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

@superset-ui/core

Package Overview
Dependencies
Maintainers
3
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superset-ui/core - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

esm/.DS_Store

2

esm/index.js

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

export{default as callApi}from"./callApi";export{default as SupersetClient}from"./SupersetClient";
export{default as Plugin}from"./models/Plugin";export{default as Preset}from"./models/Preset";export{default as Registry}from"./models/Registry";export{default as convertKeysToCamelCase}from"./utils/convertKeysToCamelCase";export{default as isDefined}from"./utils/isDefined";export{default as isRequired}from"./utils/isRequired";export{default as makeSingleton}from"./utils/makeSingleton";

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

"use strict";var _callApi=_interopRequireDefault(require("./callApi"));var _SupersetClient=_interopRequireDefault(require("./SupersetClient"));exports.__esModule=/* force = */!0,exports.SupersetClient=exports.callApi=void 0;exports.callApi=_callApi.default;exports.SupersetClient=_SupersetClient.default;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}
"use strict";var _Plugin=_interopRequireDefault(require("./models/Plugin"));var _Preset=_interopRequireDefault(require("./models/Preset"));var _Registry=_interopRequireDefault(require("./models/Registry"));var _convertKeysToCamelCase=_interopRequireDefault(require("./utils/convertKeysToCamelCase"));var _isDefined=_interopRequireDefault(require("./utils/isDefined"));var _isRequired=_interopRequireDefault(require("./utils/isRequired"));var _makeSingleton=_interopRequireDefault(require("./utils/makeSingleton"));exports.__esModule=!0,exports.makeSingleton=exports.isRequired=exports.isDefined=exports.convertKeysToCamelCase=exports.Registry=exports.Preset=exports.Plugin=void 0;exports.Plugin=_Plugin.default;exports.Preset=_Preset.default;exports.Registry=_Registry.default;exports.convertKeysToCamelCase=_convertKeysToCamelCase.default;exports.isDefined=_isDefined.default;exports.isRequired=_isRequired.default;exports.makeSingleton=_makeSingleton.default;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}
{
"name": "@superset-ui/core",
"version": "0.2.0",
"description": "Superset UI core 🤖",
"version": "0.3.0",
"description": "Superset UI core",
"sideEffects": false,

@@ -17,6 +17,3 @@ "main": "lib/index.js",

"keywords": [
"superset",
"client",
"core",
"data"
"superset"
],

@@ -29,14 +26,9 @@ "author": "Superset",

"homepage": "https://github.com/apache-superset/superset-ui#readme",
"devDependencies": {
"fetch-mock": "^6.5.2",
"node-fetch": "^2.2.0"
"publishConfig": {
"access": "public"
},
"dependencies": {
"@babel/runtime": "^7.1.2",
"whatwg-fetch": "^2.0.4"
"lodash": "^4.17.11"
},
"publishConfig": {
"access": "public"
},
"gitHead": "098c2fce9f3f6a16b555c2a3ebf4715af76818a8"
"gitHead": "f319c4e3273d47d6aa1f298ddfdaba1bdfc8181b"
}

@@ -1,42 +0,12 @@

## `@superset-ui/core`
## @superset-ui/core
[![Version](https://img.shields.io/npm/v/@superset-ui/core.svg?style=flat)](https://img.shields.io/npm/v/@superset-ui/core.svg?style=flat)
[![David (path)](https://img.shields.io/david/apache-superset/superset-ui.svg?path=packages%2Fsuperset-ui-core&style=flat-square)](https://david-dm.org/apache-superset/superset-ui?path=packages/superset-ui-core)
Core modules for Superset:
Description
- `SupersetClient` requests and authentication
- (future) `i18n` locales and translation
### SupersetClient
The `SupersetClient` handles all client-side requests to the Superset backend. It can be configured
for use within the Superset application, or used to issue `CORS` requests in other applications. At
a high-level it supports:
- `CSRF` token authentication
- a token may be passed at configuration time, else the client will handle fetching and passing
the token in all subsequent requests.
- queues requests in the case that another request is made before the token is received.
- it checks for a token before every request, and will fail if no token was received or if it has
expired. In either case the user should be directed to re-authenticate.
- supports `GET` and `POST` requests (no `PUT` or `DELETE`)
- timeouts
- query aborts through the `AbortController` API
#### Example usage
```javascript
// appSetup.js
import { SupersetClient } from `@superset-ui/core`;
// or import SupersetClient from `@superset-ui/core/lib|esm/SupersetClient`;
SupersetClient.configure(...clientConfig);
SupersetClient.init(); // CSRF auth, can also chain `.configure().init();
// anotherFile.js
import { SupersetClient } from `@superset-ui/core`;
SupersetClient.post(...requestConfig)
.then(({ request, json }) => ...)
.catch((error) => ...);
```js
import { xxx } from '@superset-ui/core';
```

@@ -46,47 +16,6 @@

##### Client Configuration
`fn(args)`
The following flags can be passed in the client config call
`SupersetClient.configure(...clientConfig);`
- TBD
- `protocol = 'http:'`
- `host`
- `headers`
- `credentials = 'same-origin'` (set to `include` for non-Superset apps)
- `mode = 'same-origin'` (set to `cors` for non-Superset apps)
- `timeout`
- `csrfToken` you can configure the client with a CSRF token at configuration time, else the client
will attempt to fetch this before any other requests are issued
##### Per-request Configuration
The following flags can be passed on a per-request call `SupersetClient.get/post(...requestConfig);`
- `url` or `endpoint`
- `headers`
- `body`
- `timeout`
- `signal` (for aborting, from `const { signal } = (new AbortController())`)
- for `POST` requests
- `postPayload` (key values are added to a `new FormData()`)
- `stringify` whether to call `JSON.stringify` on `postPayload` values
##### Request aborting
Per-request aborting is implemented through the `AbortController` API:
```javascript
import { SupersetClient } from '@superset-ui/core';
import AbortController from 'abortcontroller-polyfill';
const controller = new AbortController();
const { signal } = controller;
SupersetClient.get({ ..., signal }).then(...).catch(...);
if (IWantToCancelForSomeReason) {
signal.abort(); // Promise is rejected, request `catch` is invoked
}
```
### Development

@@ -93,0 +22,0 @@

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