catalyst-relay 0.5.7 → 0.5.9
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/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +81 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -535,6 +535,15 @@ interface TransportObject {
|
|
|
535
535
|
position: string;
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
/**
|
|
539
|
+
* Parse Transport Tasks — Extract task IDs and their objects from transport XML
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
interface TaskContents {
|
|
543
|
+
taskId: string;
|
|
544
|
+
objects: TransportObject[];
|
|
545
|
+
}
|
|
546
|
+
|
|
538
547
|
/**
|
|
539
548
|
* Git Diff — Compare local content with server content
|
|
540
549
|
*
|
|
@@ -613,6 +622,7 @@ interface ADTClient {
|
|
|
613
622
|
createTransport(config: TransportConfig): AsyncResult<string>;
|
|
614
623
|
deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
|
|
615
624
|
removeFromTransport(transportId: string, objectName: string): AsyncResult<void>;
|
|
625
|
+
viewTransportObjects(transportId: string): AsyncResult<TaskContents[]>;
|
|
616
626
|
gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
|
|
617
627
|
getObjectConfig(): ObjectConfig[];
|
|
618
628
|
}
|
|
@@ -639,4 +649,4 @@ declare function activateLogging(): void;
|
|
|
639
649
|
*/
|
|
640
650
|
declare function deactivateLogging(): void;
|
|
641
651
|
|
|
642
|
-
export { type ADTClient, type ActivationMessage, type ActivationResult, type Aggregation, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type BasicFilter, type BetweenFilter, type ClientConfig, type ColumnInfo, type DataFrame, type DataPreviewQuery, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ExportableSessionState, type FolderNode, type ListFilter, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectNode, type ObjectRef, type ObjectWithContent, type Package, type PackageNode, type Parameter, type PreviewSQL, type QueryFilter, type Result, type SamlAuthConfig, type SearchOptions, type SearchResult, type Session, type Sorting, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TransportObject, type TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
|
|
652
|
+
export { type ADTClient, type ActivationMessage, type ActivationResult, type Aggregation, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type BasicFilter, type BetweenFilter, type ClientConfig, type ColumnInfo, type DataFrame, type DataPreviewQuery, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ExportableSessionState, type FolderNode, type ListFilter, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectNode, type ObjectRef, type ObjectWithContent, type Package, type PackageNode, type Parameter, type PreviewSQL, type QueryFilter, type Result, type SamlAuthConfig, type SearchOptions, type SearchResult, type Session, type Sorting, type SsoAuthConfig, type SuccessResponse, type TaskContents, type Transport, type TransportConfig, type TransportObject, type TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
|
package/dist/index.d.ts
CHANGED
|
@@ -535,6 +535,15 @@ interface TransportObject {
|
|
|
535
535
|
position: string;
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
/**
|
|
539
|
+
* Parse Transport Tasks — Extract task IDs and their objects from transport XML
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
interface TaskContents {
|
|
543
|
+
taskId: string;
|
|
544
|
+
objects: TransportObject[];
|
|
545
|
+
}
|
|
546
|
+
|
|
538
547
|
/**
|
|
539
548
|
* Git Diff — Compare local content with server content
|
|
540
549
|
*
|
|
@@ -613,6 +622,7 @@ interface ADTClient {
|
|
|
613
622
|
createTransport(config: TransportConfig): AsyncResult<string>;
|
|
614
623
|
deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
|
|
615
624
|
removeFromTransport(transportId: string, objectName: string): AsyncResult<void>;
|
|
625
|
+
viewTransportObjects(transportId: string): AsyncResult<TaskContents[]>;
|
|
616
626
|
gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
|
|
617
627
|
getObjectConfig(): ObjectConfig[];
|
|
618
628
|
}
|
|
@@ -639,4 +649,4 @@ declare function activateLogging(): void;
|
|
|
639
649
|
*/
|
|
640
650
|
declare function deactivateLogging(): void;
|
|
641
651
|
|
|
642
|
-
export { type ADTClient, type ActivationMessage, type ActivationResult, type Aggregation, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type BasicFilter, type BetweenFilter, type ClientConfig, type ColumnInfo, type DataFrame, type DataPreviewQuery, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ExportableSessionState, type FolderNode, type ListFilter, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectNode, type ObjectRef, type ObjectWithContent, type Package, type PackageNode, type Parameter, type PreviewSQL, type QueryFilter, type Result, type SamlAuthConfig, type SearchOptions, type SearchResult, type Session, type Sorting, type SsoAuthConfig, type SuccessResponse, type Transport, type TransportConfig, type TransportObject, type TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
|
|
652
|
+
export { type ADTClient, type ActivationMessage, type ActivationResult, type Aggregation, type ApiResponse, type AsyncResult, type AuthConfig, type AuthType, type BasicAuthConfig, type BasicFilter, type BetweenFilter, type ClientConfig, type ColumnInfo, type DataFrame, type DataPreviewQuery, type Dependency, type DiffResult, type DistinctResult, type ErrorCode, type ErrorResponse, type ExportableSessionState, type FolderNode, type ListFilter, type ObjectConfig, type ObjectContent, type ObjectMetadata, type ObjectNode, type ObjectRef, type ObjectWithContent, type Package, type PackageNode, type Parameter, type PreviewSQL, type QueryFilter, type Result, type SamlAuthConfig, type SearchOptions, type SearchResult, type Session, type Sorting, type SsoAuthConfig, type SuccessResponse, type TaskContents, type Transport, type TransportConfig, type TransportObject, type TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
|
package/dist/index.js
CHANGED
|
@@ -2506,45 +2506,37 @@ async function createTransport(client, config) {
|
|
|
2506
2506
|
return ok(transportId);
|
|
2507
2507
|
}
|
|
2508
2508
|
|
|
2509
|
-
// src/core/adt/transports/
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
const
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2509
|
+
// src/core/adt/transports/parseTransportTasks.ts
|
|
2510
|
+
function parseTransportTasks(doc) {
|
|
2511
|
+
const tasks = [];
|
|
2512
|
+
const taskElements = doc.getElementsByTagName("tm:task");
|
|
2513
|
+
for (let i = 0; i < taskElements.length; i++) {
|
|
2514
|
+
const taskEl = taskElements[i];
|
|
2515
|
+
if (!taskEl) continue;
|
|
2516
|
+
const taskId = taskEl.getAttribute("tm:number");
|
|
2517
|
+
if (!taskId) continue;
|
|
2518
|
+
const objects = [];
|
|
2519
|
+
const objectElements = taskEl.getElementsByTagName("tm:abap_object");
|
|
2520
|
+
for (let j = 0; j < objectElements.length; j++) {
|
|
2521
|
+
const el = objectElements[j];
|
|
2522
|
+
if (!el) continue;
|
|
2523
|
+
const name = el.getAttribute("tm:name");
|
|
2524
|
+
if (!name) continue;
|
|
2525
|
+
objects.push({
|
|
2526
|
+
name,
|
|
2527
|
+
description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
|
|
2528
|
+
pgmid: el.getAttribute("tm:pgmid") || "",
|
|
2529
|
+
type: el.getAttribute("tm:type") || "",
|
|
2530
|
+
position: el.getAttribute("tm:position") || ""
|
|
2531
|
+
});
|
|
2517
2532
|
}
|
|
2518
|
-
|
|
2519
|
-
if (requestErr) return err(requestErr);
|
|
2520
|
-
if (!response.ok) {
|
|
2521
|
-
const text2 = await response.text();
|
|
2522
|
-
const errorMsg = extractError(text2);
|
|
2523
|
-
return err(new Error(`Failed to read transport ${transportId}: ${errorMsg}`));
|
|
2524
|
-
}
|
|
2525
|
-
const text = await response.text();
|
|
2526
|
-
const [doc, parseErr] = safeParseXml(text);
|
|
2527
|
-
if (parseErr) return err(parseErr);
|
|
2528
|
-
const objects = [];
|
|
2529
|
-
const elements = doc.getElementsByTagName("tm:abap_object");
|
|
2530
|
-
for (let i = 0; i < elements.length; i++) {
|
|
2531
|
-
const el = elements[i];
|
|
2532
|
-
if (!el) continue;
|
|
2533
|
-
const name = el.getAttribute("tm:name");
|
|
2534
|
-
if (!name) continue;
|
|
2535
|
-
objects.push({
|
|
2536
|
-
name,
|
|
2537
|
-
description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
|
|
2538
|
-
pgmid: el.getAttribute("tm:pgmid") || "",
|
|
2539
|
-
type: el.getAttribute("tm:type") || "",
|
|
2540
|
-
position: el.getAttribute("tm:position") || ""
|
|
2541
|
-
});
|
|
2533
|
+
tasks.push({ taskId, objects });
|
|
2542
2534
|
}
|
|
2543
|
-
return
|
|
2535
|
+
return tasks;
|
|
2544
2536
|
}
|
|
2545
2537
|
|
|
2546
2538
|
// src/core/adt/transports/removeFromTransport.ts
|
|
2547
|
-
var
|
|
2539
|
+
var ACCEPT_HEADER = "application/vnd.sap.adt.transportorganizer.v1+xml";
|
|
2548
2540
|
async function removeTransportEntry(client, transportId, object) {
|
|
2549
2541
|
const body = [
|
|
2550
2542
|
'<?xml version="1.0" encoding="ASCII"?>',
|
|
@@ -2558,7 +2550,7 @@ async function removeTransportEntry(client, transportId, object) {
|
|
|
2558
2550
|
method: "PUT",
|
|
2559
2551
|
path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
|
|
2560
2552
|
headers: {
|
|
2561
|
-
"Accept":
|
|
2553
|
+
"Accept": ACCEPT_HEADER,
|
|
2562
2554
|
"Content-Type": "text/plain"
|
|
2563
2555
|
},
|
|
2564
2556
|
body
|
|
@@ -2572,49 +2564,36 @@ async function removeTransportEntry(client, transportId, object) {
|
|
|
2572
2564
|
return ok(void 0);
|
|
2573
2565
|
}
|
|
2574
2566
|
async function removeFromTransport(client, transportId, objectName) {
|
|
2575
|
-
const [
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2567
|
+
const [response, requestErr] = await client.request({
|
|
2568
|
+
method: "GET",
|
|
2569
|
+
path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
|
|
2570
|
+
headers: { "Accept": ACCEPT_HEADER }
|
|
2571
|
+
});
|
|
2572
|
+
if (requestErr) return err(requestErr);
|
|
2573
|
+
if (!response.ok) {
|
|
2574
|
+
const text2 = await response.text();
|
|
2575
|
+
const errorMsg = extractError(text2);
|
|
2576
|
+
return err(new Error(`Failed to read transport ${transportId}: ${errorMsg}`));
|
|
2580
2577
|
}
|
|
2581
|
-
|
|
2578
|
+
const text = await response.text();
|
|
2579
|
+
const [doc, parseErr] = safeParseXml(text);
|
|
2580
|
+
if (parseErr) return err(parseErr);
|
|
2581
|
+
const tasks = parseTransportTasks(doc);
|
|
2582
|
+
for (const task of tasks) {
|
|
2583
|
+
const object = task.objects.find((o) => o.name === objectName);
|
|
2584
|
+
if (!object) continue;
|
|
2585
|
+
return removeTransportEntry(client, task.taskId, object);
|
|
2586
|
+
}
|
|
2587
|
+
return err(new Error(`Object '${objectName}' not found on transport ${transportId}`));
|
|
2582
2588
|
}
|
|
2583
2589
|
|
|
2584
2590
|
// src/core/adt/transports/deleteTransport.ts
|
|
2585
|
-
var
|
|
2586
|
-
function parseTransportTasks(doc) {
|
|
2587
|
-
const tasks = [];
|
|
2588
|
-
const taskElements = doc.getElementsByTagName("tm:task");
|
|
2589
|
-
for (let i = 0; i < taskElements.length; i++) {
|
|
2590
|
-
const taskEl = taskElements[i];
|
|
2591
|
-
if (!taskEl) continue;
|
|
2592
|
-
const taskId = taskEl.getAttribute("tm:number");
|
|
2593
|
-
if (!taskId) continue;
|
|
2594
|
-
const objects = [];
|
|
2595
|
-
const objectElements = taskEl.getElementsByTagName("tm:abap_object");
|
|
2596
|
-
for (let j = 0; j < objectElements.length; j++) {
|
|
2597
|
-
const el = objectElements[j];
|
|
2598
|
-
if (!el) continue;
|
|
2599
|
-
const name = el.getAttribute("tm:name");
|
|
2600
|
-
if (!name) continue;
|
|
2601
|
-
objects.push({
|
|
2602
|
-
name,
|
|
2603
|
-
description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
|
|
2604
|
-
pgmid: el.getAttribute("tm:pgmid") || "",
|
|
2605
|
-
type: el.getAttribute("tm:type") || "",
|
|
2606
|
-
position: el.getAttribute("tm:position") || ""
|
|
2607
|
-
});
|
|
2608
|
-
}
|
|
2609
|
-
tasks.push({ taskId, objects });
|
|
2610
|
-
}
|
|
2611
|
-
return tasks;
|
|
2612
|
-
}
|
|
2591
|
+
var ACCEPT_HEADER2 = "application/vnd.sap.adt.transportorganizer.v1+xml";
|
|
2613
2592
|
async function sortAndCompress(client, taskId) {
|
|
2614
2593
|
const [response, requestErr] = await client.request({
|
|
2615
2594
|
method: "POST",
|
|
2616
2595
|
path: `/sap/bc/adt/cts/transportrequests/${taskId}/sortandcompress`,
|
|
2617
|
-
headers: { "Accept":
|
|
2596
|
+
headers: { "Accept": ACCEPT_HEADER2 }
|
|
2618
2597
|
});
|
|
2619
2598
|
if (requestErr) return err(requestErr);
|
|
2620
2599
|
if (!response.ok) {
|
|
@@ -2628,7 +2607,7 @@ async function deleteRequest(client, id) {
|
|
|
2628
2607
|
const [response, requestErr] = await client.request({
|
|
2629
2608
|
method: "DELETE",
|
|
2630
2609
|
path: `/sap/bc/adt/cts/transportrequests/${id}`,
|
|
2631
|
-
headers: { "Accept":
|
|
2610
|
+
headers: { "Accept": ACCEPT_HEADER2 }
|
|
2632
2611
|
});
|
|
2633
2612
|
if (requestErr) return err(requestErr);
|
|
2634
2613
|
if (!response.ok) {
|
|
@@ -2642,7 +2621,7 @@ async function deleteTransport(client, transportId, removeObjects = false) {
|
|
|
2642
2621
|
const [response, requestErr] = await client.request({
|
|
2643
2622
|
method: "GET",
|
|
2644
2623
|
path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
|
|
2645
|
-
headers: { "Accept":
|
|
2624
|
+
headers: { "Accept": ACCEPT_HEADER2 }
|
|
2646
2625
|
});
|
|
2647
2626
|
if (requestErr) return err(requestErr);
|
|
2648
2627
|
if (!response.ok) {
|
|
@@ -2661,7 +2640,7 @@ async function deleteTransport(client, transportId, removeObjects = false) {
|
|
|
2661
2640
|
const [taskResponse, taskReadErr] = await client.request({
|
|
2662
2641
|
method: "GET",
|
|
2663
2642
|
path: `/sap/bc/adt/cts/transportrequests/${task.taskId}`,
|
|
2664
|
-
headers: { "Accept":
|
|
2643
|
+
headers: { "Accept": ACCEPT_HEADER2 }
|
|
2665
2644
|
});
|
|
2666
2645
|
if (taskReadErr) return err(taskReadErr);
|
|
2667
2646
|
const taskText = await taskResponse.text();
|
|
@@ -2689,6 +2668,26 @@ async function deleteTransport(client, transportId, removeObjects = false) {
|
|
|
2689
2668
|
return deleteRequest(client, transportId);
|
|
2690
2669
|
}
|
|
2691
2670
|
|
|
2671
|
+
// src/core/adt/transports/viewTransportObjects.ts
|
|
2672
|
+
var ACCEPT_HEADER3 = "application/vnd.sap.adt.transportorganizer.v1+xml";
|
|
2673
|
+
async function viewTransportObjects(client, transportId) {
|
|
2674
|
+
const [response, requestErr] = await client.request({
|
|
2675
|
+
method: "GET",
|
|
2676
|
+
path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
|
|
2677
|
+
headers: { "Accept": ACCEPT_HEADER3 }
|
|
2678
|
+
});
|
|
2679
|
+
if (requestErr) return err(requestErr);
|
|
2680
|
+
if (!response.ok) {
|
|
2681
|
+
const text2 = await response.text();
|
|
2682
|
+
const errorMsg = extractError(text2);
|
|
2683
|
+
return err(new Error(`Failed to read transport ${transportId}: ${errorMsg}`));
|
|
2684
|
+
}
|
|
2685
|
+
const text = await response.text();
|
|
2686
|
+
const [doc, parseErr] = safeParseXml(text);
|
|
2687
|
+
if (parseErr) return err(parseErr);
|
|
2688
|
+
return ok(parseTransportTasks(doc));
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2692
2691
|
// src/core/adt/craud/gitDiff.ts
|
|
2693
2692
|
var import_diff = require("diff");
|
|
2694
2693
|
function computeDiff(serverLines, localLines) {
|
|
@@ -2958,6 +2957,12 @@ async function removeFromTransport2(state, requestor, transportId, objectName) {
|
|
|
2958
2957
|
return removeFromTransport(requestor, transportId, objectName);
|
|
2959
2958
|
}
|
|
2960
2959
|
|
|
2960
|
+
// src/client/methods/transport/viewTransportObjects.ts
|
|
2961
|
+
async function viewTransportObjects2(state, requestor, transportId) {
|
|
2962
|
+
if (!state.session) return err(new Error("Not logged in"));
|
|
2963
|
+
return viewTransportObjects(requestor, transportId);
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2961
2966
|
// src/client/methods/diff/gitDiff.ts
|
|
2962
2967
|
async function gitDiff2(state, requestor, objects) {
|
|
2963
2968
|
if (!state.session) return err(new Error("Not logged in"));
|
|
@@ -3340,6 +3345,9 @@ var ADTClientImpl = class {
|
|
|
3340
3345
|
async removeFromTransport(transportId, objectName) {
|
|
3341
3346
|
return removeFromTransport2(this.state, this.requestor, transportId, objectName);
|
|
3342
3347
|
}
|
|
3348
|
+
async viewTransportObjects(transportId) {
|
|
3349
|
+
return viewTransportObjects2(this.state, this.requestor, transportId);
|
|
3350
|
+
}
|
|
3343
3351
|
// --- Diff Operations ---
|
|
3344
3352
|
async gitDiff(objects) {
|
|
3345
3353
|
return gitDiff2(this.state, this.requestor, objects);
|