@sap-ux/fe-fpm-writer 0.27.5 → 0.27.7

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.
@@ -141,11 +141,9 @@ function getMetaPath(type, metaPath, usePlaceholders) {
141
141
  if (!metaPath) {
142
142
  return getDefaultMetaPath(type, usePlaceholders);
143
143
  }
144
- const { entitySet, bindingContextType = 'absolute' } = metaPath;
145
- let { qualifier } = metaPath;
146
- let entityPath = entitySet || (usePlaceholders ? PLACEHOLDERS.entitySet : '');
147
- const lastIndex = entityPath.lastIndexOf('.');
148
- entityPath = lastIndex >= 0 ? entityPath.substring?.(lastIndex + 1) : entityPath;
144
+ const { bindingContextType = 'absolute' } = metaPath;
145
+ let { entitySet, qualifier } = metaPath;
146
+ entitySet = entitySet || (usePlaceholders ? PLACEHOLDERS.entitySet : '');
149
147
  const qualifierOrPlaceholder = qualifier || (usePlaceholders ? PLACEHOLDERS.qualifier : '');
150
148
  if (type === types_1.BuildingBlockType.Chart) {
151
149
  // Special handling for chart - while runtime does not support approach without contextPath
@@ -153,11 +151,11 @@ function getMetaPath(type, metaPath, usePlaceholders) {
153
151
  qualifier = qualifierParts.pop();
154
152
  return {
155
153
  metaPath: qualifier,
156
- contextPath: qualifierParts.length ? `/${entityPath}/${qualifierParts.join('/')}` : `/${entityPath}`
154
+ contextPath: qualifierParts.length ? `/${entitySet}/${qualifierParts.join('/')}` : `/${entitySet}`
157
155
  };
158
156
  }
159
157
  return {
160
- metaPath: bindingContextType === 'absolute' ? `/${entityPath}/${qualifierOrPlaceholder}` : qualifierOrPlaceholder
158
+ metaPath: bindingContextType === 'absolute' ? `/${entitySet}/${qualifierOrPlaceholder}` : qualifierOrPlaceholder
161
159
  };
162
160
  }
163
161
  /**
@@ -149,14 +149,8 @@ function getEntityPrompt(context, properties = {}) {
149
149
  name: 'buildingBlockData.metaPath.entitySet',
150
150
  choices: project
151
151
  ? async () => {
152
- const entityTypes = await (0, service_1.getEntityTypes)(project, appId);
153
- const entityTypeMap = {};
154
- for (const entityType of entityTypes) {
155
- const value = entityType.fullyQualifiedName;
156
- const qualifierParts = value.split('.');
157
- entityTypeMap[qualifierParts[qualifierParts.length - 1]] = value;
158
- }
159
- return transformChoices(entityTypeMap);
152
+ const entitySets = (await (0, service_1.getEntitySets)(project, appId)).map((entitySet) => entitySet.name);
153
+ return transformChoices(entitySets);
160
154
  }
161
155
  : [],
162
156
  guiOptions: {
@@ -1,4 +1,4 @@
1
- import type { ConvertedMetadata, EntityType } from '@sap-ux/vocabularies-types';
1
+ import type { ConvertedMetadata, EntitySet } from '@sap-ux/vocabularies-types';
2
2
  import type { EntityTypeAnnotations } from '@sap-ux/vocabularies-types/vocabularies/Edm_Types';
3
3
  import type { UIAnnotationTerms } from '@sap-ux/vocabularies-types/vocabularies/UI';
4
4
  import { FioriAnnotationService } from '@sap-ux/fiori-annotation-api';
@@ -38,13 +38,13 @@ export declare function getAnnotationService(project: Project, serviceName: stri
38
38
  */
39
39
  export declare function getMergedMetadata(annotationService: FioriAnnotationService): ConvertedMetadata;
40
40
  /**
41
- * Method gets available entity types in project.
41
+ * Method gets available entity sets in project.
42
42
  *
43
43
  * @param project = project
44
44
  * @param appId = app id
45
- * @returns an array of entity types
45
+ * @returns an array of entity sets
46
46
  */
47
- export declare function getEntityTypes(project: Project, appId: string): Promise<EntityType[]>;
47
+ export declare function getEntitySets(project: Project, appId: string): Promise<EntitySet[]>;
48
48
  /**
49
49
  * Method to get the annotation term alias.
50
50
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAnnotationPathQualifiers = exports.getAnnotationTermAlias = exports.getEntityTypes = exports.getMergedMetadata = exports.getAnnotationService = exports.getMappedServiceName = void 0;
3
+ exports.getAnnotationPathQualifiers = exports.getAnnotationTermAlias = exports.getEntitySets = exports.getMergedMetadata = exports.getAnnotationService = exports.getMappedServiceName = void 0;
4
4
  const annotation_converter_1 = require("@sap-ux/annotation-converter");
5
5
  const fiori_annotation_api_1 = require("@sap-ux/fiori-annotation-api");
6
6
  const project_access_1 = require("@sap-ux/project-access");
@@ -88,17 +88,17 @@ function getMainService(project, appId) {
88
88
  return mainService ?? 'mainService';
89
89
  }
90
90
  /**
91
- * Method gets available entity types in project.
91
+ * Method gets available entity sets in project.
92
92
  *
93
93
  * @param project = project
94
94
  * @param appId = app id
95
- * @returns an array of entity types
95
+ * @returns an array of entity sets
96
96
  */
97
- async function getEntityTypes(project, appId) {
97
+ async function getEntitySets(project, appId) {
98
98
  const metadata = await getServiceMetadata(project, getMainService(project, appId), appId);
99
- return Array.from(metadata.entityTypes);
99
+ return Array.from(metadata.entitySets);
100
100
  }
101
- exports.getEntityTypes = getEntityTypes;
101
+ exports.getEntitySets = getEntitySets;
102
102
  /**
103
103
  * Method to get the annotation term alias.
104
104
  *
@@ -126,13 +126,8 @@ async function getAnnotationPathQualifiers(project, appId, entity, annotationTer
126
126
  try {
127
127
  const annotationService = await getAnnotationService(project, getMainService(project, appId), appId);
128
128
  const mergedMetadata = getMergedMetadata(annotationService);
129
- let entityType = mergedMetadata.entityTypes.by_fullyQualifiedName(entity);
130
- if (!entityType) {
131
- const entitySet = mergedMetadata.entitySets.by_name(entity);
132
- if (entitySet) {
133
- entityType = entitySet.entityType;
134
- }
135
- }
129
+ const entitySet = mergedMetadata.entitySets.by_name(entity);
130
+ const entityType = entitySet?.entityType;
136
131
  if (entityType) {
137
132
  getAnnotationPathQualifiersForEntityType(entityType, annotationTerm, result, useNamespace, bindingContext);
138
133
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.27.5",
4
+ "version": "0.27.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,8 +31,8 @@
31
31
  "semver": "7.5.4",
32
32
  "xml-formatter": "2.6.1",
33
33
  "xpath": "0.0.33",
34
- "@sap-ux/fiori-annotation-api": "0.1.37",
35
- "@sap-ux/project-access": "1.26.8"
34
+ "@sap-ux/fiori-annotation-api": "0.1.38",
35
+ "@sap-ux/project-access": "1.26.9"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/inquirer": "8.2.6",
@@ -42,7 +42,7 @@
42
42
  "@types/mem-fs-editor": "7.0.1",
43
43
  "@types/semver": "7.5.2",
44
44
  "@types/vinyl": "2.0.7",
45
- "@sap-ux/ui-prompting": "0.1.4"
45
+ "@sap-ux/ui-prompting": "0.1.5"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=18.x"