diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 0d83b0b1..00000000 --- a/.codecov.yml +++ /dev/null @@ -1,21 +0,0 @@ -codecov: - max_report_age: off - -comment: false - -coverage: - precision: 2 - round: down - status: - project: - default: - threshold: 0.2 - if_not_found: success - patch: - default: - enabled: no - if_not_found: success - changes: - default: - enabled: no - if_not_found: success diff --git a/.commitlintrc.yml b/.commitlintrc.yml new file mode 100644 index 00000000..c7059727 --- /dev/null +++ b/.commitlintrc.yml @@ -0,0 +1,12 @@ +extends: + - '@commitlint/config-lerna-scopes' + - '@commitlint/config-conventional' +rules: + subject-case: + - 0 + - always + - 'sentence-case' + header-case: + - 0 + - always + - 'sentence-case' diff --git a/.eslintrc.yml b/.eslintrc.yml index c440d70e..ed4cb1b0 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -12,9 +12,12 @@ extends: parser: '@typescript-eslint/parser' -parserOptions: - project: tsconfig.eslint.json - sourceType: module +ignorePatterns: + - node_modules/ + - dist/ + - '**/rollup.config.js' + - '**/scripts/*.ts' + - '*d.ts' plugins: - '@typescript-eslint' @@ -24,18 +27,18 @@ rules: import/no-default-export: error import/prefer-default-export: off '@typescript-eslint/explicit-function-return-type': off - -overrides: - - files: - - 'test/**/*.ts' - rules: - import/no-unresolved: 0 + import/no-extraneous-dependencies: + - error + - devDependencies: + - '**/test/**/*.ts' + import/extensions: + - error + - never + - json: always settings: import/resolver: node: extensions: - .js - - .jsx - .ts - - .tsx diff --git a/.github/ASSETS/header.svg b/.github/ASSETS/header.svg new file mode 100644 index 00000000..b7fd2339 --- /dev/null +++ b/.github/ASSETS/header.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.github/ASSETS/logo.svg b/.github/ASSETS/logo.svg new file mode 100644 index 00000000..12b441e4 --- /dev/null +++ b/.github/ASSETS/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.github/ASSETS/thumbnail.png b/.github/ASSETS/thumbnail.png new file mode 100644 index 00000000..c884d720 Binary files /dev/null and b/.github/ASSETS/thumbnail.png differ diff --git a/.gitignore b/.gitignore index ae8bc167..b93e97ff 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ coverage .rpt2_cache .idea .DS_Store -temp +yarn-error.log \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..a8e0bbe3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,127 @@ +default: + image: node:lts-alpine + +# Cache modules in between jobs +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - packages/gitbeaker-core/node_modules/ + - packages/gitbeaker-cli/node_modules/ + - packages/gitbeaker-browser/node_modules/ + - packages/gitbeaker-node/node_modules/ + - packages/gitbeaker-requester-utils/node_modules/ + - node_modules/ + +stages: + - install + - build + - lint + - test + - release + +#Link and Install all required dependancies +install: + image: node:lts + stage: install + script: + - yarn + +# Build core (cjs, es, and browser) and cli packages +# Uses work around to allow for linking of the cli packages +build: + stage: build + script: + - yarn build + artifacts: + paths: + - packages/gitbeaker-core/dist/ + - packages/gitbeaker-cli/dist/ + - packages/gitbeaker-browser/dist/ + - packages/gitbeaker-node/dist/ + - packages/gitbeaker-requester-utils/dist/ + +# Lint all code, tests and supporting documentation (README, CHANGELOG etc) +lint:src: + stage: lint + script: yarn lint + +lint:docs: + stage: lint + script: yarn lint:doc + +# Test packages and builds +test:core:unit: + stage: test + script: yarn jest core/test/unit && yarn codecov -F core + +test:node:unit: + stage: test + script: yarn jest node/test/unit && yarn codecov -F node + +test:browser:unit: + stage: test + script: yarn jest browser/test/unit && yarn codecov -F browser + +test:utils:unit: + stage: test + script: yarn jest utils/test/unit && yarn codecov -F utils + +# test:core:integration: &integration +# image: +# name: docker/compose:latest +# entrypoint: ['/bin/sh', '-c'] +# variables: +# DOCKER_HOST: tcp://docker:2375 +# GITLAB_URL: http://docker:8080 +# services: +# - docker:dind +# stage: test +# before_script: +# # Install docker compose +# - apk add --no-cache nodejs yarn git + +# # Spin up container +# - cd scripts +# - docker-compose -f docker-compose.yml up -d + +# # Verify Gitlab instance is up and running +# - node probe.js + +# # Get the personal token +# - export PERSONAL_ACCESS_TOKEN=$(docker exec -i gitlab sh -c 'gitlab-rails r /mnt/init.rb') + +# - cd .. +# - echo $PERSONAL_ACCESS_TOKEN +# - echo $GITLAB_URL +# - echo $CODECOV_TOKEN +# script: yarn jest core/test/integration --runInBand && yarn codecov -F core + +# test:cli:integration: +# <<: *integration +# script: yarn jest core/test/integration --runInBand && yarn codecov + +# test:cli:integration:dist: +# <<: *integration +# script: yarn jest core/test/integration --runInBand && yarn codecov + +# test:core:integration:dist-cjs: +# <<: *integration +# script: yarn jest core/test/integration --runInBand --moduleNameMapper="{dist:dist/index.es.js}" + +# test:core:integration:dist-es +# <<: *integration +# script: yarn jest core/test/integration --runInBand --moduleNameMapper="{dist:dist/index.es.js}" + +# test:core:integration:browser: +# <<: *integration +# script: npm run test:integration -- --scope=core --moduleNameMapper="{dist:dist/index.umd.js}" && codecov + +# Release +release: + only: + refs: + - master + stage: release + before_script: + - apk add --no-cache git + script: yarn release diff --git a/.huskyrc.yml b/.huskyrc.yml index 121c224e..ff38f4d7 100644 --- a/.huskyrc.yml +++ b/.huskyrc.yml @@ -1,2 +1,3 @@ hooks: pre-commit: 'lint-staged' + commit-msg: 'commitlint -E HUSKY_GIT_PARAMS' diff --git a/.lintstagedrc.yml b/.lintstagedrc.yml index edbb7d0b..6c67790c 100644 --- a/.lintstagedrc.yml +++ b/.lintstagedrc.yml @@ -1,7 +1,4 @@ -'*.{ts, !(generate).ts}': +'*.{ts,js,json,md,yml}': - 'prettier --write' +'*.{ts,js}': - 'eslint --fix' - - 'git add' -'*.{json, md, yml, js}': - - 'prettier --write' - - 'git add' diff --git a/.releaserc.yml b/.releaserc.yml index e93d0556..7fe3cdd3 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -1,9 +1,15 @@ tagFormat: '${version}' -verifyConditions: +plugins: + - '@semantic-release/commit-analyzer' + - '@semantic-release/release-notes-generator' - '@semantic-release/changelog' - - '@semantic-release/npm' - - '@semantic-release/git' -prepare: - - '@semantic-release/changelog' - - '@semantic-release/npm' - - '@semantic-release/git' + - - 'semantic-release-npmx' + - access: 'public' + - '@semantic-release/github' + - - '@semantic-release/git' + - message: "chore: Release 🚀 ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + assets: + - 'CHANGELOG.md' + - '*.lock' + - - '**/package.json' + - '!**/node_modules/**/package.json' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e24e7c76..00000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -language: node_js - -stages: - - lint - - test - - release - -notifications: - email: false - -env: - - GITLAB_URL=http://localhost:8080 - -jobs: - include: - - stage: lint - node_js: node - script: - - npm run lint - - prettier --check './*.json' './*.yml' - - - &test-unit - stage: test - name: Unit Test LFS - node_js: lts/* - before_script: - - npm run build - - npm link - script: - - npm run test:unit - - - <<: *test-unit - name: Unit Test Latest - node_js: node - script: - - npm run test:unit -- --coverage - after_success: - - npm run coverage - - - &test-integration - stage: test - name: Integration Test LFS - node_js: lts/* - before_script: - - cd test/docker/ - - # Spin up container - - docker-compose -f docker-compose.test.yml up -d - - # Verify Gitlab instance is up and running - - node test_readiness.js - - # Get the personal token - - export PERSONAL_ACCESS_TOKEN=$(docker exec -it gitlab bash -lc 'printf "%q" "$(gitlab-rails r /tmp/init_data.rb)"') - - # Display configuration - - echo $PERSONAL_ACCESS_TOKEN - - # Build library - - npm run build - - npm link - script: - - npm run test:integration - - - <<: *test-integration - name: Integration Test Latest - node_js: node - script: - - npm run test:integration -- --coverage - after_success: - - npm run coverage - - - stage: release - node_js: node - before_script: - - npm run build - script: - - npm run release diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c7227d..23961145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,86 +1,73 @@ ## [14.2.2](https://github.com/jdalrymple/node-gitlab/compare/14.2.1...14.2.2) (2020-01-30) - ### Bug Fixes -* Incorrect request method in MergeRequests.approvalState() method ([#586](https://github.com/jdalrymple/node-gitlab/issues/586)) ([cb5f822](https://github.com/jdalrymple/node-gitlab/commit/cb5f8228ca1f64cc55b79e1ef475c3d49568267a)) +- Incorrect request method in MergeRequests.approvalState() method ([#586](https://github.com/jdalrymple/node-gitlab/issues/586)) ([cb5f822](https://github.com/jdalrymple/node-gitlab/commit/cb5f8228ca1f64cc55b79e1ef475c3d49568267a)) ## [14.2.1](https://github.com/jdalrymple/node-gitlab/compare/14.2.0...14.2.1) (2020-01-20) - ### Bug Fixes -* added file extension for dummy file name in project import ([#561](https://github.com/jdalrymple/node-gitlab/issues/561)) ([f45cb68](https://github.com/jdalrymple/node-gitlab/commit/f45cb68498b54a2ad1ab1371589d0152d76adf11)), closes [/gitlab.com/gitlab-org/gitlab-foss/issues/50944#note_101737263](https://github.com//gitlab.com/gitlab-org/gitlab-foss/issues/50944/issues/note_101737263) +- added file extension for dummy file name in project import ([#561](https://github.com/jdalrymple/node-gitlab/issues/561)) ([f45cb68](https://github.com/jdalrymple/node-gitlab/commit/f45cb68498b54a2ad1ab1371589d0152d76adf11)), closes [/gitlab.com/gitlab-org/gitlab-foss/issues/50944#note_101737263](https://github.com//gitlab.com/gitlab-org/gitlab-foss/issues/50944/issues/note_101737263) # [14.2.0](https://github.com/jdalrymple/node-gitlab/compare/14.1.1...14.2.0) (2020-01-17) - ### Features -* Adding support for merge_requests in the Deployments API ([911078b](https://github.com/jdalrymple/node-gitlab/commit/911078bba30145a98ba051e672963dbbe8816a6a)), closes [#554](https://github.com/jdalrymple/node-gitlab/issues/554) +- Adding support for merge_requests in the Deployments API ([911078b](https://github.com/jdalrymple/node-gitlab/commit/911078bba30145a98ba051e672963dbbe8816a6a)), closes [#554](https://github.com/jdalrymple/node-gitlab/issues/554) ## [14.1.1](https://github.com/jdalrymple/node-gitlab/compare/14.1.0...14.1.1) (2020-01-03) - ### Bug Fixes -* resourceDiscussions.editNote add content params, and allowed discussionId to accept a string type ([#524](https://github.com/jdalrymple/node-gitlab/issues/524)) ([22d916a](https://github.com/jdalrymple/node-gitlab/commit/22d916a05fdf2f4361fa2e9d17fdd8784ed6bfb3)) +- resourceDiscussions.editNote add content params, and allowed discussionId to accept a string type ([#524](https://github.com/jdalrymple/node-gitlab/issues/524)) ([22d916a](https://github.com/jdalrymple/node-gitlab/commit/22d916a05fdf2f4361fa2e9d17fdd8784ed6bfb3)) # [14.1.0](https://github.com/jdalrymple/node-gitlab/compare/14.0.1...14.1.0) (2019-12-30) - ### Bug Fixes -* make ResourceMembers.all/show delivery correct options params ([#521](https://github.com/jdalrymple/node-gitlab/issues/521)) ([505b407](https://github.com/jdalrymple/node-gitlab/commit/505b4072f3441440fd4903089d83d000e701e84c)), closes [#518](https://github.com/jdalrymple/node-gitlab/issues/518) - +- make ResourceMembers.all/show delivery correct options params ([#521](https://github.com/jdalrymple/node-gitlab/issues/521)) ([505b407](https://github.com/jdalrymple/node-gitlab/commit/505b4072f3441440fd4903089d83d000e701e84c)), closes [#518](https://github.com/jdalrymple/node-gitlab/issues/518) ### Features -* Added support for the Vulnerability Findings API ([#517](https://github.com/jdalrymple/node-gitlab/issues/517)) ([497bf94](https://github.com/jdalrymple/node-gitlab/commit/497bf948d97d58dbe0bc2f57c47c92d646a29790)) +- Added support for the Vulnerability Findings API ([#517](https://github.com/jdalrymple/node-gitlab/issues/517)) ([497bf94](https://github.com/jdalrymple/node-gitlab/commit/497bf948d97d58dbe0bc2f57c47c92d646a29790)) ## [14.0.1](https://github.com/jdalrymple/node-gitlab/compare/14.0.0...14.0.1) (2019-12-23) - ### Bug Fixes -* Adding back functionality for rejectUnauthorized http option ([#502](https://github.com/jdalrymple/node-gitlab/issues/502)) ([0f17bed](https://github.com/jdalrymple/node-gitlab/commit/0f17bedc0b6ec82793d5f7e6f9c3f53b030a642e)) +- Adding back functionality for rejectUnauthorized http option ([#502](https://github.com/jdalrymple/node-gitlab/issues/502)) ([0f17bed](https://github.com/jdalrymple/node-gitlab/commit/0f17bedc0b6ec82793d5f7e6f9c3f53b030a642e)) # [14.0.0](https://github.com/jdalrymple/node-gitlab/compare/13.0.0...14.0.0) (2019-12-21) - ### Bug Fixes -* Typing on GPGKey method arguments was missing ([#514](https://github.com/jdalrymple/node-gitlab/issues/514)) ([234c9a7](https://github.com/jdalrymple/node-gitlab/commit/234c9a75db9be752e6d4febee171e3b44be6a30a)) -* Typing on Group and Project variable keys was incorrect [#512](https://github.com/jdalrymple/node-gitlab/issues/512) ([#515](https://github.com/jdalrymple/node-gitlab/issues/515)) ([c7afca5](https://github.com/jdalrymple/node-gitlab/commit/c7afca523160ac19707d0207b9892a81b799e645)) - +- Typing on GPGKey method arguments was missing ([#514](https://github.com/jdalrymple/node-gitlab/issues/514)) ([234c9a7](https://github.com/jdalrymple/node-gitlab/commit/234c9a75db9be752e6d4febee171e3b44be6a30a)) +- Typing on Group and Project variable keys was incorrect [#512](https://github.com/jdalrymple/node-gitlab/issues/512) ([#515](https://github.com/jdalrymple/node-gitlab/issues/515)) ([c7afca5](https://github.com/jdalrymple/node-gitlab/commit/c7afca523160ac19707d0207b9892a81b799e645)) ### BREAKING CHANGES -* The title property is not required for the add method. +- The title property is not required for the add method. # [13.0.0](https://github.com/jdalrymple/node-gitlab/compare/12.1.0...13.0.0) (2019-12-09) - ### Features -* Adding ability to get a singular member of a project or group, including inheritedMemebrs ([#508](https://github.com/jdalrymple/node-gitlab/issues/508)) ([807171c](https://github.com/jdalrymple/node-gitlab/commit/807171c3ff29977e8f6f5faa9603c550334c2192)), closes [#507](https://github.com/jdalrymple/node-gitlab/issues/507) - +- Adding ability to get a singular member of a project or group, including inheritedMemebrs ([#508](https://github.com/jdalrymple/node-gitlab/issues/508)) ([807171c](https://github.com/jdalrymple/node-gitlab/commit/807171c3ff29977e8f6f5faa9603c550334c2192)), closes [#507](https://github.com/jdalrymple/node-gitlab/issues/507) ### BREAKING CHANGES -* Updated the Members.all function to have the inheritedMembers option to be in the optional object. +- Updated the Members.all function to have the inheritedMembers option to be in the optional object. # [12.1.0](https://github.com/jdalrymple/node-gitlab/compare/12.0.1...12.1.0) (2019-12-05) - ### Bug Fixes -* Removing required options object in a few of the API methods ([#505](https://github.com/jdalrymple/node-gitlab/issues/505)) ([b709ef6](https://github.com/jdalrymple/node-gitlab/commit/b709ef6716d15368c8775d77e5eb0cf22d6369a7)) - +- Removing required options object in a few of the API methods ([#505](https://github.com/jdalrymple/node-gitlab/issues/505)) ([b709ef6](https://github.com/jdalrymple/node-gitlab/commit/b709ef6716d15368c8775d77e5eb0cf22d6369a7)) ### Features -* Add Group/File schemas ([#506](https://github.com/jdalrymple/node-gitlab/issues/506)) ([f467816](https://github.com/jdalrymple/node-gitlab/commit/f467816070bffcd3776e5dc3e6074c92bf6d644e)) +- Add Group/File schemas ([#506](https://github.com/jdalrymple/node-gitlab/issues/506)) ([f467816](https://github.com/jdalrymple/node-gitlab/commit/f467816070bffcd3776e5dc3e6074c92bf6d644e)) ## [12.0.1](https://github.com/jdalrymple/node-gitlab/compare/12.0.0...12.0.1) (2019-11-27) diff --git a/LICENSE.md b/LICENSE.md index 70d5c069..3b8b9fbb 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ # The MIT License Copyright (c) -**2019 Justin Dalrymple** +**2020 Justin Dalrymple** Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 7a3b3e33..91f1a569 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,48 @@ -[![npm @latest](https://img.shields.io/npm/v/gitlab.svg)](https://www.npmjs.com/package/gitlab) -[![npm downloads](https://img.shields.io/npm/dt/gitlab.svg)](https://www.npmjs.com/package/gitlab) -[![dependencies Status](https://david-dm.org/jdalrymple/node-gitlab/status.svg)](https://david-dm.org/jdalrymple/node-gitlab) -[![devDependencies Status](https://david-dm.org/jdalrymple/node-gitlab/dev-status.svg)](https://david-dm.org/jdalrymple/node-gitlab?type=dev) -[![Greenkeeper badge](https://badges.greenkeeper.io/jdalrymple/node-gitlab.svg)](https://greenkeeper.io/) -[![Code Climate](https://codeclimate.com/github/jdalrymple/node-gitlab/badges/gpa.svg)](https://codeclimate.com/github/jdalrymple/node-gitlab) -[![Build Status](https://img.shields.io/travis/jdalrymple/node-gitlab/master.svg)](https://travis-ci.org/jdalrymple/node-gitlab) -[![Coverage](https://img.shields.io/codecov/c/github/jdalrymple/node-gitlab/master.svg)](https://codecov.io/gh/jdalrymple/node-gitlab) -[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -[![Code Style: Prettier](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg) -[![Install Size](https://packagephobia.now.sh/badge?p=gitlab)](https://packagephobia.now.sh/result?p=gitlab) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jdalrymple/node-gitlab/blob/master/LICENSE.md) - -# node-gitlab +
+
+ gitbeaker +
+
+

+ + Gitlab Pipeline Status + + + Code Climate maintainability + + + CodeCov test coverage + + + Dependency Status + + + Dev Dependency Status + + Dependabot Badge + + Semantic Release + + + Commitizen + + Prettier + + Install Size: Core + + + Install Size: Node + + + Install Size: Browser + + + Install Size: CLI + + + Licence: MIT + +

🤖 [GitLab](https://gitlab.com/gitlab-org/gitlab/) API NodeJS library with full support of all the [Gitlab API](https://gitlab.com/gitlab-org/gitlab/tree/master/doc/api) services. @@ -40,23 +70,42 @@ ```bash # Install from npm -npm install gitlab +npm install @gitbeaker/node # NodeJS default, index.es.js for esm + +npm install @gitbeaker/browser # UMD default + +npm install @gitbeaker/cli # CLI + ``` ## Getting Started -Instantiate the library using a basic token created in your [Gitlab Profile](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) +**NodeJS** ```javascript // ES6 (>=node 10.16.0 LTS) -import { Gitlab } from 'gitlab'; // All Resources -import { Projects } from 'gitlab'; // Just the Project Resource +import { Gitlab } from '@gitbeaker/node'; // All Resources +import { Projects } from '@gitbeaker/node'; // Just the Project Resource //...etc // ES5, assuming native or polyfilled Promise is available -const { Gitlab } = require('gitlab'); +const { Gitlab } = require('@gitbeaker/node'); ``` +**Browser** + +```javascript +// ES6 (>=node 10.16.0 LTS) +import { Gitlab } from '@gitbeaker/browser'; // All Resources +import { Projects } from '@gitbeaker/browser'; // Just the Project Resource +//...etc + +// ES5, assuming native or polyfilled Promise is available +const { Gitlab } = require('@gitbeaker/browser'); +``` + +Instantiate the library using a basic token created in your [Gitlab Profile](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html) + ```javascript const api = new Gitlab({ token: 'personaltoken', @@ -65,46 +114,47 @@ const api = new Gitlab({ Available instantiating options: -| Name | Optional | Default | Description | -| -------------------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL | -| `token` | No\* | N/A | Personal Token. Required (one of the three tokens are required) | -| `oauthToken` | No\* | N/A | OAuth Token. Required (one of the three tokens are required) | -| `jobToken` | No\* | N/A | CI Job Token. Required (one of the three tokens are required) | -| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to HTTPS hosts urls | -| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/ee/api/#sudo) query parameter | -| `version` | Yes | `4` | API Version ID | -| `camelize` | Yes | `false` | Camelizes all response body keys | -| `requester` | Yes | [KyRequester.ts](./src/infrastructure/KyRequester.ts) | Request Library Wrapper. Currently wraps Ky. | -| `requestTimeout` | Yes | `300000` | Request Library Timeout in ms | -| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | -| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | +| Name | Optional | Default | Description | +| -------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL | +| `token` | No\* | N/A | Personal Token. Required (one of the three tokens are required) | +| `oauthToken` | No\* | N/A | OAuth Token. Required (one of the three tokens are required) | +| `jobToken` | No\* | N/A | CI Job Token. Required (one of the three tokens are required) | +| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to HTTPS hosts urls | +| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/ee/api/#sudo) query parameter | +| `version` | Yes | `4` | API Version ID | +| `camelize` | Yes | `false` | Camelizes all response body keys | +| `requester` | Yes\* | For @gitbeaker/node and @gitbeaker/cli, it uses a Got based requester, for @gitbeaker/browser, it uses a ky based requester. The @gitbeaker/core package **does not** have a default and thus must be set explicitly | Request Library Wrapper | +| `requestTimeout` | Yes | `300000` | Request Library Timeout in ms | +| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | +| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html) | ### CLI Support The CLI export functions in a similar manner, following the pattern: ```bash -gitlab [service name] [method name] --arg1 --arg2 --arg3 +gitbeaker [service name] [method name] --arg1 --arg2 --arg3 ``` Where `service name` is any of the supported API names, `method name` is any of the supported commands on that API service (See source for exceptions, but generally all, show, remove, update) and `--arg1...--arg3` are any of the arguments you would normally supply to the function. The names of the args should match the names in the method headers **EXCEPT** all the optional arguments whose names should match what the GitLab API docs request. -There is one small exception with the instantiating arguments, however, which must be supplied using a `gl` prefix. ie. +There is one small exception with the instantiating arguments, however, which must be supplied using a `gb` or `gl` prefix. ie. ```bash # To get all the projects -gitlab projects all --gl-token="personaltoken" +gitbeaker projects all --gb-token="personaltoken" # To get a project with id = 2 -gitlab projects show --gl-token="personaltoken" --projectId=2 +gitbeaker projects show --gl-token="personaltoken" --projectId=2 ``` -To reduce the annoyance of having to pass those configuration properties each time, it is also possible to pass the token and host information through environment variables in the form of `GITLAB_[option name]` ie: +To reduce the annoyance of having to pass those configuration properties each time, it is also possible to pass the token and host information through environment variables in the form of `GITLAB_[option name]` or `GITBEAKER_[option name]` ie: ```bash GITLAB_HOST=http://example.com GITLAB_TOKEN=personaltoken +GITBEAKER_CAMELIZE=true ``` This could be set globally or using a [.env](https://github.com/motdotla/dotenv#readme) file in the project folder. @@ -114,7 +164,7 @@ This could be set globally or using a [.env](https://github.com/motdotla/dotenv# The library is exported as `gitlab` and can be used by simply adding this script to your html file: ```html -