appwrite-utils-cli 1.9.7 → 1.11.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/CONFIG_TODO.md +1189 -1189
- package/README.md +1004 -1004
- package/SELECTION_DIALOGS.md +145 -145
- package/SERVICE_IMPLEMENTATION_REPORT.md +462 -462
- package/package.json +6 -3
- package/scripts/copy-templates.ts +23 -23
- package/src/adapters/index.ts +11 -37
- package/src/backups/operations/bucketBackup.ts +277 -277
- package/src/backups/operations/collectionBackup.ts +310 -310
- package/src/backups/operations/comprehensiveBackup.ts +342 -342
- package/src/backups/schemas/bucketManifest.ts +78 -78
- package/src/backups/schemas/comprehensiveManifest.ts +76 -76
- package/src/backups/tracking/centralizedTracking.ts +352 -352
- package/src/cli/commands/configCommands.ts +265 -201
- package/src/cli/commands/databaseCommands.ts +931 -879
- package/src/cli/commands/functionCommands.ts +333 -332
- package/src/cli/commands/importFileCommands.ts +815 -0
- package/src/cli/commands/schemaCommands.ts +141 -141
- package/src/cli/commands/storageCommands.ts +2 -3
- package/src/cli/commands/transferCommands.ts +454 -457
- package/src/collections/attributes.ts.backup +1555 -1555
- package/src/collections/{attributes.ts → columns.ts} +15 -10
- package/src/collections/indexes.ts +350 -352
- package/src/collections/methods.ts +714 -700
- package/src/collections/tableOperations.ts +29 -8
- package/src/collections/transferOperations.ts +376 -377
- package/src/collections/wipeOperations.ts +449 -346
- package/src/databases/methods.ts +49 -49
- package/src/databases/setup.ts +77 -77
- package/src/examples/yamlTerminologyExample.ts +346 -346
- package/src/functions/deployments.ts +221 -220
- package/src/functions/fnConfigDiscovery.ts +2 -2
- package/src/functions/methods.ts +284 -284
- package/src/functions/templates/count-docs-in-collection/README.md +53 -53
- package/src/functions/templates/count-docs-in-collection/src/main.ts +159 -159
- package/src/functions/templates/count-docs-in-collection/src/request.ts +8 -8
- package/src/functions/templates/hono-typescript/README.md +285 -285
- package/src/functions/templates/hono-typescript/src/adapters/request.ts +73 -73
- package/src/functions/templates/hono-typescript/src/adapters/response.ts +105 -105
- package/src/functions/templates/hono-typescript/src/app.ts +179 -179
- package/src/functions/templates/hono-typescript/src/context.ts +102 -102
- package/src/functions/templates/hono-typescript/src/{index.ts → main.ts} +53 -53
- package/src/functions/templates/hono-typescript/src/middleware/appwrite.ts +118 -118
- package/src/functions/templates/typescript-node/README.md +31 -31
- package/src/functions/templates/typescript-node/src/context.ts +102 -102
- package/src/functions/templates/typescript-node/src/{index.ts → main.ts} +29 -29
- package/src/functions/templates/uv/README.md +30 -30
- package/src/functions/templates/uv/pyproject.toml +29 -29
- package/src/functions/templates/uv/src/context.py +124 -124
- package/src/functions/templates/uv/src/{index.py → main.py} +45 -45
- package/src/init.ts +62 -62
- package/src/interactiveCLI.ts +1095 -1030
- package/src/main.ts +1517 -1670
- package/src/migrations/afterImportActions.ts +579 -580
- package/src/migrations/appwriteToX.ts +634 -630
- package/src/migrations/comprehensiveTransfer.ts +2149 -2149
- package/src/migrations/dataLoader.ts +1729 -1702
- package/src/migrations/importController.ts +440 -428
- package/src/migrations/importDataActions.ts +315 -315
- package/src/migrations/relationships.ts +333 -334
- package/src/migrations/services/DataTransformationService.ts +195 -195
- package/src/migrations/services/FileHandlerService.ts +310 -310
- package/src/migrations/services/ImportOrchestrator.ts +674 -665
- package/src/migrations/services/RateLimitManager.ts +362 -362
- package/src/migrations/services/RelationshipResolver.ts +460 -460
- package/src/migrations/services/UserMappingService.ts +344 -344
- package/src/migrations/services/ValidationService.ts +333 -333
- package/src/migrations/transfer.ts +987 -942
- package/src/migrations/yaml/YamlImportConfigLoader.ts +438 -438
- package/src/migrations/yaml/YamlImportIntegration.ts +438 -438
- package/src/migrations/yaml/generateImportSchemas.ts +1347 -1347
- package/src/schemas/authUser.ts +23 -23
- package/src/setup.ts +8 -8
- package/src/setupCommands.ts +5 -6
- package/src/setupController.ts +42 -42
- package/src/shared/backupMetadataSchema.ts +93 -93
- package/src/shared/backupTracking.ts +211 -211
- package/src/shared/confirmationDialogs.ts +326 -326
- package/src/shared/migrationHelpers.ts +232 -232
- package/src/shared/operationLogger.ts +20 -20
- package/src/shared/operationQueue.ts +326 -327
- package/src/shared/operationsTable.ts +338 -338
- package/src/shared/operationsTableSchema.ts +60 -60
- package/src/shared/progressManager.ts +277 -277
- package/src/shared/relationshipExtractor.ts +214 -214
- package/src/shared/selectionDialogs.ts +775 -722
- package/src/storage/backupCompression.ts +88 -88
- package/src/storage/methods.ts +695 -682
- package/src/storage/schemas.ts +205 -205
- package/src/tables/indexManager.ts +408 -408
- package/src/types/node-appwrite-tablesdb.d.ts +43 -43
- package/src/types.ts +9 -9
- package/src/users/methods.ts +358 -359
- package/src/utils/configMigration.ts +347 -347
- package/src/utils/index.ts +2 -2
- package/src/utils/loadConfigs.ts +457 -449
- package/src/utils/setupFiles.ts +1236 -1238
- package/src/utilsController.ts +1263 -1213
- package/tests/README.md +496 -496
- package/tests/adapters/AdapterFactory.test.ts +276 -276
- package/tests/integration/syncOperations.test.ts +462 -462
- package/tests/jest.config.js +24 -24
- package/tests/migration/configMigration.test.ts +545 -545
- package/tests/setup.ts +61 -61
- package/tests/testUtils.ts +339 -339
- package/tests/utils/loadConfigs.test.ts +349 -349
- package/tests/validation/configValidation.test.ts +411 -411
- package/tsconfig.json +44 -44
- 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/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/adapters/index.d.ts +0 -11
- package/dist/adapters/index.js +0 -12
- package/dist/backups/operations/bucketBackup.d.ts +0 -19
- package/dist/backups/operations/bucketBackup.js +0 -197
- package/dist/backups/operations/collectionBackup.d.ts +0 -30
- package/dist/backups/operations/collectionBackup.js +0 -201
- package/dist/backups/operations/comprehensiveBackup.d.ts +0 -25
- package/dist/backups/operations/comprehensiveBackup.js +0 -238
- package/dist/backups/schemas/bucketManifest.d.ts +0 -93
- package/dist/backups/schemas/bucketManifest.js +0 -33
- package/dist/backups/schemas/comprehensiveManifest.d.ts +0 -108
- package/dist/backups/schemas/comprehensiveManifest.js +0 -32
- package/dist/backups/tracking/centralizedTracking.d.ts +0 -34
- package/dist/backups/tracking/centralizedTracking.js +0 -274
- package/dist/cli/commands/configCommands.d.ts +0 -8
- package/dist/cli/commands/configCommands.js +0 -166
- package/dist/cli/commands/databaseCommands.d.ts +0 -14
- package/dist/cli/commands/databaseCommands.js +0 -644
- package/dist/cli/commands/functionCommands.d.ts +0 -7
- package/dist/cli/commands/functionCommands.js +0 -330
- package/dist/cli/commands/schemaCommands.d.ts +0 -7
- package/dist/cli/commands/schemaCommands.js +0 -169
- package/dist/cli/commands/storageCommands.d.ts +0 -5
- package/dist/cli/commands/storageCommands.js +0 -143
- package/dist/cli/commands/transferCommands.d.ts +0 -5
- package/dist/cli/commands/transferCommands.js +0 -384
- package/dist/collections/attributes.d.ts +0 -13
- package/dist/collections/attributes.js +0 -1333
- package/dist/collections/indexes.d.ts +0 -12
- package/dist/collections/indexes.js +0 -217
- package/dist/collections/methods.d.ts +0 -19
- package/dist/collections/methods.js +0 -587
- package/dist/collections/tableOperations.d.ts +0 -86
- package/dist/collections/tableOperations.js +0 -447
- package/dist/collections/transferOperations.d.ts +0 -8
- package/dist/collections/transferOperations.js +0 -412
- package/dist/collections/wipeOperations.d.ts +0 -16
- package/dist/collections/wipeOperations.js +0 -233
- 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/databases/methods.d.ts +0 -6
- package/dist/databases/methods.js +0 -35
- package/dist/databases/setup.d.ts +0 -5
- package/dist/databases/setup.js +0 -45
- package/dist/examples/yamlTerminologyExample.d.ts +0 -42
- package/dist/examples/yamlTerminologyExample.js +0 -272
- package/dist/functions/deployments.d.ts +0 -4
- package/dist/functions/deployments.js +0 -146
- package/dist/functions/fnConfigDiscovery.d.ts +0 -3
- package/dist/functions/fnConfigDiscovery.js +0 -108
- package/dist/functions/methods.d.ts +0 -16
- package/dist/functions/methods.js +0 -174
- package/dist/functions/pathResolution.d.ts +0 -37
- package/dist/functions/pathResolution.js +0 -185
- package/dist/functions/templates/count-docs-in-collection/README.md +0 -54
- package/dist/functions/templates/count-docs-in-collection/package.json +0 -25
- package/dist/functions/templates/count-docs-in-collection/src/main.ts +0 -159
- package/dist/functions/templates/count-docs-in-collection/src/request.ts +0 -9
- package/dist/functions/templates/count-docs-in-collection/tsconfig.json +0 -28
- package/dist/functions/templates/hono-typescript/README.md +0 -286
- package/dist/functions/templates/hono-typescript/package.json +0 -26
- package/dist/functions/templates/hono-typescript/src/adapters/request.ts +0 -74
- package/dist/functions/templates/hono-typescript/src/adapters/response.ts +0 -106
- package/dist/functions/templates/hono-typescript/src/app.ts +0 -180
- package/dist/functions/templates/hono-typescript/src/context.ts +0 -103
- package/dist/functions/templates/hono-typescript/src/index.ts +0 -54
- package/dist/functions/templates/hono-typescript/src/middleware/appwrite.ts +0 -119
- package/dist/functions/templates/hono-typescript/tsconfig.json +0 -20
- package/dist/functions/templates/typescript-node/README.md +0 -32
- package/dist/functions/templates/typescript-node/package.json +0 -25
- package/dist/functions/templates/typescript-node/src/context.ts +0 -103
- package/dist/functions/templates/typescript-node/src/index.ts +0 -29
- package/dist/functions/templates/typescript-node/tsconfig.json +0 -28
- package/dist/functions/templates/uv/README.md +0 -31
- package/dist/functions/templates/uv/pyproject.toml +0 -30
- package/dist/functions/templates/uv/src/__init__.py +0 -0
- package/dist/functions/templates/uv/src/context.py +0 -125
- package/dist/functions/templates/uv/src/index.py +0 -46
- package/dist/init.d.ts +0 -2
- package/dist/init.js +0 -57
- package/dist/interactiveCLI.d.ts +0 -31
- package/dist/interactiveCLI.js +0 -898
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -1180
- package/dist/migrations/afterImportActions.d.ts +0 -17
- package/dist/migrations/afterImportActions.js +0 -306
- package/dist/migrations/appwriteToX.d.ts +0 -211
- package/dist/migrations/appwriteToX.js +0 -491
- package/dist/migrations/comprehensiveTransfer.d.ts +0 -147
- package/dist/migrations/comprehensiveTransfer.js +0 -1317
- package/dist/migrations/dataLoader.d.ts +0 -753
- package/dist/migrations/dataLoader.js +0 -1250
- package/dist/migrations/importController.d.ts +0 -23
- package/dist/migrations/importController.js +0 -268
- package/dist/migrations/importDataActions.d.ts +0 -50
- package/dist/migrations/importDataActions.js +0 -230
- package/dist/migrations/relationships.d.ts +0 -29
- package/dist/migrations/relationships.js +0 -204
- package/dist/migrations/services/DataTransformationService.d.ts +0 -55
- package/dist/migrations/services/DataTransformationService.js +0 -158
- package/dist/migrations/services/FileHandlerService.d.ts +0 -75
- package/dist/migrations/services/FileHandlerService.js +0 -236
- package/dist/migrations/services/ImportOrchestrator.d.ts +0 -97
- package/dist/migrations/services/ImportOrchestrator.js +0 -485
- package/dist/migrations/services/RateLimitManager.d.ts +0 -138
- package/dist/migrations/services/RateLimitManager.js +0 -279
- package/dist/migrations/services/RelationshipResolver.d.ts +0 -120
- package/dist/migrations/services/RelationshipResolver.js +0 -332
- package/dist/migrations/services/UserMappingService.d.ts +0 -109
- package/dist/migrations/services/UserMappingService.js +0 -277
- package/dist/migrations/services/ValidationService.d.ts +0 -74
- package/dist/migrations/services/ValidationService.js +0 -260
- package/dist/migrations/transfer.d.ts +0 -26
- package/dist/migrations/transfer.js +0 -608
- package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +0 -131
- package/dist/migrations/yaml/YamlImportConfigLoader.js +0 -383
- package/dist/migrations/yaml/YamlImportIntegration.d.ts +0 -93
- package/dist/migrations/yaml/YamlImportIntegration.js +0 -341
- package/dist/migrations/yaml/generateImportSchemas.d.ts +0 -30
- package/dist/migrations/yaml/generateImportSchemas.js +0 -1327
- package/dist/schemas/authUser.d.ts +0 -24
- package/dist/schemas/authUser.js +0 -17
- package/dist/setup.d.ts +0 -2
- package/dist/setup.js +0 -5
- package/dist/setupCommands.d.ts +0 -58
- package/dist/setupCommands.js +0 -490
- package/dist/setupController.d.ts +0 -9
- package/dist/setupController.js +0 -34
- package/dist/shared/attributeMapper.d.ts +0 -20
- package/dist/shared/attributeMapper.js +0 -203
- package/dist/shared/backupMetadataSchema.d.ts +0 -94
- package/dist/shared/backupMetadataSchema.js +0 -38
- package/dist/shared/backupTracking.d.ts +0 -18
- package/dist/shared/backupTracking.js +0 -176
- package/dist/shared/confirmationDialogs.d.ts +0 -75
- package/dist/shared/confirmationDialogs.js +0 -236
- 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/migrationHelpers.d.ts +0 -61
- package/dist/shared/migrationHelpers.js +0 -145
- package/dist/shared/operationLogger.d.ts +0 -10
- package/dist/shared/operationLogger.js +0 -12
- package/dist/shared/operationQueue.d.ts +0 -40
- package/dist/shared/operationQueue.js +0 -311
- package/dist/shared/operationsTable.d.ts +0 -26
- package/dist/shared/operationsTable.js +0 -286
- package/dist/shared/operationsTableSchema.d.ts +0 -48
- package/dist/shared/operationsTableSchema.js +0 -35
- package/dist/shared/progressManager.d.ts +0 -62
- package/dist/shared/progressManager.js +0 -215
- package/dist/shared/pydanticModelGenerator.d.ts +0 -17
- package/dist/shared/pydanticModelGenerator.js +0 -615
- package/dist/shared/relationshipExtractor.d.ts +0 -56
- package/dist/shared/relationshipExtractor.js +0 -138
- package/dist/shared/schemaGenerator.d.ts +0 -40
- package/dist/shared/schemaGenerator.js +0 -556
- package/dist/shared/selectionDialogs.d.ts +0 -214
- package/dist/shared/selectionDialogs.js +0 -544
- package/dist/storage/backupCompression.d.ts +0 -20
- package/dist/storage/backupCompression.js +0 -67
- package/dist/storage/methods.d.ts +0 -32
- package/dist/storage/methods.js +0 -472
- package/dist/storage/schemas.d.ts +0 -842
- package/dist/storage/schemas.js +0 -175
- package/dist/tables/indexManager.d.ts +0 -65
- package/dist/tables/indexManager.js +0 -294
- package/dist/types.d.ts +0 -4
- package/dist/types.js +0 -3
- package/dist/users/methods.d.ts +0 -16
- package/dist/users/methods.js +0 -277
- 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/configMigration.d.ts +0 -1
- package/dist/utils/configMigration.js +0 -261
- 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/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/loadConfigs.d.ts +0 -50
- package/dist/utils/loadConfigs.js +0 -358
- 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/setupFiles.d.ts +0 -4
- package/dist/utils/setupFiles.js +0 -1192
- 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/dist/utilsController.d.ts +0 -107
- package/dist/utilsController.js +0 -873
- 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/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/functions/pathResolution.ts +0 -227
- package/src/functions/templates/count-docs-in-collection/package.json +0 -25
- package/src/functions/templates/count-docs-in-collection/tsconfig.json +0 -28
- package/src/functions/templates/hono-typescript/package.json +0 -26
- package/src/functions/templates/hono-typescript/tsconfig.json +0 -20
- package/src/functions/templates/typescript-node/package.json +0 -25
- package/src/functions/templates/typescript-node/tsconfig.json +0 -28
- package/src/shared/attributeMapper.ts +0 -229
- 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/pydanticModelGenerator.ts +0 -618
- package/src/shared/schemaGenerator.ts +0 -644
- package/src/utils/ClientFactory.ts +0 -240
- package/src/utils/configDiscovery.ts +0 -557
- 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/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/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/tmp-sync-test/.appwrite/collections/TestCollection.yaml +0 -7
|
@@ -1,753 +0,0 @@
|
|
|
1
|
-
import type { ImportDataActions } from "./importDataActions.js";
|
|
2
|
-
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type ImportDef } from "appwrite-utils";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { type Databases } from "node-appwrite";
|
|
5
|
-
import { AuthUserCreateSchema } from "../schemas/authUser.js";
|
|
6
|
-
export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
7
|
-
collection: z.ZodOptional<z.ZodObject<{
|
|
8
|
-
name: z.ZodString;
|
|
9
|
-
attributes: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
10
|
-
key: z.ZodString;
|
|
11
|
-
type: z.ZodString;
|
|
12
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
-
error: z.ZodOptional<z.ZodString>;
|
|
15
|
-
required: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
18
|
-
xdefault: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
19
|
-
format: z.ZodOptional<z.ZodString>;
|
|
20
|
-
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
21
|
-
min: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
22
|
-
max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
23
|
-
elements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
-
encrypt: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
-
relatedCollection: z.ZodOptional<z.ZodString>;
|
|
26
|
-
relationType: z.ZodOptional<z.ZodString>;
|
|
27
|
-
twoWay: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
-
twoWayKey: z.ZodOptional<z.ZodString>;
|
|
29
|
-
onDelete: z.ZodOptional<z.ZodString>;
|
|
30
|
-
side: z.ZodOptional<z.ZodString>;
|
|
31
|
-
importMapping: z.ZodOptional<z.ZodObject<{
|
|
32
|
-
originalIdField: z.ZodString;
|
|
33
|
-
targetField: z.ZodOptional<z.ZodString>;
|
|
34
|
-
}, z.core.$strip>>;
|
|
35
|
-
}, z.core.$loose>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
format: z.ZodOptional<z.ZodString>;
|
|
38
|
-
key: z.ZodString;
|
|
39
|
-
status: z.ZodOptional<z.ZodString>;
|
|
40
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
44
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
45
|
-
error: z.ZodOptional<z.ZodString>;
|
|
46
|
-
type: z.ZodLiteral<"string">;
|
|
47
|
-
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
48
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
-
encrypt: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
-
format: z.ZodOptional<z.ZodString>;
|
|
53
|
-
key: z.ZodString;
|
|
54
|
-
status: z.ZodOptional<z.ZodString>;
|
|
55
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
58
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
59
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
60
|
-
error: z.ZodOptional<z.ZodString>;
|
|
61
|
-
type: z.ZodLiteral<"integer">;
|
|
62
|
-
min: z.ZodOptional<z.ZodNumber>;
|
|
63
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
65
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
-
format: z.ZodOptional<z.ZodString>;
|
|
68
|
-
key: z.ZodString;
|
|
69
|
-
status: z.ZodOptional<z.ZodString>;
|
|
70
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
73
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
74
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
75
|
-
error: z.ZodOptional<z.ZodString>;
|
|
76
|
-
type: z.ZodLiteral<"double">;
|
|
77
|
-
min: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
80
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
-
format: z.ZodOptional<z.ZodString>;
|
|
83
|
-
key: z.ZodString;
|
|
84
|
-
status: z.ZodOptional<z.ZodString>;
|
|
85
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
88
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
89
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
90
|
-
error: z.ZodOptional<z.ZodString>;
|
|
91
|
-
type: z.ZodLiteral<"float">;
|
|
92
|
-
min: z.ZodOptional<z.ZodNumber>;
|
|
93
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
95
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
format: z.ZodOptional<z.ZodString>;
|
|
98
|
-
key: z.ZodString;
|
|
99
|
-
status: z.ZodOptional<z.ZodString>;
|
|
100
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
103
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
104
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
105
|
-
error: z.ZodOptional<z.ZodString>;
|
|
106
|
-
type: z.ZodLiteral<"boolean">;
|
|
107
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
108
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
-
format: z.ZodOptional<z.ZodString>;
|
|
111
|
-
key: z.ZodString;
|
|
112
|
-
status: z.ZodOptional<z.ZodString>;
|
|
113
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
116
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
117
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
118
|
-
error: z.ZodOptional<z.ZodString>;
|
|
119
|
-
type: z.ZodLiteral<"datetime">;
|
|
120
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
121
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
-
format: z.ZodOptional<z.ZodString>;
|
|
124
|
-
key: z.ZodString;
|
|
125
|
-
status: z.ZodOptional<z.ZodString>;
|
|
126
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
129
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
130
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
131
|
-
error: z.ZodOptional<z.ZodString>;
|
|
132
|
-
type: z.ZodLiteral<"email">;
|
|
133
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
-
format: z.ZodOptional<z.ZodString>;
|
|
137
|
-
key: z.ZodString;
|
|
138
|
-
status: z.ZodOptional<z.ZodString>;
|
|
139
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
142
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
143
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
144
|
-
error: z.ZodOptional<z.ZodString>;
|
|
145
|
-
type: z.ZodLiteral<"ip">;
|
|
146
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
147
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
-
format: z.ZodOptional<z.ZodString>;
|
|
150
|
-
key: z.ZodString;
|
|
151
|
-
status: z.ZodOptional<z.ZodString>;
|
|
152
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
153
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
155
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
156
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
157
|
-
error: z.ZodOptional<z.ZodString>;
|
|
158
|
-
type: z.ZodLiteral<"url">;
|
|
159
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
160
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
-
format: z.ZodOptional<z.ZodString>;
|
|
163
|
-
key: z.ZodString;
|
|
164
|
-
status: z.ZodOptional<z.ZodString>;
|
|
165
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
168
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
169
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
170
|
-
error: z.ZodOptional<z.ZodString>;
|
|
171
|
-
type: z.ZodLiteral<"enum">;
|
|
172
|
-
elements: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
173
|
-
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
-
array: z.ZodOptional<z.ZodBoolean>;
|
|
176
|
-
format: z.ZodOptional<z.ZodString>;
|
|
177
|
-
key: z.ZodString;
|
|
178
|
-
status: z.ZodOptional<z.ZodString>;
|
|
179
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
180
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
|
-
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
182
|
-
$createdAt: z.ZodOptional<z.ZodString>;
|
|
183
|
-
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
184
|
-
error: z.ZodOptional<z.ZodString>;
|
|
185
|
-
type: z.ZodLiteral<"relationship">;
|
|
186
|
-
relatedCollection: z.ZodString;
|
|
187
|
-
relationType: z.ZodEnum<{
|
|
188
|
-
oneToMany: "oneToMany";
|
|
189
|
-
manyToOne: "manyToOne";
|
|
190
|
-
oneToOne: "oneToOne";
|
|
191
|
-
manyToMany: "manyToMany";
|
|
192
|
-
}>;
|
|
193
|
-
twoWay: z.ZodBoolean;
|
|
194
|
-
twoWayKey: z.ZodOptional<z.ZodString>;
|
|
195
|
-
onDelete: z.ZodDefault<z.ZodEnum<{
|
|
196
|
-
setNull: "setNull";
|
|
197
|
-
cascade: "cascade";
|
|
198
|
-
restrict: "restrict";
|
|
199
|
-
}>>;
|
|
200
|
-
side: z.ZodOptional<z.ZodEnum<{
|
|
201
|
-
parent: "parent";
|
|
202
|
-
child: "child";
|
|
203
|
-
}>>;
|
|
204
|
-
importMapping: z.ZodOptional<z.ZodObject<{
|
|
205
|
-
originalIdField: z.ZodString;
|
|
206
|
-
targetField: z.ZodOptional<z.ZodString>;
|
|
207
|
-
}, z.core.$strip>>;
|
|
208
|
-
}, z.core.$strip>], "type">>>>;
|
|
209
|
-
$id: z.ZodOptional<z.ZodString>;
|
|
210
|
-
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
211
|
-
documentSecurity: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
212
|
-
$permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
213
|
-
permission: z.ZodString;
|
|
214
|
-
target: z.ZodString;
|
|
215
|
-
}, z.core.$strip>>>>;
|
|
216
|
-
indexes: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
-
key: z.ZodString;
|
|
218
|
-
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
219
|
-
key: "key";
|
|
220
|
-
unique: "unique";
|
|
221
|
-
fulltext: "fulltext";
|
|
222
|
-
}>>>;
|
|
223
|
-
status: z.ZodOptional<z.ZodString>;
|
|
224
|
-
error: z.ZodOptional<z.ZodString>;
|
|
225
|
-
attributes: z.ZodArray<z.ZodString>;
|
|
226
|
-
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
227
|
-
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
228
|
-
key: string;
|
|
229
|
-
type: "key" | "unique" | "fulltext";
|
|
230
|
-
attributes: string[];
|
|
231
|
-
status?: string | undefined;
|
|
232
|
-
error?: string | undefined;
|
|
233
|
-
orders?: string[] | undefined;
|
|
234
|
-
}[], {
|
|
235
|
-
key: string;
|
|
236
|
-
type: "key" | "unique" | "fulltext";
|
|
237
|
-
attributes: string[];
|
|
238
|
-
status?: string | undefined;
|
|
239
|
-
error?: string | undefined;
|
|
240
|
-
orders?: string[] | undefined;
|
|
241
|
-
}[]>>;
|
|
242
|
-
importDefs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
243
|
-
type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
244
|
-
create: "create";
|
|
245
|
-
update: "update";
|
|
246
|
-
}>>>;
|
|
247
|
-
filePath: z.ZodString;
|
|
248
|
-
basePath: z.ZodOptional<z.ZodString>;
|
|
249
|
-
primaryKeyField: z.ZodDefault<z.ZodString>;
|
|
250
|
-
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
251
|
-
sourceField: z.ZodString;
|
|
252
|
-
fieldToSet: z.ZodOptional<z.ZodString>;
|
|
253
|
-
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
|
254
|
-
targetField: z.ZodString;
|
|
255
|
-
targetCollection: z.ZodString;
|
|
256
|
-
}, z.core.$strip>>>;
|
|
257
|
-
createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
|
258
|
-
updateMapping: z.ZodOptional<z.ZodObject<{
|
|
259
|
-
originalIdField: z.ZodString;
|
|
260
|
-
targetField: z.ZodString;
|
|
261
|
-
}, z.core.$strip>>;
|
|
262
|
-
attributeMappings: z.ZodArray<z.ZodObject<{
|
|
263
|
-
oldKey: z.ZodOptional<z.ZodString>;
|
|
264
|
-
oldKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
265
|
-
targetKey: z.ZodString;
|
|
266
|
-
valueToSet: z.ZodOptional<z.ZodAny>;
|
|
267
|
-
fileData: z.ZodOptional<z.ZodObject<{
|
|
268
|
-
name: z.ZodString;
|
|
269
|
-
path: z.ZodString;
|
|
270
|
-
}, z.core.$strip>>;
|
|
271
|
-
converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
272
|
-
validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
273
|
-
action: z.ZodString;
|
|
274
|
-
params: z.ZodArray<z.ZodString>;
|
|
275
|
-
}, z.core.$strip>>>>;
|
|
276
|
-
postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
277
|
-
action: z.ZodString;
|
|
278
|
-
params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
279
|
-
}, z.core.$strip>>>>;
|
|
280
|
-
}, z.core.$strip>>;
|
|
281
|
-
}, z.core.$strip>>>>;
|
|
282
|
-
databaseId: z.ZodOptional<z.ZodString>;
|
|
283
|
-
databaseIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
284
|
-
}, z.core.$strip>>;
|
|
285
|
-
data: z.ZodArray<z.ZodObject<{
|
|
286
|
-
rawData: z.ZodAny;
|
|
287
|
-
finalData: z.ZodAny;
|
|
288
|
-
context: z.ZodAny;
|
|
289
|
-
importDef: z.ZodOptional<z.ZodObject<{
|
|
290
|
-
type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
291
|
-
create: "create";
|
|
292
|
-
update: "update";
|
|
293
|
-
}>>>;
|
|
294
|
-
filePath: z.ZodString;
|
|
295
|
-
basePath: z.ZodOptional<z.ZodString>;
|
|
296
|
-
primaryKeyField: z.ZodDefault<z.ZodString>;
|
|
297
|
-
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
298
|
-
sourceField: z.ZodString;
|
|
299
|
-
fieldToSet: z.ZodOptional<z.ZodString>;
|
|
300
|
-
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
|
301
|
-
targetField: z.ZodString;
|
|
302
|
-
targetCollection: z.ZodString;
|
|
303
|
-
}, z.core.$strip>>>;
|
|
304
|
-
createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
|
305
|
-
updateMapping: z.ZodOptional<z.ZodObject<{
|
|
306
|
-
originalIdField: z.ZodString;
|
|
307
|
-
targetField: z.ZodString;
|
|
308
|
-
}, z.core.$strip>>;
|
|
309
|
-
attributeMappings: z.ZodArray<z.ZodObject<{
|
|
310
|
-
oldKey: z.ZodOptional<z.ZodString>;
|
|
311
|
-
oldKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
312
|
-
targetKey: z.ZodString;
|
|
313
|
-
valueToSet: z.ZodOptional<z.ZodAny>;
|
|
314
|
-
fileData: z.ZodOptional<z.ZodObject<{
|
|
315
|
-
name: z.ZodString;
|
|
316
|
-
path: z.ZodString;
|
|
317
|
-
}, z.core.$strip>>;
|
|
318
|
-
converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
319
|
-
validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
320
|
-
action: z.ZodString;
|
|
321
|
-
params: z.ZodArray<z.ZodString>;
|
|
322
|
-
}, z.core.$strip>>>>;
|
|
323
|
-
postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
324
|
-
action: z.ZodString;
|
|
325
|
-
params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
326
|
-
}, z.core.$strip>>>>;
|
|
327
|
-
}, z.core.$strip>>;
|
|
328
|
-
}, z.core.$strip>>;
|
|
329
|
-
}, z.core.$strip>>;
|
|
330
|
-
}, z.core.$strip>;
|
|
331
|
-
export type CollectionImportData = z.infer<typeof CollectionImportDataSchema>;
|
|
332
|
-
export declare class DataLoader {
|
|
333
|
-
private appwriteFolderPath;
|
|
334
|
-
private importDataActions;
|
|
335
|
-
private database;
|
|
336
|
-
private usersController;
|
|
337
|
-
private config;
|
|
338
|
-
importMap: Map<string, {
|
|
339
|
-
data: {
|
|
340
|
-
rawData: any;
|
|
341
|
-
finalData: any;
|
|
342
|
-
context: any;
|
|
343
|
-
importDef?: {
|
|
344
|
-
filePath: string;
|
|
345
|
-
primaryKeyField: string;
|
|
346
|
-
attributeMappings: {
|
|
347
|
-
targetKey: string;
|
|
348
|
-
oldKey?: string | undefined;
|
|
349
|
-
oldKeys?: string[] | undefined;
|
|
350
|
-
valueToSet?: any;
|
|
351
|
-
fileData?: {
|
|
352
|
-
name: string;
|
|
353
|
-
path: string;
|
|
354
|
-
} | undefined;
|
|
355
|
-
converters?: string[] | undefined;
|
|
356
|
-
validationActions?: {
|
|
357
|
-
action: string;
|
|
358
|
-
params: string[];
|
|
359
|
-
}[] | undefined;
|
|
360
|
-
postImportActions?: {
|
|
361
|
-
action: string;
|
|
362
|
-
params: (string | Record<string, any>)[];
|
|
363
|
-
}[] | undefined;
|
|
364
|
-
}[];
|
|
365
|
-
type?: "create" | "update" | undefined;
|
|
366
|
-
basePath?: string | undefined;
|
|
367
|
-
idMappings?: {
|
|
368
|
-
sourceField: string;
|
|
369
|
-
targetField: string;
|
|
370
|
-
targetCollection: string;
|
|
371
|
-
fieldToSet?: string | undefined;
|
|
372
|
-
targetFieldToMatch?: string | undefined;
|
|
373
|
-
}[] | undefined;
|
|
374
|
-
createUsers?: boolean | null | undefined;
|
|
375
|
-
updateMapping?: {
|
|
376
|
-
originalIdField: string;
|
|
377
|
-
targetField: string;
|
|
378
|
-
} | undefined;
|
|
379
|
-
} | undefined;
|
|
380
|
-
}[];
|
|
381
|
-
collection?: {
|
|
382
|
-
name: string;
|
|
383
|
-
attributes: ({
|
|
384
|
-
key: string;
|
|
385
|
-
required: boolean;
|
|
386
|
-
type: "string";
|
|
387
|
-
size: number;
|
|
388
|
-
array?: boolean | undefined;
|
|
389
|
-
format?: string | undefined;
|
|
390
|
-
status?: string | undefined;
|
|
391
|
-
attributes?: string[] | undefined;
|
|
392
|
-
orders?: string[] | undefined;
|
|
393
|
-
$createdAt?: string | undefined;
|
|
394
|
-
$updatedAt?: string | undefined;
|
|
395
|
-
error?: string | undefined;
|
|
396
|
-
xdefault?: string | null | undefined;
|
|
397
|
-
encrypt?: boolean | undefined;
|
|
398
|
-
} | {
|
|
399
|
-
key: string;
|
|
400
|
-
required: boolean;
|
|
401
|
-
type: "integer";
|
|
402
|
-
array?: boolean | undefined;
|
|
403
|
-
format?: string | undefined;
|
|
404
|
-
status?: string | undefined;
|
|
405
|
-
attributes?: string[] | undefined;
|
|
406
|
-
orders?: string[] | undefined;
|
|
407
|
-
$createdAt?: string | undefined;
|
|
408
|
-
$updatedAt?: string | undefined;
|
|
409
|
-
error?: string | undefined;
|
|
410
|
-
min?: number | undefined;
|
|
411
|
-
max?: number | undefined;
|
|
412
|
-
xdefault?: number | null | undefined;
|
|
413
|
-
} | {
|
|
414
|
-
key: string;
|
|
415
|
-
required: boolean;
|
|
416
|
-
type: "double";
|
|
417
|
-
array?: boolean | undefined;
|
|
418
|
-
format?: string | undefined;
|
|
419
|
-
status?: string | undefined;
|
|
420
|
-
attributes?: string[] | undefined;
|
|
421
|
-
orders?: string[] | undefined;
|
|
422
|
-
$createdAt?: string | undefined;
|
|
423
|
-
$updatedAt?: string | undefined;
|
|
424
|
-
error?: string | undefined;
|
|
425
|
-
min?: number | undefined;
|
|
426
|
-
max?: number | undefined;
|
|
427
|
-
xdefault?: number | null | undefined;
|
|
428
|
-
} | {
|
|
429
|
-
key: string;
|
|
430
|
-
required: boolean;
|
|
431
|
-
type: "float";
|
|
432
|
-
array?: boolean | undefined;
|
|
433
|
-
format?: string | undefined;
|
|
434
|
-
status?: string | undefined;
|
|
435
|
-
attributes?: string[] | undefined;
|
|
436
|
-
orders?: string[] | undefined;
|
|
437
|
-
$createdAt?: string | undefined;
|
|
438
|
-
$updatedAt?: string | undefined;
|
|
439
|
-
error?: string | undefined;
|
|
440
|
-
min?: number | undefined;
|
|
441
|
-
max?: number | undefined;
|
|
442
|
-
xdefault?: number | null | undefined;
|
|
443
|
-
} | {
|
|
444
|
-
key: string;
|
|
445
|
-
required: boolean;
|
|
446
|
-
type: "boolean";
|
|
447
|
-
array?: boolean | undefined;
|
|
448
|
-
format?: string | undefined;
|
|
449
|
-
status?: string | undefined;
|
|
450
|
-
attributes?: string[] | undefined;
|
|
451
|
-
orders?: string[] | undefined;
|
|
452
|
-
$createdAt?: string | undefined;
|
|
453
|
-
$updatedAt?: string | undefined;
|
|
454
|
-
error?: string | undefined;
|
|
455
|
-
xdefault?: boolean | null | undefined;
|
|
456
|
-
} | {
|
|
457
|
-
key: string;
|
|
458
|
-
required: boolean;
|
|
459
|
-
type: "datetime";
|
|
460
|
-
array?: boolean | undefined;
|
|
461
|
-
format?: string | undefined;
|
|
462
|
-
status?: string | undefined;
|
|
463
|
-
attributes?: string[] | undefined;
|
|
464
|
-
orders?: string[] | undefined;
|
|
465
|
-
$createdAt?: string | undefined;
|
|
466
|
-
$updatedAt?: string | undefined;
|
|
467
|
-
error?: string | undefined;
|
|
468
|
-
xdefault?: string | null | undefined;
|
|
469
|
-
} | {
|
|
470
|
-
key: string;
|
|
471
|
-
required: boolean;
|
|
472
|
-
type: "email";
|
|
473
|
-
array?: boolean | undefined;
|
|
474
|
-
format?: string | undefined;
|
|
475
|
-
status?: string | undefined;
|
|
476
|
-
attributes?: string[] | undefined;
|
|
477
|
-
orders?: string[] | undefined;
|
|
478
|
-
$createdAt?: string | undefined;
|
|
479
|
-
$updatedAt?: string | undefined;
|
|
480
|
-
error?: string | undefined;
|
|
481
|
-
xdefault?: string | null | undefined;
|
|
482
|
-
} | {
|
|
483
|
-
key: string;
|
|
484
|
-
required: boolean;
|
|
485
|
-
type: "ip";
|
|
486
|
-
array?: boolean | undefined;
|
|
487
|
-
format?: string | undefined;
|
|
488
|
-
status?: string | undefined;
|
|
489
|
-
attributes?: string[] | undefined;
|
|
490
|
-
orders?: string[] | undefined;
|
|
491
|
-
$createdAt?: string | undefined;
|
|
492
|
-
$updatedAt?: string | undefined;
|
|
493
|
-
error?: string | undefined;
|
|
494
|
-
xdefault?: string | null | undefined;
|
|
495
|
-
} | {
|
|
496
|
-
key: string;
|
|
497
|
-
required: boolean;
|
|
498
|
-
type: "url";
|
|
499
|
-
array?: boolean | undefined;
|
|
500
|
-
format?: string | undefined;
|
|
501
|
-
status?: string | undefined;
|
|
502
|
-
attributes?: string[] | undefined;
|
|
503
|
-
orders?: string[] | undefined;
|
|
504
|
-
$createdAt?: string | undefined;
|
|
505
|
-
$updatedAt?: string | undefined;
|
|
506
|
-
error?: string | undefined;
|
|
507
|
-
xdefault?: string | null | undefined;
|
|
508
|
-
} | {
|
|
509
|
-
key: string;
|
|
510
|
-
required: boolean;
|
|
511
|
-
type: "enum";
|
|
512
|
-
elements: string[];
|
|
513
|
-
array?: boolean | undefined;
|
|
514
|
-
format?: string | undefined;
|
|
515
|
-
status?: string | undefined;
|
|
516
|
-
attributes?: string[] | undefined;
|
|
517
|
-
orders?: string[] | undefined;
|
|
518
|
-
$createdAt?: string | undefined;
|
|
519
|
-
$updatedAt?: string | undefined;
|
|
520
|
-
error?: string | undefined;
|
|
521
|
-
xdefault?: string | null | undefined;
|
|
522
|
-
} | {
|
|
523
|
-
key: string;
|
|
524
|
-
required: boolean;
|
|
525
|
-
type: "relationship";
|
|
526
|
-
relatedCollection: string;
|
|
527
|
-
relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
|
|
528
|
-
twoWay: boolean;
|
|
529
|
-
onDelete: "setNull" | "cascade" | "restrict";
|
|
530
|
-
array?: boolean | undefined;
|
|
531
|
-
format?: string | undefined;
|
|
532
|
-
status?: string | undefined;
|
|
533
|
-
attributes?: string[] | undefined;
|
|
534
|
-
orders?: string[] | undefined;
|
|
535
|
-
$createdAt?: string | undefined;
|
|
536
|
-
$updatedAt?: string | undefined;
|
|
537
|
-
error?: string | undefined;
|
|
538
|
-
twoWayKey?: string | undefined;
|
|
539
|
-
side?: "parent" | "child" | undefined;
|
|
540
|
-
importMapping?: {
|
|
541
|
-
originalIdField: string;
|
|
542
|
-
targetField?: string | undefined;
|
|
543
|
-
} | undefined;
|
|
544
|
-
})[];
|
|
545
|
-
$permissions: {
|
|
546
|
-
permission: string;
|
|
547
|
-
target: string;
|
|
548
|
-
}[];
|
|
549
|
-
indexes: {
|
|
550
|
-
key: string;
|
|
551
|
-
type: "key" | "unique" | "fulltext";
|
|
552
|
-
attributes: string[];
|
|
553
|
-
status?: string | undefined;
|
|
554
|
-
error?: string | undefined;
|
|
555
|
-
orders?: string[] | undefined;
|
|
556
|
-
}[];
|
|
557
|
-
importDefs: {
|
|
558
|
-
filePath: string;
|
|
559
|
-
primaryKeyField: string;
|
|
560
|
-
attributeMappings: {
|
|
561
|
-
targetKey: string;
|
|
562
|
-
oldKey?: string | undefined;
|
|
563
|
-
oldKeys?: string[] | undefined;
|
|
564
|
-
valueToSet?: any;
|
|
565
|
-
fileData?: {
|
|
566
|
-
name: string;
|
|
567
|
-
path: string;
|
|
568
|
-
} | undefined;
|
|
569
|
-
converters?: string[] | undefined;
|
|
570
|
-
validationActions?: {
|
|
571
|
-
action: string;
|
|
572
|
-
params: string[];
|
|
573
|
-
}[] | undefined;
|
|
574
|
-
postImportActions?: {
|
|
575
|
-
action: string;
|
|
576
|
-
params: (string | Record<string, any>)[];
|
|
577
|
-
}[] | undefined;
|
|
578
|
-
}[];
|
|
579
|
-
type?: "create" | "update" | undefined;
|
|
580
|
-
basePath?: string | undefined;
|
|
581
|
-
idMappings?: {
|
|
582
|
-
sourceField: string;
|
|
583
|
-
targetField: string;
|
|
584
|
-
targetCollection: string;
|
|
585
|
-
fieldToSet?: string | undefined;
|
|
586
|
-
targetFieldToMatch?: string | undefined;
|
|
587
|
-
}[] | undefined;
|
|
588
|
-
createUsers?: boolean | null | undefined;
|
|
589
|
-
updateMapping?: {
|
|
590
|
-
originalIdField: string;
|
|
591
|
-
targetField: string;
|
|
592
|
-
} | undefined;
|
|
593
|
-
}[];
|
|
594
|
-
$id?: string | undefined;
|
|
595
|
-
enabled?: boolean | undefined;
|
|
596
|
-
documentSecurity?: boolean | undefined;
|
|
597
|
-
databaseId?: string | undefined;
|
|
598
|
-
databaseIds?: string[] | undefined;
|
|
599
|
-
} | undefined;
|
|
600
|
-
}>;
|
|
601
|
-
private oldIdToNewIdPerCollectionMap;
|
|
602
|
-
collectionImportOperations: Map<string, string>;
|
|
603
|
-
private mergedUserMap;
|
|
604
|
-
private emailToUserIdMap;
|
|
605
|
-
private phoneToUserIdMap;
|
|
606
|
-
private userIdSet;
|
|
607
|
-
userExistsMap: Map<string, boolean>;
|
|
608
|
-
private shouldWriteFile;
|
|
609
|
-
constructor(appwriteFolderPath: string, importDataActions: ImportDataActions, database: Databases, config: AppwriteConfig, shouldWriteFile?: boolean);
|
|
610
|
-
getCollectionKey(name: string): string;
|
|
611
|
-
/**
|
|
612
|
-
* Merges two objects by updating the source object with the target object's values.
|
|
613
|
-
* It iterates through the target object's keys and updates the source object if:
|
|
614
|
-
* - The source object has the key.
|
|
615
|
-
* - The target object's value for that key is not null, undefined, or an empty string.
|
|
616
|
-
* - If the target object has an array value, it concatenates the values and removes duplicates.
|
|
617
|
-
*
|
|
618
|
-
* @param source - The source object to be updated.
|
|
619
|
-
* @param target - The target object with values to update the source object.
|
|
620
|
-
* @returns The updated source object.
|
|
621
|
-
*/
|
|
622
|
-
mergeObjects(source: any, update: any): any;
|
|
623
|
-
loadData(importDef: ImportDef): any[];
|
|
624
|
-
checkMapValuesForId(newId: string, collectionName: string): string | false;
|
|
625
|
-
getTrueUniqueId(collectionName: string): string;
|
|
626
|
-
createContext(db: ConfigDatabase, collection: CollectionCreate, item: any, docId: string): any;
|
|
627
|
-
/**
|
|
628
|
-
* Transforms the given item based on the provided attribute mappings.
|
|
629
|
-
* This method applies conversion rules to the item's attributes as defined in the attribute mappings.
|
|
630
|
-
*
|
|
631
|
-
* @param item - The item to be transformed.
|
|
632
|
-
* @param attributeMappings - The mappings that define how each attribute should be transformed.
|
|
633
|
-
* @returns The transformed item.
|
|
634
|
-
*/
|
|
635
|
-
transformData(item: any, attributeMappings: AttributeMappings): any;
|
|
636
|
-
setupMaps(dbId: string): Promise<void>;
|
|
637
|
-
getAllUsers(): Promise<import("node-appwrite").Models.User<import("node-appwrite").Models.Preferences>[]>;
|
|
638
|
-
start(dbId: string): Promise<void>;
|
|
639
|
-
/**
|
|
640
|
-
* Deals with merged users by iterating through all collections in the configuration.
|
|
641
|
-
* We have merged users if there are duplicate emails or phones in the import data.
|
|
642
|
-
* This function will iterate through all collections that are the same name as the
|
|
643
|
-
* users collection and pull out their primaryKeyField's. It will then loop through
|
|
644
|
-
* each collection and find any documents that have a
|
|
645
|
-
*
|
|
646
|
-
* @return {void} This function does not return anything.
|
|
647
|
-
*/
|
|
648
|
-
/**
|
|
649
|
-
* Gets the value to match for a given key in the final data or context.
|
|
650
|
-
* @param finalData - The final data object.
|
|
651
|
-
* @param context - The context object.
|
|
652
|
-
* @param key - The key to get the value for.
|
|
653
|
-
* @returns The value to match for from finalData or Context
|
|
654
|
-
*/
|
|
655
|
-
getValueFromData(finalData: any, context: any, key: string): any;
|
|
656
|
-
updateOldReferencesForNew(): void;
|
|
657
|
-
private writeMapsToJsonFile;
|
|
658
|
-
/**
|
|
659
|
-
* Prepares user data by checking for duplicates based on email or phone, adding to a duplicate map if found,
|
|
660
|
-
* and then returning the transformed item without user-specific keys.
|
|
661
|
-
*
|
|
662
|
-
* @param item - The raw item to be processed.
|
|
663
|
-
* @param attributeMappings - The attribute mappings for the item.
|
|
664
|
-
* @returns The transformed item with user-specific keys removed.
|
|
665
|
-
*/
|
|
666
|
-
prepareUserData(item: any, attributeMappings: AttributeMappings, primaryKeyField: string, newId: string): {
|
|
667
|
-
transformedItem: any;
|
|
668
|
-
existingId: string | undefined;
|
|
669
|
-
userData: {
|
|
670
|
-
rawData: any;
|
|
671
|
-
finalData: z.infer<typeof AuthUserCreateSchema>;
|
|
672
|
-
};
|
|
673
|
-
};
|
|
674
|
-
/**
|
|
675
|
-
* Prepares the data for creating user collection documents.
|
|
676
|
-
* This involves loading the data, transforming it according to the import definition,
|
|
677
|
-
* and handling the creation of new unique IDs for each item.
|
|
678
|
-
*
|
|
679
|
-
* @param db - The database configuration.
|
|
680
|
-
* @param collection - The collection configuration.
|
|
681
|
-
* @param importDef - The import definition containing the attribute mappings and other relevant info.
|
|
682
|
-
*/
|
|
683
|
-
prepareUserCollectionCreateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
|
|
684
|
-
/**
|
|
685
|
-
* Prepares the data for creating documents in a collection.
|
|
686
|
-
* This involves loading the data, transforming it, and handling ID mappings.
|
|
687
|
-
*
|
|
688
|
-
* @param db - The database configuration.
|
|
689
|
-
* @param collection - The collection configuration.
|
|
690
|
-
* @param importDef - The import definition containing the attribute mappings and other relevant info.
|
|
691
|
-
*/
|
|
692
|
-
prepareCreateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
|
|
693
|
-
/**
|
|
694
|
-
* Prepares the data for updating documents within a collection.
|
|
695
|
-
* This method loads the raw data based on the import definition, transforms it according to the attribute mappings,
|
|
696
|
-
* finds the new ID for each item based on the primary key or update mapping, and then validates the transformed data.
|
|
697
|
-
* If the data is valid, it updates the import definition with any post-import actions and adds the item to the current collection data.
|
|
698
|
-
*
|
|
699
|
-
* @param db - The database configuration.
|
|
700
|
-
* @param collection - The collection configuration.
|
|
701
|
-
* @param importDef - The import definition containing the attribute mappings and other relevant info.
|
|
702
|
-
*/
|
|
703
|
-
prepareUpdateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
|
|
704
|
-
private updateReferencesBasedOnAttributeMappings;
|
|
705
|
-
private getMergedId;
|
|
706
|
-
/**
|
|
707
|
-
* Generates attribute mappings with post-import actions based on the provided attribute mappings.
|
|
708
|
-
* This method checks each mapping for a fileData attribute and adds a post-import action to create a file
|
|
709
|
-
* and update the field with the file's ID if necessary.
|
|
710
|
-
*
|
|
711
|
-
* @param attributeMappings - The attribute mappings from the import definition.
|
|
712
|
-
* @param context - The context object containing information about the database, collection, and document.
|
|
713
|
-
* @param item - The item being imported, used for resolving template paths in fileData mappings.
|
|
714
|
-
* @returns The attribute mappings updated with any necessary post-import actions.
|
|
715
|
-
*/
|
|
716
|
-
getAttributeMappingsWithActions(attributeMappings: AttributeMappings, context: any, item: any): ({
|
|
717
|
-
targetKey: string;
|
|
718
|
-
oldKey?: string | undefined;
|
|
719
|
-
oldKeys?: string[] | undefined;
|
|
720
|
-
valueToSet?: any;
|
|
721
|
-
fileData?: {
|
|
722
|
-
name: string;
|
|
723
|
-
path: string;
|
|
724
|
-
} | undefined;
|
|
725
|
-
converters?: string[] | undefined;
|
|
726
|
-
validationActions?: {
|
|
727
|
-
action: string;
|
|
728
|
-
params: string[];
|
|
729
|
-
}[] | undefined;
|
|
730
|
-
postImportActions?: {
|
|
731
|
-
action: string;
|
|
732
|
-
params: (string | Record<string, any>)[];
|
|
733
|
-
}[] | undefined;
|
|
734
|
-
} | {
|
|
735
|
-
postImportActions: {
|
|
736
|
-
action: string;
|
|
737
|
-
params: any[];
|
|
738
|
-
}[];
|
|
739
|
-
targetKey: string;
|
|
740
|
-
oldKey?: string | undefined;
|
|
741
|
-
oldKeys?: string[] | undefined;
|
|
742
|
-
valueToSet?: any;
|
|
743
|
-
fileData?: {
|
|
744
|
-
name: string;
|
|
745
|
-
path: string;
|
|
746
|
-
} | undefined;
|
|
747
|
-
converters?: string[] | undefined;
|
|
748
|
-
validationActions?: {
|
|
749
|
-
action: string;
|
|
750
|
-
params: string[];
|
|
751
|
-
}[] | undefined;
|
|
752
|
-
})[];
|
|
753
|
-
}
|