@sap-ux/project-access 1.13.8 → 1.15.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/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/project/cap.d.ts +27 -1
- package/dist/project/cap.js +130 -2
- package/dist/project/index.d.ts +1 -1
- package/dist/project/index.js +4 -1
- package/dist/types/cap/index.d.ts +75 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { FileName } from './constants';
|
|
2
|
-
export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getMtaPath, getNodeModulesPath, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml } from './project';
|
|
2
|
+
export { findAllApps, findCapProjects, findFioriArtifacts, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getCapCustomPaths, getCapEnvironment, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, getMtaPath, getNodeModulesPath, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readCapServiceMetadataEdmx, readUi5Yaml } from './project';
|
|
3
3
|
export { getFilePaths } from './file';
|
|
4
4
|
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getFilePaths = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getNodeModulesPath = exports.getMtaPath = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.FileName = void 0;
|
|
17
|
+
exports.getFilePaths = exports.readUi5Yaml = exports.readCapServiceMetadataEdmx = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getNodeModulesPath = exports.getMtaPath = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getCapCustomPaths = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.FileName = void 0;
|
|
18
18
|
var constants_1 = require("./constants");
|
|
19
19
|
Object.defineProperty(exports, "FileName", { enumerable: true, get: function () { return constants_1.FileName; } });
|
|
20
20
|
var project_1 = require("./project");
|
|
@@ -28,6 +28,9 @@ Object.defineProperty(exports, "getCapCustomPaths", { enumerable: true, get: fun
|
|
|
28
28
|
Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: function () { return project_1.getCapEnvironment; } });
|
|
29
29
|
Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return project_1.getCapModelAndServices; } });
|
|
30
30
|
Object.defineProperty(exports, "getCapProjectType", { enumerable: true, get: function () { return project_1.getCapProjectType; } });
|
|
31
|
+
Object.defineProperty(exports, "getCdsFiles", { enumerable: true, get: function () { return project_1.getCdsFiles; } });
|
|
32
|
+
Object.defineProperty(exports, "getCdsRoots", { enumerable: true, get: function () { return project_1.getCdsRoots; } });
|
|
33
|
+
Object.defineProperty(exports, "getCdsServices", { enumerable: true, get: function () { return project_1.getCdsServices; } });
|
|
31
34
|
Object.defineProperty(exports, "getMtaPath", { enumerable: true, get: function () { return project_1.getMtaPath; } });
|
|
32
35
|
Object.defineProperty(exports, "getNodeModulesPath", { enumerable: true, get: function () { return project_1.getNodeModulesPath; } });
|
|
33
36
|
Object.defineProperty(exports, "getWebappPath", { enumerable: true, get: function () { return project_1.getWebappPath; } });
|
package/dist/project/cap.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { CapCustomPaths, CapProjectType, CdsEnvironment, csn, Package } from '../types';
|
|
1
|
+
import type { CapCustomPaths, CapProjectType, CdsEnvironment, csn, Package, ServiceDefinitions } from '../types';
|
|
2
2
|
interface ServiceInfo {
|
|
3
3
|
name: string;
|
|
4
4
|
urlPath: string;
|
|
5
|
+
runtime?: string;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Returns true if the project is a CAP Node.js project.
|
|
@@ -42,6 +43,31 @@ export declare function getCapModelAndServices(projectRoot: string): Promise<{
|
|
|
42
43
|
model: csn;
|
|
43
44
|
services: ServiceInfo[];
|
|
44
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns a list of cds file paths (layers). By default return list of all, but you can also restrict it to one envRoot.
|
|
48
|
+
*
|
|
49
|
+
* @param projectRoot - root of the project, where the package.json is
|
|
50
|
+
* @param [ignoreErrors] - optionally, default is false; if set to true the thrown error will be checked for CDS file paths in model and returned
|
|
51
|
+
* @param [envRoot] - optionally, the root folder or CDS file to get the layer files
|
|
52
|
+
* @returns - array of strings containing cds file paths
|
|
53
|
+
*/
|
|
54
|
+
export declare function getCdsFiles(projectRoot: string, ignoreErrors?: boolean, envRoot?: string | string[]): Promise<string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Returns a list of filepaths to CDS files in root folders. Same what is done if you execute cds.resolve('*') on command line in a project.
|
|
57
|
+
*
|
|
58
|
+
* @param projectRoot - root of the project, where the package.json is
|
|
59
|
+
* @param [clearCache] - optionally, clear the cache, default false
|
|
60
|
+
* @returns - array of root paths
|
|
61
|
+
*/
|
|
62
|
+
export declare function getCdsRoots(projectRoot: string, clearCache?: boolean): Promise<string[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Return a list of services in a CAP project.
|
|
65
|
+
*
|
|
66
|
+
* @param projectRoot - root of the CAP project, where the package.json is
|
|
67
|
+
* @param ignoreErrors - in case loading the cds model throws an error, try to use the model from the exception object
|
|
68
|
+
* @returns - array of service definitions
|
|
69
|
+
*/
|
|
70
|
+
export declare function getCdsServices(projectRoot: string, ignoreErrors?: boolean): Promise<ServiceDefinitions[]>;
|
|
45
71
|
/**
|
|
46
72
|
* Return the EDMX string of a CAP service.
|
|
47
73
|
*
|
package/dist/project/cap.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.toReferenceUri = exports.toAbsoluteUri = exports.getCapEnvironment = exports.readCapServiceMetadataEdmx = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
|
|
12
|
+
exports.toReferenceUri = exports.toAbsoluteUri = exports.getCapEnvironment = exports.readCapServiceMetadataEdmx = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
|
|
13
13
|
const child_process_1 = require("child_process");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const constants_1 = require("../constants");
|
|
@@ -120,7 +120,8 @@ function getCapModelAndServices(projectRoot) {
|
|
|
120
120
|
services = services.map((value) => {
|
|
121
121
|
return {
|
|
122
122
|
name: value.name,
|
|
123
|
-
urlPath: uniformUrl(value.urlPath)
|
|
123
|
+
urlPath: uniformUrl(value.urlPath),
|
|
124
|
+
runtime: value.runtime
|
|
124
125
|
};
|
|
125
126
|
});
|
|
126
127
|
}
|
|
@@ -131,6 +132,133 @@ function getCapModelAndServices(projectRoot) {
|
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
exports.getCapModelAndServices = getCapModelAndServices;
|
|
135
|
+
/**
|
|
136
|
+
* Returns a list of cds file paths (layers). By default return list of all, but you can also restrict it to one envRoot.
|
|
137
|
+
*
|
|
138
|
+
* @param projectRoot - root of the project, where the package.json is
|
|
139
|
+
* @param [ignoreErrors] - optionally, default is false; if set to true the thrown error will be checked for CDS file paths in model and returned
|
|
140
|
+
* @param [envRoot] - optionally, the root folder or CDS file to get the layer files
|
|
141
|
+
* @returns - array of strings containing cds file paths
|
|
142
|
+
*/
|
|
143
|
+
function getCdsFiles(projectRoot, ignoreErrors = false, envRoot) {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
let cdsFiles = [];
|
|
147
|
+
try {
|
|
148
|
+
let csn;
|
|
149
|
+
envRoot !== null && envRoot !== void 0 ? envRoot : (envRoot = yield getCdsRoots(projectRoot));
|
|
150
|
+
try {
|
|
151
|
+
const cds = yield loadCdsModuleFromProject(projectRoot);
|
|
152
|
+
csn = yield cds.load(envRoot);
|
|
153
|
+
cdsFiles = [...((_a = csn['$sources']) !== null && _a !== void 0 ? _a : [])];
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
if (ignoreErrors && ((_b = e.model) === null || _b === void 0 ? void 0 : _b.sources) && typeof e.model.sources === 'object') {
|
|
157
|
+
cdsFiles.push(...extractCdsFilesFromMessage(e.model.sources));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
throw e;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
throw Error(`Error while retrieving the list of cds files for project ${projectRoot}, envRoot ${envRoot}. Error was: ${error}`);
|
|
166
|
+
}
|
|
167
|
+
return cdsFiles;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
exports.getCdsFiles = getCdsFiles;
|
|
171
|
+
/**
|
|
172
|
+
* Returns a list of filepaths to CDS files in root folders. Same what is done if you execute cds.resolve('*') on command line in a project.
|
|
173
|
+
*
|
|
174
|
+
* @param projectRoot - root of the project, where the package.json is
|
|
175
|
+
* @param [clearCache] - optionally, clear the cache, default false
|
|
176
|
+
* @returns - array of root paths
|
|
177
|
+
*/
|
|
178
|
+
function getCdsRoots(projectRoot, clearCache = false) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const roots = [];
|
|
181
|
+
const capCustomPaths = yield getCapCustomPaths(projectRoot);
|
|
182
|
+
const cdsEnvRoots = [capCustomPaths.db, capCustomPaths.srv, capCustomPaths.app, 'schema', 'services'];
|
|
183
|
+
// clear cache is enforced to also resolve newly created cds file at design time
|
|
184
|
+
const cds = yield loadCdsModuleFromProject(projectRoot);
|
|
185
|
+
if (clearCache) {
|
|
186
|
+
cds.resolve.cache = {};
|
|
187
|
+
}
|
|
188
|
+
for (const cdsEnvRoot of cdsEnvRoots) {
|
|
189
|
+
const resolvedRoots = cds.resolve((0, path_1.join)(projectRoot, cdsEnvRoot), {
|
|
190
|
+
skipModelCache: true
|
|
191
|
+
}) || [];
|
|
192
|
+
for (const resolvedRoot of resolvedRoots) {
|
|
193
|
+
roots.push(resolvedRoot);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return roots;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
exports.getCdsRoots = getCdsRoots;
|
|
200
|
+
/**
|
|
201
|
+
* Return a list of services in a CAP project.
|
|
202
|
+
*
|
|
203
|
+
* @param projectRoot - root of the CAP project, where the package.json is
|
|
204
|
+
* @param ignoreErrors - in case loading the cds model throws an error, try to use the model from the exception object
|
|
205
|
+
* @returns - array of service definitions
|
|
206
|
+
*/
|
|
207
|
+
function getCdsServices(projectRoot, ignoreErrors = true) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
let cdsServices = [];
|
|
210
|
+
try {
|
|
211
|
+
const cds = yield loadCdsModuleFromProject(projectRoot);
|
|
212
|
+
const roots = yield getCdsRoots(projectRoot);
|
|
213
|
+
let model;
|
|
214
|
+
try {
|
|
215
|
+
model = yield cds.load(roots);
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
if (ignoreErrors && e.model) {
|
|
219
|
+
model = e.model;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw e;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const linked = cds.linked(model);
|
|
226
|
+
if (Array.isArray(linked.services)) {
|
|
227
|
+
cdsServices = linked.services;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
Object.keys(linked.services).forEach((service) => {
|
|
231
|
+
cdsServices.push(linked.services[service]);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
throw Error(`Error while resolving cds roots for '${projectRoot}'. ${error}`);
|
|
237
|
+
}
|
|
238
|
+
return cdsServices;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
exports.getCdsServices = getCdsServices;
|
|
242
|
+
/**
|
|
243
|
+
* When an error occurs while trying to read cds files, the error object contains the source file
|
|
244
|
+
* information. This function extracts this file paths.
|
|
245
|
+
*
|
|
246
|
+
* @param sources - map containing the file name
|
|
247
|
+
* @returns - array of strings containing cds file paths
|
|
248
|
+
*/
|
|
249
|
+
function extractCdsFilesFromMessage(sources) {
|
|
250
|
+
const cdsFiles = [];
|
|
251
|
+
for (const source in sources) {
|
|
252
|
+
let filename = sources[source].filename;
|
|
253
|
+
if (typeof filename === 'string' && !filename.startsWith(path_1.sep)) {
|
|
254
|
+
filename = (0, path_1.join)(path_1.sep, filename);
|
|
255
|
+
}
|
|
256
|
+
if (filename) {
|
|
257
|
+
cdsFiles.push(filename);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return cdsFiles;
|
|
261
|
+
}
|
|
134
262
|
/**
|
|
135
263
|
* Remove rogue '\\' - cds windows if needed.
|
|
136
264
|
* Replaces all backslashes with forward slashes, removes double slashes, and trailing slashes.
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx } from './cap';
|
|
1
|
+
export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx } from './cap';
|
|
2
2
|
export { getNodeModulesPath } from './dependencies';
|
|
3
3
|
export { getAppProgrammingLanguage } from './info';
|
|
4
4
|
export { loadModuleFromProject } from './module-loader';
|
package/dist/project/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getAppProgrammingLanguage = exports.getNodeModulesPath = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
3
|
+
exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getAppProgrammingLanguage = exports.getNodeModulesPath = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
4
4
|
var cap_1 = require("./cap");
|
|
5
5
|
Object.defineProperty(exports, "getCapCustomPaths", { enumerable: true, get: function () { return cap_1.getCapCustomPaths; } });
|
|
6
6
|
Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return cap_1.getCapModelAndServices; } });
|
|
7
7
|
Object.defineProperty(exports, "getCapProjectType", { enumerable: true, get: function () { return cap_1.getCapProjectType; } });
|
|
8
|
+
Object.defineProperty(exports, "getCdsFiles", { enumerable: true, get: function () { return cap_1.getCdsFiles; } });
|
|
9
|
+
Object.defineProperty(exports, "getCdsRoots", { enumerable: true, get: function () { return cap_1.getCdsRoots; } });
|
|
10
|
+
Object.defineProperty(exports, "getCdsServices", { enumerable: true, get: function () { return cap_1.getCdsServices; } });
|
|
8
11
|
Object.defineProperty(exports, "isCapJavaProject", { enumerable: true, get: function () { return cap_1.isCapJavaProject; } });
|
|
9
12
|
Object.defineProperty(exports, "isCapNodeJsProject", { enumerable: true, get: function () { return cap_1.isCapNodeJsProject; } });
|
|
10
13
|
Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: function () { return cap_1.getCapEnvironment; } });
|
|
@@ -81,6 +81,7 @@ export interface CSN {
|
|
|
81
81
|
extensions?: Definition[];
|
|
82
82
|
$sources?: string[];
|
|
83
83
|
}
|
|
84
|
+
export type ServiceDefinitions = Definitions & ((namespace: string) => Definitions) & any[];
|
|
84
85
|
interface DefinitionRegistry {
|
|
85
86
|
type: Type;
|
|
86
87
|
struct: Struct;
|
|
@@ -127,6 +128,12 @@ interface Entity extends Struct {
|
|
|
127
128
|
[name: string]: Definition;
|
|
128
129
|
};
|
|
129
130
|
}
|
|
131
|
+
interface LinkedDefinition {
|
|
132
|
+
is(kind: kind | 'Association' | 'Composition'): boolean;
|
|
133
|
+
name: string;
|
|
134
|
+
}
|
|
135
|
+
type Filter = string | ((def: Definition) => boolean);
|
|
136
|
+
type Visitor = (def: Definition, name: string, parent: Definition, defs: Definitions) => void;
|
|
130
137
|
interface Association extends Type {
|
|
131
138
|
type: 'cds.Association' | 'cds.Composition';
|
|
132
139
|
/** The fully-qualified name of the Association's target entity */
|
|
@@ -142,5 +149,73 @@ interface Association extends Type {
|
|
|
142
149
|
/** The optionally specified keys in case of managed Associations */
|
|
143
150
|
keys?: column_expr[];
|
|
144
151
|
}
|
|
152
|
+
export interface LinkedModel extends CSN {
|
|
153
|
+
/**
|
|
154
|
+
* Fetches definitions matching the given filter, returning an iterator on them.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* let m = cds.reflect (aParsedModel)
|
|
158
|
+
* for (let d of m.each('entity')) console.log (d.kind, d.name)
|
|
159
|
+
* let entities = [...m.each('entity')] //> capture all
|
|
160
|
+
* let entities = m.all('entity') //> equivalent shortcut
|
|
161
|
+
*/
|
|
162
|
+
each(x: Filter, defs?: Definitions): IterableIterator<LinkedDefinition>;
|
|
163
|
+
/**
|
|
164
|
+
* Fetches definitions matching the given filter, returning them in an array.
|
|
165
|
+
* Convenience shortcut for `[...reflect.each('entity')]`
|
|
166
|
+
*/
|
|
167
|
+
all(x: Filter, defs?: Definitions): LinkedDefinition[];
|
|
168
|
+
/**
|
|
169
|
+
* Fetches definitions matching the given filter, returning the first match, if any.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* let service = model.find('service')
|
|
173
|
+
* @param {Filter} [x] the filter
|
|
174
|
+
* @param {Definitions} [defs] the definitions to fetch in, default: `this.definitions`
|
|
175
|
+
*/
|
|
176
|
+
find(x: Filter, defs?: Definitions): LinkedDefinition;
|
|
177
|
+
/**
|
|
178
|
+
* Calls the visitor for each definition matching the given filter.
|
|
179
|
+
*
|
|
180
|
+
* @see [capire](https://github.wdf.sap.corp/pages/cap/node.js/api#cds-reflect-foreach)
|
|
181
|
+
*/
|
|
182
|
+
foreach(x?: Filter, visitor?: Visitor, defs?: Definitions): this;
|
|
183
|
+
/**
|
|
184
|
+
* Same as foreach but recursively visits each element definition
|
|
185
|
+
*
|
|
186
|
+
* @see [capire](https://github.wdf.sap.corp/pages/cap/node.js/api#cds-reflect-foreach)
|
|
187
|
+
*/
|
|
188
|
+
forall(x?: Filter, visitor?: Visitor, defs?: Definitions): this;
|
|
189
|
+
/**
|
|
190
|
+
* Fetches definitions declared as children of a given parent context or service.
|
|
191
|
+
* It fetches all definitions whose fully-qualified names start with the parent's name.
|
|
192
|
+
* Returns the found definitions as an object with the local names as keys.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* let service = model.find ('service')
|
|
196
|
+
* let entities = m.childrenOf (service)
|
|
197
|
+
* @param parent either the parent itself or its fully-qualified name
|
|
198
|
+
* @param filter an optional filter to apply before picking a child
|
|
199
|
+
*/
|
|
200
|
+
childrenOf(parent: LinkedDefinition | string, filter?: (def: Definition) => boolean): Definitions;
|
|
201
|
+
/**
|
|
202
|
+
* Provides convenient access to the model's top-level definitions.
|
|
203
|
+
* For example, you can use it in an es6-import-like fashion to avoid
|
|
204
|
+
* working with fully-qualified names as follows:
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* let model = cds.reflect (cds.parse(`
|
|
208
|
+
* namespace our.lovely.bookshop;
|
|
209
|
+
* entity Books {...}
|
|
210
|
+
* entity Authors {...}
|
|
211
|
+
* `))
|
|
212
|
+
* const {Books,Authors} = model.exports
|
|
213
|
+
* SELECT.from (Books) .where ({ID:11})
|
|
214
|
+
*/
|
|
215
|
+
exports: Definitions & ((namespace: string) => Definitions);
|
|
216
|
+
entities: Definitions & ((namespace: string) => Definitions);
|
|
217
|
+
services: Definitions & ((namespace: string) => Definitions);
|
|
218
|
+
definitions: Definitions;
|
|
219
|
+
}
|
|
145
220
|
export {};
|
|
146
221
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"engines": {
|
|
23
23
|
"pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
|
|
24
|
-
"node": ">=
|
|
24
|
+
"node": ">=18.x"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"findit2": "2.2.3",
|
|
28
28
|
"mem-fs": "2.1.0",
|
|
29
29
|
"mem-fs-editor": "9.4.0",
|
|
30
|
-
"@sap-ux/ui5-config": "0.
|
|
30
|
+
"@sap-ux/ui5-config": "0.20.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/mem-fs": "1.1.2",
|