open-index/open-npm huggingface dataset:
npm package: @incorta-org/component-sdk
Description: incorta Component SDK
Author: incorta
Latest version: 6.0.0

## Incorta Component SDK

The Incorta Component SDK is used to create new visualizations or plugins for Incorta Analyzer and Dashboards.

Development of Incorta Components presumes knowledge of HTML, CSS, JSON, Javascript, Node.js, NPM, React, and Typescript. You will also need to be familiar with Incorta, including Incorta Analyzer, and analytics concepts in general.

> Note: This project contains the Typescript definition and JSON schema files for an Incorta Component SDK project. The actual project that developers will use is [incorta/create-incorta-component](https://github.com/Incorta/create-incorta-component) installable via NPM. 

#### Prerequisites

- You'll need access to an Incorta cluster. [Incorta Cloud signup](https://cloud.incorta.com/signup/) is quick and easy.
- A code editor. Even if you have another favorite editor, we recommend [Visual Studio Code](https://code.visualstudio.com) so that you can take advantage of the auto-complete in the configuration JSON files.
- [Node.js](https://nodejs.org/) in order to get NPM (Node Package Manager)

#### Install the Incorta component package

This lets you create new Incorta components and run the testing server.

```bash
% npm install -g @incorta-org/create-incorta-component
```

#### To Create a new Incorta Component

```bash
% create-incorta-component new
```
npm package: @incorta-org/create-incorta-visual
Description: Generate a new Incorta visualization
Latest version: 0.0.5-alpha.13
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Create Incorta Visual

This package include the `create-incorta-visual` CLI to make the creation of custom Incotra visualizations simpler.


## How to use

Install the package:

`npm install -g @incorta-org/create-incorta-visual`

You can create a new visualization by runnnig: 

`create-incorta-visual my-incorta-visual`
npm package: @incpad/error-handle
Description: ```$xslt     const ErrorHandle = require('./packages/error-handle');     const list=[         {             code: 1001,             msg: 'Path not valid',             name: 'PathNotValid',         }     ]     const ErrorHandleInstance=new ErrorHandle()   
Latest version: 1.0.26

### Usage

```$xslt
    const ErrorHandle = require('./packages/error-handle');
    const list=[
        {
            code: 1001,
            msg: 'Path not valid',
            name: 'PathNotValid',
        }
    ]
    const ErrorHandleInstance=new ErrorHandle()
    ErrorHandleInstance.initCustomErrorWithObject(list)
```
可以选择使用code或者name去触发一个error，使用如下方式触发：

```$xslt
ErrorHandleInstance.throwErrorByName("PathNotValid")
ErrorHandleInstance.throwErrorByCode(1001)
```
在错误定义时可选属性为handleFunc，传入一个函数，该函数会在错误触发之前调用
```$xslt
{
        code: 1001,
        msg: 'Path not valid',
        name: 'PathNotValid',
        handleFunc:e=>{
            //send error to sentry
        }
}
```
npm package: @incpad/need
Description: 对于普通node程序来说，由于允许随时调用require注入，所以只需要如此： ```$xslt const {need} =require("@incpad/need") const _=need("lodash") _.get({},"xxx") ``` 如果传入第二个参数，即给与指定的上下文，如果第二个参数是个对象， 便会将该库注入到对应的对象中 ```$xslt const {need} =require("@incpad/need") let test={} need("lodash",test
Latest version: 1.0.22

### Usage
对于普通node程序来说，由于允许随时调用require注入，所以只需要如此：
```$xslt
const {need} =require("@incpad/need")
const _=need("lodash")
_.get({},"xxx")
```
如果传入第二个参数，即给与指定的上下文，如果第二个参数是个对象，
便会将该库注入到对应的对象中
```$xslt
const {need} =require("@incpad/need")
let test={}
need("lodash",test)
console.log(test.lodash)
```

对于babel系列的程序，由于需要编译处理，所以require不可以接受变量作为参数，所以需要特定的adapter作为处理  

同时，如果想要注入自己写的js文件而不是node_modules里的模块，也需要添加对应的adapter作为处理

下面给出adapter文件示例:
```$xslt
module.exports={
    tester:moduleName=>true,
    getMod:moduleName=>mod
}
```
调用need函数时，程序遍历内部的adapter数组，将模块名传入tester函数，如果返回true，则代表该adapter可以处理该模块，  
然后程序会调用对应的getMod方法，该方法应该返回需求的模块。


通过如下方式可以将自定义adapter添加到adapter数组中(以unshift的方式):

```$xslt
const {need,addAdapter} =require("@incpad/need")
const cusAdapter=reuqire("./addAdapter.js")
addAdapter(cusAdapter)
```
如果对应adapter格式不正确，会抛出对应错误
npm package: @incpad/react-native-tools
Description: * base模块        > ```const base=require("@incpad/react-native-tools/tools/base")```       or     > ```const {base}=require("@incpad/react-native-tools")```     * base.isAndroid():是否为安卓平台     * base.isIOS():是否为ios平台     * base.isIphoneX():是否为iPhoneX机型
Latest version: 1.0.18

### Usage
* base模块   
    > ```const base=require("@incpad/react-native-tools/tools/base")```  
    or
    > ```const {base}=require("@incpad/react-native-tools")```
    * base.isAndroid():是否为安卓平台
    * base.isIOS():是否为ios平台
    * base.isIphoneX():是否为iPhoneX机型
    
* geo模块
    > ```const geo=require("@incpad/react-native-tools/tools/geo")```  
    or
    > ```const {geo}=require("@incpad/react-native-tools")```
    
    * geo.getGeo(cbSucc:function,cbErr:function):获取用户地址，传入成功与失败的回调函数
npm package: @incpad/time-tool
Description: 对date-fns的二次封装，弃用moment，避免过大的无用代码引入，从而加快解析速度
Latest version: 1.0.8

### Usage
对date-fns的二次封装，弃用moment，避免过大的无用代码引入，从而加快解析速度

* compare 模块: 对所有时间比较、取值等等的函数集
* parse 模块:对所有时间的取值、解析的函数集
* oprator 模块:对所有时间的增删改操作的函数集
npm package: @incpad/validator
Description: ```$xslt     const {Validator, initValidatorWithFile} = require("@incpad/validator")     initValidatorWithFile("./validator.schema.js"); ``` 导入的js文件应该像这样的： ```$xslt module.exports = {     schemaList: {         testSchema: {             code: {            
Latest version: 0.0.27

### Usage

```$xslt
    const {Validator, initValidatorWithFile} = require("@incpad/validator")
    initValidatorWithFile("./validator.schema.js");
```
导入的js文件应该像这样的：
```$xslt
module.exports = {
    schemaList: {
        testSchema: {
            code: {
                type: 'number',
                min: 1000,
            },
            msg: 'string',
            name: 'string'
        },
    },
    customCheckerList: {
        existPath,
    },
    customMessages: {
        existPathError: 'path not exist',
    },
};
```
其中的schemaList、customCheckerList、customMessages是必须的，  
schemaList是标准的验证对象格式定义、customCheckerList是自定义验证函数列表、
customMessages是自定义报错信息的列表。

或者也可以使用如下方式初始化:
```$xslt
const {Validator,initValidatorWithObject} = require("@incpad/validator")
initValidatorWithObject(object);
```
这个object对象等同于之前文件export出的对象

然后就可以使用如下方式进行验证：
```$xslt
Validator("testSchema", targetObject)
```

同时，该库还导出了便捷函数checkFuncParam   
```$xslt
const {initValidatorWithObject, Validator, checkFuncParam} = require("../index");
const schema = {
    schemaList: {
        getGeoParamCheck: {
            cbSucc: "function",
            cbErr: "function"
        },
    },
    customCheckerList: {},
    customMessages: {},
};
initValidatorWithObject(schema);
function getGeo(cbSucc,cbErr){
    checkFuncParam("getGeoParamCheck", {cbSucc,cbErr});
}
```
如果校验失败，则会直接抛出参数格式不正确的错误


由于该库只是fastest-validator的再次封装，所以schema、返回值等等都和原库一致