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

@superfaceai/one-sdk

Package Overview
Dependencies
Maintainers
3
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superfaceai/one-sdk - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

2

package.json
{
"name": "@superfaceai/one-sdk",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"main": "node/index.js",

@@ -5,0 +5,0 @@ "type": "module",

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

[Website](https://superface.ai) | [Get Started](https://superface.ai/docs/getting-started) | [Documentation](https://superface.ai/docs) | [Discord](https://sfc.is/discord) | [Twitter](https://twitter.com/superfaceai) | [Support](https://superface.ai/support)
[Website](https://superface.ai) | [Get Started](https://superface.ai/docs/getting-started) | [Documentation](https://superface.ai/docs) | [GitHub Discussions](https://sfc.is/discussions) | [Twitter](https://twitter.com/superfaceai) | [Support](https://superface.ai/support)
<br />

@@ -12,6 +12,5 @@ <br />

[![license](https://img.shields.io/npm/l/@superfaceai/one-sdk)](LICENSE)
[![Discord](https://img.shields.io/discord/819563244418105354?logo=discord&logoColor=fff)](https://sfc.is/discord)
[![GitHub Discussions](https://img.shields.io/github/discussions/superfaceai/.github?logo=github&logoColor=fff)](https://github.com/orgs/superfaceai/discussions)
[![npm](https://img.shields.io/npm/v/@superfaceai/one-sdk/beta.svg)](https://www.npmjs.com/package/@superfaceai/one-sdk/v/beta)
`OneClient` is a universal API client which provides an unparalleled developer experience for every HTTP API. It enhances resiliency to API changes, and comes with built-in integration monitoring and provider failover.

@@ -26,3 +25,3 @@

- [Documentation](https://superface.ai/docs)
- [Discord](https://sfc.is/discord)
- [Support](https://superface.ai/support)

@@ -40,2 +39,3 @@ ## Install

OneClient uses three files (also called Comlink) which together make the integration:
- **Profile** - describe business capabilities apart from the implementation details, what is expected as input and what will be the result. Profile name have optional scope before `/` and required name `[scope/]<name>`

@@ -66,2 +66,3 @@ - **Provider** - Define a provider's API services and security schemes to use in a Comlink Map

The final structure should look like this:
```

@@ -80,38 +81,40 @@ .

```js
import { OneClient, PerformError, UnexpectedError } from '@superfaceai/one-sdk/node';
import {
OneClient,
PerformError,
UnexpectedError,
} from '@superfaceai/one-sdk/node';
async function main() {
const client = new OneClient();
const profile = await client.getProfile('<profileName>');
const client = new OneClient();
const profile = await client.getProfile('<profileName>');
try {
const result = await profile.getUseCase('<usecaseName>').perform({
// Input parameters as defined in profile:
'<key>': '<value>'
try {
const result = await profile.getUseCase('<usecaseName>').perform(
{
// Input parameters as defined in profile:
'<key>': '<value>',
},
{
provider: '<providerName>',
parameters: {
// Provider specific integration parameters:
'<integrationParameterName>': '<integrationParameterValue>',
},
{
provider: '<providerName>',
parameters: {
// Provider specific integration parameters:
'<integrationParameterName>': '<integrationParameterValue>'
security: {
// Provider specific security values:
'<securityValueId>': {
// Security values as described in provider or on profile page
},
security: {
// Provider specific security values:
'<securityValueId>': {
// Security values as described in provider or on profile page
}
}
});
} catch (e) {
if (e instanceof PerformError) {
console.log('ERROR RESULT:', e.errorResult);
} else if (e instanceof UnexpectedError) {
console.error('ERROR:', e);
} else {
throw e;
},
}
);
} catch (e) {
if (e instanceof PerformError) {
console.log('ERROR RESULT:', e.errorResult);
} else if (e instanceof UnexpectedError) {
console.error('ERROR:', e);
} else {
throw e;
}
}
main();
```

@@ -200,5 +203,7 @@

- OneSDK Client can't be instantiated in the global scope
- We discovered Cloudflare is not allowing synchronisation between requests. We need to make sure, that two different requests are not accessing OneSDK Core at the same time. [The problem](https://zuplo.com/blog/the-script-will-never-generate-a-response-on-cloudflare-workers).
- Build-time integrations only
- Currently the maps (integration glue) needs to be bundled with the worker at the build time

@@ -218,2 +223,2 @@ - Future OneSDK will be fetching the maps at the runtime to enable dynamic healing and recovery

© 2023 Superface s.r.o.
© 2023 Superface s.r.o.

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