@abapify/adt-contracts 0.4.34 → 0.4.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,115 +1,35 @@
1
1
  # @abapify/adt-contracts
2
2
 
3
- [![version](https://img.shields.io/github/package-json/v/abapify/adt-cli?filename=packages/adt-contracts/package.json)](https://github.com/abapify/adt-cli/pkgs/npm/%40abapify%2Fadt-contracts)
3
+ [![npm](https://img.shields.io/npm/v/%40abapify%2Fadt-contracts)](https://www.npmjs.com/package/@abapify/adt-contracts)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/abapify/adt-cli/blob/main/LICENSE)
4
5
 
5
- **SAP ADT REST API contracts** — typed endpoint definitions using `speci` + `ts-xsd` schemas.
6
+ SAP ADT REST API contracts using speci + ts-xsd.
6
7
 
7
- Part of the [abapify monorepo](../../README.md).
8
-
9
- ## What is it?
10
-
11
- 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.
12
-
13
- ```
14
- ┌─────────────────────────────────────────────────────────────────┐
15
- │ adt-client │
16
- │ (HTTP Client + Request Execution) │
17
- └─────────────────────────────────────────────────────────────────┘
18
- │
19
- ▼
20
- ┌─────────────────────────────────────────────────────────────────┐
21
- │ adt-contracts (this package) │
22
- │ (REST API Contracts using speci + ts-xsd) │
23
- └─────────────────────────────────────────────────────────────────┘
24
- │
25
- ▼
26
- ┌─────────────────────────────────────────────────────────────────┐
27
- │ adt-schemas │
28
- │ (TypeScript schemas from SAP XSD definitions) │
29
- └─────────────────────────────────────────────────────────────────┘
30
- ```
31
-
32
- Contracts are pure data structures that define:
33
-
34
- - **Endpoint URLs** - REST paths
35
- - **HTTP methods** - GET, POST, PUT, DELETE
36
- - **Request/Response schemas** - Using `ts-xsd` generated from SAP XSD definitions
37
- - **Content-Types** - SAP vendor-specific media types
38
-
39
- ## Installation
8
+ ## Install
40
9
 
41
10
  ```bash
42
- bun add adt-contracts
11
+ npm install @abapify/adt-contracts
43
12
  ```
44
13
 
45
14
  ## Usage
46
15
 
47
- ### With speci client
48
-
49
- ```typescript
50
- import { adtContract } from 'adt-contracts';
51
- import { createClient } from 'speci/rest';
52
-
53
- const client = createClient(adtContract, {
54
- baseUrl: 'https://sap-server.example.com/sap/bc/adt',
55
- adapter: myAdapter,
56
- });
57
-
58
- // Full type inference from XSD schemas!
59
- const transport = await client.cts.getTransportRequests();
60
- const classInfo = await client.oo.getClass('ZCL_MY_CLASS');
61
- ```
62
-
63
- ### Individual contracts
64
-
65
- ```typescript
66
- import { ctsContract, atcContract, ooContract } from 'adt-contracts';
16
+ ```ts
17
+ import { adtContract } from '@abapify/adt-contracts';
18
+ import { createClient } from '@abapify/speci/rest';
67
19
 
68
- // Use specific contracts
69
- const cts = createClient(ctsContract, config);
70
- const atc = createClient(atcContract, config);
20
+ const client = createClient(adtContract, { baseUrl, adapter });
71
21
  ```
72
22
 
73
- ## Available Contracts
23
+ ## Features
74
24
 
75
- | Contract | Description |
76
- | -------------- | ------------------------------------- |
77
- | `coreContract` | Core ADT object operations |
78
- | `ctsContract` | Change and Transport System |
79
- | `atcContract` | ABAP Test Cockpit |
80
- | `ooContract` | Object-Oriented (classes, interfaces) |
25
+ - Typed ADT REST contracts built with `speci` + `ts-xsd`
26
+ - Request / response types inferred from SAP XSD schemas
27
+ - Single source for the client, mock server, and proxy
81
28
 
82
- ## Architecture
83
-
84
- ```
85
- adt-contracts (this package)
86
- ├── speci contracts (endpoint definitions)
87
- └── adt-schemas (ts-xsd schemas)
88
- └── ts-xsd (XSD → TypeScript)
89
- ```
29
+ ## Documentation
90
30
 
91
- **Contracts are pure data** - no HTTP client, no business logic. Use with any `speci`-compatible adapter.
92
-
93
- ## Adding New Contracts
94
-
95
- 1. Ensure schema exists in `adt-schemas`
96
- 2. Create contract file in `src/adt/<feature>/index.ts`
97
- 3. Define endpoints using `adtHttp.get/post/put/delete`
98
- 4. Export from `src/adt/index.ts`
99
-
100
- ```typescript
101
- import { adtHttp } from '../../base';
102
- import { mySchema } from 'adt-schemas';
103
-
104
- export const myContract = {
105
- getResource: (id: string) =>
106
- adtHttp.get(`/my/endpoint/${id}`, {
107
- responses: { 200: mySchema },
108
- headers: { Accept: 'application/vnd.sap.adt.my.v1+xml' },
109
- }),
110
- };
111
- ```
31
+ **[adt-cli.netlify.app/sdk/packages/adt-contracts](https://adt-cli.netlify.app/sdk/packages/adt-contracts)**
112
32
 
113
- ## License
33
+ ---
114
34
 
115
- MIT
35
+ Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
@@ -10,7 +10,7 @@ import { createClient, http, http as http$1 } from "@abapify/speci/rest";
10
10
  * to decide whether the descriptor carries a body schema.
11
11
  */
12
12
  const textPlain = {
13
- parse: (x) => String(x),
13
+ parse: String,
14
14
  build: (x) => x,
15
15
  _infer: void 0
16
16
  };
@@ -429,7 +429,7 @@ const addTaskBodySchema = {
429
429
  _infer: void 0,
430
430
  parse: (raw) => {
431
431
  const root = transportmanagment.parse(raw)?.root;
432
- if (!root || !root.targetuser) throw new Error("Invalid CTS add-task body");
432
+ if (!root?.targetuser) throw new Error("Invalid CTS add-task body");
433
433
  return { root: { targetuser: root.targetuser } };
434
434
  },
435
435
  build: (body) => transportmanagment.build(body)
@@ -1201,7 +1201,7 @@ function buildUsageReferenceRequestXml(scopeResultXml) {
1201
1201
  const prologEnd = noProlog.indexOf("?>");
1202
1202
  if (prologEnd !== -1) noProlog = noProlog.slice(prologEnd + 2).replace(/^\s+/, "");
1203
1203
  }
1204
- const scopeElement = noProlog.replaceAll(/usagereferences:usageScopeResult/g, "usagereferences:scope");
1204
+ const scopeElement = noProlog.replaceAll("usagereferences:usageScopeResult", "usagereferences:scope");
1205
1205
  return `<?xml version="1.0" encoding="UTF-8"?>
1206
1206
  <usagereferences:usageReferenceRequest xmlns:usagereferences="${USAGEREFS_NAMESPACE}">\n <usagereferences:affectedObjects/>
1207
1207
  ${scopeElement}\n</usagereferences:usageReferenceRequest>`;
@@ -1873,9 +1873,9 @@ const usersContract = {
1873
1873
  * NOTE: sapcli (jfilak/sapcli) drives STRUST via RFC function modules
1874
1874
  * (`sap/rfc/strust.py`), not ADT. The paths below follow the
1875
1875
  * `/sap/bc/adt/system/...` convention used elsewhere in the SAP ADT
1876
- * REST surface (see `system/users`). See the accompanying TODO-synthetic
1877
- * fixtures in `@abapify/adt-fixtures` — replace with real captures when
1878
- * available.
1876
+ * REST surface (see `system/users`). See the accompanying synthetic
1877
+ * fixtures in `@abapify/adt-fixtures` — fabricated stand-ins that await
1878
+ * real captures.
1879
1879
  */
1880
1880
  /**
1881
1881
  * Inferrable schema wrapper for a PEM (plain-text) request body.
@@ -2972,4 +2972,4 @@ function contract(definition) {
2972
2972
  }
2973
2973
 
2974
2974
  export { coverageContract as $, usageReferencesContract as $t, gctsBranchesSchema as A, structuresContract as At, gctsPullSchema as B, objectstructureContract as Bt, enhancementsContract as C, dclContract as Ct, boContract as D, tabletypesContract as Dt, bindingsContract as E, ddlSourcesContract as Et, gctsCreateBranchResponseSchema as F, functionGroupsContract as Ft, runtimeContract as G, sourceversionsContract as Gt, gctsRepositorySchema as H, OBJECT_PROPERTIES_RESULT_MIME as Ht, gctsCreateRepositoryBodySchema as I, programsModuleContract as It, profile as J, SEARCH_REQUEST_MIME as Jt, dumps as K, SCOPE_REQUEST_MIME as Kt, gctsGenericOkSchema as L, includesContract as Lt, gctsCommitResponseSchema as M, domainsContract as Mt, gctsConfigSchema as N, functionsContract as Nt, behaviordefinitionsContract as O, tablesettingsContract as Ot, gctsCreateBranchBodySchema as P, functionModulesContract as Pt, runtimeTraceListSchema as Q, buildUsageScopeRequestXml as Qt, gctsLogSchema as R, programsContract as Rt, normalizeOdataFeed as S, ddlxSourcesContract as St, businessservicesContract as T, ddlContract as Tt, gctsSetConfigBodySchema as U, objectPropertiesContract as Ut, gctsRepositoriesSchema as V, informationsystemContract as Vt, gctsSetItemBodySchema as W, assertAdtRelativeUri as Wt, runtimeDumpListSchema as X, USAGEREFS_NAMESPACE as Xt, runtimeDumpDetailSchema as Y, SEARCH_RESPONSE_MIME as Yt, runtimeTraceDetailSchema as Z, buildUsageReferenceRequestXml as Zt, flpGroupListSchema as _, TransportStatus as _n, dtebSourcesContract as _t, vitContract as a, packagesContract as an, extractCoverageStatementUris as at, flpTileSchema as b, crud as bn, dsfdSourcesContract as bt, CLASSIC_BADI_IMPLEMENTATION_VIT_TYPE as c, classrunContract as cn, activationContract as ct, completion as d, aunitContract as dn, psesContract as dt, searchContract as en, statements as et, completionRequestSchema as f, atcContract as fn, usersContract as ft, flpCatalogSchema as g, TransportFunction as gn, dtebContract as gt, flpCatalogListSchema as h, ctsContract as hn, srvdSourcesContract as ht, adtContract as i, sessionsContract as in, coverageXmlBody as it, gctsCommitBodySchema as j, dataelementsContract as jt, gctsContract as k, tablesContract as kt, vitWbObjectPropertiesContract as l, interfacesContract as ln, checkrunsContract as lt, flpContract as m, worklistsContract as mn, srvdContract as mt, createAdtClient as n, httpContract as nn, buildCoverageQuery as nt, BASIC_OBJECT_PROPERTIES_MIME as o, discoveryContract as on, datapreviewContract as ot, completionResponseSchema as p, resultsContract as pn, ddicContract as pt, tracesContract as q, SCOPE_RESPONSE_MIME as qt, http$1 as r, systeminformationContract as rn, buildStatementsBulkRequest as rt, CLASSIC_BADI_DEFINITION_VIT_TYPE as s, ooContract as sn, freestyle as st, contract as t, coreContract as tn, measurements as tt, codeassistanceContract as u, classesContract as un, systemContract as ut, flpGroupSchema as v, normalizeTransportFindResponse as vn, dsfiContract as vt, enhoxhhContract as w, dclSourcesContract as wt, normalizeOdataEntity as x, repo as xn, ddlxContract as xt, flpTileListSchema as y, transports as yn, dsfdContract as yt, gctsObjectsSchema as z, repositoryContract as zt };
2975
- //# sourceMappingURL=base-Xx5fRmGN.mjs.map
2975
+ //# sourceMappingURL=base-BMiBb0Wt.mjs.map