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

@forge/resolver

Package Overview
Dependencies
Maintainers
14
Versions
351
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forge/resolver - npm Package Compare versions

Comparing version 0.1.0-next.1 to 0.1.0-next.2

6

CHANGELOG.md
# @forge/resolver
## 0.1.0-next.2
### Patch Changes
- 2fcd284: Add error case for returning primitive values from resolver definitions
## 0.1.0-next.1

@@ -4,0 +10,0 @@

10

out/__test__/index.test.js

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

resolver.define('getCloudId', () => {
return backendState.context.cloudId;
return { cloudId: backendState.context.cloudId };
});

@@ -35,2 +35,5 @@ resolver.define('getLogs', () => {

});
resolver.define('invalidReturn', () => {
return 'foo';
});
resolver.define('invalidFunction', null);

@@ -42,3 +45,3 @@ const invoke = async (functionKey, payload) => {

it('should perform get operations', async () => {
expect(await invoke('getCloudId')).toEqual('cloudId-123');
expect(await invoke('getCloudId')).toEqual({ cloudId: 'cloudId-123' });
expect(await invoke('getLogs')).toEqual(['some log entries', 'warning', 'not verified']);

@@ -58,2 +61,5 @@ });

});
it('should throw an error if the resolver definition returns a value that is not an object or undefined', async () => {
await expect(invoke('invalidReturn')).rejects.toThrowError(new Error("Value returned from resolver definition 'invalidReturn' is type 'string' expected 'object' or 'undefined'"));
});
});

6

out/index.js

@@ -19,6 +19,10 @@ "use strict";

}
return cb({
const result = await cb({
payload: callPayload || {},
context: Object.assign({ accountId: (_a = backendRuntimePayload === null || backendRuntimePayload === void 0 ? void 0 : backendRuntimePayload.principal) === null || _a === void 0 ? void 0 : _a.accountId }, context)
});
if (typeof result !== 'object' && result !== undefined) {
throw new Error(`Value returned from resolver definition '${functionKey}' is type '${typeof result}' expected 'object' or 'undefined'`);
}
return result;
}

@@ -25,0 +29,0 @@ throw new Error(`Function '${functionKey}' is not defined.`);

{
"name": "@forge/resolver",
"version": "0.1.0-next.1",
"version": "0.1.0-next.2",
"description": "Forge function resolver",

@@ -5,0 +5,0 @@ "author": "Atlassian",

Sorry, the diff of this file is not supported yet

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