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

@orion-js/resolvers

Package Overview
Dependencies
Maintainers
2
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.0.0-alpha.13 to 3.0.0-alpha.16

lib/resolver/types.d.ts

2

lib/index.d.ts
import resolver from './resolver';
export * from './resolver/ResolverTypes';
export * from './resolver/types';
export { resolver };

@@ -19,2 +19,2 @@ "use strict";

exports.resolver = resolver_1.default;
__exportStar(require("./resolver/ResolverTypes"), exports);
__exportStar(require("./resolver/types"), exports);

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

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

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

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

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

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

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

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

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

import { ResolverOptions } from '../ResolverTypes';
import { ResolverOptions } from '../types';
export default function (options: ResolverOptions, result: any): any;

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

import { ResolverOptions, Resolver } from './ResolverTypes';
export default function resolver(options: ResolverOptions): Resolver;
import { CreateResolver } from './types';
declare const resolver: CreateResolver;
export default resolver;

@@ -10,4 +10,3 @@ "use strict";

const cache_1 = require("@orion-js/cache");
const omit_1 = __importDefault(require("lodash/omit"));
function resolver(options) {
const resolver = function (options) {
options.params = (0, cleanParams_1.default)(options.params);

@@ -20,7 +19,10 @@ if (!options.cacheProvider) {

}
return {
...(0, omit_1.default)(options, 'resolve'),
const resolve = options.resolve;
const resolver = {
...options,
resolve,
execute: (0, getExecute_1.default)(options)
};
}
return resolver;
};
exports.default = resolver;

@@ -13,2 +13,3 @@ "use strict";

});
expect(typeof resolver).toBe('object');
expect(typeof resolver.execute).toBe('function');

@@ -57,1 +58,37 @@ expect(typeof resolver.resolverId).toBe('string');

});
it('should create typed resolvers', async () => {
const resolve = async (params) => {
return params.value * 2;
};
const resolver = (0, index_1.default)({
params: {
value: {
type: Number
}
},
returns: Number,
resolve
});
const result = await resolver.execute({ params: { value: 2 } });
expect(result).toBe(4);
});
it('should create typed model resolvers', async () => {
const resolve = async function (model, params) {
return model.value * 2;
};
const resolver = (0, index_1.default)({
params: {
value: {
type: Number
}
},
returns: Number,
resolve
});
const inModel = resolver.resolve;
const inModelResult = await inModel({ value: 2 });
/**
* We are testing the typescript removes one argument on the resolve function.
*/
expect(inModelResult).toBe(4);
});
{
"name": "@orion-js/resolvers",
"version": "3.0.0-alpha.13",
"version": "3.0.0-alpha.16",
"main": "lib/index.js",

@@ -37,3 +37,3 @@ "types": "lib/index.d.ts",

},
"gitHead": "82c882da5213349bbec68e8692e18895aeb56e07"
"gitHead": "0d7f96232742888d72a5f9dcea2d5df0fb8fe255"
}
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