arc-1 1.0.2 → 1.1.0
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/bin/arc1-cli.js +3 -7
- package/bin/arc1.js +4 -9
- package/dist/adt/abapgit.d.ts +10 -5
- package/dist/adt/abapgit.d.ts.map +1 -1
- package/dist/adt/abapgit.js +357 -76
- package/dist/adt/abapgit.js.map +1 -1
- package/dist/adt/atc.d.ts +49 -0
- package/dist/adt/atc.d.ts.map +1 -0
- package/dist/adt/atc.js +294 -0
- package/dist/adt/atc.js.map +1 -0
- package/dist/adt/aunit-package.d.ts +22 -0
- package/dist/adt/aunit-package.d.ts.map +1 -0
- package/dist/adt/aunit-package.js +78 -0
- package/dist/adt/aunit-package.js.map +1 -0
- package/dist/adt/aunit.d.ts +143 -0
- package/dist/adt/aunit.d.ts.map +1 -0
- package/dist/adt/aunit.js +987 -0
- package/dist/adt/aunit.js.map +1 -0
- package/dist/adt/client.d.ts +9 -7
- package/dist/adt/client.d.ts.map +1 -1
- package/dist/adt/client.js +55 -64
- package/dist/adt/client.js.map +1 -1
- package/dist/adt/config.d.ts +2 -0
- package/dist/adt/config.d.ts.map +1 -1
- package/dist/adt/config.js +1 -0
- package/dist/adt/config.js.map +1 -1
- package/dist/adt/devtools.d.ts +8 -30
- package/dist/adt/devtools.d.ts.map +1 -1
- package/dist/adt/devtools.js +41 -218
- package/dist/adt/devtools.js.map +1 -1
- package/dist/adt/diagnostics.d.ts +1 -1
- package/dist/adt/diagnostics.d.ts.map +1 -1
- package/dist/adt/diagnostics.js +12 -12
- package/dist/adt/diagnostics.js.map +1 -1
- package/dist/adt/errors.d.ts +7 -0
- package/dist/adt/errors.d.ts.map +1 -1
- package/dist/adt/errors.js +7 -0
- package/dist/adt/errors.js.map +1 -1
- package/dist/adt/features.d.ts +9 -3
- package/dist/adt/features.d.ts.map +1 -1
- package/dist/adt/features.js +40 -8
- package/dist/adt/features.js.map +1 -1
- package/dist/adt/gcts.d.ts +12 -45
- package/dist/adt/gcts.d.ts.map +1 -1
- package/dist/adt/gcts.js +299 -171
- package/dist/adt/gcts.js.map +1 -1
- package/dist/adt/http-deadline.d.ts +23 -0
- package/dist/adt/http-deadline.d.ts.map +1 -0
- package/dist/adt/http-deadline.js +106 -0
- package/dist/adt/http-deadline.js.map +1 -0
- package/dist/adt/http-wire-body.d.ts +2 -0
- package/dist/adt/http-wire-body.d.ts.map +1 -0
- package/dist/adt/http-wire-body.js +14 -0
- package/dist/adt/http-wire-body.js.map +1 -0
- package/dist/adt/http.d.ts +10 -24
- package/dist/adt/http.d.ts.map +1 -1
- package/dist/adt/http.js +89 -53
- package/dist/adt/http.js.map +1 -1
- package/dist/adt/path-safety.d.ts +16 -0
- package/dist/adt/path-safety.d.ts.map +1 -0
- package/dist/adt/path-safety.js +101 -0
- package/dist/adt/path-safety.js.map +1 -0
- package/dist/adt/semaphore.d.ts +2 -2
- package/dist/adt/semaphore.d.ts.map +1 -1
- package/dist/adt/semaphore.js +26 -9
- package/dist/adt/semaphore.js.map +1 -1
- package/dist/adt/source-diff.d.ts +10 -1
- package/dist/adt/source-diff.d.ts.map +1 -1
- package/dist/adt/source-diff.js +33 -7
- package/dist/adt/source-diff.js.map +1 -1
- package/dist/adt/text-search.d.ts +25 -0
- package/dist/adt/text-search.d.ts.map +1 -0
- package/dist/adt/text-search.js +152 -0
- package/dist/adt/text-search.js.map +1 -0
- package/dist/adt/transport-diff.d.ts +128 -0
- package/dist/adt/transport-diff.d.ts.map +1 -0
- package/dist/adt/transport-diff.js +524 -0
- package/dist/adt/transport-diff.js.map +1 -0
- package/dist/adt/transport.d.ts +78 -13
- package/dist/adt/transport.d.ts.map +1 -1
- package/dist/adt/transport.js +443 -41
- package/dist/adt/transport.js.map +1 -1
- package/dist/adt/types.d.ts +23 -12
- package/dist/adt/types.d.ts.map +1 -1
- package/dist/adt/xml-parser.d.ts +1 -8
- package/dist/adt/xml-parser.d.ts.map +1 -1
- package/dist/adt/xml-parser.js +54 -60
- package/dist/adt/xml-parser.js.map +1 -1
- package/dist/authz/policy.d.ts.map +1 -1
- package/dist/authz/policy.js +5 -2
- package/dist/authz/policy.js.map +1 -1
- package/dist/cli-args.d.ts +2 -2
- package/dist/cli-args.js +2 -2
- package/dist/cli-checks.d.ts +56 -0
- package/dist/cli-checks.d.ts.map +1 -0
- package/dist/cli-checks.js +368 -0
- package/dist/cli-checks.js.map +1 -0
- package/dist/cli.d.ts +68 -15
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +677 -297
- package/dist/cli.js.map +1 -1
- package/dist/handlers/cds-hints.d.ts.map +1 -1
- package/dist/handlers/cds-hints.js +1 -10
- package/dist/handlers/cds-hints.js.map +1 -1
- package/dist/handlers/diagnose.d.ts +4 -0
- package/dist/handlers/diagnose.d.ts.map +1 -1
- package/dist/handlers/diagnose.js +616 -9
- package/dist/handlers/diagnose.js.map +1 -1
- package/dist/handlers/dispatch.d.ts.map +1 -1
- package/dist/handlers/dispatch.js +40 -1
- package/dist/handlers/dispatch.js.map +1 -1
- package/dist/handlers/git.d.ts.map +1 -1
- package/dist/handlers/git.js +165 -84
- package/dist/handlers/git.js.map +1 -1
- package/dist/handlers/read.d.ts.map +1 -1
- package/dist/handlers/read.js +15 -0
- package/dist/handlers/read.js.map +1 -1
- package/dist/handlers/schemas.d.ts +15 -2
- package/dist/handlers/schemas.d.ts.map +1 -1
- package/dist/handlers/schemas.js +75 -6
- package/dist/handlers/schemas.js.map +1 -1
- package/dist/handlers/search.js +1 -1
- package/dist/handlers/search.js.map +1 -1
- package/dist/handlers/tools.d.ts.map +1 -1
- package/dist/handlers/tools.js +51 -42
- package/dist/handlers/tools.js.map +1 -1
- package/dist/handlers/transport.d.ts +2 -1
- package/dist/handlers/transport.d.ts.map +1 -1
- package/dist/handlers/transport.js +128 -27
- package/dist/handlers/transport.js.map +1 -1
- package/dist/handlers/write/create.d.ts.map +1 -1
- package/dist/handlers/write/create.js +11 -0
- package/dist/handlers/write/create.js.map +1 -1
- package/dist/handlers/write/update-delete.d.ts.map +1 -1
- package/dist/handlers/write/update-delete.js +33 -10
- package/dist/handlers/write/update-delete.js.map +1 -1
- package/dist/handlers/write-helpers.d.ts.map +1 -1
- package/dist/handlers/write-helpers.js +3 -2
- package/dist/handlers/write-helpers.js.map +1 -1
- package/dist/server/audit.d.ts +1 -1
- package/dist/server/audit.d.ts.map +1 -1
- package/dist/server/audit.js +228 -21
- package/dist/server/audit.js.map +1 -1
- package/dist/server/config.d.ts +16 -0
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +145 -17
- package/dist/server/config.js.map +1 -1
- package/dist/server/effective-policy-log.d.ts +2 -1
- package/dist/server/effective-policy-log.d.ts.map +1 -1
- package/dist/server/effective-policy-log.js +8 -2
- package/dist/server/effective-policy-log.js.map +1 -1
- package/dist/server/multi-target-runtime.d.ts.map +1 -1
- package/dist/server/multi-target-runtime.js +3 -0
- package/dist/server/multi-target-runtime.js.map +1 -1
- package/dist/server/multi-target-tools.d.ts.map +1 -1
- package/dist/server/multi-target-tools.js +5 -0
- package/dist/server/multi-target-tools.js.map +1 -1
- package/dist/server/server.d.ts +15 -13
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +36 -26
- package/dist/server/server.js.map +1 -1
- package/dist/server/types.d.ts +2 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js +1 -0
- package/dist/server/types.js.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADT repository text-search request and response contract.
|
|
3
|
+
*
|
|
4
|
+
* This lives outside the client facade and the shared XML parser because the
|
|
5
|
+
* endpoint has its own discovery vocabulary, paging model, proxy-URI encoding,
|
|
6
|
+
* and release fallbacks.
|
|
7
|
+
*/
|
|
8
|
+
import { checkOperation, OperationType } from './safety.js';
|
|
9
|
+
import { decodeXmlEntities, findDeepNodes, getNestedArray, parseXml } from './xml-parser.js';
|
|
10
|
+
const MAX_SEARCH_RESULTS = 1_000;
|
|
11
|
+
/** Coerce a caller-supplied search-result limit into a safe positive integer. */
|
|
12
|
+
export function clampSearchResults(requested, fallback) {
|
|
13
|
+
if (requested === undefined || !Number.isFinite(requested) || requested < 1)
|
|
14
|
+
return fallback;
|
|
15
|
+
return Math.min(Math.floor(requested), MAX_SEARCH_RESULTS);
|
|
16
|
+
}
|
|
17
|
+
/** Reduce an ADT object type to the short form the text-search filter expects.
|
|
18
|
+
*
|
|
19
|
+
* `/informationsystem/textsearch/objecttypes` advertises each supported type as
|
|
20
|
+
* a named item whose `name` is the short form (`CLAS`) and whose `data` is the
|
|
21
|
+
* slash form (`CLAS/OC`). Function modules are the live-advertised exception to
|
|
22
|
+
* prefix truncation: `FUGR/F` maps to `FUGR`, while `FUGR/FF` maps to `FUNC`.
|
|
23
|
+
*/
|
|
24
|
+
export function toTextSearchObjectType(objectType) {
|
|
25
|
+
const normalized = String(objectType).trim().toUpperCase();
|
|
26
|
+
if (normalized === 'FUGR/FF')
|
|
27
|
+
return 'FUNC';
|
|
28
|
+
return normalized.split('/')[0];
|
|
29
|
+
}
|
|
30
|
+
/** Execute a bounded source search using the lowercase discovery collection. */
|
|
31
|
+
export async function searchSource(http, safety, pattern, maxResults = 50, objectType, packageName) {
|
|
32
|
+
checkOperation(safety, OperationType.Search, 'SearchSource');
|
|
33
|
+
const params = new URLSearchParams({
|
|
34
|
+
searchString: pattern,
|
|
35
|
+
searchFromIndex: '1',
|
|
36
|
+
searchToIndex: String(clampSearchResults(maxResults, 50)),
|
|
37
|
+
});
|
|
38
|
+
if (objectType)
|
|
39
|
+
params.set('objectType', toTextSearchObjectType(objectType));
|
|
40
|
+
if (packageName)
|
|
41
|
+
params.set('packageName', packageName);
|
|
42
|
+
const response = await http.get(`/sap/bc/adt/repository/informationsystem/textsearch?${params.toString()}`);
|
|
43
|
+
return parseSourceSearchResults(response.body);
|
|
44
|
+
}
|
|
45
|
+
/** Pull `objectName` out of an ADT proxy-URI mapping. */
|
|
46
|
+
function parseProxyUriObjectName(uri) {
|
|
47
|
+
if (!uri)
|
|
48
|
+
return '';
|
|
49
|
+
const content = /[?&]content=([^&]*)/.exec(uri.replace(/&/g, '&'));
|
|
50
|
+
if (!content)
|
|
51
|
+
return '';
|
|
52
|
+
let decoded = content[1];
|
|
53
|
+
try {
|
|
54
|
+
decoded = decodeURIComponent(decoded);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Malformed percent-encoding — fall through with the raw value.
|
|
58
|
+
}
|
|
59
|
+
const named = /objectName:([^,#]+)/i.exec(decoded);
|
|
60
|
+
const raw = named ? named[1] : decoded.split('#')[0];
|
|
61
|
+
return raw.replace(/=+.*$/, '').trim();
|
|
62
|
+
}
|
|
63
|
+
/** Pull the 1-based line number out of a text-line proxy URI. */
|
|
64
|
+
function parseTextLineNumber(uri) {
|
|
65
|
+
if (!uri)
|
|
66
|
+
return 0;
|
|
67
|
+
let decoded = uri.replace(/&/g, '&');
|
|
68
|
+
try {
|
|
69
|
+
decoded = decodeURIComponent(decoded);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Malformed percent-encoding — fall through with the raw value.
|
|
73
|
+
}
|
|
74
|
+
const match = /#start=(\d+)/.exec(decoded) ?? /\bposition:(\d+)/.exec(decoded);
|
|
75
|
+
return match ? Number(match[1]) : 0;
|
|
76
|
+
}
|
|
77
|
+
function cleanTextSearchSnippet(raw) {
|
|
78
|
+
return decodeXmlEntities(String(raw ?? ''))
|
|
79
|
+
.replace(/<\/?b>/gi, '')
|
|
80
|
+
.replace(/\s+/g, ' ')
|
|
81
|
+
.trim();
|
|
82
|
+
}
|
|
83
|
+
/** Parse live text-search results plus the older object-reference and Atom fallbacks. */
|
|
84
|
+
export function parseSourceSearchResults(xml) {
|
|
85
|
+
const parsed = parseXml(xml);
|
|
86
|
+
const results = [];
|
|
87
|
+
const searchObjects = findDeepNodes(parsed, 'textSearchObject');
|
|
88
|
+
if (searchObjects.length > 0) {
|
|
89
|
+
for (const obj of searchObjects) {
|
|
90
|
+
const matches = findDeepNodes(obj, 'textLine').map((line) => ({
|
|
91
|
+
line: parseTextLineNumber(String(line['@_uri'] ?? '')),
|
|
92
|
+
snippet: cleanTextSearchSnippet(line.content),
|
|
93
|
+
}));
|
|
94
|
+
// Ancestor nodes provide navigation context but contain no actual hits.
|
|
95
|
+
if (matches.length === 0)
|
|
96
|
+
continue;
|
|
97
|
+
const uri = decodeXmlEntities(String(obj['@_uri'] ?? ''));
|
|
98
|
+
const mainObject = (obj.adtMainObject ?? {});
|
|
99
|
+
results.push({
|
|
100
|
+
objectType: String(mainObject['@_type'] ?? ''),
|
|
101
|
+
objectName: parseProxyUriObjectName(uri) || String(mainObject['@_name'] ?? ''),
|
|
102
|
+
uri,
|
|
103
|
+
matches,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
108
|
+
const refs = getNestedArray(parsed, 'objectReferences', 'objectReference');
|
|
109
|
+
if (refs.length > 0) {
|
|
110
|
+
for (const ref of refs) {
|
|
111
|
+
const matches = findDeepNodes(ref, 'textSearchResult').map((match) => ({
|
|
112
|
+
line: Number(match['@_line'] ?? 0),
|
|
113
|
+
snippet: String(match['@_snippet'] ?? match['#text'] ?? ''),
|
|
114
|
+
}));
|
|
115
|
+
results.push({
|
|
116
|
+
objectType: String(ref['@_type'] ?? ''),
|
|
117
|
+
objectName: String(ref['@_name'] ?? ''),
|
|
118
|
+
uri: String(ref['@_uri'] ?? ''),
|
|
119
|
+
matches,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return results;
|
|
123
|
+
}
|
|
124
|
+
const entries = getNestedArray(parsed, 'feed', 'entry');
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
const uri = String(entry.id ?? entry['@_href'] ?? '');
|
|
127
|
+
const title = String(entry.title ?? '');
|
|
128
|
+
results.push({
|
|
129
|
+
objectType: '',
|
|
130
|
+
objectName: title || uri.split('/').pop() || '',
|
|
131
|
+
uri,
|
|
132
|
+
matches: [],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (results.length === 0) {
|
|
136
|
+
for (const node of findDeepNodes(parsed, 'match')) {
|
|
137
|
+
results.push({
|
|
138
|
+
objectType: String(node['@_type'] ?? ''),
|
|
139
|
+
objectName: String(node['@_name'] ?? node['@_objectName'] ?? ''),
|
|
140
|
+
uri: String(node['@_uri'] ?? ''),
|
|
141
|
+
matches: [
|
|
142
|
+
{
|
|
143
|
+
line: Number(node['@_line'] ?? 0),
|
|
144
|
+
snippet: String(node['@_snippet'] ?? node['#text'] ?? ''),
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return results;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=text-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-search.js","sourceRoot":"","sources":["../../src/adt/text-search.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAAC,SAA6B,EAAE,QAAgB;IAChF,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7F,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,UAAU,GA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H,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC;gBACX,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACxC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;gBAChE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBAChC,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;qBAC1D;iBACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport-scoped review diffs — backs `SAPTransport action="diff"`.
|
|
3
|
+
*
|
|
4
|
+
* Answers "what did this transport change?" by picking, per object, the revision written
|
|
5
|
+
* under the transport and the one immediately before it, then diffing those two sources.
|
|
6
|
+
*
|
|
7
|
+
* The selection mirrors SAP's own ADT MCP tool
|
|
8
|
+
* (`com.sap.adt.tm.backend.diff.TransportDiffService`, ADT 3.60.1) with four corrections
|
|
9
|
+
* proven necessary against live feeds — see docs/plans/2026-08-03-transport-diff.md:
|
|
10
|
+
*
|
|
11
|
+
* 1. match the request AND its tasks (SAP matches one exact correction number);
|
|
12
|
+
* 2. break timestamp ties on the version number — the feed is returned in neither
|
|
13
|
+
* version nor date order (a4h returns `00002, 00000, 00001`);
|
|
14
|
+
* 3. skip every same-transport sibling when walking back, not just one active entry,
|
|
15
|
+
* so two saves under one transport still diff against the pre-transport state;
|
|
16
|
+
* 4. never require the predecessor to carry a CTS id — released revisions with a blank
|
|
17
|
+
* transport exist and are valid baselines.
|
|
18
|
+
*
|
|
19
|
+
* `selectionMethod` and `baselineStatus` ride the result so a reviewer can tell exact
|
|
20
|
+
* evidence from a fallback guess; SAP's tool reports neither.
|
|
21
|
+
*/
|
|
22
|
+
import { type AdtClient } from './client.js';
|
|
23
|
+
import type { RevisionInfo, TransportObject } from './types.js';
|
|
24
|
+
/** How `current` was chosen — evidence quality, surfaced to the caller. */
|
|
25
|
+
export type RevisionSelectionMethod = 'exact-transport' | 'latest-revision-fallback' | 'active-only-fallback' | 'no-revisions';
|
|
26
|
+
/** What the "before" side of a diff actually is. */
|
|
27
|
+
export type BaselineStatus = 'prior-revision'
|
|
28
|
+
/** A predecessor exists, but the "after" side was NOT matched to this transport — the diff
|
|
29
|
+
* may belong to another change. Never present this as authoritative. */
|
|
30
|
+
| 'prior-revision-unverified' | 'no-prior-snapshot' | 'baseline-ambiguous' | 'baseline-unavailable';
|
|
31
|
+
export interface SkippedRevision {
|
|
32
|
+
revision: RevisionInfo;
|
|
33
|
+
reason: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TransportRevisionPair {
|
|
36
|
+
current: RevisionInfo | null;
|
|
37
|
+
previous: RevisionInfo | null;
|
|
38
|
+
selectionMethod: RevisionSelectionMethod;
|
|
39
|
+
skipped: SkippedRevision[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The 5-digit ADT version number of a revision.
|
|
43
|
+
*
|
|
44
|
+
* On 7.58 the atom `<id>` is the bare number (`00001`). Some releases use a URN there, so
|
|
45
|
+
* fall back to the number segment of the content URI (`…/versions/<ts>/00001/content`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function revisionNumber(revision: RevisionInfo): string;
|
|
48
|
+
/**
|
|
49
|
+
* Pick the revision written under `transportIds` and the one immediately preceding it.
|
|
50
|
+
*
|
|
51
|
+
* `transportIds` should hold the request id AND every task id: version records reference
|
|
52
|
+
* the request on the systems verified so far, but matching both is a superset that can
|
|
53
|
+
* only add correct matches.
|
|
54
|
+
*/
|
|
55
|
+
export declare function selectTransportRevisionPair(revisions: RevisionInfo[], transportIds: Iterable<string>): TransportRevisionPair;
|
|
56
|
+
/**
|
|
57
|
+
* Classify the "before" side.
|
|
58
|
+
*
|
|
59
|
+
* Creation is asserted ONLY when the current revision was matched to the transport and has
|
|
60
|
+
* no predecessor. A missing predecessor under a fallback selection is ambiguous — it may
|
|
61
|
+
* simply mean the object's history was never snapshotted.
|
|
62
|
+
*/
|
|
63
|
+
export declare function baselineStatusFor(pair: TransportRevisionPair, allRevisions?: RevisionInfo[]): BaselineStatus;
|
|
64
|
+
export interface LogicalTransportObject {
|
|
65
|
+
pgmid: string;
|
|
66
|
+
type: string;
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
taskIds: string[];
|
|
70
|
+
/** The raw transport entries this logical object was built from. */
|
|
71
|
+
components: Array<{
|
|
72
|
+
pgmid: string;
|
|
73
|
+
type: string;
|
|
74
|
+
name: string;
|
|
75
|
+
wbtype: string;
|
|
76
|
+
taskId: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Collapse a transport's raw entries into reviewable objects.
|
|
81
|
+
*
|
|
82
|
+
* `parseTransportList` already yields task-level entries only, so request-level and
|
|
83
|
+
* `<tm:all_objects>` duplicates never arrive here — but the same object under two tasks
|
|
84
|
+
* does, and LIMU names are unusable as ADT object names either way.
|
|
85
|
+
*/
|
|
86
|
+
export declare function rollupTransportObjects(tasks: Array<{
|
|
87
|
+
id: string;
|
|
88
|
+
objects: TransportObject[];
|
|
89
|
+
}>): LogicalTransportObject[];
|
|
90
|
+
/**
|
|
91
|
+
* Which class includes this transport actually touched.
|
|
92
|
+
*
|
|
93
|
+
* CTS already states it: a `CINC ZCL_X============CCIMP` entry names the include, and
|
|
94
|
+
* `METH`/`CPUB`/`CPRI`/`CPRO`/`CLSD` mean the main source. Reading that is strictly better
|
|
95
|
+
* than diffing all five and guessing afterwards which were untouched — it cannot mislabel a
|
|
96
|
+
* changed include as unchanged, and it drops ~4/5 of the SAP round trips for a typical class.
|
|
97
|
+
* A bare `R3TR CLAS` entry carries no component detail, so fall back to all five.
|
|
98
|
+
*/
|
|
99
|
+
export declare function classIncludesFor(object: LogicalTransportObject): {
|
|
100
|
+
includes: string[];
|
|
101
|
+
fromComponents: boolean;
|
|
102
|
+
};
|
|
103
|
+
export interface TransportPartDiff {
|
|
104
|
+
part: string;
|
|
105
|
+
baselineStatus: BaselineStatus;
|
|
106
|
+
selectionMethod: RevisionSelectionMethod;
|
|
107
|
+
from: string | null;
|
|
108
|
+
to: string | null;
|
|
109
|
+
added: number;
|
|
110
|
+
removed: number;
|
|
111
|
+
diff: string;
|
|
112
|
+
/** The hunks were trimmed; `added`/`removed` still reflect the full change. */
|
|
113
|
+
diffTruncated?: boolean;
|
|
114
|
+
note?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface TransportObjectDiff {
|
|
117
|
+
type: string;
|
|
118
|
+
name: string;
|
|
119
|
+
taskIds: string[];
|
|
120
|
+
parts: TransportPartDiff[];
|
|
121
|
+
/** Set instead of `parts` when the object carries no diffable source at all. */
|
|
122
|
+
inventoryReason?: string;
|
|
123
|
+
}
|
|
124
|
+
/** Diff every source part of one logical object. Never throws — failures become visible rows. */
|
|
125
|
+
export declare function diffTransportObject(client: AdtClient, object: LogicalTransportObject, transportIds: Set<string>, opts?: {
|
|
126
|
+
minimalErrors?: boolean;
|
|
127
|
+
}): Promise<TransportObjectDiff>;
|
|
128
|
+
//# sourceMappingURL=transport-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-diff.d.ts","sourceRoot":"","sources":["../../src/adt/transport-diff.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