appwrite-utils-cli 1.6.2 → 1.6.4
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_TODO.md +1189 -0
- package/SERVICE_IMPLEMENTATION_REPORT.md +462 -0
- package/dist/cli/commands/configCommands.js +7 -1
- package/dist/cli/commands/databaseCommands.js +23 -15
- package/dist/collections/attributes.d.ts +1 -1
- package/dist/collections/attributes.js +163 -66
- package/dist/collections/indexes.js +3 -17
- package/dist/collections/methods.js +38 -0
- package/dist/config/ConfigManager.d.ts +445 -0
- package/dist/config/ConfigManager.js +625 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +7 -0
- package/dist/config/services/ConfigDiscoveryService.d.ts +126 -0
- package/dist/config/services/ConfigDiscoveryService.js +374 -0
- package/dist/config/services/ConfigLoaderService.d.ts +105 -0
- package/dist/config/services/ConfigLoaderService.js +410 -0
- package/dist/config/services/ConfigMergeService.d.ts +208 -0
- package/dist/config/services/ConfigMergeService.js +307 -0
- package/dist/config/services/ConfigValidationService.d.ts +214 -0
- package/dist/config/services/ConfigValidationService.js +310 -0
- package/dist/config/services/SessionAuthService.d.ts +225 -0
- package/dist/config/services/SessionAuthService.js +456 -0
- package/dist/config/services/__tests__/ConfigMergeService.test.d.ts +1 -0
- package/dist/config/services/__tests__/ConfigMergeService.test.js +271 -0
- package/dist/config/services/index.d.ts +13 -0
- package/dist/config/services/index.js +10 -0
- package/dist/interactiveCLI.js +8 -6
- package/dist/main.js +2 -2
- package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +1 -1
- package/dist/shared/operationQueue.js +1 -1
- package/dist/utils/ClientFactory.d.ts +87 -0
- package/dist/utils/ClientFactory.js +164 -0
- package/dist/utils/getClientFromConfig.js +4 -3
- package/dist/utils/helperFunctions.d.ts +1 -0
- package/dist/utils/helperFunctions.js +21 -5
- package/dist/utils/yamlConverter.d.ts +2 -0
- package/dist/utils/yamlConverter.js +21 -4
- package/dist/utilsController.d.ts +18 -15
- package/dist/utilsController.js +83 -131
- package/package.json +1 -1
- package/src/cli/commands/configCommands.ts +8 -1
- package/src/cli/commands/databaseCommands.ts +34 -20
- package/src/collections/attributes.ts +195 -150
- package/src/collections/indexes.ts +4 -19
- package/src/collections/methods.ts +46 -0
- package/src/config/ConfigManager.ts +808 -0
- package/src/config/index.ts +10 -0
- package/src/config/services/ConfigDiscoveryService.ts +463 -0
- package/src/config/services/ConfigLoaderService.ts +560 -0
- package/src/config/services/ConfigMergeService.ts +386 -0
- package/src/config/services/ConfigValidationService.ts +394 -0
- package/src/config/services/SessionAuthService.ts +565 -0
- package/src/config/services/__tests__/ConfigMergeService.test.ts +351 -0
- package/src/config/services/index.ts +29 -0
- package/src/interactiveCLI.ts +9 -7
- package/src/main.ts +2 -2
- package/src/shared/operationQueue.ts +1 -1
- package/src/utils/ClientFactory.ts +186 -0
- package/src/utils/getClientFromConfig.ts +4 -3
- package/src/utils/helperFunctions.ts +27 -7
- package/src/utils/yamlConverter.ts +28 -2
- package/src/utilsController.ts +99 -187
@@ -518,6 +518,52 @@ export const createOrUpdateCollectionsViaAdapter = async (
|
|
518
518
|
}
|
519
519
|
}
|
520
520
|
|
521
|
+
// Wait for all attributes to become available before creating indexes
|
522
|
+
const allAttrKeys = [
|
523
|
+
...nonRel.map((a: any) => a.key),
|
524
|
+
...rels.filter((a: any) => a.relatedCollection).map((a: any) => a.key)
|
525
|
+
];
|
526
|
+
|
527
|
+
if (allAttrKeys.length > 0) {
|
528
|
+
for (const attrKey of allAttrKeys) {
|
529
|
+
const maxWait = 60000; // 60 seconds
|
530
|
+
const startTime = Date.now();
|
531
|
+
let lastStatus = '';
|
532
|
+
|
533
|
+
while (Date.now() - startTime < maxWait) {
|
534
|
+
try {
|
535
|
+
const tableData = await adapter.getTable({ databaseId, tableId });
|
536
|
+
const attrs = (tableData as any).attributes || [];
|
537
|
+
const attr = attrs.find((a: any) => a.key === attrKey);
|
538
|
+
|
539
|
+
if (attr) {
|
540
|
+
if (attr.status === 'available') {
|
541
|
+
break; // Attribute is ready
|
542
|
+
}
|
543
|
+
if (attr.status === 'failed' || attr.status === 'stuck') {
|
544
|
+
throw new Error(`Attribute ${attrKey} failed to create: ${attr.error || 'unknown error'}`);
|
545
|
+
}
|
546
|
+
// Still processing, continue waiting
|
547
|
+
lastStatus = attr.status;
|
548
|
+
}
|
549
|
+
|
550
|
+
await delay(2000); // Check every 2 seconds
|
551
|
+
} catch (e) {
|
552
|
+
// If we can't check status, assume it's processing and continue
|
553
|
+
await delay(2000);
|
554
|
+
}
|
555
|
+
}
|
556
|
+
|
557
|
+
// Timeout check
|
558
|
+
if (Date.now() - startTime >= maxWait) {
|
559
|
+
MessageFormatter.warning(
|
560
|
+
`Attribute ${attrKey} did not become available within ${maxWait / 1000}s (last status: ${lastStatus}). Proceeding anyway.`,
|
561
|
+
{ prefix: 'Attributes' }
|
562
|
+
);
|
563
|
+
}
|
564
|
+
}
|
565
|
+
}
|
566
|
+
|
521
567
|
// Indexes
|
522
568
|
const idxs = (indexes || []) as any[];
|
523
569
|
for (const idx of idxs) {
|