catalyst-relay 0.5.6 → 0.5.8

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 CHANGED
@@ -520,7 +520,7 @@ interface TransportConfig {
520
520
  */
521
521
 
522
522
  /**
523
- * Object entry to remove from a transport
523
+ * Object entry on a transport
524
524
  */
525
525
  interface TransportObject {
526
526
  /** Object name (e.g., 'ZSNAP_F72TG_103') */
@@ -612,7 +612,7 @@ interface ADTClient {
612
612
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
613
613
  createTransport(config: TransportConfig): AsyncResult<string>;
614
614
  deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
615
- removeFromTransport(transportId: string, object: TransportObject): AsyncResult<void>;
615
+ removeFromTransport(transportId: string, objectName: string): AsyncResult<void>;
616
616
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
617
617
  getObjectConfig(): ObjectConfig[];
618
618
  }
package/dist/index.d.ts CHANGED
@@ -520,7 +520,7 @@ interface TransportConfig {
520
520
  */
521
521
 
522
522
  /**
523
- * Object entry to remove from a transport
523
+ * Object entry on a transport
524
524
  */
525
525
  interface TransportObject {
526
526
  /** Object name (e.g., 'ZSNAP_F72TG_103') */
@@ -612,7 +612,7 @@ interface ADTClient {
612
612
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
613
613
  createTransport(config: TransportConfig): AsyncResult<string>;
614
614
  deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
615
- removeFromTransport(transportId: string, object: TransportObject): AsyncResult<void>;
615
+ removeFromTransport(transportId: string, objectName: string): AsyncResult<void>;
616
616
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
617
617
  getObjectConfig(): ObjectConfig[];
618
618
  }
package/dist/index.js CHANGED
@@ -2506,9 +2506,38 @@ async function createTransport(client, config) {
2506
2506
  return ok(transportId);
2507
2507
  }
2508
2508
 
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
+ });
2532
+ }
2533
+ tasks.push({ taskId, objects });
2534
+ }
2535
+ return tasks;
2536
+ }
2537
+
2509
2538
  // src/core/adt/transports/removeFromTransport.ts
2510
2539
  var ACCEPT_HEADER = "application/vnd.sap.adt.transportorganizer.v1+xml";
2511
- async function removeFromTransport(client, transportId, object) {
2540
+ async function removeTransportEntry(client, transportId, object) {
2512
2541
  const body = [
2513
2542
  '<?xml version="1.0" encoding="ASCII"?>',
2514
2543
  `<tm:root xmlns:tm="http://www.sap.com/cts/adt/tm" tm:number="${escapeXml(transportId)}" tm:useraction="removeobject">`,
@@ -2534,36 +2563,32 @@ async function removeFromTransport(client, transportId, object) {
2534
2563
  }
2535
2564
  return ok(void 0);
2536
2565
  }
2566
+ async function removeFromTransport(client, transportId, objectName) {
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}`));
2577
+ }
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}`));
2588
+ }
2537
2589
 
2538
2590
  // src/core/adt/transports/deleteTransport.ts
2539
2591
  var ACCEPT_HEADER2 = "application/vnd.sap.adt.transportorganizer.v1+xml";
2540
- function parseTransportTasks(doc) {
2541
- const tasks = [];
2542
- const taskElements = doc.getElementsByTagName("tm:task");
2543
- for (let i = 0; i < taskElements.length; i++) {
2544
- const taskEl = taskElements[i];
2545
- if (!taskEl) continue;
2546
- const taskId = taskEl.getAttribute("tm:number");
2547
- if (!taskId) continue;
2548
- const objects = [];
2549
- const objectElements = taskEl.getElementsByTagName("tm:abap_object");
2550
- for (let j = 0; j < objectElements.length; j++) {
2551
- const el = objectElements[j];
2552
- if (!el) continue;
2553
- const name = el.getAttribute("tm:name");
2554
- if (!name) continue;
2555
- objects.push({
2556
- name,
2557
- description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
2558
- pgmid: el.getAttribute("tm:pgmid") || "",
2559
- type: el.getAttribute("tm:type") || "",
2560
- position: el.getAttribute("tm:position") || ""
2561
- });
2562
- }
2563
- tasks.push({ taskId, objects });
2564
- }
2565
- return tasks;
2566
- }
2567
2592
  async function sortAndCompress(client, taskId) {
2568
2593
  const [response, requestErr] = await client.request({
2569
2594
  method: "POST",
@@ -2627,7 +2652,7 @@ async function deleteTransport(client, transportId, removeObjects = false) {
2627
2652
  if (!el) continue;
2628
2653
  const name = el.getAttribute("tm:name");
2629
2654
  if (!name) continue;
2630
- const [, removeErr] = await removeFromTransport(client, task.taskId, {
2655
+ const [, removeErr] = await removeTransportEntry(client, task.taskId, {
2631
2656
  name,
2632
2657
  description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
2633
2658
  pgmid: el.getAttribute("tm:pgmid") || "",
@@ -2907,9 +2932,9 @@ async function deleteTransport2(state, requestor, transportId, removeObjects = f
2907
2932
  }
2908
2933
 
2909
2934
  // src/client/methods/transport/removeFromTransport.ts
2910
- async function removeFromTransport2(state, requestor, transportId, object) {
2935
+ async function removeFromTransport2(state, requestor, transportId, objectName) {
2911
2936
  if (!state.session) return err(new Error("Not logged in"));
2912
- return removeFromTransport(requestor, transportId, object);
2937
+ return removeFromTransport(requestor, transportId, objectName);
2913
2938
  }
2914
2939
 
2915
2940
  // src/client/methods/diff/gitDiff.ts
@@ -3291,8 +3316,8 @@ var ADTClientImpl = class {
3291
3316
  async deleteTransport(transportId, removeObjects = false) {
3292
3317
  return deleteTransport2(this.state, this.requestor, transportId, removeObjects);
3293
3318
  }
3294
- async removeFromTransport(transportId, object) {
3295
- return removeFromTransport2(this.state, this.requestor, transportId, object);
3319
+ async removeFromTransport(transportId, objectName) {
3320
+ return removeFromTransport2(this.state, this.requestor, transportId, objectName);
3296
3321
  }
3297
3322
  // --- Diff Operations ---
3298
3323
  async gitDiff(objects) {