@sap-ux/project-access 1.10.0 → 1.10.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.
@@ -107,7 +107,15 @@ function getCapModelAndServices(projectRoot) {
107
107
  (0, path_1.join)(projectRoot, capProjectPaths.db)
108
108
  ];
109
109
  const model = yield cds.load(modelPaths);
110
- const services = cds.compile.to['serviceinfo'](model, { root: projectRoot });
110
+ let services = cds.compile.to['serviceinfo'](model, { root: projectRoot });
111
+ if (services === null || services === void 0 ? void 0 : services.map) {
112
+ services = services === null || services === void 0 ? void 0 : services.map((value) => {
113
+ return {
114
+ name: value.name,
115
+ urlPath: uniformUrl(value.urlPath)
116
+ };
117
+ });
118
+ }
111
119
  return {
112
120
  model,
113
121
  services
@@ -115,6 +123,15 @@ function getCapModelAndServices(projectRoot) {
115
123
  });
116
124
  }
117
125
  exports.getCapModelAndServices = getCapModelAndServices;
126
+ /**
127
+ * Remove rogue '\\' - cds windows if needed.
128
+ *
129
+ * @param url - url to uniform
130
+ * @returns - uniform url
131
+ */
132
+ function uniformUrl(url) {
133
+ return url.replace(/\\/g, '/').replace(/\/\//g, '/');
134
+ }
118
135
  /**
119
136
  * Return the EDMX string of a CAP service.
120
137
  *
@@ -142,15 +159,15 @@ function readCapServiceMetadataEdmx(root, uri, version = 'v4') {
142
159
  }
143
160
  exports.readCapServiceMetadataEdmx = readCapServiceMetadataEdmx;
144
161
  /**
145
- * Find a service in a list of services.
162
+ * Find a service in a list of services ignoring leading and trailing slashes.
146
163
  *
147
164
  * @param services - list of services from cds.compile.to['serviceinfo'](model)
148
165
  * @param uri - search uri (usually from data source in manifest.json)
149
166
  * @returns - name and uri of the service, undefined if service not found
150
167
  */
151
168
  function findServiceByUri(services, uri) {
152
- const searchUri = uri.replace(/[\\/]/g, '/'); // replace all \ and / in service uri due to issues on Windows with backslashes
153
- return services.find((srv) => srv.urlPath.replace(/[\\/]/g, '/') === searchUri);
169
+ const searchUri = uniformUrl(uri).replace(/(?:^\/)|(?:\/$)/g, '');
170
+ return services.find((srv) => srv.urlPath.replace(/(?:^\/)|(?:\/$)/g, '') === searchUri);
154
171
  }
155
172
  /**
156
173
  * Get CAP CDS project environment config for project root.
@@ -23,7 +23,7 @@ export declare function getAppRootFromWebappPath(webappPath: string): Promise<st
23
23
  * @param wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
24
24
  * @returns - results as path to apps plus files already parsed, e.g. manifest.json
25
25
  */
26
- export declare function findAllApps(wsFolders: WorkspaceFolder[] | string[] | undefined): Promise<AllAppResults[]>;
26
+ export declare function findAllApps(wsFolders: readonly WorkspaceFolder[] | string[] | undefined): Promise<AllAppResults[]>;
27
27
  /**
28
28
  * Find all requested Fiori artifacts like apps, adaptations, extensions, that are supported by Fiori tools, for a given list of roots (workspace folders).
29
29
  *
@@ -33,7 +33,7 @@ export declare function findAllApps(wsFolders: WorkspaceFolder[] | string[] | un
33
33
  * @returns - data structure containing the search results, for app e.g. as path to app plus files already parsed, e.g. manifest.json
34
34
  */
35
35
  export declare function findFioriArtifacts(options: {
36
- wsFolders?: WorkspaceFolder[] | string[];
36
+ wsFolders?: readonly WorkspaceFolder[] | string[];
37
37
  artifacts: FioriArtifactTypes[];
38
38
  }): Promise<FoundFioriArtifacts>;
39
39
  //# sourceMappingURL=search.d.ts.map
@@ -59,7 +59,7 @@ function wsFoldersToRootPaths(wsFolders) {
59
59
  });
60
60
  }
61
61
  else {
62
- wsRoots = wsFolders || [];
62
+ wsRoots = (wsFolders !== null && wsFolders !== void 0 ? wsFolders : []);
63
63
  }
64
64
  return wsRoots;
65
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",