catalyst-relay 0.5.3 → 0.5.5

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
@@ -468,11 +468,24 @@ interface DistinctResult {
468
468
  */
469
469
  interface SearchResult {
470
470
  name: string;
471
+ uri: string;
471
472
  extension: string;
472
473
  package: string;
473
474
  description?: string;
474
475
  objectType: string;
475
476
  }
477
+ /**
478
+ * Search for objects by name pattern
479
+ *
480
+ * @param client - ADT client
481
+ * @param query - Search pattern (supports wildcards)
482
+ * @param types - Optional array of object type filters
483
+ * @returns Array of matching objects or error
484
+ */
485
+ interface SearchOptions {
486
+ types?: string[];
487
+ includePackages?: boolean;
488
+ }
476
489
 
477
490
  /**
478
491
  * Where-Used — Find object dependencies
@@ -575,7 +588,7 @@ interface ADTClient {
575
588
  previewData(query: PreviewSQL): AsyncResult<DataFrame>;
576
589
  getDistinctValues(objectName: string, parameters: Parameter[], column: string, objectType?: 'table' | 'view'): AsyncResult<DistinctResult>;
577
590
  countRows(objectName: string, objectType: 'table' | 'view', parameters?: Parameter[]): AsyncResult<number>;
578
- search(query: string, types?: string[]): AsyncResult<SearchResult[]>;
591
+ search(query: string, options?: SearchOptions): AsyncResult<SearchResult[]>;
579
592
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
580
593
  createTransport(config: TransportConfig): AsyncResult<string>;
581
594
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
@@ -604,4 +617,4 @@ declare function activateLogging(): void;
604
617
  */
605
618
  declare function deactivateLogging(): void;
606
619
 
607
- 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -468,11 +468,24 @@ interface DistinctResult {
468
468
  */
469
469
  interface SearchResult {
470
470
  name: string;
471
+ uri: string;
471
472
  extension: string;
472
473
  package: string;
473
474
  description?: string;
474
475
  objectType: string;
475
476
  }
477
+ /**
478
+ * Search for objects by name pattern
479
+ *
480
+ * @param client - ADT client
481
+ * @param query - Search pattern (supports wildcards)
482
+ * @param types - Optional array of object type filters
483
+ * @returns Array of matching objects or error
484
+ */
485
+ interface SearchOptions {
486
+ types?: string[];
487
+ includePackages?: boolean;
488
+ }
476
489
 
477
490
  /**
478
491
  * Where-Used — Find object dependencies
@@ -575,7 +588,7 @@ interface ADTClient {
575
588
  previewData(query: PreviewSQL): AsyncResult<DataFrame>;
576
589
  getDistinctValues(objectName: string, parameters: Parameter[], column: string, objectType?: 'table' | 'view'): AsyncResult<DistinctResult>;
577
590
  countRows(objectName: string, objectType: 'table' | 'view', parameters?: Parameter[]): AsyncResult<number>;
578
- search(query: string, types?: string[]): AsyncResult<SearchResult[]>;
591
+ search(query: string, options?: SearchOptions): AsyncResult<SearchResult[]>;
579
592
  whereUsed(object: ObjectRef): AsyncResult<Dependency[]>;
580
593
  createTransport(config: TransportConfig): AsyncResult<string>;
581
594
  gitDiff(objects: ObjectContent[]): AsyncResult<DiffResult[]>;
@@ -604,4 +617,4 @@ declare function activateLogging(): void;
604
617
  */
605
618
  declare function deactivateLogging(): void;
606
619
 
607
- 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 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 };
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 };
package/dist/index.js CHANGED
@@ -2310,7 +2310,8 @@ async function countRows(client, objectName, _objectType, parameters = []) {
2310
2310
  }
2311
2311
 
2312
2312
  // src/core/adt/discovery/searchObjects.ts
2313
- async function searchObjects(client, query, types) {
2313
+ async function searchObjects(client, query, options) {
2314
+ const { types, includePackages = true } = options ?? {};
2314
2315
  const searchPattern = query || "*";
2315
2316
  const objectTypes = types && types.length > 0 ? types : getAllTypes();
2316
2317
  const params = [
@@ -2342,8 +2343,30 @@ async function searchObjects(client, query, types) {
2342
2343
  if (parseErr) {
2343
2344
  return err(parseErr);
2344
2345
  }
2346
+ if (includePackages) await enrichWithPackages(client, results);
2345
2347
  return ok(results);
2346
2348
  }
2349
+ async function enrichWithPackages(client, results) {
2350
+ const needsPackage = results.filter((r) => !r.package);
2351
+ if (needsPackage.length === 0) return;
2352
+ const promises = needsPackage.map(async (result) => {
2353
+ const encodedUri = encodeURIComponent(result.uri);
2354
+ const [response, reqErr] = await client.request({
2355
+ method: "GET",
2356
+ path: `/sap/bc/adt/repository/informationsystem/objectproperties/values?uri=${encodedUri}&facet=package`
2357
+ });
2358
+ if (reqErr || !response.ok) return;
2359
+ const text = await response.text();
2360
+ const [doc, parseErr] = safeParseXml(text);
2361
+ if (parseErr) return;
2362
+ const oprNs = "http://www.sap.com/adt/ris/objectProperties";
2363
+ const objEl = doc.getElementsByTagNameNS(oprNs, "object")[0];
2364
+ if (!objEl) return;
2365
+ const pkg = objEl.getAttribute("package");
2366
+ if (pkg) result.package = pkg;
2367
+ });
2368
+ await Promise.all(promises);
2369
+ }
2347
2370
  function parseSearchResults(xml) {
2348
2371
  const [doc, parseErr] = safeParseXml(xml);
2349
2372
  if (parseErr) {
@@ -2356,14 +2379,16 @@ function parseSearchResults(xml) {
2356
2379
  if (!obj) continue;
2357
2380
  const name = obj.getAttributeNS("http://www.sap.com/adt/core", "name") || obj.getAttribute("adtcore:name");
2358
2381
  const type = obj.getAttributeNS("http://www.sap.com/adt/core", "type") || obj.getAttribute("adtcore:type");
2382
+ const uri = obj.getAttributeNS("http://www.sap.com/adt/core", "uri") || obj.getAttribute("adtcore:uri");
2359
2383
  const description = obj.getAttributeNS("http://www.sap.com/adt/core", "description") || obj.getAttribute("adtcore:description");
2360
- if (!name || !type) continue;
2384
+ if (!name || !type || !uri) continue;
2361
2385
  const config = getConfigByType(type);
2362
2386
  if (!config) continue;
2363
2387
  const packageRef = obj.getElementsByTagNameNS("http://www.sap.com/adt/core", "packageRef")[0];
2364
2388
  const packageName = packageRef ? packageRef.getAttributeNS("http://www.sap.com/adt/core", "name") || packageRef.getAttribute("adtcore:name") : "";
2365
2389
  const result = {
2366
2390
  name,
2391
+ uri,
2367
2392
  extension: config.extension,
2368
2393
  package: packageName || "",
2369
2394
  objectType: config.label
@@ -2721,9 +2746,9 @@ async function countRows2(state, requestor, objectName, objectType, parameters =
2721
2746
  }
2722
2747
 
2723
2748
  // src/client/methods/search/search.ts
2724
- async function search(state, requestor, query, types) {
2749
+ async function search(state, requestor, query, options) {
2725
2750
  if (!state.session) return err(new Error("Not logged in"));
2726
- return searchObjects(requestor, query, types);
2751
+ return searchObjects(requestor, query, options);
2727
2752
  }
2728
2753
 
2729
2754
  // src/client/methods/search/whereUsed.ts
@@ -3104,8 +3129,8 @@ var ADTClientImpl = class {
3104
3129
  return countRows2(this.state, this.requestor, objectName, objectType, parameters);
3105
3130
  }
3106
3131
  // --- Search ---
3107
- async search(query, types) {
3108
- return search(this.state, this.requestor, query, types);
3132
+ async search(query, options) {
3133
+ return search(this.state, this.requestor, query, options);
3109
3134
  }
3110
3135
  async whereUsed(object) {
3111
3136
  return whereUsed(this.state, this.requestor, object);