@abapify/adt-services 0.0.0 → 0.4.4
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 +72 -1
- package/dist/index.d.mts +1199 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3110 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +40 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1199 @@
|
|
|
1
|
+
import { FileLockStore, LockService } from "@abapify/adt-locks";
|
|
2
|
+
import { AdkContext, AdkObject, AdkTransportRequest, ObjectSourceVersionsResult, ReleaseResult, TransportObjectSelector, TransportSourceManifest, buildTransportSourceManifest, listObjectSourceVersions } from "@abapify/adk";
|
|
3
|
+
import { AdtPlugin, FormatOptionValue } from "@abapify/adt-plugin";
|
|
4
|
+
import { Destination, Destination as Destination$1, LoadedConfig, LoadedConfig as LoadedConfig$1 } from "@abapify/adt-config";
|
|
5
|
+
import { AdtAdapterConfig, AdtClient, Logger } from "@abapify/adt-client";
|
|
6
|
+
import { AuthConfig, AuthManager, AuthMethod, AuthPlugin, AuthPluginOptions, AuthPluginResult, AuthSession, BasicCredentials, CookieCredentials, Credentials } from "@abapify/adt-auth";
|
|
7
|
+
import { BasicObjectPropertiesResponse } from "@abapify/adt-contracts";
|
|
8
|
+
import { Logger as Logger$1 } from "@abapify/logger";
|
|
9
|
+
//#region src/services/badi/index.d.ts
|
|
10
|
+
interface BadiImplementation {
|
|
11
|
+
name: string;
|
|
12
|
+
shortText: string;
|
|
13
|
+
active: boolean;
|
|
14
|
+
default: boolean;
|
|
15
|
+
example: boolean;
|
|
16
|
+
implementingClass: string;
|
|
17
|
+
badiDefinition: string;
|
|
18
|
+
enhancementSpot: string;
|
|
19
|
+
}
|
|
20
|
+
interface BadiInfo {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
type: string;
|
|
24
|
+
package: string;
|
|
25
|
+
responsible: string;
|
|
26
|
+
version: string;
|
|
27
|
+
technology: string;
|
|
28
|
+
switchSupported: boolean;
|
|
29
|
+
badiImplementations: BadiImplementation[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse an `enho:objectData` XML document into a `BadiInfo` structure.
|
|
33
|
+
*/
|
|
34
|
+
declare function parseEnhancementImplementation(xml: string): BadiInfo;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch ENHO metadata for a BAdI / enhancement implementation and parse
|
|
37
|
+
* the BAdI implementation list.
|
|
38
|
+
*/
|
|
39
|
+
declare function getBadiInfo({ client, name }: {
|
|
40
|
+
client: AdtClient;
|
|
41
|
+
name: string;
|
|
42
|
+
}): Promise<BadiInfo>;
|
|
43
|
+
type BadiKind = 'definition' | 'implementation' | 'enhancement';
|
|
44
|
+
type BadiMetadata = {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
kind: BadiKind;
|
|
48
|
+
description?: string;
|
|
49
|
+
language?: string;
|
|
50
|
+
version?: string;
|
|
51
|
+
packageName?: string;
|
|
52
|
+
packageUri?: string;
|
|
53
|
+
responsible?: string;
|
|
54
|
+
masterLanguage?: string;
|
|
55
|
+
masterSystem?: string;
|
|
56
|
+
/** When SAP supplies a container reference, it can be used to validate lineage. */
|
|
57
|
+
containerRef?: {
|
|
58
|
+
name?: string;
|
|
59
|
+
type?: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
type BadiReadResult = BadiMetadata & {
|
|
63
|
+
/** ENHO/XHB metadata when kind is enhancement. */
|
|
64
|
+
enhancement?: BadiInfo;
|
|
65
|
+
source?: string;
|
|
66
|
+
/** Present when `--implementations` is used on a classic definition. */
|
|
67
|
+
implementations?: BadiMetadata[];
|
|
68
|
+
};
|
|
69
|
+
/** @deprecated Use BadiMetadata */
|
|
70
|
+
type ClassicBadiMetadata = Omit<BadiMetadata, 'kind'>;
|
|
71
|
+
declare function normalizeClassicBadiMetadata({ response, kind }: {
|
|
72
|
+
response: BasicObjectPropertiesResponse;
|
|
73
|
+
kind: 'definition' | 'implementation';
|
|
74
|
+
}): BadiMetadata;
|
|
75
|
+
declare class BadiService {
|
|
76
|
+
private readonly client;
|
|
77
|
+
constructor(client: AdtClient);
|
|
78
|
+
private contextFor;
|
|
79
|
+
private readContextFor;
|
|
80
|
+
resolveKind({ name }: {
|
|
81
|
+
name: string;
|
|
82
|
+
}): Promise<BadiKind>;
|
|
83
|
+
get({ name, options }: {
|
|
84
|
+
name: string;
|
|
85
|
+
options?: {
|
|
86
|
+
includeSource?: boolean;
|
|
87
|
+
includeImplementations?: boolean;
|
|
88
|
+
};
|
|
89
|
+
}): Promise<BadiReadResult>;
|
|
90
|
+
getDefinition({ name }: {
|
|
91
|
+
name: string;
|
|
92
|
+
}): Promise<BadiMetadata>;
|
|
93
|
+
getImplementation({ name }: {
|
|
94
|
+
name: string;
|
|
95
|
+
}): Promise<BadiMetadata>;
|
|
96
|
+
/**
|
|
97
|
+
* List classic BAdI implementations (SXCI/XI) for a definition name.
|
|
98
|
+
* Uses repository quick search heuristics — authoritative active/inactive
|
|
99
|
+
* state requires SXC_ATTR (not exposed on all systems).
|
|
100
|
+
*/
|
|
101
|
+
listImplementations({ name }: {
|
|
102
|
+
name: string;
|
|
103
|
+
}): Promise<BadiMetadata[]>;
|
|
104
|
+
}
|
|
105
|
+
/** @deprecated Use BadiService */
|
|
106
|
+
declare const ClassicBadiService: typeof BadiService;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/services/changeset/service.d.ts
|
|
109
|
+
type ChangesetStatus = 'open' | 'committing' | 'committed' | 'rolled_back';
|
|
110
|
+
interface ChangesetEntry {
|
|
111
|
+
objectUri: string;
|
|
112
|
+
objectType: string;
|
|
113
|
+
objectName: string;
|
|
114
|
+
lockHandle: string;
|
|
115
|
+
action: 'update' | 'create';
|
|
116
|
+
createdAt: number;
|
|
117
|
+
}
|
|
118
|
+
interface Changeset {
|
|
119
|
+
id: string;
|
|
120
|
+
openedAt: number;
|
|
121
|
+
status: ChangesetStatus;
|
|
122
|
+
entries: ChangesetEntry[];
|
|
123
|
+
description?: string;
|
|
124
|
+
}
|
|
125
|
+
interface AddEntryArgs {
|
|
126
|
+
objectUri: string;
|
|
127
|
+
objectType: string;
|
|
128
|
+
objectName: string;
|
|
129
|
+
source: string;
|
|
130
|
+
transport?: string;
|
|
131
|
+
}
|
|
132
|
+
interface CommitResult {
|
|
133
|
+
activated: string[];
|
|
134
|
+
failed: {
|
|
135
|
+
uri: string;
|
|
136
|
+
error: string;
|
|
137
|
+
}[];
|
|
138
|
+
}
|
|
139
|
+
interface RollbackResult {
|
|
140
|
+
released: string[];
|
|
141
|
+
failed: {
|
|
142
|
+
uri: string;
|
|
143
|
+
error: string;
|
|
144
|
+
}[];
|
|
145
|
+
}
|
|
146
|
+
/** Create a brand-new empty changeset (no SAP interaction yet). */
|
|
147
|
+
declare function createChangeset(description?: string): Changeset;
|
|
148
|
+
declare class ChangesetService {
|
|
149
|
+
private readonly client;
|
|
150
|
+
private readonly logger?;
|
|
151
|
+
private readonly locks;
|
|
152
|
+
constructor(client: AdtClient, logger?: Logger | undefined);
|
|
153
|
+
/** Transport-agnostic: returns a fresh Changeset descriptor. */
|
|
154
|
+
begin(description?: string): Changeset;
|
|
155
|
+
/**
|
|
156
|
+
* Lock the object, PUT the source, and register the entry. Throws on
|
|
157
|
+
* lock or PUT failure; lock is released in the error path so the
|
|
158
|
+
* caller never sees a half-applied entry.
|
|
159
|
+
*/
|
|
160
|
+
add(changeset: Changeset, args: AddEntryArgs): Promise<ChangesetEntry>;
|
|
161
|
+
/**
|
|
162
|
+
* Batch-activate every entry, then release every lock. The changeset
|
|
163
|
+
* is mutated in place: `status` advances to `committing` during the
|
|
164
|
+
* call and `committed` on success. On activation failure it is left
|
|
165
|
+
* as `committing` and the error is rethrown after lock cleanup.
|
|
166
|
+
*/
|
|
167
|
+
commit(changeset: Changeset): Promise<CommitResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Release every lock (best-effort) and mark the changeset
|
|
170
|
+
* `rolled_back`. Does NOT revert PUT'ed source — see file-level
|
|
171
|
+
* comment for rationale.
|
|
172
|
+
*/
|
|
173
|
+
rollback(changeset: Changeset): Promise<RollbackResult>;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/services/checkin/diff.d.ts
|
|
177
|
+
type ChangeAction = 'create' | 'update' | 'unchanged' | 'skip';
|
|
178
|
+
interface ChangePlanEntry {
|
|
179
|
+
/** ADK object carrying local (deserialised) data. */
|
|
180
|
+
object: AdkObject;
|
|
181
|
+
/** What we intend to do with this object on SAP. */
|
|
182
|
+
action: ChangeAction;
|
|
183
|
+
/** Human-readable reason — used for dry-run output. */
|
|
184
|
+
reason?: string;
|
|
185
|
+
/** Error encountered during diff (load failure that wasn't a 404). */
|
|
186
|
+
error?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Compute diff for a single object.
|
|
190
|
+
*
|
|
191
|
+
* Returns the `ChangePlanEntry` without yet mutating anything on SAP. The
|
|
192
|
+
* caller decides whether to group, filter, or apply the plan.
|
|
193
|
+
*/
|
|
194
|
+
declare function diffObject(object: AdkObject): Promise<ChangePlanEntry>;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/services/checkin/plan.d.ts
|
|
197
|
+
type DependencyTier = 'ddic' | 'app' | 'cds' | 'package' | 'other';
|
|
198
|
+
declare function classifyTier(type: string): DependencyTier;
|
|
199
|
+
interface ChangePlan {
|
|
200
|
+
/** All entries regardless of action/tier, in discovery order. */
|
|
201
|
+
entries: ChangePlanEntry[];
|
|
202
|
+
/** Actionable entries grouped by tier in apply order. */
|
|
203
|
+
groups: Array<{
|
|
204
|
+
tier: DependencyTier;
|
|
205
|
+
entries: ChangePlanEntry[];
|
|
206
|
+
}>;
|
|
207
|
+
/** Entries that don't need an apply pass (skip/unchanged). */
|
|
208
|
+
inert: ChangePlanEntry[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Build a ChangePlan by classifying each entry and sorting into tiers.
|
|
212
|
+
*
|
|
213
|
+
* Entries whose action is `skip` or `unchanged` are parked in `inert` so the
|
|
214
|
+
* apply stage doesn't touch them. Empty tiers are elided.
|
|
215
|
+
*/
|
|
216
|
+
declare function buildPlan(entries: ChangePlanEntry[]): ChangePlan;
|
|
217
|
+
/** Extract a flat ordered list of AdkObjects from a plan (apply order). */
|
|
218
|
+
declare function flattenPlanObjects(plan: ChangePlan): AdkObject[];
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/services/checkin/apply.d.ts
|
|
221
|
+
interface ApplyOptions {
|
|
222
|
+
/** Transport request used for lock + save operations. */
|
|
223
|
+
transport?: string;
|
|
224
|
+
/** Dry run — build plan but don't touch SAP. */
|
|
225
|
+
dryRun?: boolean;
|
|
226
|
+
/** Activate saved objects after each tier. Default: true. */
|
|
227
|
+
activate?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Release locks for which this client persisted a handle before the batch
|
|
230
|
+
* lock session begins. Mirrors `adt export --unlock`.
|
|
231
|
+
*/
|
|
232
|
+
unlock?: boolean;
|
|
233
|
+
/** Per-tier progress hook. */
|
|
234
|
+
onTierStart?: (tier: DependencyTier, size: number) => void;
|
|
235
|
+
/** Per-object progress hook. */
|
|
236
|
+
onObject?: (object: AdkObject, status: string) => void;
|
|
237
|
+
}
|
|
238
|
+
interface ApplyTierResult {
|
|
239
|
+
tier: DependencyTier;
|
|
240
|
+
size: number;
|
|
241
|
+
saved: number;
|
|
242
|
+
failed: number;
|
|
243
|
+
unchanged: number;
|
|
244
|
+
activated: number;
|
|
245
|
+
errors: Array<{
|
|
246
|
+
name: string;
|
|
247
|
+
type: string;
|
|
248
|
+
error: string;
|
|
249
|
+
}>;
|
|
250
|
+
}
|
|
251
|
+
interface ApplyResult {
|
|
252
|
+
/** Per-tier stats in the order they were applied. */
|
|
253
|
+
tiers: ApplyTierResult[];
|
|
254
|
+
/** Aggregate totals. */
|
|
255
|
+
totals: {
|
|
256
|
+
saved: number;
|
|
257
|
+
failed: number;
|
|
258
|
+
unchanged: number;
|
|
259
|
+
activated: number;
|
|
260
|
+
};
|
|
261
|
+
/** True if the caller aborted before all tiers ran (lock conflict). */
|
|
262
|
+
aborted: boolean;
|
|
263
|
+
}
|
|
264
|
+
/** Execute the change plan. Always returns a result — caller decides exit. */
|
|
265
|
+
declare function applyPlan(plan: ChangePlan, ctx: AdkContext, options?: ApplyOptions): Promise<ApplyResult>;
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/services/checkin/service.d.ts
|
|
268
|
+
interface CheckinOptions {
|
|
269
|
+
/** Source directory containing serialised files (abapGit/gCTS layout). */
|
|
270
|
+
sourceDir: string;
|
|
271
|
+
/** Format id — `abapgit` | `gcts` | `aff` | bespoke plugin package. */
|
|
272
|
+
format: string;
|
|
273
|
+
/** Target root package (used by FormatPlugin to resolve packageRef). */
|
|
274
|
+
rootPackage?: string;
|
|
275
|
+
/** Transport request for all modified/created objects. */
|
|
276
|
+
transport?: string;
|
|
277
|
+
/** Filter by ABAP object types (e.g. ['CLAS','INTF']). */
|
|
278
|
+
objectTypes?: string[];
|
|
279
|
+
/** Dry run — validate only, no SAP writes. */
|
|
280
|
+
dryRun?: boolean;
|
|
281
|
+
/** Activate objects after save (default true). */
|
|
282
|
+
activate?: boolean;
|
|
283
|
+
/** Release stale locks only when this client persisted their handles. */
|
|
284
|
+
unlock?: boolean;
|
|
285
|
+
/** ABAP language version override (e.g. '5' for Cloud). */
|
|
286
|
+
abapLanguageVersion?: string;
|
|
287
|
+
/** Format-specific options (opaque to the service). */
|
|
288
|
+
formatOptions?: Record<string, FormatOptionValue>;
|
|
289
|
+
/** Optional ADK context override (tests pass a shared one). */
|
|
290
|
+
adkContext?: AdkContext;
|
|
291
|
+
/** Log hook — no console writes inside the service itself. */
|
|
292
|
+
onLog?: (level: 'info' | 'warn' | 'error', message: string) => void;
|
|
293
|
+
/** Per-object progress hook passed down to apply. */
|
|
294
|
+
onObject?: (object: AdkObject, status: string) => void;
|
|
295
|
+
}
|
|
296
|
+
interface CheckinResult {
|
|
297
|
+
/** Source directory that was checked in. */
|
|
298
|
+
sourceDir: string;
|
|
299
|
+
/** Format id used for deserialisation. */
|
|
300
|
+
format: string;
|
|
301
|
+
/** Total AdkObjects discovered from the file tree. */
|
|
302
|
+
discovered: number;
|
|
303
|
+
/** Diff outcome per action kind (create/update/unchanged/skip). */
|
|
304
|
+
actions: Record<string, number>;
|
|
305
|
+
/** Tiered apply result (one entry per non-empty tier). */
|
|
306
|
+
apply: ApplyResult;
|
|
307
|
+
/** Plan groups as tier → entries (for dry-run/output formatting). */
|
|
308
|
+
groups: Array<{
|
|
309
|
+
tier: DependencyTier;
|
|
310
|
+
entries: Array<{
|
|
311
|
+
name: string;
|
|
312
|
+
type: string;
|
|
313
|
+
action: ChangePlanEntry['action'];
|
|
314
|
+
}>;
|
|
315
|
+
}>;
|
|
316
|
+
/** True if we stopped before applying every tier. */
|
|
317
|
+
aborted: boolean;
|
|
318
|
+
/** Human-readable summary suitable for CLI output. */
|
|
319
|
+
summary: string;
|
|
320
|
+
}
|
|
321
|
+
declare class CheckinService {
|
|
322
|
+
checkin(options: CheckinOptions): Promise<CheckinResult>;
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/services/connection/service.d.ts
|
|
326
|
+
/** Concrete connection metadata used to instantiate an ADT client. */
|
|
327
|
+
interface ConnectionParams {
|
|
328
|
+
baseUrl: string;
|
|
329
|
+
client?: string;
|
|
330
|
+
username?: string;
|
|
331
|
+
password?: string;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Inputs accepted by the shared connection resolver.
|
|
335
|
+
*
|
|
336
|
+
* `baseUrl` and `systemId` are mutually exclusive selectors:
|
|
337
|
+
* - `baseUrl` selects explicit connection args
|
|
338
|
+
* - `systemId` selects configured/fallback lookup paths
|
|
339
|
+
*/
|
|
340
|
+
interface ConnectionResolveArgs {
|
|
341
|
+
baseUrl?: string;
|
|
342
|
+
client?: string;
|
|
343
|
+
username?: string;
|
|
344
|
+
password?: string;
|
|
345
|
+
systemId?: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Hook points used by the resolver to stay transport/framework agnostic.
|
|
349
|
+
*
|
|
350
|
+
* Resolution chain:
|
|
351
|
+
* 1. `createClient` with explicit args (`baseUrl`)
|
|
352
|
+
* 2. `resolveSystem` + `createClient` (`systemId` from registry)
|
|
353
|
+
* 3. `resolveFromAuthStore` (`systemId` from local auth-store fallback)
|
|
354
|
+
*/
|
|
355
|
+
interface ResolveConnectionClientHooks<TClient> {
|
|
356
|
+
createClient: (params: ConnectionParams) => TClient;
|
|
357
|
+
resolveSystem?: (systemId: string) => ConnectionParams | undefined;
|
|
358
|
+
resolveFromAuthStore?: (systemId: string) => Promise<TClient>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Final resolved client plus metadata about how it was obtained.
|
|
362
|
+
*
|
|
363
|
+
* `systemId` is present when a logical system was used and may be absent
|
|
364
|
+
* for plain explicit `baseUrl` calls.
|
|
365
|
+
*/
|
|
366
|
+
interface ResolvedConnectionClient<TClient> {
|
|
367
|
+
client: TClient;
|
|
368
|
+
systemId?: string;
|
|
369
|
+
source: 'explicit' | 'multi-system' | 'adt-cli-auth-store';
|
|
370
|
+
}
|
|
371
|
+
declare function resolveConnectionClient<TClient>(args: ConnectionResolveArgs, hooks: ResolveConnectionClientHooks<TClient>): Promise<ResolvedConnectionClient<TClient>>;
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/services/cts/transport-lifecycle.d.ts
|
|
374
|
+
interface CtsTransportLifecycleOperations {
|
|
375
|
+
getTransport(transport: string, client: AdtClient): Promise<AdkTransportRequest>;
|
|
376
|
+
}
|
|
377
|
+
interface CtsTransportSummary {
|
|
378
|
+
transport: string;
|
|
379
|
+
status: string;
|
|
380
|
+
statusText: string;
|
|
381
|
+
owner: string;
|
|
382
|
+
description: string;
|
|
383
|
+
target: string;
|
|
384
|
+
targetDescription: string;
|
|
385
|
+
taskCount: number;
|
|
386
|
+
objectCount: number;
|
|
387
|
+
}
|
|
388
|
+
interface ReleaseTransportInput {
|
|
389
|
+
transport: string;
|
|
390
|
+
releaseAll?: boolean;
|
|
391
|
+
}
|
|
392
|
+
interface ReleaseTransportResult {
|
|
393
|
+
status: 'released' | 'already_released';
|
|
394
|
+
transport: string;
|
|
395
|
+
releaseAll: boolean;
|
|
396
|
+
result: ReleaseResult;
|
|
397
|
+
}
|
|
398
|
+
interface ReassignTransportInput {
|
|
399
|
+
transport: string;
|
|
400
|
+
newOwner: string;
|
|
401
|
+
recursive?: boolean;
|
|
402
|
+
}
|
|
403
|
+
interface ReassignTransportResult {
|
|
404
|
+
status: 'reassigned';
|
|
405
|
+
transport: string;
|
|
406
|
+
previousOwner: string;
|
|
407
|
+
newOwner: string;
|
|
408
|
+
recursive: boolean;
|
|
409
|
+
}
|
|
410
|
+
interface CreateTaskInput {
|
|
411
|
+
transport: string;
|
|
412
|
+
owner: string;
|
|
413
|
+
}
|
|
414
|
+
interface CreateTaskResult {
|
|
415
|
+
status: 'created';
|
|
416
|
+
transport: string;
|
|
417
|
+
task: string;
|
|
418
|
+
owner: string;
|
|
419
|
+
}
|
|
420
|
+
declare class CtsTransportLifecycleService {
|
|
421
|
+
private readonly client;
|
|
422
|
+
private readonly operations;
|
|
423
|
+
constructor(client: AdtClient, operations?: CtsTransportLifecycleOperations);
|
|
424
|
+
getTransport(transport: string): Promise<CtsTransportSummary>;
|
|
425
|
+
release(input: ReleaseTransportInput): Promise<ReleaseTransportResult>;
|
|
426
|
+
createTask(input: CreateTaskInput): Promise<CreateTaskResult>;
|
|
427
|
+
reassign(input: ReassignTransportInput): Promise<ReassignTransportResult>;
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/services/cts/transport-metadata.d.ts
|
|
431
|
+
interface CtsTransportMetadataUnit {
|
|
432
|
+
kind: 'request' | 'task';
|
|
433
|
+
number: string;
|
|
434
|
+
description?: string;
|
|
435
|
+
owner?: string;
|
|
436
|
+
status?: string;
|
|
437
|
+
type?: string;
|
|
438
|
+
parent?: string;
|
|
439
|
+
lastChangedTimestamp?: string;
|
|
440
|
+
}
|
|
441
|
+
interface CtsTransportMetadataResult {
|
|
442
|
+
requestedTransport: string;
|
|
443
|
+
units: CtsTransportMetadataUnit[];
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Typed CTS metadata projection shared by CLI and MCP. The ADT client owns
|
|
447
|
+
* protocol decoding; this service deliberately has no XML or console logic.
|
|
448
|
+
*/
|
|
449
|
+
declare class CtsTransportMetadataService {
|
|
450
|
+
private readonly client;
|
|
451
|
+
constructor(client: AdtClient);
|
|
452
|
+
get(transport: string): Promise<CtsTransportMetadataResult>;
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/services/import/service.d.ts
|
|
456
|
+
/**
|
|
457
|
+
* Options for importing a single object by name (search-based)
|
|
458
|
+
*/
|
|
459
|
+
interface ObjectImportOptions {
|
|
460
|
+
/** Object name to search for (e.g., 'ZAGE_DOMA_CASE_SENSITIVE') */
|
|
461
|
+
objectName: string;
|
|
462
|
+
/** Exact ABAP object type used to disambiguate same-named objects */
|
|
463
|
+
objectType?: string;
|
|
464
|
+
/** Output directory for serialized files */
|
|
465
|
+
outputPath: string;
|
|
466
|
+
/** Format plugin name or package (e.g., 'abapgit', '@abapify/adt-plugin-abapgit') */
|
|
467
|
+
format: string;
|
|
468
|
+
/** Format-specific options provided via CLI */
|
|
469
|
+
formatOptions?: Record<string, FormatOptionValue>;
|
|
470
|
+
/** Enable debug output */
|
|
471
|
+
debug?: boolean;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Options for importing a transport request
|
|
475
|
+
*/
|
|
476
|
+
interface TransportImportOptions {
|
|
477
|
+
/**
|
|
478
|
+
* Transport request number(s).
|
|
479
|
+
*
|
|
480
|
+
* Accepts a single number or a comma-separated list:
|
|
481
|
+
* - `'DEVK900001'` — single TR
|
|
482
|
+
* - `'DEVK900001,DEVK900002,DEVK900003'` — multiple TRs (merged, deduplicated)
|
|
483
|
+
*/
|
|
484
|
+
transportNumber: string;
|
|
485
|
+
/** Output directory for serialized files */
|
|
486
|
+
outputPath: string;
|
|
487
|
+
/** Filter by object types (e.g., ['CLAS', 'INTF']) - if not specified, imports all */
|
|
488
|
+
objectTypes?: string[];
|
|
489
|
+
/** Format plugin name or package (e.g., 'abapgit', '@abapify/adt-plugin-abapgit') */
|
|
490
|
+
format: string;
|
|
491
|
+
/** Format-specific options provided via CLI */
|
|
492
|
+
formatOptions?: Record<string, FormatOptionValue>;
|
|
493
|
+
/** Enable debug output */
|
|
494
|
+
debug?: boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Whether to apply deletions for objects marked with obj_func=D and pgmid=R3TR.
|
|
497
|
+
* Default: true
|
|
498
|
+
*/
|
|
499
|
+
applyDeletions?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* When true, write a JSON sidecar for each transport to
|
|
502
|
+
* `<outputPath>/.adt/tr/<TRKORR>.json` with normalized transport metadata.
|
|
503
|
+
* Default: false
|
|
504
|
+
*/
|
|
505
|
+
saveTrMetadata?: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* When true, objects that are in the TR list but cannot be fetched from SAP
|
|
508
|
+
* (i.e., `objRef.load()` returns null — the object no longer exists in the system)
|
|
509
|
+
* are treated as deletions: `format.delete()` is called to remove their local files.
|
|
510
|
+
*
|
|
511
|
+
* This catches the "orphan sync" case where an object was removed in SAP without
|
|
512
|
+
* an explicit `obj_func=D` entry in the transport.
|
|
513
|
+
*
|
|
514
|
+
* Default: false (backward-compatible; previously counted as skipped)
|
|
515
|
+
*/
|
|
516
|
+
removeMissingObjects?: boolean;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Options for importing a package
|
|
520
|
+
*/
|
|
521
|
+
interface PackageImportOptions {
|
|
522
|
+
/** Package name (e.g., 'Z_MY_PACKAGE') */
|
|
523
|
+
packageName: string;
|
|
524
|
+
/** Output directory for serialized files */
|
|
525
|
+
outputPath: string;
|
|
526
|
+
/** Filter by object types (e.g., ['CLAS', 'INTF']) - if not specified, imports all */
|
|
527
|
+
objectTypes?: string[];
|
|
528
|
+
/** Include subpackages */
|
|
529
|
+
includeSubpackages?: boolean;
|
|
530
|
+
/** Format plugin name or package (e.g., 'abapgit', '@abapify/adt-plugin-abapgit') */
|
|
531
|
+
format: string;
|
|
532
|
+
/** Enable debug output */
|
|
533
|
+
debug?: boolean;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Result of an import operation
|
|
537
|
+
*/
|
|
538
|
+
interface ImportResult {
|
|
539
|
+
/** Transport number (for transport imports) */
|
|
540
|
+
transportNumber?: string;
|
|
541
|
+
/** Package name (for package imports) */
|
|
542
|
+
packageName?: string;
|
|
543
|
+
/** Object name (for single-object imports) */
|
|
544
|
+
objectName?: string;
|
|
545
|
+
/** Object type (for single-object imports) */
|
|
546
|
+
objectType?: string;
|
|
547
|
+
/** Description of the imported content */
|
|
548
|
+
description: string;
|
|
549
|
+
/** Total objects found */
|
|
550
|
+
totalObjects: number;
|
|
551
|
+
/** Statistics */
|
|
552
|
+
results: {
|
|
553
|
+
success: number;
|
|
554
|
+
skipped: number;
|
|
555
|
+
failed: number;
|
|
556
|
+
/** Objects deleted from the file system (obj_func=D) */
|
|
557
|
+
deleted: number;
|
|
558
|
+
};
|
|
559
|
+
/** Objects by type */
|
|
560
|
+
objectsByType: Record<string, number>;
|
|
561
|
+
/** Output path */
|
|
562
|
+
outputPath: string;
|
|
563
|
+
/** Files removed during deletion pass */
|
|
564
|
+
filesRemoved?: string[];
|
|
565
|
+
/** Metadata sidecar files written (when saveTrMetadata is true) */
|
|
566
|
+
metadataFiles?: string[];
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Import Service - uses ADK architecture
|
|
570
|
+
*
|
|
571
|
+
* Flow:
|
|
572
|
+
* 1. Load format plugin (via CLI option or config)
|
|
573
|
+
* 2. Fetch transport via AdkTransport.get() or package via AdkPackage.get()
|
|
574
|
+
* 3. Load each object via objRef.load()
|
|
575
|
+
* 4. Delegate serialization to format plugin
|
|
576
|
+
*/
|
|
577
|
+
declare class ImportService {
|
|
578
|
+
private getConfigFormatOptions;
|
|
579
|
+
/**
|
|
580
|
+
* Import objects from a transport request
|
|
581
|
+
*
|
|
582
|
+
* @param options - Import options including transport number, output path, and format
|
|
583
|
+
* @returns Import result with statistics
|
|
584
|
+
*/
|
|
585
|
+
importTransport(options: TransportImportOptions): Promise<ImportResult>;
|
|
586
|
+
/**
|
|
587
|
+
* Import objects from an ABAP package
|
|
588
|
+
*
|
|
589
|
+
* @param options - Import options including package name, output path, and format
|
|
590
|
+
* @returns Import result with statistics
|
|
591
|
+
*/
|
|
592
|
+
importPackage(options: PackageImportOptions): Promise<ImportResult>;
|
|
593
|
+
/**
|
|
594
|
+
* Import a single object by name (search-based resolution)
|
|
595
|
+
*
|
|
596
|
+
* Flow:
|
|
597
|
+
* 1. quickSearch for the object name
|
|
598
|
+
* 2. Find exact match — if ambiguous, report all matches
|
|
599
|
+
* 3. Extract ADT type from search result
|
|
600
|
+
* 4. Load via ADK factory + format plugin → local file
|
|
601
|
+
*
|
|
602
|
+
* @param options - Import options including object name, output path, and format
|
|
603
|
+
* @returns Import result with statistics
|
|
604
|
+
*/
|
|
605
|
+
importObject(options: ObjectImportOptions): Promise<ImportResult>;
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/services/source/service.d.ts
|
|
609
|
+
interface GetSourceOptions {
|
|
610
|
+
objectName: string;
|
|
611
|
+
objectType?: string;
|
|
612
|
+
version?: string;
|
|
613
|
+
include?: string;
|
|
614
|
+
method?: string;
|
|
615
|
+
grep?: string;
|
|
616
|
+
maxBytes?: number;
|
|
617
|
+
format?: 'raw' | 'structured';
|
|
618
|
+
}
|
|
619
|
+
interface GetSourceDefaultResult {
|
|
620
|
+
object: string;
|
|
621
|
+
source: string;
|
|
622
|
+
bytes: number;
|
|
623
|
+
version: string;
|
|
624
|
+
include?: string;
|
|
625
|
+
note?: string;
|
|
626
|
+
}
|
|
627
|
+
interface GetSourceMethodListResult {
|
|
628
|
+
object: string;
|
|
629
|
+
methodCount: number;
|
|
630
|
+
methods: string[];
|
|
631
|
+
note?: string;
|
|
632
|
+
}
|
|
633
|
+
interface GetSourceMethodResult {
|
|
634
|
+
object: string;
|
|
635
|
+
method: string;
|
|
636
|
+
source: string;
|
|
637
|
+
startLine: number;
|
|
638
|
+
endLine: number;
|
|
639
|
+
bytes: number;
|
|
640
|
+
note?: string;
|
|
641
|
+
}
|
|
642
|
+
interface GrepMatch {
|
|
643
|
+
line: number;
|
|
644
|
+
text: string;
|
|
645
|
+
method?: string;
|
|
646
|
+
include?: string;
|
|
647
|
+
class?: string;
|
|
648
|
+
}
|
|
649
|
+
interface GetSourceGrepResult {
|
|
650
|
+
object: string;
|
|
651
|
+
pattern: string;
|
|
652
|
+
matchCount: number;
|
|
653
|
+
matches: string[];
|
|
654
|
+
methodContext?: GrepMatch[];
|
|
655
|
+
note?: string;
|
|
656
|
+
}
|
|
657
|
+
interface SourceInclude {
|
|
658
|
+
name: string;
|
|
659
|
+
startLine: number;
|
|
660
|
+
endLine: number;
|
|
661
|
+
owner?: string;
|
|
662
|
+
}
|
|
663
|
+
interface SourceMethod {
|
|
664
|
+
name: string;
|
|
665
|
+
startLine: number;
|
|
666
|
+
endLine: number;
|
|
667
|
+
owner?: string;
|
|
668
|
+
}
|
|
669
|
+
interface GetSourceStructuredResult {
|
|
670
|
+
object: string;
|
|
671
|
+
source: string;
|
|
672
|
+
bytes: number;
|
|
673
|
+
version: string;
|
|
674
|
+
include?: string;
|
|
675
|
+
includes: SourceInclude[];
|
|
676
|
+
methods: SourceMethod[];
|
|
677
|
+
note?: string;
|
|
678
|
+
}
|
|
679
|
+
type GetSourceResult = GetSourceDefaultResult | GetSourceMethodListResult | GetSourceMethodResult | GetSourceGrepResult | GetSourceStructuredResult;
|
|
680
|
+
declare class GetSourceTooLargeError extends Error {
|
|
681
|
+
readonly maxBytes: number;
|
|
682
|
+
readonly code: "SOURCE_TOO_LARGE";
|
|
683
|
+
constructor(maxBytes: number);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Fetch ABAP source with arc-1 SAPRead-style filtering.
|
|
687
|
+
*
|
|
688
|
+
* @throws {GetSourceTooLargeError} when the source body exceeds maxBytes.
|
|
689
|
+
* @throws {Error} for resolution or validation failures.
|
|
690
|
+
*/
|
|
691
|
+
declare function getSource(client: AdtClient, options: GetSourceOptions): Promise<GetSourceResult>;
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/services/source-history/service.d.ts
|
|
694
|
+
interface ListObjectVersionsInput {
|
|
695
|
+
objectName: string;
|
|
696
|
+
objectType: string;
|
|
697
|
+
component?: string;
|
|
698
|
+
}
|
|
699
|
+
type ListObjectVersionsResult = ObjectSourceVersionsResult;
|
|
700
|
+
interface GetVersionSourceInput {
|
|
701
|
+
uri: string;
|
|
702
|
+
}
|
|
703
|
+
interface BuildTransportManifestInput {
|
|
704
|
+
transports: string[];
|
|
705
|
+
selector?: TransportObjectSelector;
|
|
706
|
+
concurrency?: number;
|
|
707
|
+
}
|
|
708
|
+
type BuildTransportManifestResult = TransportSourceManifest;
|
|
709
|
+
type ExactSourceHistoryServiceErrorCode = 'SOURCE_VERSION_LIST_FAILED' | 'SOURCE_VERSION_READ_FAILED' | 'TRANSPORT_SOURCE_MANIFEST_FAILED';
|
|
710
|
+
/**
|
|
711
|
+
* Safe delivery-layer failure that deliberately excludes adapter response
|
|
712
|
+
* bodies, credentials, and ABAP source text.
|
|
713
|
+
*/
|
|
714
|
+
declare class ExactSourceHistoryServiceError extends Error {
|
|
715
|
+
readonly code: ExactSourceHistoryServiceErrorCode;
|
|
716
|
+
constructor(code: ExactSourceHistoryServiceErrorCode, message: string);
|
|
717
|
+
}
|
|
718
|
+
interface ExactSourceHistoryOperations {
|
|
719
|
+
listObjectSourceVersions: typeof listObjectSourceVersions;
|
|
720
|
+
buildTransportSourceManifest: typeof buildTransportSourceManifest;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Shared source-history delivery service used by CLI and MCP.
|
|
724
|
+
*
|
|
725
|
+
* The class is deliberately free of Commander, stdout, file-system, and
|
|
726
|
+
* process-exit concerns. It returns ADK/client domain values directly so both
|
|
727
|
+
* delivery surfaces expose the same normalized records.
|
|
728
|
+
*/
|
|
729
|
+
/**
|
|
730
|
+
* Strip server-relative source locators from a listing so that only object
|
|
731
|
+
* identity, component ids, and transport provenance remain.
|
|
732
|
+
*/
|
|
733
|
+
declare function toMetadataOnlySourceVersionListing(result: ListObjectVersionsResult): unknown;
|
|
734
|
+
/**
|
|
735
|
+
* Strip source locators from a transport manifest so that only object
|
|
736
|
+
* identity, change metadata, and transport provenance remain.
|
|
737
|
+
*/
|
|
738
|
+
declare function toMetadataOnlyTransportSourceManifest(manifest: BuildTransportManifestResult): unknown;
|
|
739
|
+
declare class ExactSourceHistoryService {
|
|
740
|
+
private readonly client;
|
|
741
|
+
private readonly operations;
|
|
742
|
+
constructor(client: AdtClient, operations?: ExactSourceHistoryOperations);
|
|
743
|
+
listObjectVersions(input: ListObjectVersionsInput): Promise<ListObjectVersionsResult>;
|
|
744
|
+
getVersionSource(input: GetVersionSourceInput): Promise<string>;
|
|
745
|
+
buildTransportManifest(input: BuildTransportManifestInput): Promise<BuildTransportManifestResult>;
|
|
746
|
+
}
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/services/check/service.d.ts
|
|
749
|
+
declare const DEFAULT_CHECK_SOURCE_VERSION = "inactive";
|
|
750
|
+
type CheckSourceVersion = '' | 'active' | 'inactive' | 'workingArea' | 'new' | 'partlyActive' | 'activeWithInactiveVersion';
|
|
751
|
+
type CheckMessage = {
|
|
752
|
+
uri?: string;
|
|
753
|
+
type?: unknown;
|
|
754
|
+
shortText?: string;
|
|
755
|
+
category?: string;
|
|
756
|
+
code?: string;
|
|
757
|
+
};
|
|
758
|
+
type CheckReport = {
|
|
759
|
+
checkMessageList?: {
|
|
760
|
+
checkMessage?: CheckMessage[];
|
|
761
|
+
};
|
|
762
|
+
reporter?: string;
|
|
763
|
+
triggeringUri?: string;
|
|
764
|
+
status?: string;
|
|
765
|
+
statusText?: string;
|
|
766
|
+
};
|
|
767
|
+
interface CheckServiceInput {
|
|
768
|
+
objects: Array<{
|
|
769
|
+
uri: string;
|
|
770
|
+
}>;
|
|
771
|
+
sourceVersion?: CheckSourceVersion;
|
|
772
|
+
}
|
|
773
|
+
interface CheckResult {
|
|
774
|
+
reports: CheckReport[];
|
|
775
|
+
hasErrors: boolean;
|
|
776
|
+
hasWarnings: boolean;
|
|
777
|
+
}
|
|
778
|
+
declare class CheckService {
|
|
779
|
+
private readonly client;
|
|
780
|
+
constructor(client: AdtClient);
|
|
781
|
+
run(input: CheckServiceInput): Promise<CheckResult>;
|
|
782
|
+
}
|
|
783
|
+
//#endregion
|
|
784
|
+
//#region src/shared/adt-client.d.ts
|
|
785
|
+
interface CliContext {
|
|
786
|
+
sid?: string;
|
|
787
|
+
logger?: Logger;
|
|
788
|
+
logLevel?: string;
|
|
789
|
+
logOutput?: string;
|
|
790
|
+
logResponseFiles?: boolean;
|
|
791
|
+
verbose?: boolean | string;
|
|
792
|
+
/** Path to config file (from --config flag) */
|
|
793
|
+
configPath?: string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Set global CLI context (called by CLI preAction hook)
|
|
797
|
+
* This allows getAdtClientV2() to auto-read CLI options without passing them explicitly
|
|
798
|
+
*/
|
|
799
|
+
declare function setCliContext(context: CliContext): void;
|
|
800
|
+
/**
|
|
801
|
+
* Get current CLI context
|
|
802
|
+
*/
|
|
803
|
+
declare function getCliContext(): CliContext;
|
|
804
|
+
/**
|
|
805
|
+
* Reset CLI context (useful for testing)
|
|
806
|
+
*/
|
|
807
|
+
declare function resetCliContext(): void;
|
|
808
|
+
declare const silentLogger: Logger;
|
|
809
|
+
/**
|
|
810
|
+
* Console logger - outputs to console (used when enableLogging is true)
|
|
811
|
+
*/
|
|
812
|
+
declare const consoleLogger: Logger;
|
|
813
|
+
/**
|
|
814
|
+
* Captured response data from the last request
|
|
815
|
+
*/
|
|
816
|
+
interface CapturedResponse {
|
|
817
|
+
/** Raw XML/text response */
|
|
818
|
+
xml?: string;
|
|
819
|
+
/** Parsed JSON response */
|
|
820
|
+
json?: unknown;
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Get the last captured response (for commands that need raw XML/JSON)
|
|
824
|
+
*/
|
|
825
|
+
declare function getCaptured(): CapturedResponse;
|
|
826
|
+
/**
|
|
827
|
+
* Set captured response data
|
|
828
|
+
*/
|
|
829
|
+
declare function setCaptured(data: CapturedResponse): void;
|
|
830
|
+
/**
|
|
831
|
+
* Reset captured data (called before each request when capture is enabled)
|
|
832
|
+
*/
|
|
833
|
+
declare function resetCaptured(): void;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/utils/adt-client-v2.d.ts
|
|
836
|
+
/**
|
|
837
|
+
* @internal
|
|
838
|
+
* Install a test AdtClient instance. When set, `getAdtClientV2()` will return
|
|
839
|
+
* the most recently pushed client instead of loading credentials from disk and
|
|
840
|
+
* constructing a real client. Intended solely for e2e harness usage.
|
|
841
|
+
*
|
|
842
|
+
* Returns a `release` function that removes **this specific** override from
|
|
843
|
+
* the stack. Callers (harness teardown) MUST call `release()` in an
|
|
844
|
+
* `afterEach` / `afterAll` / `finally` block.
|
|
845
|
+
*
|
|
846
|
+
* Backward compatibility: passing `null` pops the top of the stack (legacy
|
|
847
|
+
* behaviour used by older harness code paths). New code should prefer the
|
|
848
|
+
* returned release handle.
|
|
849
|
+
*/
|
|
850
|
+
declare function __setTestAdtClient(client: AdtClient | null): () => void;
|
|
851
|
+
/**
|
|
852
|
+
* @internal
|
|
853
|
+
* Inspect the current test override (mostly for diagnostics / test cleanup).
|
|
854
|
+
* Returns the top of the stack, or `null` if no override is active.
|
|
855
|
+
*/
|
|
856
|
+
declare function __getTestAdtClient(): AdtClient | null;
|
|
857
|
+
/**
|
|
858
|
+
* Options for creating ADT v2 client
|
|
859
|
+
*/
|
|
860
|
+
interface AdtClientV2Options {
|
|
861
|
+
/** Optional response plugins (added after built-in plugins) */
|
|
862
|
+
plugins?: AdtAdapterConfig['plugins'];
|
|
863
|
+
/** Optional logger for CLI messages (defaults to global CLI logger or silent) */
|
|
864
|
+
logger?: Logger;
|
|
865
|
+
/** Enable request/response logging (default: from CLI --verbose flag) */
|
|
866
|
+
enableLogging?: boolean;
|
|
867
|
+
/** Enable response file logging (default: from CLI --log-response-files flag) */
|
|
868
|
+
logResponseFiles?: boolean;
|
|
869
|
+
/** Output directory for response files (default: from CLI --log-output flag or './tmp/logs') */
|
|
870
|
+
logOutput?: string;
|
|
871
|
+
/** Write metadata alongside response files (default: false) */
|
|
872
|
+
writeMetadata?: boolean;
|
|
873
|
+
/** SAP System ID (SID) - e.g., 'TRL' (default: from CLI --sid flag) */
|
|
874
|
+
sid?: string;
|
|
875
|
+
/** Enable capture plugin to capture raw XML and parsed JSON (default: false) */
|
|
876
|
+
capture?: boolean;
|
|
877
|
+
/** Enable automatic SAML re-authentication when session expires (default: true for cookie auth) */
|
|
878
|
+
autoReauth?: boolean;
|
|
879
|
+
/** Pass through verbose flag (used to disable compact progress output) */
|
|
880
|
+
verbose?: boolean | string;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Typed error thrown by `getAdtClientV2Safe` when authentication cannot be
|
|
884
|
+
* resolved. Intentionally NOT thrown by the legacy `getAdtClientV2`, which
|
|
885
|
+
* prints a friendly message and calls `process.exit(1)` instead. Use this
|
|
886
|
+
* error class from long-running processes (HTTP servers, MCP daemons) that
|
|
887
|
+
* must never exit the process on auth failure.
|
|
888
|
+
*/
|
|
889
|
+
declare class AdtAuthError extends Error {
|
|
890
|
+
readonly code: 'NO_SESSION' | 'SESSION_EXPIRED_NO_PLUGIN' | 'REFRESH_FAILED' | 'UNSUPPORTED_AUTH_METHOD' | 'MAX_REFRESH_ATTEMPTS';
|
|
891
|
+
readonly systemId?: string;
|
|
892
|
+
constructor(code: AdtAuthError['code'], message: string, systemId?: string);
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Get authenticated ADT v2 client
|
|
896
|
+
*
|
|
897
|
+
* Loads auth session from CLI config and creates v2 client.
|
|
898
|
+
* Automatically refreshes expired sessions when possible.
|
|
899
|
+
* Exits with error if not authenticated.
|
|
900
|
+
*
|
|
901
|
+
* @param options - Optional configuration (plugins, logger, etc.)
|
|
902
|
+
* @returns Authenticated ADT v2 client
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* // Simple usage
|
|
906
|
+
* const client = await getAdtClientV2();
|
|
907
|
+
*
|
|
908
|
+
* @example
|
|
909
|
+
* // With custom logger
|
|
910
|
+
* const client = await getAdtClientV2({
|
|
911
|
+
* logger: myLogger,
|
|
912
|
+
* enableLogging: true // Enable HTTP request/response logging
|
|
913
|
+
* });
|
|
914
|
+
*
|
|
915
|
+
* @example
|
|
916
|
+
* // With plugins
|
|
917
|
+
* const client = await getAdtClientV2({
|
|
918
|
+
* plugins: [myPlugin]
|
|
919
|
+
* });
|
|
920
|
+
*/
|
|
921
|
+
declare function getAdtClientV2(options?: AdtClientV2Options): Promise<AdtClient>;
|
|
922
|
+
/**
|
|
923
|
+
* Same contract as {@link getAdtClientV2}, but on any authentication /
|
|
924
|
+
* credential failure throws a typed {@link AdtAuthError} instead of
|
|
925
|
+
* writing to stderr and calling `process.exit(1)`.
|
|
926
|
+
*
|
|
927
|
+
* Use this from long-running processes (HTTP servers, MCP daemons) where
|
|
928
|
+
* `process.exit` would tear down unrelated connections.
|
|
929
|
+
*
|
|
930
|
+
* @throws {AdtAuthError} when the session is missing, expired without a
|
|
931
|
+
* refresh plugin, refresh fails, or the configured auth method is
|
|
932
|
+
* unsupported.
|
|
933
|
+
*/
|
|
934
|
+
declare function getAdtClientV2Safe(options?: AdtClientV2Options): Promise<AdtClient>;
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region src/utils/adt-http-options.d.ts
|
|
937
|
+
declare function resolveAdtHeadersTimeoutMs(env?: Readonly<Record<string, string | undefined>>): number | undefined;
|
|
938
|
+
//#endregion
|
|
939
|
+
//#region src/utils/auth.d.ts
|
|
940
|
+
declare const authManager: AuthManager;
|
|
941
|
+
/**
|
|
942
|
+
* Load auth session
|
|
943
|
+
*/
|
|
944
|
+
declare function loadAuthSession(sid?: string): import("@abapify/adt-auth").AuthSession | null;
|
|
945
|
+
/**
|
|
946
|
+
* Save auth session
|
|
947
|
+
*/
|
|
948
|
+
declare function saveAuthSession(session: Parameters<typeof authManager.saveSession>[0]): void;
|
|
949
|
+
/**
|
|
950
|
+
* List all available SIDs
|
|
951
|
+
*/
|
|
952
|
+
declare function listAvailableSids(): string[];
|
|
953
|
+
/**
|
|
954
|
+
* Get default SID
|
|
955
|
+
*/
|
|
956
|
+
declare function getDefaultSid(): string | undefined;
|
|
957
|
+
/**
|
|
958
|
+
* Set default SID
|
|
959
|
+
*/
|
|
960
|
+
declare function setDefaultSid(sid: string): void;
|
|
961
|
+
/**
|
|
962
|
+
* Check if session is expired
|
|
963
|
+
*/
|
|
964
|
+
declare function isExpired(session: Parameters<typeof authManager.isExpired>[0]): boolean;
|
|
965
|
+
/**
|
|
966
|
+
* Refresh credentials using auth plugin
|
|
967
|
+
*/
|
|
968
|
+
declare function refreshCredentials(session: Parameters<typeof authManager.refreshCredentials>[0], options?: Parameters<typeof authManager.refreshCredentials>[1]): Promise<import("@abapify/adt-auth").AuthSession | null>;
|
|
969
|
+
/**
|
|
970
|
+
* Get the AuthManager instance (for advanced use)
|
|
971
|
+
*/
|
|
972
|
+
declare function getAuthManager(): AuthManager;
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/utils/destinations.d.ts
|
|
975
|
+
/**
|
|
976
|
+
* Get loaded config (cached)
|
|
977
|
+
* Uses configPath from CLI context if available (from --config flag)
|
|
978
|
+
*/
|
|
979
|
+
declare function getConfig(): Promise<LoadedConfig$1>;
|
|
980
|
+
/**
|
|
981
|
+
* Get a destination by name (SID)
|
|
982
|
+
* @param name Destination name (e.g., 'TRL')
|
|
983
|
+
*/
|
|
984
|
+
declare function getDestination(name: string): Promise<Destination$1 | undefined>;
|
|
985
|
+
/**
|
|
986
|
+
* List all configured destinations
|
|
987
|
+
*/
|
|
988
|
+
declare function listDestinations(): Promise<string[]>;
|
|
989
|
+
/**
|
|
990
|
+
* Check if a destination exists
|
|
991
|
+
*/
|
|
992
|
+
declare function hasDestination(name: string): Promise<boolean>;
|
|
993
|
+
/**
|
|
994
|
+
* Clear cached config (useful for testing)
|
|
995
|
+
*/
|
|
996
|
+
declare function clearConfigCache(): void;
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region src/utils/format-loader.d.ts
|
|
999
|
+
/** Resolve a CLI format id to its registered package name (if known). */
|
|
1000
|
+
declare function resolvePackageForFormatId(id: string): string | undefined;
|
|
1001
|
+
/**
|
|
1002
|
+
* Parse format specification with optional preset.
|
|
1003
|
+
*
|
|
1004
|
+
* Examples:
|
|
1005
|
+
* @abapify/adt-plugin-abapgit → { package: '@abapify/adt-plugin-abapgit' }
|
|
1006
|
+
* @abapify/adt-plugin-abapgit/full → { package: '@abapify/adt-plugin-abapgit', preset: 'full' }
|
|
1007
|
+
* abapgit → { package: '@abapify/adt-plugin-abapgit' } (shortcut)
|
|
1008
|
+
* ag → { package: '@abapify/adt-plugin-abapgit' } (shortcut)
|
|
1009
|
+
*/
|
|
1010
|
+
declare function parseFormatSpec(formatSpec: string): {
|
|
1011
|
+
package: string;
|
|
1012
|
+
preset?: string;
|
|
1013
|
+
};
|
|
1014
|
+
/**
|
|
1015
|
+
* Load a format plugin by CLI spec.
|
|
1016
|
+
*
|
|
1017
|
+
* Resolution order:
|
|
1018
|
+
* 1. Look up the format id in the {@link FormatPlugin} registry. If it is
|
|
1019
|
+
* already registered (e.g. via CLI bootstrap), use it without any dynamic
|
|
1020
|
+
* import.
|
|
1021
|
+
* 2. Otherwise dynamically `import(packageName)` — this triggers the
|
|
1022
|
+
* package's self-registration side-effects — then return the resolved
|
|
1023
|
+
* legacy `AdtPlugin` instance from the package's default/named export.
|
|
1024
|
+
*/
|
|
1025
|
+
declare function loadFormatPlugin(formatSpec: string): Promise<{
|
|
1026
|
+
name: string;
|
|
1027
|
+
description: string;
|
|
1028
|
+
instance: AdtPlugin;
|
|
1029
|
+
preset?: string;
|
|
1030
|
+
}>;
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/utils/lock-helpers.d.ts
|
|
1033
|
+
type SearchObject = {
|
|
1034
|
+
name?: string;
|
|
1035
|
+
type?: string;
|
|
1036
|
+
uri?: string;
|
|
1037
|
+
description?: string;
|
|
1038
|
+
packageName?: string;
|
|
1039
|
+
};
|
|
1040
|
+
/**
|
|
1041
|
+
* Normalize a quickSearch result into a flat SearchObject[].
|
|
1042
|
+
*
|
|
1043
|
+
* The ADT quickSearch endpoint may return results under
|
|
1044
|
+
* `objectReference`, `objectReferences.objectReference`, or
|
|
1045
|
+
* `mainObject.objectReference` — this helper handles all variants.
|
|
1046
|
+
*/
|
|
1047
|
+
declare function normalizeSearchResults(searchResult: Record<string, unknown>): SearchObject[];
|
|
1048
|
+
/** Shared lock store instance */
|
|
1049
|
+
declare const lockStore: FileLockStore;
|
|
1050
|
+
/**
|
|
1051
|
+
* Resolve an ADT object name/type/uri into a canonical URI + display label.
|
|
1052
|
+
*
|
|
1053
|
+
* Resolution order:
|
|
1054
|
+
* 1. Explicit URI override
|
|
1055
|
+
* 2. Type hint → construct from ADK registry
|
|
1056
|
+
* 3. Quick-search fallback
|
|
1057
|
+
*/
|
|
1058
|
+
declare function resolveObjectUri(client: Awaited<ReturnType<typeof getAdtClientV2>>, objectName: string, commandVerb: string, typeHint?: string, uriOverride?: string): Promise<{
|
|
1059
|
+
uri: string;
|
|
1060
|
+
display: string;
|
|
1061
|
+
}>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Get or create the lock service.
|
|
1064
|
+
* Prefers the global ADK context's service (shares the same store),
|
|
1065
|
+
* falls back to creating a fresh one with the shared FileLockStore.
|
|
1066
|
+
*/
|
|
1067
|
+
declare function getLockService(client: Awaited<ReturnType<typeof getAdtClientV2>>): LockService;
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/utils/progress-reporter.d.ts
|
|
1070
|
+
interface ProgressReporter {
|
|
1071
|
+
/** Update progress message (overwrites previous message in compact mode) */
|
|
1072
|
+
step(message: string): void;
|
|
1073
|
+
/** Emit a message on its own line (always persists) */
|
|
1074
|
+
persist(message: string): void;
|
|
1075
|
+
/** Finish the progress block and ensure the cursor moves to the next line */
|
|
1076
|
+
done(finalMessage?: string): void;
|
|
1077
|
+
/** Clear current progress without outputting anything (silent finish) */
|
|
1078
|
+
clear(): void;
|
|
1079
|
+
}
|
|
1080
|
+
interface ProgressOptions {
|
|
1081
|
+
/** When true, log updates replace each other on the same line */
|
|
1082
|
+
compact?: boolean;
|
|
1083
|
+
/** Optional logger to record progress events (info level by default) */
|
|
1084
|
+
logger?: Logger$1;
|
|
1085
|
+
/** Log level to use when writing progress messages */
|
|
1086
|
+
level?: 'trace' | 'debug' | 'info' | 'warn';
|
|
1087
|
+
}
|
|
1088
|
+
declare function createProgressReporter(options?: ProgressOptions): ProgressReporter;
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region src/utils/transport-numbers.d.ts
|
|
1091
|
+
/**
|
|
1092
|
+
* Parse a comma-separated string of SAP transport numbers into a deduplicated
|
|
1093
|
+
* uppercase array.
|
|
1094
|
+
*
|
|
1095
|
+
* Trims whitespace, uppercases, filters empty tokens, and removes duplicates
|
|
1096
|
+
* while preserving insertion order (O(n) via Set).
|
|
1097
|
+
*
|
|
1098
|
+
* Throws when no valid transport numbers are found.
|
|
1099
|
+
*
|
|
1100
|
+
* @example
|
|
1101
|
+
* parseTransportNumbers('DEVK900001') // → ['DEVK900001']
|
|
1102
|
+
* parseTransportNumbers('DEVK900001, DEVK900002') // → ['DEVK900001', 'DEVK900002']
|
|
1103
|
+
* parseTransportNumbers('DEVK900001,DEVK900001') // → ['DEVK900001'] (deduped)
|
|
1104
|
+
*/
|
|
1105
|
+
declare function parseTransportNumbers(value: string): string[];
|
|
1106
|
+
//#endregion
|
|
1107
|
+
//#region src/ui/types.d.ts
|
|
1108
|
+
/**
|
|
1109
|
+
* UI Types
|
|
1110
|
+
*
|
|
1111
|
+
* Core types for the chalk-based component system.
|
|
1112
|
+
*/
|
|
1113
|
+
/**
|
|
1114
|
+
* Base building block - anything that renders to lines
|
|
1115
|
+
*/
|
|
1116
|
+
interface Component {
|
|
1117
|
+
render(): string[];
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Page is a Component with metadata and print capability
|
|
1121
|
+
*/
|
|
1122
|
+
interface Page extends Component {
|
|
1123
|
+
title: string;
|
|
1124
|
+
/** Clickable title link (OSC 8 hyperlink) */
|
|
1125
|
+
titleLink?: string;
|
|
1126
|
+
icon?: string;
|
|
1127
|
+
menu?: MenuItem[];
|
|
1128
|
+
footer?: string;
|
|
1129
|
+
/** Print the full page to console */
|
|
1130
|
+
print(): void;
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Menu item for navigation/actions
|
|
1134
|
+
*/
|
|
1135
|
+
interface MenuItem {
|
|
1136
|
+
key: string;
|
|
1137
|
+
label: string;
|
|
1138
|
+
icon?: string;
|
|
1139
|
+
href?: string;
|
|
1140
|
+
info?: string;
|
|
1141
|
+
}
|
|
1142
|
+
//#endregion
|
|
1143
|
+
//#region src/ui/components/link.d.ts
|
|
1144
|
+
/**
|
|
1145
|
+
* Create an OSC 8 hyperlink
|
|
1146
|
+
*
|
|
1147
|
+
* @param text - Display text
|
|
1148
|
+
* @param url - URL to link to
|
|
1149
|
+
* @returns Formatted hyperlink string
|
|
1150
|
+
*/
|
|
1151
|
+
declare function hyperlink(text: string, url: string): string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Set the ADT system name for hyperlinks (called by CLI on init)
|
|
1154
|
+
*/
|
|
1155
|
+
declare function setAdtSystem(systemName: string): void;
|
|
1156
|
+
/**
|
|
1157
|
+
* Get current ADT system name
|
|
1158
|
+
*/
|
|
1159
|
+
declare function getAdtSystem(): string;
|
|
1160
|
+
/**
|
|
1161
|
+
* ADT Object Reference (matches AdtObjectReference schema)
|
|
1162
|
+
* Core attributes: uri, type, name
|
|
1163
|
+
*/
|
|
1164
|
+
interface AdtObjectRef {
|
|
1165
|
+
/** Object name */
|
|
1166
|
+
name?: string;
|
|
1167
|
+
/** Object type (e.g., "DEVC/K", "CLAS/OC") */
|
|
1168
|
+
type?: string;
|
|
1169
|
+
/** ADT URI (e.g., "/sap/bc/adt/packages/$TMP") */
|
|
1170
|
+
uri?: string;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Create a generic link (plain URL)
|
|
1174
|
+
*/
|
|
1175
|
+
declare function link(text: string, url: string): string;
|
|
1176
|
+
/**
|
|
1177
|
+
* Create an ADT Eclipse link for an object reference
|
|
1178
|
+
* Format: adt://[SYSTEM]/sap/bc/adt/[path]
|
|
1179
|
+
*
|
|
1180
|
+
* @param ref - ADT object reference with name, type, and/or uri (can be undefined)
|
|
1181
|
+
* @returns Formatted hyperlink string (or empty string if no ref/name)
|
|
1182
|
+
*/
|
|
1183
|
+
declare function adtLink(ref?: AdtObjectRef): string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Create a clickable package link (convenience wrapper)
|
|
1186
|
+
*/
|
|
1187
|
+
declare function packageLink(packageName: string): string;
|
|
1188
|
+
/**
|
|
1189
|
+
* ADT Link Component - link to ADT object in Eclipse
|
|
1190
|
+
* Extends Link with ADT-specific URL resolution
|
|
1191
|
+
*/
|
|
1192
|
+
declare function AdtLink(ref?: AdtObjectRef): Component;
|
|
1193
|
+
/**
|
|
1194
|
+
* Package Link Component - convenience for package links
|
|
1195
|
+
*/
|
|
1196
|
+
declare function PackageLink(packageName: string): Component;
|
|
1197
|
+
//#endregion
|
|
1198
|
+
export { type AddEntryArgs, AdtAuthError, AdtClientV2Options, AdtLink, AdtObjectRef, type ApplyOptions, type ApplyResult, type ApplyTierResult, type AuthConfig, type AuthMethod, type AuthPlugin, type AuthPluginOptions, type AuthPluginResult, type AuthSession, BadiImplementation, BadiInfo, BadiKind, BadiMetadata, BadiReadResult, BadiService, type BasicCredentials, type BuildTransportManifestInput, type BuildTransportManifestResult, CapturedResponse, type ChangeAction, type ChangePlan, type ChangePlanEntry, type Changeset, type ChangesetEntry, ChangesetService, type ChangesetStatus, CheckMessage, CheckReport, CheckResult, CheckService, CheckServiceInput, CheckSourceVersion, type CheckinOptions, type CheckinResult, CheckinService, ClassicBadiMetadata, ClassicBadiService, CliContext, type CommitResult, Component, type ConnectionResolveArgs, type CookieCredentials, type CreateTaskInput, type CreateTaskResult, type Credentials, type CtsTransportLifecycleOperations, CtsTransportLifecycleService, type CtsTransportMetadataResult, CtsTransportMetadataService, type CtsTransportMetadataUnit, type CtsTransportSummary, DEFAULT_CHECK_SOURCE_VERSION, type DependencyTier, type Destination, type ExactSourceHistoryOperations, ExactSourceHistoryService, ExactSourceHistoryServiceError, type ExactSourceHistoryServiceErrorCode, type GetSourceDefaultResult, type GetSourceGrepResult, type GetSourceMethodListResult, type GetSourceMethodResult, type GetSourceOptions, type GetSourceResult, type GetSourceStructuredResult, GetSourceTooLargeError, type GetVersionSourceInput, type GrepMatch, ImportResult, ImportService, type ListObjectVersionsInput, type ListObjectVersionsResult, type LoadedConfig, MenuItem, ObjectImportOptions, PackageImportOptions, PackageLink, Page, ProgressOptions, ProgressReporter, type ReassignTransportInput, type ReassignTransportResult, type ReleaseTransportInput, type ReleaseTransportResult, type ResolveConnectionClientHooks, type ResolvedConnectionClient, type RollbackResult, SearchObject, type SourceInclude, type SourceMethod, TransportImportOptions, __getTestAdtClient, __setTestAdtClient, adtLink, applyPlan, buildPlan, classifyTier, clearConfigCache, consoleLogger, createChangeset, createProgressReporter, diffObject, flattenPlanObjects, getAdtClientV2, getAdtClientV2Safe, getAdtSystem, getAuthManager, getBadiInfo, getCaptured, getCliContext, getConfig, getDefaultSid, getDestination, getLockService, getSource, hasDestination, hyperlink, isExpired, link, listAvailableSids, listDestinations, loadAuthSession, loadFormatPlugin, lockStore, normalizeClassicBadiMetadata, normalizeSearchResults, packageLink, parseEnhancementImplementation, parseFormatSpec, parseTransportNumbers, refreshCredentials, resetCaptured, resetCliContext, resolveAdtHeadersTimeoutMs, resolveConnectionClient, resolveObjectUri, resolvePackageForFormatId, saveAuthSession, setAdtSystem, setCaptured, setCliContext, setDefaultSid, silentLogger, toMetadataOnlySourceVersionListing, toMetadataOnlyTransportSourceManifest };
|
|
1199
|
+
//# sourceMappingURL=index.d.mts.map
|