@sap-ux/project-access 1.3.1 → 1.4.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 CHANGED
@@ -1,4 +1,4 @@
1
1
  export { FileName } from './constants';
2
- export { findAllApps, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getCapModelAndServices, getCapProjectType, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readUi5Yaml } from './project';
2
+ export { findAllApps, findProjectRoot, getAppRootFromWebappPath, getAppProgrammingLanguage, getCapEnvironment, getCapModelAndServices, getCapProjectType, getWebappPath, isCapJavaProject, isCapNodeJsProject, loadModuleFromProject, readUi5Yaml } from './project';
3
3
  export * from './types';
4
4
  //# 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.readUi5Yaml = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getCapProjectType = exports.getCapModelAndServices = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findAllApps = exports.FileName = void 0;
17
+ exports.readUi5Yaml = exports.loadModuleFromProject = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getWebappPath = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapEnvironment = exports.getAppProgrammingLanguage = exports.getAppRootFromWebappPath = exports.findProjectRoot = 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");
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "findAllApps", { enumerable: true, get: function
22
22
  Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return project_1.findProjectRoot; } });
23
23
  Object.defineProperty(exports, "getAppRootFromWebappPath", { enumerable: true, get: function () { return project_1.getAppRootFromWebappPath; } });
24
24
  Object.defineProperty(exports, "getAppProgrammingLanguage", { enumerable: true, get: function () { return project_1.getAppProgrammingLanguage; } });
25
+ Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: function () { return project_1.getCapEnvironment; } });
25
26
  Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return project_1.getCapModelAndServices; } });
26
27
  Object.defineProperty(exports, "getCapProjectType", { enumerable: true, get: function () { return project_1.getCapProjectType; } });
27
28
  Object.defineProperty(exports, "getWebappPath", { enumerable: true, get: function () { return project_1.getWebappPath; } });
@@ -1,4 +1,8 @@
1
- import type { CapCustomPaths, CapProjectType, csn, Package } from '../types';
1
+ import type { CapCustomPaths, CapProjectType, CdsEnvironment, csn, Package } from '../types';
2
+ interface ServiceInfo {
3
+ name: string;
4
+ urlPath: string;
5
+ }
2
6
  /**
3
7
  * Returns true if the project is a CAP Node.js project.
4
8
  *
@@ -34,9 +38,14 @@ export declare function getCapCustomPaths(capProjectPath: string): Promise<CapCu
34
38
  */
35
39
  export declare function getCapModelAndServices(projectRoot: string): Promise<{
36
40
  model: csn;
37
- services: {
38
- name: string;
39
- urlPath: string;
40
- }[];
41
+ services: ServiceInfo[];
41
42
  }>;
43
+ /**
44
+ * Get CAP CDS project environment config for project root.
45
+ *
46
+ * @param capProjectPath - project root of a CAP project
47
+ * @returns - environment config for CAP project
48
+ */
49
+ export declare function getCapEnvironment(capProjectPath: string): Promise<CdsEnvironment>;
50
+ export {};
42
51
  //# sourceMappingURL=cap.d.ts.map
@@ -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.getCapModelAndServices = exports.getCapCustomPaths = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
12
+ exports.getCapEnvironment = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
13
13
  const path_1 = require("path");
14
14
  const constants_1 = require("../constants");
15
15
  const file_1 = require("../file");
@@ -77,8 +77,7 @@ function getCapCustomPaths(capProjectPath) {
77
77
  srv: 'srv/'
78
78
  };
79
79
  try {
80
- const cds = yield (0, module_loader_1.loadModuleFromProject)(capProjectPath, '@sap/cds');
81
- const cdsCustomPaths = cds.env.for('cds', capProjectPath);
80
+ const cdsCustomPaths = yield getCapEnvironment(capProjectPath);
82
81
  if (cdsCustomPaths.folders) {
83
82
  result.app = cdsCustomPaths.folders.app;
84
83
  result.db = cdsCustomPaths.folders.db;
@@ -115,4 +114,17 @@ function getCapModelAndServices(projectRoot) {
115
114
  });
116
115
  }
117
116
  exports.getCapModelAndServices = getCapModelAndServices;
117
+ /**
118
+ * Get CAP CDS project environment config for project root.
119
+ *
120
+ * @param capProjectPath - project root of a CAP project
121
+ * @returns - environment config for CAP project
122
+ */
123
+ function getCapEnvironment(capProjectPath) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const cds = yield (0, module_loader_1.loadModuleFromProject)(capProjectPath, '@sap/cds');
126
+ return cds.env.for('cds', capProjectPath);
127
+ });
128
+ }
129
+ exports.getCapEnvironment = getCapEnvironment;
118
130
  //# sourceMappingURL=cap.js.map
@@ -1,4 +1,4 @@
1
- export { getCapModelAndServices, getCapProjectType, isCapJavaProject, isCapNodeJsProject } from './cap';
1
+ export { getCapModelAndServices, getCapProjectType, isCapJavaProject, isCapNodeJsProject, getCapEnvironment } from './cap';
2
2
  export { getAppProgrammingLanguage } from './info';
3
3
  export { loadModuleFromProject } from './module-loader';
4
4
  export { findAllApps, findProjectRoot, getAppRootFromWebappPath } from './search';
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findAllApps = exports.loadModuleFromProject = exports.getAppProgrammingLanguage = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getCapProjectType = exports.getCapModelAndServices = void 0;
3
+ exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findAllApps = exports.loadModuleFromProject = exports.getAppProgrammingLanguage = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.getCapProjectType = exports.getCapModelAndServices = void 0;
4
4
  var cap_1 = require("./cap");
5
5
  Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return cap_1.getCapModelAndServices; } });
6
6
  Object.defineProperty(exports, "getCapProjectType", { enumerable: true, get: function () { return cap_1.getCapProjectType; } });
7
7
  Object.defineProperty(exports, "isCapJavaProject", { enumerable: true, get: function () { return cap_1.isCapJavaProject; } });
8
8
  Object.defineProperty(exports, "isCapNodeJsProject", { enumerable: true, get: function () { return cap_1.isCapNodeJsProject; } });
9
+ Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: function () { return cap_1.getCapEnvironment; } });
9
10
  var info_1 = require("./info");
10
11
  Object.defineProperty(exports, "getAppProgrammingLanguage", { enumerable: true, get: function () { return info_1.getAppProgrammingLanguage; } });
11
12
  var module_loader_1 = require("./module-loader");
@@ -4,6 +4,16 @@ export interface CapCustomPaths {
4
4
  db: string;
5
5
  srv: string;
6
6
  }
7
+ export interface CdsEnvironment {
8
+ folders?: CapCustomPaths;
9
+ i18n?: CapI18n;
10
+ }
11
+ export interface CapI18n {
12
+ default_language?: string;
13
+ fallback_bundle?: string;
14
+ file?: string;
15
+ folders?: string[];
16
+ }
7
17
  type SELECT = {
8
18
  SELECT: {
9
19
  distinct?: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",