@quatrain/queue-gcp 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ # LICENSE UPDATE NOTICE
2
+
3
+ As of 01/01/2026, Quatrain Core is licensed under the **GNU Affero General Public License v3.0 (AGPL v3)**.
4
+ Previous versions remain under the MIT License.
5
+
6
+ ## Why AGPL?
7
+
8
+ We believe in open collaboration for the development ecosystem. The AGPL ensures that any modification or deployment of this BaaS stack, including over a network, benefits the entire community.
9
+
10
+ ## Commercial Services & Enterprise Usage
11
+
12
+ We provide official deployment services, technical training, and certification for Quatrain Core.
13
+ For organizations requiring a non-copyleft license (commercial license) or custom proprietary integrations, please contact the copyright holder: **Quatrain Technologies**.
14
+
15
+ Copyright © 2024-2026 Quatrain Technologies. All Rights Reserved.
package/package.json CHANGED
@@ -1,42 +1,40 @@
1
1
  {
2
- "name": "@quatrain/queue-gcp",
3
- "version": "1.1.12",
4
- "description": "Queue adapter for Google Cloud Platform PubSub",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": [
8
- "lib/",
9
- "README.md"
10
- ],
11
- "author": "Quatrain Développement SAS <developers@quatrain.com>",
12
- "license": "MIT",
13
- "devDependencies": {
14
- "@tsconfig/recommended": "^1.0.1",
15
- "@types/fs-extra": "^11.0.4",
16
- "@types/jest": "^27.0.3",
17
- "@types/node": "^22.10.1",
18
- "@types/object-hash": "^3.0.6",
19
- "jest": "^27.4.7",
20
- "jest-node-exports-resolver": "^1.1.6",
21
- "trace-unhandled": "^2.0.1",
22
- "ts-jest": "^27.1.2",
23
- "ts-node": "^10.4.0",
24
- "typescript": "^5.1.5"
25
- },
26
- "dependencies": {
27
- "@google-cloud/pubsub": "^4.7.0",
28
- "@quatrain/core": "^1.1.15",
29
- "@quatrain/queue": "^1.1.12"
30
- },
31
- "scripts": {
32
- "test-ci": "jest --runInBand",
33
- "build": "tsc",
34
- "wbuild": "tsc --watch",
35
- "bump-to": "yarn version",
36
- "hash": "node ../../bin/hashFolder.js",
37
- "hash:persist": "yarn hash > .hash_latest.txt",
38
- "hash:compare": "yarn hash > .hash_newest.txt && cmp -s .hash_latest.txt .hash_newest.txt",
39
- "publish": "yarn hash:compare || yarn publish:process",
40
- "publish:process": "yarn version patch && yarn build && yarn npm publish --access public && yarn hash:persist"
41
- }
42
- }
2
+ "name": "@quatrain/queue-gcp",
3
+ "version": "1.1.13",
4
+ "description": "Queue adapter for Google Cloud Platform PubSub",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "bun": "src/index.ts",
8
+ "files": [
9
+ "LICENSE.md",
10
+ "src/",
11
+ "lib/",
12
+ "README.md"
13
+ ],
14
+ "author": "Quatrain Développement SAS <developers@quatrain.com>",
15
+ "license": "AGPL-3.0-only",
16
+ "devDependencies": {
17
+ "@tsconfig/recommended": "^1.0.1",
18
+ "@types/fs-extra": "^11.0.4",
19
+ "@types/jest": "^27.0.3",
20
+ "@types/node": "^22.10.1",
21
+ "@types/object-hash": "^3.0.6",
22
+ "jest": "^30.2.0",
23
+ "jest-node-exports-resolver": "^1.1.6",
24
+ "trace-unhandled": "^2.0.1",
25
+ "ts-jest": "^27.1.2",
26
+ "ts-node": "^10.4.0",
27
+ "typescript": "^5.1.5"
28
+ },
29
+ "dependencies": {
30
+ "@google-cloud/pubsub": "^4.7.0",
31
+ "@quatrain/core": "^1.1.43",
32
+ "@quatrain/queue": "^1.1.20"
33
+ },
34
+ "scripts": {
35
+ "test-ci": "jest --runInBand",
36
+ "build": "tsc",
37
+ "wbuild": "tsc --watch",
38
+ "bump-to": "yarn version"
39
+ }
40
+ }
@@ -0,0 +1,28 @@
1
+ import { Core } from '@quatrain/core'
2
+ import { AbstractQueueAdapter, QueueParameters } from '@quatrain/queue'
3
+ import { PubSub } from '@google-cloud/pubsub'
4
+
5
+ export class PubSubQueueAdapter extends AbstractQueueAdapter {
6
+ constructor(params: QueueParameters) {
7
+ super(params)
8
+ const { projectId, keyFilename } = (params.config as any) || {}
9
+
10
+ this._client = new PubSub({
11
+ projectId,
12
+ keyFilename,
13
+ })
14
+ }
15
+
16
+ async send(data: any, topic: string): Promise<string> {
17
+ const dataBuffer = Buffer.from(JSON.stringify(data))
18
+ const messageId = await this._client.topic(topic).publish(dataBuffer)
19
+
20
+ Core.log(`[Pubsub] Sending message to ${topic}`)
21
+
22
+ return messageId
23
+ }
24
+
25
+ listen(topic: string) {
26
+ return this._client.topic(topic).onPublish()
27
+ }
28
+ }