@sap-ux/odata-entity-model
Advanced tools
Comparing version 0.1.1 to 0.2.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MetadataService = void 0; | ||
// 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)); | ||
/** | ||
@@ -259,3 +243,2 @@ * Extracts action/function name by removing the part enclosed in parentheses. | ||
getEdmTargetKinds(path) { | ||
var _a; | ||
const element = this.getMetadataElement(path); | ||
@@ -265,22 +248,3 @@ if (!element) { | ||
} | ||
const targetKinds = []; | ||
if (this.isCds) { | ||
targetKinds.push(...((_a = targetKindsMapCds.get(element.kind)) !== null && _a !== void 0 ? _a : [])); | ||
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 */); | ||
} | ||
} | ||
else { | ||
targetKinds.push(element.kind); | ||
if (element.kind === "FunctionImport" /* Edm.FunctionImport */ && this.ODataVersion !== '4.0') { | ||
// vocabulary and annotation files are defined based on OData v4, but are used to annotate both OData v2 and OData v4 metadata. | ||
// OData v2 does not have 'Action' but only 'FunctionImport'. Map to 'Action' to support annotating 'FunctionImport' with terms targeting actions. | ||
targetKinds.push("Action" /* Edm.Action */); | ||
} | ||
} | ||
if (targetKinds.includes("EntitySet" /* Edm.EntitySet */) || element.isCollectionValued) { | ||
targetKinds.push("Collection" /* Edm.Collection */); | ||
} | ||
return targetKinds; | ||
return element.targetKinds; | ||
} | ||
@@ -287,0 +251,0 @@ /** |
{ | ||
"name": "@sap-ux/odata-entity-model", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "OData model representation without annotations", | ||
@@ -12,29 +12,7 @@ "main": "dist/index.js", | ||
], | ||
"jestSonar": { | ||
"reportPath": "reports/test/unit", | ||
"reportFile": "test-report.xml" | ||
}, | ||
"devDependencies": { | ||
"npm-run-all": "4.1.5", | ||
"typescript": "4.9.5", | ||
"@sap-ux/odata-annotation-core-types": "0.1.1" | ||
"@sap-ux/odata-annotation-core-types": "0.3.0" | ||
}, | ||
"eslint-formatter-multiple": { | ||
"formatters": [ | ||
{ | ||
"name": "stylish", | ||
"output": "console" | ||
}, | ||
{ | ||
"name": "json", | ||
"output": "file", | ||
"path": "reports/lint/eslint.json" | ||
}, | ||
{ | ||
"name": "checkstyle", | ||
"output": "file", | ||
"path": "reports/lint/eslint.checkstyle.xml" | ||
} | ||
] | ||
}, | ||
"scripts": { | ||
@@ -48,3 +26,3 @@ "build": "npm-run-all clean && tsc --build ./tsconfig.build.json", | ||
"lint:summary": "eslint . --ext .ts,.tsx -f summary", | ||
"lint:fix": "eslint --fix", | ||
"lint:fix": "eslint . --ext .ts --fix", | ||
"lint:fix:all": "eslint . --ext .ts,.tsx --fix", | ||
@@ -51,0 +29,0 @@ "lint:report": "eslint . --ext .ts,.tsx -f multiple ", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
36912
413