appwrite-utils-cli 1.9.7 → 1.12.0
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 +1004 -1004
- package/dist/adapters/index.d.ts +7 -8
- package/dist/adapters/index.js +7 -9
- package/dist/backups/operations/bucketBackup.js +2 -2
- package/dist/backups/operations/collectionBackup.d.ts +1 -1
- package/dist/backups/operations/collectionBackup.js +3 -3
- package/dist/backups/operations/comprehensiveBackup.d.ts +1 -1
- package/dist/backups/operations/comprehensiveBackup.js +2 -2
- package/dist/backups/tracking/centralizedTracking.d.ts +1 -1
- package/dist/backups/tracking/centralizedTracking.js +2 -2
- package/dist/cli/commands/configCommands.js +51 -7
- package/dist/cli/commands/databaseCommands.js +156 -104
- package/dist/cli/commands/functionCommands.js +3 -3
- package/dist/cli/commands/importFileCommands.d.ts +7 -0
- package/dist/cli/commands/importFileCommands.js +674 -0
- package/dist/cli/commands/schemaCommands.js +3 -3
- package/dist/cli/commands/storageCommands.js +2 -3
- package/dist/cli/commands/transferCommands.js +3 -5
- package/dist/collections/{attributes.d.ts → columns.d.ts} +1 -1
- package/dist/collections/{attributes.js → columns.js} +15 -9
- package/dist/collections/indexes.js +1 -3
- package/dist/collections/methods.d.ts +1 -1
- package/dist/collections/methods.js +38 -20
- package/dist/collections/tableOperations.d.ts +1 -0
- package/dist/collections/tableOperations.js +30 -11
- package/dist/collections/transferOperations.d.ts +1 -1
- package/dist/collections/transferOperations.js +3 -4
- package/dist/collections/wipeOperations.d.ts +4 -3
- package/dist/collections/wipeOperations.js +112 -39
- package/dist/databases/methods.js +2 -2
- package/dist/databases/setup.js +2 -2
- package/dist/examples/yamlTerminologyExample.js +2 -2
- package/dist/functions/deployments.d.ts +1 -1
- package/dist/functions/deployments.js +6 -6
- package/dist/functions/fnConfigDiscovery.js +2 -2
- package/dist/functions/methods.js +2 -2
- package/dist/functions/templates/count-docs-in-collection/README.md +53 -53
- package/dist/functions/templates/count-docs-in-collection/src/main.ts +159 -159
- package/dist/functions/templates/count-docs-in-collection/src/request.ts +8 -8
- package/dist/functions/templates/hono-typescript/README.md +285 -285
- package/dist/functions/templates/hono-typescript/src/adapters/request.ts +73 -73
- package/dist/functions/templates/hono-typescript/src/adapters/response.ts +105 -105
- package/dist/functions/templates/hono-typescript/src/app.ts +179 -179
- package/dist/functions/templates/hono-typescript/src/context.ts +102 -102
- package/{src/functions/templates/hono-typescript/src/index.ts → dist/functions/templates/hono-typescript/src/main.ts} +53 -53
- package/dist/functions/templates/hono-typescript/src/middleware/appwrite.ts +118 -118
- package/dist/functions/templates/typescript-node/README.md +31 -31
- package/dist/functions/templates/typescript-node/src/context.ts +102 -102
- package/dist/functions/templates/typescript-node/src/{index.ts → main.ts} +29 -29
- package/dist/functions/templates/uv/README.md +30 -30
- package/dist/functions/templates/uv/pyproject.toml +29 -29
- package/dist/functions/templates/uv/src/context.py +124 -124
- package/dist/functions/templates/uv/src/{index.py → main.py} +45 -45
- package/dist/init.js +1 -1
- package/dist/interactiveCLI.d.ts +6 -1
- package/dist/interactiveCLI.js +79 -25
- package/dist/main.js +125 -180
- package/dist/migrations/afterImportActions.js +2 -3
- package/dist/migrations/appwriteToX.d.ts +1 -1
- package/dist/migrations/appwriteToX.js +10 -8
- package/dist/migrations/comprehensiveTransfer.js +3 -5
- package/dist/migrations/dataLoader.d.ts +4 -2
- package/dist/migrations/dataLoader.js +42 -20
- package/dist/migrations/importController.d.ts +2 -0
- package/dist/migrations/importController.js +39 -24
- package/dist/migrations/importDataActions.js +3 -3
- package/dist/migrations/relationships.js +1 -2
- package/dist/migrations/services/DataTransformationService.js +2 -2
- package/dist/migrations/services/FileHandlerService.js +1 -1
- package/dist/migrations/services/ImportOrchestrator.d.ts +2 -0
- package/dist/migrations/services/ImportOrchestrator.js +15 -7
- package/dist/migrations/services/RateLimitManager.js +1 -1
- package/dist/migrations/services/RelationshipResolver.js +1 -1
- package/dist/migrations/services/UserMappingService.js +1 -1
- package/dist/migrations/services/ValidationService.js +1 -1
- package/dist/migrations/transfer.d.ts +8 -4
- package/dist/migrations/transfer.js +108 -55
- package/dist/migrations/yaml/YamlImportConfigLoader.js +52 -52
- package/dist/migrations/yaml/YamlImportIntegration.js +2 -2
- package/dist/migrations/yaml/generateImportSchemas.js +174 -174
- package/dist/setupCommands.d.ts +1 -1
- package/dist/setupCommands.js +5 -6
- package/dist/setupController.js +1 -1
- package/dist/shared/backupTracking.d.ts +1 -1
- package/dist/shared/backupTracking.js +2 -2
- package/dist/shared/confirmationDialogs.js +1 -1
- package/dist/shared/migrationHelpers.d.ts +1 -1
- package/dist/shared/migrationHelpers.js +4 -4
- package/dist/shared/operationQueue.d.ts +1 -1
- package/dist/shared/operationQueue.js +3 -4
- package/dist/shared/operationsTable.d.ts +1 -1
- package/dist/shared/operationsTable.js +35 -34
- package/dist/shared/operationsTableSchema.d.ts +3 -3
- package/dist/shared/operationsTableSchema.js +2 -2
- package/dist/shared/progressManager.js +1 -1
- package/dist/shared/selectionDialogs.d.ts +6 -0
- package/dist/shared/selectionDialogs.js +56 -12
- package/dist/storage/methods.d.ts +12 -0
- package/dist/storage/methods.js +92 -89
- package/dist/storage/schemas.d.ts +2 -2
- package/dist/tables/indexManager.d.ts +1 -1
- package/dist/tables/indexManager.js +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/users/methods.js +2 -3
- package/dist/utils/configMigration.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/loadConfigs.d.ts +2 -2
- package/dist/utils/loadConfigs.js +6 -7
- package/dist/utils/setupFiles.js +139 -141
- package/dist/utilsController.d.ts +16 -9
- package/dist/utilsController.js +93 -68
- package/package.json +9 -3
- package/.appwrite/.yaml_schemas/appwrite-config.schema.json +0 -380
- package/.appwrite/.yaml_schemas/collection.schema.json +0 -255
- package/.appwrite/collections/Categories.yaml +0 -182
- package/.appwrite/collections/ExampleCollection.yaml +0 -36
- package/.appwrite/collections/Posts.yaml +0 -227
- package/.appwrite/collections/Users.yaml +0 -149
- package/.appwrite/config.yaml +0 -109
- package/.appwrite/import/README.md +0 -148
- package/.appwrite/import/categories-import.yaml +0 -129
- package/.appwrite/import/posts-import.yaml +0 -208
- package/.appwrite/import/users-import.yaml +0 -130
- package/.appwrite/importData/categories.json +0 -194
- package/.appwrite/importData/posts.json +0 -270
- package/.appwrite/importData/users.json +0 -220
- package/.appwrite/schemas/categories.json +0 -128
- package/.appwrite/schemas/exampleCollection.json +0 -52
- package/.appwrite/schemas/posts.json +0 -173
- package/.appwrite/schemas/users.json +0 -125
- package/CHANGELOG.md +0 -35
- package/CONFIG_TODO.md +0 -1189
- package/SELECTION_DIALOGS.md +0 -146
- package/SERVICE_IMPLEMENTATION_REPORT.md +0 -462
- package/dist/adapters/AdapterFactory.d.ts +0 -94
- package/dist/adapters/AdapterFactory.js +0 -420
- package/dist/adapters/DatabaseAdapter.d.ts +0 -243
- package/dist/adapters/DatabaseAdapter.js +0 -50
- package/dist/adapters/LegacyAdapter.d.ts +0 -50
- package/dist/adapters/LegacyAdapter.js +0 -615
- package/dist/adapters/TablesDBAdapter.d.ts +0 -45
- package/dist/adapters/TablesDBAdapter.js +0 -611
- package/dist/config/ConfigManager.d.ts +0 -450
- package/dist/config/ConfigManager.js +0 -650
- package/dist/config/configMigration.d.ts +0 -87
- package/dist/config/configMigration.js +0 -390
- package/dist/config/configValidation.d.ts +0 -66
- package/dist/config/configValidation.js +0 -358
- package/dist/config/index.d.ts +0 -8
- package/dist/config/index.js +0 -7
- package/dist/config/services/ConfigDiscoveryService.d.ts +0 -122
- package/dist/config/services/ConfigDiscoveryService.js +0 -322
- package/dist/config/services/ConfigLoaderService.d.ts +0 -129
- package/dist/config/services/ConfigLoaderService.js +0 -535
- package/dist/config/services/ConfigMergeService.d.ts +0 -208
- package/dist/config/services/ConfigMergeService.js +0 -308
- package/dist/config/services/ConfigValidationService.d.ts +0 -214
- package/dist/config/services/ConfigValidationService.js +0 -310
- package/dist/config/services/SessionAuthService.d.ts +0 -225
- package/dist/config/services/SessionAuthService.js +0 -456
- package/dist/config/services/__tests__/ConfigMergeService.test.d.ts +0 -1
- package/dist/config/services/__tests__/ConfigMergeService.test.js +0 -271
- package/dist/config/services/index.d.ts +0 -13
- package/dist/config/services/index.js +0 -10
- package/dist/config/yamlConfig.d.ts +0 -722
- package/dist/config/yamlConfig.js +0 -702
- package/dist/functions/pathResolution.d.ts +0 -37
- package/dist/functions/pathResolution.js +0 -185
- package/dist/functions/templates/count-docs-in-collection/package.json +0 -25
- package/dist/functions/templates/count-docs-in-collection/tsconfig.json +0 -28
- package/dist/functions/templates/hono-typescript/package.json +0 -26
- package/dist/functions/templates/hono-typescript/src/index.ts +0 -54
- package/dist/functions/templates/hono-typescript/tsconfig.json +0 -20
- package/dist/functions/templates/typescript-node/package.json +0 -25
- package/dist/functions/templates/typescript-node/tsconfig.json +0 -28
- package/dist/shared/attributeMapper.d.ts +0 -20
- package/dist/shared/attributeMapper.js +0 -203
- package/dist/shared/errorUtils.d.ts +0 -54
- package/dist/shared/errorUtils.js +0 -95
- package/dist/shared/functionManager.d.ts +0 -48
- package/dist/shared/functionManager.js +0 -348
- package/dist/shared/jsonSchemaGenerator.d.ts +0 -50
- package/dist/shared/jsonSchemaGenerator.js +0 -290
- package/dist/shared/logging.d.ts +0 -61
- package/dist/shared/logging.js +0 -116
- package/dist/shared/messageFormatter.d.ts +0 -39
- package/dist/shared/messageFormatter.js +0 -162
- package/dist/shared/pydanticModelGenerator.d.ts +0 -17
- package/dist/shared/pydanticModelGenerator.js +0 -615
- package/dist/shared/schemaGenerator.d.ts +0 -40
- package/dist/shared/schemaGenerator.js +0 -556
- package/dist/utils/ClientFactory.d.ts +0 -87
- package/dist/utils/ClientFactory.js +0 -212
- package/dist/utils/configDiscovery.d.ts +0 -78
- package/dist/utils/configDiscovery.js +0 -472
- package/dist/utils/constantsGenerator.d.ts +0 -31
- package/dist/utils/constantsGenerator.js +0 -321
- package/dist/utils/dataConverters.d.ts +0 -46
- package/dist/utils/dataConverters.js +0 -139
- package/dist/utils/directoryUtils.d.ts +0 -22
- package/dist/utils/directoryUtils.js +0 -59
- package/dist/utils/getClientFromConfig.d.ts +0 -39
- package/dist/utils/getClientFromConfig.js +0 -199
- package/dist/utils/helperFunctions.d.ts +0 -63
- package/dist/utils/helperFunctions.js +0 -156
- package/dist/utils/pathResolvers.d.ts +0 -53
- package/dist/utils/pathResolvers.js +0 -72
- package/dist/utils/projectConfig.d.ts +0 -122
- package/dist/utils/projectConfig.js +0 -206
- package/dist/utils/retryFailedPromises.d.ts +0 -2
- package/dist/utils/retryFailedPromises.js +0 -23
- package/dist/utils/sessionAuth.d.ts +0 -48
- package/dist/utils/sessionAuth.js +0 -164
- package/dist/utils/typeGuards.d.ts +0 -35
- package/dist/utils/typeGuards.js +0 -57
- package/dist/utils/validationRules.d.ts +0 -43
- package/dist/utils/validationRules.js +0 -42
- package/dist/utils/versionDetection.d.ts +0 -58
- package/dist/utils/versionDetection.js +0 -251
- package/dist/utils/yamlConverter.d.ts +0 -100
- package/dist/utils/yamlConverter.js +0 -428
- package/dist/utils/yamlLoader.d.ts +0 -70
- package/dist/utils/yamlLoader.js +0 -267
- package/scripts/copy-templates.ts +0 -23
- package/src/adapters/AdapterFactory.ts +0 -529
- package/src/adapters/DatabaseAdapter.ts +0 -319
- package/src/adapters/LegacyAdapter.ts +0 -844
- package/src/adapters/TablesDBAdapter.ts +0 -823
- package/src/adapters/index.ts +0 -37
- package/src/backups/operations/bucketBackup.ts +0 -277
- package/src/backups/operations/collectionBackup.ts +0 -310
- package/src/backups/operations/comprehensiveBackup.ts +0 -342
- package/src/backups/schemas/bucketManifest.ts +0 -78
- package/src/backups/schemas/comprehensiveManifest.ts +0 -76
- package/src/backups/tracking/centralizedTracking.ts +0 -352
- package/src/cli/commands/configCommands.ts +0 -201
- package/src/cli/commands/databaseCommands.ts +0 -879
- package/src/cli/commands/functionCommands.ts +0 -418
- package/src/cli/commands/schemaCommands.ts +0 -200
- package/src/cli/commands/storageCommands.ts +0 -152
- package/src/cli/commands/transferCommands.ts +0 -457
- package/src/collections/attributes.ts +0 -2020
- package/src/collections/attributes.ts.backup +0 -1555
- package/src/collections/indexes.ts +0 -352
- package/src/collections/methods.ts +0 -700
- package/src/collections/tableOperations.ts +0 -521
- package/src/collections/transferOperations.ts +0 -590
- package/src/collections/wipeOperations.ts +0 -346
- package/src/config/ConfigManager.ts +0 -849
- package/src/config/README.md +0 -274
- package/src/config/configMigration.ts +0 -575
- package/src/config/configValidation.ts +0 -445
- package/src/config/index.ts +0 -10
- package/src/config/services/ConfigDiscoveryService.ts +0 -410
- package/src/config/services/ConfigLoaderService.ts +0 -732
- package/src/config/services/ConfigMergeService.ts +0 -388
- package/src/config/services/ConfigValidationService.ts +0 -394
- package/src/config/services/SessionAuthService.ts +0 -565
- package/src/config/services/__tests__/ConfigMergeService.test.ts +0 -351
- package/src/config/services/index.ts +0 -29
- package/src/config/yamlConfig.ts +0 -761
- package/src/databases/methods.ts +0 -49
- package/src/databases/setup.ts +0 -77
- package/src/examples/yamlTerminologyExample.ts +0 -346
- package/src/functions/deployments.ts +0 -220
- package/src/functions/fnConfigDiscovery.ts +0 -103
- package/src/functions/methods.ts +0 -284
- package/src/functions/pathResolution.ts +0 -227
- package/src/functions/templates/count-docs-in-collection/README.md +0 -54
- package/src/functions/templates/count-docs-in-collection/package.json +0 -25
- package/src/functions/templates/count-docs-in-collection/src/main.ts +0 -159
- package/src/functions/templates/count-docs-in-collection/src/request.ts +0 -9
- package/src/functions/templates/count-docs-in-collection/tsconfig.json +0 -28
- package/src/functions/templates/hono-typescript/README.md +0 -286
- package/src/functions/templates/hono-typescript/package.json +0 -26
- package/src/functions/templates/hono-typescript/src/adapters/request.ts +0 -74
- package/src/functions/templates/hono-typescript/src/adapters/response.ts +0 -106
- package/src/functions/templates/hono-typescript/src/app.ts +0 -180
- package/src/functions/templates/hono-typescript/src/context.ts +0 -103
- package/src/functions/templates/hono-typescript/src/middleware/appwrite.ts +0 -119
- package/src/functions/templates/hono-typescript/tsconfig.json +0 -20
- package/src/functions/templates/typescript-node/README.md +0 -32
- package/src/functions/templates/typescript-node/package.json +0 -25
- package/src/functions/templates/typescript-node/src/context.ts +0 -103
- package/src/functions/templates/typescript-node/src/index.ts +0 -29
- package/src/functions/templates/typescript-node/tsconfig.json +0 -28
- package/src/functions/templates/uv/README.md +0 -31
- package/src/functions/templates/uv/pyproject.toml +0 -30
- package/src/functions/templates/uv/src/__init__.py +0 -0
- package/src/functions/templates/uv/src/context.py +0 -125
- package/src/functions/templates/uv/src/index.py +0 -46
- package/src/init.ts +0 -62
- package/src/interactiveCLI.ts +0 -1136
- package/src/main.ts +0 -1670
- package/src/migrations/afterImportActions.ts +0 -580
- package/src/migrations/appwriteToX.ts +0 -664
- package/src/migrations/comprehensiveTransfer.ts +0 -2285
- package/src/migrations/dataLoader.ts +0 -1702
- package/src/migrations/importController.ts +0 -428
- package/src/migrations/importDataActions.ts +0 -315
- package/src/migrations/relationships.ts +0 -334
- package/src/migrations/services/DataTransformationService.ts +0 -196
- package/src/migrations/services/FileHandlerService.ts +0 -311
- package/src/migrations/services/ImportOrchestrator.ts +0 -666
- package/src/migrations/services/RateLimitManager.ts +0 -363
- package/src/migrations/services/RelationshipResolver.ts +0 -461
- package/src/migrations/services/UserMappingService.ts +0 -345
- package/src/migrations/services/ValidationService.ts +0 -349
- package/src/migrations/transfer.ts +0 -1068
- package/src/migrations/yaml/YamlImportConfigLoader.ts +0 -439
- package/src/migrations/yaml/YamlImportIntegration.ts +0 -446
- package/src/migrations/yaml/generateImportSchemas.ts +0 -1354
- package/src/schemas/authUser.ts +0 -23
- package/src/setup.ts +0 -8
- package/src/setupCommands.ts +0 -603
- package/src/setupController.ts +0 -43
- package/src/shared/attributeMapper.ts +0 -229
- package/src/shared/backupMetadataSchema.ts +0 -93
- package/src/shared/backupTracking.ts +0 -211
- package/src/shared/confirmationDialogs.ts +0 -327
- package/src/shared/errorUtils.ts +0 -110
- package/src/shared/functionManager.ts +0 -537
- package/src/shared/jsonSchemaGenerator.ts +0 -383
- package/src/shared/logging.ts +0 -149
- package/src/shared/messageFormatter.ts +0 -208
- package/src/shared/migrationHelpers.ts +0 -232
- package/src/shared/operationLogger.ts +0 -20
- package/src/shared/operationQueue.ts +0 -377
- package/src/shared/operationsTable.ts +0 -338
- package/src/shared/operationsTableSchema.ts +0 -60
- package/src/shared/progressManager.ts +0 -278
- package/src/shared/pydanticModelGenerator.ts +0 -618
- package/src/shared/relationshipExtractor.ts +0 -214
- package/src/shared/schemaGenerator.ts +0 -644
- package/src/shared/selectionDialogs.ts +0 -749
- package/src/storage/backupCompression.ts +0 -88
- package/src/storage/methods.ts +0 -698
- package/src/storage/schemas.ts +0 -205
- package/src/tables/indexManager.ts +0 -409
- package/src/types/node-appwrite-tablesdb.d.ts +0 -44
- package/src/types.ts +0 -9
- package/src/users/methods.ts +0 -359
- package/src/utils/ClientFactory.ts +0 -240
- package/src/utils/configDiscovery.ts +0 -557
- package/src/utils/configMigration.ts +0 -348
- package/src/utils/constantsGenerator.ts +0 -369
- package/src/utils/dataConverters.ts +0 -159
- package/src/utils/directoryUtils.ts +0 -61
- package/src/utils/getClientFromConfig.ts +0 -257
- package/src/utils/helperFunctions.ts +0 -228
- package/src/utils/index.ts +0 -2
- package/src/utils/loadConfigs.ts +0 -449
- package/src/utils/pathResolvers.ts +0 -81
- package/src/utils/projectConfig.ts +0 -340
- package/src/utils/retryFailedPromises.ts +0 -29
- package/src/utils/sessionAuth.ts +0 -230
- package/src/utils/setupFiles.ts +0 -1238
- package/src/utils/typeGuards.ts +0 -65
- package/src/utils/validationRules.ts +0 -88
- package/src/utils/versionDetection.ts +0 -292
- package/src/utils/yamlConverter.ts +0 -542
- package/src/utils/yamlLoader.ts +0 -371
- package/src/utilsController.ts +0 -1213
- package/tests/README.md +0 -497
- package/tests/adapters/AdapterFactory.test.ts +0 -277
- package/tests/integration/syncOperations.test.ts +0 -463
- package/tests/jest.config.js +0 -25
- package/tests/migration/configMigration.test.ts +0 -546
- package/tests/setup.ts +0 -62
- package/tests/testUtils.ts +0 -340
- package/tests/utils/loadConfigs.test.ts +0 -350
- package/tests/validation/configValidation.test.ts +0 -412
- package/tmp-sync-test/.appwrite/collections/TestCollection.yaml +0 -7
- package/tsconfig.json +0 -44
|
@@ -24,12 +24,12 @@ export const OperationRecordSchema = z.object({
|
|
|
24
24
|
$createdAt: z.string(),
|
|
25
25
|
$updatedAt: z.string(),
|
|
26
26
|
operationType: z.string(),
|
|
27
|
-
|
|
27
|
+
targetTable: z.string().optional(),
|
|
28
28
|
status: OperationStatusSchema,
|
|
29
29
|
progress: z.number(),
|
|
30
30
|
total: z.number(),
|
|
31
31
|
data: z.any().optional(),
|
|
32
32
|
error: z.string().optional()
|
|
33
33
|
});
|
|
34
|
-
export const OPERATIONS_TABLE_ID = "
|
|
34
|
+
export const OPERATIONS_TABLE_ID = "appwrite_operations";
|
|
35
35
|
export const OPERATIONS_TABLE_NAME = "Operations Tracking";
|
|
@@ -179,6 +179,12 @@ export declare class SelectionDialogs {
|
|
|
179
179
|
* Shows bucket selection dialog for selected databases
|
|
180
180
|
*/
|
|
181
181
|
static selectBucketsForDatabases(selectedDatabaseIds: string[], availableBuckets: any[], configuredBuckets: any[], options?: BucketSelectionOptions): Promise<string[]>;
|
|
182
|
+
/**
|
|
183
|
+
* Shows bucket selection for push operations with merged local+remote buckets.
|
|
184
|
+
* Unlike selectBucketsForDatabases, this shows all buckets as a flat list
|
|
185
|
+
* with source indicators (Local only, Remote only, Configured).
|
|
186
|
+
*/
|
|
187
|
+
static selectBucketsForPush(mergedBuckets: any[], configuredBuckets: any[], options?: BucketSelectionOptions): Promise<string[]>;
|
|
182
188
|
/**
|
|
183
189
|
* Shows final confirmation dialog with sync selection summary
|
|
184
190
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import inquirer from "inquirer";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import { MessageFormatter } from
|
|
4
|
-
import { logger } from
|
|
3
|
+
import { MessageFormatter } from 'appwrite-utils-helpers';
|
|
4
|
+
import { logger } from 'appwrite-utils-helpers';
|
|
5
5
|
/**
|
|
6
6
|
* Comprehensive selection dialog system for enhanced sync flow
|
|
7
7
|
*
|
|
@@ -186,7 +186,7 @@ export class SelectionDialogs {
|
|
|
186
186
|
if (showDatabaseContext) {
|
|
187
187
|
MessageFormatter.section(`Table Selection for ${databaseName}`);
|
|
188
188
|
}
|
|
189
|
-
const configuredIds = new Set(configuredTables.map(table => table.$id || table.id));
|
|
189
|
+
const configuredIds = new Set(configuredTables.map(table => table.$id || table.id || table.tableId || table.name));
|
|
190
190
|
let choices = [];
|
|
191
191
|
if (showSelectAll && availableTables.length > 1) {
|
|
192
192
|
choices.push({
|
|
@@ -196,18 +196,19 @@ export class SelectionDialogs {
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
availableTables.forEach(table => {
|
|
199
|
-
const
|
|
199
|
+
const tableId = table.$id || table.id || table.tableId || table.name;
|
|
200
|
+
const isConfigured = configuredIds.has(tableId);
|
|
200
201
|
const status = isConfigured ? chalk.green('✅') : chalk.blue('○');
|
|
201
|
-
const name = `${status} ${table.name} (${
|
|
202
|
+
const name = `${status} ${table.name} (${tableId})`;
|
|
202
203
|
if (allowNewOnly && isConfigured) {
|
|
203
204
|
return; // Skip configured tables if only allowing new ones
|
|
204
205
|
}
|
|
205
206
|
choices.push({
|
|
206
207
|
name,
|
|
207
|
-
value:
|
|
208
|
+
value: tableId,
|
|
208
209
|
short: table.name,
|
|
209
210
|
// Do not preselect anything unless explicitly provided
|
|
210
|
-
checked: defaultSelected.includes(
|
|
211
|
+
checked: defaultSelected.includes(tableId)
|
|
211
212
|
});
|
|
212
213
|
});
|
|
213
214
|
if (choices.length === 0) {
|
|
@@ -231,7 +232,7 @@ export class SelectionDialogs {
|
|
|
231
232
|
}]);
|
|
232
233
|
// Handle select all
|
|
233
234
|
if (selectedTableIds.includes('__SELECT_ALL__')) {
|
|
234
|
-
const allIds = availableTables.map(table => table.$id);
|
|
235
|
+
const allIds = availableTables.map(table => table.$id || table.id || table.tableId || table.name);
|
|
235
236
|
if (allowNewOnly) {
|
|
236
237
|
return allIds.filter(id => !configuredIds.has(id));
|
|
237
238
|
}
|
|
@@ -360,6 +361,46 @@ export class SelectionDialogs {
|
|
|
360
361
|
}
|
|
361
362
|
return selectedBucketIds || [];
|
|
362
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* Shows bucket selection for push operations with merged local+remote buckets.
|
|
366
|
+
* Unlike selectBucketsForDatabases, this shows all buckets as a flat list
|
|
367
|
+
* with source indicators (Local only, Remote only, Configured).
|
|
368
|
+
*/
|
|
369
|
+
static async selectBucketsForPush(mergedBuckets, configuredBuckets, options = {}) {
|
|
370
|
+
MessageFormatter.section("Storage Bucket Selection");
|
|
371
|
+
if (mergedBuckets.length === 0) {
|
|
372
|
+
MessageFormatter.warning("No storage buckets found (local or remote).", { skipLogging: true });
|
|
373
|
+
return [];
|
|
374
|
+
}
|
|
375
|
+
const choices = mergedBuckets.map(bucket => {
|
|
376
|
+
let status;
|
|
377
|
+
let suffix = '';
|
|
378
|
+
if (bucket._isLocalOnly) {
|
|
379
|
+
status = chalk.yellow('*');
|
|
380
|
+
suffix = chalk.yellow(' (Local only - will be created)');
|
|
381
|
+
}
|
|
382
|
+
else if (bucket._isRemoteOnly) {
|
|
383
|
+
status = chalk.blue('○');
|
|
384
|
+
suffix = chalk.blue(' (Remote only)');
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
status = chalk.green('✅');
|
|
388
|
+
suffix = chalk.green(' (Configured)');
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
name: `${status} ${bucket.name} (${bucket.$id})${suffix}`,
|
|
392
|
+
value: bucket.$id,
|
|
393
|
+
short: bucket.name,
|
|
394
|
+
};
|
|
395
|
+
});
|
|
396
|
+
const { selectedBucketIds } = await inquirer.prompt([{
|
|
397
|
+
type: 'checkbox',
|
|
398
|
+
name: 'selectedBucketIds',
|
|
399
|
+
message: 'Select storage buckets to push:',
|
|
400
|
+
choices,
|
|
401
|
+
}]);
|
|
402
|
+
return selectedBucketIds || [];
|
|
403
|
+
}
|
|
363
404
|
/**
|
|
364
405
|
* Shows final confirmation dialog with sync selection summary
|
|
365
406
|
*/
|
|
@@ -402,7 +443,7 @@ export class SelectionDialogs {
|
|
|
402
443
|
});
|
|
403
444
|
}
|
|
404
445
|
// Table summary
|
|
405
|
-
console.log(chalk.bold.cyan("\n📋 Tables
|
|
446
|
+
console.log(chalk.bold.cyan("\n📋 Tables:"));
|
|
406
447
|
console.log(` Total: ${selectionSummary.totalTables}`);
|
|
407
448
|
console.log(` ${chalk.green('✅ Configured')}: ${selectionSummary.existingItems.tables}`);
|
|
408
449
|
console.log(` ${chalk.blue('○ New')}: ${selectionSummary.newItems.tables}`);
|
|
@@ -499,9 +540,12 @@ export class SelectionDialogs {
|
|
|
499
540
|
static createBucketSelection(selectedBucketIds, availableBuckets, configuredBuckets, availableDatabases) {
|
|
500
541
|
const configuredIds = new Set(configuredBuckets.map(bucket => bucket.$id || bucket.id));
|
|
501
542
|
return selectedBucketIds.map(bucketId => {
|
|
502
|
-
|
|
543
|
+
// Look up in availableBuckets first, then fall back to configuredBuckets
|
|
544
|
+
// (handles merged lists where local-only buckets may only be in configuredBuckets)
|
|
545
|
+
const bucket = availableBuckets.find(b => b.$id === bucketId)
|
|
546
|
+
|| configuredBuckets.find(b => (b.$id || b.id) === bucketId);
|
|
503
547
|
if (!bucket) {
|
|
504
|
-
throw new Error(`Bucket with ID ${bucketId} not found in available buckets`);
|
|
548
|
+
throw new Error(`Bucket with ID ${bucketId} not found in available or configured buckets`);
|
|
505
549
|
}
|
|
506
550
|
const database = bucket.databaseId ?
|
|
507
551
|
availableDatabases.find(db => db.$id === bucket.databaseId) : undefined;
|
|
@@ -510,7 +554,7 @@ export class SelectionDialogs {
|
|
|
510
554
|
bucketName: bucket.name,
|
|
511
555
|
databaseId: bucket.databaseId,
|
|
512
556
|
databaseName: database?.name,
|
|
513
|
-
isNew: !configuredIds.has(bucketId)
|
|
557
|
+
isNew: bucket._isLocalOnly || !configuredIds.has(bucketId)
|
|
514
558
|
};
|
|
515
559
|
});
|
|
516
560
|
}
|
|
@@ -9,7 +9,19 @@ export declare const deleteBucket: (storage: Storage, bucketId: string) => Promi
|
|
|
9
9
|
export declare const getFile: (storage: Storage, bucketId: string, fileId: string) => Promise<Models.File>;
|
|
10
10
|
export declare const listFiles: (storage: Storage, bucketId: string, queries?: string[], search?: string) => Promise<Models.FileList>;
|
|
11
11
|
export declare const deleteFile: (storage: Storage, bucketId: string, fileId: string) => Promise<{}>;
|
|
12
|
+
/**
|
|
13
|
+
* Convert permission objects ({permission, target}) to Appwrite Permission strings.
|
|
14
|
+
*/
|
|
15
|
+
export declare const buildPermissionStrings: (permissions: Array<{
|
|
16
|
+
permission: string;
|
|
17
|
+
target: string;
|
|
18
|
+
}> | undefined) => string[];
|
|
12
19
|
export declare const ensureDatabaseConfigBucketsExist: (storage: Storage, config: AppwriteConfig, databases?: Models.Database[]) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Ensure global/root-level buckets from config.buckets[] exist on remote.
|
|
22
|
+
* Optionally filter to only push selected bucket IDs.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ensureGlobalBucketsExist: (storage: Storage, config: AppwriteConfig, selectedBucketIds?: string[]) => Promise<void>;
|
|
13
25
|
export declare const wipeDocumentStorage: (storage: Storage, bucketId: string, options?: {
|
|
14
26
|
skipConfirmation?: boolean;
|
|
15
27
|
}) => Promise<void>;
|
package/dist/storage/methods.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Compression, Databases, Permission, Query, Role, Storage, } from "node-appwrite";
|
|
2
2
|
import { tryAwaitWithRetry } from "appwrite-utils";
|
|
3
|
-
import { getClientFromConfig } from "
|
|
3
|
+
import { getClientFromConfig } from "appwrite-utils-helpers";
|
|
4
4
|
import { ulid } from "ulidx";
|
|
5
5
|
import { logOperation } from "../shared/operationLogger.js";
|
|
6
6
|
import { splitIntoBatches } from "../shared/migrationHelpers.js";
|
|
7
|
-
import { retryFailedPromises } from "
|
|
7
|
+
import { retryFailedPromises } from "appwrite-utils-helpers";
|
|
8
8
|
import { InputFile } from "node-appwrite/file";
|
|
9
|
-
import { MessageFormatter, Messages } from "
|
|
9
|
+
import { MessageFormatter, Messages } from "appwrite-utils-helpers";
|
|
10
10
|
import { ProgressManager } from "../shared/progressManager.js";
|
|
11
11
|
import { recordBackup } from "../shared/backupTracking.js";
|
|
12
|
-
import { AdapterFactory } from "
|
|
12
|
+
import { AdapterFactory } from "appwrite-utils-helpers";
|
|
13
13
|
import { createBackupZip } from "./backupCompression.js";
|
|
14
14
|
export const getStorage = (config) => {
|
|
15
15
|
const client = getClientFromConfig(config);
|
|
@@ -39,96 +39,99 @@ export const listFiles = async (storage, bucketId, queries, search) => {
|
|
|
39
39
|
export const deleteFile = async (storage, bucketId, fileId) => {
|
|
40
40
|
return await storage.deleteFile(bucketId, fileId);
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Convert permission objects ({permission, target}) to Appwrite Permission strings.
|
|
44
|
+
*/
|
|
45
|
+
export const buildPermissionStrings = (permissions) => {
|
|
46
|
+
const result = [];
|
|
47
|
+
if (!permissions || permissions.length === 0)
|
|
48
|
+
return result;
|
|
49
|
+
for (const p of permissions) {
|
|
50
|
+
switch (p.permission) {
|
|
51
|
+
case 'read':
|
|
52
|
+
result.push(Permission.read(p.target));
|
|
53
|
+
break;
|
|
54
|
+
case 'create':
|
|
55
|
+
result.push(Permission.create(p.target));
|
|
56
|
+
break;
|
|
57
|
+
case 'update':
|
|
58
|
+
result.push(Permission.update(p.target));
|
|
59
|
+
break;
|
|
60
|
+
case 'delete':
|
|
61
|
+
result.push(Permission.delete(p.target));
|
|
62
|
+
break;
|
|
63
|
+
case 'write':
|
|
64
|
+
result.push(Permission.write(p.target));
|
|
65
|
+
break;
|
|
66
|
+
default: break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Check if a bucket's current state differs from desired config.
|
|
73
|
+
*/
|
|
74
|
+
const bucketDiffers = (existing, desired, permissions) => {
|
|
75
|
+
return (existing.name !== desired.name ||
|
|
76
|
+
JSON.stringify(existing.$permissions || []) !== JSON.stringify(permissions) ||
|
|
77
|
+
!!existing.fileSecurity !== !!desired.fileSecurity ||
|
|
78
|
+
!!existing.enabled !== !!desired.enabled ||
|
|
79
|
+
(existing.maximumFileSize ?? undefined) !== (desired.maximumFileSize ?? undefined) ||
|
|
80
|
+
JSON.stringify(existing.allowedFileExtensions || []) !== JSON.stringify(desired.allowedFileExtensions || []) ||
|
|
81
|
+
String(existing.compression || 'none') !== String(desired.compression || 'none') ||
|
|
82
|
+
!!existing.encryption !== !!desired.encryption ||
|
|
83
|
+
!!existing.antivirus !== !!desired.antivirus);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Create or update a single bucket to match desired config.
|
|
87
|
+
*/
|
|
88
|
+
const ensureSingleBucketExists = async (storage, desired) => {
|
|
89
|
+
const permissions = buildPermissionStrings(desired.permissions);
|
|
90
|
+
try {
|
|
91
|
+
const existing = await storage.getBucket(desired.$id);
|
|
92
|
+
if (bucketDiffers(existing, desired, permissions)) {
|
|
93
|
+
try {
|
|
94
|
+
await storage.updateBucket(desired.$id, desired.name, permissions, desired.fileSecurity, desired.enabled, desired.maximumFileSize, desired.allowedFileExtensions, desired.compression, desired.encryption, desired.antivirus);
|
|
95
|
+
MessageFormatter.info(`Updated bucket ${desired.$id} to match config`, { prefix: 'Buckets' });
|
|
96
|
+
}
|
|
97
|
+
catch (updateErr) {
|
|
98
|
+
MessageFormatter.warning(`Failed to update bucket ${desired.$id}: ${updateErr instanceof Error ? updateErr.message : String(updateErr)}`, { prefix: 'Buckets' });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
MessageFormatter.debug(`Bucket ${desired.$id} up-to-date`, undefined, { prefix: 'Buckets' });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (_e) {
|
|
106
|
+
// Bucket doesn't exist, create it
|
|
107
|
+
try {
|
|
108
|
+
await storage.createBucket(desired.$id, desired.name, permissions, desired.fileSecurity, desired.enabled, desired.maximumFileSize, desired.allowedFileExtensions, desired.compression, desired.encryption, desired.antivirus);
|
|
109
|
+
MessageFormatter.success(`Bucket ${desired.$id} created`, { prefix: 'Buckets' });
|
|
110
|
+
}
|
|
111
|
+
catch (createError) {
|
|
112
|
+
MessageFormatter.error(`Failed to create bucket ${desired.$id}`, createError instanceof Error ? createError : new Error(String(createError)), { prefix: 'Buckets' });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
42
116
|
export const ensureDatabaseConfigBucketsExist = async (storage, config, databases = []) => {
|
|
43
117
|
for (const db of databases) {
|
|
44
118
|
const database = config.databases?.find((d) => d.$id === db.$id);
|
|
45
119
|
if (database?.bucket) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
permissions.push(Permission.create(p.target));
|
|
60
|
-
break;
|
|
61
|
-
case 'update':
|
|
62
|
-
permissions.push(Permission.update(p.target));
|
|
63
|
-
break;
|
|
64
|
-
case 'delete':
|
|
65
|
-
permissions.push(Permission.delete(p.target));
|
|
66
|
-
break;
|
|
67
|
-
case 'write':
|
|
68
|
-
permissions.push(Permission.write(p.target));
|
|
69
|
-
break;
|
|
70
|
-
default: break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const diff = (existing.name !== desired.name ||
|
|
75
|
-
JSON.stringify(existing.$permissions || []) !== JSON.stringify(permissions) ||
|
|
76
|
-
!!existing.fileSecurity !== !!desired.fileSecurity ||
|
|
77
|
-
!!existing.enabled !== !!desired.enabled ||
|
|
78
|
-
(existing.maximumFileSize ?? undefined) !== (desired.maximumFileSize ?? undefined) ||
|
|
79
|
-
JSON.stringify(existing.allowedFileExtensions || []) !== JSON.stringify(desired.allowedFileExtensions || []) ||
|
|
80
|
-
String(existing.compression || 'none') !== String(desired.compression || 'none') ||
|
|
81
|
-
!!existing.encryption !== !!desired.encryption ||
|
|
82
|
-
!!existing.antivirus !== !!desired.antivirus);
|
|
83
|
-
if (diff) {
|
|
84
|
-
try {
|
|
85
|
-
await storage.updateBucket(desired.$id, desired.name, permissions, desired.fileSecurity, desired.enabled, desired.maximumFileSize, desired.allowedFileExtensions, desired.compression, desired.encryption, desired.antivirus);
|
|
86
|
-
MessageFormatter.info(`Updated bucket ${desired.$id} to match config`, { prefix: 'Buckets' });
|
|
87
|
-
}
|
|
88
|
-
catch (updateErr) {
|
|
89
|
-
MessageFormatter.warning(`Failed to update bucket ${desired.$id}: ${updateErr instanceof Error ? updateErr.message : String(updateErr)}`, { prefix: 'Buckets' });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
MessageFormatter.debug(`Bucket ${desired.$id} up-to-date`, undefined, { prefix: 'Buckets' });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
const permissions = [];
|
|
98
|
-
if (database.bucket.permissions &&
|
|
99
|
-
database.bucket.permissions.length > 0) {
|
|
100
|
-
for (const permission of database.bucket.permissions) {
|
|
101
|
-
switch (permission.permission) {
|
|
102
|
-
case "read":
|
|
103
|
-
permissions.push(Permission.read(permission.target));
|
|
104
|
-
break;
|
|
105
|
-
case "create":
|
|
106
|
-
permissions.push(Permission.create(permission.target));
|
|
107
|
-
break;
|
|
108
|
-
case "update":
|
|
109
|
-
permissions.push(Permission.update(permission.target));
|
|
110
|
-
break;
|
|
111
|
-
case "delete":
|
|
112
|
-
permissions.push(Permission.delete(permission.target));
|
|
113
|
-
break;
|
|
114
|
-
case "write":
|
|
115
|
-
permissions.push(Permission.write(permission.target));
|
|
116
|
-
break;
|
|
117
|
-
default:
|
|
118
|
-
console.warn(`Unknown permission: ${permission.permission}`);
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
await storage.createBucket(database.bucket.$id, database.bucket.name, permissions, database.bucket.fileSecurity, database.bucket.enabled, database.bucket.maximumFileSize, database.bucket.allowedFileExtensions, database.bucket.compression, database.bucket.encryption, database.bucket.antivirus);
|
|
125
|
-
MessageFormatter.success(`Bucket ${database.bucket.$id} created`, { prefix: 'Buckets' });
|
|
126
|
-
}
|
|
127
|
-
catch (createError) {
|
|
128
|
-
MessageFormatter.error(`Failed to create bucket ${database.bucket.$id}`, createError instanceof Error ? createError : new Error(String(createError)), { prefix: 'Buckets' });
|
|
129
|
-
}
|
|
130
|
-
}
|
|
120
|
+
await ensureSingleBucketExists(storage, database.bucket);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Ensure global/root-level buckets from config.buckets[] exist on remote.
|
|
126
|
+
* Optionally filter to only push selected bucket IDs.
|
|
127
|
+
*/
|
|
128
|
+
export const ensureGlobalBucketsExist = async (storage, config, selectedBucketIds) => {
|
|
129
|
+
const globalBuckets = config.buckets || [];
|
|
130
|
+
for (const bucket of globalBuckets) {
|
|
131
|
+
if (selectedBucketIds && !selectedBucketIds.includes(bucket.$id)) {
|
|
132
|
+
continue;
|
|
131
133
|
}
|
|
134
|
+
await ensureSingleBucketExists(storage, bucket);
|
|
132
135
|
}
|
|
133
136
|
};
|
|
134
137
|
export const wipeDocumentStorage = async (storage, bucketId, options = {}) => {
|
|
@@ -12,11 +12,11 @@ export declare const BackupSchema: z.ZodObject<{
|
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export type Backup = z.infer<typeof BackupSchema>;
|
|
14
14
|
export declare const BackupCreateSchema: z.ZodObject<{
|
|
15
|
+
collections: z.ZodArray<z.ZodString>;
|
|
15
16
|
documents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
16
17
|
collectionId: z.ZodString;
|
|
17
18
|
data: z.ZodString;
|
|
18
19
|
}, z.core.$strip>>>;
|
|
19
|
-
collections: z.ZodArray<z.ZodString>;
|
|
20
20
|
database: z.ZodString;
|
|
21
21
|
}, z.core.$strip>;
|
|
22
22
|
export type BackupCreate = z.infer<typeof BackupCreateSchema>;
|
|
@@ -56,7 +56,6 @@ export declare const OperationSchema: z.ZodObject<{
|
|
|
56
56
|
export type Operation = z.infer<typeof OperationSchema>;
|
|
57
57
|
export declare const OperationCreateSchema: z.ZodObject<{
|
|
58
58
|
error: z.ZodString;
|
|
59
|
-
data: z.ZodAny;
|
|
60
59
|
status: z.ZodDefault<z.ZodEnum<{
|
|
61
60
|
error: "error";
|
|
62
61
|
pending: "pending";
|
|
@@ -66,6 +65,7 @@ export declare const OperationCreateSchema: z.ZodObject<{
|
|
|
66
65
|
cancelled: "cancelled";
|
|
67
66
|
}>>;
|
|
68
67
|
collectionId: z.ZodString;
|
|
68
|
+
data: z.ZodAny;
|
|
69
69
|
operationType: z.ZodString;
|
|
70
70
|
batches: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
71
71
|
progress: z.ZodNumber;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Index } from "appwrite-utils";
|
|
2
|
-
import type { DatabaseAdapter } from "
|
|
2
|
+
import type { DatabaseAdapter } from "appwrite-utils-helpers";
|
|
3
3
|
import type { Models } from "node-appwrite";
|
|
4
4
|
export interface IndexOperation {
|
|
5
5
|
type: 'create' | 'update' | 'skip' | 'delete';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isIndexEqualToIndex } from "../collections/tableOperations.js";
|
|
2
|
-
import { MessageFormatter } from "
|
|
3
|
-
import { delay, tryAwaitWithRetry } from "
|
|
2
|
+
import { MessageFormatter } from "appwrite-utils-helpers";
|
|
3
|
+
import { delay, tryAwaitWithRetry } from "appwrite-utils-helpers";
|
|
4
4
|
/**
|
|
5
5
|
* Plan index operations by comparing desired indexes with existing ones
|
|
6
6
|
* Uses the existing isIndexEqualToIndex function for consistent comparison
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ValidationRules } from "
|
|
1
|
+
export type { ValidationRules } from "appwrite-utils-helpers";
|
|
2
2
|
export { type AuthUserCreate, AuthUserCreateSchema, type AuthUser, AuthUserSchema, } from "./schemas/authUser.js";
|
|
3
|
-
export { validationRules } from "
|
|
3
|
+
export { validationRules } from "appwrite-utils-helpers";
|
|
4
4
|
export { afterImportActions } from "./migrations/afterImportActions.js";
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { AuthUserCreateSchema, AuthUserSchema, } from "./schemas/authUser.js";
|
|
2
|
-
export { validationRules } from "
|
|
2
|
+
export { validationRules } from "appwrite-utils-helpers";
|
|
3
3
|
export { afterImportActions } from "./migrations/afterImportActions.js";
|
package/dist/users/methods.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { AppwriteException, Databases, ID, Query, Users, } from "node-appwrite";
|
|
2
2
|
import { AuthUserSchema, } from "../schemas/authUser.js";
|
|
3
|
-
import { logger } from "
|
|
3
|
+
import { logger, MessageFormatter } from "appwrite-utils-helpers";
|
|
4
4
|
import { splitIntoBatches } from "../shared/migrationHelpers.js";
|
|
5
|
-
import { getAppwriteClient, tryAwaitWithRetry, } from "
|
|
5
|
+
import { getAppwriteClient, tryAwaitWithRetry, } from "appwrite-utils-helpers";
|
|
6
6
|
import { isUndefined } from "es-toolkit/compat";
|
|
7
7
|
import { isEmpty } from "es-toolkit/compat";
|
|
8
|
-
import { MessageFormatter } from "../shared/messageFormatter.js";
|
|
9
8
|
export class UsersController {
|
|
10
9
|
config;
|
|
11
10
|
users;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { promises as fs } from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
|
-
import { MessageFormatter } from "
|
|
4
|
+
import { MessageFormatter } from "appwrite-utils-helpers";
|
|
5
5
|
import { ConfirmationDialogs } from "../shared/confirmationDialogs.js";
|
|
6
6
|
import yaml from "js-yaml";
|
|
7
7
|
export async function migrateConfig(workingDir) {
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from 'appwrite-utils-helpers';
|
|
2
2
|
export * from "./setupFiles.js";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from 'appwrite-utils-helpers';
|
|
2
2
|
export * from "./setupFiles.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AppwriteConfig } from "appwrite-utils";
|
|
2
|
-
import { type ValidationResult } from "
|
|
2
|
+
import { type ValidationResult } from "appwrite-utils-helpers";
|
|
3
3
|
/**
|
|
4
4
|
* Session authentication preservation options for config loading
|
|
5
5
|
*/
|
|
@@ -28,7 +28,7 @@ export interface ConfigLoadingOptions {
|
|
|
28
28
|
* @returns SessionPreservationOptions object
|
|
29
29
|
*/
|
|
30
30
|
export declare function createSessionPreservation(sessionCookie: string, email?: string, expiresAt?: string): SessionPreservationOptions;
|
|
31
|
-
export { findAppwriteConfig, findFunctionsDir } from
|
|
31
|
+
export { findAppwriteConfig, findFunctionsDir } from 'appwrite-utils-helpers';
|
|
32
32
|
/**
|
|
33
33
|
* Loads the Appwrite configuration and returns both config and the path where it was found.
|
|
34
34
|
* @param configDir The directory to search for config files.
|
|
@@ -4,12 +4,11 @@ import {} from "appwrite-utils";
|
|
|
4
4
|
import { register } from "tsx/esm/api"; // Import the register function
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import chalk from "chalk";
|
|
7
|
-
import { findYamlConfig, loadYamlConfig, loadYamlConfigWithSession, extractSessionOptionsFromConfig } from "
|
|
8
|
-
import { detectAppwriteVersionCached, fetchServerVersion, isVersionAtLeast } from
|
|
9
|
-
import { MessageFormatter } from "
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { findAppwriteConfig, findAppwriteConfigTS, findFunctionsDir, discoverCollections, discoverTables, discoverLegacyDirectory } from "./configDiscovery.js";
|
|
7
|
+
import { findYamlConfig, loadYamlConfig, loadYamlConfigWithSession, extractSessionOptionsFromConfig, validateCollectionsTablesConfig, reportValidationResults } from "appwrite-utils-helpers";
|
|
8
|
+
import { detectAppwriteVersionCached, fetchServerVersion, isVersionAtLeast } from 'appwrite-utils-helpers';
|
|
9
|
+
import { MessageFormatter } from "appwrite-utils-helpers";
|
|
10
|
+
import { resolveCollectionsDir, resolveTablesDir } from 'appwrite-utils-helpers';
|
|
11
|
+
import { findAppwriteConfig, findAppwriteConfigTS, findFunctionsDir, discoverCollections, discoverTables, discoverLegacyDirectory } from 'appwrite-utils-helpers';
|
|
13
12
|
/**
|
|
14
13
|
* Helper function to create session preservation options from session data
|
|
15
14
|
* @param sessionCookie The session cookie string
|
|
@@ -28,7 +27,7 @@ export function createSessionPreservation(sessionCookie, email, expiresAt) {
|
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
// Re-export config discovery functions for backward compatibility
|
|
31
|
-
export { findAppwriteConfig, findFunctionsDir } from
|
|
30
|
+
export { findAppwriteConfig, findFunctionsDir } from 'appwrite-utils-helpers';
|
|
32
31
|
/**
|
|
33
32
|
* Loads the Appwrite configuration and returns both config and the path where it was found.
|
|
34
33
|
* @param configDir The directory to search for config files.
|