@sap/ux-specification 1.124.32 → 1.124.34
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/CHANGELOG.md +73 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
- package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
- package/dist/documentation/v2/v2-ListReport.html +2 -2
- package/dist/documentation/v2/v2-ListReportNew.html +2 -2
- package/dist/documentation/v2/v2-ObjectPage.html +2 -2
- package/dist/documentation/v2/v2-OverviewPage.html +2 -2
- package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
- package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
- package/dist/documentation/v4/v4-FreestylePage.html +2 -2
- package/dist/documentation/v4/v4-ListReport.html +2 -2
- package/dist/documentation/v4/v4-ObjectPage.html +2 -2
- package/dist/index-min.js +249 -250
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v2/ApplicationV2.json +28 -3
- package/dist/schemas/v2/ListReportNewConfig.json +45 -0
- package/dist/schemas/v2/ObjectPageConfig.json +11 -5
- package/dist/schemas/v4/ApplicationV4.json +12 -6
- package/dist/schemas/v4/BuildingBlocksConfig.json +34 -16
- package/dist/schemas/v4/ListReportConfig.json +34 -0
- package/dist/schemas/v4/ObjectPageConfig.json +18 -1
- package/dist/specification/package.json +18 -18
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +17 -1
- package/dist/specification/scripts/macros/corrections.js.map +1 -1
- package/dist/specification/scripts/macros/schema.d.ts.map +1 -1
- package/dist/specification/scripts/macros/schema.js +10 -1
- package/dist/specification/scripts/macros/schema.js.map +1 -1
- package/dist/specification/scripts/macros/types.d.ts +1 -0
- package/dist/specification/scripts/macros/types.d.ts.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.d.ts.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.js +23 -13
- package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
- package/dist/specification/src/api.js +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +65 -4
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +138 -8
- package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/specification/src/sync/common/distTagEvaluator.d.ts +10 -3
- package/dist/specification/src/sync/common/distTagEvaluator.d.ts.map +1 -1
- package/dist/specification/src/sync/common/distTagEvaluator.js +14 -4
- package/dist/specification/src/sync/common/distTagEvaluator.js.map +1 -1
- package/dist/specification/src/sync/common/generate/objectPage.js +3 -1
- package/dist/specification/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.d.ts +13 -4
- package/dist/specification/src/sync/common/generate/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/utils.js +35 -20
- package/dist/specification/src/sync/common/generate/utils.js.map +1 -1
- package/dist/specification/src/sync/common/i18n.json +5 -3
- package/dist/specification/src/sync/common/utils.d.ts +52 -1
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +176 -4
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/application.d.ts +1 -0
- package/dist/specification/src/sync/v2/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/application.js +18 -0
- package/dist/specification/src/sync/v2/application.js.map +1 -1
- package/dist/specification/src/sync/v2/export/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.js +15 -4
- package/dist/specification/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.js +8 -15
- package/dist/specification/src/sync/v2/export/exportPageGeneric.js.map +1 -1
- package/dist/specification/src/sync/v2/export/factory.d.ts +26 -0
- package/dist/specification/src/sync/v2/export/factory.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/factory.js +3 -3
- package/dist/specification/src/sync/v2/export/factory.js.map +1 -1
- package/dist/specification/src/sync/v2/export/pages/ObjectPage.d.ts +1 -0
- package/dist/specification/src/sync/v2/export/pages/ObjectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/pages/ObjectPage.js +11 -0
- package/dist/specification/src/sync/v2/export/pages/ObjectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js +46 -0
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.js +46 -1
- package/dist/specification/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.js +63 -13
- package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js +28 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.d.ts +22 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.d.ts.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.js +124 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.js.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js +4 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js.map +1 -1
- package/dist/specification/src/sync/v2/import/importPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/importPage.js +5 -6
- package/dist/specification/src/sync/v2/import/importPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/overviewPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/overviewPage.js +4 -0
- package/dist/specification/src/sync/v2/import/pages/overviewPage.js.map +1 -1
- package/dist/specification/src/sync/v2/utils.d.ts +17 -1
- package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/utils.js +57 -0
- package/dist/specification/src/sync/v2/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts +3 -2
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.js +14 -2
- package/dist/specification/src/sync/v4/export/controls/Header.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js +7 -2
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTableColumn.d.ts +3 -0
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTableColumn.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTableColumn.js +20 -0
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTableColumn.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.d.ts +5 -0
- package/dist/specification/src/sync/v4/export/controls/TableColumn.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js +40 -0
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js.map +1 -1
- package/dist/specification/src/sync/v4/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/export.js +11 -3
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js +2 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts +107 -0
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js +374 -0
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts +3 -3
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +10 -2
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js +9 -2
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js +2 -2
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/listReport.d.ts +100 -2
- package/dist/specification/src/sync/v4/generate/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/listReport.js +119 -100
- package/dist/specification/src/sync/v4/generate/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +7 -7
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts +141 -0
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/App.js +208 -0
- package/dist/specification/src/sync/v4/sync-rules/App.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts +193 -0
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +384 -0
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +172 -0
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +410 -0
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +70 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.js +73 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.d.ts +9 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.js +43 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.js.map +1 -0
- package/dist/specification/src/sync/v4/utils/utils.d.ts +6 -28
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +8 -55
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/types/src/common/types.d.ts +122 -1
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js +16 -1
- package/dist/types/src/common/types.js.map +1 -1
- package/dist/types/src/common/webapp/manifest/Manifest.d.ts +1 -1
- package/dist/types/src/common/webapp/manifest/Manifest.d.ts.map +1 -1
- package/dist/types/src/v2/application.d.ts +18 -0
- package/dist/types/src/v2/application.d.ts.map +1 -1
- package/dist/types/src/v2/controls/ObjectPageHeaderSection.d.ts.map +1 -1
- package/dist/types/src/v2/controls/ObjectPageTable.d.ts +4 -4
- package/dist/types/src/v2/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/types/src/v2/controls/Table.d.ts.map +1 -1
- package/dist/types/src/v2/pages/ObjectPageConfigV2.d.ts +10 -1
- package/dist/types/src/v2/pages/ObjectPageConfigV2.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageHeader.d.ts +1 -1
- package/dist/types/src/v4/controls/ObjectPageHeaderSection.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageSection.d.ts.map +1 -1
- package/dist/types/src/v4/webapp/manifest/ManifestSettings.d.ts +41 -0
- package/dist/types/src/v4/webapp/manifest/ManifestSettings.d.ts.map +1 -1
- package/dist/types/src/v4/webapp/manifest/ManifestSettings.js.map +1 -1
- package/package.json +18 -18
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppSchema = void 0;
|
|
4
|
+
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
/**
|
|
7
|
+
* Central manager for application schema lifecycle and operations.
|
|
8
|
+
* Encapsulates all schema structure knowledge and provides clean APIs for schema manipulation.
|
|
9
|
+
*/
|
|
10
|
+
class AppSchema {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor for AppSchema.
|
|
13
|
+
*
|
|
14
|
+
* @param genericSchema - The initial generic schema object
|
|
15
|
+
*/
|
|
16
|
+
constructor(genericSchema) {
|
|
17
|
+
this.schema = JSON.parse(JSON.stringify(genericSchema));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validates a property path array.
|
|
21
|
+
*
|
|
22
|
+
* @param propertyPath - The path to validate
|
|
23
|
+
* @returns true if valid, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
isValidPropertyPath(propertyPath) {
|
|
26
|
+
return (Array.isArray(propertyPath) &&
|
|
27
|
+
propertyPath.length > 0 &&
|
|
28
|
+
propertyPath.every((key) => typeof key === 'string' && key.length > 0));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolves a $ref to its actual definition.
|
|
32
|
+
*
|
|
33
|
+
* @param ref - The $ref string (e.g., "#/definitions/MyDefinition")
|
|
34
|
+
* @returns The resolved definition or undefined
|
|
35
|
+
*/
|
|
36
|
+
resolveRef(ref) {
|
|
37
|
+
if (typeof ref !== 'string' || !ref.startsWith(common_1.DEFINITION_LINK_PREFIX)) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const definitionName = ref.substring(common_1.DEFINITION_LINK_PREFIX.length);
|
|
41
|
+
return this.getDefinition(definitionName);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Navigates through an object using a property path and returns the value at that path.
|
|
45
|
+
* Automatically resolves $ref references when encountered.
|
|
46
|
+
*
|
|
47
|
+
* @param root - The root object to navigate from
|
|
48
|
+
* @param propertyPath - Array of keys forming the path
|
|
49
|
+
* @param createIntermediates - Whether to create intermediate objects if they don't exist
|
|
50
|
+
* @param resolveRefs - Whether to resolve $ref references during navigation (default: true)
|
|
51
|
+
* @returns The value at the path, or undefined if not found
|
|
52
|
+
*/
|
|
53
|
+
navigatePropertyPath(root, propertyPath, createIntermediates = false, resolveRefs = true) {
|
|
54
|
+
if (!root || !this.isValidPropertyPath(propertyPath)) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
let current = root;
|
|
58
|
+
for (let i = 0; i < propertyPath.length; i++) {
|
|
59
|
+
const key = propertyPath[i];
|
|
60
|
+
const isLastKey = i === propertyPath.length - 1;
|
|
61
|
+
if (current[key] === undefined || current[key] === null) {
|
|
62
|
+
if (createIntermediates) {
|
|
63
|
+
current[key] = {};
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Check if the current value has a $ref and resolve it
|
|
70
|
+
// When we resolve a $ref, we navigate into the resolved definition
|
|
71
|
+
// without modifying the original object
|
|
72
|
+
// Don't resolve on the last key to allow reading properties that contain $ref
|
|
73
|
+
// Only resolve if $ref is the ONLY property (pure reference)
|
|
74
|
+
if (!createIntermediates && resolveRefs && !isLastKey && current[key]?.$ref) {
|
|
75
|
+
const keys = Object.keys(current[key]);
|
|
76
|
+
const isPureRef = keys.length === 1 && keys[0] === '$ref';
|
|
77
|
+
if (isPureRef) {
|
|
78
|
+
const resolved = this.resolveRef(current[key].$ref);
|
|
79
|
+
if (resolved) {
|
|
80
|
+
// Navigate into the resolved definition without mutating original
|
|
81
|
+
current = resolved;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (typeof current[key] !== 'object') {
|
|
87
|
+
return createIntermediates ? undefined : current[key];
|
|
88
|
+
}
|
|
89
|
+
current = current[key];
|
|
90
|
+
}
|
|
91
|
+
return current;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Sets a value at a property path within an object, creating intermediate objects as needed.
|
|
95
|
+
*
|
|
96
|
+
* @param root - The root object to navigate from
|
|
97
|
+
* @param propertyPath - Array of keys forming the path
|
|
98
|
+
* @param value - The value to set
|
|
99
|
+
* @returns true if successful, false otherwise
|
|
100
|
+
*/
|
|
101
|
+
setPropertyPath(root, propertyPath, value) {
|
|
102
|
+
if (!root || !this.isValidPropertyPath(propertyPath)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
let current = root;
|
|
106
|
+
for (let i = 0; i < propertyPath.length - 1; i++) {
|
|
107
|
+
const key = propertyPath[i];
|
|
108
|
+
if (!current[key] || typeof current[key] !== 'object') {
|
|
109
|
+
current[key] = {};
|
|
110
|
+
}
|
|
111
|
+
current = current[key];
|
|
112
|
+
}
|
|
113
|
+
const finalKey = propertyPath[propertyPath.length - 1];
|
|
114
|
+
current[finalKey] = value;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets the current schema definition.
|
|
119
|
+
*
|
|
120
|
+
* @returns The schema definition
|
|
121
|
+
*/
|
|
122
|
+
getSchema() {
|
|
123
|
+
return this.schema;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets a specific definition from the schema by name.
|
|
127
|
+
*
|
|
128
|
+
* @param name - The name of the definition
|
|
129
|
+
* @returns The definition or undefined if not found
|
|
130
|
+
*/
|
|
131
|
+
getDefinition(name) {
|
|
132
|
+
if (typeof name !== 'string') {
|
|
133
|
+
return name;
|
|
134
|
+
}
|
|
135
|
+
return this.schema.definitions?.[name];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Sets a definition in the schema.
|
|
139
|
+
*
|
|
140
|
+
* @param name - The name of the definition
|
|
141
|
+
* @param definition - The definition to set
|
|
142
|
+
*/
|
|
143
|
+
setDefinition(name, definition) {
|
|
144
|
+
if (!this.schema.definitions) {
|
|
145
|
+
this.schema.definitions = {};
|
|
146
|
+
}
|
|
147
|
+
this.schema.definitions[name] = definition;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Deletes a definition from the schema.
|
|
151
|
+
*
|
|
152
|
+
* @param name - The name of the definition to delete
|
|
153
|
+
*/
|
|
154
|
+
deleteDefinition(name) {
|
|
155
|
+
if (this.schema.definitions?.[name]) {
|
|
156
|
+
delete this.schema.definitions[name];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Gets a root level property by path.
|
|
161
|
+
*
|
|
162
|
+
* @param propertyPath - Array of property names forming the path
|
|
163
|
+
* @returns The property definition or undefined
|
|
164
|
+
*/
|
|
165
|
+
getRootProperty(propertyPath) {
|
|
166
|
+
if (!this.schema.properties || !this.isValidPropertyPath(propertyPath)) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
return this.navigatePropertyPath(this.schema.properties, propertyPath);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Gets a property in a definition by path.
|
|
173
|
+
*
|
|
174
|
+
* @param definition - The definition object
|
|
175
|
+
* @param propertyPath - Array of property names forming the path
|
|
176
|
+
* @returns The property definition or undefined
|
|
177
|
+
*/
|
|
178
|
+
getProperty(definition, propertyPath) {
|
|
179
|
+
// If no property path is provided, return the entire definition
|
|
180
|
+
if (!propertyPath) {
|
|
181
|
+
return definition;
|
|
182
|
+
}
|
|
183
|
+
// If property path is invalid, return undefined
|
|
184
|
+
if (!this.isValidPropertyPath(propertyPath)) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
return this.navigatePropertyPath(definition, propertyPath);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Sets a property in a definition using a path.
|
|
191
|
+
*
|
|
192
|
+
* @param definition - The definition name (string) or definition object
|
|
193
|
+
* @param propertyPath - The path to the property (optional)
|
|
194
|
+
* @param value - The value to set
|
|
195
|
+
*/
|
|
196
|
+
setProperty(definition, propertyPath, value) {
|
|
197
|
+
if (typeof definition === 'string') {
|
|
198
|
+
definition = this.getDefinition(definition);
|
|
199
|
+
}
|
|
200
|
+
this.setPropertyPath(definition, propertyPath, value);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Removes a property in a definition using a path.
|
|
204
|
+
*
|
|
205
|
+
* @param definition - The definition object
|
|
206
|
+
* @param value - The value to set
|
|
207
|
+
*/
|
|
208
|
+
removeProperty(definition, value) {
|
|
209
|
+
if (!definition) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
delete definition[value];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Sets a schema tag on a definition.
|
|
216
|
+
*
|
|
217
|
+
* @param definitionName - The name of the definition
|
|
218
|
+
* @param tag - The schema tag to set
|
|
219
|
+
* @param value - The value for the tag
|
|
220
|
+
*/
|
|
221
|
+
setDefinitionTag(definitionName, tag, value) {
|
|
222
|
+
const definition = this.getDefinition(definitionName);
|
|
223
|
+
if (definition) {
|
|
224
|
+
definition[tag] = value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Sets a schema tag on a property using a path.
|
|
229
|
+
*
|
|
230
|
+
* @param definitionOrString - The definition or name of the definition that should contain the property
|
|
231
|
+
* @param tagOrProperty - The tag info or property path
|
|
232
|
+
* @param tag - The tag info (if property path is provided)
|
|
233
|
+
*/
|
|
234
|
+
setPropertyTag(definitionOrString, tagOrProperty, tag) {
|
|
235
|
+
const definition = this.getDefinition(definitionOrString);
|
|
236
|
+
let property = definition;
|
|
237
|
+
if (tag && tagOrProperty instanceof Array) {
|
|
238
|
+
// called with propertyPath
|
|
239
|
+
property = this.getProperty(definition, tagOrProperty);
|
|
240
|
+
}
|
|
241
|
+
const tagInfo = tag ? tag : tagOrProperty;
|
|
242
|
+
if (property && typeof property === 'object') {
|
|
243
|
+
property[tagInfo.name] = tagInfo.value;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Hides a property or definition by setting the hidden tag.
|
|
248
|
+
*
|
|
249
|
+
* @param definition - The definition or name of the definition that should contain the property
|
|
250
|
+
* @param propertyPath - The path to the property (optional)
|
|
251
|
+
*/
|
|
252
|
+
hide(definition, propertyPath) {
|
|
253
|
+
this.setPropertyTag(definition, propertyPath, { name: ux_specification_types_1.SchemaTag.hidden, value: true });
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Creates a reference to a definition.
|
|
257
|
+
*
|
|
258
|
+
* @param definitionName - The name of the definition to reference
|
|
259
|
+
* @returns The $ref string
|
|
260
|
+
*/
|
|
261
|
+
createDefinitionRef(definitionName) {
|
|
262
|
+
return `${common_1.DEFINITION_LINK_PREFIX}${definitionName}`;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Sets a property to reference a definition using a path.
|
|
266
|
+
*
|
|
267
|
+
* @param definitionOrString - The definition or name of the definition that should contain the property
|
|
268
|
+
* @param propertyPath - The path to the property
|
|
269
|
+
* @param targetDefinitionName - The name of the definition to reference
|
|
270
|
+
*/
|
|
271
|
+
setPropertyRef(definitionOrString, propertyPath, targetDefinitionName) {
|
|
272
|
+
this.setPropertyTag(definitionOrString, propertyPath, {
|
|
273
|
+
name: '$ref',
|
|
274
|
+
value: this.createDefinitionRef(targetDefinitionName)
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Sets a reference for a definition without a path.
|
|
279
|
+
*
|
|
280
|
+
* @param definitionOrString - The definition or name of the definition that should contain the property
|
|
281
|
+
* @param targetDefinitionName - The name of the definition to reference
|
|
282
|
+
*/
|
|
283
|
+
setDefinitionRef(definitionOrString, targetDefinitionName) {
|
|
284
|
+
this.setPropertyTag(definitionOrString, {
|
|
285
|
+
name: '$ref',
|
|
286
|
+
value: this.createDefinitionRef(targetDefinitionName)
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Adds an enum to a definition property using a path.
|
|
291
|
+
* If there is only one enum value, adds a 'const' property instead of 'enum'.
|
|
292
|
+
*
|
|
293
|
+
* @param definitionName - The name of the definition
|
|
294
|
+
* @param propertyPath - Array of property names forming the path
|
|
295
|
+
* @param enumValues - Array of enum values to add
|
|
296
|
+
*/
|
|
297
|
+
addEnumToSchema(definitionName, propertyPath, enumValues) {
|
|
298
|
+
const definition = this.getDefinition(definitionName);
|
|
299
|
+
if (!definition || !this.isValidPropertyPath(propertyPath) || enumValues.length === 0) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
// Determine whether to use 'const' (single value) or 'enum' (multiple values)
|
|
303
|
+
const propertyName = enumValues.length === 1 ? 'const' : 'enum';
|
|
304
|
+
const propertyValue = enumValues.length === 1 ? enumValues[0] : enumValues;
|
|
305
|
+
// If the path ends with 'enum', set the value directly at that path
|
|
306
|
+
// Otherwise, navigate to the property and add enum/const to it
|
|
307
|
+
if (propertyPath[propertyPath.length - 1] === 'enum') {
|
|
308
|
+
// Path ends with 'enum', set it directly
|
|
309
|
+
let current = definition;
|
|
310
|
+
for (let i = 0; i < propertyPath.length - 1; i++) {
|
|
311
|
+
const key = propertyPath[i];
|
|
312
|
+
if (!current[key]) {
|
|
313
|
+
current[key] = {};
|
|
314
|
+
}
|
|
315
|
+
current = current[key];
|
|
316
|
+
}
|
|
317
|
+
current[propertyName] = propertyValue;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
// Path doesn't end with 'enum', navigate to the property and add enum/const to it
|
|
321
|
+
let current = definition;
|
|
322
|
+
for (const key of propertyPath) {
|
|
323
|
+
if (!current[key]) {
|
|
324
|
+
current[key] = {};
|
|
325
|
+
}
|
|
326
|
+
current = current[key];
|
|
327
|
+
}
|
|
328
|
+
current[propertyName] = propertyValue;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Clones a definition with a new name.
|
|
333
|
+
*
|
|
334
|
+
* @param sourceName - The name of the source definition to clone
|
|
335
|
+
* @param targetName - The name for the cloned definition
|
|
336
|
+
* @returns The cloned definition or undefined if source doesn't exist
|
|
337
|
+
*/
|
|
338
|
+
cloneDefinition(sourceName, targetName) {
|
|
339
|
+
const source = this.getDefinition(sourceName);
|
|
340
|
+
if (source) {
|
|
341
|
+
const clone = structuredClone(source);
|
|
342
|
+
this.setDefinition(targetName, clone);
|
|
343
|
+
return clone;
|
|
344
|
+
}
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Updates property indices for ordering.
|
|
349
|
+
*
|
|
350
|
+
* @param order - Array of property names in the desired order
|
|
351
|
+
* @param definitionName - Optional definition name (if not provided, updates root schema properties)
|
|
352
|
+
*/
|
|
353
|
+
updatePropertyIndices(order, definitionName) {
|
|
354
|
+
const definition = definitionName ? this.getDefinition(definitionName) : this.getSchema();
|
|
355
|
+
if (!definition?.properties) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
order.forEach((propertyName, index) => {
|
|
359
|
+
const property = definition.properties[propertyName];
|
|
360
|
+
if (property && typeof property === 'object') {
|
|
361
|
+
property[ux_specification_types_1.SchemaTag.propertyIndex] = index;
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Performs cleanup operations on the schema.
|
|
367
|
+
*
|
|
368
|
+
* @param definitionsToDelete - Array of definition names to delete
|
|
369
|
+
*/
|
|
370
|
+
cleanup(definitionsToDelete) {
|
|
371
|
+
definitionsToDelete.forEach((name) => this.deleteDefinition(name));
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Finalizes and returns the schema.
|
|
375
|
+
* This method can be used as the final step in schema generation.
|
|
376
|
+
*
|
|
377
|
+
* @returns The finalized schema definition
|
|
378
|
+
*/
|
|
379
|
+
finalize() {
|
|
380
|
+
return this.schema;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
exports.AppSchema = AppSchema;
|
|
384
|
+
//# sourceMappingURL=AppSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppSchema.js","sourceRoot":"","sources":["../../../../../../src/sync/v4/sync-rules/AppSchema.ts"],"names":[],"mappings":";;;AACA,wEAAwE;AACxE,yCAAsD;AAOtD;;;GAGG;AACH,MAAa,SAAS;IAGlB;;;;OAIG;IACH,YAAY,aAAqB;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAe,CAAC;IAC1E,CAAC;IAED;;;;;OAKG;IACK,mBAAmB,CAAC,YAAkC;QAC1D,OAAO,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AAQ,KAAK,QAAQ,EAAE,CAAC;gBAC3C,QAAQ,CAAC,kCAAS,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;YAC9C,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,mBAA6B;QACjC,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CACJ;AA5aD,8BA4aC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { Definition } from 'typescript-json-schema';
|
|
2
|
+
export interface Base {
|
|
3
|
+
name: string;
|
|
4
|
+
definition: Definition;
|
|
5
|
+
}
|
|
6
|
+
export declare class BaseClass {
|
|
7
|
+
private appSchema;
|
|
8
|
+
private base;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of BaseClass.
|
|
11
|
+
*
|
|
12
|
+
* @param appSchema - The application schema definition
|
|
13
|
+
*/
|
|
14
|
+
constructor(appSchema?: Definition);
|
|
15
|
+
/**
|
|
16
|
+
* Gets the class name.
|
|
17
|
+
*
|
|
18
|
+
* @returns The name of the class
|
|
19
|
+
*/
|
|
20
|
+
getClassName(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the base name.
|
|
23
|
+
*
|
|
24
|
+
* @returns The base name
|
|
25
|
+
*/
|
|
26
|
+
getBaseName(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the base definition.
|
|
29
|
+
*
|
|
30
|
+
* @returns The base definition
|
|
31
|
+
*/
|
|
32
|
+
getBase(): Definition;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the base definition and name.
|
|
35
|
+
*
|
|
36
|
+
* @param base - The base object containing name and definition
|
|
37
|
+
*/
|
|
38
|
+
setBase(base: Base): void;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the definitions from the app schema.
|
|
41
|
+
*
|
|
42
|
+
* @returns The definitions object or undefined
|
|
43
|
+
*/
|
|
44
|
+
getDefinitions(): Definition | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Creates an annotation path for schema based on entity type, term, and qualifier.
|
|
47
|
+
*
|
|
48
|
+
* @param entityTypeName - Entity type name.
|
|
49
|
+
* @param term - Annotation term.
|
|
50
|
+
* @param qualifier - Annotation qualifier (optional).
|
|
51
|
+
* @returns Annotation path based on received params
|
|
52
|
+
*/
|
|
53
|
+
createAnnotationPath(entityTypeName: string, term: string, qualifier?: string): string | undefined;
|
|
54
|
+
}
|
|
55
|
+
export declare class Decorator extends BaseClass {
|
|
56
|
+
/**
|
|
57
|
+
* Reference to the parent decorator instance.
|
|
58
|
+
* Used by @dependsOn decorator to support parent property access via '../' syntax.
|
|
59
|
+
*/
|
|
60
|
+
private __parent__?;
|
|
61
|
+
/**
|
|
62
|
+
* Sets the parent decorator instance for this object.
|
|
63
|
+
* This enables nested decorators to access parent properties using the '../' prefix in @dependsOn.
|
|
64
|
+
*
|
|
65
|
+
* @param parent - The parent Decorator instance
|
|
66
|
+
* @returns this (for method chaining)
|
|
67
|
+
*/
|
|
68
|
+
setParent(parent: Decorator): this;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the parent decorator instance if it exists.
|
|
71
|
+
*
|
|
72
|
+
* @returns The parent Decorator instance or undefined
|
|
73
|
+
*/
|
|
74
|
+
getParent(): Decorator | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Helper method to get property value from an object using a property path.
|
|
77
|
+
* Supports simple property names (e.g., 'visualFilters'), nested paths (e.g., 'settings.enabled'),
|
|
78
|
+
* and parent traversal (e.g., '../type' to access parent object's type property).
|
|
79
|
+
*
|
|
80
|
+
* @param syncInstance - The object instance to retrieve the property value from
|
|
81
|
+
* @param propertyPath - The property path (e.g., 'visualFilters', 'settings.enabled', or '../type')
|
|
82
|
+
* @returns Object containing the final key and its value, or undefined if not found
|
|
83
|
+
*/
|
|
84
|
+
private getPropertyKeyValue;
|
|
85
|
+
/**
|
|
86
|
+
* Evaluates a single dependency condition.
|
|
87
|
+
*
|
|
88
|
+
* @param condition - The single condition to evaluate
|
|
89
|
+
* @param condition.path - The property path to check
|
|
90
|
+
* @param condition.dependsOn - Optional custom condition function
|
|
91
|
+
* @param condition.expectedValue - Optional expected value for equality check
|
|
92
|
+
* @param syncRuleProviderInstance - The sync rule provider instance
|
|
93
|
+
* @returns Object containing whether condition passed and the dependency value
|
|
94
|
+
*/
|
|
95
|
+
private evaluateSingleCondition;
|
|
96
|
+
/**
|
|
97
|
+
* Helper method to add a message to the schema property based on value condition.
|
|
98
|
+
*
|
|
99
|
+
* @param condition - EnumValueCondition object containing condition details
|
|
100
|
+
* @param syncRuleProviderInstance - The instance of the sync rule provider
|
|
101
|
+
* @param definition - The schema property definition
|
|
102
|
+
* @param i18nProperties - i18n properties for message translation
|
|
103
|
+
* @param i18nProperties.propertyName - The property name for the message
|
|
104
|
+
* @param i18nProperties.context - The context for the message
|
|
105
|
+
*/
|
|
106
|
+
private addConditionalMessage;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the context message from evaluation results.
|
|
109
|
+
*
|
|
110
|
+
* @param results - The evaluation results
|
|
111
|
+
* @returns The context message string
|
|
112
|
+
*/
|
|
113
|
+
private getContextForMessage;
|
|
114
|
+
/**
|
|
115
|
+
* Applies the dependsOn decorator to the schema definition.
|
|
116
|
+
*
|
|
117
|
+
* @param schemaDefinition - The schema definition to apply the decorator to
|
|
118
|
+
* @param syncRuleProviderInstance - The sync rule provider instance
|
|
119
|
+
*/
|
|
120
|
+
private applyDependsOnDecorator;
|
|
121
|
+
/**
|
|
122
|
+
* Gets the validity metadata for a property.
|
|
123
|
+
*
|
|
124
|
+
* @param target - The target object
|
|
125
|
+
* @param propertyName - The property name
|
|
126
|
+
* @returns The validity metadata or undefined
|
|
127
|
+
*/
|
|
128
|
+
private getValidityMetadata;
|
|
129
|
+
/**
|
|
130
|
+
* Applies the validity decorator to the schema definition based on the sync rule provider instance and minimum UI5 version.
|
|
131
|
+
*
|
|
132
|
+
* @param schemaDefinition The schema definition to apply the validity decorator to
|
|
133
|
+
* @param syncRuleProviderInstance The instance of the sync rule provider
|
|
134
|
+
* @param minUI5Version The minimum UI5 version to consider for validity checks
|
|
135
|
+
*/
|
|
136
|
+
private applyValidityDecorator;
|
|
137
|
+
/**
|
|
138
|
+
* Applies the isViewNode decorator to the schema definition based on the target and property name.
|
|
139
|
+
*
|
|
140
|
+
* @param schemaDefinition The schema definition to apply the isViewNode decorator to
|
|
141
|
+
* @param target The target object or function
|
|
142
|
+
* @param propertyName The property name (optional)
|
|
143
|
+
*/
|
|
144
|
+
private applyIsViewNodeDecorator;
|
|
145
|
+
/**
|
|
146
|
+
* Applies the description decorator to the schema definition.
|
|
147
|
+
*
|
|
148
|
+
* @param schemaDefinition - The schema definition to apply the decorator to
|
|
149
|
+
* @param target - The target object or function
|
|
150
|
+
* @param propertyName - The property name (optional)
|
|
151
|
+
*/
|
|
152
|
+
private applyDescriptionDecorator;
|
|
153
|
+
/**
|
|
154
|
+
* Applies the hidden decorator to the schema definition.
|
|
155
|
+
*
|
|
156
|
+
* @param schemaDefinition - The schema definition to apply the decorator to
|
|
157
|
+
* @param target - The target object or function
|
|
158
|
+
* @param propertyName - The property name (optional)
|
|
159
|
+
*/
|
|
160
|
+
private applyHiddenDecorator;
|
|
161
|
+
/**
|
|
162
|
+
* Applies all decorators to the schema definition.
|
|
163
|
+
*
|
|
164
|
+
* @param minUi5Version - The minimum UI5 version (optional)
|
|
165
|
+
* @param propertyName - The property name (optional)
|
|
166
|
+
* @returns Object containing the definition
|
|
167
|
+
*/
|
|
168
|
+
applyDecorators(minUi5Version?: string, propertyName?: string): {
|
|
169
|
+
definition: Definition;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=DecoratorClass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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