cap-mock-generator 1.0.1 → 1.0.3
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 +109 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,12 +11,115 @@ An advanced, interactive, and intelligent mock dataset generation engine built s
|
|
|
11
11
|
|
|
12
12
|
## ✨ Features
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
* **Interactive Onboarding Wizard:** Powered by modern `@inquirer/prompts`, walking you seamlessly through configuration step-by-step.
|
|
15
|
+
* **Relational Data Integrity (Foreign Key Management):** Automatically analyzes dependencies. It ensures child tables (e.g., entity relationships ending with `ID`) match valid, existing primary keys generated from parent tables.
|
|
16
|
+
* **Automatic Virtual Column Stripping:** Cleanly filters out `Association to many` and `Composition of many` virtual elements so they never mess up your physical CSV deployment files.
|
|
17
|
+
* **Multi-Provider AI Data Layer:** High-fidelity business mock data using either **Google Gemini Pro (`gemini-2.5-flash`)** or **OpenAI (`gpt-4o-mini`)** structured JSON responses.
|
|
18
|
+
* **Resilient Fallback Core:** If your AI API tokens hit limit caps or encounter network spikes (503 Service Unavailable), the engine gracefully falls back to a lightning-fast local **Faker.js** cluster without crashing.
|
|
19
|
+
* **Clean Architectural Foundations:** Designed around the Command-Service pattern for maximum scalability and maintainability.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📥 Installation
|
|
24
|
+
|
|
25
|
+
You can install `cap-mock-generator` globally, locally as a development dependency, or invoke it instantly on-demand using `npx`.
|
|
26
|
+
|
|
27
|
+
### 1. Global Installation
|
|
28
|
+
|
|
29
|
+
Quickest access across any project workspace:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g cap-mock-generator
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Local Installation
|
|
36
|
+
|
|
37
|
+
Recommended for engineering team standardization.
|
|
38
|
+
|
|
39
|
+
Install it directly as a development dependency inside your specific SAP CAP project root directory:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install cap-mock-generator --save-dev
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🚀 Usage
|
|
48
|
+
|
|
49
|
+
Once installed, open your terminal, ensure you are in the root directory of your SAP CAP application where your `package.json` and `db/` folder reside, and trigger the wizard using one of the strategies below.
|
|
50
|
+
|
|
51
|
+
### ⚡ Option A: On-The-Fly Execution
|
|
52
|
+
|
|
53
|
+
No installation required.
|
|
54
|
+
|
|
55
|
+
If you prefer to run the module directly without explicitly downloading it to your machine, use `npx`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx cap-mock-generator start
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 🌍 Option B: Global Command Line Execution
|
|
62
|
+
|
|
63
|
+
If you selected the global installation strategy earlier, simply ignite the interface by typing:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cap-mock-generator start
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 🛠️ Option C: Configured Local Project Scripts
|
|
70
|
+
|
|
71
|
+
If you installed the generator locally, open your native `package.json` and map a clean entry shortcut helper to your internal `scripts` block:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"scripts": {
|
|
76
|
+
"mock:gen": "cap-mock-generator start"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Now, any team member working on the repository can securely refresh testing data vectors by executing:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run mock:gen
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🛠️ Interactive Onboarding Flow
|
|
90
|
+
|
|
91
|
+
When you ignite the CLI wizard, it will guide you through the following prompts:
|
|
92
|
+
|
|
93
|
+
```plaintext
|
|
94
|
+
🌟 --- CAP Mock Generator Onboarding Wizard ---
|
|
95
|
+
|
|
96
|
+
? Enter your CDS schema filename inside the "db" directory: (schema.cds)
|
|
97
|
+
? How many mock records should be generated per Entity? (5)
|
|
98
|
+
? Do you want to enable the AI smart data layer engine? (Yes/No)
|
|
99
|
+
? Select your preferred AI Provider target: (Gemini (Google) / OpenAI (GPT))
|
|
100
|
+
? Provide your secret authorization API Key: ***********************
|
|
101
|
+
|
|
102
|
+
⚙️ Processing schema and initializing execution...
|
|
103
|
+
🔍 Analyzing model artifacts...
|
|
104
|
+
|
|
105
|
+
📦 Processing Entity: [sap.btp.assetmanagement.Plants]
|
|
106
|
+
🤖 Generating smart context data via Gemini...
|
|
107
|
+
✅ CSV successfully exported to: .../db/data/sap.btp.assetmanagement.Plants.csv
|
|
108
|
+
|
|
109
|
+
📦 Processing Entity: [sap.btp.assetmanagement.Assets]
|
|
110
|
+
🤖 Generating smart context data via Gemini...
|
|
111
|
+
✅ CSV successfully exported to: .../db/data/sap.btp.assetmanagement.Assets.csv
|
|
112
|
+
|
|
113
|
+
✨ Execution successfully completed! Check your db/data directory. 😎
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🔒 Security & Environment Compliance
|
|
119
|
+
|
|
120
|
+
Your secret API credentials, such as `GEMINI_API_KEY` or `OPENAI_API_KEY`, are processed strictly inside your immediate shell execution context memory through `process.env`.
|
|
121
|
+
|
|
122
|
+
They are never saved to disk, logged to the console, or transported outside the official provider endpoint requests.
|
|
20
123
|
|
|
21
124
|
---
|
|
22
125
|
|