@sap-ux/axios-extension
Advanced tools
Comparing version 1.13.1 to 1.14.0
import type { Logger } from '@sap-ux/logger'; | ||
import type { GeneratorEntry } from './types'; | ||
import type { BusinessObject } from '../../types'; | ||
import type { BusinessObject, ValidationResponse } from '../../types'; | ||
import { AdtService } from '../services'; | ||
@@ -19,2 +19,8 @@ /** | ||
/** | ||
* Get the schema of the service binding. | ||
* | ||
* @returns The schema of the service binding. | ||
*/ | ||
getSchema(): Promise<any>; | ||
/** | ||
* Get the content of the service binding. | ||
@@ -27,2 +33,16 @@ * | ||
/** | ||
* Validate the package before generation. | ||
* | ||
* @param pckg - The package to be validated. | ||
* @returns The response of the validation. | ||
*/ | ||
validatePackage(pckg: string): Promise<any>; | ||
/** | ||
* Validate the service content and package before generation. | ||
* | ||
* @param content - The content to be validated. | ||
* @returns The response of the validation. | ||
*/ | ||
validateContent(content: string): Promise<ValidationResponse>; | ||
/** | ||
* Generate the service binding. | ||
@@ -34,9 +54,4 @@ * | ||
*/ | ||
generate(content: string, transport: string): Promise<any>; | ||
/** | ||
* Lock the service binding. The class should be configured with the uri of the service binding | ||
* The uri is returned from the generate method. | ||
*/ | ||
lockServiceBinding(): Promise<void>; | ||
generate(content: string, transport: string): Promise<unknown>; | ||
} | ||
//# sourceMappingURL=ui-service-generator.d.ts.map |
@@ -28,2 +28,20 @@ "use strict"; | ||
/** | ||
* Get the schema of the service binding. | ||
* | ||
* @returns The schema of the service binding. | ||
*/ | ||
getSchema() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield this.get('/schema', { | ||
headers: { | ||
Accept: 'application/vnd.sap.adt.repository.generator.schema.v1+json' | ||
}, | ||
params: { | ||
referencedObject: this.bo.uri | ||
} | ||
}); | ||
return JSON.parse(response.data); | ||
}); | ||
} | ||
/** | ||
* Get the content of the service binding. | ||
@@ -56,41 +74,65 @@ * | ||
/** | ||
* Generate the service binding. | ||
* Validate the package before generation. | ||
* | ||
* @param content - The content of the service binding. | ||
* @param transport - The transport. | ||
* @returns The object references. | ||
* @param pckg - The package to be validated. | ||
* @returns The response of the validation. | ||
*/ | ||
generate(content, transport) { | ||
validatePackage(pckg) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield this.post('', content, { | ||
const response = yield this.get('/validation', { | ||
headers: { | ||
Accept: 'application/vnd.sap.adt.validationMessages.v1+xml' | ||
}, | ||
params: { | ||
referencedObject: this.bo.uri, | ||
package: pckg, | ||
checks: 'package' | ||
} | ||
}); | ||
return this.parseResponse(response.data); | ||
}); | ||
} | ||
/** | ||
* Validate the service content and package before generation. | ||
* | ||
* @param content - The content to be validated. | ||
* @returns The response of the validation. | ||
*/ | ||
validateContent(content) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield this.post('/validation', content, { | ||
headers: { | ||
'Content-Type': 'application/vnd.sap.adt.repository.generator.content.v1+json', | ||
Accept: 'application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage' | ||
Accept: 'application/vnd.sap.adt.validationMessages.v1+xml' | ||
}, | ||
params: { | ||
referencedObject: this.bo.uri, | ||
corrNr: transport | ||
checks: 'package,referencedobject,authorization' | ||
} | ||
}); | ||
// Service binding is in XML format, ready to be used for the subsequent activation and publish. | ||
const data = this.parseResponse(response.data); | ||
return data.objectReferences; | ||
return (_a = data.validationMessages) === null || _a === void 0 ? void 0 : _a.validationMessage; | ||
}); | ||
} | ||
/** | ||
* Lock the service binding. The class should be configured with the uri of the service binding | ||
* The uri is returned from the generate method. | ||
* Generate the service binding. | ||
* | ||
* @param content - The content of the service binding. | ||
* @param transport - The transport. | ||
* @returns The object references. | ||
*/ | ||
lockServiceBinding() { | ||
generate(content, transport) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.post('', '', { | ||
const response = yield this.post('', content, { | ||
headers: { | ||
Accept: 'application/*,application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.lock.result', | ||
'x-sap-adt-sessiontype': 'stateful' | ||
'Content-Type': 'application/vnd.sap.adt.repository.generator.content.v1+json', | ||
Accept: 'application/vnd.sap.adt.repository.generator.v1+json, application/vnd.sap.as+xml;charset=UTF-8;dataname=com.sap.adt.StatusMessage' | ||
}, | ||
params: { | ||
_action: `LOCK`, | ||
accessMode: 'MODIFY' | ||
referencedObject: this.bo.uri, | ||
corrNr: transport | ||
} | ||
}); | ||
return JSON.parse(response.data); | ||
}); | ||
@@ -97,0 +139,0 @@ } |
@@ -40,7 +40,8 @@ "use strict"; | ||
params: { | ||
referencedObject: `/sap/bc/adt/bo/behaviordefinitions/${businessObjectName.toLocaleLowerCase()}` | ||
referencedObject: `/sap/bc/adt/bo/behaviordefinitions/${businessObjectName.toLocaleLowerCase()}`, | ||
type: 'webapi' | ||
} | ||
}); | ||
const data = (_a = this.parseResponse(response.data).feed) === null || _a === void 0 ? void 0 : _a.entry; | ||
if ((data === null || data === void 0 ? void 0 : data.id) === 'ui-service' || (data === null || data === void 0 ? void 0 : data.id) === 'uiservice') { | ||
if ((data === null || data === void 0 ? void 0 : data.id) === 'published-ui-service') { | ||
return data; | ||
@@ -47,0 +48,0 @@ } |
@@ -8,4 +8,3 @@ export { AdtService } from './adt-service'; | ||
export { GeneratorService } from './generator-service'; | ||
export { PublishService } from './publish-service'; | ||
export { BusinessObjectsService } from './businessobjects-service'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BusinessObjectsService = exports.PublishService = exports.GeneratorService = exports.FileStoreService = exports.ListPackageService = exports.TransportRequestService = exports.TransportChecksService = exports.AtoService = exports.AdtService = void 0; | ||
exports.BusinessObjectsService = exports.GeneratorService = exports.FileStoreService = exports.ListPackageService = exports.TransportRequestService = exports.TransportChecksService = exports.AtoService = exports.AdtService = void 0; | ||
var adt_service_1 = require("./adt-service"); | ||
@@ -18,6 +18,4 @@ Object.defineProperty(exports, "AdtService", { enumerable: true, get: function () { return adt_service_1.AdtService; } }); | ||
Object.defineProperty(exports, "GeneratorService", { enumerable: true, get: function () { return generator_service_1.GeneratorService; } }); | ||
var publish_service_1 = require("./publish-service"); | ||
Object.defineProperty(exports, "PublishService", { enumerable: true, get: function () { return publish_service_1.PublishService; } }); | ||
var businessobjects_service_1 = require("./businessobjects-service"); | ||
Object.defineProperty(exports, "BusinessObjectsService", { enumerable: true, get: function () { return businessobjects_service_1.BusinessObjectsService; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -127,2 +127,7 @@ /** | ||
}; | ||
export type ValidationResponse = { | ||
severity: string; | ||
short_text: string; | ||
long_text: string; | ||
}; | ||
//# sourceMappingURL=adt-types.d.ts.map |
{ | ||
"name": "@sap-ux/axios-extension", | ||
"version": "1.13.1", | ||
"version": "1.14.0", | ||
"description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.", | ||
@@ -32,3 +32,3 @@ "repository": { | ||
"supertest": "6.3.3", | ||
"@sap-ux/project-access": "1.21.1" | ||
"@sap-ux/project-access": "1.22.2" | ||
}, | ||
@@ -35,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
271245
91
6170