@sap-ux/odata-service-inquirer 0.1.12 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -101,9 +101,10 @@ exports.getCapProjectChoices = getCapProjectChoices;
|
|
|
101
101
|
* @param serviceInfo - The service info
|
|
102
102
|
* @param projectPath - The project path
|
|
103
103
|
* @param appPath - The app path
|
|
104
|
+
* @param cdsVersionInfo - The cds version info
|
|
104
105
|
* @returns a cap service choice
|
|
105
106
|
*/
|
|
106
|
-
function createCapServiceChoice(capModel, serviceInfo, projectPath, appPath) {
|
|
107
|
+
function createCapServiceChoice(capModel, serviceInfo, projectPath, appPath, cdsVersionInfo) {
|
|
107
108
|
var _a, _b, _c;
|
|
108
109
|
const srvDef = (_a = capModel.definitions) === null || _a === void 0 ? void 0 : _a[serviceInfo.name];
|
|
109
110
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -127,7 +128,8 @@ function createCapServiceChoice(capModel, serviceInfo, projectPath, appPath) {
|
|
|
127
128
|
projectPath,
|
|
128
129
|
appPath,
|
|
129
130
|
// Assume Node.js if not defined
|
|
130
|
-
capType: serviceInfo.runtime ? serviceInfo.runtime : 'Node.js'
|
|
131
|
+
capType: serviceInfo.runtime ? serviceInfo.runtime : 'Node.js',
|
|
132
|
+
cdsVersionInfo
|
|
131
133
|
};
|
|
132
134
|
return {
|
|
133
135
|
name: capService.capType
|
|
@@ -154,17 +156,19 @@ function getCapServiceChoices(capProjectPaths) {
|
|
|
154
156
|
try {
|
|
155
157
|
let capServices = [];
|
|
156
158
|
let capModel;
|
|
159
|
+
let capCdsVersionInfo;
|
|
157
160
|
try {
|
|
158
161
|
// Workaround for missing clear cache functionality in `getCapModelAnsdServices`, this resets the cds.resolve.cache.
|
|
159
162
|
// If this is not done then errors can be thrown where out-of-processs changes to the files system have occurred
|
|
160
163
|
yield (0, project_access_1.getCdsRoots)(capProjectPaths.path, true);
|
|
161
164
|
// Load the CAP model and services
|
|
162
|
-
const { model, services } = yield (0, project_access_1.getCapModelAndServices)({
|
|
165
|
+
const { model, services, cdsVersionInfo } = yield (0, project_access_1.getCapModelAndServices)({
|
|
163
166
|
projectRoot: capProjectPaths.path,
|
|
164
167
|
logger: logger_helper_1.default.logger
|
|
165
168
|
});
|
|
166
169
|
capServices = services;
|
|
167
170
|
capModel = model;
|
|
171
|
+
capCdsVersionInfo = cdsVersionInfo;
|
|
168
172
|
}
|
|
169
173
|
catch (error) {
|
|
170
174
|
prompt_helpers_1.errorHandler.logErrorMsgs(error);
|
|
@@ -177,7 +181,7 @@ function getCapServiceChoices(capProjectPaths) {
|
|
|
177
181
|
logger_helper_1.default.logger.debug(`CDS model source paths: ${JSON.stringify(capModel.$sources)}`);
|
|
178
182
|
const serviceChoices = capServices
|
|
179
183
|
.map((service) => {
|
|
180
|
-
return createCapServiceChoice(capModel, service, projectPath, appPath);
|
|
184
|
+
return createCapServiceChoice(capModel, service, projectPath, appPath, capCdsVersionInfo);
|
|
181
185
|
})
|
|
182
186
|
.filter((service) => !!service); // filter undefined entries
|
|
183
187
|
return serviceChoices !== null && serviceChoices !== void 0 ? serviceChoices : [];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IValidationLink } from '@sap-devx/yeoman-ui-types';
|
|
2
2
|
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
3
3
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
4
|
+
import type { CdsVersionInfo } from '@sap-ux/project-access';
|
|
4
5
|
import type { ListChoiceOptions } from 'inquirer';
|
|
5
6
|
/**
|
|
6
7
|
* This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
|
|
@@ -71,6 +72,10 @@ export interface CapService {
|
|
|
71
72
|
* The path to the CAP project.
|
|
72
73
|
*/
|
|
73
74
|
projectPath: string;
|
|
75
|
+
/**
|
|
76
|
+
* The CDS info for the Cds instance that was used to compile the project when determining the service.
|
|
77
|
+
*/
|
|
78
|
+
cdsVersionInfo?: CdsVersionInfo;
|
|
74
79
|
/**
|
|
75
80
|
* The name of the CAP service as identified by the cds model.
|
|
76
81
|
*/
|
|
@@ -85,7 +90,7 @@ export interface CapService {
|
|
|
85
90
|
*/
|
|
86
91
|
serviceCdsPath?: string;
|
|
87
92
|
/**
|
|
88
|
-
* The runtime of the
|
|
93
|
+
* The runtime of the Cds instance that was used to compile the project when determining the service.
|
|
89
94
|
*/
|
|
90
95
|
capType?: CapRuntime;
|
|
91
96
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/odata-service-inquirer",
|
|
3
3
|
"description": "Prompts module that can prompt users for inputs required for odata service writing",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"i18next": "23.5.1",
|
|
24
24
|
"os-name": "4.0.1",
|
|
25
25
|
"@sap-ux/btp-utils": "0.14.4",
|
|
26
|
+
"@sap-ux/telemetry": "0.4.30",
|
|
26
27
|
"@sap-ux/inquirer-common": "0.2.8",
|
|
27
28
|
"@sap-ux/logger": "0.5.1",
|
|
28
|
-
"@sap-ux/project-access": "1.
|
|
29
|
-
"@sap-ux/telemetry": "0.4.28"
|
|
29
|
+
"@sap-ux/project-access": "1.21.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@sap-devx/yeoman-ui-types": "1.14.4",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/lodash": "4.14.202",
|
|
36
36
|
"jest-extended": "3.2.4",
|
|
37
37
|
"lodash": "4.17.21",
|
|
38
|
-
"@sap-ux/odata-service-writer": "0.
|
|
38
|
+
"@sap-ux/odata-service-writer": "0.20.1",
|
|
39
39
|
"@sap-ux/feature-toggle": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|