New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

a1pubsub

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a1pubsub - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

14

dist/index.d.ts

@@ -26,4 +26,3 @@ import { JSON } from './json';

*/
export interface PubSubMessage<S extends string, T> {
subscription: S;
export interface PubSubMessage<T> {
message: {

@@ -66,7 +65,8 @@ messageId: MessageId;

declare type Validator<T> = (json: JSON) => T | undefined;
interface SubscriptionHandler<S extends string, T> {
validator: Validator<T>;
handler: (data: PubSubMessage<S, T>) => Promise<boolean>;
interface SubscriptionHandler<D extends {} = {}> {
validator: Validator<D>;
handler: (subscription: string, data: PubSubMessage<D>) => Promise<boolean>;
}
export declare type DecodingTable<S extends string, T> = Map<S, SubscriptionHandler<S, T>>;
export interface DecodingTable extends Record<string, SubscriptionHandler<any>> {
}
export declare const getSubscription: <S extends string>(rawSubscription: string) => S | null;

@@ -77,3 +77,3 @@ export declare class PubSub<S extends string, T> {

private decoders;
constructor(projectId: string, decodingTable: DecodingTable<S, T>, customStateManager?: StateManager);
constructor(projectId: string, decodingTable: DecodingTable, customStateManager?: StateManager);
publish<J extends {}>(topic: string, data: J): Promise<void>;

@@ -80,0 +80,0 @@ handlePubSubMessage(rawMsg: UnprocessedPubSubMessage): Promise<SubscriptionError | undefined>;

@@ -133,3 +133,3 @@ "use strict";

const updatedCachedMessage = yield this.stateManager.recordMessageReceived(rawMsg, subscription, cachedMessage);
const subscriptionHandler = this.decoders.get(subscription);
const subscriptionHandler = this.decoders[subscription];
if (!subscriptionHandler) {

@@ -144,3 +144,2 @@ return SubscriptionError.MissingHandlerForTopic;

const pubSubMessage = {
subscription,
message: {

@@ -151,3 +150,3 @@ messageId: rawMsg.message.messageId,

};
const succeeded = yield handler(pubSubMessage).catch(() => {
const succeeded = yield handler(subscription, pubSubMessage).catch(() => {
// catching in case handler didn't catch its own errors

@@ -154,0 +153,0 @@ return false;

{
"name": "a1pubsub",
"version": "0.0.6",
"version": "0.0.7",
"description": "GCP PubSub wrapper to add idempotency",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc