{"id":32246374,"url":"https://github.com/clevercloud/clever-client.js","last_synced_at":"2026-02-18T12:00:38.099Z","repository":{"id":16844879,"uuid":"19604659","full_name":"CleverCloud/clever-client.js","owner":"CleverCloud","description":"JavaScript REST client and utils for Clever Cloud's API","archived":false,"fork":false,"pushed_at":"2026-02-10T08:54:33.000Z","size":2541,"stargazers_count":17,"open_issues_count":6,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-02-10T13:59:03.333Z","etag":null,"topics":["client","javascript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@clevercloud/client","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleverCloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-05-09T08:37:17.000Z","updated_at":"2026-02-10T08:48:09.000Z","dependencies_parsed_at":"2025-12-11T14:08:23.236Z","dependency_job_id":null,"html_url":"https://github.com/CleverCloud/clever-client.js","commit_stats":{"total_commits":449,"total_committers":12,"mean_commits":"37.416666666666664","dds":0.5857461024498887,"last_synced_commit":"15260cf1287b7606e7d216d7452788ced83fc79c"},"previous_names":[],"tags_count":162,"template":false,"template_full_name":null,"purl":"pkg:github/CleverCloud/clever-client.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fclever-client.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fclever-client.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fclever-client.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fclever-client.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleverCloud","download_url":"https://codeload.github.com/CleverCloud/clever-client.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleverCloud%2Fclever-client.js/sbom","scorecard":{"id":30592,"data":{"date":"2025-08-11","repo":{"name":"github.com/CleverCloud/clever-client.js","commit":"ec927e65744b3dc64ef5bffc012f4eb844b73790"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.1,"checks":[{"name":"Code-Review","score":5,"reason":"Found 6/11 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"17 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/CleverCloud/clever-client.js/release.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-jgmv-j7ww-jx2x","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T19:00:19.060Z","repository_id":16844879,"created_at":"2025-08-14T19:00:19.060Z","updated_at":"2025-08-14T19:00:19.060Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29578139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","javascript"],"created_at":"2025-10-22T17:17:43.560Z","updated_at":"2026-02-18T12:00:38.094Z","avatar_url":"https://github.com/CleverCloud.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript REST client and utils for Clever Cloud's API\n\n\u003e 🚧 **New Client Documentation Available**: For the new command-pattern client (beta), see [NEW_CLIENT.md](NEW_CLIENT.md)\n\n## What is this?\n\nThis project contains a REST client for Clever Cloud's API and some utils.\n\n## How do I use this?\n\nFirst, you need to install the Node.js module:\n\n```sh\nnpm install @clevercloud/client\n```\n\nAll API REST paths are accessible as \"functions\" organized in \"services\".\nA call to a function of a service will just prepare the HTTP request and return the request params in an object via a promise.\nIt won't authenticate the request and it won't send it.\n\nYou will need to chain some helpers to the function call to:\n\n* Specify the API host (prod, preprod...)\n* Add the right authentication headers (oAuth v1 or other...)\n* Send the HTTP request with your favourite lib/code\n* Handle the response with your favourite lib/code\n\nThose helpers are ready to use for browsers or Node.js and for oAuth v1 signature auth.\nThe recommended way is to wrap those helpers in one place of your app and to reuse it everywhere you need to send API calls.\n\nHere's an example using ECMAScript modules with oAuth v1 signature and using the `fetch` API to send requests.\n\nIn a file, expose this function:\n\n```js\nimport { addOauthHeader } from '@clevercloud/client/esm/oauth.js';\nimport { prefixUrl } from '@clevercloud/client/esm/prefix-url.js';\nimport { request } from '@clevercloud/client/esm/request.fetch.js';\n\nexport function sendToApi (requestParams) {\n\n  // load and cache config and tokens\n  const API_HOST = 'https://api.clever-cloud.com'\n  const tokens = {\n    OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY',\n    OAUTH_CONSUMER_SECRET: 'your OAUTH_CONSUMER_SECRET',\n    API_OAUTH_TOKEN: 'your API_OAUTH_TOKEN',\n    API_OAUTH_TOKEN_SECRET: 'your API_OAUTH_TOKEN_SECRET',\n  }\n\n  return Promise.resolve(requestParams)\n    .then(prefixUrl(API_HOST))\n    .then(addOauthHeader(tokens))\n    .then(request);\n    // chain a .catch() call here if you need to handle some errors or maybe redirect to login\n}\n```\n\nNOTE: If your project relies on a specific REST library (axios, jQuery...), you'll have to write your own request function to plug the params to your lib instead of using `request.fetch.js`.\n\nThen, in any file of your app, import the API function you need directly (it helps with tree shaking), call it and add a `.then(sendToApi)` like this:\n\n```js\nimport { getAllEnvVars } from '@clevercloud/client/esm/api/v2/application.js';\nimport { sendToApi } from '../send-to-api.js';\n\nconst envVars = await getAllEnvVars({ id: oid, appId }).then(sendToApi);\n```\n\nNOTE: It returns a promise, you may want to use `await` with it.\n\n## How can I get the oAuth configuration?\n\nA general documentation is proposed on [our Website](https://www.clever.cloud/developers/api/howto#oauth1).\nAs stated in the documentation:\n\n\u003e You need to create an oAuth consumer token in the Clever Cloud console. Click on \"Create...\", then on \"an oauth consumer\" under your organization name. All created consumers will appear under the list of applications and add-ons.\n\nOnce you got the consumer, you still need to generate the aAuth tokens. You may do the whole aAuth dance in the browser.\n\nIf you use the [clever-tools](https://github.com/CleverCloud/clever-tools) CLI, you can also generate tokens using the following command :\n\n```sh\nclever login\n```\n\nOnce successfully logged in, you’ll be provided with a token / secret couple.\n\n## Logs stream and event API stream (v2)\n\n### Retrieving logs from Clever Cloud\n\nThis stream is exposed the inner SSE source with [`component-emitter`](https://www.npmjs.com/package/component-emitter), a tiny lib implementing an API that closely match both [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) from the DOM and [`EventEmitter`](https://nodejs.org/api/events.html) from Node.js.\n\nHere's an example of how to use `LogsStream` to retrieve live logs from an app:\n\n```js\n// Browser implementation or Node.js implementation\nimport { LogsStream } from '@clevercloud/client/esm/streams/logs.browser.js';\n// import { LogsStream } from '@clevercloud/client/esm/streams/logs.node.js';\n\n// Load and cache config and tokens\nconst API_HOST = 'https://api.clever-cloud.com';\nconst tokens = {\n  OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY',\n  OAUTH_CONSUMER_SECRET: 'your OAUTH_CONSUMER_SECRET',\n  API_OAUTH_TOKEN: 'your API_OAUTH_TOKEN',\n  API_OAUTH_TOKEN_SECRET: 'your API_OAUTH_TOKEN_SECRET',\n};\n\n// Create a LogsStream instance (filter and deploymentId are optional)\nconst logsStream = new LogsStream({ apiHost: API_HOST, tokens, appId, filter, deploymentId });\n\n// Listen to \"log\" events\nlogsStream.on('log', (rawLogLine) =\u003e console.log(rawLogLine));\n\n// Open the stream\nlogsStream.open();\n```\n\n### Retrieving events from Clever Cloud\n\nThis stream is exposed the inner WebSocket source with [`component-emitter`](https://www.npmjs.com/package/component-emitter), a tiny lib implementing an API that closely match both [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) from the DOM and [`EventEmitter`](https://nodejs.org/api/events.html) from Node.js.\n\nHere's an example of how to use `EventsStream` to retrieve events from the Clever Cloud platform:\n\n```js\n// Browser and Node.js 21+ implementation\nimport { EventsStream } from '@clevercloud/client/esm/streams/events.js';\n\n// Load and cache config and tokens\nconst API_HOST = 'https://api.clever-cloud.com';\nconst tokens = {\n  OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY',\n  OAUTH_CONSUMER_SECRET: 'your OAUTH_CONSUMER_SECRET',\n  API_OAUTH_TOKEN: 'your API_OAUTH_TOKEN',\n  API_OAUTH_TOKEN_SECRET: 'your API_OAUTH_TOKEN_SECRET',\n};\n\n// Create an EventsStream instance (appId is optional)\nconst eventsStream = new EventsStream({ apiHost: API_HOST, tokens, appId });\n\n// Listen to \"event\" events\neventsStream.on('event', (rawEvent) =\u003e console.log(rawEvent));\n\n// Open the stream\neventsStream.open();\n```\n\n### Handling errors\n\nWhen an error (network failures, bad authentication...) occurs with the source stream, an error event is emitted:\n\n```js\nstream.on('error', (error) =\u003e console.error(error));\n```\n\n* By default, when a network failure is detected, an error is emitted and the stream is closed automatically.\n* If you enable the auto retry behaviour, when a network failure is detected, it won't emit an error.\n* If you enable the auto retry behaviour AND set a max number of retries, it will emit an error.\n\nSee \"auto retry behaviour\" section for more details...\n\n### Close the stream\n\nYou can close the stream at any time like this:\n\n```js\nstream.close();\n```\n\nIt won't remove event listeners from the stream instance so you can re-open it easily.\n\n### Auto retry behaviour\n\nWhen you call `.open()` on a stream, it's not resilient to network failures by default.\nWe have an opt-in auto retry behaviour to handle those, you can enable it when you open the stream like this:\n\n```js\nstream.open({ autoRetry: true });\n```\n\nNetwork failure are detected with a ping/pong system.\nWhen such a failure is detected and auto retry behaviour is enabled, the source stream is closed and a new open is attempted automatically.\n\nYou probably don't need to but you can listen to events related to this auto retry behaviour:\n\n```js\n// \"close\" event is emitted each time a network failure is detected (or any unknown error not related to authentication)\nstream.on('close', (reason) =\u003e console.log('Stream closed because of', reason));\n// \"open\" event is emitted on first .open() call and each time a new open is attempted\nstream.on('open', () =\u003e console.log('Stream open...'));\n// \"ping\" event is emitted each time a ping is received from the source stream\nstream.on('ping', () =\u003e console.log('Received ping'));\n```\n\nWhen enabled, the auto retry behaviour will follow an infinite exponential backoff pattern.\nYou can change the default timings and max number of retries like this:\n\n```js\nstream.open({\n  autoRetry: true,\n  // Factor used to compute exponential backoff delays, defaults to 1.25\n  backoffFactor: 1.5,\n  // First iteration timeout in ms, also used to compute exponential backoff delays, defaults to 1500\n  initRetryTimeout: 2000,\n  // Maximum number of consecutive iterations the auto retry behaviour can do, defaults to Infinity\n  maxRetryCount: 6,\n});\n```\n\n## Logs stream (v4)\n\n```js\nimport { ApplicationLogStream } from '@clevercloud/client/esm/streams/application-log.js';\n\n// Load and cache config and tokens\nconst API_HOST = 'https://api.clever-cloud.com';\nconst tokens = {\n  OAUTH_CONSUMER_KEY: 'your OAUTH_CONSUMER_KEY',\n  OAUTH_CONSUMER_SECRET: 'your OAUTH_CONSUMER_SECRET',\n  API_OAUTH_TOKEN: 'your API_OAUTH_TOKEN',\n  API_OAUTH_TOKEN_SECRET: 'your API_OAUTH_TOKEN_SECRET',\n};\n\n// Create an EventsStream instance (appId is optional)\nconst logsStream = new ApplicationLogStream({\n  apiHost: API_HOST,\n  tokens,\n  ownerId: 'YYY',\n  appId: 'XXX',\n  // optionnal auto retry config\n  // retryConfiguration: {\n  //   enabled: true,\n    // backoffFactor: number,\n    // initRetryTimeout: number,\n    // maxRetryCount: number,\n  // },\n  // optionnal logs request params\n  // since: Date,\n  // until: Date,\n  // service: string[],\n  // limit: number,\n  // deploymentId: string,\n  // instanceId: string[],\n  // filter: string,\n  // field: string[],\n  // throttleElements: number,\n  // throttlePerInMilliseconds: number,\n});\n\nlogsStream\n  .on('open', (event) =\u003e console.debug('stream opened!', event))\n  .on('error', (event) =\u003e console.error('error', event.error))\n  .onLog((event) =\u003e console.log(event.data.date, event.data.message));\n\nlogsStream.start();\n\n// You can also pause the stream\nlogsStream.pause();\n\n// And resume it\nlogsStream.resume();\n```\n\n## License\n\nThis project is licensed under the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevercloud%2Fclever-client.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclevercloud%2Fclever-client.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclevercloud%2Fclever-client.js/lists"}