cap-mock-generator 1.0.6 → 1.0.8

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/README.md CHANGED
@@ -139,3 +139,10 @@ entity Assets {
139
139
  name : String(100);
140
140
  }
141
141
  ```
142
+
143
+ ## ⚖️ Legal Disclaimer & Trademark Notice
144
+
145
+ This project is an independent open-source tool and is **not** officially affiliated with, endorsed by, or sponsored by SAP SE.
146
+
147
+ * **SAP, SAP BTP, and SAP CAP** are trademarks or registered trademarks of SAP SE in Germany and other countries.
148
+ * The `@sap/cds-compiler` package used as a dependency in this tool is the exclusive property and copyright of **SAP SE**. It is utilized in accordance with its public availability on the default registry.
@@ -57,14 +57,21 @@ class CdsParserService {
57
57
  const property = propDef;
58
58
  const isAssoc = property.type === 'cds.Association' ||
59
59
  property.type === 'cds.Composition' ||
60
- property.type === undefined ||
61
- propName.startsWith('to');
60
+ (property.type === undefined && propName.startsWith('to'));
62
61
  let finalType = property.type || 'Association';
62
+ let finalPropName = propName;
63
+ if (property.target === 'sap.common.Countries' || property.target === 'sap.common.Currencies') {
64
+ finalPropName = `${propName}_code`;
65
+ finalType = 'cds.String';
66
+ }
67
+ else if (property.type === 'cds.Association' && !isAssoc) {
68
+ finalPropName = `${propName}_ID`;
69
+ }
63
70
  if (typeof property.target === 'string') {
64
71
  finalType = `Association.${property.target}`;
65
72
  }
66
73
  properties.push({
67
- name: propName,
74
+ name: finalPropName,
68
75
  type: finalType,
69
76
  isAssociation: isAssoc
70
77
  });
@@ -21,10 +21,16 @@ class FakerService {
21
21
  if (lowerPropName.includes('receiver')) {
22
22
  return faker_1.faker.internet.username();
23
23
  }
24
- if (lowerPropName.includes('createdby')) {
24
+ if (lowerPropName.includes('createdby') || lowerPropName.includes('modifiedby')) {
25
25
  return faker_1.faker.internet.username();
26
26
  }
27
+ if (lowerPropName.endsWith('currency') || lowerPropName.endsWith('code')) {
28
+ return faker_1.faker.string.alpha({ length: 3, casing: 'upper' });
29
+ }
27
30
  switch (propType) {
31
+ case 'cds.Date': {
32
+ return faker_1.faker.date.anytime().toISOString().split('T')[0];
33
+ }
28
34
  case 'cds.UUID': {
29
35
  return faker_1.faker.string.uuid();
30
36
  }
@@ -51,7 +57,8 @@ class FakerService {
51
57
  for (let i = 0; i < count; i++) {
52
58
  const row = {};
53
59
  for (const prop of entity.properties) {
54
- if (prop.isAssociation || prop.name.startsWith('to'))
60
+ // to ile başlayan sanal ilişkiler veya many-to-many bağları temizce atlansın
61
+ if (prop.isAssociation)
55
62
  continue;
56
63
  row[prop.name] = this.generateValue(prop.name, prop.type, parentIds);
57
64
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cap-mock-generator",
3
- "version": "1.0.6",
4
- "description": "Advanced interactive smart mock dataset generation engine for SAP BTP CAP applications.",
3
+ "version": "1.0.8",
4
+ "description": "An interactive mock data generation engine for SAP CAP applications, leveraging the official @sap/cds-compiler by SAP for schema parsing.",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
7
7
  "cap-mock-generator": "./dist/cli.js"