@ aerokit/ sdk (英语)
以统一的TypeScript SDK为现代云平台,加快您的应用和集成开发.
概览
@aerokit/sdk 页:1 模块, (中文(简体) ), 服务器侧类型Script 为开发轻量级而设计的运行时间 API
应用、自动化脚本和跨云层或精密环境的扩展.
核心特征
- 类型脚本第一 API – 丰富的类型定义和IDE自动补全,用于生产,安全的脚本.
- 统一平台模式 – HTTP, I/O, Database, Filesystem, Security, Jobs, and Message 的常见抽象.
- 内置装饰器 - 简化发展方式
@Controller, (中文(简体) ),@Entity, (中文(简体) ),@Scheduled, (中文(简体) ),@Component, (中文(简体) ),@Injected, (中文(简体) ), 还有更多. - 无接缝依赖性注射 – 连接模块化业务逻辑的轻量级IoC机制.
- 可累积持久性 - 通过SQL和NoSQL工作
sdk/sdk/dbAPI (英语). - 企业准备的 HTTP 层 - 与
sdk/sdk/http。 。 。 . - 背景任务和听众 - 使用
sdk/sdk/job或事件驱动的听众sdk/component。 。 。 . - 广泛运行时间 - 在不重新部署的情况下动态部署、扩展和运行模块.
示例
CountryEntity.ts
import { Entity, Table, Id, Generated, Column, Documentation } from "@aerokit/sdk/db";
@Entity("CountryEntity")
@Table("SAMPLE_COUNTRY")
@Documentation("Sample Country Entity")
export class CountryEntity {
@Id()
@Generated("sequence")
@Column({ name: "COUNTRY_ID", type: "long" })
@Documentation("My Id")
public Id?: number;
@Column({ name: "COUNTRY_NAME", type: "string" })
@Documentation("My Name")
public Name?: string;
@Column({ name: "COUNTRY_CODE2", type: "string" })
public Code2?: string;
@Column({ name: "COUNTRY_CODE3", type: "string" })
public Code3?: string;
@Column({ name: "COUNTRY_NUMERIC", type: "string" })
public Numeric?: string;
}
CountryRepository.ts
import { Repository, EntityConstructor } from "@aerokit/sdk/db";
import { Component } from "@aerokit/sdk/component";
import { CountryEntity } from "./CountryEntity";
@Component('CountryRepository')
export class CountryRepository extends Repository<CountryEntity> {
constructor() {
super((CountryEntity as EntityConstructor));
}
}
CountryRepository;
CountryController.ts
import { Controller, Get, Documentation } from "@aerokit/sdk/http"
import { HttpUtils } from "@aerokit/sdk/http/utils";
import { Options } from "@aerokit/sdk/db";
import { Injected, Inject } from "@aerokit/sdk/component";
import { CountryEntity } from "./CountryEntity";
import { CountryRepository } from "./CountryRepository";
@Controller
@Documentation("Sample Country Controller")
@Injected()
class CountryController {
@Inject('CountryRepository')
private readonly repository!: CountryRepository;
@Get("/")
@Documentation("Sample Get All Countries")
public getAll(): CountryEntity[] {
try {
const options: Options = {limit: 20, offset: 0};
return this.repository.findAll(options);
} catch (error: any) {
HttpUtils.sendInternalServerError(error.message);
}
return [];
}
}
SDK 模块
| 模块 | 说明 |
|---|---|
@aerokit/sdk/bpm | 业务流程管理和工作流程自动化API. |
@aerokit/sdk/cache | 用于数据再利用和性能的内存和分布式缓存API. |
@aerokit/sdk/cms | 内容管理公用设施和储存库的存取. |
@aerokit/sdk/component | 依赖性注射和模块服务登记. |
@aerokit/sdk/core | 环境、配置和背景等核心运行时间公用事业. |
@aerokit/sdk/db | 拥有SQL和NoSQL支持的数据库访问,实体映射,以及交易. |
@aerokit/sdk/extensions | 运行时间扩展和动态插件注册机制. |
@aerokit/sdk/git | 存储器操作的 Git 集成( Cloone, 承诺, 推动等) . |
@aerokit/sdk/http | RESTful API和网络控制器的HTTP服务器框架. |
@aerokit/sdk/indexing | 索引和搜索API的全文和结构化内容. |
@aerokit/sdk/integrations | 连接外部企业系统的集成适配器. |
@aerokit/sdk/io | 文件,流,以及本地或远程源的存储 I/O 操作. |
@aerokit/sdk/job | 带有装饰器的日程安排和背景任务执行 . |
@aerokit/sdk/junit | 轻量级测试和运行时间验证设施. |
@aerokit/sdk/log | 集中采伐和监测接口. |
@aerokit/sdk/mail | 电子邮件组成、发送和通知服务. |
@aerokit/sdk/messaging | 与队列、主题和事件 API相连接的图层 . |
@aerokit/sdk/net | 网络公用事业如WebSocket,REST,和HTTP客户端业务. |
@aerokit/sdk/pdf | PDF 生成和操纵工具. |
@aerokit/sdk/platform | 平台生命周期管理、模块元数据和运行时间服务. |
@aerokit/sdk/security | 认证、授权和用户上下文管理. |
@aerokit/sdk/template | 动态文档和内容渲染的调温系统. |
@aerokit/sdk/utils | 用于字符串、日期和对象操纵的通用工具. |
使用大小写
- API-第一业务逻辑用于内部或客户应用.
- 企业系统之间的轻量级整合.
- 自动化脚本(计划或事件驱动).
- 自定义模块运行时间中的平台扩展.
哲学
@aerokit 遵循一个代码配置哲学——而不是XML或JSON描述符,您定义服务,
,并使用装饰器直接在 TypeScript 中工作.
这使得你的代码可以自我记录,可以测试,并跨环境可移植.
开始
npm install @aerokit/sdk
然后只导入您需要的东西 :
import { Request, Response } from "@aerokit/sdk/http";
import { Entity, Column } from "@aerokit/sdk/db";