@palmetto/nestjs-pubsub 3.1.0 → 3.2.1
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/README.md +6 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +3 -1
- package/dist/pubsub-gcppubsub-module.d.ts +8 -0
- package/dist/pubsub-gcppubsub-module.js +57 -0
- package/dist/subscriber.d.ts +2 -1
- package/dist/subscriber.js +2 -1
- package/package.json +5 -4
package/README.md
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./pubsub-module.js";
|
|
2
2
|
export * from "./pubsub-bullmq-module.js";
|
|
3
3
|
export * from "./pubsub-rabbitmq-module.js";
|
|
4
|
-
export
|
|
4
|
+
export * from "./pubsub-gcppubsub-module.js";
|
|
5
|
+
export { type HandlerMethod, PubSubBullMqSubscriber, PubSubRabbitSubscriber, PubSubGcpSubscriber, } from "./subscriber.js";
|
package/dist/main.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PubSubRabbitSubscriber = exports.PubSubBullMqSubscriber = void 0;
|
|
17
|
+
exports.PubSubGcpSubscriber = exports.PubSubRabbitSubscriber = exports.PubSubBullMqSubscriber = void 0;
|
|
18
18
|
__exportStar(require("./pubsub-module.js"), exports);
|
|
19
19
|
__exportStar(require("./pubsub-bullmq-module.js"), exports);
|
|
20
20
|
__exportStar(require("./pubsub-rabbitmq-module.js"), exports);
|
|
21
|
+
__exportStar(require("./pubsub-gcppubsub-module.js"), exports);
|
|
21
22
|
var subscriber_js_1 = require("./subscriber.js");
|
|
22
23
|
Object.defineProperty(exports, "PubSubBullMqSubscriber", { enumerable: true, get: function () { return subscriber_js_1.PubSubBullMqSubscriber; } });
|
|
23
24
|
Object.defineProperty(exports, "PubSubRabbitSubscriber", { enumerable: true, get: function () { return subscriber_js_1.PubSubRabbitSubscriber; } });
|
|
25
|
+
Object.defineProperty(exports, "PubSubGcpSubscriber", { enumerable: true, get: function () { return subscriber_js_1.PubSubGcpSubscriber; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GcpPubSubConnectionConfig } from "@palmetto/pubsub";
|
|
2
|
+
declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<GcpPubSubConnectionConfig, "register", "create", {}>;
|
|
3
|
+
/**
|
|
4
|
+
* This module requires @palmetto/pubsub and @google-cloud/pubsub
|
|
5
|
+
*/
|
|
6
|
+
export declare class PubSubGcpModule extends ConfigurableModuleClass {
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PubSubGcpModule = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const pubsub_1 = require("@palmetto/pubsub");
|
|
15
|
+
const pubsub_provider_module_1 = require("./pubsub-provider-module");
|
|
16
|
+
const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new common_1.ConfigurableModuleBuilder().build();
|
|
17
|
+
let GcpPubSubConnectionShutdown = class GcpPubSubConnectionShutdown {
|
|
18
|
+
constructor(connection) {
|
|
19
|
+
this.connection = connection;
|
|
20
|
+
}
|
|
21
|
+
onApplicationShutdown() {
|
|
22
|
+
return this.connection.close();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
GcpPubSubConnectionShutdown = __decorate([
|
|
26
|
+
(0, common_1.Injectable)(),
|
|
27
|
+
__metadata("design:paramtypes", [pubsub_1.GcpPubSubConnection])
|
|
28
|
+
], GcpPubSubConnectionShutdown);
|
|
29
|
+
/**
|
|
30
|
+
* This module requires @palmetto/pubsub and @google-cloud/pubsub
|
|
31
|
+
*/
|
|
32
|
+
let PubSubGcpModule = class PubSubGcpModule extends ConfigurableModuleClass {
|
|
33
|
+
};
|
|
34
|
+
exports.PubSubGcpModule = PubSubGcpModule;
|
|
35
|
+
exports.PubSubGcpModule = PubSubGcpModule = __decorate([
|
|
36
|
+
(0, common_1.Module)({
|
|
37
|
+
imports: [pubsub_provider_module_1.PubSubProviderFactoryModule],
|
|
38
|
+
providers: [
|
|
39
|
+
{
|
|
40
|
+
provide: pubsub_1.GcpPubSubConnection,
|
|
41
|
+
useFactory: (config) => pubsub_1.GcpPubSubConnection.create(config, new common_1.Logger(pubsub_1.GcpPubSubConnection.name)),
|
|
42
|
+
inject: [MODULE_OPTIONS_TOKEN],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
provide: pubsub_1.GcpPubSubProvider,
|
|
46
|
+
useFactory: (providers, connection) => {
|
|
47
|
+
const provider = new pubsub_1.GcpPubSubProvider(connection, new common_1.Logger(pubsub_1.GcpPubSubProvider.name));
|
|
48
|
+
providers.addProvider(provider);
|
|
49
|
+
return provider;
|
|
50
|
+
},
|
|
51
|
+
inject: [pubsub_provider_module_1.PubSubProviderFactory, pubsub_1.GcpPubSubConnection],
|
|
52
|
+
},
|
|
53
|
+
GcpPubSubConnectionShutdown,
|
|
54
|
+
],
|
|
55
|
+
exports: [pubsub_1.GcpPubSubConnection, pubsub_1.GcpPubSubProvider],
|
|
56
|
+
})
|
|
57
|
+
], PubSubGcpModule);
|
package/dist/subscriber.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MessageContext, MessageResult, BullMqMessageContext, BullMqQueueConfiguration, RabbitMqMessageContext, RabbitQueueExchangeConfiguration } from "@palmetto/pubsub";
|
|
1
|
+
import { MessageContext, MessageResult, BullMqMessageContext, BullMqQueueConfiguration, RabbitMqMessageContext, RabbitQueueExchangeConfiguration, GcpPubSubConfiguration, GcpPubSubMessageContext } from "@palmetto/pubsub";
|
|
2
2
|
export declare const EVENT_HANDLER: unique symbol;
|
|
3
3
|
export type HandlerMethod<TMessageContext extends MessageContext> = (msg: never, context: TMessageContext) => Promise<MessageResult> | MessageResult;
|
|
4
4
|
export declare const PubSubRabbitSubscriber: (config: RabbitQueueExchangeConfiguration) => <T extends HandlerMethod<RabbitMqMessageContext>>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
5
5
|
export declare const PubSubBullMqSubscriber: (config: BullMqQueueConfiguration) => <T extends HandlerMethod<BullMqMessageContext>>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
6
|
+
export declare const PubSubGcpSubscriber: (config: GcpPubSubConfiguration) => <T extends HandlerMethod<GcpPubSubMessageContext>>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
package/dist/subscriber.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PubSubBullMqSubscriber = exports.PubSubRabbitSubscriber = exports.EVENT_HANDLER = void 0;
|
|
3
|
+
exports.PubSubGcpSubscriber = exports.PubSubBullMqSubscriber = exports.PubSubRabbitSubscriber = exports.EVENT_HANDLER = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
exports.EVENT_HANDLER = Symbol("EVENT_HANDLER");
|
|
@@ -12,3 +12,4 @@ const EventSubscriber = (config) => {
|
|
|
12
12
|
};
|
|
13
13
|
exports.PubSubRabbitSubscriber = (EventSubscriber);
|
|
14
14
|
exports.PubSubBullMqSubscriber = (EventSubscriber);
|
|
15
|
+
exports.PubSubGcpSubscriber = (EventSubscriber);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palmetto/nestjs-pubsub",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/palmetto/galaxy"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@nestjs/core": "^11.1.3",
|
|
29
29
|
"@nestjs/testing": "^11.1.5",
|
|
30
30
|
"@palmetto/nestjs-errors": "^2.2.1",
|
|
31
|
-
"@palmetto/pubsub": "^3.1
|
|
31
|
+
"@palmetto/pubsub": "^3.2.1",
|
|
32
32
|
"@swc/core": "^1.13.3",
|
|
33
33
|
"@types/node": "^24.2.1",
|
|
34
34
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -53,10 +53,11 @@
|
|
|
53
53
|
"rxjs": "^7.8.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
+
"@google-cloud/pubsub": "^5",
|
|
56
57
|
"@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
57
58
|
"@nestjs/core": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
58
59
|
"@palmetto/nestjs-errors": "^2.2.1",
|
|
59
|
-
"@palmetto/pubsub": "^3.1
|
|
60
|
-
"zod": "^4.1
|
|
60
|
+
"@palmetto/pubsub": "^3.2.1",
|
|
61
|
+
"zod": "^4.1"
|
|
61
62
|
}
|
|
62
63
|
}
|