@contiva/sap-integration-suite-client
Version:
SAP Cloud Platform Integration API Client
57 lines (56 loc) • 2.18 kB
JavaScript
;
/**
* Central configuration for collection endpoints that can contain artifacts
*
* This module provides a centralized list of SAP API collection endpoints
* that may contain artifacts. These endpoints are used by updateArtifactStatus
* to find and update artifacts in collection caches.
*
* @module cache-collections-config
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.COLLECTION_ENDPOINTS = void 0;
exports.getCollectionPatterns = getCollectionPatterns;
exports.getCollectionEndpoints = getCollectionEndpoints;
/**
* Collection endpoint patterns that can contain artifacts
* These patterns are used to find collection cache keys when updating artifact status
*/
exports.COLLECTION_ENDPOINTS = [
'GET:/IntegrationRuntimeArtifacts*', // All deployed artifacts
'GET:/IntegrationPackages*', // All packages
'GET:/IntegrationDesigntimeArtifacts*', // All design-time artifacts
'GET:/MessageMappingDesigntimeArtifacts*', // All message mappings
'GET:/ValueMappingDesigntimeArtifacts*', // All value mappings
'GET:/ScriptCollectionDesigntimeArtifacts*', // All script collections
];
/**
* Generates cache key patterns for collection endpoints with hostname prefix
*
* @param hostname - The SAP hostname to use in the cache key pattern
* @returns Array of cache key patterns (e.g. 'sap:hostname:GET:/IntegrationRuntimeArtifacts*')
*
* @example
* const patterns = getCollectionPatterns('my-tenant.sap-api.com');
* // Returns: [
* // 'sap:my-tenant.sap-api.com:GET:/IntegrationRuntimeArtifacts*',
* // 'sap:my-tenant.sap-api.com:GET:/IntegrationPackages*',
* // ...
* // ]
*/
function getCollectionPatterns(hostname) {
const trimmed = hostname === null || hostname === void 0 ? void 0 : hostname.trim();
if (!trimmed) {
return [];
}
return exports.COLLECTION_ENDPOINTS.map(endpoint => `sap:${trimmed}:${endpoint}`);
}
/**
* Gets the list of collection endpoints (without hostname prefix)
* Useful for documentation or debugging
*
* @returns Array of collection endpoint patterns
*/
function getCollectionEndpoints() {
return exports.COLLECTION_ENDPOINTS;
}