Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orion-js/resolvers

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orion-js/resolvers - npm Package Compare versions

Comparing version 3.7.1 to 3.7.2

4

lib/resolver/getExecute/getCacheKey.d.ts

@@ -1,2 +0,2 @@

import { ResolverOptions, ExecuteOptions } from '../types';
export default function (options: ResolverOptions, executeOptions: ExecuteOptions): Promise<string>;
import { ExecuteOptions } from '../types';
export default function (executeOptions: ExecuteOptions): Promise<string>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const helpers_1 = require("@orion-js/helpers");
const getBaseKey = async (options, executeOptions) => {
const { parent, params, viewer } = executeOptions;
const getBaseKey = async (executeOptions) => {
const { parent, params, viewer, options } = executeOptions;
if (parent) {

@@ -15,6 +15,6 @@ const getKey = options.getCacheKey;

};
async function default_1(options, executeOptions) {
const { parent, params, viewer } = executeOptions;
async function default_1(executeOptions) {
const { parent, params, viewer, options } = executeOptions;
if (options.getCacheKey) {
const baseKey = await getBaseKey(options, executeOptions);
const baseKey = await getBaseKey(executeOptions);
return options.resolverId + '_' + baseKey;

@@ -21,0 +21,0 @@ }

@@ -1,2 +0,2 @@

import { ResolverOptions, ExecuteOptions } from '../types';
export default function (options: ResolverOptions, executeOptions: ExecuteOptions): Promise<any>;
import { ExecuteOptions } from '../types';
export default function (executeOptions: ExecuteOptions): Promise<any>;

@@ -7,4 +7,4 @@ "use strict";

const getCacheKey_1 = __importDefault(require("./getCacheKey"));
async function default_1(options, executeOptions) {
const { parent, params, viewer } = executeOptions;
async function default_1(executeOptions) {
const { parent, params, viewer, options } = executeOptions;
const executeResolver = async () => {

@@ -20,3 +20,3 @@ const resultFunc = options.resolve;

if (options.cache && options.cacheProvider) {
const key = await (0, getCacheKey_1.default)(options, executeOptions);
const key = await (0, getCacheKey_1.default)(executeOptions);
const result = await options.cacheProvider.get(key, {

@@ -23,0 +23,0 @@ fallback: executeResolver,

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

const params = { num: 321 };
const result = await (0, getResult_1.default)({ resolve }, { params, viewer: {} });
const result = await (0, getResult_1.default)({ options: { resolve }, params, viewer: {} });
expect(result).toBe(321 * 2);

@@ -27,3 +27,2 @@ });

const resolverId = '1234';
const emptyCall = { params: {}, viewer: {} };
const resolver = {

@@ -35,8 +34,9 @@ resolve,

};
const result1 = await (0, getResult_1.default)(resolver, emptyCall);
const emptyCall = { options: resolver, params: {}, viewer: {} };
const result1 = await (0, getResult_1.default)(emptyCall);
expect(result1).toBe(2);
const result2 = await (0, getResult_1.default)(resolver, emptyCall);
const result2 = await (0, getResult_1.default)(emptyCall);
expect(result2).toBe(2);
await (0, helpers_1.sleep)(15);
const result3 = await (0, getResult_1.default)(resolver, emptyCall);
const result3 = await (0, getResult_1.default)(emptyCall);
expect(result3).toBe(3);

@@ -58,4 +58,4 @@ });

const resolver = { resolve, cacheProvider: provider, cache, resolverId };
const result = await (0, getResult_1.default)(resolver, { params: {}, viewer: {} });
const result = await (0, getResult_1.default)({ options: resolver, params: {}, viewer: {} });
expect(result).toBe('fromcache');
});

@@ -1,2 +0,2 @@

import { ExecuteOptions, ResolverOptions } from '../types';
export declare function getResultWithMiddlewares(options: ResolverOptions, executeOptions: ExecuteOptions): Promise<any>;
import { ExecuteOptions } from '../types';
export declare function getResultWithMiddlewares(executeOptions: ExecuteOptions): Promise<any>;

@@ -10,8 +10,8 @@ "use strict";

const getResult_1 = __importDefault(require("./getResult"));
async function getResultWithMiddlewares(options, executeOptions) {
async function getResultWithMiddlewares(executeOptions) {
const resolveMiddleware = (0, createResolverMiddleware_1.createResolverMiddleware)(async (executeOptions, next) => {
return await (0, getResult_1.default)(options, executeOptions);
return await (0, getResult_1.default)(executeOptions);
});
const composedMiddlewares = (0, helpers_1.composeMiddlewares)([
...(options.middlewares || []),
...(executeOptions.options.middlewares || []),
resolveMiddleware

@@ -18,0 +18,0 @@ ]);

@@ -18,6 +18,7 @@ "use strict";

viewer: executeParams.viewer || {},
parent: executeParams.parent
parent: executeParams.parent,
options: options
};
await (0, checkPermissions_1.default)(executeOptions, options);
const result = await (0, getResultWithMiddlewares_1.getResultWithMiddlewares)(options, executeOptions);
const result = await (0, getResultWithMiddlewares_1.getResultWithMiddlewares)(executeOptions);
return (0, initResult_1.default)(options, result);

@@ -24,0 +25,0 @@ };

@@ -13,2 +13,3 @@ import { OrionCache } from '@orion-js/cache';

parent?: any;
options: ResolverOptions;
}

@@ -15,0 +16,0 @@ declare type Parameters<T> = T extends (...args: infer P) => any ? P : never;

{
"name": "@orion-js/resolvers",
"version": "3.7.1",
"version": "3.7.2",
"main": "lib/index.js",

@@ -20,5 +20,5 @@ "types": "lib/index.d.ts",

"dependencies": {
"@orion-js/cache": "^3.7.1",
"@orion-js/helpers": "^3.7.1",
"@orion-js/schema": "^3.7.1"
"@orion-js/cache": "^3.7.2",
"@orion-js/helpers": "^3.7.2",
"@orion-js/schema": "^3.7.2"
},

@@ -37,3 +37,3 @@ "devDependencies": {

},
"gitHead": "b34633e2a999e3db3cde99582dacea704f23429c"
"gitHead": "78fd47c75e4a7a280850e7f779b08a326bac34c6"
}
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