@superset-ui/core
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 5 instances in 1 package
35293
1
0
21
0
24
+ Addedlodash@^4.17.11
+ Addedlodash@4.17.21(transitive)
- Removed@babel/runtime@^7.1.2
- Removedwhatwg-fetch@^2.0.4
- Removed@babel/runtime@7.26.0(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedwhatwg-fetch@2.0.4(transitive)