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

@envelop/core

Package Overview
Dependencies
Maintainers
1
Versions
1491
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/core - npm Package Compare versions

Comparing version

to
2.4.0-alpha-3936561.0

44

index.js

@@ -302,2 +302,45 @@ 'use strict';

}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function getInMemoryLRUCache({ max = 1000, onDelete = () => { }, } = {}) {
let storage = {};
let keys = [];
return {
get(key) {
return storage[key];
},
set(key, value) {
queueMicrotask(() => {
if (storage[key] != null) {
if (keys.indexOf(key)) {
keys.splice(keys.indexOf(key), 1);
}
}
keys.push(key);
storage[key] = value;
while (keys.length > max) {
const key = keys.shift();
if (key != null) {
onDelete(key, storage[key]);
delete storage[key];
}
}
});
},
delete(key) {
queueMicrotask(() => {
if (storage[key] != null) {
keys.splice(keys.indexOf(key), 1);
onDelete(key, storage[key]);
delete storage[key];
}
});
},
clear() {
queueMicrotask(() => {
storage = {};
keys = [];
});
},
};
}

@@ -1293,2 +1336,3 @@ function createEnvelopOrchestrator(plugins) {

exports.formatError = formatError;
exports.getInMemoryLRUCache = getInMemoryLRUCache;
exports.handleStreamOrSingleExecutionResult = handleStreamOrSingleExecutionResult;

@@ -1295,0 +1339,0 @@ exports.isAsyncIterable = isAsyncIterable;

2

package.json
{
"name": "@envelop/core",
"version": "2.3.1",
"version": "2.4.0-alpha-3936561.0",
"sideEffects": false,

@@ -5,0 +5,0 @@ "peerDependencies": {

@@ -34,1 +34,10 @@ import { ASTNode, DocumentNode, OperationDefinitionNode, Source, ExecutionResult, SubscriptionArgs, ExecutionArgs } from 'graphql';

export declare function errorAsyncIterator<TInput>(source: AsyncIterable<TInput>, onError: (err: unknown) => void): AsyncGenerator<TInput>;
export declare function getInMemoryLRUCache<V>({ max, onDelete, }?: {
max?: number;
onDelete?: (key: string, value: V) => void;
}): {
get(key: string): V | undefined;
set(key: string, value: V): void;
delete(key: string): void;
clear(): void;
};

Sorry, the diff of this file is not supported yet