@breadstone-infrastructure/prisma-seeds 0.0.231

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.
Files changed (252) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +284 -0
  4. package/ai/AISeedGenerator.d.ts +127 -0
  5. package/ai/AISeedGenerator.d.ts.map +1 -0
  6. package/ai/AISeedGenerator.js +438 -0
  7. package/ai/AISeedGenerator.js.map +1 -0
  8. package/ai/AISeedTypes.d.ts +138 -0
  9. package/ai/AISeedTypes.d.ts.map +1 -0
  10. package/ai/AISeedTypes.js +3 -0
  11. package/ai/AISeedTypes.js.map +1 -0
  12. package/ai/PrismaModelAnalyzer.d.ts +36 -0
  13. package/ai/PrismaModelAnalyzer.d.ts.map +1 -0
  14. package/ai/PrismaModelAnalyzer.js +110 -0
  15. package/ai/PrismaModelAnalyzer.js.map +1 -0
  16. package/ai/PrismaTypeSchemaGenerator.d.ts +38 -0
  17. package/ai/PrismaTypeSchemaGenerator.d.ts.map +1 -0
  18. package/ai/PrismaTypeSchemaGenerator.js +71 -0
  19. package/ai/PrismaTypeSchemaGenerator.js.map +1 -0
  20. package/ai/createAISeeder.d.ts +11 -0
  21. package/ai/createAISeeder.d.ts.map +1 -0
  22. package/ai/createAISeeder.js +72 -0
  23. package/ai/createAISeeder.js.map +1 -0
  24. package/ai/index.d.ts +6 -0
  25. package/ai/index.d.ts.map +1 -0
  26. package/ai/index.js +5 -0
  27. package/ai/index.js.map +1 -0
  28. package/assets/AssetManager.d.ts +213 -0
  29. package/assets/AssetManager.d.ts.map +1 -0
  30. package/assets/AssetManager.js +460 -0
  31. package/assets/AssetManager.js.map +1 -0
  32. package/assets/IImageTransformOptions.d.ts +42 -0
  33. package/assets/IImageTransformOptions.d.ts.map +1 -0
  34. package/assets/IImageTransformOptions.js +22 -0
  35. package/assets/IImageTransformOptions.js.map +1 -0
  36. package/assets/adapters/BlobAdapterFactory.d.ts +21 -0
  37. package/assets/adapters/BlobAdapterFactory.d.ts.map +1 -0
  38. package/assets/adapters/BlobAdapterFactory.js +3 -0
  39. package/assets/adapters/BlobAdapterFactory.js.map +1 -0
  40. package/assets/adapters/CloudflareR2BlobAdapter.d.ts +97 -0
  41. package/assets/adapters/CloudflareR2BlobAdapter.d.ts.map +1 -0
  42. package/assets/adapters/CloudflareR2BlobAdapter.js +265 -0
  43. package/assets/adapters/CloudflareR2BlobAdapter.js.map +1 -0
  44. package/assets/adapters/EmptyBlobAdapter.d.ts +42 -0
  45. package/assets/adapters/EmptyBlobAdapter.d.ts.map +1 -0
  46. package/assets/adapters/EmptyBlobAdapter.js +65 -0
  47. package/assets/adapters/EmptyBlobAdapter.js.map +1 -0
  48. package/assets/adapters/LocalFileAdapter.d.ts +34 -0
  49. package/assets/adapters/LocalFileAdapter.d.ts.map +1 -0
  50. package/assets/adapters/LocalFileAdapter.js +74 -0
  51. package/assets/adapters/LocalFileAdapter.js.map +1 -0
  52. package/assets/adapters/VercelBlobAdapter.d.ts +73 -0
  53. package/assets/adapters/VercelBlobAdapter.d.ts.map +1 -0
  54. package/assets/adapters/VercelBlobAdapter.js +168 -0
  55. package/assets/adapters/VercelBlobAdapter.js.map +1 -0
  56. package/assets/adapters/abstracts/BlobAdapterBase.d.ts +62 -0
  57. package/assets/adapters/abstracts/BlobAdapterBase.d.ts.map +1 -0
  58. package/assets/adapters/abstracts/BlobAdapterBase.js +58 -0
  59. package/assets/adapters/abstracts/BlobAdapterBase.js.map +1 -0
  60. package/assets/adapters/abstracts/HttpBlobAdapterBase.d.ts +43 -0
  61. package/assets/adapters/abstracts/HttpBlobAdapterBase.d.ts.map +1 -0
  62. package/assets/adapters/abstracts/HttpBlobAdapterBase.js +88 -0
  63. package/assets/adapters/abstracts/HttpBlobAdapterBase.js.map +1 -0
  64. package/assets/adapters/createBlobAdapter.d.ts +47 -0
  65. package/assets/adapters/createBlobAdapter.d.ts.map +1 -0
  66. package/assets/adapters/createBlobAdapter.js +63 -0
  67. package/assets/adapters/createBlobAdapter.js.map +1 -0
  68. package/assets/adapters/index.d.ts +11 -0
  69. package/assets/adapters/index.d.ts.map +1 -0
  70. package/assets/adapters/index.js +7 -0
  71. package/assets/adapters/index.js.map +1 -0
  72. package/assets/adapters/interfaces/IBlobAdapter.d.ts +41 -0
  73. package/assets/adapters/interfaces/IBlobAdapter.d.ts.map +1 -0
  74. package/assets/adapters/interfaces/IBlobAdapter.js +3 -0
  75. package/assets/adapters/interfaces/IBlobAdapter.js.map +1 -0
  76. package/assets/adapters/interfaces/IBlobAdapterConfig.d.ts +16 -0
  77. package/assets/adapters/interfaces/IBlobAdapterConfig.d.ts.map +1 -0
  78. package/assets/adapters/interfaces/IBlobAdapterConfig.js +2 -0
  79. package/assets/adapters/interfaces/IBlobAdapterConfig.js.map +1 -0
  80. package/assets/adapters/interfaces/IBlobUploadResult.d.ts +24 -0
  81. package/assets/adapters/interfaces/IBlobUploadResult.d.ts.map +1 -0
  82. package/assets/adapters/interfaces/IBlobUploadResult.js +2 -0
  83. package/assets/adapters/interfaces/IBlobUploadResult.js.map +1 -0
  84. package/base/BaseSeeder.d.ts +21 -0
  85. package/base/BaseSeeder.d.ts.map +1 -0
  86. package/base/BaseSeeder.js +45 -0
  87. package/base/BaseSeeder.js.map +1 -0
  88. package/base/functionalSeeder.d.ts +31 -0
  89. package/base/functionalSeeder.d.ts.map +1 -0
  90. package/base/functionalSeeder.js +33 -0
  91. package/base/functionalSeeder.js.map +1 -0
  92. package/cli/Cli.d.ts +2 -0
  93. package/cli/Cli.d.ts.map +1 -0
  94. package/cli/Cli.js +32 -0
  95. package/cli/Cli.js.map +1 -0
  96. package/cli/CliArgs.d.ts +2 -0
  97. package/cli/CliArgs.d.ts.map +1 -0
  98. package/cli/CliArgs.js +133 -0
  99. package/cli/CliArgs.js.map +1 -0
  100. package/cli/CliArgsConfig.d.ts +2 -0
  101. package/cli/CliArgsConfig.d.ts.map +1 -0
  102. package/cli/CliArgsConfig.js +15 -0
  103. package/cli/CliArgsConfig.js.map +1 -0
  104. package/cli/CliRun.d.ts +2 -0
  105. package/cli/CliRun.d.ts.map +1 -0
  106. package/cli/CliRun.js +34 -0
  107. package/cli/CliRun.js.map +1 -0
  108. package/cli/commands/SeedCommand.d.ts +2 -0
  109. package/cli/commands/SeedCommand.d.ts.map +1 -0
  110. package/cli/commands/SeedCommand.js +73 -0
  111. package/cli/commands/SeedCommand.js.map +1 -0
  112. package/cli/commands/SeedCommandArgsConfig.d.ts +2 -0
  113. package/cli/commands/SeedCommandArgsConfig.d.ts.map +1 -0
  114. package/cli/commands/SeedCommandArgsConfig.js +31 -0
  115. package/cli/commands/SeedCommandArgsConfig.js.map +1 -0
  116. package/cli/seed.d.ts +2 -0
  117. package/cli/seed.d.ts.map +1 -0
  118. package/cli/seed.js +42 -0
  119. package/cli/seed.js.map +1 -0
  120. package/config/IAssetConfig.d.ts +36 -0
  121. package/config/IAssetConfig.d.ts.map +1 -0
  122. package/config/IAssetConfig.js +3 -0
  123. package/config/IAssetConfig.js.map +1 -0
  124. package/config/IComposedSeedConfig.d.ts +32 -0
  125. package/config/IComposedSeedConfig.d.ts.map +1 -0
  126. package/config/IComposedSeedConfig.js +3 -0
  127. package/config/IComposedSeedConfig.js.map +1 -0
  128. package/config/ISeedConfig.d.ts +75 -0
  129. package/config/ISeedConfig.d.ts.map +1 -0
  130. package/config/ISeedConfig.js +3 -0
  131. package/config/ISeedConfig.js.map +1 -0
  132. package/config/ISeedContext.d.ts +92 -0
  133. package/config/ISeedContext.d.ts.map +1 -0
  134. package/config/ISeedContext.js +3 -0
  135. package/config/ISeedContext.js.map +1 -0
  136. package/config/ISeedDefinition.d.ts +38 -0
  137. package/config/ISeedDefinition.d.ts.map +1 -0
  138. package/config/ISeedDefinition.js +3 -0
  139. package/config/ISeedDefinition.js.map +1 -0
  140. package/config/ISeedFactory.d.ts +15 -0
  141. package/config/ISeedFactory.d.ts.map +1 -0
  142. package/config/ISeedFactory.js +3 -0
  143. package/config/ISeedFactory.js.map +1 -0
  144. package/config/ISeedOptions.d.ts +44 -0
  145. package/config/ISeedOptions.d.ts.map +1 -0
  146. package/config/ISeedOptions.js +2 -0
  147. package/config/ISeedOptions.js.map +1 -0
  148. package/config/ISeedResult.d.ts +44 -0
  149. package/config/ISeedResult.d.ts.map +1 -0
  150. package/config/ISeedResult.js +2 -0
  151. package/config/ISeedResult.js.map +1 -0
  152. package/config/ISeeder.d.ts +37 -0
  153. package/config/ISeeder.d.ts.map +1 -0
  154. package/config/ISeeder.js +3 -0
  155. package/config/ISeeder.js.map +1 -0
  156. package/config/createAdapter.d.ts +13 -0
  157. package/config/createAdapter.d.ts.map +1 -0
  158. package/config/createAdapter.js +16 -0
  159. package/config/createAdapter.js.map +1 -0
  160. package/config/createSeed.d.ts +6 -0
  161. package/config/createSeed.d.ts.map +1 -0
  162. package/config/createSeed.js +16 -0
  163. package/config/createSeed.js.map +1 -0
  164. package/config/defineConfig.d.ts +27 -0
  165. package/config/defineConfig.d.ts.map +1 -0
  166. package/config/defineConfig.js +35 -0
  167. package/config/defineConfig.js.map +1 -0
  168. package/discovery/SeedConfigDiscovery.d.ts +16 -0
  169. package/discovery/SeedConfigDiscovery.d.ts.map +1 -0
  170. package/discovery/SeedConfigDiscovery.js +137 -0
  171. package/discovery/SeedConfigDiscovery.js.map +1 -0
  172. package/index.d.ts +32 -0
  173. package/index.d.ts.map +1 -0
  174. package/index.js +32 -0
  175. package/index.js.map +1 -0
  176. package/json/JsonReferenceResolver.d.ts +23 -0
  177. package/json/JsonReferenceResolver.d.ts.map +1 -0
  178. package/json/JsonReferenceResolver.js +99 -0
  179. package/json/JsonReferenceResolver.js.map +1 -0
  180. package/json/JsonSchemaValidator.d.ts +23 -0
  181. package/json/JsonSchemaValidator.d.ts.map +1 -0
  182. package/json/JsonSchemaValidator.js +98 -0
  183. package/json/JsonSchemaValidator.js.map +1 -0
  184. package/json/JsonSeedLoader.d.ts +33 -0
  185. package/json/JsonSeedLoader.d.ts.map +1 -0
  186. package/json/JsonSeedLoader.js +176 -0
  187. package/json/JsonSeedLoader.js.map +1 -0
  188. package/json/JsonSeedTypes.d.ts +204 -0
  189. package/json/JsonSeedTypes.d.ts.map +1 -0
  190. package/json/JsonSeedTypes.js +3 -0
  191. package/json/JsonSeedTypes.js.map +1 -0
  192. package/json/createJsonSeeder.d.ts +13 -0
  193. package/json/createJsonSeeder.d.ts.map +1 -0
  194. package/json/createJsonSeeder.js +240 -0
  195. package/json/createJsonSeeder.js.map +1 -0
  196. package/json/index.d.ts +6 -0
  197. package/json/index.d.ts.map +1 -0
  198. package/json/index.js +7 -0
  199. package/json/index.js.map +1 -0
  200. package/logging/ISeedLogger.d.ts +55 -0
  201. package/logging/ISeedLogger.d.ts.map +1 -0
  202. package/logging/ISeedLogger.js +3 -0
  203. package/logging/ISeedLogger.js.map +1 -0
  204. package/logging/LogLevel.d.ts +30 -0
  205. package/logging/LogLevel.d.ts.map +1 -0
  206. package/logging/LogLevel.js +37 -0
  207. package/logging/LogLevel.js.map +1 -0
  208. package/logging/SeedLogger.d.ts +24 -0
  209. package/logging/SeedLogger.d.ts.map +1 -0
  210. package/logging/SeedLogger.js +94 -0
  211. package/logging/SeedLogger.js.map +1 -0
  212. package/orchestration/SeedOrchestrator.d.ts +30 -0
  213. package/orchestration/SeedOrchestrator.d.ts.map +1 -0
  214. package/orchestration/SeedOrchestrator.js +262 -0
  215. package/orchestration/SeedOrchestrator.js.map +1 -0
  216. package/package.json +27 -0
  217. package/resolvers/EntityResolver.d.ts +43 -0
  218. package/resolvers/EntityResolver.d.ts.map +1 -0
  219. package/resolvers/EntityResolver.js +95 -0
  220. package/resolvers/EntityResolver.js.map +1 -0
  221. package/utils/AssetReferenceResolver.d.ts +49 -0
  222. package/utils/AssetReferenceResolver.d.ts.map +1 -0
  223. package/utils/AssetReferenceResolver.js +62 -0
  224. package/utils/AssetReferenceResolver.js.map +1 -0
  225. package/utils/EntityLookupCache.d.ts +47 -0
  226. package/utils/EntityLookupCache.d.ts.map +1 -0
  227. package/utils/EntityLookupCache.js +64 -0
  228. package/utils/EntityLookupCache.js.map +1 -0
  229. package/utils/ISeedRandom.d.ts +70 -0
  230. package/utils/ISeedRandom.d.ts.map +1 -0
  231. package/utils/ISeedRandom.js +3 -0
  232. package/utils/ISeedRandom.js.map +1 -0
  233. package/utils/LocalizationToolkit.d.ts +125 -0
  234. package/utils/LocalizationToolkit.d.ts.map +1 -0
  235. package/utils/LocalizationToolkit.js +131 -0
  236. package/utils/LocalizationToolkit.js.map +1 -0
  237. package/utils/SeededRandom.d.ts +15 -0
  238. package/utils/SeededRandom.d.ts.map +1 -0
  239. package/utils/SeededRandom.js +56 -0
  240. package/utils/SeededRandom.js.map +1 -0
  241. package/utils/StringArrayToolkit.d.ts +25 -0
  242. package/utils/StringArrayToolkit.d.ts.map +1 -0
  243. package/utils/StringArrayToolkit.js +56 -0
  244. package/utils/StringArrayToolkit.js.map +1 -0
  245. package/utils/StringValueGuard.d.ts +24 -0
  246. package/utils/StringValueGuard.d.ts.map +1 -0
  247. package/utils/StringValueGuard.js +46 -0
  248. package/utils/StringValueGuard.js.map +1 -0
  249. package/utils/WarningCollector.d.ts +40 -0
  250. package/utils/WarningCollector.d.ts.map +1 -0
  251. package/utils/WarningCollector.js +83 -0
  252. package/utils/WarningCollector.js.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 0.0.231 (2026-03-14)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **cli:** integrate CliParser for improved argument parsing and build scripts ([23b1773dce](https://github.com/RueDeRennes/mosaik/commit/23b1773dce))
6
+ - **cli:** implement Prisma Seeds CLI with argument configuration and commands ([d7d3ab6ff9](https://github.com/RueDeRennes/mosaik/commit/d7d3ab6ff9))
7
+ - **buttons): add ripple prop to button components and related updates feat(components): implement ripple behavior in various components fix(theme:** remove duplicate ripple property in theme JSON files ([d31f695f82](https://github.com/RueDeRennes/mosaik/commit/d31f695f82))
8
+ - **McpToolRegistrar): add overview and framework guide tools with enhanced descriptions feat(package:** update dependencies across multiple packages to latest versions ([45bc8fb4f6](https://github.com/RueDeRennes/mosaik/commit/45bc8fb4f6))
9
+ - **Button, Banner:** add shadow properties and update related styles and tokens ([5d69398b19](https://github.com/RueDeRennes/mosaik/commit/5d69398b19))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Breadstone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,284 @@
1
+ # @strivio/prisma-seeds
2
+
3
+ Database seeding framework for Prisma with JSON-based data loading.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Populate database
9
+ yarn nx run api:db:seed
10
+
11
+ # Reset and re-populate
12
+ yarn nx run api:db:reset
13
+ ```
14
+
15
+ ## Documentation
16
+
17
+ 📖 **Full documentation:** [`docs/infrastructure/prisma-seeds.md`](../../docs/infrastructure/prisma-seeds.md)
18
+
19
+ Topics covered:
20
+ - JSON-based seeding architecture
21
+ - Validation and schema definitions
22
+ - Multi-language support
23
+ - Asset management
24
+ - Relationship handling
25
+
26
+ ## Development
27
+
28
+ ```bash
29
+ # Build
30
+ yarn nx build prisma-seeds
31
+
32
+ # Test
33
+ yarn nx test prisma-seeds
34
+
35
+ # Lint
36
+ yarn nx lint prisma-seeds
37
+ ```
38
+
39
+ ## Project Structure
40
+
41
+ ```
42
+ libs/backend/features/[feature]/
43
+ ├── seed.config.mjs # Configuration
44
+ └── .seed/
45
+ ├── data/ # JSON content files
46
+ │ └── items.json
47
+ ├── schemas/ # Validation rules (optional)
48
+ │ └── item.schema.json
49
+ └── assets/ # Images and media
50
+ └── images/
51
+ ```
52
+
53
+ ## Example: Products
54
+
55
+ **Data File** (`.seed/data/products.json`):
56
+ ```json
57
+ {
58
+ "products": [
59
+ {
60
+ "id": "prod-001",
61
+ "name": {
62
+ "en": "Protein Powder",
63
+ "de": "Protein Pulver"
64
+ },
65
+ "price": 49.99,
66
+ "category": "supplements",
67
+ "image": "@asset:protein-powder"
68
+ }
69
+ ]
70
+ }
71
+ ```
72
+
73
+ **Result:**
74
+ - Product created in database
75
+ - Name available in English and German
76
+ - Image uploaded to cloud storage
77
+ - Linked to supplements category
78
+
79
+ ## Documentation
80
+
81
+ Complete guides available in `/docs/seeding/`:
82
+
83
+ ### Getting Started
84
+ - **[Getting Started](../../docs/seeding/getting-started.md)** - Create your first seed configuration
85
+ - **[JSON Seeding](../../docs/seeding/json-seeding.md)** - Structure your JSON data files
86
+
87
+ ### Features
88
+ - **[Asset Management](../../docs/seeding/asset-management.md)** - Handle images and media
89
+ - **[Localization](../../docs/seeding/localization.md)** - Multi-language content
90
+
91
+ ### Best Practices
92
+ - **[Best Practices](../../docs/seeding/best-practices.md)** - Patterns and conventions
93
+ - **[Examples](../../docs/seeding/examples/)** - Real-world implementations
94
+
95
+ ## Common Use Cases
96
+
97
+ ### Initial Setup
98
+ Populate database with essential data:
99
+ - User authentication
100
+ - Categories and tags
101
+ - Reference data
102
+
103
+ ### Content Updates
104
+ Deploy new or updated content:
105
+ - New exercises
106
+ - Updated recipes
107
+ - Fresh tips
108
+
109
+ ### Development
110
+ Create test data:
111
+ - Sample users
112
+ - Example workouts
113
+ - Test products
114
+
115
+ ## Configuration
116
+
117
+ Each feature defines its own seeding:
118
+
119
+ **Basic Configuration:**
120
+ - **name** - Feature identifier
121
+ - **order** - When to run (1-100)
122
+ - **dependencies** - Required features
123
+ - **data** - JSON file paths
124
+ - **assets** - Image configuration
125
+
126
+ **Processing Options:**
127
+ - **validation** - Schema checking
128
+ - **updates** - Create vs update logic
129
+ - **relationships** - Link to other entities
130
+
131
+ ## Entity Resolution
132
+
133
+ Automatically find and link related data:
134
+
135
+ **Example:**
136
+ ```json
137
+ {
138
+ "exercise": {
139
+ "name": "Bench Press",
140
+ "category": "barbell",
141
+ "muscles": ["chest", "triceps"]
142
+ }
143
+ }
144
+ ```
145
+
146
+ System will:
147
+ 1. Find "barbell" category by name
148
+ 2. Find "chest" and "triceps" muscles
149
+ 3. Create proper database links
150
+
151
+ ## Localization
152
+
153
+ Support multiple languages:
154
+
155
+ **JSON Format:**
156
+ ```json
157
+ {
158
+ "name": {
159
+ "en": "Bench Press",
160
+ "de": "Bankdrücken"
161
+ }
162
+ }
163
+ ```
164
+
165
+ **Database Storage:**
166
+ - Primary language (EN) for search
167
+ - All translations in separate table
168
+ - Fallback to English if missing
169
+
170
+ ## Asset Management
171
+
172
+ Upload images automatically:
173
+
174
+ **JSON Reference:**
175
+ ```json
176
+ {
177
+ "image": "@asset:bench-press"
178
+ }
179
+ ```
180
+
181
+ **Process:**
182
+ 1. Find image file in `.seed/assets/`
183
+ 2. Optimize (resize, format conversion)
184
+ 3. Upload to cloud storage (Vercel Blob)
185
+ 4. Store URL in database
186
+
187
+ ## Performance
188
+
189
+ **Optimized Processing:**
190
+ - Auto-caching prevents duplicate queries
191
+ - Batch processing for efficiency
192
+ - Transaction support for consistency
193
+
194
+ **Example:**
195
+ - 540 exercises processed in ~4 minutes
196
+ - Single query loads all categories (cached)
197
+ - No N+1 query problems
198
+
199
+ ## CLI Commands
200
+
201
+ ```bash
202
+ # Seed everything
203
+ yarn nx run api:db:seed
204
+
205
+ # Reset and re-seed
206
+ yarn nx run api:db:reset
207
+
208
+ # Seed specific feature
209
+ yarn nx run api:db:seed --feature=fit
210
+ ```
211
+
212
+ ## Troubleshooting
213
+
214
+ ### Validation Errors
215
+ Check JSON structure matches schema.
216
+
217
+ ### Missing References
218
+ Ensure related entities seeded first (check order/dependencies).
219
+
220
+ ### Asset Upload Fails
221
+ Verify Vercel Blob token and network connection.
222
+
223
+ ### Duplicate Entries
224
+ Check unique field configuration and existing data.
225
+
226
+ ## Development
227
+
228
+ ### Adding New Features
229
+
230
+ 1. Create `.seed/` directory in feature
231
+ 2. Add JSON data files
232
+ 3. Create `seed.config.mjs`
233
+ 4. Test locally
234
+ 5. Commit and deploy
235
+
236
+ ### Updating Content
237
+
238
+ 1. Edit JSON files
239
+ 2. Run seeding locally
240
+ 3. Verify changes
241
+ 4. Commit updates
242
+ 5. Deploy to production
243
+
244
+ ### Testing
245
+
246
+ ```bash
247
+ # Test with fresh database
248
+ yarn nx run api:db:reset
249
+ yarn nx run api:db:seed
250
+
251
+ # Validate JSON
252
+ cat .seed/data/items.json | jq .
253
+ ```
254
+
255
+ ## Architecture
256
+
257
+ **Modular Design:**
258
+ - Each feature owns its data
259
+ - Clear dependencies
260
+ - Isolated testing
261
+ - Easy to extend
262
+
263
+ **Type-Safe:**
264
+ - TypeScript throughout
265
+ - Prisma type generation
266
+ - Validation schemas
267
+
268
+ **Production-Ready:**
269
+ - Error handling
270
+ - Logging
271
+ - Performance optimized
272
+ - Tested at scale
273
+
274
+ ## Support
275
+
276
+ For questions or issues:
277
+ - Check `/docs/seeding/` documentation
278
+ - Review example implementations
279
+ - See feature-specific READMEs
280
+
281
+ ---
282
+
283
+ **Version:** 2.0
284
+ **Updated:** January 2025
@@ -0,0 +1,127 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+ import type { IAISeedConfig } from './AISeedTypes.js';
3
+ import type { IFunctionalSeederUtilities } from '../base/functionalSeeder.js';
4
+ import type { ISeedResult } from '../config/ISeedResult.js';
5
+ import type { ISeedContext } from '../config/ISeedContext.js';
6
+ /**
7
+ * AI-powered seed generator that uses LLMs to generate realistic test data.
8
+ *
9
+ * @public
10
+ */
11
+ export declare class AISeedGenerator {
12
+ private readonly _prisma;
13
+ private readonly _modelAnalyzer;
14
+ private readonly _logger;
15
+ constructor(_prisma: PrismaClient);
16
+ /**
17
+ * Generate entities using AI based on configuration.
18
+ *
19
+ * @public
20
+ * @template T The type of the entity to be generated
21
+ * @param config AI seed configuration
22
+ * @param context Seed context with Prisma client and logger
23
+ * @param utilities Utilities for seeding operations
24
+ * @returns Result of the seeding operation
25
+ */
26
+ generateEntities<T>(config: IAISeedConfig<T>, context: ISeedContext, utilities: IFunctionalSeederUtilities): Promise<ISeedResult>;
27
+ /**
28
+ * Build a comprehensive prompt for AI generation.
29
+ *
30
+ * @private
31
+ * @template T The type of the entity to be generated
32
+ * @param config AI seed configuration
33
+ * @param executionContext Execution context with model schema and existing data
34
+ * @returns The constructed prompt string
35
+ */
36
+ private buildPrompt;
37
+ /**
38
+ * Call AI service to generate data.
39
+ *
40
+ * @private
41
+ * @template T The type of the entity to be generated
42
+ * @param config AI seed configuration
43
+ * @param prompt The prompt string to send to the AI
44
+ * @returns Array of generated objects
45
+ */
46
+ private callAI;
47
+ private resolveChunkSize;
48
+ private initializeUniqueFieldTracker;
49
+ private hasDuplicateUniqueField;
50
+ private registerUniqueFieldValues;
51
+ private extractUniqueFieldValue;
52
+ /**
53
+ * Create AI provider based on configuration.
54
+ *
55
+ * @private
56
+ * @param provider The AI provider name
57
+ * @returns The corresponding environment variable key
58
+ */
59
+ private createAIProvider;
60
+ /**
61
+ * Validate generated data and apply transformations.
62
+ *
63
+ * @private
64
+ * @template T The type of the entity to be generated
65
+ * @param data The raw generated data from AI
66
+ * @param config AI seed configuration
67
+ * @returns Array of validated and transformed entities
68
+ */
69
+ private validateAndTransform;
70
+ /**
71
+ * Save generated entities to database.
72
+ *
73
+ * @private
74
+ * @template T The type of the entity to be generated
75
+ * @param entities The array of entities to save
76
+ * @param config AI seed configuration
77
+ * @param context Seed context with Prisma client and logger
78
+ * @returns The saved entities
79
+ */
80
+ private saveEntities;
81
+ /**
82
+ * Get existing values for a field to avoid duplicates.
83
+ *
84
+ * @private
85
+ * @param existingData The existing data array
86
+ * @param fieldName The field name to extract values from
87
+ * @returns Array of existing values for the specified field
88
+ */
89
+ private getExistingFieldValues;
90
+ /**
91
+ * Interpolate template with variables.
92
+ *
93
+ * @private
94
+ * @template T The type of the entity to be generated
95
+ * @param template The template string with placeholders
96
+ * @param variables Variables to replace in the template
97
+ * @returns The interpolated string
98
+ */
99
+ private interpolateTemplate;
100
+ /**
101
+ * Convert model name to camelCase for Prisma client access.
102
+ *
103
+ * @private
104
+ * @param modelName The Prisma model name
105
+ * @returns The camelCased model name
106
+ */
107
+ private toCamelCase;
108
+ /**
109
+ * Get or create Zod schema from config.
110
+ *
111
+ * @private
112
+ * @template T The type of the entity to be generated
113
+ * @param config AI seed configuration
114
+ * @returns Zod schema for validating generated entities
115
+ */
116
+ private getZodSchema;
117
+ /**
118
+ * Generate a basic Zod schema for common Prisma model patterns.
119
+ *
120
+ * @private
121
+ * @template T The type of the entity to be generated
122
+ * @param config AI seed configuration
123
+ * @returns Zod schema for validating generated entities
124
+ */
125
+ private generateBasicPrismaSchema;
126
+ }
127
+ //# sourceMappingURL=AISeedGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AISeedGenerator.d.ts","sourceRoot":"","sources":["../../src/ai/AISeedGenerator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAA8C,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D;;;;GAIG;AACH,qBAAa,eAAe;IAYpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR5B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;gBAOvB,OAAO,EAAE,YAAY;IAS1C;;;;;;;;;OASG;IACU,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,0BAA0B,GAAG,OAAO,CAAC,WAAW,CAAC;IAwD9I;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;IAsEnB;;;;;;;;OAQG;YACW,MAAM;IAwBpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,4BAA4B;IAsBpC,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,yBAAyB;IAoBjC,OAAO,CAAC,uBAAuB;IAoB/B;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IA6BxB;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAsC5B;;;;;;;;;OASG;YACW,YAAY;IAc1B;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAInB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;CA0BpC"}