@sap-ux/xml-odata-annotation-converter 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +55 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/attribute-getters.d.ts +18 -0
- package/dist/parser/attribute-getters.d.ts.map +1 -0
- package/dist/parser/attribute-getters.js +28 -0
- package/dist/parser/attribute-getters.js.map +1 -0
- package/dist/parser/document.d.ts +11 -0
- package/dist/parser/document.d.ts.map +1 -0
- package/dist/parser/document.js +325 -0
- package/dist/parser/document.js.map +1 -0
- package/dist/parser/element-getters.d.ts +10 -0
- package/dist/parser/element-getters.d.ts.map +1 -0
- package/dist/parser/element-getters.js +15 -0
- package/dist/parser/element-getters.js.map +1 -0
- package/dist/parser/escaping.d.ts +8 -0
- package/dist/parser/escaping.d.ts.map +1 -0
- package/dist/parser/escaping.js +21 -0
- package/dist/parser/escaping.js.map +1 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +10 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/metadata.d.ts +11 -0
- package/dist/parser/metadata.d.ts.map +1 -0
- package/dist/parser/metadata.js +515 -0
- package/dist/parser/metadata.js.map +1 -0
- package/dist/parser/range.d.ts +37 -0
- package/dist/parser/range.d.ts.map +1 -0
- package/dist/parser/range.js +67 -0
- package/dist/parser/range.js.map +1 -0
- package/dist/printer/builders.d.ts +49 -0
- package/dist/printer/builders.d.ts.map +1 -0
- package/dist/printer/builders.js +138 -0
- package/dist/printer/builders.js.map +1 -0
- package/dist/printer/csdl-to-xml.d.ts +23 -0
- package/dist/printer/csdl-to-xml.d.ts.map +1 -0
- package/dist/printer/csdl-to-xml.js +160 -0
- package/dist/printer/csdl-to-xml.js.map +1 -0
- package/dist/printer/document-modifier.d.ts +6 -0
- package/dist/printer/document-modifier.d.ts.map +1 -0
- package/dist/printer/document-modifier.js +47 -0
- package/dist/printer/document-modifier.js.map +1 -0
- package/dist/printer/index.d.ts +5 -0
- package/dist/printer/index.d.ts.map +1 -0
- package/dist/printer/index.js +31 -0
- package/dist/printer/index.js.map +1 -0
- package/dist/printer/namespaces.d.ts +3 -0
- package/dist/printer/namespaces.d.ts.map +1 -0
- package/dist/printer/namespaces.js +6 -0
- package/dist/printer/namespaces.js.map +1 -0
- package/dist/printer/serializer-edmx.d.ts +46 -0
- package/dist/printer/serializer-edmx.d.ts.map +1 -0
- package/dist/printer/serializer-edmx.js +214 -0
- package/dist/printer/serializer-edmx.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNewAnnotationFile = exports.serializeTarget = exports.serializeElement = exports.serializeAttribute = exports.serializeReference = void 0;
|
|
4
|
+
const odata_annotation_core_1 = require("@sap-ux/odata-annotation-core");
|
|
5
|
+
const csdl_to_xml_1 = require("./csdl-to-xml");
|
|
6
|
+
const namespaces_1 = require("./namespaces");
|
|
7
|
+
const namespaces = {
|
|
8
|
+
Edmx: 'edmx'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Serializes reference.
|
|
12
|
+
*
|
|
13
|
+
* @param data namespace data (must not be undefined)
|
|
14
|
+
* @param parentStartPosition
|
|
15
|
+
* @returns string
|
|
16
|
+
*/
|
|
17
|
+
function serializeReference(data, parentStartPosition = -1) {
|
|
18
|
+
const includeSnippet = (0, odata_annotation_core_1.createElementNode)({
|
|
19
|
+
name: "Include" /* Edmx.Include */,
|
|
20
|
+
namespaceAlias: 'Edmx',
|
|
21
|
+
attributes: {
|
|
22
|
+
["Namespace" /* Edmx.Namespace */]: (0, odata_annotation_core_1.createAttributeNode)("Namespace" /* Edmx.Namespace */, data.namespace)
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (data.alias) {
|
|
26
|
+
includeSnippet.attributes["Alias" /* Edmx.Alias */] = (0, odata_annotation_core_1.createAttributeNode)("Alias" /* Edmx.Alias */, data.alias);
|
|
27
|
+
}
|
|
28
|
+
const snippet = (0, odata_annotation_core_1.createElementNode)({
|
|
29
|
+
name: "Reference" /* Edmx.Reference */,
|
|
30
|
+
namespaceAlias: 'Edmx',
|
|
31
|
+
content: [includeSnippet],
|
|
32
|
+
attributes: {
|
|
33
|
+
["Uri" /* Edmx.Uri */]: (0, odata_annotation_core_1.createAttributeNode)("Uri" /* Edmx.Uri */, data.referenceUri)
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const indentLevel = (0, odata_annotation_core_1.getIndentLevel)(parentStartPosition, odata_annotation_core_1.printOptions.tabWidth) + 1;
|
|
37
|
+
return ('\n' +
|
|
38
|
+
(0, csdl_to_xml_1.printCsdlNodeToXmlString)(snippet, odata_annotation_core_1.printOptions, {
|
|
39
|
+
cursorIndentLevel: indentLevel,
|
|
40
|
+
namespaces
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
exports.serializeReference = serializeReference;
|
|
44
|
+
/**
|
|
45
|
+
* Serializes attribute.
|
|
46
|
+
*
|
|
47
|
+
* @param attribute
|
|
48
|
+
* @returns string
|
|
49
|
+
*/
|
|
50
|
+
function serializeAttribute(attribute) {
|
|
51
|
+
return attribute.name + '="' + attribute.value + '"';
|
|
52
|
+
}
|
|
53
|
+
exports.serializeAttribute = serializeAttribute;
|
|
54
|
+
/**
|
|
55
|
+
* Serializes element.
|
|
56
|
+
*
|
|
57
|
+
* @param element
|
|
58
|
+
* @param parentElementStartPosition
|
|
59
|
+
* @returns string
|
|
60
|
+
*/
|
|
61
|
+
function serializeElement(element, parentElementStartPosition = -1) {
|
|
62
|
+
const indentLevel = (0, odata_annotation_core_1.getIndentLevel)(parentElementStartPosition, odata_annotation_core_1.printOptions.tabWidth) + 1;
|
|
63
|
+
return '\n' + (0, csdl_to_xml_1.printCsdlNodeToXmlString)(element, odata_annotation_core_1.printOptions, { cursorIndentLevel: indentLevel });
|
|
64
|
+
}
|
|
65
|
+
exports.serializeElement = serializeElement;
|
|
66
|
+
/**
|
|
67
|
+
* Serializes target.
|
|
68
|
+
*
|
|
69
|
+
* @param target
|
|
70
|
+
* @param parentStartPostition
|
|
71
|
+
* @returns string
|
|
72
|
+
*/
|
|
73
|
+
function serializeTarget(target, parentStartPostition = 0) {
|
|
74
|
+
const indentLevel = (0, odata_annotation_core_1.getIndentLevel)(parentStartPostition, odata_annotation_core_1.printOptions.tabWidth) + 1;
|
|
75
|
+
const terms = (0, csdl_to_xml_1.printCsdlNodeToXmlString)(target.terms, odata_annotation_core_1.printOptions, {
|
|
76
|
+
cursorIndentLevel: indentLevel + 1
|
|
77
|
+
});
|
|
78
|
+
const annotationTargetSnippet = (0, odata_annotation_core_1.createElementNode)({
|
|
79
|
+
name: "Annotations" /* Edm.Annotations */,
|
|
80
|
+
attributes: {
|
|
81
|
+
["Target" /* Edm.Target */]: (0, odata_annotation_core_1.createAttributeNode)("Target" /* Edm.Target */, target.name)
|
|
82
|
+
},
|
|
83
|
+
content: [(0, odata_annotation_core_1.createTextNode)(terms)]
|
|
84
|
+
});
|
|
85
|
+
return ('\n' +
|
|
86
|
+
(0, csdl_to_xml_1.printCsdlNodeToXmlString)(annotationTargetSnippet, odata_annotation_core_1.printOptions, {
|
|
87
|
+
cursorIndentLevel: indentLevel
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
exports.serializeTarget = serializeTarget;
|
|
91
|
+
/**
|
|
92
|
+
* Creates new annotation file object.
|
|
93
|
+
*
|
|
94
|
+
* @param aliasInfo
|
|
95
|
+
* @param metadataUri
|
|
96
|
+
* @param vocabularies
|
|
97
|
+
* @returns annotation file object
|
|
98
|
+
*/
|
|
99
|
+
function getNewAnnotationFile(aliasInfo, metadataUri, vocabularies) {
|
|
100
|
+
// build map with all edmx references
|
|
101
|
+
const references = new Map();
|
|
102
|
+
Object.keys(aliasInfo.aliasMap).forEach((nsOrAlias) => {
|
|
103
|
+
if (aliasInfo.aliasMap[nsOrAlias] === nsOrAlias) {
|
|
104
|
+
collectReferences(references, vocabularies, aliasInfo, nsOrAlias, metadataUri);
|
|
105
|
+
}
|
|
106
|
+
else if (nsOrAlias !== aliasInfo.currentFileAlias) {
|
|
107
|
+
// alias
|
|
108
|
+
if (!references.has(aliasInfo.aliasMap[nsOrAlias])) {
|
|
109
|
+
references.set(aliasInfo.aliasMap[nsOrAlias], { alias: '', uri: '' });
|
|
110
|
+
}
|
|
111
|
+
const aliasMap = references.get(aliasInfo.aliasMap[nsOrAlias]);
|
|
112
|
+
if (aliasMap) {
|
|
113
|
+
aliasMap.alias = nsOrAlias;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
// build references EDMX snippet
|
|
118
|
+
let referencesSnippet = '';
|
|
119
|
+
references.forEach((value, namespace) => {
|
|
120
|
+
const alias = value.alias;
|
|
121
|
+
const referenceUri = value.uri;
|
|
122
|
+
const data = {
|
|
123
|
+
alias,
|
|
124
|
+
namespace,
|
|
125
|
+
referenceUri
|
|
126
|
+
};
|
|
127
|
+
referencesSnippet += serializeReference(data, 0);
|
|
128
|
+
});
|
|
129
|
+
const schemaSnippet = (0, odata_annotation_core_1.createElementNode)({
|
|
130
|
+
name: "Schema" /* Edm.Schema */,
|
|
131
|
+
attributes: {
|
|
132
|
+
['xmlns']: (0, odata_annotation_core_1.createAttributeNode)('xmlns', namespaces_1.EDM_V4_NAMESPACE),
|
|
133
|
+
["Namespace" /* Edm.Namespace */]: (0, odata_annotation_core_1.createAttributeNode)("Namespace" /* Edm.Namespace */, aliasInfo.currentFileNamespace)
|
|
134
|
+
},
|
|
135
|
+
content: [
|
|
136
|
+
(0, odata_annotation_core_1.createTextNode)('\n' +
|
|
137
|
+
(0, odata_annotation_core_1.indent)(odata_annotation_core_1.printOptions.tabWidth, odata_annotation_core_1.printOptions.useTabs, 3) +
|
|
138
|
+
'INSERT_TOKEN' +
|
|
139
|
+
'\n' +
|
|
140
|
+
(0, odata_annotation_core_1.indent)(odata_annotation_core_1.printOptions.tabWidth, odata_annotation_core_1.printOptions.useTabs, 2))
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
if (aliasInfo.currentFileAlias) {
|
|
144
|
+
schemaSnippet.attributes["Alias" /* Edm.Alias */] = (0, odata_annotation_core_1.createAttributeNode)("Alias" /* Edm.Alias */, aliasInfo.currentFileAlias);
|
|
145
|
+
}
|
|
146
|
+
const dataServiceSnippet = (0, odata_annotation_core_1.createElementNode)({
|
|
147
|
+
name: "DataServices" /* Edmx.DataServices */,
|
|
148
|
+
namespaceAlias: 'Edmx',
|
|
149
|
+
content: [schemaSnippet]
|
|
150
|
+
});
|
|
151
|
+
const rootElement = (0, odata_annotation_core_1.createElementNode)({
|
|
152
|
+
name: "Edmx" /* Edmx.Edmx */,
|
|
153
|
+
namespaceAlias: 'Edmx',
|
|
154
|
+
attributes: {
|
|
155
|
+
['xmlns:edmx']: (0, odata_annotation_core_1.createAttributeNode)('xmlns:edmx', namespaces_1.EDMX_V4_NAMESPACE),
|
|
156
|
+
["Version" /* Edmx.Version */]: (0, odata_annotation_core_1.createAttributeNode)("Version" /* Edmx.Version */, '4.0')
|
|
157
|
+
},
|
|
158
|
+
content: [(0, odata_annotation_core_1.createTextNode)(referencesSnippet), dataServiceSnippet, (0, odata_annotation_core_1.createTextNode)('\n')]
|
|
159
|
+
});
|
|
160
|
+
const fileContent = (0, csdl_to_xml_1.printCsdlNodeToXmlString)(rootElement, odata_annotation_core_1.printOptions, {
|
|
161
|
+
cursorIndentLevel: 0,
|
|
162
|
+
namespaces
|
|
163
|
+
}) + '\n';
|
|
164
|
+
// find position of insert token
|
|
165
|
+
const { lastLine, lastCharacter } = getLastPosition(fileContent.substring(0, fileContent.indexOf('INSERT_TOKEN')));
|
|
166
|
+
return {
|
|
167
|
+
fileContent: fileContent.replace('INSERT_TOKEN', ''),
|
|
168
|
+
position: { line: lastLine, character: lastCharacter }
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
exports.getNewAnnotationFile = getNewAnnotationFile;
|
|
172
|
+
/**
|
|
173
|
+
* Returns last position data in given content.
|
|
174
|
+
*
|
|
175
|
+
* @param fileContent
|
|
176
|
+
* @returns last position data
|
|
177
|
+
*/
|
|
178
|
+
function getLastPosition(fileContent) {
|
|
179
|
+
const contentLines = fileContent.split('\n');
|
|
180
|
+
const lastLine = contentLines.length - 1;
|
|
181
|
+
const lastCharacter = contentLines[lastLine].length;
|
|
182
|
+
return { lastLine, lastCharacter };
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Collects references.
|
|
186
|
+
*
|
|
187
|
+
* @param references references map
|
|
188
|
+
* @param vocabularies vocabularies map
|
|
189
|
+
* @param aliasInfo alias information
|
|
190
|
+
* @param nsOrAlias namespace or alias
|
|
191
|
+
* @param metadataUri md uri
|
|
192
|
+
*/
|
|
193
|
+
function collectReferences(references, vocabularies, aliasInfo, nsOrAlias, metadataUri) {
|
|
194
|
+
// namespace
|
|
195
|
+
if (nsOrAlias !== aliasInfo.currentFileNamespace) {
|
|
196
|
+
if (!references.has(nsOrAlias)) {
|
|
197
|
+
references.set(nsOrAlias, { alias: '', uri: '' });
|
|
198
|
+
}
|
|
199
|
+
const reference = references.get(nsOrAlias);
|
|
200
|
+
if (reference) {
|
|
201
|
+
const vocabulary = vocabularies.get(nsOrAlias);
|
|
202
|
+
if (vocabulary) {
|
|
203
|
+
reference.uri = vocabulary === null || vocabulary === void 0 ? void 0 : vocabulary.defaultUri;
|
|
204
|
+
if (!reference.alias) {
|
|
205
|
+
reference.alias = vocabulary.defaultAlias;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
reference.uri = metadataUri; // TODO support multiple metadata Uris
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=serializer-edmx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-edmx.js","sourceRoot":"","sources":["../../src/printer/serializer-edmx.ts"],"names":[],"mappings":";;;AASA,yEASuC;AAGvC,+CAAyD;AAEzD,6CAAmE;AAEnE,MAAM,UAAU,GAAsB;IAClC,IAAI,EAAE,MAAM;CACf,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,IAA8B,EAAE,mBAAmB,GAAG,CAAC,CAAC;IACvF,MAAM,cAAc,GAAG,IAAA,yCAAiB,EAAC;QACrC,IAAI,8BAAc;QAClB,cAAc,EAAE,MAAM;QACtB,UAAU,EAAE;YACR,kCAAgB,EAAE,IAAA,2CAAmB,oCAAiB,IAAI,CAAC,SAAS,CAAC;SACxE;KACJ,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,KAAK,EAAE;QACZ,cAAc,CAAC,UAAU,0BAAY,GAAG,IAAA,2CAAmB,4BAAa,IAAI,CAAC,KAAK,CAAC,CAAC;KACvF;IAED,MAAM,OAAO,GAAG,IAAA,yCAAiB,EAAC;QAC9B,IAAI,kCAAgB;QACpB,cAAc,EAAE,MAAM;QACtB,OAAO,EAAE,CAAC,cAAc,CAAC;QACzB,UAAU,EAAE;YACR,sBAAU,EAAE,IAAA,2CAAmB,wBAAW,IAAI,CAAC,YAAY,CAAC;SAC/D;KACJ,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,IAAA,sCAAc,EAAC,mBAAmB,EAAE,oCAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnF,OAAO,CACH,IAAI;QACJ,IAAA,sCAAwB,EAAC,OAAO,EAAE,oCAAY,EAAE;YAC5C,iBAAiB,EAAE,WAAW;YAC9B,UAAU;SACb,CAAC,CACL,CAAC;AACN,CAAC;AA7BD,gDA6BC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,SAAoB;IACnD,OAAO,S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AG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,CAAC;gBACvC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;oBAClB,SAAS,CAAC,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC;iBAC7C;aACJ;iBAAM;gBACH,SAAS,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,sCAAsC;aACtE;SACJ;KACJ;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sap-ux/xml-odata-annotation-converter",
|
|
3
|
+
"description": "Converter for OData annotations in XML format.",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"publisher": "SAPSE",
|
|
6
|
+
"author": "SAP SE",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@sap-ux/odata-annotation-core": "0.1.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@xml-tools/ast": "5.0.5",
|
|
17
|
+
"@xml-tools/parser": "1.0.11",
|
|
18
|
+
"chevrotain": "7.1.1",
|
|
19
|
+
"npm-run-all": "4.1.5",
|
|
20
|
+
"typescript": "4.9.5",
|
|
21
|
+
"@sap-ux/odata-vocabularies": "0.1.4",
|
|
22
|
+
"@sap-ux/odata-annotation-core-types": "0.1.2"
|
|
23
|
+
},
|
|
24
|
+
"eslint-formatter-multiple": {
|
|
25
|
+
"formatters": [
|
|
26
|
+
{
|
|
27
|
+
"name": "stylish",
|
|
28
|
+
"output": "console"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "json",
|
|
32
|
+
"output": "file",
|
|
33
|
+
"path": "reports/lint/eslint.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "checkstyle",
|
|
37
|
+
"output": "file",
|
|
38
|
+
"path": "reports/lint/eslint.checkstyle.xml"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"compile": "tsc --build tsconfig.build.json",
|
|
44
|
+
"build": "npm-run-all clean compile",
|
|
45
|
+
"clean:dist": "rimraf ./dist ./generators *.tsbuildinfo",
|
|
46
|
+
"clean": "rimraf ./reports",
|
|
47
|
+
"format:fix": "prettier --write --loglevel silent --ignore-path ../../../.prettierignore",
|
|
48
|
+
"format:fix:all": "prettier --write '**/*.{css,scss,html,js,json,ts,tsx,yaml,yml}' '!**/{out,dist,typings,node_modules}/**' '!**/*.{svg,png,xml}' --ignore-path ../../../.prettierignore",
|
|
49
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
50
|
+
"lint:fix": "eslint --fix",
|
|
51
|
+
"lint:fix:all": "eslint . --ext .ts,.tsx --fix",
|
|
52
|
+
"lint:report": "eslint . --ext .ts,.tsx -f multiple ",
|
|
53
|
+
"lint:summary": "eslint . --ext .ts,.tsx -f summary",
|
|
54
|
+
"pre-commit": "lint-staged --quiet",
|
|
55
|
+
"test": "jest --maxWorkers=2",
|
|
56
|
+
"test:update": "node scripts/update-parser-fixtures.mjs",
|
|
57
|
+
"watch": "tsc --build ./ -watch"
|
|
58
|
+
}
|
|
59
|
+
}
|