New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sap/ux-cds-compiler-facade

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/ux-cds-compiler-facade - npm Package Compare versions

Comparing version

to
1.12.2

2

dist/cdsDocument.d.ts
import type { XsnCompileModel } from '@sap/cds-compiler';
import type { Annotation, Assignment, Node, Path, StringLiteral, Token } from '@sap/ux-cds-annotation-parser';
import type { Annotation, Assignment, Node, Path, StringLiteral, Token } from '@sap-ux/cds-annotation-parser';
import type { Namespace } from '@sap-ux/odata-annotation-core-types';

@@ -4,0 +4,0 @@ export interface AnnotateDirective extends Node {

import type { ICdsCompiler, XsnArtifact, XsnElement, XsnFinalEffectiveType, XsnNamedObject, XsnObject, XsnOriginatedObject, XsnDependency, XsnUsing, XsnNamespace } from '@sap/cds-compiler';
import type { MetadataElement } from '@sap/ux-metadata';
import type { MetadataElement } from '@sap-ux/odata-annotation-core-types';
import type { Reference, Namespace } from '@sap-ux/odata-annotation-core';

@@ -26,2 +26,9 @@ import type { CdsCompilerFacade } from '../facade';

private setStructuredType;
/**
* Get OData target kinds for a metadata element.
*
* @param metadata element.
* @returns OData target kinds.
*/
private getEdmTargetKinds;
private buildNode;

@@ -28,0 +35,0 @@ private getNamespace;

@@ -56,2 +56,18 @@ "use strict";

};
// OData conform target kinds for CDS kinds
const targetKindsCds = {
service: ["EntityContainer" /* Edm.EntityContainer */],
entitySet: ["EntitySet" /* Edm.EntitySet */],
entity: ["EntityType" /* Edm.EntityType */, "EntitySet" /* Edm.EntitySet */],
view: ["EntityType" /* Edm.EntityType */, "EntitySet" /* Edm.EntitySet */],
aspect: ["ComplexType" /* Edm.ComplexType */, "EntityType" /* Edm.EntityType */, "EntitySet" /* Edm.EntitySet */],
element: ["Property" /* Edm.Property */],
action: ["Action" /* Edm.Action */, "ActionImport" /* Edm.ActionImport */],
function: ["Function" /* Edm.Function */, "FunctionImport" /* Edm.FunctionImport */],
actionImport: ["Action" /* Edm.Action */],
functionImport: ["FunctionImport" /* Edm.FunctionImport */],
param: ["Parameter" /* Edm.Parameter */],
type: ["TypeDefinition" /* Edm.TypeDefinition */, "Property" /* Edm.Property */, "Parameter" /* Edm.Parameter */]
};
const targetKindsMapCds = new Map(Object.entries(targetKindsCds));
class Converter {

@@ -103,2 +119,5 @@ constructor(compiler, facade) {

}
if (result) {
result.targetKinds = this.getEdmTargetKinds(result);
}
return result;

@@ -124,2 +143,3 @@ };

}
elementNode.targetKinds = this.getEdmTargetKinds(elementNode);
elements.push(...this.collectElementsFromStructuredType(typeArtifact, elementNode, elementName, parentPath));

@@ -133,3 +153,5 @@ elements.push(elementNode);

const boundActionName = this.getNamespace(entityName) + '.' + actionName + this.getActionNodeSignature(action, entityName);
return this.buildNode(action.kind, boundActionName, undefined, this.getOrigin(action));
const actionNode = this.buildNode(action.kind, boundActionName, undefined, this.getOrigin(action));
actionNode.targetKinds = this.getEdmTargetKinds(actionNode);
return actionNode;
};

@@ -145,2 +167,3 @@ this.convertParameter = (paramName, parentPath, parameter) => {

}
paramNode.targetKinds = this.getEdmTargetKinds(paramNode);
return paramNode;

@@ -176,2 +199,3 @@ };

bindingParamNode.structuredType = this.convertNameToEdmx(namedObj.absolute);
bindingParamNode.targetKinds = this.getEdmTargetKinds(bindingParamNode);
return bindingParamNode;

@@ -191,2 +215,3 @@ };

}
returnParamNode.targetKinds = this.getEdmTargetKinds(returnParamNode);
return returnParamNode;

@@ -197,3 +222,5 @@ };

origin.name += '.' + propName;
return this.buildNode('element', propName, parentPath, origin, 'Edm.Boolean');
const draftPropNode = this.buildNode('element', propName, parentPath, origin, 'Edm.Boolean');
draftPropNode.targetKinds = this.getEdmTargetKinds(draftPropNode);
return draftPropNode;
};

@@ -208,2 +235,3 @@ this.convertEntitySetNode = (entitySetName, parentPath, entity) => {

entitySetNode.structuredType = this.convertNameToEdmx(namedObj.absolute);
entitySetNode.targetKinds = this.getEdmTargetKinds(entitySetNode);
return entitySetNode;

@@ -215,2 +243,3 @@ };

actionFunctionImportNode.structuredType = actionOrFunctionFqName;
actionFunctionImportNode.targetKinds = this.getEdmTargetKinds(actionFunctionImportNode);
return actionFunctionImportNode;

@@ -339,2 +368,23 @@ };

}
/**
* Get OData target kinds for a metadata element.
*
* @param metadata element.
* @returns OData target kinds.
*/
getEdmTargetKinds(element) {
if (!element) {
return [];
}
const targetKinds = [];
targetKinds.push(...(targetKindsMapCds.get(element.kind) ?? []));
if (element.kind === 'element' && element.structuredType && element.isEntityType) {
// CDS elements pointing to an entity type can be annotated like a EDMX navigation property
targetKinds.unshift("NavigationProperty" /* Edm.NavigationProperty */);
}
if (targetKinds.includes("EntitySet" /* Edm.EntitySet */) || element.isCollectionValued) {
targetKinds.push("Collection" /* Edm.Collection */);
}
return targetKinds;
}
buildNode(kind, name, parentPath, origin, edmPrimitiveType) {

@@ -349,3 +399,4 @@ const node = {

isComplexType: false,
isAnnotatable: true
isAnnotatable: true,
targetKinds: []
};

@@ -505,3 +556,5 @@ if (origin) {

for (const { name, type } of keyNamesAndTypes) {
elements.push(this.buildNode(element.kind, [elementName, name].join('_'), parentPath, this.getOrigin(element), type));
const node = this.buildNode(element.kind, [elementName, name].join('_'), parentPath, this.getOrigin(element), type);
node.targetKinds = this.getEdmTargetKinds(node);
elements.push(node);
}

@@ -508,0 +561,0 @@ return elements;

@@ -1,2 +0,2 @@

import type { MetadataElement } from '@sap/ux-metadata';
import type { MetadataElement } from '@sap-ux/odata-annotation-core-types';
import type { CdsCompilerFacade } from '..';

@@ -3,0 +3,0 @@ export declare const RETURN_PARAM_NAME = "$Return";

{
"name": "@sap/ux-cds-compiler-facade",
"version": "1.12.0",
"version": "1.12.2",
"description": "SAP Fiori tools - CDS compiler facade",

@@ -32,9 +32,11 @@ "publisher": "SAPSE",

},
"peerDependencies": {
"@sap-ux/odata-annotation-core": "0.1.7",
"@sap-ux/odata-annotation-core-types": "0.3.0"
},
"devDependencies": {
"@sap-ux/odata-annotation-core": "0.1.2",
"@sap-ux/odata-annotation-core-types": "0.1.1",
"@sap-ux/cds-annotation-parser": "0.1.2",
"@sap/cds": "7.4.1",
"@sap/ux-cds-annotation-parser": "1.12.0",
"@sap/ux-cds-compiler-types": "1.12.0",
"@sap/ux-project-access": "1.12.0",
"@sap/ux-cds-compiler-types": "1.12.2",
"@sap/ux-project-access": "1.12.2",
"madge": "4.0.2",

@@ -41,0 +43,0 @@ "typescript": "5.2.2"

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