catalyst-relay 0.5.5 → 0.5.6

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
@@ -515,6 +515,26 @@ interface TransportConfig {
515
515
  description: string;
516
516
  }
517
517
 
518
+ /**
519
+ * Remove From Transport — Remove an object from a transport request
520
+ */
521
+
522
+ /**
523
+ * Object entry to remove from a transport
524
+ */
525
+ interface TransportObject {
526
+ /** Object name (e.g., 'ZSNAP_F72TG_103') */
527
+ name: string;
528
+ /** Object description */
529
+ description: string;
530
+ /** Program ID (e.g., 'R3TR') */
531
+ pgmid: string;
532
+ /** Object type (e.g., 'DDLS') */
533
+ type: string;
534
+ /** Position in the transport (e.g., '000002') */
535
+ position: string;
536
+ }
537
+
518
538
  /**
519
539
  * Git Diff — Compare local content with server content
520
540
  *
@@ -591,6 +611,8 @@ interface ADTClient {
591
611
  search(query: string, options?: SearchOptions): AsyncResult<SearchResult[]>;
592
612
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
593
613
  createTransport(config: TransportConfig): AsyncResult<string>;
614
+ deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
615
+ removeFromTransport(transportId: string, object: TransportObject): AsyncResult<void>;
594
616
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
595
617
  getObjectConfig(): ObjectConfig[];
596
618
  }
@@ -617,4 +639,4 @@ declare function activateLogging(): void;
617
639
  */
618
640
  declare function deactivateLogging(): void;
619
641
 
620
- 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 TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
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 };
package/dist/index.d.ts CHANGED
@@ -515,6 +515,26 @@ interface TransportConfig {
515
515
  description: string;
516
516
  }
517
517
 
518
+ /**
519
+ * Remove From Transport — Remove an object from a transport request
520
+ */
521
+
522
+ /**
523
+ * Object entry to remove from a transport
524
+ */
525
+ interface TransportObject {
526
+ /** Object name (e.g., 'ZSNAP_F72TG_103') */
527
+ name: string;
528
+ /** Object description */
529
+ description: string;
530
+ /** Program ID (e.g., 'R3TR') */
531
+ pgmid: string;
532
+ /** Object type (e.g., 'DDLS') */
533
+ type: string;
534
+ /** Position in the transport (e.g., '000002') */
535
+ position: string;
536
+ }
537
+
518
538
  /**
519
539
  * Git Diff — Compare local content with server content
520
540
  *
@@ -591,6 +611,8 @@ interface ADTClient {
591
611
  search(query: string, options?: SearchOptions): AsyncResult<SearchResult[]>;
592
612
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
593
613
  createTransport(config: TransportConfig): AsyncResult<string>;
614
+ deleteTransport(transportId: string, removeObjects?: boolean): AsyncResult<void>;
615
+ removeFromTransport(transportId: string, object: TransportObject): AsyncResult<void>;
594
616
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
595
617
  getObjectConfig(): ObjectConfig[];
596
618
  }
@@ -617,4 +639,4 @@ declare function activateLogging(): void;
617
639
  */
618
640
  declare function deactivateLogging(): void;
619
641
 
620
- 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 TreeQuery, type TreeResponse, type UpsertResult, activateLogging, buildSQLQuery, createClient, deactivateLogging, err, ok };
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 };
package/dist/index.js CHANGED
@@ -2506,6 +2506,143 @@ async function createTransport(client, config) {
2506
2506
  return ok(transportId);
2507
2507
  }
2508
2508
 
2509
+ // src/core/adt/transports/removeFromTransport.ts
2510
+ var ACCEPT_HEADER = "application/vnd.sap.adt.transportorganizer.v1+xml";
2511
+ async function removeFromTransport(client, transportId, object) {
2512
+ const body = [
2513
+ '<?xml version="1.0" encoding="ASCII"?>',
2514
+ `<tm:root xmlns:tm="http://www.sap.com/cts/adt/tm" tm:number="${escapeXml(transportId)}" tm:useraction="removeobject">`,
2515
+ " <tm:request>",
2516
+ ` <tm:abap_object tm:name="${escapeXml(object.name)}" tm:obj_desc="${escapeXml(object.description)}" tm:pgmid="${escapeXml(object.pgmid)}" tm:type="${escapeXml(object.type)}" tm:position="${escapeXml(object.position)}"/>`,
2517
+ " </tm:request>",
2518
+ "</tm:root>"
2519
+ ].join("\n");
2520
+ const [response, requestErr] = await client.request({
2521
+ method: "PUT",
2522
+ path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
2523
+ headers: {
2524
+ "Accept": ACCEPT_HEADER,
2525
+ "Content-Type": "text/plain"
2526
+ },
2527
+ body
2528
+ });
2529
+ if (requestErr) return err(requestErr);
2530
+ if (!response.ok) {
2531
+ const text = await response.text();
2532
+ const errorMsg = extractError(text);
2533
+ return err(new Error(`Failed to remove ${object.name} from transport ${transportId}: ${errorMsg}`));
2534
+ }
2535
+ return ok(void 0);
2536
+ }
2537
+
2538
+ // src/core/adt/transports/deleteTransport.ts
2539
+ 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
+ async function sortAndCompress(client, taskId) {
2568
+ const [response, requestErr] = await client.request({
2569
+ method: "POST",
2570
+ path: `/sap/bc/adt/cts/transportrequests/${taskId}/sortandcompress`,
2571
+ headers: { "Accept": ACCEPT_HEADER2 }
2572
+ });
2573
+ if (requestErr) return err(requestErr);
2574
+ if (!response.ok) {
2575
+ const text = await response.text();
2576
+ const errorMsg = extractError(text);
2577
+ return err(new Error(`Failed to sort and compress task ${taskId}: ${errorMsg}`));
2578
+ }
2579
+ return ok(void 0);
2580
+ }
2581
+ async function deleteRequest(client, id) {
2582
+ const [response, requestErr] = await client.request({
2583
+ method: "DELETE",
2584
+ path: `/sap/bc/adt/cts/transportrequests/${id}`,
2585
+ headers: { "Accept": ACCEPT_HEADER2 }
2586
+ });
2587
+ if (requestErr) return err(requestErr);
2588
+ if (!response.ok) {
2589
+ const text = await response.text();
2590
+ const errorMsg = extractError(text);
2591
+ return err(new Error(`Failed to delete ${id}: ${errorMsg}`));
2592
+ }
2593
+ return ok(void 0);
2594
+ }
2595
+ async function deleteTransport(client, transportId, removeObjects = false) {
2596
+ const [response, requestErr] = await client.request({
2597
+ method: "GET",
2598
+ path: `/sap/bc/adt/cts/transportrequests/${transportId}`,
2599
+ headers: { "Accept": ACCEPT_HEADER2 }
2600
+ });
2601
+ if (requestErr) return err(requestErr);
2602
+ if (!response.ok) {
2603
+ const text2 = await response.text();
2604
+ const errorMsg = extractError(text2);
2605
+ return err(new Error(`Failed to read transport ${transportId}: ${errorMsg}`));
2606
+ }
2607
+ const text = await response.text();
2608
+ const [doc, parseErr] = safeParseXml(text);
2609
+ if (parseErr) return err(parseErr);
2610
+ const tasks = parseTransportTasks(doc);
2611
+ for (const task of tasks) {
2612
+ if (removeObjects && task.objects.length > 0) {
2613
+ const [, compressErr] = await sortAndCompress(client, task.taskId);
2614
+ if (compressErr) return err(compressErr);
2615
+ const [taskResponse, taskReadErr] = await client.request({
2616
+ method: "GET",
2617
+ path: `/sap/bc/adt/cts/transportrequests/${task.taskId}`,
2618
+ headers: { "Accept": ACCEPT_HEADER2 }
2619
+ });
2620
+ if (taskReadErr) return err(taskReadErr);
2621
+ const taskText = await taskResponse.text();
2622
+ const [taskDoc, taskParseErr] = safeParseXml(taskText);
2623
+ if (taskParseErr) return err(taskParseErr);
2624
+ const elements = taskDoc.getElementsByTagName("tm:abap_object");
2625
+ for (let i = 0; i < elements.length; i++) {
2626
+ const el = elements[i];
2627
+ if (!el) continue;
2628
+ const name = el.getAttribute("tm:name");
2629
+ if (!name) continue;
2630
+ const [, removeErr] = await removeFromTransport(client, task.taskId, {
2631
+ name,
2632
+ description: el.getAttribute("tm:obj_desc") || el.getAttribute("tm:obj_info") || "",
2633
+ pgmid: el.getAttribute("tm:pgmid") || "",
2634
+ type: el.getAttribute("tm:type") || "",
2635
+ position: el.getAttribute("tm:position") || ""
2636
+ });
2637
+ if (removeErr) return err(removeErr);
2638
+ }
2639
+ }
2640
+ const [, taskErr] = await deleteRequest(client, task.taskId);
2641
+ if (taskErr) return err(taskErr);
2642
+ }
2643
+ return deleteRequest(client, transportId);
2644
+ }
2645
+
2509
2646
  // src/core/adt/craud/gitDiff.ts
2510
2647
  var import_diff = require("diff");
2511
2648
  function computeDiff(serverLines, localLines) {
@@ -2763,6 +2900,18 @@ async function createTransport2(state, requestor, transportConfig) {
2763
2900
  return createTransport(requestor, transportConfig);
2764
2901
  }
2765
2902
 
2903
+ // src/client/methods/transport/deleteTransport.ts
2904
+ async function deleteTransport2(state, requestor, transportId, removeObjects = false) {
2905
+ if (!state.session) return err(new Error("Not logged in"));
2906
+ return deleteTransport(requestor, transportId, removeObjects);
2907
+ }
2908
+
2909
+ // src/client/methods/transport/removeFromTransport.ts
2910
+ async function removeFromTransport2(state, requestor, transportId, object) {
2911
+ if (!state.session) return err(new Error("Not logged in"));
2912
+ return removeFromTransport(requestor, transportId, object);
2913
+ }
2914
+
2766
2915
  // src/client/methods/diff/gitDiff.ts
2767
2916
  async function gitDiff2(state, requestor, objects) {
2768
2917
  if (!state.session) return err(new Error("Not logged in"));
@@ -3139,6 +3288,12 @@ var ADTClientImpl = class {
3139
3288
  async createTransport(transportConfig) {
3140
3289
  return createTransport2(this.state, this.requestor, transportConfig);
3141
3290
  }
3291
+ async deleteTransport(transportId, removeObjects = false) {
3292
+ return deleteTransport2(this.state, this.requestor, transportId, removeObjects);
3293
+ }
3294
+ async removeFromTransport(transportId, object) {
3295
+ return removeFromTransport2(this.state, this.requestor, transportId, object);
3296
+ }
3142
3297
  // --- Diff Operations ---
3143
3298
  async gitDiff(objects) {
3144
3299
  return gitDiff2(this.state, this.requestor, objects);