Http Methods#53
Conversation
- Add Http module: a transport layer, but for REST-based Extension SDKs - Remove global window hack for testing from production code - Added a Browser.js module that set's up a global window object for Jest - Added a Server.js module that creates a REST server using OpenRPC examples
- Core SDK / Extension SDK handhsake - Config - Query params - POST body
| else if (request.url.endsWith('/account/authenticate')) { | ||
| response.write(JSON.stringify({ | ||
| oat: "OAT", | ||
| bearerToken: "BEARER", |
There was a problem hiding this comment.
Hi Jeremy: Please confirm that these two lines are not sensitive. (Unlikely but I have to ask.)
Thanks
There was a problem hiding this comment.
Correct, they are not. The code deals with tokens, but there are no secrets or example values present.
| }) | ||
| }) | ||
|
|
||
| return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
might be better to rewrite this as an async function, a lot of nested .thens going on
There was a problem hiding this comment.
Stylistically, I agree.
However, I've been resisting the urge to use async/await because we haven't used them yet in the code. I just did a quick search and saw it's used in the new version of Lifecycle.ready() in the Core SDK. Have we tested that code on all of the browsers we care about?
| Http.onAuthorize(apis.authorize) | ||
| } | ||
|
|
||
| export const initialize = window.__firebolt ? () => { throw new Error('Use Extensions.initialize() from \\'@firebolt-js/sdk\\' to initialize ${pkg.name}.') } : _initialize |
There was a problem hiding this comment.
think I might need this walked through. Why would the initialize method throw an error if __firebolt is not undefined?
There was a problem hiding this comment.
This export const initialize is for non-Firebolt apps that need to use the SDK. They can import the initialize method and use the SDK w/out Firebolt. Not a high priority use case, but seemed like a good bonus to get teams to leverage our framework.
Firebolt get's access to the real initialize method (not the exported one) via window.__firebolt.registerExtensionSDK.
WARNING: A Blackduck scan failure has been waivedA prior failure has been upvoted
|
- Move `distributor` to it's own parameter - Fix MockProps bug - Fix MockTransport bug that was hiding errors in our code - add a simple prop to test MockProps - Test MockProps (get works now, but set needs it's own PR)
WARNING: A Blackduck scan failure has been waivedA prior failure has been upvoted
|
Creates the ability to add HTTP/REST methods to an SDK. Would be used by Extension SDKs
Creates a new module called
Httpthat looks like a Transport Layer.Methods that have the "http" tag will:
So that existing method templates will just work over Http.
The "http" tag supports several extensions:
Additionally, all of these extensions will support the following macros:
Creates an Extensions Module that allows Apps to initialize any imported Extension SDKs. This module will be exported from Core, and potentially any other SDKs that talk directly to the FEE over RPC.
Allows apps to pass in a configuration to each Extension SDK. Additionally, this method will pass callbacks for:
token()- allows Extension SDKs to get a token, will be mapped toAuthentication.token('platform')by defaultauthorize(permissions)- allows Extension SDKs to acquire user grants before grabbing the token, mapped toCapabilities.request()by default.This PR also adds file-level tree-shaking to the SDK generation: unimported files are scrubbed from the build, to avoid bulking up SDKs with code they don't need. Tree-shaking starts at the
mainfile in package.json and crawls through anyimport foo from barorexport foo from barstatements.