appwrite-utils-cli 0.10.86 → 1.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.
Files changed (178) hide show
  1. package/.appwrite/.yaml_schemas/appwrite-config.schema.json +380 -0
  2. package/.appwrite/.yaml_schemas/collection.schema.json +255 -0
  3. package/.appwrite/collections/Categories.yaml +182 -0
  4. package/.appwrite/collections/ExampleCollection.yaml +36 -0
  5. package/.appwrite/collections/Posts.yaml +227 -0
  6. package/.appwrite/collections/Users.yaml +149 -0
  7. package/.appwrite/config.yaml +109 -0
  8. package/.appwrite/import/README.md +148 -0
  9. package/.appwrite/import/categories-import.yaml +129 -0
  10. package/.appwrite/import/posts-import.yaml +208 -0
  11. package/.appwrite/import/users-import.yaml +130 -0
  12. package/.appwrite/importData/categories.json +194 -0
  13. package/.appwrite/importData/posts.json +270 -0
  14. package/.appwrite/importData/users.json +220 -0
  15. package/.appwrite/schemas/categories.json +128 -0
  16. package/.appwrite/schemas/exampleCollection.json +52 -0
  17. package/.appwrite/schemas/posts.json +173 -0
  18. package/.appwrite/schemas/users.json +125 -0
  19. package/README.md +260 -33
  20. package/dist/collections/attributes.js +3 -2
  21. package/dist/collections/methods.js +56 -38
  22. package/dist/config/yamlConfig.d.ts +501 -0
  23. package/dist/config/yamlConfig.js +452 -0
  24. package/dist/databases/setup.d.ts +6 -0
  25. package/dist/databases/setup.js +119 -0
  26. package/dist/functions/methods.d.ts +1 -1
  27. package/dist/functions/methods.js +5 -2
  28. package/dist/functions/openapi.d.ts +4 -0
  29. package/dist/functions/openapi.js +60 -0
  30. package/dist/interactiveCLI.d.ts +5 -0
  31. package/dist/interactiveCLI.js +194 -49
  32. package/dist/main.js +91 -30
  33. package/dist/migrations/afterImportActions.js +2 -2
  34. package/dist/migrations/appwriteToX.d.ts +10 -0
  35. package/dist/migrations/appwriteToX.js +15 -4
  36. package/dist/migrations/backup.d.ts +16 -16
  37. package/dist/migrations/dataLoader.d.ts +83 -1
  38. package/dist/migrations/dataLoader.js +4 -4
  39. package/dist/migrations/importController.js +25 -18
  40. package/dist/migrations/importDataActions.js +2 -2
  41. package/dist/migrations/logging.d.ts +9 -1
  42. package/dist/migrations/logging.js +41 -22
  43. package/dist/migrations/migrationHelper.d.ts +4 -4
  44. package/dist/migrations/relationships.js +1 -1
  45. package/dist/migrations/services/DataTransformationService.d.ts +55 -0
  46. package/dist/migrations/services/DataTransformationService.js +158 -0
  47. package/dist/migrations/services/FileHandlerService.d.ts +75 -0
  48. package/dist/migrations/services/FileHandlerService.js +236 -0
  49. package/dist/migrations/services/ImportOrchestrator.d.ts +97 -0
  50. package/dist/migrations/services/ImportOrchestrator.js +488 -0
  51. package/dist/migrations/services/RateLimitManager.d.ts +138 -0
  52. package/dist/migrations/services/RateLimitManager.js +279 -0
  53. package/dist/migrations/services/RelationshipResolver.d.ts +120 -0
  54. package/dist/migrations/services/RelationshipResolver.js +332 -0
  55. package/dist/migrations/services/UserMappingService.d.ts +109 -0
  56. package/dist/migrations/services/UserMappingService.js +277 -0
  57. package/dist/migrations/services/ValidationService.d.ts +74 -0
  58. package/dist/migrations/services/ValidationService.js +260 -0
  59. package/dist/migrations/transfer.d.ts +0 -6
  60. package/dist/migrations/transfer.js +16 -132
  61. package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +384 -0
  62. package/dist/migrations/yaml/YamlImportConfigLoader.js +375 -0
  63. package/dist/migrations/yaml/YamlImportIntegration.d.ts +87 -0
  64. package/dist/migrations/yaml/YamlImportIntegration.js +330 -0
  65. package/dist/migrations/yaml/generateImportSchemas.d.ts +17 -0
  66. package/dist/migrations/yaml/generateImportSchemas.js +575 -0
  67. package/dist/schemas/authUser.d.ts +9 -9
  68. package/dist/shared/attributeManager.d.ts +17 -0
  69. package/dist/shared/attributeManager.js +273 -0
  70. package/dist/shared/confirmationDialogs.d.ts +75 -0
  71. package/dist/shared/confirmationDialogs.js +236 -0
  72. package/dist/shared/functionManager.d.ts +48 -0
  73. package/dist/shared/functionManager.js +322 -0
  74. package/dist/shared/indexManager.d.ts +24 -0
  75. package/dist/shared/indexManager.js +150 -0
  76. package/dist/shared/jsonSchemaGenerator.d.ts +51 -0
  77. package/dist/shared/jsonSchemaGenerator.js +313 -0
  78. package/dist/shared/logging.d.ts +10 -0
  79. package/dist/shared/logging.js +46 -0
  80. package/dist/shared/messageFormatter.d.ts +37 -0
  81. package/dist/shared/messageFormatter.js +152 -0
  82. package/dist/shared/migrationHelpers.d.ts +173 -0
  83. package/dist/shared/migrationHelpers.js +142 -0
  84. package/dist/shared/operationLogger.d.ts +3 -0
  85. package/dist/shared/operationLogger.js +25 -0
  86. package/dist/shared/operationQueue.d.ts +13 -0
  87. package/dist/shared/operationQueue.js +79 -0
  88. package/dist/shared/progressManager.d.ts +62 -0
  89. package/dist/shared/progressManager.js +215 -0
  90. package/dist/shared/schemaGenerator.d.ts +18 -0
  91. package/dist/shared/schemaGenerator.js +523 -0
  92. package/dist/storage/methods.d.ts +3 -1
  93. package/dist/storage/methods.js +144 -55
  94. package/dist/storage/schemas.d.ts +56 -16
  95. package/dist/types.d.ts +2 -2
  96. package/dist/types.js +1 -1
  97. package/dist/users/methods.d.ts +16 -0
  98. package/dist/users/methods.js +276 -0
  99. package/dist/utils/configMigration.d.ts +1 -0
  100. package/dist/utils/configMigration.js +156 -0
  101. package/dist/utils/dataConverters.d.ts +46 -0
  102. package/dist/utils/dataConverters.js +139 -0
  103. package/dist/utils/loadConfigs.d.ts +15 -4
  104. package/dist/utils/loadConfigs.js +377 -51
  105. package/dist/utils/schemaStrings.js +2 -1
  106. package/dist/utils/setupFiles.d.ts +2 -1
  107. package/dist/utils/setupFiles.js +723 -28
  108. package/dist/utils/validationRules.d.ts +43 -0
  109. package/dist/utils/validationRules.js +42 -0
  110. package/dist/utils/yamlConverter.d.ts +48 -0
  111. package/dist/utils/yamlConverter.js +98 -0
  112. package/dist/utilsController.js +65 -43
  113. package/package.json +19 -15
  114. package/src/collections/attributes.ts +3 -2
  115. package/src/collections/methods.ts +85 -51
  116. package/src/config/yamlConfig.ts +488 -0
  117. package/src/{migrations/setupDatabase.ts → databases/setup.ts} +11 -5
  118. package/src/functions/methods.ts +8 -4
  119. package/src/functions/templates/count-docs-in-collection/package.json +25 -0
  120. package/src/functions/templates/count-docs-in-collection/tsconfig.json +28 -0
  121. package/src/functions/templates/typescript-node/package.json +24 -0
  122. package/src/functions/templates/typescript-node/tsconfig.json +28 -0
  123. package/src/functions/templates/uv/README.md +31 -0
  124. package/src/functions/templates/uv/pyproject.toml +29 -0
  125. package/src/interactiveCLI.ts +226 -61
  126. package/src/main.ts +111 -37
  127. package/src/migrations/afterImportActions.ts +2 -2
  128. package/src/migrations/appwriteToX.ts +17 -4
  129. package/src/migrations/dataLoader.ts +4 -4
  130. package/src/migrations/importController.ts +30 -22
  131. package/src/migrations/importDataActions.ts +2 -2
  132. package/src/migrations/relationships.ts +1 -1
  133. package/src/migrations/services/DataTransformationService.ts +196 -0
  134. package/src/migrations/services/FileHandlerService.ts +311 -0
  135. package/src/migrations/services/ImportOrchestrator.ts +669 -0
  136. package/src/migrations/services/RateLimitManager.ts +363 -0
  137. package/src/migrations/services/RelationshipResolver.ts +461 -0
  138. package/src/migrations/services/UserMappingService.ts +345 -0
  139. package/src/migrations/services/ValidationService.ts +349 -0
  140. package/src/migrations/transfer.ts +22 -228
  141. package/src/migrations/yaml/YamlImportConfigLoader.ts +427 -0
  142. package/src/migrations/yaml/YamlImportIntegration.ts +419 -0
  143. package/src/migrations/yaml/generateImportSchemas.ts +589 -0
  144. package/src/shared/attributeManager.ts +429 -0
  145. package/src/shared/confirmationDialogs.ts +327 -0
  146. package/src/shared/functionManager.ts +515 -0
  147. package/src/shared/indexManager.ts +253 -0
  148. package/src/shared/jsonSchemaGenerator.ts +403 -0
  149. package/src/shared/logging.ts +74 -0
  150. package/src/shared/messageFormatter.ts +195 -0
  151. package/src/{migrations/migrationHelper.ts → shared/migrationHelpers.ts} +22 -4
  152. package/src/{migrations/helper.ts → shared/operationLogger.ts} +7 -2
  153. package/src/{migrations/queue.ts → shared/operationQueue.ts} +1 -1
  154. package/src/shared/progressManager.ts +278 -0
  155. package/src/{migrations/schemaStrings.ts → shared/schemaGenerator.ts} +71 -17
  156. package/src/storage/methods.ts +199 -78
  157. package/src/types.ts +2 -2
  158. package/src/{migrations/users.ts → users/methods.ts} +2 -2
  159. package/src/utils/configMigration.ts +212 -0
  160. package/src/utils/loadConfigs.ts +414 -52
  161. package/src/utils/schemaStrings.ts +2 -1
  162. package/src/utils/setupFiles.ts +742 -40
  163. package/src/{migrations → utils}/validationRules.ts +1 -1
  164. package/src/utils/yamlConverter.ts +131 -0
  165. package/src/utilsController.ts +75 -54
  166. package/src/functions/templates/poetry/README.md +0 -30
  167. package/src/functions/templates/poetry/pyproject.toml +0 -16
  168. package/src/migrations/attributes.ts +0 -561
  169. package/src/migrations/backup.ts +0 -205
  170. package/src/migrations/databases.ts +0 -39
  171. package/src/migrations/dbHelpers.ts +0 -92
  172. package/src/migrations/indexes.ts +0 -40
  173. package/src/migrations/logging.ts +0 -29
  174. package/src/migrations/storage.ts +0 -538
  175. /package/src/{migrations → functions}/openapi.ts +0 -0
  176. /package/src/functions/templates/{poetry → uv}/src/__init__.py +0 -0
  177. /package/src/functions/templates/{poetry → uv}/src/index.py +0 -0
  178. /package/src/{migrations/converters.ts → utils/dataConverters.ts} +0 -0
@@ -0,0 +1,330 @@
1
+ import { YamlImportConfigLoader } from "./YamlImportConfigLoader.js";
2
+ import { createImportSchemas, createImportExamples } from "./generateImportSchemas.js";
3
+ import { logger } from "../../shared/logging.js";
4
+ import path from "path";
5
+ import fs from "fs";
6
+ /**
7
+ * Integration service that bridges YAML import configurations with the existing import system.
8
+ * Provides seamless integration between new YAML configs and legacy TypeScript collection definitions.
9
+ */
10
+ export class YamlImportIntegration {
11
+ configLoader;
12
+ appwriteFolderPath;
13
+ constructor(appwriteFolderPath) {
14
+ this.appwriteFolderPath = appwriteFolderPath;
15
+ this.configLoader = new YamlImportConfigLoader(appwriteFolderPath);
16
+ }
17
+ /**
18
+ * Initializes the YAML import system.
19
+ * Creates necessary directories, schemas, and example files.
20
+ */
21
+ async initialize() {
22
+ try {
23
+ // Create import directory structure
24
+ await this.configLoader.createImportStructure();
25
+ // Generate JSON schemas for IntelliSense
26
+ await createImportSchemas(this.appwriteFolderPath);
27
+ // Create example configurations
28
+ await createImportExamples(this.appwriteFolderPath);
29
+ logger.info("YAML import system initialized successfully");
30
+ }
31
+ catch (error) {
32
+ logger.error("Failed to initialize YAML import system:", error);
33
+ throw error;
34
+ }
35
+ }
36
+ /**
37
+ * Merges YAML import configurations with existing collection definitions.
38
+ * Allows collections to have both TypeScript and YAML import definitions.
39
+ *
40
+ * @param collections - Existing collection configurations
41
+ * @returns Collections with merged import definitions
42
+ */
43
+ async mergeWithCollections(collections) {
44
+ try {
45
+ // Load all YAML import configurations
46
+ const yamlConfigs = await this.configLoader.loadAllImportConfigs();
47
+ if (yamlConfigs.size === 0) {
48
+ logger.info("No YAML import configurations found, using existing collection definitions");
49
+ return collections;
50
+ }
51
+ logger.info(`Found YAML import configurations for ${yamlConfigs.size} collections`);
52
+ const mergedCollections = [...collections];
53
+ // Process each collection with YAML configs
54
+ for (const [collectionName, yamlConfigList] of yamlConfigs.entries()) {
55
+ const existingCollection = mergedCollections.find(c => c.name === collectionName);
56
+ if (existingCollection) {
57
+ // Merge with existing collection
58
+ const yamlImportDefs = yamlConfigList.map(yamlConfig => this.configLoader.convertToImportDef(yamlConfig));
59
+ // Combine existing and YAML import definitions
60
+ const existingImportDefs = existingCollection.importDefs || [];
61
+ existingCollection.importDefs = [...existingImportDefs, ...yamlImportDefs];
62
+ logger.info(`Merged ${yamlImportDefs.length} YAML import definitions with collection: ${collectionName}`);
63
+ }
64
+ else {
65
+ // Create new collection from YAML config
66
+ const yamlImportDefs = yamlConfigList.map(yamlConfig => this.configLoader.convertToImportDef(yamlConfig));
67
+ const newCollection = {
68
+ name: collectionName,
69
+ $id: collectionName.toLowerCase().replace(/\s+/g, '_'),
70
+ enabled: true,
71
+ documentSecurity: false,
72
+ $permissions: [],
73
+ attributes: [], // Will be populated from existing collection or schema
74
+ indexes: [],
75
+ importDefs: yamlImportDefs,
76
+ };
77
+ mergedCollections.push(newCollection);
78
+ logger.info(`Created new collection from YAML config: ${collectionName}`);
79
+ }
80
+ }
81
+ return mergedCollections;
82
+ }
83
+ catch (error) {
84
+ logger.error("Failed to merge YAML configurations with collections:", error);
85
+ // Return original collections on error to avoid breaking existing functionality
86
+ return collections;
87
+ }
88
+ }
89
+ /**
90
+ * Validates YAML import configurations against existing collection schemas.
91
+ * Ensures that all target fields exist in the collection definitions.
92
+ *
93
+ * @param collections - Collection definitions to validate against
94
+ * @returns Validation results with errors and warnings
95
+ */
96
+ async validateConfigurations(collections) {
97
+ const errors = [];
98
+ const warnings = [];
99
+ try {
100
+ const yamlConfigs = await this.configLoader.loadAllImportConfigs();
101
+ for (const [collectionName, yamlConfigList] of yamlConfigs.entries()) {
102
+ const collection = collections.find(c => c.name === collectionName);
103
+ if (!collection) {
104
+ warnings.push(`YAML import config references non-existent collection: ${collectionName}`);
105
+ continue;
106
+ }
107
+ for (let i = 0; i < yamlConfigList.length; i++) {
108
+ const yamlConfig = yamlConfigList[i];
109
+ const configErrors = this.configLoader.validateAgainstCollection(yamlConfig, collection.attributes || []);
110
+ errors.push(...configErrors.map(err => `${collectionName}[${i}]: ${err}`));
111
+ // Additional validation
112
+ this.validateSourceFiles(yamlConfig, errors, collectionName, i);
113
+ this.validateConverters(yamlConfig, warnings, collectionName, i);
114
+ }
115
+ }
116
+ return {
117
+ isValid: errors.length === 0,
118
+ errors,
119
+ warnings,
120
+ };
121
+ }
122
+ catch (error) {
123
+ errors.push(`Failed to validate YAML configurations: ${error}`);
124
+ return {
125
+ isValid: false,
126
+ errors,
127
+ warnings,
128
+ };
129
+ }
130
+ }
131
+ /**
132
+ * Validates that source files exist for import configurations.
133
+ */
134
+ validateSourceFiles(yamlConfig, errors, collectionName, configIndex) {
135
+ const sourceFilePath = path.resolve(this.appwriteFolderPath, yamlConfig.source.file);
136
+ if (!fs.existsSync(sourceFilePath)) {
137
+ errors.push(`${collectionName}[${configIndex}]: Source file not found: ${yamlConfig.source.file}`);
138
+ }
139
+ }
140
+ /**
141
+ * Validates that converter functions are available.
142
+ */
143
+ validateConverters(yamlConfig, warnings, collectionName, configIndex) {
144
+ const availableConverters = [
145
+ "anyToString",
146
+ "anyToNumber",
147
+ "anyToBoolean",
148
+ "anyToDate",
149
+ "stringToLowerCase",
150
+ "stringToUpperCase",
151
+ "stringTrim",
152
+ "numberToString",
153
+ "booleanToString",
154
+ "dateToString",
155
+ "dateToTimestamp",
156
+ "timestampToDate",
157
+ "arrayToString",
158
+ "stringToArray",
159
+ "removeNulls",
160
+ "removeEmpty"
161
+ ];
162
+ for (const mapping of yamlConfig.mapping.attributes) {
163
+ for (const converter of mapping.converters) {
164
+ const cleanConverter = converter.replace(/\[arr\]/gi, "").replace(/\[Arr\]/gi, "");
165
+ if (!availableConverters.includes(cleanConverter)) {
166
+ warnings.push(`${collectionName}[${configIndex}]: Unknown converter '${converter}' in mapping for '${mapping.targetKey}'`);
167
+ }
168
+ }
169
+ }
170
+ }
171
+ /**
172
+ * Generates a YAML import configuration from an existing ImportDef.
173
+ * Useful for migrating TypeScript configurations to YAML.
174
+ *
175
+ * @param importDef - Existing ImportDef to convert
176
+ * @param collectionName - Name of the collection
177
+ * @returns YAML configuration string
178
+ */
179
+ convertImportDefToYaml(importDef, collectionName) {
180
+ const yamlConfig = {
181
+ source: {
182
+ file: importDef.filePath,
183
+ basePath: importDef.basePath,
184
+ type: "json",
185
+ },
186
+ target: {
187
+ collection: collectionName,
188
+ type: importDef.type || "create",
189
+ primaryKey: importDef.primaryKeyField,
190
+ createUsers: importDef.createUsers || false,
191
+ },
192
+ mapping: {
193
+ attributes: importDef.attributeMappings.map(attr => ({
194
+ oldKey: attr.oldKey,
195
+ oldKeys: attr.oldKeys,
196
+ targetKey: attr.targetKey,
197
+ valueToSet: attr.valueToSet,
198
+ fileData: attr.fileData,
199
+ converters: attr.converters || [],
200
+ validation: (attr.validationActions || []).map(v => ({
201
+ rule: v.action,
202
+ params: v.params,
203
+ })),
204
+ afterImport: (attr.postImportActions || []).map(a => ({
205
+ action: a.action,
206
+ params: a.params,
207
+ })),
208
+ })),
209
+ relationships: (importDef.idMappings || []).map(rel => ({
210
+ sourceField: rel.sourceField,
211
+ targetField: rel.targetField,
212
+ targetCollection: rel.targetCollection,
213
+ fieldToSet: rel.fieldToSet,
214
+ targetFieldToMatch: rel.targetFieldToMatch,
215
+ })),
216
+ },
217
+ options: {
218
+ batchSize: 50,
219
+ skipValidation: false,
220
+ dryRun: false,
221
+ continueOnError: true,
222
+ updateMapping: importDef.updateMapping,
223
+ },
224
+ };
225
+ const yaml = require("js-yaml");
226
+ const yamlContent = yaml.dump(yamlConfig, {
227
+ indent: 2,
228
+ lineWidth: 120,
229
+ sortKeys: false,
230
+ });
231
+ return `# yaml-language-server: $schema=../.yaml_schemas/import-config.schema.json\n# Import Configuration for ${collectionName}\n\n${yamlContent}`;
232
+ }
233
+ /**
234
+ * Exports existing TypeScript import configurations to YAML files.
235
+ * Helps migrate from TypeScript to YAML-based configurations.
236
+ *
237
+ * @param collections - Collections with existing import definitions
238
+ */
239
+ async exportToYaml(collections) {
240
+ const exportDir = path.join(this.appwriteFolderPath, "import", "exported");
241
+ if (!fs.existsSync(exportDir)) {
242
+ fs.mkdirSync(exportDir, { recursive: true });
243
+ }
244
+ let exportedCount = 0;
245
+ for (const collection of collections) {
246
+ if (!collection.importDefs || collection.importDefs.length === 0) {
247
+ continue;
248
+ }
249
+ for (let i = 0; i < collection.importDefs.length; i++) {
250
+ const importDef = collection.importDefs[i];
251
+ const yamlContent = this.convertImportDefToYaml(importDef, collection.name);
252
+ const filename = collection.importDefs.length > 1
253
+ ? `${collection.name}-${i + 1}.yaml`
254
+ : `${collection.name}.yaml`;
255
+ const filePath = path.join(exportDir, filename);
256
+ fs.writeFileSync(filePath, yamlContent);
257
+ exportedCount++;
258
+ logger.info(`Exported import configuration: ${filePath}`);
259
+ }
260
+ }
261
+ logger.info(`Exported ${exportedCount} import configurations to YAML`);
262
+ }
263
+ /**
264
+ * Gets statistics about YAML import configurations.
265
+ */
266
+ async getStatistics() {
267
+ try {
268
+ const yamlConfigs = await this.configLoader.loadAllImportConfigs();
269
+ const stats = this.configLoader.getStatistics(yamlConfigs);
270
+ return {
271
+ hasYamlConfigs: yamlConfigs.size > 0,
272
+ totalConfigurations: stats.totalConfigurations,
273
+ collectionsWithConfigs: stats.collectionsWithConfigs,
274
+ configurationsByType: stats.configsByType,
275
+ totalAttributeMappings: stats.totalAttributeMappings,
276
+ totalRelationshipMappings: stats.totalRelationshipMappings,
277
+ };
278
+ }
279
+ catch (error) {
280
+ logger.error("Failed to get YAML import statistics:", error);
281
+ return {
282
+ hasYamlConfigs: false,
283
+ totalConfigurations: 0,
284
+ collectionsWithConfigs: 0,
285
+ configurationsByType: {},
286
+ totalAttributeMappings: 0,
287
+ totalRelationshipMappings: 0,
288
+ };
289
+ }
290
+ }
291
+ /**
292
+ * Creates a new YAML import configuration from a template.
293
+ *
294
+ * @param collectionName - Name of the collection
295
+ * @param sourceFile - Source data file name
296
+ * @param outputPath - Output file path (optional)
297
+ */
298
+ async createFromTemplate(collectionName, sourceFile, outputPath) {
299
+ const template = this.configLoader.generateTemplate(collectionName, sourceFile);
300
+ const fileName = outputPath || `${collectionName.toLowerCase()}-import.yaml`;
301
+ const fullPath = path.join(this.appwriteFolderPath, "import", fileName);
302
+ // Add schema reference to template
303
+ const schemaHeader = "# yaml-language-server: $schema=../.yaml_schemas/import-config.schema.json\n";
304
+ const templateWithSchema = schemaHeader + template;
305
+ fs.writeFileSync(fullPath, templateWithSchema);
306
+ logger.info(`Created YAML import configuration: ${fullPath}`);
307
+ return fullPath;
308
+ }
309
+ /**
310
+ * Checks if YAML import system is properly set up.
311
+ */
312
+ async isSetupComplete() {
313
+ const missingComponents = [];
314
+ // Check import directory
315
+ const importDir = path.join(this.appwriteFolderPath, "import");
316
+ if (!fs.existsSync(importDir)) {
317
+ missingComponents.push("import directory");
318
+ }
319
+ // Check schema files
320
+ const schemaDir = path.join(this.appwriteFolderPath, ".yaml_schemas");
321
+ const importSchemaPath = path.join(schemaDir, "import-config.schema.json");
322
+ if (!fs.existsSync(importSchemaPath)) {
323
+ missingComponents.push("import configuration schema");
324
+ }
325
+ return {
326
+ isComplete: missingComponents.length === 0,
327
+ missingComponents,
328
+ };
329
+ }
330
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Generates JSON Schema for YAML import configurations.
3
+ * Provides IntelliSense support for YAML files in IDEs.
4
+ */
5
+ export declare function generateImportConfigSchema(): any;
6
+ /**
7
+ * Creates all necessary schema files for YAML import configurations.
8
+ *
9
+ * @param appwriteFolderPath - Path to the .appwrite directory
10
+ */
11
+ export declare function createImportSchemas(appwriteFolderPath: string): Promise<void>;
12
+ /**
13
+ * Generates example YAML import configurations.
14
+ *
15
+ * @param appwriteFolderPath - Path to the .appwrite directory
16
+ */
17
+ export declare function createImportExamples(appwriteFolderPath: string): Promise<void>;