Socket
Socket
Sign inDemoInstall

@sap-ux/axios-extension

Package Overview
Dependencies
Maintainers
3
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/axios-extension - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

3

dist/abap/abap-service-provider.d.ts

@@ -85,5 +85,6 @@ import { ServiceProvider } from '../base/service-provider';

*
* @param alias - optional alias path on which the LREP service is exposed
* @returns an instance of the design time adaptation service.
*/
getLayeredRepository(): LayeredRepositoryService;
getLayeredRepository(alias?: string): LayeredRepositoryService;
/**

@@ -90,0 +91,0 @@ * Retrieve singleton instance of AdtService subclass to serve the specific ADT request query.

@@ -177,9 +177,11 @@ "use strict";

*
* @param alias - optional alias path on which the LREP service is exposed
* @returns an instance of the design time adaptation service.
*/
getLayeredRepository() {
if (!this.services[lrep_service_1.LayeredRepositoryService.PATH]) {
this.services[lrep_service_1.LayeredRepositoryService.PATH] = this.createService(lrep_service_1.LayeredRepositoryService.PATH, lrep_service_1.LayeredRepositoryService);
getLayeredRepository(alias) {
const path = alias !== null && alias !== void 0 ? alias : lrep_service_1.LayeredRepositoryService.PATH;
if (!this.services[path]) {
this.services[path] = this.createService(path, lrep_service_1.LayeredRepositoryService);
}
return this.services[lrep_service_1.LayeredRepositoryService.PATH];
return this.services[path];
}

@@ -186,0 +188,0 @@ /**

@@ -7,2 +7,3 @@ /// <reference types="node" />

import type { ManifestNamespace } from '@sap-ux/project-access';
import type { TransportConfig } from './ui5-abap-repository-service';
export type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile & {

@@ -31,3 +32,3 @@ [key: string]: unknown;

*/
export interface AdaptationConfig {
export interface AdaptationConfig extends TransportConfig {
/**

@@ -38,10 +39,2 @@ * Namespace either as string or object

/**
* Optional ABAP package name
*/
package?: string;
/**
* Optional transport request
*/
transport?: string;
/**
* Optional layer (default: CUSTOMER_BASE)

@@ -90,2 +83,8 @@ */

/**
* Simple request to fetch a CSRF token required for all writing operations.
*
* @returns the response
*/
getCsrfToken(): Promise<AxiosResponse<any, any>>;
/**
* Merge a given app descriptor variant with the stord app descriptor.

@@ -110,12 +109,12 @@ *

*
* @param archivePath path to a zip archive containing the adaptation project
* @param archive path to a zip archive or archive as buffer containing the adaptation project
* @param config adataption project deployment configuration
* @returns the Axios response object for futher processing
*/
deploy(archivePath: string, config: AdaptationConfig): Promise<AxiosResponse>;
deploy(archive: Buffer | string, config: AdaptationConfig): Promise<AxiosResponse>;
/**
* Undeploy the archive identified by the configuration.
*
* @param config adataption project deployment configuration
* @returns the Axios response object for futher processing
* @param config adaptation project deployment configuration
* @returns the Axios response object for further processing
*/

@@ -122,0 +121,0 @@ undeploy(config: AdaptationConfig): Promise<AxiosResponse>;

@@ -27,2 +27,11 @@ "use strict";

/**
* Check if a variable is a buffer.
*
* @param input variable to be checked
* @returns true if the input is a buffer
*/
function isBuffer(input) {
return input.BYTES_PER_ELEMENT !== undefined;
}
/**
* Path suffix for all DTA actions.

@@ -36,2 +45,20 @@ */

/**
* Simple request to fetch a CSRF token required for all writing operations.
*
* @returns the response
*/
getCsrfToken() {
return __awaiter(this, void 0, void 0, function* () {
try {
return yield this.get('/actions/getcsrftoken/');
}
catch (error) {
if ((0, odata_request_error_1.isAxiosError)(error)) {
this.tryLogResponse(error.response);
}
throw error;
}
});
}
/**
* Merge a given app descriptor variant with the stord app descriptor.

@@ -95,10 +122,10 @@ *

*
* @param archivePath path to a zip archive containing the adaptation project
* @param archive path to a zip archive or archive as buffer containing the adaptation project
* @param config adataption project deployment configuration
* @returns the Axios response object for futher processing
*/
deploy(archivePath, config) {
deploy(archive, config) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const archive = (0, fs_1.readFileSync)(archivePath);
const data = isBuffer(archive) ? archive : (0, fs_1.readFileSync)(archive);
const checkResponse = yield this.isExistingVariant(config.namespace);

@@ -116,3 +143,3 @@ const params = {

url: DTA_PATH_SUFFIX,
data: archive,
data,
params,

@@ -130,7 +157,7 @@ headers: {

*
* @param config adataption project deployment configuration
* @returns the Axios response object for futher processing
* @param config adaptation project deployment configuration
* @returns the Axios response object for further processing
*/
undeploy(config) {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {

@@ -148,5 +175,15 @@ const checkResponse = yield this.isExistingVariant(config.namespace);

}
const response = yield this.delete(DTA_PATH_SUFFIX, { params });
this.tryLogResponse(response, 'Undeployment successful.');
return response;
try {
const response = yield this.delete(DTA_PATH_SUFFIX, { params });
this.tryLogResponse(response, 'Undeployment successful.');
return response;
}
catch (error) {
this.log.error('Undeployment failed');
this.log.debug(error);
if ((0, odata_request_error_1.isAxiosError)(error) && ((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 405) {
this.log.error('Newer version of SAP_UI required, please check https://help.sap.com/docs/bas/developing-sap-fiori-app-in-sap-business-application-studio/delete-adaptation-project');
}
throw error;
}
});

@@ -153,0 +190,0 @@ }

@@ -6,5 +6,18 @@ /// <reference types="node" />

/**
* Required configuration a transportable object.
*/
export interface TransportConfig {
/**
* Optional package for the ABAP development object
*/
package?: string;
/**
* Optional transport request to record the changes
*/
transport?: string;
}
/**
* Required configuration for the BSP hosting an app.
*/
export interface BspConfig {
export interface BspConfig extends TransportConfig {
/**

@@ -18,10 +31,2 @@ * Name of the BSP, additionally, the last part of the exposed service path

description?: string;
/**
* Optional package for the ABAP development object
*/
package?: string;
/**
* Optional transport request to record the changes
*/
transport?: string;
}

@@ -89,2 +94,9 @@ /**

/**
* Get the application files as zip archive. This will only work on ABAP systems 2308 or newer.
*
* @param app application id (BSP application name)
* @returns undefined if no app is found or downloading files is not supported, otherwise return the application files as a buffer.
*/
downloadFiles(app: string): Promise<Buffer>;
/**
* Deploy the given archive either by creating a new BSP or updating an existing one.

@@ -91,0 +103,0 @@ *

@@ -79,2 +79,30 @@ "use strict";

/**
* Get the application files as zip archive. This will only work on ABAP systems 2308 or newer.
*
* @param app application id (BSP application name)
* @returns undefined if no app is found or downloading files is not supported, otherwise return the application files as a buffer.
*/
downloadFiles(app) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
try {
const response = yield this.get(`/Repositories('${encodeURIComponent(app)}')`, {
params: {
CodePage: 'UTF8',
DownloadFiles: 'RUNTIME'
}
});
const data = response.odata();
return data.ZipArchive ? Buffer.from(data.ZipArchive) : undefined;
}
catch (error) {
this.log.debug(`Retrieving application ${app}, ${error}`);
if ((0, odata_request_error_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
return undefined;
}
throw error;
}
});
}
/**
* Deploy the given archive either by creating a new BSP or updating an existing one.

@@ -81,0 +109,0 @@ *

{
"name": "@sap-ux/axios-extension",
"version": "1.6.1",
"version": "1.7.0",
"description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc