@slingr/cli 0.0.1
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 +320 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/cli-build.d.ts +9 -0
- package/dist/commands/cli-build.d.ts.map +1 -0
- package/dist/commands/cli-build.js +36 -0
- package/dist/commands/cli-build.js.map +1 -0
- package/dist/commands/create-app.d.ts +20 -0
- package/dist/commands/create-app.d.ts.map +1 -0
- package/dist/commands/create-app.js +246 -0
- package/dist/commands/create-app.js.map +1 -0
- package/dist/commands/ds.d.ts +28 -0
- package/dist/commands/ds.d.ts.map +1 -0
- package/dist/commands/ds.js +529 -0
- package/dist/commands/ds.js.map +1 -0
- package/dist/commands/gql.d.ts +22 -0
- package/dist/commands/gql.d.ts.map +1 -0
- package/dist/commands/gql.js +340 -0
- package/dist/commands/gql.js.map +1 -0
- package/dist/commands/infra/down.d.ts +13 -0
- package/dist/commands/infra/down.d.ts.map +1 -0
- package/dist/commands/infra/down.js +80 -0
- package/dist/commands/infra/down.js.map +1 -0
- package/dist/commands/infra/up.d.ts +13 -0
- package/dist/commands/infra/up.d.ts.map +1 -0
- package/dist/commands/infra/up.js +69 -0
- package/dist/commands/infra/up.js.map +1 -0
- package/dist/commands/infra/update.d.ts +14 -0
- package/dist/commands/infra/update.d.ts.map +1 -0
- package/dist/commands/infra/update.js +321 -0
- package/dist/commands/infra/update.js.map +1 -0
- package/dist/commands/run.d.ts +19 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +315 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/setup.d.ts +18 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +189 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/projectStructure.d.ts +10 -0
- package/dist/projectStructure.d.ts.map +1 -0
- package/dist/projectStructure.js +153 -0
- package/dist/projectStructure.js.map +1 -0
- package/dist/scripts/generate-schema.d.ts +10 -0
- package/dist/scripts/generate-schema.d.ts.map +1 -0
- package/dist/scripts/generate-schema.js +130 -0
- package/dist/scripts/generate-schema.js.map +1 -0
- package/dist/scripts/generate-schema.ts +143 -0
- package/dist/templates/.github/copilot-instructions.md.template +17 -0
- package/dist/templates/config/datasource.ts.template +9 -0
- package/dist/templates/config/jest.config.ts +30 -0
- package/dist/templates/config/jest.setup.ts +1 -0
- package/dist/templates/config/tsconfig.json.template +30 -0
- package/dist/templates/dataSources/mysql.ts.template +13 -0
- package/dist/templates/dataSources/postgres.ts.template +13 -0
- package/dist/templates/dataset-generator-script.ts.template +140 -0
- package/dist/templates/datasets/mysql-default/Address.jsonl.template +4 -0
- package/dist/templates/datasets/mysql-default/App.jsonl.template +5 -0
- package/dist/templates/datasets/mysql-default/Company.jsonl.template +4 -0
- package/dist/templates/datasets/mysql-default/Person.jsonl.template +3 -0
- package/dist/templates/datasets/postgres-default/Address.jsonl.template +4 -0
- package/dist/templates/datasets/postgres-default/App.jsonl.template +5 -0
- package/dist/templates/datasets/postgres-default/Company.jsonl.template +4 -0
- package/dist/templates/datasets/postgres-default/Person.jsonl.template +3 -0
- package/dist/templates/docs/app-description.md.template +34 -0
- package/dist/templates/gql/codegen.yml.template +25 -0
- package/dist/templates/gql/index.ts.template +24 -0
- package/dist/templates/gql/operations.graphql.template +30 -0
- package/dist/templates/package.json.template +38 -0
- package/dist/templates/prompt-analysis.md.template +111 -0
- package/dist/templates/prompt-script-generation.md.template +259 -0
- package/dist/templates/src/Address.ts.template +31 -0
- package/dist/templates/src/App.ts.template +61 -0
- package/dist/templates/src/Company.ts.template +48 -0
- package/dist/templates/src/Models.test.ts.template +655 -0
- package/dist/templates/src/Person.test.ts.template +289 -0
- package/dist/templates/src/Person.ts.template +105 -0
- package/dist/templates/src/actions/index.ts.template +12 -0
- package/dist/templates/src/index.ts +66 -0
- package/dist/templates/src/types/gql.d.ts.template +18 -0
- package/dist/templates/vscode/extensions.json +3 -0
- package/dist/templates/vscode/settings.json +11 -0
- package/dist/utils/datasourceParser.d.ts +12 -0
- package/dist/utils/datasourceParser.d.ts.map +1 -0
- package/dist/utils/datasourceParser.js +91 -0
- package/dist/utils/datasourceParser.js.map +1 -0
- package/dist/utils/jsonlLoader.d.ts +140 -0
- package/dist/utils/jsonlLoader.d.ts.map +1 -0
- package/dist/utils/jsonlLoader.js +583 -0
- package/dist/utils/jsonlLoader.js.map +1 -0
- package/dist/utils/model-analyzer.d.ts +86 -0
- package/dist/utils/model-analyzer.d.ts.map +1 -0
- package/dist/utils/model-analyzer.js +458 -0
- package/dist/utils/model-analyzer.js.map +1 -0
- package/dist/utils/portChecker.d.ts +36 -0
- package/dist/utils/portChecker.d.ts.map +1 -0
- package/dist/utils/portChecker.js +308 -0
- package/dist/utils/portChecker.js.map +1 -0
- package/dist/utils/synthetic-data-generator.d.ts +74 -0
- package/dist/utils/synthetic-data-generator.d.ts.map +1 -0
- package/dist/utils/synthetic-data-generator.js +443 -0
- package/dist/utils/synthetic-data-generator.js.map +1 -0
- package/oclif.manifest.json +435 -0
- package/package.json +118 -0
- package/src/templates/.github/copilot-instructions.md.template +17 -0
- package/src/templates/config/datasource.ts.template +9 -0
- package/src/templates/config/jest.config.ts +30 -0
- package/src/templates/config/jest.setup.ts +1 -0
- package/src/templates/config/tsconfig.json.template +30 -0
- package/src/templates/dataSources/mysql.ts.template +13 -0
- package/src/templates/dataSources/postgres.ts.template +13 -0
- package/src/templates/dataset-generator-script.ts.template +140 -0
- package/src/templates/datasets/mysql-default/Address.jsonl.template +4 -0
- package/src/templates/datasets/mysql-default/App.jsonl.template +5 -0
- package/src/templates/datasets/mysql-default/Company.jsonl.template +4 -0
- package/src/templates/datasets/mysql-default/Person.jsonl.template +3 -0
- package/src/templates/datasets/postgres-default/Address.jsonl.template +4 -0
- package/src/templates/datasets/postgres-default/App.jsonl.template +5 -0
- package/src/templates/datasets/postgres-default/Company.jsonl.template +4 -0
- package/src/templates/datasets/postgres-default/Person.jsonl.template +3 -0
- package/src/templates/docs/app-description.md.template +34 -0
- package/src/templates/gql/codegen.yml.template +25 -0
- package/src/templates/gql/index.ts.template +24 -0
- package/src/templates/gql/operations.graphql.template +30 -0
- package/src/templates/package.json.template +38 -0
- package/src/templates/prompt-analysis.md.template +111 -0
- package/src/templates/prompt-script-generation.md.template +259 -0
- package/src/templates/src/Address.ts.template +31 -0
- package/src/templates/src/App.ts.template +61 -0
- package/src/templates/src/Company.ts.template +48 -0
- package/src/templates/src/Models.test.ts.template +655 -0
- package/src/templates/src/Person.test.ts.template +289 -0
- package/src/templates/src/Person.ts.template +105 -0
- package/src/templates/src/actions/index.ts.template +12 -0
- package/src/templates/src/index.ts +66 -0
- package/src/templates/src/types/gql.d.ts.template +18 -0
- package/src/templates/vscode/extensions.json +3 -0
- package/src/templates/vscode/settings.json +11 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dataset Generator Script for {{PROJECT_NAME}}
|
|
3
|
+
*
|
|
4
|
+
* This script generates synthetic data for the {{DATASOURCE}}-{{DATASET}} dataset.
|
|
5
|
+
* Generated by Slingr CLI at {{TIMESTAMP}}
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npm run build
|
|
9
|
+
* node dist/scripts/generate-{{DATASOURCE}}-{{DATASET}}.js
|
|
10
|
+
*
|
|
11
|
+
* Or via CLI:
|
|
12
|
+
* slingr ds {{DATASOURCE}} run-script {{DATASET}}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { faker } from '@faker-js/faker';
|
|
16
|
+
import fs from 'fs-extra';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
|
|
19
|
+
// Import your models (adjust paths as needed)
|
|
20
|
+
{{MODEL_IMPORTS}}
|
|
21
|
+
|
|
22
|
+
interface GenerationConfig {
|
|
23
|
+
seed?: number;
|
|
24
|
+
locale?: string;
|
|
25
|
+
outputDir?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
class {{DATASET_CLASS_NAME}}Generator {
|
|
29
|
+
private config: GenerationConfig;
|
|
30
|
+
|
|
31
|
+
constructor(config: GenerationConfig = {}) {
|
|
32
|
+
this.config = {
|
|
33
|
+
seed: config.seed || {{SEED}},
|
|
34
|
+
locale: config.locale || '{{LOCALE}}',
|
|
35
|
+
outputDir: config.outputDir || path.join(process.cwd(), 'src', 'datasets', '{{DATASOURCE}}-{{DATASET}}'),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Set faker seed for reproducible results
|
|
39
|
+
faker.seed(this.config.seed);
|
|
40
|
+
if (this.config.locale !== 'en') {
|
|
41
|
+
faker.setLocale(this.config.locale);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Generate all datasets
|
|
47
|
+
*/
|
|
48
|
+
async generateAll(): Promise<void> {
|
|
49
|
+
console.log('🎯 Starting dataset generation...');
|
|
50
|
+
|
|
51
|
+
// Ensure output directory exists
|
|
52
|
+
await fs.ensureDir(this.config.outputDir!);
|
|
53
|
+
|
|
54
|
+
{{GENERATION_METHODS}}
|
|
55
|
+
|
|
56
|
+
console.log('🎉 Dataset generation completed!');
|
|
57
|
+
console.log(`📁 Output directory: ${this.config.outputDir}`);
|
|
58
|
+
console.log('\n💡 To load this dataset, run:');
|
|
59
|
+
console.log(` slingr ds {{DATASOURCE}} load {{DATASET}}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
{{INDIVIDUAL_GENERATORS}}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Save records to JSONL file
|
|
66
|
+
*/
|
|
67
|
+
private async saveToFile<T>(records: T[], fileName: string): Promise<void> {
|
|
68
|
+
const filePath = path.join(this.config.outputDir!, `${fileName}.jsonl`);
|
|
69
|
+
const jsonlContent = records.map(record => JSON.stringify(record)).join('\n');
|
|
70
|
+
|
|
71
|
+
await fs.writeFile(filePath, jsonlContent, 'utf-8');
|
|
72
|
+
console.log(`💾 Saved ${records.length} records to ${fileName}.jsonl`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Utility method to generate realistic data based on field hints
|
|
77
|
+
*/
|
|
78
|
+
private generateByFieldName(fieldName: string, type: string): any {
|
|
79
|
+
const name = fieldName.toLowerCase();
|
|
80
|
+
|
|
81
|
+
switch (type.toLowerCase()) {
|
|
82
|
+
case 'email':
|
|
83
|
+
return faker.internet.email();
|
|
84
|
+
|
|
85
|
+
case 'text':
|
|
86
|
+
if (name.includes('name')) {
|
|
87
|
+
if (name.includes('first')) return faker.person.firstName();
|
|
88
|
+
if (name.includes('last')) return faker.person.lastName();
|
|
89
|
+
if (name.includes('company')) return faker.company.name();
|
|
90
|
+
return faker.person.fullName();
|
|
91
|
+
}
|
|
92
|
+
if (name.includes('phone')) return faker.phone.number();
|
|
93
|
+
if (name.includes('address')) return faker.location.streetAddress();
|
|
94
|
+
if (name.includes('city')) return faker.location.city();
|
|
95
|
+
if (name.includes('country')) return faker.location.country();
|
|
96
|
+
if (name.includes('description')) return faker.lorem.paragraph();
|
|
97
|
+
return faker.lorem.words(Math.floor(Math.random() * 3) + 1);
|
|
98
|
+
|
|
99
|
+
case 'integer':
|
|
100
|
+
if (name.includes('age')) return faker.number.int({ min: 1, max: 120 });
|
|
101
|
+
return faker.number.int({ min: 1, max: 1000 });
|
|
102
|
+
|
|
103
|
+
case 'float':
|
|
104
|
+
case 'decimal':
|
|
105
|
+
return faker.number.float({ min: 0, max: 1000, precision: 0.01 });
|
|
106
|
+
|
|
107
|
+
case 'boolean':
|
|
108
|
+
return faker.datatype.boolean();
|
|
109
|
+
|
|
110
|
+
case 'date':
|
|
111
|
+
return faker.date.past().toISOString();
|
|
112
|
+
|
|
113
|
+
case 'uuid':
|
|
114
|
+
return faker.string.uuid();
|
|
115
|
+
|
|
116
|
+
case 'html':
|
|
117
|
+
return `<p>${faker.lorem.sentence()}</p>`;
|
|
118
|
+
|
|
119
|
+
default:
|
|
120
|
+
return faker.lorem.word();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Main execution
|
|
126
|
+
if (require.main === module) {
|
|
127
|
+
const generator = new {{DATASET_CLASS_NAME}}Generator();
|
|
128
|
+
|
|
129
|
+
generator.generateAll()
|
|
130
|
+
.then(() => {
|
|
131
|
+
console.log('✅ Script completed successfully');
|
|
132
|
+
process.exit(0);
|
|
133
|
+
})
|
|
134
|
+
.catch((error) => {
|
|
135
|
+
console.error('❌ Script failed:', error);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { {{DATASET_CLASS_NAME}}Generator };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"id": "69bda24e-2893-4950-a4ef-190388878123", "street": "123 Main Street", "zipCode": "10001", "country": "United States"}
|
|
2
|
+
{"street": "456 Oak Avenue", "zipCode": "90210", "country": "Portugal"}
|
|
3
|
+
{"street": "789 Pine Boulevard", "zipCode": "60601", "country": "Norway"}
|
|
4
|
+
{"street": "321 Elm Drive", "zipCode": "30309", "country": "Zimbabwe"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"name": "SlingrApp", "version": "01.00.01", "description": "A comprehensive application framework for building modern web applications", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
2
|
+
{"name": "TestApp.Beta", "version": "00.05.12", "description": "A testing application used for quality assurance and validation purposes", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878402"}}
|
|
3
|
+
{"name": "ProductionApp", "version": "02.15.03", "description": "The main production application serving thousands of users daily", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
4
|
+
{"name": "Analytics.Dashboard", "version": "01.08.07", "description": "A powerful analytics dashboard for monitoring application metrics and performance", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
5
|
+
{"name": "AdminPanel", "version": "03.02.11", "description": "Administrative panel for managing users, permissions, and system configurations", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878402"}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"name": "AdminTech Systems", "ceo": {"firstName": "Sarah", "lastName": "Davis", "email": "sarah.davis@admintech.com", "age": 42, "phoneNumber": "+1222333444", "additionalInfo": "<p>CEO and Systems Administrator</p>", "isActive": true}}
|
|
2
|
+
{"id":"69bda24e-2893-4950-a4ef-190388878401", "name": "TechCorp Solutions", "ceo": {"firstName": "Robert", "lastName": "Johnson", "email": "robert.johnson@example.com", "age": 45, "phoneNumber": "+1987654321", "additionalInfo": "<p>CEO and Founder</p>", "isActive": true}}
|
|
3
|
+
{"id":"69bda24e-2893-4950-a4ef-190388878402", "name": "DataFlow Analytics", "ceo": {"firstName": "Michael", "lastName": "Chen", "email": "michael.chen@dataflow.com", "age": 38, "phoneNumber": "+1333444555", "additionalInfo": "<p>CEO and Data Architect</p>", "isActive": true}}
|
|
4
|
+
{"name": "MainStreet Enterprises", "ceo": {"firstName": "David", "lastName": "Wilson", "email": "david.wilson@mainstreet.com", "age": 48, "phoneNumber": "+1555987654", "additionalInfo": "<p>CEO and Founder of MainStreet Enterprises</p>", "isActive": true}, "address": {"street": "Calle Falsa 216", "zipCode": "28080", "country": "Spain"}}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{"firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "age": 25, "phoneNumber": "+1234567890", "additionalInfo": "<p>Senior Developer</p>", "isActive": true}
|
|
2
|
+
{"firstName": "Jane", "lastName": "Smith", "email": "jane.smith@example.com", "age": 16, "parentEmail": "parent.smith@example.com", "additionalInfo": "<p>Student</p>", "isActive": true}
|
|
3
|
+
{"firstName": "Alice", "lastName": "Johnson", "email": "alice.johnson@mainstreet.com", "age": 32, "phoneNumber": "+1555123456", "additionalInfo": "<p>Business Owner and Entrepreneur</p>", "isActive": true, "address": {"street": "21 Mulberry Street", "zipCode": "10001", "country": "United States"}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"id": "69bda24e-2893-4950-a4ef-190388878123", "street": "123 Main Street", "zipCode": "10001", "country": "United States"}
|
|
2
|
+
{"street": "456 Oak Avenue", "zipCode": "90210", "country": "Portugal"}
|
|
3
|
+
{"street": "789 Pine Boulevard", "zipCode": "60601", "country": "Norway"}
|
|
4
|
+
{"street": "321 Elm Drive", "zipCode": "30309", "country": "Zimbabwe"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"name": "SlingrApp", "version": "01.00.01", "description": "A comprehensive application framework for building modern web applications", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
2
|
+
{"name": "TestApp.Beta", "version": "00.05.12", "description": "A testing application used for quality assurance and validation purposes", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878402"}}
|
|
3
|
+
{"name": "ProductionApp", "version": "02.15.03", "description": "The main production application serving thousands of users daily", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
4
|
+
{"name": "Analytics.Dashboard", "version": "01.08.07", "description": "A powerful analytics dashboard for monitoring application metrics and performance", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878401"}}
|
|
5
|
+
{"name": "AdminPanel", "version": "03.02.11", "description": "Administrative panel for managing users, permissions, and system configurations", "ownerCompany": {"id":"69bda24e-2893-4950-a4ef-190388878402"}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
{"name": "AdminTech Systems", "ceo": {"firstName": "Sarah", "lastName": "Davis", "email": "sarah.davis@admintech.com", "age": 42, "phoneNumber": "+1222333444", "additionalInfo": "<p>CEO and Systems Administrator</p>", "isActive": true}}
|
|
2
|
+
{"id":"69bda24e-2893-4950-a4ef-190388878401", "name": "TechCorp Solutions", "ceo": {"firstName": "Robert", "lastName": "Johnson", "email": "robert.johnson@example.com", "age": 45, "phoneNumber": "+1987654321", "additionalInfo": "<p>CEO and Founder</p>", "isActive": true}}
|
|
3
|
+
{"id":"69bda24e-2893-4950-a4ef-190388878402", "name": "DataFlow Analytics", "ceo": {"firstName": "Michael", "lastName": "Chen", "email": "michael.chen@dataflow.com", "age": 38, "phoneNumber": "+1333444555", "additionalInfo": "<p>CEO and Data Architect</p>", "isActive": true}}
|
|
4
|
+
{"name": "MainStreet Enterprises", "ceo": {"firstName": "David", "lastName": "Wilson", "email": "david.wilson@mainstreet.com", "age": 48, "phoneNumber": "+1555987654", "additionalInfo": "<p>CEO and Founder of MainStreet Enterprises</p>", "isActive": true}, "address": {"street": "Calle Falsa 216", "zipCode": "28080", "country": "Spain"}}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{"firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "age": 25, "phoneNumber": "+1234567890", "additionalInfo": "<p>Senior Developer</p>", "isActive": true}
|
|
2
|
+
{"firstName": "Jane", "lastName": "Smith", "email": "jane.smith@example.com", "age": 16, "parentEmail": "parent.smith@example.com", "additionalInfo": "<p>Student</p>", "isActive": true}
|
|
3
|
+
{"firstName": "Alice", "lastName": "Johnson", "email": "alice.johnson@mainstreet.com", "age": 32, "phoneNumber": "+1555123456", "additionalInfo": "<p>Business Owner and Entrepreneur</p>", "isActive": true, "address": {"street": "21 Mulberry Street", "zipCode": "10001", "country": "United States"}}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# {{APP_NAME}}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
{{DESCRIPTION}}
|
|
5
|
+
|
|
6
|
+
## Application Type
|
|
7
|
+
{{APP_TYPE}}
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
- **Backend**: {{HAS_BACKEND}}
|
|
11
|
+
- **Frontend**: {{HAS_FRONTEND}}
|
|
12
|
+
- **Database**: {{DB_TYPE}}
|
|
13
|
+
|
|
14
|
+
## Getting Started
|
|
15
|
+
|
|
16
|
+
1. Install dependencies:
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Start development:
|
|
22
|
+
```bash
|
|
23
|
+
npm run dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. Build for production:
|
|
27
|
+
```bash
|
|
28
|
+
npm run build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Development
|
|
32
|
+
- Use TypeScript for all development
|
|
33
|
+
- Follow the established patterns in the `src/data` directory
|
|
34
|
+
- Refer to the GitHub Copilot instructions in `.github/copilot-instructions.md`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# GraphQL Code Generator configuration
|
|
2
|
+
# This file is automatically generated by Slingr CLI
|
|
3
|
+
# You can customize it according to your needs
|
|
4
|
+
|
|
5
|
+
schema: './generated/gql/schema.graphql'
|
|
6
|
+
documents: './operations.graphql'
|
|
7
|
+
generates:
|
|
8
|
+
./generated/gql/sdk.ts:
|
|
9
|
+
plugins:
|
|
10
|
+
- 'typescript'
|
|
11
|
+
- 'typescript-operations'
|
|
12
|
+
- 'typescript-graphql-request'
|
|
13
|
+
config:
|
|
14
|
+
# Generate a SDK that works with graphql-request
|
|
15
|
+
rawRequest: false
|
|
16
|
+
# Generate typed document nodes
|
|
17
|
+
documentMode: 'documentNode'
|
|
18
|
+
# Use GraphQLClient from graphql-request
|
|
19
|
+
gqlImport: 'graphql-request#gql'
|
|
20
|
+
# Add helpful comments
|
|
21
|
+
addDocumentNodeToSchema: true
|
|
22
|
+
# Generate scalars as strings by default
|
|
23
|
+
scalars:
|
|
24
|
+
DateTime: string
|
|
25
|
+
Upload: File
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL SDK - Auto-generated by Slingr CLI
|
|
3
|
+
*
|
|
4
|
+
* This module provides a typed GraphQL SDK for your Slingr application.
|
|
5
|
+
* Import this module to access type-safe GraphQL operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { getSdk } from './sdk';
|
|
9
|
+
import { GraphQLClient } from 'graphql-request';
|
|
10
|
+
|
|
11
|
+
// Default GraphQL client configuration
|
|
12
|
+
const defaultEndpoint = process.env.GRAPHQL_ENDPOINT || 'http://localhost:4000/graphql';
|
|
13
|
+
|
|
14
|
+
// Create a default client
|
|
15
|
+
const defaultClient = new GraphQLClient(defaultEndpoint);
|
|
16
|
+
|
|
17
|
+
// Export the SDK with the default client
|
|
18
|
+
const gql = getSdk(defaultClient);
|
|
19
|
+
|
|
20
|
+
export default gql;
|
|
21
|
+
export * from './sdk';
|
|
22
|
+
|
|
23
|
+
// Also export a function to create SDK with custom client
|
|
24
|
+
export const createGql = (client: GraphQLClient) => getSdk(client);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# GraphQL Operations for SDK Generation
|
|
2
|
+
#
|
|
3
|
+
# This file defines the queries, mutations, and subscriptions
|
|
4
|
+
# that will be available in your generated SDK.
|
|
5
|
+
#
|
|
6
|
+
# IMPORTANT: This is YOUR file - customize it with your own operations!
|
|
7
|
+
#
|
|
8
|
+
# The SDK generator will create typed functions for each operation defined here.
|
|
9
|
+
# Add your custom queries, mutations, and subscriptions below.
|
|
10
|
+
#
|
|
11
|
+
# Example:
|
|
12
|
+
# query GetUser($id: ID!) {
|
|
13
|
+
# user(id: $id) {
|
|
14
|
+
# id
|
|
15
|
+
# name
|
|
16
|
+
# email
|
|
17
|
+
# }
|
|
18
|
+
# }
|
|
19
|
+
#
|
|
20
|
+
# mutation CreateUser($input: CreateUserInput!) {
|
|
21
|
+
# createUser(input: $input) {
|
|
22
|
+
# id
|
|
23
|
+
# name
|
|
24
|
+
# }
|
|
25
|
+
# }
|
|
26
|
+
|
|
27
|
+
# Sample query (replace or remove this)
|
|
28
|
+
query TestQuery {
|
|
29
|
+
test
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{APP_NAME}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"dev": "ts-node src/index.ts",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"test:watch": "jest --watch"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"slingr",
|
|
14
|
+
"{{APP_KEYWORD}}"
|
|
15
|
+
],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"graphql-request": "^7.3.0",
|
|
20
|
+
"slingr-framework": "github:slingr-stack/framework"{{DB_DRIVER_DEPENDENCY}}
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@graphql-codegen/cli": "^6.0.0",
|
|
24
|
+
"@graphql-codegen/typescript": "^5.0.2",
|
|
25
|
+
"@graphql-codegen/typescript-graphql-request": "^6.3.0",
|
|
26
|
+
"@graphql-codegen/typescript-operations": "^5.0.2",
|
|
27
|
+
"@types/jest": "^29.5.12",
|
|
28
|
+
"@types/node": "^24.3.0",
|
|
29
|
+
"jest": "^30.2.0",
|
|
30
|
+
"ts-jest": "^29.4.5",
|
|
31
|
+
"ts-node": "^10.9.2",
|
|
32
|
+
"typescript": "^5.9.2"
|
|
33
|
+
},
|
|
34
|
+
"overrides": {
|
|
35
|
+
"glob": "^11.0.0",
|
|
36
|
+
"node-gyp": "^11.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Dataset Quality Analysis: Improve "{{DATASOURCE}}-{{DATASET}}" Synthetic Data
|
|
2
|
+
|
|
3
|
+
## ⚠️ IMPORTANT: DO NOT MODIFY MODELS
|
|
4
|
+
**Your task is ONLY to improve the dataset generation, NOT to modify the existing model definitions.**
|
|
5
|
+
The models in `src/data/*.ts` are correct and must remain unchanged. Focus exclusively on generating better, more realistic data that fits these models.
|
|
6
|
+
|
|
7
|
+
## Project Context
|
|
8
|
+
{{PROJECT_DESCRIPTION}}
|
|
9
|
+
|
|
10
|
+
## Current Dataset Information
|
|
11
|
+
- **Dataset Name**: `{{DATASOURCE}}-{{DATASET}}`
|
|
12
|
+
- **Location**: `src/datasets/{{DATASOURCE}}-{{DATASET}}/`
|
|
13
|
+
- **Datasource**: {{DATASOURCE}}
|
|
14
|
+
- **Generated**: {{TIMESTAMP}}
|
|
15
|
+
- **Models**: {{TOTAL_MODELS}} models with {{TOTAL_RECORDS}} total records
|
|
16
|
+
|
|
17
|
+
### Generated Files
|
|
18
|
+
{{DATASET_FILES}}
|
|
19
|
+
|
|
20
|
+
## Data Models (READ-ONLY)
|
|
21
|
+
The following models define the structure that your dataset must follow:
|
|
22
|
+
|
|
23
|
+
{{MODEL_DESCRIPTIONS}}
|
|
24
|
+
|
|
25
|
+
## Current Generated Data Preview
|
|
26
|
+
{{DATA_PREVIEW}}
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Your Task: Analyze and Improve Dataset Quality
|
|
31
|
+
|
|
32
|
+
Please analyze the **generated dataset only** (not the models) and help improve the data generation to make it more realistic, coherent, and useful for testing.
|
|
33
|
+
|
|
34
|
+
### 1. **Data Realism Assessment**
|
|
35
|
+
Analyze the sample data above and identify:
|
|
36
|
+
- Which fields have unrealistic or nonsensical values?
|
|
37
|
+
- Are the generated values appropriate for the field names and types?
|
|
38
|
+
- Do text fields have meaningful content or just random words?
|
|
39
|
+
- Are numeric values (ages, prices, quantities) within realistic ranges?
|
|
40
|
+
- Do email addresses, phone numbers, and other formatted fields look authentic?
|
|
41
|
+
|
|
42
|
+
### 2. **Data Coherence & Relationships**
|
|
43
|
+
Check for logical consistency:
|
|
44
|
+
- Do related fields make sense together? (e.g., age and parentEmail relationship)
|
|
45
|
+
- Are there dependencies between fields that should be respected?
|
|
46
|
+
- Do composition/reference relationships contain appropriate related data?
|
|
47
|
+
- Are there any contradictory values in the same record?
|
|
48
|
+
|
|
49
|
+
### 3. **Business Domain Appropriateness**
|
|
50
|
+
Consider the business context:
|
|
51
|
+
- Do the generated values reflect realistic business scenarios?
|
|
52
|
+
- Are the data patterns useful for testing various use cases?
|
|
53
|
+
- Would this data help identify bugs or test edge cases?
|
|
54
|
+
- Are there missing scenarios or data patterns that should be represented?
|
|
55
|
+
|
|
56
|
+
### 4. **Field-by-Field Generation Improvements**
|
|
57
|
+
For each model and its fields, suggest specific improvements:
|
|
58
|
+
- Which Faker.js methods would generate more appropriate data?
|
|
59
|
+
- Should certain fields use smart generation based on field names?
|
|
60
|
+
- Are there field combinations that need coordinated generation?
|
|
61
|
+
- Should some fields use predefined realistic values instead of random data?
|
|
62
|
+
|
|
63
|
+
### 5. **Specific Actionable Recommendations**
|
|
64
|
+
Provide concrete suggestions to improve the dataset generation:
|
|
65
|
+
|
|
66
|
+
#### Example Format:
|
|
67
|
+
```
|
|
68
|
+
Model: Person
|
|
69
|
+
Field: firstName
|
|
70
|
+
Current Issue: Generic random words like "dolor sit"
|
|
71
|
+
Improvement: Use faker.person.firstName() for realistic names
|
|
72
|
+
Expected Result: "John", "María", "Wei", etc.
|
|
73
|
+
|
|
74
|
+
Field: age + parentEmail
|
|
75
|
+
Current Issue: parentEmail appears randomly regardless of age
|
|
76
|
+
Improvement: Only generate parentEmail when age < 18
|
|
77
|
+
Expected Result: Coherent parent-child relationships
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Please provide similar detailed recommendations for EACH field that needs improvement.
|
|
81
|
+
|
|
82
|
+
### 6. **Sample Improved Records**
|
|
83
|
+
Show 2-3 examples of what improved records should look like for each model, with realistic and coherent data that respects all field constraints and relationships.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Generation Strategy Recommendations
|
|
88
|
+
|
|
89
|
+
Based on your analysis, suggest:
|
|
90
|
+
1. **Smart Field Mapping**: Which field names should trigger specific Faker methods?
|
|
91
|
+
2. **Conditional Logic**: What field dependencies need to be handled?
|
|
92
|
+
3. **Realistic Ranges**: What are appropriate min/max values for numeric fields?
|
|
93
|
+
4. **Data Patterns**: What mix of typical vs. edge case values would be most useful?
|
|
94
|
+
5. **Relationship Handling**: How to ensure referential integrity and meaningful relationships?
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Technical Constraints (DO NOT CHANGE)
|
|
99
|
+
- Models are defined in `src/data/*.ts` and must NOT be modified
|
|
100
|
+
- All generated data must pass the model validations (required, min/max, regex, etc.)
|
|
101
|
+
- Output format is JSONL (one JSON object per line)
|
|
102
|
+
- Generation uses @faker-js/faker library
|
|
103
|
+
|
|
104
|
+
## Next Steps After Analysis
|
|
105
|
+
Once you provide your recommendations, I will:
|
|
106
|
+
1. Update the data generation logic to implement your suggestions
|
|
107
|
+
2. Regenerate the dataset with improved realistic data
|
|
108
|
+
3. Validate that all data passes model constraints
|
|
109
|
+
4. Load the improved dataset for testing
|
|
110
|
+
|
|
111
|
+
Please focus on making the data as realistic and useful as possible while respecting all existing model constraints and validations.
|