@sap-ux/axios-extension
Advanced tools
Comparing version 1.3.6 to 1.4.0
export { AppInfo, BspConfig, DeployConfig, Ui5AbapRepositoryService, UndeployConfig } from './ui5-abap-repository-service'; | ||
export { LayeredRepositoryService, AdaptationConfig } from './lrep-service'; | ||
export { LayeredRepositoryService, AdaptationConfig, MergedAppDescriptor } from './lrep-service'; | ||
export { AbapServiceProvider } from './abap-service-provider'; | ||
@@ -4,0 +4,0 @@ export { AppIndex, AppIndexService } from './app-index-service'; |
@@ -0,1 +1,3 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { Service } from '../base/service-provider'; | ||
@@ -5,2 +7,6 @@ import type { AxiosResponse } from 'axios'; | ||
import type { Logger } from '@sap-ux/logger'; | ||
import type { ManifestNamespace } from '@sap-ux/project-access'; | ||
export type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile & { | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
@@ -39,4 +45,26 @@ * Object structure representing a namespace: containing an id (variant id) and a reference (base application id). | ||
transport?: string; | ||
/** | ||
* Optional layer (default: CUSTOMER_BASE) | ||
*/ | ||
layer?: Layer; | ||
} | ||
/** | ||
* Resulting structure after merging an app descriptor variant with the original app descriptor. | ||
*/ | ||
export interface MergedAppDescriptor { | ||
name: string; | ||
url: string; | ||
manifest: Manifest; | ||
asyncHints: { | ||
libs: { | ||
name: string; | ||
lazy?: boolean; | ||
url?: { | ||
url: string; | ||
final: boolean; | ||
}; | ||
}[]; | ||
}; | ||
} | ||
/** | ||
* Structure of the result message. | ||
@@ -52,4 +80,8 @@ */ | ||
/** | ||
* A class respresenting the design time adaptation service allowing to deploy adaptation projects to an ABAP system. | ||
* Technically supported layers, however, in practice only `CUSTOMER_BASE` is used | ||
*/ | ||
type Layer = 'VENDOR' | 'CUSTOMER_BASE'; | ||
/** | ||
* A class representing the design time adaptation service allowing to deploy adaptation projects to an ABAP system. | ||
*/ | ||
export declare class LayeredRepositoryService extends Axios implements Service { | ||
@@ -59,8 +91,18 @@ static readonly PATH = "/sap/bc/lrep"; | ||
/** | ||
* Merge a given app descriptor variant with the stord app descriptor. | ||
* | ||
* @param appDescriptorVariant zip file containing an app descriptor variant | ||
* @returns a promise with an object containing merged app descriptors with their id as keys. | ||
*/ | ||
mergeAppDescriptorVariant(appDescriptorVariant: Buffer): Promise<{ | ||
[key: string]: MergedAppDescriptor; | ||
}>; | ||
/** | ||
* Check whether a variant with the given namespace already exists. | ||
* | ||
* @param namespace either as string or as object | ||
* @returns the Axios response object for futher processing | ||
* @param [layer] optional layer | ||
* @returns the Axios response object for further processing | ||
*/ | ||
isExistingVariant(namespace: Namespace): Promise<AxiosResponse>; | ||
isExistingVariant(namespace: Namespace, layer?: Layer): Promise<AxiosResponse>; | ||
/** | ||
@@ -95,2 +137,3 @@ * Deploy the given archive either by creating a new folder in the layered repository or updating an existing one. | ||
} | ||
export {}; | ||
//# sourceMappingURL=lrep-service.d.ts.map |
@@ -31,12 +31,37 @@ "use strict"; | ||
/** | ||
* A class respresenting the design time adaptation service allowing to deploy adaptation projects to an ABAP system. | ||
* A class representing the design time adaptation service allowing to deploy adaptation projects to an ABAP system. | ||
*/ | ||
class LayeredRepositoryService extends axios_1.Axios { | ||
/** | ||
* Merge a given app descriptor variant with the stord app descriptor. | ||
* | ||
* @param appDescriptorVariant zip file containing an app descriptor variant | ||
* @returns a promise with an object containing merged app descriptors with their id as keys. | ||
*/ | ||
mergeAppDescriptorVariant(appDescriptorVariant) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const response = yield this.put('/appdescr_variant_preview/', appDescriptorVariant, { | ||
headers: { | ||
'Content-Type': 'application/zip' | ||
} | ||
}); | ||
return JSON.parse(response.data); | ||
} | ||
catch (error) { | ||
if ((0, odata_request_error_1.isAxiosError)(error)) { | ||
this.tryLogResponse(error.response); | ||
} | ||
throw error; | ||
} | ||
}); | ||
} | ||
/** | ||
* Check whether a variant with the given namespace already exists. | ||
* | ||
* @param namespace either as string or as object | ||
* @returns the Axios response object for futher processing | ||
* @param [layer] optional layer | ||
* @returns the Axios response object for further processing | ||
*/ | ||
isExistingVariant(namespace) { | ||
isExistingVariant(namespace, layer = 'CUSTOMER_BASE') { | ||
var _a; | ||
@@ -48,3 +73,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
name: getNamespaceAsString(namespace), | ||
layer: 'CUSTOMER_BASE', | ||
layer, | ||
timestamp: Date.now() | ||
@@ -57,8 +82,9 @@ } | ||
catch (error) { | ||
if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) { | ||
return error.response; | ||
if ((0, odata_request_error_1.isAxiosError)(error)) { | ||
this.tryLogResponse(error.response); | ||
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) { | ||
return error.response; | ||
} | ||
} | ||
else { | ||
throw error; | ||
} | ||
throw error; | ||
} | ||
@@ -75,3 +101,3 @@ }); | ||
deploy(archivePath, config) { | ||
var _a; | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -82,5 +108,5 @@ const archive = (0, fs_1.readFileSync)(archivePath); | ||
name: getNamespaceAsString(config.namespace), | ||
layer: 'CUSTOMER_BASE' | ||
layer: (_a = config.layer) !== null && _a !== void 0 ? _a : 'CUSTOMER_BASE' | ||
}; | ||
params['package'] = (_a = config.package) !== null && _a !== void 0 ? _a : '$TMP'; | ||
params['package'] = (_b = config.package) !== null && _b !== void 0 ? _b : '$TMP'; | ||
if (params['package'].toUpperCase() !== '$TMP') { | ||
@@ -109,2 +135,3 @@ params['changelist'] = config.transport; | ||
undeploy(config) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -117,3 +144,3 @@ const checkResponse = yield this.isExistingVariant(config.namespace); | ||
name: getNamespaceAsString(config.namespace), | ||
layer: 'CUSTOMER_BASE' | ||
layer: (_a = config.layer) !== null && _a !== void 0 ? _a : 'CUSTOMER_BASE' | ||
}; | ||
@@ -120,0 +147,0 @@ if (config.transport) { |
{ | ||
"name": "@sap-ux/axios-extension", | ||
"version": "1.3.6", | ||
"version": "1.4.0", | ||
"description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.", | ||
@@ -31,3 +31,4 @@ "repository": { | ||
"nock": "13.2.1", | ||
"supertest": "6.3.2" | ||
"supertest": "6.3.2", | ||
"@sap-ux/project-access": "1.10.1" | ||
}, | ||
@@ -34,0 +35,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234944
5307
4