firestore-dart-generator 1.0.0-beta.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/CONFIG_FILE_GUIDE.md +445 -0
- package/IMPLEMENTATION_SUMMARY.md +305 -0
- package/LICENSE +22 -0
- package/QUICK_START.md +241 -0
- package/README.md +590 -0
- package/dist/config-file-loader.d.ts +35 -0
- package/dist/config-file-loader.d.ts.map +1 -0
- package/dist/config-file-loader.js +130 -0
- package/dist/config-file-loader.js.map +1 -0
- package/dist/config-loader.d.ts +21 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +125 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/dart-generator.d.ts +35 -0
- package/dist/dart-generator.d.ts.map +1 -0
- package/dist/dart-generator.js +167 -0
- package/dist/dart-generator.js.map +1 -0
- package/dist/firestore-client.d.ts +49 -0
- package/dist/firestore-client.d.ts.map +1 -0
- package/dist/firestore-client.js +227 -0
- package/dist/firestore-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive-cli.d.ts +5 -0
- package/dist/interactive-cli.d.ts.map +1 -0
- package/dist/interactive-cli.js +310 -0
- package/dist/interactive-cli.js.map +1 -0
- package/dist/schema-analyzer.d.ts +38 -0
- package/dist/schema-analyzer.d.ts.map +1 -0
- package/dist/schema-analyzer.js +350 -0
- package/dist/schema-analyzer.js.map +1 -0
- package/dist/templates/model.hbs +39 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/firestore-dart-gen.example.yaml +28 -0
- package/package.json +61 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.FirestoreClient = void 0;
|
|
40
|
+
const admin = __importStar(require("firebase-admin"));
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
class FirestoreClient {
|
|
45
|
+
constructor(projectId, serviceAccountPath) {
|
|
46
|
+
this.projectId = projectId;
|
|
47
|
+
this.serviceAccountPath = serviceAccountPath;
|
|
48
|
+
this.db = null;
|
|
49
|
+
this.initialized = false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Initialize Firebase Admin SDK
|
|
53
|
+
*/
|
|
54
|
+
async initialize() {
|
|
55
|
+
if (this.initialized) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
// Try to use service account path if provided
|
|
60
|
+
if (this.serviceAccountPath) {
|
|
61
|
+
const serviceAccountFullPath = path.resolve(process.cwd(), this.serviceAccountPath);
|
|
62
|
+
if (!fs.existsSync(serviceAccountFullPath)) {
|
|
63
|
+
throw new Error(`Service account file not found: ${serviceAccountFullPath}`);
|
|
64
|
+
}
|
|
65
|
+
const serviceAccount = JSON.parse(fs.readFileSync(serviceAccountFullPath, 'utf8'));
|
|
66
|
+
admin.initializeApp({
|
|
67
|
+
credential: admin.credential.cert(serviceAccount),
|
|
68
|
+
projectId: this.projectId || serviceAccount.project_id,
|
|
69
|
+
});
|
|
70
|
+
console.log(chalk_1.default.green('ā Firebase initialized with service account'));
|
|
71
|
+
}
|
|
72
|
+
// Try GOOGLE_APPLICATION_CREDENTIALS env variable
|
|
73
|
+
else if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
|
|
74
|
+
admin.initializeApp({
|
|
75
|
+
credential: admin.credential.applicationDefault(),
|
|
76
|
+
projectId: this.projectId || process.env.FIREBASE_PROJECT_ID,
|
|
77
|
+
});
|
|
78
|
+
console.log(chalk_1.default.green('ā Firebase initialized with application default credentials'));
|
|
79
|
+
}
|
|
80
|
+
// No credentials provided
|
|
81
|
+
else {
|
|
82
|
+
throw new Error('No Firebase credentials provided. Set GOOGLE_APPLICATION_CREDENTIALS env variable or use --service-account flag');
|
|
83
|
+
}
|
|
84
|
+
this.db = admin.firestore();
|
|
85
|
+
this.initialized = true;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error(chalk_1.default.red('ā Failed to initialize Firebase:'), error);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get Firestore instance
|
|
94
|
+
*/
|
|
95
|
+
getFirestore() {
|
|
96
|
+
if (!this.db) {
|
|
97
|
+
throw new Error('Firestore not initialized. Call initialize() first.');
|
|
98
|
+
}
|
|
99
|
+
return this.db;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Fetch sample documents from a collection
|
|
103
|
+
*/
|
|
104
|
+
async fetchSampleDocuments(collectionPath, limit = 20) {
|
|
105
|
+
if (!this.db) {
|
|
106
|
+
throw new Error('Firestore not initialized');
|
|
107
|
+
}
|
|
108
|
+
console.log(chalk_1.default.blue(`Fetching up to ${limit} documents from ${collectionPath}...`));
|
|
109
|
+
const snapshot = await this.db
|
|
110
|
+
.collection(collectionPath)
|
|
111
|
+
.limit(limit)
|
|
112
|
+
.get();
|
|
113
|
+
if (snapshot.empty) {
|
|
114
|
+
console.log(chalk_1.default.yellow(`ā No documents found in collection: ${collectionPath}`));
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
console.log(chalk_1.default.green(`ā Found ${snapshot.docs.length} documents`));
|
|
118
|
+
return snapshot.docs;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Fetch sample documents from a subcollection
|
|
122
|
+
*/
|
|
123
|
+
async fetchSampleDocumentsFromSubcollection(parentCollectionPath, subcollectionName, limit = 20) {
|
|
124
|
+
if (!this.db) {
|
|
125
|
+
throw new Error('Firestore not initialized');
|
|
126
|
+
}
|
|
127
|
+
console.log(chalk_1.default.blue(`Fetching subcollection ${subcollectionName} from ${parentCollectionPath}...`));
|
|
128
|
+
// Get a sample parent document
|
|
129
|
+
const parentSnapshot = await this.db
|
|
130
|
+
.collection(parentCollectionPath)
|
|
131
|
+
.limit(1)
|
|
132
|
+
.get();
|
|
133
|
+
if (parentSnapshot.empty) {
|
|
134
|
+
console.log(chalk_1.default.yellow(`ā No parent documents found in: ${parentCollectionPath}`));
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const parentDoc = parentSnapshot.docs[0];
|
|
138
|
+
console.log(chalk_1.default.gray(` Using parent document: ${parentDoc.id}`));
|
|
139
|
+
// Get subcollection documents
|
|
140
|
+
const subcollectionSnapshot = await parentDoc.ref
|
|
141
|
+
.collection(subcollectionName)
|
|
142
|
+
.limit(limit)
|
|
143
|
+
.get();
|
|
144
|
+
if (subcollectionSnapshot.empty) {
|
|
145
|
+
console.log(chalk_1.default.yellow(`ā No documents found in subcollection: ${subcollectionName}`));
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
console.log(chalk_1.default.green(`ā Found ${subcollectionSnapshot.docs.length} documents in subcollection`));
|
|
149
|
+
return subcollectionSnapshot.docs;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if collection exists
|
|
153
|
+
*/
|
|
154
|
+
async collectionExists(collectionPath) {
|
|
155
|
+
if (!this.db) {
|
|
156
|
+
throw new Error('Firestore not initialized');
|
|
157
|
+
}
|
|
158
|
+
const snapshot = await this.db.collection(collectionPath).limit(1).get();
|
|
159
|
+
return !snapshot.empty;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Check if subcollection exists
|
|
163
|
+
*/
|
|
164
|
+
async subcollectionExists(parentCollectionPath, subcollectionName) {
|
|
165
|
+
if (!this.db) {
|
|
166
|
+
throw new Error('Firestore not initialized');
|
|
167
|
+
}
|
|
168
|
+
// Get a sample parent document
|
|
169
|
+
const parentSnapshot = await this.db
|
|
170
|
+
.collection(parentCollectionPath)
|
|
171
|
+
.limit(1)
|
|
172
|
+
.get();
|
|
173
|
+
if (parentSnapshot.empty) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
const parentDoc = parentSnapshot.docs[0];
|
|
177
|
+
const subcollectionSnapshot = await parentDoc.ref
|
|
178
|
+
.collection(subcollectionName)
|
|
179
|
+
.limit(1)
|
|
180
|
+
.get();
|
|
181
|
+
return !subcollectionSnapshot.empty;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* List all root-level collections in the database
|
|
185
|
+
*/
|
|
186
|
+
async listCollections() {
|
|
187
|
+
if (!this.db) {
|
|
188
|
+
throw new Error('Firestore not initialized');
|
|
189
|
+
}
|
|
190
|
+
const collections = await this.db.listCollections();
|
|
191
|
+
return collections.map(col => col.id);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List subcollections for a given collection (by checking first document)
|
|
195
|
+
*/
|
|
196
|
+
async listSubcollections(collectionPath) {
|
|
197
|
+
if (!this.db) {
|
|
198
|
+
throw new Error('Firestore not initialized');
|
|
199
|
+
}
|
|
200
|
+
// Get first document to check subcollections
|
|
201
|
+
const snapshot = await this.db.collection(collectionPath).limit(1).get();
|
|
202
|
+
if (snapshot.empty) {
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
const doc = snapshot.docs[0];
|
|
206
|
+
const subcollections = await doc.ref.listCollections();
|
|
207
|
+
return subcollections.map(col => col.id);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get project ID from initialized Firebase app
|
|
211
|
+
*/
|
|
212
|
+
getProjectId() {
|
|
213
|
+
return admin.app().options.projectId;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Close Firebase connection
|
|
217
|
+
*/
|
|
218
|
+
async close() {
|
|
219
|
+
if (this.initialized) {
|
|
220
|
+
await admin.app().delete();
|
|
221
|
+
this.initialized = false;
|
|
222
|
+
this.db = null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
exports.FirestoreClient = FirestoreClient;
|
|
227
|
+
//# sourceMappingURL=firestore-client.js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C;IAED;;OAEG;IACH,YAAY;QACV,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;CACF;AAxOD,0CAwOC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const dotenv = __importStar(require("dotenv"));
|
|
42
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
+
const interactive_cli_1 = require("./interactive-cli");
|
|
44
|
+
// Load environment variables
|
|
45
|
+
dotenv.config();
|
|
46
|
+
const program = new commander_1.Command();
|
|
47
|
+
program
|
|
48
|
+
.name('firestore-dart-gen')
|
|
49
|
+
.description('Generate Dart models from Firestore collections')
|
|
50
|
+
.version('1.0.0')
|
|
51
|
+
.option('--service-account <path>', 'Path to Firebase service account JSON file')
|
|
52
|
+
.option('--project-id <id>', 'Firebase project ID', process.env.FIREBASE_PROJECT_ID)
|
|
53
|
+
.option('-c, --config <path>', 'Path to config file (firestore-dart-gen.yaml)')
|
|
54
|
+
.action(async (options) => {
|
|
55
|
+
try {
|
|
56
|
+
await (0, interactive_cli_1.runInteractiveCLI)(options.serviceAccount, options.projectId, options.config);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error(chalk_1.default.red('\nError:'), error);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
// Parse and run
|
|
64
|
+
program.parse();
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,+CAAiC;AACjC,kDAA0B;AAC1B,uDAAsD;AAEtD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,oBAAoB,CAAC;KAC1B,WAAW,CAAC,iDAAiD,CAAC;KAC9D,OAAO,CAAC,OAAO,CAAC;KAChB,MAAM,CAAC,0BAA0B,EAAE,4CAA4C,CAAC;KAChF,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;KACnF,MAAM,CAAC,qBAAqB,EAAE,+CAA+C,CAAC;KAC9E,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,IAAA,mCAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACrF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,gBAAgB;AAChB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-cli.d.ts","sourceRoot":"","sources":["../src/interactive-cli.ts"],"names":[],"mappings":"AA+CA;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,kBAAkB,CAAC,EAAE,MAAM,EAC3B,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CA8Qf"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.runInteractiveCLI = runInteractiveCLI;
|
|
40
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const child_process_1 = require("child_process");
|
|
44
|
+
const firestore_client_1 = require("./firestore-client");
|
|
45
|
+
const schema_analyzer_1 = require("./schema-analyzer");
|
|
46
|
+
const dart_generator_1 = require("./dart-generator");
|
|
47
|
+
const config_file_loader_1 = require("./config-file-loader");
|
|
48
|
+
/**
|
|
49
|
+
* Run dart format command
|
|
50
|
+
*/
|
|
51
|
+
function runDartFormat(directory) {
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
console.log(chalk_1.default.gray(` Formatting: ${directory}`));
|
|
54
|
+
const dartFormat = (0, child_process_1.spawn)('dart', ['format', '.'], {
|
|
55
|
+
cwd: directory,
|
|
56
|
+
stdio: 'pipe',
|
|
57
|
+
});
|
|
58
|
+
let stdout = '';
|
|
59
|
+
let stderr = '';
|
|
60
|
+
dartFormat.stdout?.on('data', (data) => {
|
|
61
|
+
stdout += data.toString();
|
|
62
|
+
});
|
|
63
|
+
dartFormat.stderr?.on('data', (data) => {
|
|
64
|
+
stderr += data.toString();
|
|
65
|
+
});
|
|
66
|
+
dartFormat.on('close', (code) => {
|
|
67
|
+
if (code === 0) {
|
|
68
|
+
console.log(chalk_1.default.green(` ā Formatted: ${directory}`));
|
|
69
|
+
resolve();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
reject(new Error(stderr || 'dart format failed'));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
dartFormat.on('error', (error) => {
|
|
76
|
+
reject(new Error(`dart command not found. Make sure Dart SDK is installed: ${error.message}`));
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Run interactive CLI mode
|
|
82
|
+
*/
|
|
83
|
+
async function runInteractiveCLI(serviceAccountPath, projectId, configPath) {
|
|
84
|
+
console.log(chalk_1.default.bold.blue('\nš„ Firestore Dart Generator - Interactive Mode\n'));
|
|
85
|
+
// Load config file if exists
|
|
86
|
+
const config = config_file_loader_1.ConfigFileLoader.loadConfig(configPath);
|
|
87
|
+
// Resolve credentials with priority: CLI args > config file > env
|
|
88
|
+
const resolvedServiceAccount = config_file_loader_1.ConfigFileLoader.resolveServiceAccountPath(config, serviceAccountPath);
|
|
89
|
+
const resolvedProjectId = config_file_loader_1.ConfigFileLoader.resolveProjectId(config, projectId);
|
|
90
|
+
// Initialize Firebase
|
|
91
|
+
const client = new firestore_client_1.FirestoreClient(resolvedProjectId, resolvedServiceAccount);
|
|
92
|
+
// Handle interruption (Ctrl+C)
|
|
93
|
+
process.on('SIGINT', async () => {
|
|
94
|
+
console.log(chalk_1.default.yellow('\n\nā Process interrupted by user'));
|
|
95
|
+
await client.close();
|
|
96
|
+
process.exit(0);
|
|
97
|
+
});
|
|
98
|
+
try {
|
|
99
|
+
await client.initialize();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
console.error(chalk_1.default.red('\nā Failed to connect to Firebase'));
|
|
103
|
+
console.error(chalk_1.default.yellow('\nPossible solutions:'));
|
|
104
|
+
console.error(chalk_1.default.gray(' 1. Check your service account file path'));
|
|
105
|
+
console.error(chalk_1.default.gray(' 2. Verify your Firebase project ID'));
|
|
106
|
+
console.error(chalk_1.default.gray(' 3. Ensure service account has read permissions\n'));
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
const firebaseProjectId = client.getProjectId();
|
|
110
|
+
console.log(chalk_1.default.green(`ā Connected to Firebase Project: ${chalk_1.default.bold(firebaseProjectId)}\n`));
|
|
111
|
+
try {
|
|
112
|
+
// List collections
|
|
113
|
+
console.log(chalk_1.default.blue('š Discovering collections...\n'));
|
|
114
|
+
const collections = await client.listCollections();
|
|
115
|
+
if (collections.length === 0) {
|
|
116
|
+
console.log(chalk_1.default.yellow('ā No collections found in this project'));
|
|
117
|
+
await client.close();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
console.log(chalk_1.default.blue(`Found ${collections.length} collection(s)\n`));
|
|
121
|
+
// Get pre-selected collections from config
|
|
122
|
+
const preSelected = config?.collections || [];
|
|
123
|
+
if (preSelected.length > 0) {
|
|
124
|
+
console.log(chalk_1.default.gray(`Pre-selected from config: ${preSelected.join(', ')}\n`));
|
|
125
|
+
}
|
|
126
|
+
// Select collections (multiple)
|
|
127
|
+
const { selectedCollections } = await inquirer_1.default.prompt([
|
|
128
|
+
{
|
|
129
|
+
type: 'checkbox',
|
|
130
|
+
name: 'selectedCollections',
|
|
131
|
+
message: 'Select collections to generate models for:',
|
|
132
|
+
choices: collections.map(col => ({
|
|
133
|
+
name: col,
|
|
134
|
+
value: col,
|
|
135
|
+
checked: preSelected.includes(col), // PRE-SELECCIONAR
|
|
136
|
+
})),
|
|
137
|
+
validate: (answer) => {
|
|
138
|
+
if (answer.length < 1) {
|
|
139
|
+
return 'You must select at least one collection';
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
if (selectedCollections.length === 0) {
|
|
146
|
+
console.log(chalk_1.default.yellow('\nNo collections selected. Exiting.'));
|
|
147
|
+
await client.close();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// Detect and ask about subcollections
|
|
151
|
+
const collectionsWithSubs = new Map();
|
|
152
|
+
console.log(chalk_1.default.blue('\nš³ Checking for subcollections...\n'));
|
|
153
|
+
for (const collection of selectedCollections) {
|
|
154
|
+
console.log(chalk_1.default.gray(` Analyzing ${collection}...`));
|
|
155
|
+
const subcollections = await client.listSubcollections(collection);
|
|
156
|
+
if (subcollections.length > 0) {
|
|
157
|
+
console.log(chalk_1.default.cyan(` Found ${subcollections.length} subcollection(s): ${subcollections.join(', ')}`));
|
|
158
|
+
const { includeSubcollections } = await inquirer_1.default.prompt([
|
|
159
|
+
{
|
|
160
|
+
type: 'confirm',
|
|
161
|
+
name: 'includeSubcollections',
|
|
162
|
+
message: ` Include subcollections for ${chalk_1.default.bold(collection)}?`,
|
|
163
|
+
default: true,
|
|
164
|
+
},
|
|
165
|
+
]);
|
|
166
|
+
if (includeSubcollections) {
|
|
167
|
+
collectionsWithSubs.set(collection, subcollections);
|
|
168
|
+
}
|
|
169
|
+
console.log('');
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
console.log(chalk_1.default.gray(` No subcollections found\n`));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Configure output directory (with default from config)
|
|
176
|
+
const { outputDirectory } = await inquirer_1.default.prompt([
|
|
177
|
+
{
|
|
178
|
+
type: 'input',
|
|
179
|
+
name: 'outputDirectory',
|
|
180
|
+
message: 'Output directory for generated Dart files:',
|
|
181
|
+
default: config?.output?.directory || './lib/src/models',
|
|
182
|
+
validate: (input) => {
|
|
183
|
+
if (!input || input.trim() === '') {
|
|
184
|
+
return 'Output directory cannot be empty';
|
|
185
|
+
}
|
|
186
|
+
return true;
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
]);
|
|
190
|
+
// Configure sample size (with default from config)
|
|
191
|
+
const { sampleSize } = await inquirer_1.default.prompt([
|
|
192
|
+
{
|
|
193
|
+
type: 'number',
|
|
194
|
+
name: 'sampleSize',
|
|
195
|
+
message: 'Number of documents to sample per collection:',
|
|
196
|
+
default: config?.output?.sampleSize || 20,
|
|
197
|
+
validate: (input) => {
|
|
198
|
+
const num = Number(input);
|
|
199
|
+
if (isNaN(num) || num < 1) {
|
|
200
|
+
return 'Sample size must be at least 1';
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
]);
|
|
206
|
+
// Show summary and confirm
|
|
207
|
+
console.log(chalk_1.default.bold.cyan('\nš Generation Summary:'));
|
|
208
|
+
console.log(chalk_1.default.gray('ā'.repeat(60)));
|
|
209
|
+
console.log(chalk_1.default.white(` Firebase Project: ${firebaseProjectId}`));
|
|
210
|
+
console.log(chalk_1.default.white(` Collections: ${selectedCollections.join(', ')}`));
|
|
211
|
+
if (collectionsWithSubs.size > 0) {
|
|
212
|
+
console.log(chalk_1.default.white(' Subcollections:'));
|
|
213
|
+
for (const [parent, subs] of collectionsWithSubs.entries()) {
|
|
214
|
+
console.log(chalk_1.default.gray(` āā ${parent}: ${subs.join(', ')}`));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
console.log(chalk_1.default.white(` Output: ${outputDirectory}`));
|
|
218
|
+
console.log(chalk_1.default.white(` Sample Size: ${sampleSize} documents per collection`));
|
|
219
|
+
console.log(chalk_1.default.gray('ā'.repeat(60)));
|
|
220
|
+
const { confirmGeneration } = await inquirer_1.default.prompt([
|
|
221
|
+
{
|
|
222
|
+
type: 'confirm',
|
|
223
|
+
name: 'confirmGeneration',
|
|
224
|
+
message: 'Generate Dart models with these settings?',
|
|
225
|
+
default: true,
|
|
226
|
+
},
|
|
227
|
+
]);
|
|
228
|
+
if (!confirmGeneration) {
|
|
229
|
+
console.log(chalk_1.default.yellow('\nā Generation cancelled by user\n'));
|
|
230
|
+
await client.close();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
// Generate models
|
|
234
|
+
console.log(chalk_1.default.bold.blue('\nš Starting generation...\n'));
|
|
235
|
+
const analyzer = new schema_analyzer_1.SchemaAnalyzer();
|
|
236
|
+
const generator = new dart_generator_1.DartGenerator();
|
|
237
|
+
const generatedFiles = [];
|
|
238
|
+
const outputPath = path.resolve(process.cwd(), outputDirectory);
|
|
239
|
+
// Process main collections
|
|
240
|
+
for (const collection of selectedCollections) {
|
|
241
|
+
console.log(chalk_1.default.bold(`\nš¦ Processing collection: ${collection}`));
|
|
242
|
+
// Check if collection exists and has documents
|
|
243
|
+
const exists = await client.collectionExists(collection);
|
|
244
|
+
if (!exists) {
|
|
245
|
+
console.log(chalk_1.default.yellow(` ā No documents found, skipping\n`));
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const documents = await client.fetchSampleDocuments(collection, sampleSize);
|
|
249
|
+
if (documents.length === 0) {
|
|
250
|
+
console.log(chalk_1.default.yellow(` ā No documents found, skipping\n`));
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const schema = analyzer.analyzeDocuments(collection, documents);
|
|
254
|
+
const filePath = await generator.writeModelToFile(schema, outputPath);
|
|
255
|
+
generatedFiles.push(filePath);
|
|
256
|
+
console.log('');
|
|
257
|
+
// Process subcollections
|
|
258
|
+
const subcollections = collectionsWithSubs.get(collection) || [];
|
|
259
|
+
for (const subcollection of subcollections) {
|
|
260
|
+
console.log(chalk_1.default.bold(`\nš¦ Processing subcollection: ${collection}/${subcollection}`));
|
|
261
|
+
const subExists = await client.subcollectionExists(collection, subcollection);
|
|
262
|
+
if (!subExists) {
|
|
263
|
+
console.log(chalk_1.default.yellow(` ā No documents found, skipping\n`));
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const subDocs = await client.fetchSampleDocumentsFromSubcollection(collection, subcollection, sampleSize);
|
|
267
|
+
if (subDocs.length === 0) {
|
|
268
|
+
console.log(chalk_1.default.yellow(` ā No documents found, skipping\n`));
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const subSchema = analyzer.analyzeDocuments(subcollection, subDocs);
|
|
272
|
+
const subFilePath = await generator.writeModelToFile(subSchema, outputPath);
|
|
273
|
+
generatedFiles.push(subFilePath);
|
|
274
|
+
console.log('');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (generatedFiles.length === 0) {
|
|
278
|
+
console.log(chalk_1.default.yellow('\nā No models were generated (no documents found)\n'));
|
|
279
|
+
await client.close();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
// Generate barrel file if multiple models
|
|
283
|
+
if (generatedFiles.length > 1) {
|
|
284
|
+
await generator.generateBarrelFile(outputPath, generatedFiles);
|
|
285
|
+
}
|
|
286
|
+
// Format files
|
|
287
|
+
console.log(chalk_1.default.bold.blue('šØ Formatting generated files...\n'));
|
|
288
|
+
try {
|
|
289
|
+
await runDartFormat(outputPath);
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
console.log(chalk_1.default.yellow(`ā Could not format files: ${error}\n`));
|
|
293
|
+
}
|
|
294
|
+
// Show success
|
|
295
|
+
console.log(chalk_1.default.bold.green(`\n⨠Success! Generated ${generatedFiles.length} model(s)\n`));
|
|
296
|
+
console.log(chalk_1.default.cyan('Generated files:'));
|
|
297
|
+
generatedFiles.forEach(file => {
|
|
298
|
+
const relativePath = path.relative(process.cwd(), file);
|
|
299
|
+
console.log(chalk_1.default.green(` ā ${relativePath}`));
|
|
300
|
+
});
|
|
301
|
+
console.log(chalk_1.default.bold('\nš Next steps:'));
|
|
302
|
+
console.log(chalk_1.default.gray(' 1. Review the generated files'));
|
|
303
|
+
console.log(chalk_1.default.gray(' 2. Import the models in your Dart code'));
|
|
304
|
+
console.log(chalk_1.default.gray(` 3. Add 'equatable' to your pubspec.yaml if not already present\n`));
|
|
305
|
+
}
|
|
306
|
+
finally {
|
|
307
|
+
await client.close();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=interactive-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-cli.js","sourceRoot":"","sources":["../src/interactive-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,8CAkRC;AApUD,wDAAgC;AAChC,kDAA0B;AAC1B,2CAA6B;AAC7B,iDAAsC;A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