Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/fe-mockserver-core

Package Overview
Dependencies
Maintainers
3
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/fe-mockserver-core - npm Package Compare versions

Comparing version 1.2.42 to 1.2.43

42

dist/router/catalogServiceRouter.js

@@ -8,2 +8,3 @@ "use strict";

const router_1 = __importDefault(require("router"));
const url_1 = require("url");
/**

@@ -18,2 +19,43 @@ * Create a service mocking the catalog service from the ABAP backend.

const router = new router_1.default();
router.get('/', (_req, res) => {
const parsedUrl = new url_1.URL(`http://dummy${_req.url}`);
let data;
const serviceUrlPath = '/sap/opu/odata/IWFND/CATALOGSERVICE;v=2';
const allEntitySets = [
'Annotations',
'Vocabularies',
'ServiceCollection',
'ServiceNames',
'TagCollection',
'EntitySetCollection',
'CatalogCollection',
'RecommendedServiceCollection',
'ScopedServiceCollection'
];
if (parsedUrl.searchParams.get('$format') === 'json') {
data = JSON.stringify({
d: { EntitySets: allEntitySets.map((entitySet) => entitySet) }
});
res.setHeader('content-type', 'application/json');
}
else {
data = `<?xml version="1.0" encoding="utf-8"?>
<app:service xml:lang="en" xml:base="${serviceUrlPath}/"
xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<app:workspace>
${allEntitySets
.map((entitySet) => `<atom:collection href="${entitySet}"><atom:title type="text">${entitySet}</atom:title></atom:collection>`)
.join('')}
</app:workspace>
<atom:link rel="self" href="${serviceUrlPath}/"/>
<atom:link rel="latest-version" href="${serviceUrlPath}/"/>
</app:service>`;
res.setHeader('Content-Type', 'application/xml');
}
res.write(data);
res.end();
});
router.get('/ServiceCollection', (_req, res) => {

@@ -20,0 +62,0 @@ res.setHeader('content-type', 'application/json');

53

dist/router/serviceRouter.js

@@ -71,14 +71,43 @@ "use strict";

router.get('/', (_req, res) => {
const data = `<?xml version="1.0" encoding="utf-8"?>
<app:service xml:lang="en" xml:base="${service.urlPath}/"
xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<app:workspace>
</app:workspace>
<atom:link rel="self" href="${service.urlPath}/"/>
<atom:link rel="latest-version" href="${service.urlPath}/"/>
</app:service>`;
res.setHeader('Content-Type', 'application/xml');
const allEntitySets = dataAccess.getMetadata().getEntitySets();
const parsedUrl = new url_1.URL(`http://dummy${_req.url}`);
let data;
if (parsedUrl.searchParams.get('$format') === 'json') {
if (dataAccess.isV4()) {
data = JSON.stringify({
'@odata.context': '$metadata',
'@odata.metadataEtag': service.ETag,
value: allEntitySets.map((entitySet) => {
return {
name: entitySet.name,
kind: entitySet._type,
url: entitySet.name
};
})
});
}
else {
data = JSON.stringify({
d: { EntitySets: allEntitySets.map((entitySet) => entitySet.name) }
});
}
res.setHeader('content-type', 'application/json');
}
else {
data = `<?xml version="1.0" encoding="utf-8"?>
<app:service xml:lang="en" xml:base="${service.urlPath}/"
xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<app:workspace>
${allEntitySets
.map((entitySet) => `<atom:collection href="${entitySet.name}"><atom:title type="text">${entitySet.name}</atom:title><sap:member-title>${entitySet.entityTypeName}</sap:member-title></atom:collection>`)
.join('')}
</app:workspace>
<atom:link rel="self" href="${service.urlPath}/"/>
<atom:link rel="latest-version" href="${service.urlPath}/"/>
</app:service>`;
res.setHeader('Content-Type', 'application/xml');
}
addCSRFTokenIfRequested(_req, res); //GET use case

@@ -85,0 +114,0 @@ res.write(data);

{
"name": "@sap-ux/fe-mockserver-core",
"version": "1.2.42",
"version": "1.2.43",
"description": "SAP Fiori OData - Fiori elements mock server core",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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