Skip to content

Commit

Permalink
export pubsubworker and pubsubpublisher
Browse files Browse the repository at this point in the history
  • Loading branch information
maktouch committed Mar 15, 2022
1 parent 5a78219 commit 1116225
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
7 changes: 4 additions & 3 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ClientConfig, PubSub } from '@google-cloud/pubsub';
import PubsubPublisher from './publisher';
import PubsubWorker from './worker';
export { PubsubWorker, PubsubPublisher };
export interface JobPayload {
[key: string]: string;
}
Expand All @@ -12,9 +13,9 @@ export declare type QueueConfig = {
export default class PubsubQueue {
connectionConfig: ClientConfig;
queueConfig: QueueConfig;
_client?: PubSub;
publisher?: PubsubPublisher;
worker?: PubsubWorker;
_client: PubSub | null;
publisher: PubsubPublisher | null;
worker: PubsubWorker | null;
constructor(connectionConfig: ClientConfig | undefined, queueConfig: QueueConfig);
client(): PubSub;
get Publisher(): PubsubPublisher;
Expand Down
6 changes: 6 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PubsubPublisher = exports.PubsubWorker = void 0;
var pubsub_1 = require("@google-cloud/pubsub");
var publisher_1 = __importDefault(require("./publisher"));
exports.PubsubPublisher = publisher_1.default;
var worker_1 = __importDefault(require("./worker"));
exports.PubsubWorker = worker_1.default;
var PubsubQueue = /** @class */ (function () {
function PubsubQueue(connectionConfig, queueConfig) {
if (connectionConfig === void 0) { connectionConfig = {}; }
this.connectionConfig = connectionConfig;
this.queueConfig = queueConfig;
this._client = null;
this.publisher = null;
this.worker = null;
}
PubsubQueue.prototype.client = function () {
if (!this._client) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitmedialabs/pubsub-queue",
"version": "4.0.1",
"version": "4.1.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"license": "MIT",
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ClientConfig, PubSub } from '@google-cloud/pubsub';
import PubsubPublisher from './publisher';
import PubsubWorker from './worker';

export { PubsubWorker, PubsubPublisher };

export interface JobPayload {
[key: string]: string;
}
Expand All @@ -15,13 +17,16 @@ export type QueueConfig = {
export default class PubsubQueue {
connectionConfig: ClientConfig;
queueConfig: QueueConfig;
_client?: PubSub;
publisher?: PubsubPublisher;
worker?: PubsubWorker;
_client: PubSub | null;
publisher: PubsubPublisher | null;
worker: PubsubWorker | null;

constructor(connectionConfig: ClientConfig = {}, queueConfig: QueueConfig) {
this.connectionConfig = connectionConfig;
this.queueConfig = queueConfig;
this._client = null;
this.publisher = null;
this.worker = null;
}

client() {
Expand Down

0 comments on commit 1116225

Please sign in to comment.