
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@142vip/data-source
Advanced tools
TIPS:没数据源,可视化、数字孪生就是玩单机
@142vip/data-source模块可以用来连接多种数据源,支持从数据源快速获取数据
# npm
npm install @142vip/data-source
# pnpm
pnpm i @142vip/data-source
按照数据来源,将数据源分为CSV型、API型、SQL数据库型三种类型。
export interface MyDataSourceOptions {
// coding xxx
}
import { DataSourceConnector } from '@142vip/data-source'
export class MyDataSource implements DataSourceConnector<MyDataSourceOptions> {
/**
* 获取连接数据
*/
public async getConnectionData(options: MyDataSourceOptions): Promise<DataSourceParseResponse> {
try {
// coding xxx
}
catch (error) {
return handlerDataSourceConnectError(VipPostgreSql.name, error)
}
finally {
await pgClient?.end()
}
}
}
基于DataSourceManager接口,封装parseData、testConnect、getDataBaseNames等常用方法。
/**
* 自定义数据源
*/
export class MyDataSource implements DataSourceManager {
/**
* 解析数据
*/
public async parseData(): Promise<DataSourceParseResponse> {
// coding xxx
}
/**
* 测试连接
*/
public testConnect(): Promise<DataSourceParseResponse> {
// coding xxx
}
/**
* 获取表名列表
*/
public getDataBaseNames(): Promise<DataSourceParseResponse<string[]>> {
// coding xxx
}
/**
* 获取表名列表
*/
public getTableNames(): Promise<DataSourceParseResponse<DataSourceTable[]>> {
// coding xxx
}
/**
* 获取表字段列表
*/
public getTableColumns(tableName: string, schema?: string): Promise<DataSourceParseResponse<DataSourceColumn[]>> {
// coding xxx
}
}
Copyright (c) 2019-present, @142vip 储凡
仅供学习参考,商业使用请保留作者版权信息,作者不保证也不承担任何软件的使用风险。
FAQs
通用型数据源,支持多种数据库、API、CSV等形式的数据源管理
We found that @142vip/data-source demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.