@sap-ux/fiori-app-sub-generator 0.0.2
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/generators/app/index.d.ts +3 -0
- package/generators/app/index.js +5 -0
- package/generators/app-headless/index.d.ts +34 -0
- package/generators/app-headless/index.js +75 -0
- package/generators/app-headless/transforms.d.ts +9 -0
- package/generators/app-headless/transforms.js +208 -0
- package/generators/fiori-app-generator/end.d.ts +49 -0
- package/generators/fiori-app-generator/end.js +105 -0
- package/generators/fiori-app-generator/fioriAppGenerator.d.ts +45 -0
- package/generators/fiori-app-generator/fioriAppGenerator.js +319 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +94 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.js +3 -0
- package/generators/fiori-app-generator/index.d.ts +3 -0
- package/generators/fiori-app-generator/index.js +19 -0
- package/generators/fiori-app-generator/install.d.ts +34 -0
- package/generators/fiori-app-generator/install.js +80 -0
- package/generators/fiori-app-generator/prompting.d.ts +84 -0
- package/generators/fiori-app-generator/prompting.js +303 -0
- package/generators/fiori-app-generator/subgenHelpers.d.ts +43 -0
- package/generators/fiori-app-generator/subgenHelpers.js +71 -0
- package/generators/fiori-app-generator/transforms.d.ts +38 -0
- package/generators/fiori-app-generator/transforms.js +278 -0
- package/generators/fiori-app-generator/writing.d.ts +27 -0
- package/generators/fiori-app-generator/writing.js +94 -0
- package/generators/index.d.ts +6 -0
- package/generators/index.js +22 -0
- package/generators/translations/fioriAppSubGenerator.i18n.json +119 -0
- package/generators/types/common.d.ts +46 -0
- package/generators/types/common.js +3 -0
- package/generators/types/constants.d.ts +60 -0
- package/generators/types/constants.js +98 -0
- package/generators/types/external.d.ts +261 -0
- package/generators/types/external.js +88 -0
- package/generators/types/index.d.ts +7 -0
- package/generators/types/index.js +23 -0
- package/generators/types/state.d.ts +149 -0
- package/generators/types/state.js +35 -0
- package/generators/types/telemetryEvents.d.ts +61 -0
- package/generators/types/telemetryEvents.js +3 -0
- package/generators/types/yeomanUiStepConfig.d.ts +13 -0
- package/generators/types/yeomanUiStepConfig.js +3 -0
- package/generators/utils/appWizardCache.d.ts +40 -0
- package/generators/utils/appWizardCache.js +72 -0
- package/generators/utils/command-runner.d.ts +30 -0
- package/generators/utils/command-runner.js +88 -0
- package/generators/utils/common.d.ts +147 -0
- package/generators/utils/common.js +286 -0
- package/generators/utils/eventHooks.d.ts +29 -0
- package/generators/utils/eventHooks.js +48 -0
- package/generators/utils/i18n.d.ts +16 -0
- package/generators/utils/i18n.js +54 -0
- package/generators/utils/index.d.ts +9 -0
- package/generators/utils/index.js +25 -0
- package/generators/utils/sapuxLayer.d.ts +15 -0
- package/generators/utils/sapuxLayer.js +24 -0
- package/generators/utils/stepsHelper.d.ts +47 -0
- package/generators/utils/stepsHelper.js +161 -0
- package/generators/utils/telemetry.d.ts +16 -0
- package/generators/utils/telemetry.js +41 -0
- package/package.json +84 -0
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.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FioriAppGeneratorOptions } from '../fiori-app-generator';
|
|
2
|
+
import { FioriAppGenerator } from '../fiori-app-generator';
|
|
3
|
+
/**
|
|
4
|
+
* Generator that allows the creation of a Fiori applications without prompting based on a provided app config.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FioriAppGeneratorHeadless extends FioriAppGenerator {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param args
|
|
10
|
+
* @param opts
|
|
11
|
+
*/
|
|
12
|
+
constructor(args: string | string[], opts: FioriAppGeneratorOptions);
|
|
13
|
+
initializing(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Defers to the base class implementation to handle the writing phase.
|
|
16
|
+
*
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
19
|
+
writing(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Defers to the base class implementation to handle the install phase.
|
|
22
|
+
*
|
|
23
|
+
* @returns {Promise<void>}
|
|
24
|
+
*/
|
|
25
|
+
install(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Defers to the base class implementation to handle the end phase.
|
|
28
|
+
*
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*/
|
|
31
|
+
end(): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export default FioriAppGeneratorHeadless;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FioriAppGeneratorHeadless = void 0;
|
|
4
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
5
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
6
|
+
const fiori_app_generator_1 = require("../fiori-app-generator");
|
|
7
|
+
const i18n_1 = require("../utils/i18n");
|
|
8
|
+
const transforms_1 = require("./transforms");
|
|
9
|
+
/**
|
|
10
|
+
* Generator that allows the creation of a Fiori applications without prompting based on a provided app config.
|
|
11
|
+
*/
|
|
12
|
+
class FioriAppGeneratorHeadless extends fiori_app_generator_1.FioriAppGenerator {
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param args
|
|
16
|
+
* @param opts
|
|
17
|
+
*/
|
|
18
|
+
constructor(args, opts) {
|
|
19
|
+
super(args, opts);
|
|
20
|
+
this.log((0, i18n_1.t)('logMessages.generatingAppWithVersion', {
|
|
21
|
+
generatorName: '@sap-ux/fiori-app-sub-generator:headless',
|
|
22
|
+
generatorVersion: this.rootGeneratorVersion()
|
|
23
|
+
}));
|
|
24
|
+
try {
|
|
25
|
+
this.state = (0, transforms_1.transformExtState)(this.options.appConfig);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
this.log((0, i18n_1.t)('logMessages.generatorExiting'));
|
|
29
|
+
this.env.error(error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async initializing() {
|
|
33
|
+
// Ensure texts used in locally generated files, e.g. log messages, readme.md labels, etc. are available
|
|
34
|
+
await (0, i18n_1.initI18nFioriAppSubGenerator)();
|
|
35
|
+
await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
|
|
36
|
+
consumerModule: {
|
|
37
|
+
name: fiori_app_generator_1.APP_GENERATOR_MODULE,
|
|
38
|
+
version: this.rootGeneratorVersion()
|
|
39
|
+
},
|
|
40
|
+
internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
|
|
41
|
+
watchTelemetrySettingStore: false
|
|
42
|
+
});
|
|
43
|
+
fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
|
|
44
|
+
AppGenLaunchSource: this.options.appConfig.telemetryData?.generationSourceName ?? 'Headless',
|
|
45
|
+
AppGenLaunchSourceVersion: this.options.appConfig.telemetryData?.generationSourceVersion ?? 'Not Provided'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Defers to the base class implementation to handle the writing phase.
|
|
50
|
+
*
|
|
51
|
+
* @returns {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
async writing() {
|
|
54
|
+
return super.writing();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Defers to the base class implementation to handle the install phase.
|
|
58
|
+
*
|
|
59
|
+
* @returns {Promise<void>}
|
|
60
|
+
*/
|
|
61
|
+
async install() {
|
|
62
|
+
await super.install();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Defers to the base class implementation to handle the end phase.
|
|
66
|
+
*
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
async end() {
|
|
70
|
+
await super.end();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.FioriAppGeneratorHeadless = FioriAppGeneratorHeadless;
|
|
74
|
+
exports.default = FioriAppGeneratorHeadless;
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FEAppConfig, FFAppConfig, State } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms the external state to its internal representation.
|
|
4
|
+
*
|
|
5
|
+
* @param appConfig - defines the application to be generated
|
|
6
|
+
* @returns the internal state representation
|
|
7
|
+
*/
|
|
8
|
+
export declare function transformExtState(appConfig: FEAppConfig | FFAppConfig): State;
|
|
9
|
+
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformExtState = transformExtState;
|
|
4
|
+
const fiori_elements_writer_1 = require("@sap-ux/fiori-elements-writer");
|
|
5
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
6
|
+
const odata_service_inquirer_1 = require("@sap-ux/odata-service-inquirer");
|
|
7
|
+
const ui5_application_inquirer_1 = require("@sap-ux/ui5-application-inquirer");
|
|
8
|
+
const ui5_info_1 = require("@sap-ux/ui5-info");
|
|
9
|
+
const types_1 = require("../types");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const APP_CONFIG_CURRENT_VERSION = '0.2';
|
|
13
|
+
/**
|
|
14
|
+
* Transforms the external state to its internal representation.
|
|
15
|
+
*
|
|
16
|
+
* @param appConfig - defines the application to be generated
|
|
17
|
+
* @returns the internal state representation
|
|
18
|
+
*/
|
|
19
|
+
function transformExtState(appConfig) {
|
|
20
|
+
if (appConfig.version !== APP_CONFIG_CURRENT_VERSION) {
|
|
21
|
+
throw Error((0, utils_1.t)('error.appConfigVersion', { versions: APP_CONFIG_CURRENT_VERSION }));
|
|
22
|
+
}
|
|
23
|
+
const { project: projectConfig, service: serviceConfig, floorplan } = appConfig;
|
|
24
|
+
const state = {
|
|
25
|
+
project: _setProjectDefaults(projectConfig),
|
|
26
|
+
service: _setServiceDefaults(floorplan, serviceConfig),
|
|
27
|
+
floorplan: types_1.FloorplanFE[floorplan] ?? types_1.FloorplanFF[floorplan]
|
|
28
|
+
};
|
|
29
|
+
if (state.service.capService) {
|
|
30
|
+
state.project.targetFolder = (0, path_1.join)(state.service.capService.projectPath, state.service.capService.appPath ?? '');
|
|
31
|
+
}
|
|
32
|
+
// FE specific state properties
|
|
33
|
+
if (floorplan !== 'FF_SIMPLE' && appConfig.entityConfig) {
|
|
34
|
+
state.entityRelatedConfig = _setEntityRelatedConfig(appConfig);
|
|
35
|
+
if (serviceConfig?.annotations) {
|
|
36
|
+
state.service.annotations = Array.isArray(serviceConfig.annotations)
|
|
37
|
+
? serviceConfig?.annotations
|
|
38
|
+
: [serviceConfig?.annotations];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (appConfig.floorplan === 'FF_SIMPLE') {
|
|
42
|
+
// FF specific state properties
|
|
43
|
+
state.viewName = appConfig.project.viewName;
|
|
44
|
+
}
|
|
45
|
+
return state;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Set the entity related configuration based on the specified AppConfig.entityConfig property.
|
|
49
|
+
*
|
|
50
|
+
* @param feAppConfig
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
function _setEntityRelatedConfig(feAppConfig) {
|
|
54
|
+
const entityRelatedConfig = {
|
|
55
|
+
// Table config
|
|
56
|
+
hierarchyQualifier: feAppConfig.entityConfig?.hierarchyQualifier,
|
|
57
|
+
tableType: feAppConfig.entityConfig?.tableType,
|
|
58
|
+
// Annotation generator options
|
|
59
|
+
addFEOPAnnotations: feAppConfig.entityConfig?.generateFormAnnotations,
|
|
60
|
+
addLineItemAnnotations: feAppConfig.entityConfig?.generateLROPAnnotations
|
|
61
|
+
};
|
|
62
|
+
if (feAppConfig.alpOptions) {
|
|
63
|
+
// Alp table specific config
|
|
64
|
+
entityRelatedConfig.tableAutoHide = feAppConfig.alpOptions?.autoHide;
|
|
65
|
+
entityRelatedConfig.tableMultiSelect = feAppConfig.alpOptions?.multiSelect;
|
|
66
|
+
entityRelatedConfig.presentationQualifier = feAppConfig.alpOptions?.qualifier;
|
|
67
|
+
entityRelatedConfig.tableSelectionMode = feAppConfig.alpOptions?.selectionMode;
|
|
68
|
+
entityRelatedConfig.smartVariantManagement = feAppConfig.alpOptions?.smartVariantManagement;
|
|
69
|
+
}
|
|
70
|
+
if (feAppConfig.entityConfig?.mainEntity) {
|
|
71
|
+
entityRelatedConfig.mainEntity = {
|
|
72
|
+
entitySetName: feAppConfig.entityConfig.mainEntity.entityName,
|
|
73
|
+
entitySetType: feAppConfig.entityConfig.mainEntity.type
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (feAppConfig.entityConfig?.navigationEntity) {
|
|
77
|
+
entityRelatedConfig.navigationEntity = {
|
|
78
|
+
entitySetName: feAppConfig.entityConfig.navigationEntity.EntitySet,
|
|
79
|
+
navigationPropertyName: feAppConfig.entityConfig?.navigationEntity.Name
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (feAppConfig.entityConfig?.filterEntityType) {
|
|
83
|
+
entityRelatedConfig.filterEntityType = {
|
|
84
|
+
entitySetName: feAppConfig.entityConfig.filterEntityType,
|
|
85
|
+
entitySetType: feAppConfig.entityConfig.filterEntityType
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return entityRelatedConfig;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Set the project defaults based on the specified AppConfig.project property.
|
|
92
|
+
*
|
|
93
|
+
* @param project
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
function _setProjectDefaults(project) {
|
|
97
|
+
// Use latest fallback (offline) version if none specified
|
|
98
|
+
const ui5Version = project.ui5Version || ui5_info_1.supportedUi5VersionFallbacks[0].version;
|
|
99
|
+
return {
|
|
100
|
+
name: project.name ?? (0, utils_1.t)('defaults.projectName'),
|
|
101
|
+
targetFolder: project.targetFolder ?? process.cwd(),
|
|
102
|
+
namespace: project.namespace ?? '',
|
|
103
|
+
title: project.title ?? (0, utils_1.t)('defaults.projectTitle'),
|
|
104
|
+
description: project.description ?? (0, utils_1.t)('default.projectDescription'),
|
|
105
|
+
ui5Version: ui5Version,
|
|
106
|
+
localUI5Version: project.localUI5Version ?? ui5Version,
|
|
107
|
+
ui5Theme: project.ui5Theme ?? (0, ui5_info_1.getDefaultUI5Theme)(ui5Version),
|
|
108
|
+
skipAnnotations: project.skipAnnotations || types_1.defaultPromptValues[ui5_application_inquirer_1.promptNames.skipAnnotations],
|
|
109
|
+
enableCodeAssist: project.enableCodeAssist || types_1.defaultPromptValues[ui5_application_inquirer_1.promptNames.enableCodeAssist],
|
|
110
|
+
enableEslint: project.enableEslint || types_1.defaultPromptValues[ui5_application_inquirer_1.promptNames.enableEslint],
|
|
111
|
+
enableTypeScript: project.enableTypeScript || types_1.defaultPromptValues[ui5_application_inquirer_1.promptNames.enableTypeScript],
|
|
112
|
+
sapux: project.sapux || false,
|
|
113
|
+
flpAppId: '' // Mandatory property, will be generated in the writing phase transforms and overwritten
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Set the service defaults based on the specified AppConfig.service property.
|
|
118
|
+
*
|
|
119
|
+
* @param floorplan
|
|
120
|
+
* @param service - AppConfig service definition
|
|
121
|
+
* @throws Error - If neither an edmx nor capService are present an error will be thrown
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
function _setServiceDefaults(floorplan, service) {
|
|
125
|
+
let version;
|
|
126
|
+
if (service?.edmx) {
|
|
127
|
+
version = (0, utils_1.getODataVersion)(service.edmx);
|
|
128
|
+
}
|
|
129
|
+
else if (floorplan !== 'FF_SIMPLE' && !service?.capService?.projectPath) {
|
|
130
|
+
throw Error((0, utils_1.t)('error.appConfigMissingRequiredProperty', { propertyName: 'edmx' }));
|
|
131
|
+
}
|
|
132
|
+
else if (floorplan === 'FF_SIMPLE') {
|
|
133
|
+
// FF_SIMPLE with no datasource
|
|
134
|
+
return {
|
|
135
|
+
source: odata_service_inquirer_1.DatasourceType.none
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const serviceDefaults = {
|
|
139
|
+
host: service?.host,
|
|
140
|
+
servicePath: service?.servicePath,
|
|
141
|
+
client: service?.client,
|
|
142
|
+
edmx: service?.edmx,
|
|
143
|
+
version
|
|
144
|
+
};
|
|
145
|
+
if (service?.destination) {
|
|
146
|
+
serviceDefaults.destinationName = service.destination; // Legacy, to be removed
|
|
147
|
+
serviceDefaults.connectedSystem = {
|
|
148
|
+
destination: {
|
|
149
|
+
Name: service?.destination
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.sapSystem;
|
|
153
|
+
return serviceDefaults;
|
|
154
|
+
}
|
|
155
|
+
// Only support non-enterprise api hub currently from headless generator
|
|
156
|
+
if (service?.apiHubApiKey) {
|
|
157
|
+
serviceDefaults.apiHubConfig = {
|
|
158
|
+
apiHubKey: service.apiHubApiKey,
|
|
159
|
+
apiHubType: "API_HUB" /* ApiHubType.apiHub */
|
|
160
|
+
};
|
|
161
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.businessHub;
|
|
162
|
+
}
|
|
163
|
+
// Setting of DatasourceType has only partial relevance for the writing phase.
|
|
164
|
+
// Only FILE and CAP are checked during the writing phase, but these references should be (eventually) removed
|
|
165
|
+
// and replaced with generic checks for servicePath + edmx and cap service name respectively - then there is no need to set here
|
|
166
|
+
else if (service?.capService?.projectPath) {
|
|
167
|
+
if (!service.capService.serviceName) {
|
|
168
|
+
throw Error((0, utils_1.t)('error.appConfigMissingRequiredProperty', {
|
|
169
|
+
propertyName: 'capService.serviceName'
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
serviceDefaults.capService = _setCAPServicePaths(service.capService);
|
|
173
|
+
serviceDefaults.version = fiori_elements_writer_1.OdataVersion.v4; // CAP is always odata 4
|
|
174
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.capProject;
|
|
175
|
+
}
|
|
176
|
+
else if (!service?.servicePath && service?.edmx) {
|
|
177
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.metadataFile;
|
|
178
|
+
}
|
|
179
|
+
else if (!service?.edmx) {
|
|
180
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.none;
|
|
181
|
+
}
|
|
182
|
+
else if (service?.scp) {
|
|
183
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.sapSystem;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
serviceDefaults.source = odata_service_inquirer_1.DatasourceType.odataServiceUrl;
|
|
187
|
+
}
|
|
188
|
+
return serviceDefaults;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Sets the CapService properties.
|
|
192
|
+
*
|
|
193
|
+
* @param capService
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
196
|
+
function _setCAPServicePaths(capService) {
|
|
197
|
+
const capCustomPaths = (0, fiori_generator_shared_1.getCapFolderPathsSync)(capService.projectPath);
|
|
198
|
+
return {
|
|
199
|
+
// Use target folder for testing as capService.projectPath is an absolute path
|
|
200
|
+
projectPath: capService.projectPath,
|
|
201
|
+
serviceName: capService.serviceName,
|
|
202
|
+
serviceCdsPath: capService.serviceCdsPath,
|
|
203
|
+
// targetFolder ends in /app so step-up 1 dir
|
|
204
|
+
appPath: capCustomPaths?.app,
|
|
205
|
+
capType: (0, types_1.capTypeConversion)(capService.capType)
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=transforms.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import type { CapService } from '@sap-ux/cap-config-writer';
|
|
3
|
+
import type { OdataVersion } from '@sap-ux/fiori-elements-writer';
|
|
4
|
+
import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
5
|
+
import type { Logger } from '@sap-ux/logger';
|
|
6
|
+
import type { DatasourceType } from '@sap-ux/odata-service-inquirer';
|
|
7
|
+
import { type BackendSystem } from '@sap-ux/store';
|
|
8
|
+
import type { Editor } from 'mem-fs-editor';
|
|
9
|
+
import type { ApiHubConfig } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* FioriBaseGeneratror end phase related functionality.
|
|
12
|
+
*
|
|
13
|
+
* @param state
|
|
14
|
+
* @param state.service
|
|
15
|
+
* @param state.service.backendSystem
|
|
16
|
+
* @param state.service.capService
|
|
17
|
+
* @param state.service.sapClient
|
|
18
|
+
* @param state.service.odataVersion
|
|
19
|
+
* @param state.service.datasourceType
|
|
20
|
+
* @param state.service.apiHubConfig
|
|
21
|
+
* @param state.project
|
|
22
|
+
* @param state.project.targetFolder
|
|
23
|
+
* @param state.project.name
|
|
24
|
+
* @param state.project.flpAppId
|
|
25
|
+
* @param fs - the file system editor
|
|
26
|
+
* @param logger - the logger
|
|
27
|
+
* @param vscode - the vscode instance
|
|
28
|
+
* @param appWizard - the app wizard instance
|
|
29
|
+
* @param followUpCommand - the follow up command
|
|
30
|
+
* @returns {Promise<void>}
|
|
31
|
+
*/
|
|
32
|
+
export declare function runPostGenerationTasks({ service, project }: {
|
|
33
|
+
service: {
|
|
34
|
+
backendSystem?: BackendSystem & {
|
|
35
|
+
newOrUpdated?: boolean;
|
|
36
|
+
};
|
|
37
|
+
capService?: CapService;
|
|
38
|
+
sapClient?: string;
|
|
39
|
+
odataVersion?: OdataVersion;
|
|
40
|
+
datasourceType: DatasourceType;
|
|
41
|
+
apiHubConfig?: ApiHubConfig;
|
|
42
|
+
};
|
|
43
|
+
project: {
|
|
44
|
+
targetFolder: string;
|
|
45
|
+
name: string;
|
|
46
|
+
flpAppId?: string;
|
|
47
|
+
};
|
|
48
|
+
}, fs: Editor, logger: Logger & ILogWrapper, vscode?: unknown, appWizard?: AppWizard, followUpCommand?: string): Promise<void>;
|
|
49
|
+
//# sourceMappingURL=end.d.ts.map
|