@abapify/adt-plugin-gcts 0.4.34 → 0.4.37

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,42 +1,18 @@
1
1
  # @abapify/adt-plugin-gcts
2
2
 
3
- **Status:** v0.1 (E06 — SAP → disk direction)
3
+ [![npm](https://img.shields.io/npm/v/%40abapify%2Fadt-plugin-gcts)](https://www.npmjs.com/package/@abapify/adt-plugin-gcts)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/abapify/adt-cli/blob/main/LICENSE)
4
5
 
5
- Serializes ABAP objects to **gCTS / AFF** layout (`SAP/abap-file-formats`):
6
- JSON metadata files (`<name>.<type>.json`) alongside source files
7
- (`<name>.<type>.abap`, `.asddls`, `.asdcls`).
6
+ gCTS (git-enabled CTS) plugin for adt-cli — repository, commit, pull/push operations on SAP gCTS.
8
7
 
9
- ## Why a single plugin for both gCTS and AFF?
8
+ ## Install
10
9
 
11
- gCTS (git-enabled CTS) and AFF (`SAP/abap-file-formats`) use the same
12
- on-disk layout: JSON metadata, AFF-specific extensions, `(ns)` bracket
13
- namespace folders. A single `--format gcts` (alias: `--format aff`) serves
14
- both communities. The open question on naming is tracked in
15
- `docs/roadmap/epics/e06-gcts-format-plugin.md`.
16
-
17
- ## Filename conventions
18
-
19
- | Object | Metadata | Source |
20
- | ------ | ------------------- | ----------------------------------------------------------------- |
21
- | CLAS | `<name>.clas.json` | `<name>.clas.abap` (+ `.locals_def.abap`, `.testclasses.abap`, …) |
22
- | INTF | `<name>.intf.json` | `<name>.intf.abap` |
23
- | PROG | `<name>.prog.json` | `<name>.prog.abap` |
24
- | FUGR | `<name>.fugr.json` | — (FM files handled separately) |
25
- | DOMA | `<name>.doma.json` | — |
26
- | DTEL | `<name>.dtel.json` | — |
27
- | TABL | `<name>.tabl.json` | — |
28
- | TTYP | `<name>.ttyp.json` | — |
29
- | DEVC | `package.devc.json` | — |
30
- | DDLS | `<name>.ddls.json` | `<name>.ddls.asddls` |
31
- | DCLS | `<name>.dcls.json` | `<name>.dcls.asdcls` |
32
-
33
- vs abapGit: metadata is **JSON** (not XML) and CDS uses **`.asddls` /
34
- `.asdcls`** (not `.acds`).
10
+ ```bash
11
+ npm install @abapify/adt-plugin-gcts
12
+ ```
35
13
 
36
14
  ## Usage
37
15
 
38
- Install and import — the plugin self-registers:
39
-
40
16
  ```ts
41
17
  import '@abapify/adt-plugin-gcts';
42
18
  import { getFormatPlugin } from '@abapify/adt-plugin';
@@ -44,22 +20,15 @@ import { getFormatPlugin } from '@abapify/adt-plugin';
44
20
  const gcts = getFormatPlugin('gcts')!;
45
21
  ```
46
22
 
47
- Via the CLI (after E06 wiring):
48
-
49
- ```bash
50
- bunx adt import package --format gcts ZMYPKG ./out
51
- ```
23
+ ## Features
52
24
 
53
- The SAP → disk direction is fully supported in v0.1. disk → SAP (adt-cli's
54
- `export` command) is deferred — see the epic's "Open questions".
25
+ - gCTS / ABAP File Formats (AFF) serialization
26
+ - Registers itself as the `gcts` format plugin
55
27
 
56
- ## Architecture
28
+ ## Documentation
57
29
 
58
- This plugin is a peer of `@abapify/adt-plugin-abapgit`:
30
+ **[adt-cli.netlify.app/sdk/packages/adt-plugin-gcts](https://adt-cli.netlify.app/sdk/packages/adt-plugin-gcts)**
59
31
 
60
- - `FormatPlugin` (declarative contract) is in `src/lib/format/gcts-format.ts`
61
- - `AdtPlugin` (higher-level import behaviour) is in `src/lib/gcts-plugin.ts`
62
- - Per-object-type handlers live in `src/lib/handlers/objects/` and
63
- auto-register through the `createHandler` factory in `handlers/base.ts`
32
+ ---
64
33
 
65
- See [`AGENTS.md`](./AGENTS.md) for internal conventions.
34
+ Part of [**abapify**](https://github.com/abapify/adt-cli) — open, typed tooling for SAP ABAP Development Tools (ADT): CLI, MCP server, and SDK.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AdtPlugin, AdtPlugin as AdtPlugin$1, FormatHandler, FormatHandler as FormatHandler$1, FormatPlugin, FormatPlugin as FormatPlugin$1, ParsedFormatFilename, SerializedFile, SerializedFile as SerializedFile$1 } from "@abapify/adt-plugin";
2
- import { AdkClass, AdkDataElement, AdkDomain, AdkFunctionGroup, AdkInterface, AdkKind, AdkObject, AdkPackage, AdkProgram, AdkTable, AdkTableType } from "@abapify/adk";
2
+ import { AdkDataElement, AdkDomain, AdkKind, AdkObject, AdkProgram } from "@abapify/adk";
3
3
  /**
4
4
  * gCTS / AFF format type definitions.
5
5
  *
@@ -14,28 +14,35 @@ import { AdkClass, AdkDataElement, AdkDomain, AdkFunctionGroup, AdkInterface, Ad
14
14
  */
15
15
  /** Header common to every AFF/gCTS metadata JSON file. */
16
16
  interface GctsHeader {
17
- /** AFF format version (e.g. `1.0`). */
18
- formatVersion: string;
17
+ /** Legacy header version; current AFF schemas put formatVersion at the top level. */
18
+ formatVersion?: string;
19
19
  /** Description of the object. */
20
20
  description?: string;
21
21
  /** Master language (ISO code, lowercase — e.g. `en`). */
22
22
  originalLanguage?: string;
23
23
  /** ABAP language version (e.g. `standard`, `cloudDevelopment`). */
24
24
  abapLanguageVersion?: string;
25
- /** Indicates whether the object source is Unicode. */
26
- [key: string]: unknown;
27
25
  }
28
26
  /**
29
27
  * Top-level shape of an AFF/gCTS metadata JSON file.
30
28
  *
31
29
  * Concrete handlers tighten this with per-type payload shapes.
30
+ *
31
+ * A format version is mandatory: either the current top-level `formatVersion`
32
+ * or the legacy `header.formatVersion`.
32
33
  */
33
- interface GctsMetadata<_TPayload extends object = object> {
34
+ type GctsMetadata<_TPayload extends object = object> = {
35
+ /** Current AFF format version. */
36
+ formatVersion: string;
34
37
  /** Format header (mandatory on every file). */
35
38
  header: GctsHeader;
36
- /** Type-specific payload. Extended per ABAP object type. */
37
- [payloadKey: string]: unknown;
38
- }
39
+ } | {
40
+ formatVersion?: string;
41
+ /** Legacy form: the version lives in the header. */
42
+ header: GctsHeader & {
43
+ formatVersion: string;
44
+ };
45
+ };
39
46
  /** Convenience helper for concrete metadata shapes. */
40
47
  type WithHeader<TPayload extends object> = {
41
48
  header: GctsHeader;
@@ -98,7 +105,7 @@ declare function parseGctsFilename(filename: string): ParsedFormatFilename | und
98
105
  * Matches the `adtUriToAbapGitPath` helper in the abapGit plugin.
99
106
  */
100
107
  declare function adtUriToGctsPath(uri: string): string | undefined;
101
- type AbapObjectType = string;
108
+ type HandlerObject = Pick<AdkObject, 'name'>;
102
109
  type AdkObjectClass<T extends AdkObject = AdkObject> = {
103
110
  new (...args: any[]): T;
104
111
  readonly kind: AdkKind;
@@ -136,7 +143,7 @@ interface GctsExtraFile {
136
143
  * friction. The `toMetadata` function is the only required hook: it maps an
137
144
  * ADK object to the JSON metadata shape for the target type.
138
145
  */
139
- interface GctsHandlerDefinition<T extends AdkObject, M extends GctsMetadata = GctsMetadata> {
146
+ interface GctsHandlerDefinition<T extends HandlerObject, M extends GctsMetadata = GctsMetadata> {
140
147
  /** Map ADK object → JSON metadata payload (including the required `header`). */
141
148
  toMetadata(object: T): M;
142
149
  /** Optional: single primary source file. */
@@ -161,8 +168,8 @@ interface GctsHandlerDefinition<T extends AdkObject, M extends GctsMetadata = Gc
161
168
  setSources?(object: T, sources: Record<string, string>): void;
162
169
  }
163
170
  /** Runtime shape of a gCTS handler after `createHandler` processing. */
164
- interface GctsHandler<T extends AdkObject = AdkObject> extends FormatHandler$1 {
165
- readonly type: AbapObjectType;
171
+ interface GctsHandler<T extends HandlerObject = AdkObject> extends FormatHandler$1 {
172
+ readonly type: string;
166
173
  readonly fileExtension: string;
167
174
  readonly schema: {
168
175
  parse(raw: string): unknown;
@@ -175,85 +182,13 @@ interface GctsHandler<T extends AdkObject = AdkObject> extends FormatHandler$1 {
175
182
  setSources?(object: T, sources: Record<string, string>): void;
176
183
  }
177
184
  /** Look up a handler (full-type first, then main-type fallback). */
178
- declare function getHandler(type: AbapObjectType): GctsHandler | undefined;
185
+ declare function getHandler(type: string): GctsHandler<HandlerObject> | undefined;
179
186
  /** `true` iff the given object type has a registered handler. */
180
- declare function isSupported(type: AbapObjectType): boolean;
187
+ declare function isSupported(type: string): boolean;
181
188
  /** Snapshot of all registered object types. */
182
- declare function getSupportedTypes(): AbapObjectType[];
183
- /**
184
- * Register a handler for an ADK class (preferred — `type` is derived from
185
- * the static `kind`) or an explicit type string (for types without an ADK
186
- * class, e.g. DOMA/DTEL).
187
- */
188
- declare function createHandler<T extends AdkObject, M extends GctsMetadata = GctsMetadata>(adkClass: AdkObjectClass<T>, definition: GctsHandlerDefinition<T, M>): GctsHandler<T>;
189
- declare function createHandler<T extends AdkObject, M extends GctsMetadata = GctsMetadata>(type: AbapObjectType, definition: GctsHandlerDefinition<T, M>): GctsHandler<T>;
190
- declare const gctsFormatPlugin: FormatPlugin$1;
191
- declare const gctsPlugin: AdtPlugin$1;
192
- /**
193
- * AFF schema access over the `git_modules/abap-file-formats` submodule.
194
- *
195
- * The submodule pin (`.gitmodules`) is the provenance record — schemas and
196
- * examples are always read from it at the pinned upstream SHA. This module
197
- * has no workspace dependencies (ajv + node builtins only) so schema
198
- * conformance tests run without building the workspace.
199
- */
200
- /** Resolved AFF schema root, or `undefined` when unavailable. */
201
- declare function affRoot(): string | undefined;
202
- /** All official AFF object types (directories in `file-formats/`). */
203
- declare function listAffTypes(): string[];
204
- /**
205
- * Reference to a schema-bearing AFF artefact: an object `type` code plus an
206
- * optional format `version` (defaults to the latest wherever it matters).
207
- */
208
- interface AffRef {
209
- type: string;
210
- version?: number;
211
- }
212
- /** Format versions available for a type, newest first. */
213
- declare function affVersions(ref: AffRef): number[];
214
- declare function latestAffVersion(ref: AffRef): number | undefined;
215
- interface AffSchema {
216
- title: string;
217
- type: string;
218
- properties: Record<string, {
219
- const?: string;
220
- type?: string;
221
- }>;
222
- required?: string[];
223
- [key: string]: unknown;
224
- }
225
- declare function affSchema(ref: AffRef): AffSchema;
226
- /**
227
- * Top-level body properties of a type's schema (everything beyond the
228
- * mandatory `formatVersion`/`header` envelope), newest version by default.
229
- * Empty array for header-only types or when schemas are unavailable.
230
- */
231
- declare function affBodyProps(ref: AffRef): string[];
232
- /** Validate AFF JSON against the official schema for `ref`. */
233
- declare function affValidate(ref: AffRef, json: unknown): {
234
- valid: boolean;
235
- errors: string[];
236
- };
237
- /**
238
- * Example JSON files shipped with a type — recursively, relative paths.
239
- * Companion files (`.docu.json`, LIMU sub-objects like `.reps.json`) are
240
- * included; callers match each to its schema (see `schemaTargetForExample`).
241
- */
242
- declare function affExamples(ref: AffRef): string[];
243
- /**
244
- * Pick the schema a given example file should validate against.
245
- *
246
- * - `z_x.doma.docu.json` → the `docu` schema (companion documentation)
247
- * - `x.fugr.z_fm.func.json` / `x.fugr.y.reps.json` → the LIMU
248
- * sub-object's own schema (nested under the parent type dir)
249
- * - otherwise → the type's own schema at the example's `formatVersion`
250
- */
251
- declare function schemaTargetForExample(ref: AffRef, filename: string, json: unknown): {
252
- type: string;
253
- version?: number;
254
- companion: boolean;
255
- };
256
- declare function readAffExample(ref: AffRef, rel: string): Record<string, unknown>;
189
+ declare function getSupportedTypes(): string[];
190
+ declare function createHandler<T extends HandlerObject, M extends GctsMetadata = GctsMetadata>(adkClass: AdkObjectClass, definition: GctsHandlerDefinition<T, M>): GctsHandler<T>;
191
+ declare function createHandler<T extends HandlerObject, M extends GctsMetadata = GctsMetadata>(type: string, definition: GctsHandlerDefinition<T, M>): GctsHandler<T>;
257
192
  declare namespace advc_v1_d_exports {
258
193
  export { ABAPLanguageVersion$84 as ABAPLanguageVersion, AdvcAff, AffAdvcV1, Description$91 as Description, FormatVersion$27 as FormatVersion, Header$90 as Header, OriginalLanguage$89 as OriginalLanguage };
259
194
  }
@@ -11645,5 +11580,74 @@ type UistAff = AffUistV1;
11645
11580
  declare namespace index_d_exports {
11646
11581
  export { AdvcAff, advc_v1_d_exports as AdvcV1, AifaAff, aifa_v1_d_exports as AifaV1, AifdAff, aifd_v1_d_exports as AifdV1, AiffAff, aiff_v1_d_exports as AiffV1, AifiAff, aifi_v1_d_exports as AifiV1, AifnAff, aifn_v1_d_exports as AifnV1, AifpAff, aifp_v1_d_exports as AifpV1, AifrAff, aifr_v1_d_exports as AifrV1, AobjAff, aobj_v1_d_exports as AobjV1, ApicAff, apic_v1_d_exports as ApicV1, AploAff, aplo_v1_d_exports as AploV1, ApobAff, apob_v1_d_exports as ApobV1, BdefAff, bdef_v1_d_exports as BdefV1, BgqcAff, bgqc_v1_d_exports as BgqcV1, CdboAff, cdbo_v1_d_exports as CdboV1, CfdfAff, cfdf_v1_d_exports as CfdfV1, cfdf_v2_d_exports as CfdfV2, ChdoAff, chdo_v1_d_exports as ChdoV1, ChkcAff, chkc_v1_d_exports as ChkcV1, ChkoAff, chko_v1_d_exports as ChkoV1, ChkvAff, chkv_v1_d_exports as ChkvV1, ClasAff, clas_v1_d_exports as ClasV1, CotaAff, cota_v1_d_exports as CotaV1, CsnmAff, csnm_v1_d_exports as CsnmV1, DcatAff, dcat_v1_d_exports as DcatV1, DclsAff, dcls_v1_d_exports as DclsV1, DdlaAff, ddla_v1_d_exports as DdlaV1, DdlsAff, ddls_v1_d_exports as DdlsV1, DdlxAff, ddlx_v1_d_exports as DdlxV1, DesdAff, desd_v1_d_exports as DesdV1, DmonAff, dmon_v1_d_exports as DmonV1, DobjAff, dobj_v1_d_exports as DobjV1, DocuAff, docu_v1_d_exports as DocuV1, DomaAff, doma_v1_d_exports as DomaV1, DrasAff, dras_v1_d_exports as DrasV1, DrtyAff, drty_v1_d_exports as DrtyV1, DsfdAff, dsfd_v1_d_exports as DsfdV1, DsfiAff, dsfi_v1_d_exports as DsfiV1, DtdcAff, dtdc_v1_d_exports as DtdcV1, DtebAff, dteb_v1_d_exports as DtebV1, DtelAff, dtel_v1_d_exports as DtelV1, DtixAff, dtix_v1_d_exports as DtixV1, DtscAff, dtsc_v1_d_exports as DtscV1, EdccAff, edcc_v1_d_exports as EdccV1, EdckAff, edck_v1_d_exports as EdckV1, EdcrAff, edcr_v1_d_exports as EdcrV1, EdoiAff, edoi_v1_d_exports as EdoiV1, EeecAff, eeec_v1_d_exports as EeecV1, EnhoAff, enho_v1_d_exports as EnhoV1, EnhsAff, enhs_v1_d_exports as EnhsV1, EnquAff, enqu_v1_d_exports as EnquV1, EvtbAff, evtb_v1_d_exports as EvtbV1, EvtoAff, evto_v1_d_exports as EvtoV1, FugrAff, fugr_v1_d_exports as FugrV1, FuncAff, func_v1_d_exports as FuncV1, GsmpAff, gsmp_v1_d_exports as GsmpV1, HttpAff, http_v1_d_exports as HttpV1, IlmbAff, ilmb_v1_d_exports as IlmbV1, IntfAff, intf_v1_d_exports as IntfV1, IntmAff, intm_v1_d_exports as IntmV1, IntsAff, ints_v1_d_exports as IntsV1, IwngAff, iwng_v1_d_exports as IwngV1, MsagAff, msag_v1_d_exports as MsagV1, NontAff, nont_v1_d_exports as NontV1, NrobAff, nrob_v1_d_exports as NrobV1, NttaAff, ntta_v1_d_exports as NttaV1, NttyAff, ntty_v1_d_exports as NttyV1, ProgAff, prog_v1_d_exports as ProgV1, RepsAff, reps_v1_d_exports as RepsV1, RontAff, ront_v1_d_exports as RontV1, RvbcAff, rvbc_v1_d_exports as RvbcV1, SaiaAff, saia_v1_d_exports as SaiaV1, SajcAff, sajc_v1_d_exports as SajcV1, SajtAff, sajt_v1_d_exports as SajtV1, Scp1Aff, scp1_v1_d_exports as Scp1V1, SfpfAff, sfpf_v1_d_exports as SfpfV1, SiadAff, siad_v1_d_exports as SiadV1, SitoAff, sito_v1_d_exports as SitoV1, sito_v2_d_exports as SitoV2, SmbcAff, smbc_v1_d_exports as SmbcV1, SmtgAff, smtg_v1_d_exports as SmtgV1, SprvAff, sprv_v1_d_exports as SprvV1, SrvbAff, srvb_v1_d_exports as SrvbV1, SrvcAff, srvc_v1_d_exports as SrvcV1, SrvdAff, srvd_v1_d_exports as SrvdV1, SucoAff, suco_v1_d_exports as SucoV1, SusiAff, susi_v1_d_exports as SusiV1, SwcrAff, swcr_v1_d_exports as SwcrV1, SxtgAff, sxtg_v1_d_exports as SxtgV1, UiadAff, uiad_v1_d_exports as UiadV1, uiad_v2_d_exports as UiadV2, UipgAff, uipg_v1_d_exports as UipgV1, UistAff, uist_v1_d_exports as UistV1 };
11647
11582
  }
11583
+ declare const gctsFormatPlugin: FormatPlugin$1;
11584
+ declare const gctsPlugin: AdtPlugin$1;
11585
+ /**
11586
+ * AFF schema access over the `git_modules/abap-file-formats` submodule.
11587
+ *
11588
+ * The submodule pin (`.gitmodules`) is the provenance record — schemas and
11589
+ * examples are always read from it at the pinned upstream SHA. This module
11590
+ * has no workspace dependencies (ajv + node builtins only) so schema
11591
+ * conformance tests run without building the workspace.
11592
+ */
11593
+ /** Resolved AFF schema root, or `undefined` when unavailable. */
11594
+ declare function affRoot(): string | undefined;
11595
+ /** All official AFF object types (directories in `file-formats/`). */
11596
+ declare function listAffTypes(): string[];
11597
+ /**
11598
+ * Reference to a schema-bearing AFF artefact: an object `type` code plus an
11599
+ * optional format `version` (defaults to the latest wherever it matters).
11600
+ */
11601
+ interface AffRef {
11602
+ type: string;
11603
+ version?: number;
11604
+ }
11605
+ /** Format versions available for a type, newest first. */
11606
+ declare function affVersions(ref: AffRef): number[];
11607
+ declare function latestAffVersion(ref: AffRef): number | undefined;
11608
+ interface AffSchemaProperty {
11609
+ const?: string;
11610
+ type?: string;
11611
+ properties?: Record<string, AffSchemaProperty>;
11612
+ }
11613
+ interface AffSchema {
11614
+ title: string;
11615
+ type: string;
11616
+ properties: Record<string, AffSchemaProperty>;
11617
+ required?: string[];
11618
+ [key: string]: unknown;
11619
+ }
11620
+ declare function affSchema(ref: AffRef): AffSchema;
11621
+ /**
11622
+ * Top-level body properties of a type's schema (everything beyond the
11623
+ * mandatory `formatVersion`/`header` envelope), newest version by default.
11624
+ * Empty array for header-only types or when schemas are unavailable.
11625
+ */
11626
+ declare function affBodyProps(ref: AffRef): string[];
11627
+ /** Validate AFF JSON against the official schema for `ref`. */
11628
+ declare function affValidate(ref: AffRef, json: unknown): {
11629
+ valid: boolean;
11630
+ errors: string[];
11631
+ };
11632
+ /**
11633
+ * Example JSON files shipped with a type — recursively, relative paths.
11634
+ * Companion files (`.docu.json`, LIMU sub-objects like `.reps.json`) are
11635
+ * included; callers match each to its schema (see `schemaTargetForExample`).
11636
+ */
11637
+ declare function affExamples(ref: AffRef): string[];
11638
+ /**
11639
+ * Pick the schema a given example file should validate against.
11640
+ *
11641
+ * - `z_x.doma.docu.json` → the `docu` schema (companion documentation)
11642
+ * - `x.fugr.z_fm.func.json` / `x.fugr.y.reps.json` → the LIMU
11643
+ * sub-object's own schema (nested under the parent type dir)
11644
+ * - otherwise → the type's own schema at the example's `formatVersion`
11645
+ */
11646
+ declare function schemaTargetForExample(ref: AffRef, filename: string, json: unknown): {
11647
+ type: string;
11648
+ version?: number;
11649
+ companion: boolean;
11650
+ };
11651
+ declare function readAffExample(ref: AffRef, rel: string): Record<string, unknown>;
11648
11652
  export { type AdtPlugin, index_d_exports as AffGenerated, type AffRef, type FormatHandler, type FormatPlugin, type GctsHandler, type GctsHandlerDefinition, type GctsHeader, type GctsMetadata, gctsPlugin as GctsPlugin, gctsPlugin as default, gctsPlugin, type GctsSourceEntry, LIMU_SUBTYPES, METADATA_EXTENSION, PACKAGE_FILENAME, type SerializedFile, type WithHeader, adtUriToGctsPath, affBodyProps, affExamples, affRoot, affSchema, affValidate, affVersions, createHandler, gctsFilename, gctsFormatPlugin, gctsSourceExt, getHandler, getSupportedTypes, isSupported, latestAffVersion, listAffTypes, parseGctsFilename, readAffExample, schemaTargetForExample, sourceKey, splitSourceKey };
11649
11653
  //# sourceMappingURL=index.d.mts.map