# automl-util

> * 基于 typescript 的常用函数库。 * Flowengine组件开发SDK。

Latest version **0.0.41-feat.3** (published 2022-09-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install automl-util
pnpm add automl-util
yarn add automl-util
bun add automl-util
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.41-feat.3 |
| Published | 2022-09-14 |
| First published | 2022-09-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 336.4 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | flowengine |

## Links

- npm: https://www.npmjs.com/package/automl-util
- npm.io page: https://npm.io/package/automl-util

## Dependencies (9)

- [yaml](https://npm.io/package/yaml.md) ^1.6.0
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [brace](https://npm.io/package/brace.md) ^0.11.1
- [cross-env](https://npm.io/package/cross-env.md) ^5.2.0
- [js-base64](https://npm.io/package/js-base64.md) ^2.5.0
- [typescript](https://npm.io/package/typescript.md) ^2.7.2
- [url-loader](https://npm.io/package/url-loader.md) ^1.0.1
- [@types/yaml](https://npm.io/package/@types/yaml.md) ^1.0.2
- [@types/js-base64](https://npm.io/package/@types/js-base64.md) ^2.3.1

## Recent versions

- 0.0.41-feat.3 (latest) — 2022-09-14
- 0.0.41-feat.2 — 2022-09-14

## README

## FlowEngine工具库

*   基于 typescript 的常用函数库。
*   Flowengine组件开发SDK。


## 安装

```javascript
npm set registry http://npm.4paradigm.com
npm i automl-util --save
```

## 使用FlowEngineSDK

### 1、组件配置态本地开发说明

#### 基本说明

SDK方法执行依赖运行时URL携带参数，本地开发时需在URL携带必要参数。

例如：localhost:8080/?type=running&templateId=1&workspaceId=1&componentId=113&engineKey=bug-verify-1&rootPath=/automl-engine/93/automl/v1


| 属性          | 说明                                       | 示例值                       |
| ------------- | ------------------------------------------ | --------------------------- |
| type          | 组件配置态运行环境 （FlowEngine、Developer） | running/editing             |
| templateId    | 模板ID                                     | 1                           |
| componentId   | 组件ID                                     | 1                           |
| workspaceId   | 工作区ID                                   | 1                           |
| rootPath      | API地址                                    | /automl-engine/93/automl/v1 |


#### 获取组件数据

```javascript
import { FlowEngineSDK } from 'automl-util';

const component = await FlowEngineSDK.Component();
const data = component.get();
console.log(data)
// data => 获取组件配置信息（组件yaml中的solution）
```

#### 保存组件数据

```javascript
import { FlowEngineSDK } from 'automl-util';

const component = await FlowEngineSDK.Component();
const resp = await component.save({}) => 
// 保存组件配置信息（组件yaml中的solution）参数传入Object对象（非字符串）
```

### 2、组件运行态本地开发说明

#### 基本说明

SDK方法执行依赖运行时URL携带参数，本地开发时需在URL携带必要参数。

例如：localhost:8080/?type=running&instanceId=1&workspaceId=1


| 属性          | 说明                                       | 示例值                       |
| ------------- | ------------------------------------------ | ----------------------------|
| instanceId    | FlowEngine实例ID                           | 1                           |
| workspaceId   | 工作区ID                                   | 1                           |

#### 获取FlowEngine系统参数

```javascript
import { FlowEngineSDK } from 'automl-util';

const engine = await FlowEngineSDK.Engine();
const systemParam = engine.getSystemParam();
console.log(systemParam);

// systemParam => 组件内获取FlowEngine系统参数

// 系统参数示例结构
interface ISystemParamDto {
    instanceId: number; // 实例ID
    selfLearnerUrl: string; // 自学习服务路径
    batchPredictorUrl: string; // 批量预估服务路径
    engineId: number; // 引擎ID
    engineTemplateId: number; // 模板ID
    engineDataInfo: IEngineDataInfo; // 引擎使用数据组信息
    template: ITemplate; // 引擎模板详细信息
    engineKey: string; // EngineKey
    engineName: string; // Engine名称
    isTemplateDebug: boolean; // 是否开启模板查看权限
    workspaceId: number; // WorkspaceId
    versionName: string; // 引擎版本名称
    isTemplateComplex: boolean; // 是否单表模式
    runningENV: "aio"; // 运行环境 
    systemTime: number; // 系统当前时间
}

```

#### 组件跳转FlowEngine页面

```javascript
import { FlowEngineSDK } from 'automl-util';

const message = await FlowEngineSDK.EngineMessage();
message.redirectToRoot();
// => 跳转到FlowEngine首页

message.redirectTo({
    url:"/template"
});
// => 跳转到FlowEngine指定路径

```

---
_Source: https://npm.io/package/automl-util · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
