@sap-ux/cds-odata-annotation-converter 0.2.0
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/i18n/i18n.json +8 -0
- package/dist/i18n.d.ts +7 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +37 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/printer/csdl-to-cds.d.ts +30 -0
- package/dist/printer/csdl-to-cds.d.ts.map +1 -0
- package/dist/printer/csdl-to-cds.js +391 -0
- package/dist/printer/csdl-to-cds.js.map +1 -0
- package/dist/printer/edm-json.d.ts +18 -0
- package/dist/printer/edm-json.d.ts.map +1 -0
- package/dist/printer/edm-json.js +140 -0
- package/dist/printer/edm-json.js.map +1 -0
- package/dist/printer/indent.d.ts +16 -0
- package/dist/printer/indent.d.ts.map +1 -0
- package/dist/printer/indent.js +72 -0
- package/dist/printer/indent.js.map +1 -0
- package/dist/printer/index.d.ts +3 -0
- package/dist/printer/index.d.ts.map +1 -0
- package/dist/printer/index.js +11 -0
- package/dist/printer/index.js.map +1 -0
- package/dist/printer/primitives.d.ts +16 -0
- package/dist/printer/primitives.d.ts.map +1 -0
- package/dist/printer/primitives.js +52 -0
- package/dist/printer/primitives.js.map +1 -0
- package/dist/transforms/annotation/convert.d.ts +25 -0
- package/dist/transforms/annotation/convert.d.ts.map +1 -0
- package/dist/transforms/annotation/convert.js +47 -0
- package/dist/transforms/annotation/convert.js.map +1 -0
- package/dist/transforms/annotation/creators.d.ts +5 -0
- package/dist/transforms/annotation/creators.d.ts.map +1 -0
- package/dist/transforms/annotation/creators.js +17 -0
- package/dist/transforms/annotation/creators.js.map +1 -0
- package/dist/transforms/annotation/find-node.d.ts +20 -0
- package/dist/transforms/annotation/find-node.d.ts.map +1 -0
- package/dist/transforms/annotation/find-node.js +461 -0
- package/dist/transforms/annotation/find-node.js.map +1 -0
- package/dist/transforms/annotation/flattened.d.ts +13 -0
- package/dist/transforms/annotation/flattened.d.ts.map +1 -0
- package/dist/transforms/annotation/flattened.js +151 -0
- package/dist/transforms/annotation/flattened.js.map +1 -0
- package/dist/transforms/annotation/handler.d.ts +32 -0
- package/dist/transforms/annotation/handler.d.ts.map +1 -0
- package/dist/transforms/annotation/handler.js +14 -0
- package/dist/transforms/annotation/handler.js.map +1 -0
- package/dist/transforms/annotation/handlers/annotation.d.ts +4 -0
- package/dist/transforms/annotation/handlers/annotation.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/annotation.js +160 -0
- package/dist/transforms/annotation/handlers/annotation.js.map +1 -0
- package/dist/transforms/annotation/handlers/boolean.d.ts +4 -0
- package/dist/transforms/annotation/handlers/boolean.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/boolean.js +25 -0
- package/dist/transforms/annotation/handlers/boolean.js.map +1 -0
- package/dist/transforms/annotation/handlers/collection.d.ts +4 -0
- package/dist/transforms/annotation/handlers/collection.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/collection.js +41 -0
- package/dist/transforms/annotation/handlers/collection.js.map +1 -0
- package/dist/transforms/annotation/handlers/edm-json.d.ts +51 -0
- package/dist/transforms/annotation/handlers/edm-json.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/edm-json.js +176 -0
- package/dist/transforms/annotation/handlers/edm-json.js.map +1 -0
- package/dist/transforms/annotation/handlers/enum.d.ts +24 -0
- package/dist/transforms/annotation/handlers/enum.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/enum.js +69 -0
- package/dist/transforms/annotation/handlers/enum.js.map +1 -0
- package/dist/transforms/annotation/handlers/expression.d.ts +6 -0
- package/dist/transforms/annotation/handlers/expression.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/expression.js +92 -0
- package/dist/transforms/annotation/handlers/expression.js.map +1 -0
- package/dist/transforms/annotation/handlers/index.d.ts +7 -0
- package/dist/transforms/annotation/handlers/index.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/index.js +33 -0
- package/dist/transforms/annotation/handlers/index.js.map +1 -0
- package/dist/transforms/annotation/handlers/number.d.ts +12 -0
- package/dist/transforms/annotation/handlers/number.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/number.js +48 -0
- package/dist/transforms/annotation/handlers/number.js.map +1 -0
- package/dist/transforms/annotation/handlers/path.d.ts +4 -0
- package/dist/transforms/annotation/handlers/path.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/path.js +193 -0
- package/dist/transforms/annotation/handlers/path.js.map +1 -0
- package/dist/transforms/annotation/handlers/quoted-literal.d.ts +4 -0
- package/dist/transforms/annotation/handlers/quoted-literal.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/quoted-literal.js +45 -0
- package/dist/transforms/annotation/handlers/quoted-literal.js.map +1 -0
- package/dist/transforms/annotation/handlers/record-property.d.ts +4 -0
- package/dist/transforms/annotation/handlers/record-property.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/record-property.js +57 -0
- package/dist/transforms/annotation/handlers/record-property.js.map +1 -0
- package/dist/transforms/annotation/handlers/record.d.ts +4 -0
- package/dist/transforms/annotation/handlers/record.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/record.js +243 -0
- package/dist/transforms/annotation/handlers/record.js.map +1 -0
- package/dist/transforms/annotation/handlers/string.d.ts +5 -0
- package/dist/transforms/annotation/handlers/string.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/string.js +56 -0
- package/dist/transforms/annotation/handlers/string.js.map +1 -0
- package/dist/transforms/annotation/handlers/token.d.ts +4 -0
- package/dist/transforms/annotation/handlers/token.d.ts.map +1 -0
- package/dist/transforms/annotation/handlers/token.js +19 -0
- package/dist/transforms/annotation/handlers/token.js.map +1 -0
- package/dist/transforms/annotation/index.d.ts +2 -0
- package/dist/transforms/annotation/index.d.ts.map +1 -0
- package/dist/transforms/annotation/index.js +6 -0
- package/dist/transforms/annotation/index.js.map +1 -0
- package/dist/transforms/annotation/path-utils.d.ts +13 -0
- package/dist/transforms/annotation/path-utils.d.ts.map +1 -0
- package/dist/transforms/annotation/path-utils.js +40 -0
- package/dist/transforms/annotation/path-utils.js.map +1 -0
- package/dist/transforms/annotation/range.d.ts +5 -0
- package/dist/transforms/annotation/range.d.ts.map +1 -0
- package/dist/transforms/annotation/range.js +11 -0
- package/dist/transforms/annotation/range.js.map +1 -0
- package/dist/transforms/annotation/type-resolver.d.ts +37 -0
- package/dist/transforms/annotation/type-resolver.d.ts.map +1 -0
- package/dist/transforms/annotation/type-resolver.js +96 -0
- package/dist/transforms/annotation/type-resolver.js.map +1 -0
- package/dist/transforms/annotation/visitor-state.d.ts +81 -0
- package/dist/transforms/annotation/visitor-state.d.ts.map +1 -0
- package/dist/transforms/annotation/visitor-state.js +85 -0
- package/dist/transforms/annotation/visitor-state.js.map +1 -0
- package/dist/transforms/annotation/visitor.d.ts +17 -0
- package/dist/transforms/annotation/visitor.d.ts.map +1 -0
- package/dist/transforms/annotation/visitor.js +68 -0
- package/dist/transforms/annotation/visitor.js.map +1 -0
- package/dist/transforms/annotation-file.d.ts +31 -0
- package/dist/transforms/annotation-file.d.ts.map +1 -0
- package/dist/transforms/annotation-file.js +514 -0
- package/dist/transforms/annotation-file.js.map +1 -0
- package/dist/transforms/index.d.ts +3 -0
- package/dist/transforms/index.d.ts.map +1 -0
- package/dist/transforms/index.js +10 -0
- package/dist/transforms/index.js.map +1 -0
- package/dist/transforms/misc.d.ts +2 -0
- package/dist/transforms/misc.d.ts.map +1 -0
- package/dist/transforms/misc.js +10 -0
- package/dist/transforms/misc.js.map +1 -0
- package/dist/transforms/types.d.ts +38 -0
- package/dist/transforms/types.d.ts.map +1 -0
- package/dist/transforms/types.js +3 -0
- package/dist/transforms/types.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordPropertyHandler = void 0;
|
|
4
|
+
const cds_annotation_parser_1 = require("@sap-ux/cds-annotation-parser");
|
|
5
|
+
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
|
|
6
|
+
const flattened_1 = require("../flattened");
|
|
7
|
+
const type_resolver_1 = require("../type-resolver");
|
|
8
|
+
const creators_1 = require("../creators");
|
|
9
|
+
exports.recordPropertyHandler = {
|
|
10
|
+
type: cds_annotation_parser_1.RECORD_PROPERTY_TYPE,
|
|
11
|
+
getChildren(state, node) {
|
|
12
|
+
if (node.value) {
|
|
13
|
+
return [node.value];
|
|
14
|
+
}
|
|
15
|
+
return [];
|
|
16
|
+
},
|
|
17
|
+
convert(state, node) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (state.context.inValueContainer) {
|
|
20
|
+
// Since only annotations are allowed here, we assume it is one
|
|
21
|
+
const element = (0, odata_annotation_core_types_1.createElementNode)({
|
|
22
|
+
name: "Annotation" /* Edm.Annotation */,
|
|
23
|
+
range: (0, cds_annotation_parser_1.nodeRange)(node, true)
|
|
24
|
+
});
|
|
25
|
+
element.attributes["Term" /* Edm.Term */] = (0, creators_1.createTermAttribute)(node.name.value, (0, cds_annotation_parser_1.nodeRange)(node.name, false));
|
|
26
|
+
if (node.value) {
|
|
27
|
+
element.contentRange = (0, cds_annotation_parser_1.nodeRange)(node.value, true);
|
|
28
|
+
}
|
|
29
|
+
return element;
|
|
30
|
+
}
|
|
31
|
+
if (node.name.segments.length === 1) {
|
|
32
|
+
const element = (0, odata_annotation_core_types_1.createElementNode)({
|
|
33
|
+
name: "PropertyValue" /* Edm.PropertyValue */,
|
|
34
|
+
range: (0, cds_annotation_parser_1.nodeRange)(node, true)
|
|
35
|
+
});
|
|
36
|
+
element.attributes["Property" /* Edm.Property */] = (0, creators_1.createPropertyAttribute)(node.name.value, (0, cds_annotation_parser_1.nodeRange)(node.name, false));
|
|
37
|
+
const recordPropertyType = (_a = (0, type_resolver_1.getImplicitPropertyType)(state.vocabularyService, state.context, node.name.value)) === null || _a === void 0 ? void 0 : _a.type;
|
|
38
|
+
state.pushContext(Object.assign(Object.assign({}, state.context), { valueType: recordPropertyType, propertyName: node.name.value }));
|
|
39
|
+
if (node.value) {
|
|
40
|
+
element.contentRange = (0, cds_annotation_parser_1.nodeRange)(node.value, true);
|
|
41
|
+
// take into account colon
|
|
42
|
+
if (node.colon && element.contentRange) {
|
|
43
|
+
const colonPosition = (_c = (_b = node === null || node === void 0 ? void 0 : node.colon) === null || _b === void 0 ? void 0 : _b.range) === null || _c === void 0 ? void 0 : _c.end;
|
|
44
|
+
// position right after colon should be counted as part of the elements content
|
|
45
|
+
element.contentRange.start = colonPosition
|
|
46
|
+
? odata_annotation_core_types_1.Position.create(colonPosition.line, colonPosition.character)
|
|
47
|
+
: odata_annotation_core_types_1.Position.create(0, 0);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return element;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return (0, flattened_1.convertFlattenedPath)(state, node.name.segments, node.value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=record-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-property.js","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/record-property.ts"],"names":[],"mappings":";;;AACA,yEAAgF;AAGhF,qFAAuF;AACvF,4CAAoD;AAGpD,oDAA2D;AAE3D,0CAA2E;AAE9D,QAAA,qBAAqB,GAAgC;IAC9D,IAAI,EAAE,4CAAoB;IAC1B,WAAW,CAAC,KAAmB,EAAE,IAAoB;QACjD,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACvB;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,CAAC,KAAmB,EAAE,IAAoB;;QAC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CAAC,KAAK,EAAE;gBACZ,OAAO,CAAC,YAAY,GAAG,IAAA,iCAAS,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACnD,0BAA0B;gBAC1B,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,EAAE;oBACpC,MAAM,aAAa,GAAG,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,0CAAE,GAAG,CAAC;oBAC9C,+EAA+E;oBAC/E,OAAO,CAAC,YAAY,CAAC,KAAK,GAAG,aAAa;wBACtC,CAAC,CAAC,sCAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;wBAC9D,CAAC,CAAC,sCAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;iBAC/B;aACJ;YACD,OAAO,OAAO,CAAC;SAClB;aAAM;YACH,OAAO,IAAA,gCAAoB,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SACtE;IACL,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/record.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,+BAA+B,CAAC;AAa5F,OAAO,KAAK,EAAiB,WAAW,EAAW,MAAM,YAAY,CAAC;AAItE,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CA2C7C,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordHandler = void 0;
|
|
4
|
+
const cds_annotation_parser_1 = require("@sap-ux/cds-annotation-parser");
|
|
5
|
+
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
|
|
6
|
+
const i18n_1 = require("../../../i18n");
|
|
7
|
+
const edm_json_1 = require("./edm-json");
|
|
8
|
+
exports.recordHandler = {
|
|
9
|
+
type: cds_annotation_parser_1.RECORD_TYPE,
|
|
10
|
+
getChildren,
|
|
11
|
+
convert(state, node) {
|
|
12
|
+
var _a;
|
|
13
|
+
const element = (0, odata_annotation_core_types_1.createElementNode)({
|
|
14
|
+
name: "Record" /* Edm.Record */,
|
|
15
|
+
range: (0, cds_annotation_parser_1.nodeRange)(node, true),
|
|
16
|
+
contentRange: (0, cds_annotation_parser_1.nodeRange)(node, false)
|
|
17
|
+
});
|
|
18
|
+
const { typeProperty, valueProperty, edmJsonProperty } = findReservedProperties(node.properties);
|
|
19
|
+
const explicitType = getExplicitType(typeProperty, state.context);
|
|
20
|
+
const implicitType = getImplicitType(typeProperty, state.context);
|
|
21
|
+
// We need to resolve types to correctly handle conversion of child nodes that are type dependant
|
|
22
|
+
const recordType = explicitType !== null && explicitType !== void 0 ? explicitType : implicitType;
|
|
23
|
+
if (edmJsonProperty) {
|
|
24
|
+
return handleEdmJson(state, edmJsonProperty);
|
|
25
|
+
}
|
|
26
|
+
const isValueContainer = getIsValueContainer(state, valueProperty);
|
|
27
|
+
handleValueProperty(state, node, isValueContainer !== null && isValueContainer !== void 0 ? isValueContainer : false, valueProperty);
|
|
28
|
+
state.pushContext(Object.assign(Object.assign({}, state.context), { recordType, inValueContainer: isValueContainer }));
|
|
29
|
+
if (isValueContainer) {
|
|
30
|
+
// record containing $value should not be converted
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
validateReservedPropertyName(state, cds_annotation_parser_1.ReservedProperties.Type, typeProperty);
|
|
34
|
+
// We only add Type attribute if $Type property exits or compiler has custom logic for resolving this ambiguity
|
|
35
|
+
if (explicitType !== undefined) {
|
|
36
|
+
element.attributes["Type" /* Edm.Type */] = (0, odata_annotation_core_types_1.createAttributeNode)("Type" /* Edm.Type */, explicitType, typeProperty ? (0, cds_annotation_parser_1.nodeRange)(typeProperty.name, true) : undefined, ((_a = typeProperty === null || typeProperty === void 0 ? void 0 : typeProperty.value) === null || _a === void 0 ? void 0 : _a.type) === cds_annotation_parser_1.STRING_LITERAL_TYPE ? (0, cds_annotation_parser_1.nodeRange)(typeProperty.value, false) : undefined);
|
|
37
|
+
}
|
|
38
|
+
return element;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Gets the children annotation nodes for the provided record node based on the visitor state.
|
|
43
|
+
*
|
|
44
|
+
* @param state - The visitor state.
|
|
45
|
+
* @param node - The record node.
|
|
46
|
+
* @returns The array of children annotation nodes.
|
|
47
|
+
*/
|
|
48
|
+
function getChildren(state, node) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { edmJsonProperty, valueProperty } = findReservedProperties(node.properties);
|
|
51
|
+
if (edmJsonProperty) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
if (getIsValueContainer(state, valueProperty)) {
|
|
55
|
+
const children = [];
|
|
56
|
+
if (valueProperty === null || valueProperty === void 0 ? void 0 : valueProperty.value) {
|
|
57
|
+
children.push(valueProperty.value);
|
|
58
|
+
}
|
|
59
|
+
// Empty values are not treated as annotations because they are not prefixed with @.
|
|
60
|
+
// However, in value container only annotations are possible,
|
|
61
|
+
// so we assume that they are annotations and traverse them.
|
|
62
|
+
// PropertyValue elements are converted to Annotation elements at the end.
|
|
63
|
+
Array.prototype.push.apply(children, node.properties.filter((property) => property !== valueProperty));
|
|
64
|
+
if (node.annotations) {
|
|
65
|
+
Array.prototype.push.apply(children, node.annotations);
|
|
66
|
+
}
|
|
67
|
+
return children;
|
|
68
|
+
}
|
|
69
|
+
const recordProperties = node.properties.filter((property) => property.name.value !== cds_annotation_parser_1.ReservedProperties.Type &&
|
|
70
|
+
property.name.value.toUpperCase() !== cds_annotation_parser_1.ReservedProperties.Value.toUpperCase());
|
|
71
|
+
return [...recordProperties, ...((_a = node.annotations) !== null && _a !== void 0 ? _a : [])];
|
|
72
|
+
}
|
|
73
|
+
const uiDataFieldAbstract = 'com.sap.vocabularies.UI.v1.DataFieldAbstract';
|
|
74
|
+
const uiDataField = 'com.sap.vocabularies.UI.v1.DataField';
|
|
75
|
+
const getImplicitType = (typeProperty, context) => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (((_a = typeProperty === null || typeProperty === void 0 ? void 0 : typeProperty.value) === null || _a === void 0 ? void 0 : _a.type) === cds_annotation_parser_1.STRING_LITERAL_TYPE) {
|
|
78
|
+
return typeProperty.value.value;
|
|
79
|
+
}
|
|
80
|
+
if (context.valueType) {
|
|
81
|
+
if (context.valueType === uiDataFieldAbstract) {
|
|
82
|
+
return uiDataField;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return context.valueType;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (context.termType === uiDataFieldAbstract) {
|
|
89
|
+
return uiDataField;
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Gets the explicit type from the provided type property and context.
|
|
95
|
+
*
|
|
96
|
+
* @param typeProperty - The type property to retrieve the explicit type from.
|
|
97
|
+
* @param context - The context containing additional information.
|
|
98
|
+
* @returns The explicit type or undefined if not found.
|
|
99
|
+
*/
|
|
100
|
+
function getExplicitType(typeProperty, context) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
if (((_a = typeProperty === null || typeProperty === void 0 ? void 0 : typeProperty.value) === null || _a === void 0 ? void 0 : _a.type) === cds_annotation_parser_1.STRING_LITERAL_TYPE && ((_b = typeProperty === null || typeProperty === void 0 ? void 0 : typeProperty.name) === null || _b === void 0 ? void 0 : _b.value) === cds_annotation_parser_1.ReservedProperties.Type) {
|
|
103
|
+
return typeProperty.value.value;
|
|
104
|
+
}
|
|
105
|
+
if (context.valueType === uiDataFieldAbstract) {
|
|
106
|
+
return uiDataField;
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const normalizedTypePropertyName = cds_annotation_parser_1.ReservedProperties.Type.toUpperCase();
|
|
111
|
+
const normalizedValuePropertyName = cds_annotation_parser_1.ReservedProperties.Value.toUpperCase();
|
|
112
|
+
const normalizedEdmJsonPropertyName = cds_annotation_parser_1.ReservedProperties.EdmJson.toUpperCase();
|
|
113
|
+
/**
|
|
114
|
+
* Finds reserved properties in the provided array of record properties.
|
|
115
|
+
*
|
|
116
|
+
* @param properties - The array of record properties to search.
|
|
117
|
+
* @returns An object containing found reserved properties.
|
|
118
|
+
*/
|
|
119
|
+
function findReservedProperties(properties) {
|
|
120
|
+
const result = {};
|
|
121
|
+
for (const property of properties) {
|
|
122
|
+
const normalizedName = property.name.value.toUpperCase();
|
|
123
|
+
if (normalizedName === normalizedTypePropertyName) {
|
|
124
|
+
result.typeProperty = property;
|
|
125
|
+
}
|
|
126
|
+
else if (normalizedName === normalizedValuePropertyName) {
|
|
127
|
+
result.valueProperty = property;
|
|
128
|
+
}
|
|
129
|
+
else if (normalizedName === normalizedEdmJsonPropertyName ||
|
|
130
|
+
(normalizedName.startsWith('$EDMJ') && property.name.value.length <= normalizedEdmJsonPropertyName.length)) {
|
|
131
|
+
result.edmJsonProperty = property;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Handles the EdmJson property in the provided record property based on the visitor state.
|
|
138
|
+
*
|
|
139
|
+
* @param state - The visitor state.
|
|
140
|
+
* @param edmJsonProperty - The EdmJson record property to handle.
|
|
141
|
+
* @returns The processed element, subtree, or undefined if not applicable.
|
|
142
|
+
*/
|
|
143
|
+
function handleEdmJson(state, edmJsonProperty) {
|
|
144
|
+
if (edmJsonProperty) {
|
|
145
|
+
validateReservedPropertyName(state, cds_annotation_parser_1.ReservedProperties.EdmJson, edmJsonProperty);
|
|
146
|
+
if (edmJsonProperty.value && edmJsonProperty.name.value === cds_annotation_parser_1.ReservedProperties.EdmJson) {
|
|
147
|
+
const edmVisitor = new edm_json_1.EdmJsonVisitor(state);
|
|
148
|
+
return edmVisitor.visit(edmJsonProperty.value);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Handles the value property in the provided record node based on the visitor state and value container information.
|
|
155
|
+
*
|
|
156
|
+
* @param state - The visitor state.
|
|
157
|
+
* @param node - The record node.
|
|
158
|
+
* @param isValueContainer - A boolean indicating whether the node is a value container.
|
|
159
|
+
* @param valueProperty - The value property associated with the record node.
|
|
160
|
+
*/
|
|
161
|
+
function handleValueProperty(state, node, isValueContainer, valueProperty) {
|
|
162
|
+
if (isValueContainer) {
|
|
163
|
+
if (!valueProperty && node.range) {
|
|
164
|
+
const message = i18n_1.i18n.t('Mandatory_property_not_provided_0', {
|
|
165
|
+
property: cds_annotation_parser_1.ReservedProperties.Value
|
|
166
|
+
});
|
|
167
|
+
state.addDiagnostic(odata_annotation_core_types_1.Diagnostic.create(node.range, message, odata_annotation_core_types_1.DiagnosticSeverity.Error));
|
|
168
|
+
}
|
|
169
|
+
validateReservedPropertyName(state, cds_annotation_parser_1.ReservedProperties.Value, valueProperty);
|
|
170
|
+
addDiagnosticForExtraneousProperties(state, node, valueProperty);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Adds diagnostics for extraneous properties in the provided node based on the visitor state and value property.
|
|
175
|
+
*
|
|
176
|
+
* @param state - The visitor state.
|
|
177
|
+
* @param node - The record node containing properties to check.
|
|
178
|
+
* @param valueProperty - The value property associated with the record.
|
|
179
|
+
*/
|
|
180
|
+
function addDiagnosticForExtraneousProperties(state, node, valueProperty) {
|
|
181
|
+
var _a;
|
|
182
|
+
const typeInfo = state.context.valueType ? state.vocabularyService.getType(state.context.valueType) : undefined;
|
|
183
|
+
if (((_a = valueProperty === null || valueProperty === void 0 ? void 0 : valueProperty.name) === null || _a === void 0 ? void 0 : _a.value) === cds_annotation_parser_1.ReservedProperties.Value ||
|
|
184
|
+
(typeInfo === null || typeInfo === void 0 ? void 0 : typeInfo.kind) !== 'ComplexType' ||
|
|
185
|
+
state.context.isCollection) {
|
|
186
|
+
for (const property of node.properties) {
|
|
187
|
+
if (property.name.range && property.name.value.toUpperCase() !== normalizedValuePropertyName) {
|
|
188
|
+
state.addDiagnostic({
|
|
189
|
+
message: i18n_1.i18n.t('Property_is_not_allowed_here', { name: property.name.value }),
|
|
190
|
+
range: property.name.range,
|
|
191
|
+
severity: odata_annotation_core_types_1.DiagnosticSeverity.Warning
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Validates whether the provided property has the expected name, adding a diagnostic if not.
|
|
199
|
+
*
|
|
200
|
+
* @param state - The visitor state.
|
|
201
|
+
* @param expectedName - The expected name for the property.
|
|
202
|
+
* @param property - The record property to validate.
|
|
203
|
+
* @returns True if the property has the expected name, false otherwise.
|
|
204
|
+
*/
|
|
205
|
+
function validateReservedPropertyName(state, expectedName, property) {
|
|
206
|
+
if (property && property.name.value !== expectedName && property.name.range) {
|
|
207
|
+
// check if case issue
|
|
208
|
+
const currentValue = property.name.value;
|
|
209
|
+
const diagnostic = {
|
|
210
|
+
message: i18n_1.i18n.t('Wrong_element_0_Did_you_mean_1', {
|
|
211
|
+
currentValue: currentValue,
|
|
212
|
+
proposedValue: expectedName
|
|
213
|
+
}),
|
|
214
|
+
range: property.name.range,
|
|
215
|
+
severity: odata_annotation_core_types_1.DiagnosticSeverity.Error,
|
|
216
|
+
data: {
|
|
217
|
+
caseCheck: {
|
|
218
|
+
value: currentValue,
|
|
219
|
+
proposedValue: expectedName,
|
|
220
|
+
lookupPath: [],
|
|
221
|
+
isNamespacedValue: false
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
state.addDiagnostic(diagnostic);
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Gets a boolean indicating whether the provided value property is a value container based on the visitor state.
|
|
232
|
+
*
|
|
233
|
+
* @param state - The visitor state.
|
|
234
|
+
* @param valueProperty - The value property to check.
|
|
235
|
+
* @returns True if the value property is a value container, false otherwise.
|
|
236
|
+
*/
|
|
237
|
+
function getIsValueContainer(state, valueProperty) {
|
|
238
|
+
const typeInfo = state.context.valueType ? state.vocabularyService.getType(state.context.valueType) : undefined;
|
|
239
|
+
return (valueProperty !== undefined ||
|
|
240
|
+
(state.context.valueType !== undefined &&
|
|
241
|
+
((typeInfo === null || typeInfo === void 0 ? void 0 : typeInfo.kind) !== 'ComplexType' || state.context.isCollection === true)));
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/record.ts"],"names":[],"mappings":";;;AAAA,yEAAgH;AAIhH,qFAM6C;AAE7C,wCAAqC;AAIrC,yCAA4C;AAE/B,QAAA,aAAa,GAAwB;IAC9C,IAAI,EAAE,mCAAW;IACjB,WAAW;IACX,OAAO,CAAC,KAAmB,EAAE,IAAY;;QACrC,MAAM,OAAO,GAAY,IAAA,+CAAiB,EAAC;YACvC,IAAI,2BAAY;YAChB,KAAK,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,IAAI,CAAC;YAC5B,YAAY,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,KAAK,CAAC;SACvC,CAAC,CAAC;QACH,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEjG,MAAM,YAAY,GAAG,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClE,MAAM,YAAY,GAAG,eAAe,C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I,MAAK,aAAa,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CACjF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MultiLineStringLiteral, StringLiteral } from '@sap-ux/cds-annotation-parser';
|
|
2
|
+
import type { NodeHandler } from '../handler';
|
|
3
|
+
export declare const stringHandler: NodeHandler<StringLiteral>;
|
|
4
|
+
export declare const multiLineStringHandler: NodeHandler<MultiLineStringLiteral>;
|
|
5
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,aAAa,CAGpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,sBAAsB,CAGtE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiLineStringHandler = exports.stringHandler = void 0;
|
|
4
|
+
const cds_annotation_parser_1 = require("@sap-ux/cds-annotation-parser");
|
|
5
|
+
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
|
|
6
|
+
const path_utils_1 = require("../path-utils");
|
|
7
|
+
exports.stringHandler = {
|
|
8
|
+
type: cds_annotation_parser_1.STRING_LITERAL_TYPE,
|
|
9
|
+
convert: convertString
|
|
10
|
+
};
|
|
11
|
+
exports.multiLineStringHandler = {
|
|
12
|
+
type: cds_annotation_parser_1.MULTI_LINE_STRING_LITERAL_TYPE,
|
|
13
|
+
convert: convertString
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Converts a string literal or multiline string literal node to an Element.
|
|
17
|
+
*
|
|
18
|
+
* @param state - The visitor state.
|
|
19
|
+
* @param node - The string or multiline string literal node.
|
|
20
|
+
* @returns The converted Element or undefined if the conversion is not performed.
|
|
21
|
+
*/
|
|
22
|
+
function convertString(state, node) {
|
|
23
|
+
var _a;
|
|
24
|
+
const elementName = (_a = (0, path_utils_1.pathLikeTypeElementName)(state.context.valueType)) !== null && _a !== void 0 ? _a : "String" /* Edm.String */;
|
|
25
|
+
const element = (0, odata_annotation_core_types_1.createElementNode)({
|
|
26
|
+
name: elementName,
|
|
27
|
+
range: (0, cds_annotation_parser_1.nodeRange)(node, true),
|
|
28
|
+
contentRange: (0, cds_annotation_parser_1.nodeRange)(node, false),
|
|
29
|
+
content: [(0, odata_annotation_core_types_1.createTextNode)((0, path_utils_1.unescapeText)(node.value), (0, cds_annotation_parser_1.nodeRange)(node, false), undefined, getMultiLineType(node))]
|
|
30
|
+
});
|
|
31
|
+
if (elementName !== "String" /* Edm.String */) {
|
|
32
|
+
state.addPath(node.value);
|
|
33
|
+
}
|
|
34
|
+
else if (state.context.propertyName === 'Action') {
|
|
35
|
+
// Assuming that this string is content for property Action of UI.DataFieldForAction
|
|
36
|
+
// --> add value as absolute path to trigger collection of function/action metadata
|
|
37
|
+
state.addPath('/' + node.value);
|
|
38
|
+
}
|
|
39
|
+
else if (state.context.propertyName === 'TargetProperties') {
|
|
40
|
+
state.addPath(node.value);
|
|
41
|
+
}
|
|
42
|
+
return element;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Determines the multiline type based on the provided string or multiline string literal node.
|
|
46
|
+
*
|
|
47
|
+
* @param node - The string or multiline string literal node.
|
|
48
|
+
* @returns The determined multiline type, or undefined if the node is not a multiline string literal.
|
|
49
|
+
*/
|
|
50
|
+
function getMultiLineType(node) {
|
|
51
|
+
if (node.type === cds_annotation_parser_1.STRING_LITERAL_TYPE) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return node.stripIndentation ? "StripIndentation" /* MultilineType.StripIndentation */ : "KeepIndentation" /* MultilineType.KeepIndentation */;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/string.ts"],"names":[],"mappings":";;;AACA,yEAA+G;AAG/G,qFAA4G;AAI5G,8CAAsE;AAEzD,QAAA,aAAa,GAA+B;IACrD,IAAI,EAAE,2CAAmB;IACzB,OAAO,EAAE,aAAa;CACzB,CAAC;AAEW,QAAA,sBAAsB,GAAwC;IACvE,IAAI,EAAE,sDAA8B;IACpC,OAAO,EAAE,aAAa;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAAmB,EAAE,IAA4C;;IACpF,MAAM,WAAW,GAAG,MAAA,IAAA,oCAAuB,EAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,4DAAc,CAAC;IAEnF,MAAM,OAAO,GAAY,IAAA,+CAAiB,EAAC;QACvC,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,IAAI,CAAC;QAC5B,YAAY,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,KAAK,CAAC;QACpC,OAAO,EAAE,CAAC,IAAA,4CAAc,EAAC,IAAA,yBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;KACjH,CAAC,CAAC;IAEH,IAAI,WAAW,8BAAe,EAAE;QAC5B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC7B;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,KAAK,QAAQ,EAAE;QAChD,oFAAoF;QACpF,mFAAmF;QACnF,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;KACnC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,KAAK,kBAAkB,EAAE;QAC1D,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC7B;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAA4C;IAClE,IAAI,IAAI,CAAC,IAAI,KAAK,2CAAmB,EAAE;QACnC,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,yDAAgC,CAAC,sDAA8B,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,KAAK,CAY3C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tokenHandler = void 0;
|
|
4
|
+
const cds_annotation_parser_1 = require("@sap-ux/cds-annotation-parser");
|
|
5
|
+
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types");
|
|
6
|
+
exports.tokenHandler = {
|
|
7
|
+
type: cds_annotation_parser_1.TOKEN_TYPE,
|
|
8
|
+
convert(state, node) {
|
|
9
|
+
if (node.value === 'null') {
|
|
10
|
+
return (0, odata_annotation_core_types_1.createElementNode)({
|
|
11
|
+
name: "Null" /* Edm.Null */,
|
|
12
|
+
nameRange: (0, cds_annotation_parser_1.nodeRange)(node, false),
|
|
13
|
+
range: (0, cds_annotation_parser_1.nodeRange)(node, true)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/transforms/annotation/handlers/token.ts"],"names":[],"mappings":";;;AACA,yEAAsE;AAEtE,qFAA6E;AAKhE,QAAA,YAAY,GAAuB;IAC5C,IAAI,EAAE,kCAAU;IAChB,OAAO,CAAC,KAAmB,EAAE,IAAW;QACpC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE;YACvB,OAAO,IAAA,+CAAiB,EAAC;gBACrB,IAAI,uBAAU;gBACd,SAAS,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,KAAK,CAAC;gBACjC,KAAK,EAAE,IAAA,iCAAS,EAAC,IAAI,EAAE,IAAI,CAAC;aAC/B,CAAC,CAAC;SACN;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/annotation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertAnnotation = void 0;
|
|
4
|
+
var convert_1 = require("./convert");
|
|
5
|
+
Object.defineProperty(exports, "convertAnnotation", { enumerable: true, get: function () { return convert_1.convertAnnotation; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transforms/annotation/index.ts"],"names":[],"mappings":";;;AAAA,qCAA0E;AAArC,4GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param type - The path-like type string.
|
|
4
|
+
* @returns The simplified element name or undefined if the type is not recognized.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pathLikeTypeElementName(type: string | undefined): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param input escaped text.
|
|
10
|
+
* @returns string without escaped characters.
|
|
11
|
+
*/
|
|
12
|
+
export declare function unescapeText(input: string): string;
|
|
13
|
+
//# sourceMappingURL=path-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/transforms/annotation/path-utils.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAQpF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unescapeText = exports.pathLikeTypeElementName = void 0;
|
|
4
|
+
const PATH_TYPES = new Set([
|
|
5
|
+
'Edm.AnnotationPath',
|
|
6
|
+
'Edm.ModelElementPath',
|
|
7
|
+
'Edm.NavigationPropertyPath',
|
|
8
|
+
'Edm.PropertyPath',
|
|
9
|
+
'Edm.AnyPropertyPath',
|
|
10
|
+
'Edm.Path'
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param type - The path-like type string.
|
|
15
|
+
* @returns The simplified element name or undefined if the type is not recognized.
|
|
16
|
+
*/
|
|
17
|
+
function pathLikeTypeElementName(type) {
|
|
18
|
+
if (type === undefined) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
else if (PATH_TYPES.has(type)) {
|
|
22
|
+
const result = type.split('.')[1];
|
|
23
|
+
return result === 'AnyPropertyPath' ? 'PropertyPath' : result; // TODO distinguish from 'NavigationPropertyPath' ?
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
exports.pathLikeTypeElementName = pathLikeTypeElementName;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param input escaped text.
|
|
31
|
+
* @returns string without escaped characters.
|
|
32
|
+
*/
|
|
33
|
+
function unescapeText(input) {
|
|
34
|
+
if (!input || typeof input !== 'string') {
|
|
35
|
+
return input;
|
|
36
|
+
}
|
|
37
|
+
return input.replace(/''/g, "'");
|
|
38
|
+
}
|
|
39
|
+
exports.unescapeText = unescapeText;
|
|
40
|
+
//# sourceMappingURL=path-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../../src/transforms/annotation/path-utils.ts"],"names":[],"mappings":";;;AAAA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACvB,oBAAoB;IACpB,sBAAsB;IACtB,4BAA4B;IAC5B,kBAAkB;IAClB,qBAAqB;IACrB,UAAU;CACb,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,IAAwB;IAC5D,IAAI,IAAI,KAAK,SAAS,EAAE;QACpB,OAAO,SAAS,CAAC;KACpB;SAAM,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,OAAO,MAAM,KAAK,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,mDAAmD;KACrH;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AARD,0DAQC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACrC,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AALD,oCAKC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Position, Range } from '@sap-ux/odata-annotation-core';
|
|
2
|
+
export declare const copyPosition: (position: Position) => Position;
|
|
3
|
+
export declare const copyRange: (range: Range | undefined) => Range | undefined;
|
|
4
|
+
export declare const createRange: (start: Position | undefined, end: Position | undefined) => Range | undefined;
|
|
5
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../src/transforms/annotation/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEhE,eAAO,MAAM,YAAY,aAAc,QAAQ,KAAG,QAA8D,CAAC;AAEjH,eAAO,MAAM,SAAS,UAAW,KAAK,GAAG,SAAS,KAAG,KAAK,GAAG,SAC2B,CAAC;AACzF,eAAO,MAAM,WAAW,UAAW,QAAQ,GAAG,SAAS,OAAO,QAAQ,GAAG,SAAS,KAAG,KAAK,GAAG,SACV,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRange = exports.copyRange = exports.copyPosition = void 0;
|
|
4
|
+
const odata_annotation_core_1 = require("@sap-ux/odata-annotation-core");
|
|
5
|
+
const copyPosition = (position) => odata_annotation_core_1.Position.create(position.line, position.character);
|
|
6
|
+
exports.copyPosition = copyPosition;
|
|
7
|
+
const copyRange = (range) => range ? odata_annotation_core_1.Range.create((0, exports.copyPosition)(range.start), (0, exports.copyPosition)(range.end)) : undefined;
|
|
8
|
+
exports.copyRange = copyRange;
|
|
9
|
+
const createRange = (start, end) => start && end ? odata_annotation_core_1.Range.create((0, exports.copyPosition)(start), (0, exports.copyPosition)(end)) : undefined;
|
|
10
|
+
exports.createRange = createRange;
|
|
11
|
+
//# sourceMappingURL=range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../src/transforms/annotation/range.ts"],"names":[],"mappings":";;;AAAA,yEAAgE;AAEzD,MAAM,YAAY,GAAG,CAAC,QAAkB,EAAY,EAAE,CAAC,gCAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AAApG,QAAA,YAAY,gBAAwF;AAE1G,MAAM,SAAS,GAAG,CAAC,KAAwB,EAAqB,EAAE,CACrE,KAAK,CAAC,CAAC,CAAC,6BAAK,CAAC,MAAM,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAD5E,QAAA,SAAS,aACmE;AAClF,MAAM,WAAW,GAAG,CAAC,KAA2B,EAAE,GAAyB,EAAqB,EAAE,CACrG,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,6BAAK,CAAC,MAAM,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AADvE,QAAA,WAAW,eAC4D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { VocabularyService, ComplexTypeProperty, Term } from '@sap-ux/odata-vocabularies';
|
|
2
|
+
import type { Context } from './visitor-state';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the implicit property type based on the provided vocabulary service, context, and property name.
|
|
5
|
+
*
|
|
6
|
+
* @param vocabularyService - The vocabulary service.
|
|
7
|
+
* @param context - The context containing recordType, termType, etc.
|
|
8
|
+
* @param propertyName - The name of the property for which to get the type.
|
|
9
|
+
* @returns The implicit property type or undefined if not found.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getImplicitPropertyType(vocabularyService: VocabularyService, context: Context, propertyName: string): ComplexTypeProperty | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the property type from the provided vocabulary service based on the specified record type and property name.
|
|
14
|
+
*
|
|
15
|
+
* @param vocabularyService - The vocabulary service.
|
|
16
|
+
* @param recordType - The record type for which to retrieve the property type.
|
|
17
|
+
* @param propertyName - The name of the property for which to get the type.
|
|
18
|
+
* @returns The property type or undefined if not found.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPropertyType(vocabularyService: VocabularyService, recordType: string | undefined, propertyName: string): ComplexTypeProperty | undefined;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param service - The vocabulary service.
|
|
24
|
+
* @param type - The type string to be qualified.
|
|
25
|
+
* @returns The fully qualified type string or undefined if the namespace is not found.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getFullyQualifiedType(service: VocabularyService, type: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Gets a term from the provided vocabulary service based on the specified vocabulary name or alias and term name.
|
|
30
|
+
*
|
|
31
|
+
* @param vocabularyService - The vocabulary service.
|
|
32
|
+
* @param vocabularyNameOrAlias - The name or alias of the vocabulary.
|
|
33
|
+
* @param termName - The name of the term to retrieve, if available.
|
|
34
|
+
* @returns The retrieved term or undefined if not found.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getTerm(vocabularyService: VocabularyService, vocabularyNameOrAlias: string, termName: string | undefined): Term | undefined;
|
|
37
|
+
//# sourceMappingURL=type-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-resolver.d.ts","sourceRoot":"","sources":["../../../src/transforms/annotation/type-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAE/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACnC,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,GACrB,mBAAmB,GAAG,SAAS,CASjC;AACD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,YAAY,EAAE,MAAM,GACrB,mBAAmB,GAAG,SAAS,CAOjC;AA4BD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlG;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACnB,iBAAiB,EAAE,iBAAiB,EACpC,qBAAqB,EAAE,MAAM,EAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC7B,IAAI,GAAG,SAAS,CAUlB"}
|