Socket
Socket
Sign inDemoInstall

protocat

Package Overview
Dependencies
118
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.0-beta.1 to 0.5.0

7

dist/lib/server/middleware/cache.d.ts

@@ -6,4 +6,11 @@ /// <reference types="node" />

export interface CacheImplementation<E = {}> {
/**
* Create a unique cache key that will be used for response save and lookup.
*
* Return falsy key if caching should be skipped
*/
hash: (call: ProtoCatCall<E, Message, Message, CallType.Unary>) => Promise<string | undefined> | string | undefined;
/** Return buffer from cache. Returning falsy value is considered a cache miss. */
get: (key: string, call: ProtoCatCall<E, Message, Message, CallType.Unary>) => Promise<Buffer | undefined> | Buffer | undefined;
/** Set cache result. Result is not awaited and does not block the response nor subsequent requests */
set: (key: string, value: Buffer, call: ProtoCatCall<E, Message, Message, CallType.Unary>) => void;

@@ -10,0 +17,0 @@ }

6

dist/lib/server/middleware/cache.js

@@ -5,3 +5,7 @@ "use strict";

const call_types_1 = require("../../call-types");
exports.createCache = (cache, cb) => async (call, next) => {
exports.createCache = (
/** Response binary cache implementation */
cache,
/** Optional callback to react on cache miss/hit. Called once per request ASAP after cache retrieval */
cb) => async (call, next) => {
if (call.type !== call_types_1.CallType.Unary)

@@ -8,0 +12,0 @@ return next();

2

package.json
{
"name": "protocat",
"description": "Modern, minimalist type-safe gRPC framework for Node.js",
"version": "0.5.0-beta.1",
"version": "0.5.0",
"author": "Jaroslav Šmolík <grissius@gmail.com>",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc