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.0 to 3.0.0-beta.1

4

node/index.d.ts
import { SecurityValuesMap } from '../common/index.js';
export { PerformError, UnexpectedError } from '../common/index.js';
export type ClientOptions = {

@@ -26,4 +27,2 @@ /**

readonly assetsPath: string;
private readonly token;
private readonly insightsUrl;
private corePath;

@@ -70,2 +69,1 @@ private app;

}
export {};

@@ -8,2 +8,3 @@ import fs from 'node:fs/promises';

import { fetchErrorToHostError, systemErrorToWasiError } from './error.js';
export { PerformError, UnexpectedError } from '../common/index.js';
const CORE_PATH = process.env.CORE_PATH ?? createRequire(import.meta.url).resolve('../assets/core-async.wasm');

@@ -147,3 +148,2 @@ const ASSETS_FOLDER = 'superface';

this.assetsPath = resolvePath(process.cwd(), ASSETS_FOLDER);
this.insightsUrl = 'https://superface.ai/insights/sdk_event';
if (options.assetsPath !== undefined) {

@@ -150,0 +150,0 @@ this.assetsPath = options.assetsPath;

@@ -69,4 +69,10 @@ import { createServer as httpCreateServer } from 'node:http';

});
test('profile file does not exist', async () => {
const client = new OneClient(clientOptions);
const profile = await client.getProfile('wasm-sdk/does-not-exist');
const usecase = profile.getUseCase('Example');
await expect(() => usecase.perform({}, { provider: 'localhost' })).rejects.toThrow(UnexpectedError);
});
});
});
//# sourceMappingURL=index.test.js.map
{
"name": "@superfaceai/one-sdk",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"main": "node/index.js",

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

[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)
<br />
<br />
<img src="https://github.com/superfaceai/one-sdk/raw/main/docs/LogoGreen.png" alt="Superface" width="100" height="100">

@@ -12,5 +13,5 @@

[![Discord](https://img.shields.io/discord/819563244418105354?logo=discord&logoColor=fff)](https://sfc.is/discord)
[![npm](https://img.shields.io/npm/v/@superfaceai/one-sdk/alpha.svg)](https://www.npmjs.com/package/@superfaceai/one-sdk/v/alpha)
![TypeScript](https://img.shields.io/static/v1?message=TypeScript&&logoColor=ffffff&color=007acc&labelColor=5c5c5c&label=built%20with)
[![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.

@@ -32,3 +33,3 @@

```shell
npm install @superfaceai/one-sdk@alpha
npm install @superfaceai/one-sdk@beta
```

@@ -77,3 +78,3 @@

```js
import { OneClient } from '@superfaceai/one-sdk';
import { OneClient, PerformError, UnexpectedError } from '@superfaceai/one-sdk/node';

@@ -84,21 +85,29 @@ async function main() {

const result = await profile.getUseCase('<usecaseName>').perform({
// Input parameters as defined in profile:
'<key>': '<value>'
},
{
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
}
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>'
},
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;
}
});
console.log(result.unwrap());
}
}

@@ -187,3 +196,3 @@

The next-gen OneSDK is still in alpha stage and several features are not yet implemented. We welcome any and all feedback. The current limitations include:
The next-gen OneSDK is still in beta stage and several features are not yet implemented. We welcome any and all feedback. The current limitations include:

@@ -190,0 +199,0 @@ - OneSDK Client can't be instantiated in the global scope

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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