@compilr-dev/factory 0.1.7 → 0.1.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.
Files changed (46) hide show
  1. package/dist/factory/registry.js +2 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/toolkits/next-prisma/api-routes.d.ts +10 -0
  5. package/dist/toolkits/next-prisma/api-routes.js +155 -0
  6. package/dist/toolkits/next-prisma/config.d.ts +9 -0
  7. package/dist/toolkits/next-prisma/config.js +139 -0
  8. package/dist/toolkits/next-prisma/dashboard.d.ts +9 -0
  9. package/dist/toolkits/next-prisma/dashboard.js +87 -0
  10. package/dist/toolkits/next-prisma/entity-components.d.ts +10 -0
  11. package/dist/toolkits/next-prisma/entity-components.js +217 -0
  12. package/dist/toolkits/next-prisma/entity-pages.d.ts +12 -0
  13. package/dist/toolkits/next-prisma/entity-pages.js +348 -0
  14. package/dist/toolkits/next-prisma/helpers.d.ts +13 -0
  15. package/dist/toolkits/next-prisma/helpers.js +37 -0
  16. package/dist/toolkits/next-prisma/index.d.ts +9 -0
  17. package/dist/toolkits/next-prisma/index.js +57 -0
  18. package/dist/toolkits/next-prisma/layout.d.ts +9 -0
  19. package/dist/toolkits/next-prisma/layout.js +157 -0
  20. package/dist/toolkits/next-prisma/prisma.d.ts +8 -0
  21. package/dist/toolkits/next-prisma/prisma.js +76 -0
  22. package/dist/toolkits/next-prisma/seed.d.ts +9 -0
  23. package/dist/toolkits/next-prisma/seed.js +100 -0
  24. package/dist/toolkits/next-prisma/static.d.ts +8 -0
  25. package/dist/toolkits/next-prisma/static.js +61 -0
  26. package/dist/toolkits/next-prisma/types-gen.d.ts +10 -0
  27. package/dist/toolkits/next-prisma/types-gen.js +62 -0
  28. package/dist/toolkits/react-node/config.d.ts +1 -4
  29. package/dist/toolkits/react-node/config.js +3 -84
  30. package/dist/toolkits/react-node/helpers.d.ts +2 -23
  31. package/dist/toolkits/react-node/helpers.js +2 -67
  32. package/dist/toolkits/react-node/seed.d.ts +4 -3
  33. package/dist/toolkits/react-node/seed.js +4 -111
  34. package/dist/toolkits/react-node/shared.d.ts +2 -3
  35. package/dist/toolkits/react-node/shared.js +2 -115
  36. package/dist/toolkits/shared/color-utils.d.ts +10 -0
  37. package/dist/toolkits/shared/color-utils.js +85 -0
  38. package/dist/toolkits/shared/components.d.ts +12 -0
  39. package/dist/toolkits/shared/components.js +121 -0
  40. package/dist/toolkits/shared/helpers.d.ts +28 -0
  41. package/dist/toolkits/shared/helpers.js +72 -0
  42. package/dist/toolkits/shared/index.d.ts +9 -0
  43. package/dist/toolkits/shared/index.js +9 -0
  44. package/dist/toolkits/shared/seed-data.d.ts +18 -0
  45. package/dist/toolkits/shared/seed-data.js +119 -0
  46. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Shared Seed Data Utilities
3
+ *
4
+ * Deterministic mock data generation based on field semantics.
5
+ * Same input → same output (uses index-based logic, not Math.random).
6
+ *
7
+ * Toolkit-specific wrappers (e.g., JS array format, Prisma createMany) import these
8
+ * and format the output for their target framework.
9
+ */
10
+ export const PERSON_NAMES = [
11
+ 'Alice Johnson',
12
+ 'Bob Smith',
13
+ 'Carol Davis',
14
+ 'David Lee',
15
+ 'Eva Martinez',
16
+ 'Frank Wilson',
17
+ 'Grace Chen',
18
+ 'Henry Brown',
19
+ 'Iris Kim',
20
+ 'Jack Taylor',
21
+ ];
22
+ export const COMPANY_NAMES = [
23
+ 'Acme Corp',
24
+ 'TechVista Inc',
25
+ 'BlueSky Solutions',
26
+ 'Greenfield LLC',
27
+ 'Summit Dynamics',
28
+ 'Cascade Systems',
29
+ 'Meridian Labs',
30
+ 'Atlas Ventures',
31
+ ];
32
+ export const PRODUCT_NAMES = [
33
+ 'Premium Widget',
34
+ 'Standard Package',
35
+ 'Enterprise Suite',
36
+ 'Starter Kit',
37
+ 'Pro Bundle',
38
+ 'Deluxe Edition',
39
+ 'Basic Plan',
40
+ 'Advanced Toolkit',
41
+ ];
42
+ export const DESCRIPTIONS = [
43
+ 'A comprehensive solution for modern needs.',
44
+ 'Designed for efficiency and reliability.',
45
+ 'Built with quality and care.',
46
+ 'Perfect for teams of any size.',
47
+ 'Streamlined for maximum productivity.',
48
+ 'Industry-leading performance.',
49
+ 'Trusted by thousands of users.',
50
+ 'Next-generation technology.',
51
+ ];
52
+ export const EMAILS = [
53
+ 'alice@example.com',
54
+ 'bob@example.com',
55
+ 'carol@example.com',
56
+ 'david@example.com',
57
+ 'eva@example.com',
58
+ 'frank@example.com',
59
+ 'grace@example.com',
60
+ 'henry@example.com',
61
+ ];
62
+ export const SEED_COUNT = 8;
63
+ /** Generate a deterministic string value for a single field at a given index. */
64
+ export function generateFieldValue(field, index, entityName) {
65
+ const lowerName = field.name.toLowerCase();
66
+ const lowerEntity = entityName.toLowerCase();
67
+ switch (field.type) {
68
+ case 'string':
69
+ if (lowerName.includes('email'))
70
+ return `'${EMAILS[index % EMAILS.length]}'`;
71
+ if (lowerName.includes('name') || lowerName === 'title') {
72
+ if (lowerEntity.includes('customer') ||
73
+ lowerEntity.includes('user') ||
74
+ lowerEntity.includes('person') ||
75
+ lowerEntity.includes('employee')) {
76
+ return `'${PERSON_NAMES[index % PERSON_NAMES.length]}'`;
77
+ }
78
+ if (lowerEntity.includes('company') || lowerEntity.includes('organization')) {
79
+ return `'${COMPANY_NAMES[index % COMPANY_NAMES.length]}'`;
80
+ }
81
+ return `'${PRODUCT_NAMES[index % PRODUCT_NAMES.length]}'`;
82
+ }
83
+ if (lowerName.includes('description') ||
84
+ lowerName.includes('note') ||
85
+ lowerName.includes('comment')) {
86
+ return `'${DESCRIPTIONS[index % DESCRIPTIONS.length]}'`;
87
+ }
88
+ if (lowerName.includes('phone'))
89
+ return `'555-010${String(index)}'`;
90
+ if (lowerName.includes('address'))
91
+ return `'${String(100 + index * 10)} Main St'`;
92
+ return `'${field.label} ${String(index + 1)}'`;
93
+ case 'number':
94
+ if (lowerName.includes('price') || lowerName.includes('cost') || lowerName.includes('amount'))
95
+ return String(10 + index * 15 + 0.99);
96
+ if (lowerName.includes('quantity') || lowerName.includes('count'))
97
+ return String(1 + (index % 10));
98
+ if (lowerName.includes('age'))
99
+ return String(22 + index * 5);
100
+ if (lowerName.includes('size') || lowerName.includes('capacity'))
101
+ return String(2 + (index % 8));
102
+ return String(index + 1);
103
+ case 'boolean':
104
+ return index % 2 === 0 ? 'true' : 'false';
105
+ case 'date': {
106
+ const base = new Date('2025-06-15');
107
+ base.setDate(base.getDate() + (index * 3 - 10));
108
+ return `'${base.toISOString().split('T')[0]}'`;
109
+ }
110
+ case 'enum': {
111
+ const values = field.enumValues ?? [];
112
+ if (values.length === 0)
113
+ return "''";
114
+ return `'${values[index % values.length]}'`;
115
+ }
116
+ default:
117
+ return `'${field.label} ${String(index + 1)}'`;
118
+ }
119
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/factory",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "AI-driven application scaffolder for the compilr-dev ecosystem",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",