{"id":17655946,"url":"https://github.com/sagi/workers-pubsub","last_synced_at":"2025-09-06T04:30:56.888Z","repository":{"id":42996538,"uuid":"196069305","full_name":"sagi/workers-pubsub","owner":"sagi","description":"Google Pub/Sub API for Cloudflare Workers (and Node.js)","archived":false,"fork":false,"pushed_at":"2024-07-05T05:52:52.000Z","size":434,"stargazers_count":34,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-18T03:26:39.084Z","etag":null,"topics":["api","cloudflare-workers","google-pubsub","pubsub"],"latest_commit_sha":null,"homepage":"https://sagi.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-09T19:17:27.000Z","updated_at":"2025-03-23T11:35:43.000Z","dependencies_parsed_at":"2023-07-18T16:21:39.024Z","dependency_job_id":"cf1f971d-cfc9-4311-8aa0-d6df3116ad94","html_url":"https://github.com/sagi/workers-pubsub","commit_stats":null,"previous_names":["sagi/cfw-pubsub"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sagi/workers-pubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fworkers-pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fworkers-pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fworkers-pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fworkers-pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagi","download_url":"https://codeload.github.com/sagi/workers-pubsub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagi%2Fworkers-pubsub/sbom","scorecard":{"id":795057,"data":{"date":"2025-08-11","repo":{"name":"github.com/sagi/workers-pubsub","commit":"cddc27303430b69242231a1e3413113c31b984e8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"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":"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 2/12 approved changesets -- score normalized to 1","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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"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":"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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 20 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":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-23T08:42:22.078Z","repository_id":42996538,"created_at":"2025-08-23T08:42:22.078Z","updated_at":"2025-08-23T08:42:22.078Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273858541,"owners_count":25180763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api","cloudflare-workers","google-pubsub","pubsub"],"created_at":"2024-10-23T13:09:14.304Z","updated_at":"2025-09-06T04:30:56.511Z","avatar_url":"https://github.com/sagi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# workers-pubsub\n\n[`@sagi.io/workers-pubsub`](https://www.npmjs.com/package/@sagi.io/workers-pubsub) is a Google Pub/Sub REST API for Cloudflare Workers (can also be used with Node).\n\n⭐ We use it at **[OpenSay](https://opensay.co/?s=workers-pubsub)** to efficiently access Google's PubSub REST API with 1 round trip.\n\n[![CircleCI](https://circleci.com/gh/sagi/workers-pubsub.svg?style=svg\u0026circle-token=88da6b4a2a6ad3055418fb0b9da327d7fff9a99a)](https://circleci.com/gh/sagi/workers-pubsub)\n[![Coverage Status](https://coveralls.io/repos/github/sagi/workers-pubsub/badge.svg)](https://coveralls.io/github/sagi/workers-pubsub)\n[![MIT License](https://img.shields.io/npm/l/@sagi.io/workers-pubsub.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![version](https://img.shields.io/npm/v/@sagi.io/workers-pubsub.svg?style=flat-square)](http://npm.im/@sagi.io/workers-pubsub)\n\n## Installation\n\n~~~\n$ npm i @sagi.io/workers-pubsub\n~~~\n\n## API\n\nWe follow [Google's Pub/Sub REST API](https://cloud.google.com/pubsub/docs/reference/rest/) specification. We'll add more methods if there's demand.\n\nSee below for concrete examples for Cloudflare Workers and Node.js.\n\n### **`PubSubREST({ ... })`**\n\nInstantiates `PubSub` instance.\n\nFunction definition:\n\n```js\n const PubSubREST = async ({\n  serviceAccountJSON,\n  cryptoImpl = null,\n  fetchImpl = null,\n}) =\u003e { ... }\n```\nWhere:\n\n  - **`serviceAccountJSON`** *required* Is a Google Cloud service account with a **Pub/Sub Admin** role. An object.\n  - **`cryptoImpl`** *optional* Not needed when running on Cloudflare Workers. See concrete example below for how to use it with Node.js.\n  - **`fetchImpl`** *optional* Not needed when running on Cloudflare Workers. See concrete example below for how to use it with Node.js.\n\n### **`PubSub.topics.publish({ ... })`**\n\nPublishes a message to a topic.\n\nFunction definition:\n\n```js\nconst publish = ({ topic, messages } = {}) =\u003e { ... }\n```\nWhere:\n\n  - **`topic`** *required* The topic to send messages to.\n  - **`messages`** *required* an array of [Pub/Sub messages](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage). You can use the `PubSub.helpers.createPubSubMessage` method to easily create a Pub/Sub message.\n\n### **`PubSub.topics.list({ ... })`**\n\nLists all topics.\n\n### **`PubSub.helpers.createPubSubMessage({ ... })`**\nHelps create a PubSub message easily.\n\nFunction definition:\n\n```js\nconst createPubSubMessage = ({ message = '', attributes = undefined } = {}) =\u003e { ... }\n```\nWhere:\n\n  - **`message`** *optional* A message string. e.g. `Hello World`.\n  - **`attributes`** *optional* An object with string values. e.g. `{ type: 'slack-poll' }`.\n  - **`ordering_key`** *optional* An ordering key to allow subscribers to receive messages in order in the same region. [Read more here](https://cloud.google.com/pubsub/docs/publisher#using_ordering_keys).\n\nReturns a [Pub/Sub message](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage).\n\n## Cloudflare Workers Example\n\n~~~js\nimport base64url from 'base64url'\nimport PubSubREST from '@sagi.io/workers-pubsub'\n\nconst serviceAccountJSON = ...\n\nconst PubSub = await PubSubREST({ serviceAccountJSON })\n\nconst topic = 'gcf-task'\nconst psMessage = PubSub.helpers.createPubSubMessage({ message: 'Hello World!' })\nconst messages = [ psMessage ]\n\nawait PubSub.topics.publish({ topic, messages })\n~~~\n\n## Node.js Example\n\n~~~js\nimport fetchImpl from 'cross-fetch'\nimport { Crypto }from 'node-webcrypto-ossl'\nimport PubSubREST from '@sagi.io/workers-pubsub'\n\nconst cryptoImpl = new Crypto()\n\nconst serviceAccountJSON = ...\n\nconst PubSub = await PubSubREST({ serviceAccountJSON, cryptoImpl. fetchImpl })\n\nconst topic = 'gcf-task'\nconst psMessage = PubSub.helpers.createPubSubMessage({ message: 'Hello World!' })\nconst messages = [ psMessage ]\n\nawait PubSub.topics.publish({ topic, messages })\n~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagi%2Fworkers-pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagi%2Fworkers-pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagi%2Fworkers-pubsub/lists"}