@abapify/adt-contracts

中文文档
0.4.34发布于 2026/11/03MITTypeScriptES Module构建来源已验证近 30 天下载 6171

SAP ADT REST API contracts using speci + ts-xsd

原始使用文档
文档目录9 节
  1. What is it?
  2. Installation
  3. Usage
  4. With speci client
  5. Individual contracts
  6. Available Contracts
  7. Architecture
  8. Adding New Contracts
  9. License

@abapify/adt-contracts

version

SAP ADT REST API contracts — typed endpoint definitions using speci + ts-xsd schemas.

Part of the abapify monorepo.

What is it?

This package is the contract layer between adt-client and adt-schemas. It provides declarative REST API contracts for SAP ADT (ABAP Development Tools) endpoints.

┌─────────────────────────────────────────────────────────────────┐
│                      adt-client                               │
│              (HTTP Client + Request Execution)                   │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                      adt-contracts (this package)                │
│         (REST API Contracts using speci + ts-xsd)                │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                     adt-schemas                              │
│        (TypeScript schemas from SAP XSD definitions)             │
└─────────────────────────────────────────────────────────────────┘

Contracts are pure data structures that define:

  • Endpoint URLs - REST paths
  • HTTP methods - GET, POST, PUT, DELETE
  • Request/Response schemas - Using ts-xsd generated from SAP XSD definitions
  • Content-Types - SAP vendor-specific media types

Installation

bun add adt-contracts

Usage

With speci client

import { adtContract } from 'adt-contracts';
import { createClient } from 'speci/rest';

const client = createClient(adtContract, {
  baseUrl: 'https://sap-server.example.com/sap/bc/adt',
  adapter: myAdapter,
});

// Full type inference from XSD schemas!
const transport = await client.cts.getTransportRequests();
const classInfo = await client.oo.getClass('ZCL_MY_CLASS');

Individual contracts

import { ctsContract, atcContract, ooContract } from 'adt-contracts';

// Use specific contracts
const cts = createClient(ctsContract, config);
const atc = createClient(atcContract, config);

Available Contracts

ContractDescription
coreContractCore ADT object operations
ctsContractChange and Transport System
atcContractABAP Test Cockpit
ooContractObject-Oriented (classes, interfaces)

Architecture

adt-contracts (this package)
    ├── speci contracts (endpoint definitions)
    └── adt-schemas (ts-xsd schemas)
            └── ts-xsd (XSD → TypeScript)

Contracts are pure data - no HTTP client, no business logic. Use with any speci-compatible adapter.

Adding New Contracts

  1. Ensure schema exists in adt-schemas
  2. Create contract file in src/adt/<feature>/index.ts
  3. Define endpoints using adtHttp.get/post/put/delete
  4. Export from src/adt/index.ts
import { adtHttp } from '../../base';
import { mySchema } from 'adt-schemas';

export const myContract = {
  getResource: (id: string) =>
    adtHttp.get(`/my/endpoint/${id}`, {
      responses: { 200: mySchema },
      headers: { Accept: 'application/vnd.sap.adt.my.v1+xml' },
    }),
};

License

MIT

版本与发布记录

@abapify/adt-contracts 共发布 31 个版本,首次发布于 2026/04/21;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.34latest2026/11/033 天前
0.4.332026/11/023 天前
0.4.322026/11/023 天前
0.4.302026/10/316 天前
0.4.292026/10/306 天前
0.4.282026/10/307 天前

关于 @abapify/adt-contracts 的常见问题

@abapify/adt-contracts 是什么?

SAP ADT REST API contracts using speci + ts-xsd

如何安装 @abapify/adt-contracts?

在项目目录运行 npm install @abapify/adt-contracts,或使用 pnpm add / yarn add / bun add。

@abapify/adt-contracts 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@abapify/adt-contracts 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@abapify/adt-contracts 可以商用吗?

@abapify/adt-contracts 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@abapify/adt-contracts 的下载量有多少?

根据 npm 官方下载统计,@abapify/adt-contracts 在 2026/10/05 – 2026/11/03 这 30 天内被下载 6,171 次,日均约 206 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@abapify/adt-contracts 还在维护吗?

最新版本 0.4.34 发布于 2026/11/03(3 天前);至今共发布 31 个版本,其中过去 12 个月发布了 31 个;首次发布于 2026/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。