@sap-ux/annotation-generator 0.1.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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/Readme.md ADDED
@@ -0,0 +1,83 @@
1
+ # Fiori Annotation Generator API
2
+
3
+ Reads annotations for a service in a SAP Fiori Elements project with local metadata. Allows generation of annotations for generation of new Fiori Elements apps.
4
+
5
+ ## Installation
6
+ Npm
7
+ `npm install --save @sap-ux/annotation-generator`
8
+
9
+ Yarn
10
+ `yarn add @sap-ux/annotation-generator`
11
+
12
+ Pnpm
13
+ `pnpm add @sap-ux/annotation-generator`
14
+
15
+ ## Usage
16
+
17
+ Annotation generation example with SAP CAP CDS project:
18
+
19
+ ```typescript
20
+ import { join } from 'path';
21
+ import { create as createStore } from 'mem-fs';
22
+ import { create as createEditor } from 'mem-fs-editor';
23
+ import type { Editor } from 'mem-fs-editor';
24
+
25
+ import { getProject } from '@sap-ux/project-access';
26
+
27
+ import type { AnnotationServiceParameters, GenerateAnnotationsOptions } from '@sap-ux/annotation-generator';
28
+ import { generateAnnotations} from '@sap-ux/annotation-generator';
29
+
30
+ const project = await getProject(projectRootFolder);
31
+ const fs = createEditor(createStore());
32
+
33
+ const appName = 'app/project1';
34
+ const serviceParameters: AnnotationServiceParameters = {
35
+ project,
36
+ serviceName: 'MainService',
37
+ appName
38
+ };
39
+
40
+ const options: GenerateAnnotationsOptions = {
41
+ entitySetName: 'Capex',
42
+ annotationFilePath: join(appName, 'annotations.cds'),
43
+ addValueHelps: true,
44
+ addFacets: true,
45
+ addLineItems: true
46
+ };
47
+ await generateAnnotations(fs, serviceParameters, options);
48
+ ```
49
+
50
+ Annotation generation example with standalone UI project and OData backend:
51
+
52
+ ```typescript
53
+ import { join } from 'path';
54
+ import { create as createStore } from 'mem-fs';
55
+ import { create as createEditor } from 'mem-fs-editor';
56
+ import type { Editor } from 'mem-fs-editor';
57
+
58
+ import { getProject } from '@sap-ux/project-access';
59
+
60
+ import type { AnnotationServiceParameters, GenerateAnnotationsOptions } from '@sap-ux/annotation-generator';
61
+ import { generateAnnotations} from '@sap-ux/annotation-generator';
62
+
63
+ const project = await getProject(projectRootFolder);
64
+ const fs = createEditor(createStore());
65
+
66
+ const serviceParameters: AnnotationServiceParameters = {
67
+ project,
68
+ serviceName: 'mainService',
69
+ };
70
+
71
+ const options: GenerateAnnotationsOptions = {
72
+ entitySetName: 'Individual',
73
+ annotationFilePath: join('webapp', 'annotations', 'annotation.xml'),
74
+ addValueHelps: true,
75
+ addFacets: true,
76
+ addLineItems: true
77
+ };
78
+ await generateAnnotations(fs, serviceParameters, options);
79
+ ```
80
+
81
+
82
+ ## Keywords
83
+ OData annotations, app generation
@@ -0,0 +1,51 @@
1
+ import type { Project } from '@sap-ux/project-access';
2
+ import type { Editor } from 'mem-fs-editor';
3
+ export type AnnotationServiceParameters = {
4
+ /**
5
+ * Path to project root folder or project instance.
6
+ */
7
+ project: string | Project;
8
+ /**
9
+ * Name of the service.
10
+ */
11
+ serviceName: string;
12
+ /**
13
+ * Name of the app.
14
+ */
15
+ appName?: string;
16
+ };
17
+ /**
18
+ * Generate annotations options.
19
+ */
20
+ export type GenerateAnnotationsOptions = {
21
+ /**
22
+ * Name of entity set which is the basis for List Report/Object Page.
23
+ */
24
+ entitySetName: string;
25
+ /**
26
+ * Relative path (from project root) to the local annotation file, where annotations should be generated.
27
+ */
28
+ annotationFilePath: string;
29
+ /**
30
+ * Generate default facets (UI.Facets and UI.FieldGroup annotations for Object Page).
31
+ */
32
+ addFacets?: boolean;
33
+ /**
34
+ * Generate default line items (UI.LineItem annotation for List Report).
35
+ */
36
+ addLineItems?: boolean;
37
+ /**
38
+ * Generate value helps (Common.ValueList annotation for Value Helps).
39
+ */
40
+ addValueHelps?: boolean;
41
+ };
42
+ /**
43
+ * Generate annotations - for usage during app generation.
44
+ *
45
+ * @param fs - In memory file system editor.
46
+ * @param annotationServiceParams - Parameters for creating annotation service instance.
47
+ * @param options - Annotation generation options.
48
+ * @returns true if annotations were generated.
49
+ */
50
+ export declare function generateAnnotations(fs: Editor, annotationServiceParams: AnnotationServiceParameters, options: GenerateAnnotationsOptions): Promise<boolean>;
51
+ //# sourceMappingURL=generation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation.d.ts","sourceRoot":"","sources":["../src/generation.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAoC5C,MAAM,MAAM,2BAA2B,GAAG;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACrC,EAAE,EAAE,MAAM,EACV,uBAAuB,EAAE,2BAA2B,EACpD,OAAO,EAAE,0BAA0B,GACpC,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
@@ -0,0 +1,560 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.generateAnnotations = void 0;
13
+ const fiori_annotation_api_1 = require("@sap-ux/fiori-annotation-api");
14
+ const project_access_1 = require("@sap-ux/project-access");
15
+ const annotation_converter_1 = require("@sap-ux/annotation-converter");
16
+ const path_1 = require("path");
17
+ const url_1 = require("url");
18
+ const utils_1 = require("./utils");
19
+ const draftSpecificFields = ['IsActiveEntity', 'HasActiveEntity', 'HasDraftEntity'];
20
+ const commonNodeModulePath = (0, path_1.join)('node_modules', '@sap', 'cds', 'common.cds');
21
+ const managedProperties = ['createdAt', 'createdBy', 'modifiedAt', 'modifiedBy'];
22
+ const FACETS_PROP_NAME_LABEL = 'Label';
23
+ const FACETS_PROP_NAME_ID = 'ID';
24
+ const FACETS_PROP_NAME_TARGET = 'Target';
25
+ const FIELD_GROUP_PROP_NAME_DATA = 'Data';
26
+ const DATA_FIELD_PROP_NAME_VALUE = 'Value';
27
+ const DATA_FIELD_PROP_NAME_LABEL = 'Label';
28
+ const VALUE_LIST_PROP_NAME_COLLECTION_PATH = 'CollectionPath';
29
+ const VALUE_LIST_PROP_NAME_PARAMETERS = 'Parameters';
30
+ const VALUE_LIST_PROP_NAME_LOCAL_DATA_PROPERTY = 'LocalDataProperty';
31
+ const VALUE_LIST_PROP_NAME_VALUE_LIST_PROPERTY = 'ValueListProperty';
32
+ /**
33
+ * Generate annotations - for usage during app generation.
34
+ *
35
+ * @param fs - In memory file system editor.
36
+ * @param annotationServiceParams - Parameters for creating annotation service instance.
37
+ * @param options - Annotation generation options.
38
+ * @returns true if annotations were generated.
39
+ */
40
+ function generateAnnotations(fs, annotationServiceParams, options) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ let annotationsGenerated = false;
43
+ const { entitySetName, annotationFilePath, addFacets, addLineItems, addValueHelps } = options;
44
+ const context = yield getContext(fs, entitySetName, annotationFilePath, annotationServiceParams);
45
+ if (addFacets) {
46
+ const generated = yield generateDefaultFacets(context);
47
+ annotationsGenerated = annotationsGenerated || generated;
48
+ }
49
+ if (addLineItems) {
50
+ const generated = yield generateDefaultLineItem(context);
51
+ annotationsGenerated = annotationsGenerated || generated;
52
+ }
53
+ if (addValueHelps) {
54
+ const generated = yield generateValueHelps(context);
55
+ annotationsGenerated = annotationsGenerated || generated;
56
+ }
57
+ return annotationsGenerated;
58
+ });
59
+ }
60
+ exports.generateAnnotations = generateAnnotations;
61
+ function adaptProject(projectOrRoot) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (typeof projectOrRoot === 'string') {
64
+ // On Windows platform when called from the Application Wizard the root path may contain lowercase drive letter
65
+ // This causes annotation generation error in Fiori annotation API, thus needs adaptation
66
+ const root = (0, utils_1.adaptFilePath)(projectOrRoot);
67
+ return yield (0, project_access_1.getProject)(root);
68
+ }
69
+ else {
70
+ return projectOrRoot;
71
+ }
72
+ });
73
+ }
74
+ function getContext(fs, entitySetName, annotationFilePath, annotationServiceParams) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const { project, serviceName, appName } = annotationServiceParams;
77
+ const projectInstance = yield adaptProject(project);
78
+ const annotationService = yield fiori_annotation_api_1.FioriAnnotationService.createService(projectInstance, serviceName, appName !== null && appName !== void 0 ? appName : '', fs, {
79
+ commitOnSave: false,
80
+ clearFileResolutionCache: true
81
+ });
82
+ yield annotationService.sync();
83
+ const convertedSchema = (0, annotation_converter_1.convert)(annotationService.getSchema());
84
+ const metadataService = annotationService.getMetadataService();
85
+ const { entityType, entityTypeName } = findEntityType(convertedSchema, entitySetName);
86
+ return {
87
+ annotationService,
88
+ annotationFilePath,
89
+ project: projectInstance,
90
+ metadataService,
91
+ convertedSchema,
92
+ entityTypeName,
93
+ entityType
94
+ };
95
+ });
96
+ }
97
+ /**
98
+ * Generate UI.Facets annotation:
99
+ * - containing single ReferenceFacet referencing a UI.FieldGroup
100
+ * - the UI.FieldGroup contains a list of UI.DataFields determined based on some heuristics
101
+ *
102
+ * For an V4 Object Page this will result in a Form Section containing these Fields.
103
+ *
104
+ * @param context - Generation context.
105
+ * @returns True if annotations were generated successfully and false if they already exist.
106
+ */
107
+ function generateDefaultFacets(context) {
108
+ var _a;
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ let exception;
111
+ try {
112
+ const { annotationService, annotationFilePath, project, entityType, entityTypeName } = context;
113
+ const existingFacets = (_a = entityType.annotations.UI) === null || _a === void 0 ? void 0 : _a.Facets;
114
+ if (existingFacets) {
115
+ return false; // UI.Facets already exist
116
+ }
117
+ const fieldGroup = generateFieldGroup(context);
118
+ const facetsAnnotation = {
119
+ term: "com.sap.vocabularies.UI.v1.Facets" /* UIAnnotationTerms.Facets */,
120
+ collection: []
121
+ };
122
+ // add new facet to UI.Facets
123
+ const facet = {
124
+ type: "com.sap.vocabularies.UI.v1.ReferenceFacet" /* UIAnnotationTypes.ReferenceFacet */,
125
+ propertyValues: [
126
+ { name: FACETS_PROP_NAME_ID, value: { type: 'String', String: 'GeneratedFacet1' } },
127
+ { name: FACETS_PROP_NAME_LABEL, value: { type: 'String', String: 'General Information' } },
128
+ {
129
+ name: FACETS_PROP_NAME_TARGET,
130
+ value: {
131
+ type: 'AnnotationPath',
132
+ AnnotationPath: `@${fieldGroup.term}#${fieldGroup.qualifier}`
133
+ }
134
+ }
135
+ ]
136
+ };
137
+ facetsAnnotation.collection.push(facet);
138
+ const uri = (0, url_1.pathToFileURL)((0, path_1.join)(project.root, annotationFilePath)).toString();
139
+ const changes = [
140
+ {
141
+ uri,
142
+ kind: fiori_annotation_api_1.ChangeType.InsertAnnotation,
143
+ content: {
144
+ target: entityTypeName,
145
+ type: 'annotation',
146
+ value: fieldGroup
147
+ }
148
+ },
149
+ {
150
+ uri,
151
+ kind: fiori_annotation_api_1.ChangeType.InsertAnnotation,
152
+ content: {
153
+ target: entityTypeName,
154
+ type: 'annotation',
155
+ value: facetsAnnotation
156
+ }
157
+ }
158
+ ];
159
+ annotationService.edit(changes);
160
+ yield annotationService.save();
161
+ return true;
162
+ }
163
+ catch (e) {
164
+ exception = e instanceof fiori_annotation_api_1.ApiError ? e : new fiori_annotation_api_1.ApiError(`Generating sections failed. ${e}`);
165
+ throw exception;
166
+ }
167
+ });
168
+ }
169
+ function findEntitySet(convertedSchema, entityTypeName) {
170
+ var _a;
171
+ const entitySet = convertedSchema.entitySets.find((entitySet) => {
172
+ return entitySet.entityTypeName === entityTypeName;
173
+ });
174
+ return (_a = entitySet === null || entitySet === void 0 ? void 0 : entitySet.name) !== null && _a !== void 0 ? _a : '';
175
+ }
176
+ function findEntityType(convertedSchema, entitySetName) {
177
+ var _a, _b;
178
+ const entityTypeName = (_b = (_a = convertedSchema.entitySets.by_name(entitySetName)) === null || _a === void 0 ? void 0 : _a.entityTypeName) !== null && _b !== void 0 ? _b : '';
179
+ if (!entityTypeName) {
180
+ throw new fiori_annotation_api_1.ApiError(`Entity set not found: ${entitySetName}`, fiori_annotation_api_1.ApiErrorCode.General);
181
+ }
182
+ const entityType = convertedSchema.entityTypes.by_name(entityTypeName);
183
+ if (!entityType) {
184
+ throw new fiori_annotation_api_1.ApiError(`Entity type not found: ${entityTypeName}`, fiori_annotation_api_1.ApiErrorCode.General);
185
+ }
186
+ return { entityType, entityTypeName };
187
+ }
188
+ function generateFieldGroup(context) {
189
+ var _a, _b;
190
+ const dataFieldRecords = getDataFieldRecordCollection(context);
191
+ const fieldGroupAnnotation = {
192
+ term: "com.sap.vocabularies.UI.v1.FieldGroup" /* UIAnnotationTerms.FieldGroup */,
193
+ qualifier: '',
194
+ record: {
195
+ type: "com.sap.vocabularies.UI.v1.FieldGroupType" /* UIAnnotationTypes.FieldGroupType */,
196
+ propertyValues: [
197
+ { name: FIELD_GROUP_PROP_NAME_DATA, value: { type: 'Collection', Collection: dataFieldRecords } }
198
+ ]
199
+ }
200
+ };
201
+ const existingFieldGroupQualifiers = Object.keys((_b = (_a = context.entityType) === null || _a === void 0 ? void 0 : _a.annotations.UI) !== null && _b !== void 0 ? _b : {})
202
+ .filter((termQualifier) => termQualifier.startsWith('FieldGroup#'))
203
+ .map((termQualifier) => termQualifier.split('#')[1]);
204
+ const generatedQualifier = generateId(existingFieldGroupQualifiers, 'GeneratedGroup');
205
+ fieldGroupAnnotation.qualifier = generatedQualifier;
206
+ return fieldGroupAnnotation;
207
+ }
208
+ function getDataFieldRecordCollection(context, isListReport = false) {
209
+ var _a, _b, _c;
210
+ const { project, metadataService, entityType } = context;
211
+ const properties = entityType.entityProperties.filter((property) => !draftSpecificFields.includes(property.name));
212
+ const keyCount = moveKeysToBeginning(isListReport, entityType, properties);
213
+ const recordCollection = [];
214
+ for (const property of properties) {
215
+ const targetPath = `${entityType.fullyQualifiedName}/${property.name}`;
216
+ const targetElement = property;
217
+ const mdElement = metadataService.getMetadataElement(targetPath);
218
+ const type = mdElement === null || mdElement === void 0 ? void 0 : mdElement.edmPrimitiveType;
219
+ if (type === 'Edm.Guid' ||
220
+ !(type === null || type === void 0 ? void 0 : type.startsWith('Edm')) ||
221
+ (
222
+ // can't use nullish coalescing for boolean values
223
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
224
+ mdElement === null || mdElement === void 0 ? void 0 : mdElement.isCollectionValued) ||
225
+ // for CDS: no fields from sap.cds.common
226
+ ((project.projectType === 'CAPJava' || project.projectType === 'CAPNodejs') &&
227
+ isPropertyFromCommonNodeModule(property.name, (_a = mdElement === null || mdElement === void 0 ? void 0 : mdElement.location) === null || _a === void 0 ? void 0 : _a.uri))) {
228
+ continue;
229
+ }
230
+ const annotations = getAnnotations(project, entityType, property, targetPath, targetElement, mdElement);
231
+ const annotationHidden = (_b = annotations.UI) === null || _b === void 0 ? void 0 : _b.Hidden;
232
+ if (isHidden(annotationHidden)) {
233
+ continue;
234
+ }
235
+ const annotationLabel = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label;
236
+ const annotationTitle = annotations === null || annotations === void 0 ? void 0 : annotations['title'];
237
+ const hasLabel = annotationLabel !== null && annotationLabel !== void 0 ? annotationLabel : annotationTitle;
238
+ const record = {
239
+ type: "com.sap.vocabularies.UI.v1.DataField" /* UIAnnotationTypes.DataField */,
240
+ propertyValues: []
241
+ };
242
+ if (!hasLabel) {
243
+ record.propertyValues.push({
244
+ name: DATA_FIELD_PROP_NAME_LABEL,
245
+ value: { type: 'String', String: property.name }
246
+ });
247
+ }
248
+ record.propertyValues.push({
249
+ name: DATA_FIELD_PROP_NAME_VALUE,
250
+ value: { type: 'Path', Path: property.name }
251
+ });
252
+ recordCollection.push(record);
253
+ if (isListReport && recordCollection.length >= Math.max(keyCount, 5)) {
254
+ break;
255
+ }
256
+ }
257
+ return recordCollection;
258
+ }
259
+ function getAnnotations(project, entityType, property, targetPath, targetElement, mdElement) {
260
+ var _a;
261
+ let target = targetElement;
262
+ if (project.projectType === 'CAPJava' || project.projectType === 'CAPNodejs') {
263
+ const generatedProperty = property.name.split('_');
264
+ if (generatedProperty.length > 1) {
265
+ const assocName = ((_a = mdElement === null || mdElement === void 0 ? void 0 : mdElement.originalName) !== null && _a !== void 0 ? _a : '').split('.').pop();
266
+ targetPath = `${entityType.fullyQualifiedName}/${assocName}`;
267
+ const associationElement = entityType.navigationProperties.by_name(assocName !== null && assocName !== void 0 ? assocName : '');
268
+ if (associationElement) {
269
+ target = associationElement.targetType;
270
+ }
271
+ }
272
+ }
273
+ if (!target) {
274
+ throw new fiori_annotation_api_1.ApiError(`Path target not found: ${targetPath}`);
275
+ }
276
+ return target.annotations;
277
+ }
278
+ function moveKeysToBeginning(isListReport, entityType, properties) {
279
+ var _a, _b;
280
+ // for list report: move all key properties to the beginning
281
+ let keys = []; // contains semantic key properties and entities primary keys
282
+ if (isListReport) {
283
+ keys = entityType.keys.filter((key) => key.isKey).map((key) => key.name);
284
+ (_b = (_a = entityType.annotations.Common) === null || _a === void 0 ? void 0 : _a.SemanticKey) === null || _b === void 0 ? void 0 : _b.forEach((key) => (key.value ? keys.push(key.value) : undefined));
285
+ keys = Array.from(new Set([...keys])); // to remove duplicates?
286
+ keys.forEach((key) => {
287
+ const index = properties.map((sE) => sE.name).indexOf(key);
288
+ const element = properties.splice(index, 1);
289
+ properties.unshift(element[0]);
290
+ });
291
+ }
292
+ return keys.length;
293
+ }
294
+ /**
295
+ * Checks if the property belongs to common fields: 'createdAt', 'createdBy', 'modifiedAt', 'modifiedBy'.
296
+ *
297
+ * @param propName - Metadata element property name
298
+ * @param locationUri - location uri of property
299
+ * @returns True if property is one of the "managed" aspects properties.
300
+ */
301
+ function isPropertyFromCommonNodeModule(propName, locationUri) {
302
+ if (!propName || !locationUri) {
303
+ return false;
304
+ }
305
+ return managedProperties.includes(propName) && locationUri.endsWith(commonNodeModulePath);
306
+ }
307
+ function isHidden(hiddenAnno) {
308
+ if (!hiddenAnno || hiddenAnno.qualifier) {
309
+ return false;
310
+ }
311
+ return !hiddenAnno.value || (hiddenAnno.value.type === 'Bool' && hiddenAnno.value.Bool !== false);
312
+ }
313
+ /**
314
+ * Generate UI.LineItem annotation:
315
+ * - the UI.LineItem contains a list of UI.DataFields determined based on some heuristics
316
+ *
317
+ * For an V4 Object Page this will result in a List containing these Fields.
318
+ *
319
+ * @param context - Generation context.
320
+ * @returns True if annotations were generated successfully and false if they already exist.
321
+ */
322
+ function generateDefaultLineItem(context) {
323
+ var _a;
324
+ return __awaiter(this, void 0, void 0, function* () {
325
+ let exception;
326
+ try {
327
+ const { annotationService, project, annotationFilePath, entityType, entityTypeName } = context;
328
+ const existingList = (_a = entityType.annotations.UI) === null || _a === void 0 ? void 0 : _a.LineItem;
329
+ if (existingList) {
330
+ return false; // UI.LineItem already exists
331
+ }
332
+ const lineItem = generateLineItem(context);
333
+ const uri = (0, url_1.pathToFileURL)((0, path_1.join)(project.root, annotationFilePath)).toString();
334
+ const change = {
335
+ uri,
336
+ kind: fiori_annotation_api_1.ChangeType.InsertAnnotation,
337
+ content: {
338
+ target: entityTypeName,
339
+ type: 'annotation',
340
+ value: lineItem
341
+ }
342
+ };
343
+ annotationService.edit(change);
344
+ yield annotationService.save();
345
+ return true;
346
+ }
347
+ catch (e) {
348
+ exception = e instanceof fiori_annotation_api_1.ApiError ? e : new fiori_annotation_api_1.ApiError(`Generating LineItem failed. ${e}`);
349
+ throw exception;
350
+ }
351
+ });
352
+ }
353
+ function generateLineItem(context) {
354
+ const dataFieldRecords = getDataFieldRecordCollection(context, true);
355
+ return {
356
+ term: "com.sap.vocabularies.UI.v1.LineItem" /* UIAnnotationTerms.LineItem */,
357
+ qualifier: '',
358
+ collection: [...dataFieldRecords]
359
+ };
360
+ }
361
+ /**
362
+ * Generate Common.ValueList annotation:
363
+ * - the Common.ValueList contains CollectionPath and Common.ValueListParameterInOut
364
+ *
365
+ * For an V4 Object Page this will result in a List containing these Fields.
366
+ *
367
+ * @param context - Generation Context.
368
+ * @returns True if annotations were generated successfully and false if they already exist.
369
+ */
370
+ function generateValueHelps(context) {
371
+ return __awaiter(this, void 0, void 0, function* () {
372
+ let exception;
373
+ try {
374
+ const { project, entityType } = context;
375
+ if (project.projectType === 'EDMXBackend') {
376
+ return false;
377
+ }
378
+ const navProperties = entityType.navigationProperties.filter((navProp) => {
379
+ return canGenerateValueListAnnotationForNavigationProperty(context, entityType, navProp);
380
+ });
381
+ if (navProperties.length === 0) {
382
+ return false;
383
+ }
384
+ yield generateValueList(context, navProperties);
385
+ return true;
386
+ }
387
+ catch (e) {
388
+ exception = e instanceof fiori_annotation_api_1.ApiError ? e : new fiori_annotation_api_1.ApiError(`Generating ValueList failed. ${e}`);
389
+ throw exception;
390
+ }
391
+ });
392
+ }
393
+ function generateValueList(context, navProperties) {
394
+ return __awaiter(this, void 0, void 0, function* () {
395
+ const { annotationService, project, convertedSchema, annotationFilePath } = context;
396
+ navProperties.forEach((navProp) => {
397
+ const collectionPath = findEntitySet(convertedSchema, navProp.targetTypeName);
398
+ const { record: inOutParameter, key } = getValueListParameterInOut(context, navProp);
399
+ const valueListValue = {
400
+ type: "com.sap.vocabularies.Common.v1.ValueListType" /* CommonAnnotationTypes.ValueListType */,
401
+ propertyValues: [
402
+ {
403
+ name: VALUE_LIST_PROP_NAME_COLLECTION_PATH,
404
+ value: { type: fiori_annotation_api_1.ExpressionType.String, String: collectionPath }
405
+ },
406
+ {
407
+ name: VALUE_LIST_PROP_NAME_PARAMETERS,
408
+ value: {
409
+ type: fiori_annotation_api_1.ExpressionType.Collection,
410
+ Collection: [
411
+ inOutParameter,
412
+ //limit the vhp to 5 including mandatory, If associated entity has a lot of properties, this crashes the app at runtime.
413
+ ...getValueListParameterDisplayOnly(context, navProp.targetType, key).slice(0, 4)
414
+ ]
415
+ }
416
+ }
417
+ ]
418
+ };
419
+ const annotation = { term: "com.sap.vocabularies.Common.v1.ValueList" /* CommonAnnotationTerms.ValueList */, record: valueListValue };
420
+ const uri = (0, url_1.pathToFileURL)((0, path_1.join)(project.root, annotationFilePath)).toString();
421
+ const changes = [
422
+ {
423
+ uri,
424
+ kind: fiori_annotation_api_1.ChangeType.InsertAnnotation,
425
+ content: {
426
+ target: navProp.fullyQualifiedName,
427
+ type: 'annotation',
428
+ value: annotation
429
+ }
430
+ }
431
+ ];
432
+ annotationService.edit(changes);
433
+ });
434
+ yield annotationService.save();
435
+ });
436
+ }
437
+ function getValueListParameterInOut(context, navProp) {
438
+ const { metadataService } = context;
439
+ const mdElement = metadataService.getMetadataElement(navProp.fullyQualifiedName);
440
+ const { elementName, key } = getLocalDataPropertyName(context, mdElement);
441
+ return {
442
+ record: {
443
+ type: "com.sap.vocabularies.Common.v1.ValueListParameterInOut" /* CommonAnnotationTypes.ValueListParameterInOut */,
444
+ propertyValues: [
445
+ {
446
+ name: VALUE_LIST_PROP_NAME_LOCAL_DATA_PROPERTY,
447
+ value: {
448
+ type: fiori_annotation_api_1.ExpressionType.PropertyPath,
449
+ PropertyPath: elementName
450
+ }
451
+ },
452
+ { name: VALUE_LIST_PROP_NAME_VALUE_LIST_PROPERTY, value: { type: 'String', String: key } }
453
+ ]
454
+ },
455
+ key
456
+ };
457
+ }
458
+ /**
459
+ * Get value lust parameters to display only
460
+ * - managed properties, complex type properties or properties which are already used in InOut parameter should be omitted
461
+ * - also exclude the following properties
462
+ * - Properties of type Edm.Guid.
463
+ * - Draft specific properties such as IsActiveEntity, HasActiveEntity, HasDraftEntity.
464
+ * - Technical properties defined as managed in node_modules/@sap/cds/common.cds of CAP projects.
465
+ * - Properties annotated with UI.Hidden.
466
+ *
467
+ * @param context - Generation context.
468
+ * @param targetType - Target entity type.
469
+ * @param valueListParameterInOutPropName - Parameter property name.
470
+ * @returns DisplayOnly properties.
471
+ */
472
+ function getValueListParameterDisplayOnly(context, targetType, valueListParameterInOutPropName) {
473
+ const { metadataService } = context;
474
+ const targetEntityTypeName = targetType.name;
475
+ const mdElement = metadataService.getMetadataElement(targetEntityTypeName);
476
+ return mdElement.content
477
+ .filter((prop) => {
478
+ var _a, _b;
479
+ const convertedProp = targetType.entityProperties.by_name(prop.name);
480
+ const annotationHidden = (_a = convertedProp === null || convertedProp === void 0 ? void 0 : convertedProp.annotations.UI) === null || _a === void 0 ? void 0 : _a.Hidden;
481
+ const hidden = isHidden(annotationHidden);
482
+ const isOmit = prop.name === valueListParameterInOutPropName ||
483
+ // can't use nullish coalescing for boolean values
484
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
485
+ prop.isEntityType ||
486
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
487
+ prop.isCollectionValued ||
488
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
489
+ prop.isComplexType ||
490
+ hidden ||
491
+ prop.edmPrimitiveType === 'Edm.Guid' ||
492
+ draftSpecificFields.includes(prop.name) ||
493
+ isPropertyFromCommonNodeModule(prop.name, (_b = prop.location) === null || _b === void 0 ? void 0 : _b.uri);
494
+ return !isOmit;
495
+ })
496
+ .map((prop) => ({
497
+ type: "com.sap.vocabularies.Common.v1.ValueListParameterDisplayOnly" /* CommonAnnotationTypes.ValueListParameterDisplayOnly */,
498
+ propertyValues: [
499
+ {
500
+ name: VALUE_LIST_PROP_NAME_VALUE_LIST_PROPERTY,
501
+ value: { type: 'String', String: prop.name }
502
+ }
503
+ ]
504
+ }));
505
+ }
506
+ function canGenerateValueListAnnotationForNavigationProperty(context, entityType, navProp) {
507
+ if (navProp.isCollection) {
508
+ return false;
509
+ }
510
+ const { metadataService, convertedSchema } = context;
511
+ const mdElement = metadataService.getMetadataElement(navProp.fullyQualifiedName);
512
+ const { elementName, key } = getLocalDataPropertyName(context, mdElement);
513
+ // in CDS managed entity type must have local autogenerated property which contains associated key value, and remote key field must exist
514
+ if (!key || !entityType.entityProperties.by_name(elementName)) {
515
+ return false;
516
+ }
517
+ // It might be that an entitySet (collectionPath in value help annotation) does not exist for the entityType (e.g. for associations representing compositions)
518
+ const entitySet = findEntitySet(convertedSchema, navProp.targetTypeName);
519
+ if (!entitySet) {
520
+ return false;
521
+ }
522
+ const associatedEntityType = convertedSchema.entityTypes.by_name(navProp.targetTypeName);
523
+ const existingValueList = isValueListAlreadyExist(associatedEntityType, navProp);
524
+ // can generate ValueList if navigation property is not yet carrying valuelist annotation
525
+ return !existingValueList;
526
+ }
527
+ function getLocalDataPropertyName(context, mdElement) {
528
+ var _a, _b, _c;
529
+ const { metadataService } = context;
530
+ let currentElementName = mdElement.name;
531
+ let keyName = '';
532
+ if (mdElement.isEntityType && mdElement.structuredType) {
533
+ // build generated element name by adding first key field name of associated entity
534
+ keyName = (_c = (_b = (_a = metadataService.getMetadataElement(mdElement.structuredType)) === null || _a === void 0 ? void 0 : _a.keys) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : '';
535
+ currentElementName = keyName ? `${currentElementName}_${keyName}` : currentElementName;
536
+ }
537
+ return {
538
+ elementName: currentElementName,
539
+ key: keyName
540
+ };
541
+ }
542
+ function isValueListAlreadyExist(navPropTargetEntityType, navProp) {
543
+ var _a, _b, _c;
544
+ const existingAnnotations = navProp.annotations;
545
+ const existingCommonValueList = (_a = existingAnnotations.Common) === null || _a === void 0 ? void 0 : _a.ValueList;
546
+ const existingCDSValueList = (_c = (_b = navPropTargetEntityType.annotations) === null || _b === void 0 ? void 0 : _b['cds.odata']) === null || _c === void 0 ? void 0 : _c['valuelist'];
547
+ return !!existingCommonValueList || !!existingCDSValueList;
548
+ }
549
+ function generateId(existingIds = [], label = '') {
550
+ // add integer number as postfix until unique
551
+ let id = label;
552
+ let postfix = 0;
553
+ const base = id;
554
+ while (existingIds.includes(id)) {
555
+ postfix++;
556
+ id = base + postfix;
557
+ }
558
+ return id;
559
+ }
560
+ //# sourceMappingURL=generation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generation.js","sourceRoot":"","sources":["../src/generation.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uEAMsC;AACtC,2DAAoD;AAIpD,uEAAuD;AAcvD,+BAA4B;AAC5B,6BAAoC;AACpC,mCAAwC;AAExC,MAAM,mBAAmB,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AAEpF,MAAM,oBAAoB,GAAG,IAAA,WAAI,EAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AAC/E,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAEjF,MAAM,sBAAsB,GAAG,OAAO,CAAC;AACvC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AACzC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,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AAI,GAAG,OAAO,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { AnnotationServiceParameters, GenerateAnnotationsOptions, generateAnnotations } from './generation';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateAnnotations = void 0;
4
+ var generation_1 = require("./generation");
5
+ Object.defineProperty(exports, "generateAnnotations", { enumerable: true, get: function () { return generation_1.generateAnnotations; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA4G;AAA1C,iHAAA,mBAAmB,OAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Toggles drive letter in the given path based on the os native drive letter representation (for windows only).
3
+ *
4
+ * @param path Path to adapt.
5
+ * @returns Adapted path.
6
+ */
7
+ export declare function adaptFilePath(path: string): string;
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASlD"}
package/dist/utils.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.adaptFilePath = void 0;
4
+ const fs_1 = require("fs");
5
+ /**
6
+ * Toggles drive letter in the given path based on the os native drive letter representation (for windows only).
7
+ *
8
+ * @param path Path to adapt.
9
+ * @returns Adapted path.
10
+ */
11
+ function adaptFilePath(path) {
12
+ let result = path;
13
+ if (process.platform === 'win32') {
14
+ const osDrive = fs_1.realpathSync.native('/').charAt(0);
15
+ const pathDrive = path.charAt(0);
16
+ result =
17
+ (osDrive === osDrive.toUpperCase() ? pathDrive.toUpperCase() : pathDrive.toLowerCase()) + path.slice(1);
18
+ }
19
+ return result;
20
+ }
21
+ exports.adaptFilePath = adaptFilePath;
22
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAElC;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,IAAY;IACtC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,iBAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM;YACF,CAAC,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChH,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,sCASC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@sap-ux/annotation-generator",
3
+ "version": "0.1.0",
4
+ "description": "Library that provides API for generation of annotations by SAP Fiori App Generator",
5
+ "publisher": "SAPSE",
6
+ "author": "SAP SE",
7
+ "license": "Apache-2.0",
8
+ "main": "dist/index.js",
9
+ "dependencies": {
10
+ "@sap-ux/annotation-converter": "0.8.0",
11
+ "@sap-ux/vocabularies-types": "0.10.0",
12
+ "mem-fs-editor": "9.4.0",
13
+ "@sap-ux/fiori-annotation-api": "0.1.10",
14
+ "@sap-ux/odata-annotation-core-types": "0.3.1",
15
+ "@sap-ux/odata-entity-model": "0.2.1",
16
+ "@sap-ux/project-access": "1.22.4"
17
+ },
18
+ "devDependencies": {
19
+ "mem-fs": "2.1.0",
20
+ "@types/mem-fs": "1.1.2",
21
+ "@types/mem-fs-editor": "7.0.1",
22
+ "npm-run-all": "4.1.5"
23
+ },
24
+ "files": [
25
+ "dist/"
26
+ ],
27
+ "scripts": {
28
+ "compile": "tsc --build",
29
+ "build": "npm-run-all clean compile",
30
+ "clean": "rimraf --glob ./coverage ./dist *.tsbuildinfo ./reports",
31
+ "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
32
+ "lint": "eslint . --ext .ts",
33
+ "lint:fix": "eslint . --ext .ts --fix",
34
+ "pre-commit": "lint-staged --quiet",
35
+ "test": "jest --ci --forceExit --detectOpenHandles --colors --maxWorkers=3",
36
+ "watch": "tsc --build ./ -watch"
37
+ }
38
+ }