@njdamstra/appwrite-utils-cli 1.8.9
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/CHANGELOG.md +19 -0
- package/README.md +1133 -0
- package/dist/adapters/AdapterFactory.d.ts +94 -0
- package/dist/adapters/AdapterFactory.js +405 -0
- package/dist/adapters/DatabaseAdapter.d.ts +233 -0
- package/dist/adapters/DatabaseAdapter.js +50 -0
- package/dist/adapters/LegacyAdapter.d.ts +50 -0
- package/dist/adapters/LegacyAdapter.js +612 -0
- package/dist/adapters/TablesDBAdapter.d.ts +45 -0
- package/dist/adapters/TablesDBAdapter.js +571 -0
- package/dist/adapters/index.d.ts +11 -0
- package/dist/adapters/index.js +12 -0
- package/dist/backups/operations/bucketBackup.d.ts +19 -0
- package/dist/backups/operations/bucketBackup.js +197 -0
- package/dist/backups/operations/collectionBackup.d.ts +30 -0
- package/dist/backups/operations/collectionBackup.js +201 -0
- package/dist/backups/operations/comprehensiveBackup.d.ts +25 -0
- package/dist/backups/operations/comprehensiveBackup.js +238 -0
- package/dist/backups/schemas/bucketManifest.d.ts +93 -0
- package/dist/backups/schemas/bucketManifest.js +33 -0
- package/dist/backups/schemas/comprehensiveManifest.d.ts +108 -0
- package/dist/backups/schemas/comprehensiveManifest.js +32 -0
- package/dist/backups/tracking/centralizedTracking.d.ts +34 -0
- package/dist/backups/tracking/centralizedTracking.js +274 -0
- package/dist/cli/commands/configCommands.d.ts +8 -0
- package/dist/cli/commands/configCommands.js +166 -0
- package/dist/cli/commands/databaseCommands.d.ts +13 -0
- package/dist/cli/commands/databaseCommands.js +554 -0
- package/dist/cli/commands/functionCommands.d.ts +7 -0
- package/dist/cli/commands/functionCommands.js +330 -0
- package/dist/cli/commands/schemaCommands.d.ts +7 -0
- package/dist/cli/commands/schemaCommands.js +169 -0
- package/dist/cli/commands/storageCommands.d.ts +5 -0
- package/dist/cli/commands/storageCommands.js +143 -0
- package/dist/cli/commands/transferCommands.d.ts +5 -0
- package/dist/cli/commands/transferCommands.js +384 -0
- package/dist/collections/attributes.d.ts +13 -0
- package/dist/collections/attributes.js +1364 -0
- package/dist/collections/indexes.d.ts +12 -0
- package/dist/collections/indexes.js +217 -0
- package/dist/collections/methods.d.ts +19 -0
- package/dist/collections/methods.js +682 -0
- package/dist/collections/tableOperations.d.ts +86 -0
- package/dist/collections/tableOperations.js +434 -0
- package/dist/collections/transferOperations.d.ts +8 -0
- package/dist/collections/transferOperations.js +412 -0
- package/dist/collections/wipeOperations.d.ts +16 -0
- package/dist/collections/wipeOperations.js +233 -0
- package/dist/config/ConfigManager.d.ts +445 -0
- package/dist/config/ConfigManager.js +625 -0
- package/dist/config/configMigration.d.ts +87 -0
- package/dist/config/configMigration.js +390 -0
- package/dist/config/configValidation.d.ts +66 -0
- package/dist/config/configValidation.js +358 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.js +7 -0
- package/dist/config/services/ConfigDiscoveryService.d.ts +126 -0
- package/dist/config/services/ConfigDiscoveryService.js +374 -0
- package/dist/config/services/ConfigLoaderService.d.ts +129 -0
- package/dist/config/services/ConfigLoaderService.js +540 -0
- package/dist/config/services/ConfigMergeService.d.ts +208 -0
- package/dist/config/services/ConfigMergeService.js +308 -0
- package/dist/config/services/ConfigValidationService.d.ts +214 -0
- package/dist/config/services/ConfigValidationService.js +310 -0
- package/dist/config/services/SessionAuthService.d.ts +225 -0
- package/dist/config/services/SessionAuthService.js +456 -0
- package/dist/config/services/__tests__/ConfigMergeService.test.d.ts +1 -0
- package/dist/config/services/__tests__/ConfigMergeService.test.js +271 -0
- package/dist/config/services/index.d.ts +13 -0
- package/dist/config/services/index.js +10 -0
- package/dist/config/yamlConfig.d.ts +722 -0
- package/dist/config/yamlConfig.js +702 -0
- package/dist/databases/methods.d.ts +6 -0
- package/dist/databases/methods.js +35 -0
- package/dist/databases/setup.d.ts +5 -0
- package/dist/databases/setup.js +45 -0
- package/dist/examples/yamlTerminologyExample.d.ts +42 -0
- package/dist/examples/yamlTerminologyExample.js +272 -0
- package/dist/functions/deployments.d.ts +4 -0
- package/dist/functions/deployments.js +146 -0
- package/dist/functions/fnConfigDiscovery.d.ts +3 -0
- package/dist/functions/fnConfigDiscovery.js +108 -0
- package/dist/functions/methods.d.ts +16 -0
- package/dist/functions/methods.js +162 -0
- package/dist/functions/pathResolution.d.ts +37 -0
- package/dist/functions/pathResolution.js +185 -0
- package/dist/functions/templates/count-docs-in-collection/README.md +54 -0
- package/dist/functions/templates/count-docs-in-collection/src/main.ts +159 -0
- package/dist/functions/templates/count-docs-in-collection/src/request.ts +9 -0
- package/dist/functions/templates/hono-typescript/README.md +286 -0
- package/dist/functions/templates/hono-typescript/src/adapters/request.ts +74 -0
- package/dist/functions/templates/hono-typescript/src/adapters/response.ts +106 -0
- package/dist/functions/templates/hono-typescript/src/app.ts +180 -0
- package/dist/functions/templates/hono-typescript/src/context.ts +103 -0
- package/dist/functions/templates/hono-typescript/src/index.ts +54 -0
- package/dist/functions/templates/hono-typescript/src/middleware/appwrite.ts +119 -0
- package/dist/functions/templates/typescript-node/README.md +32 -0
- package/dist/functions/templates/typescript-node/src/context.ts +103 -0
- package/dist/functions/templates/typescript-node/src/index.ts +29 -0
- package/dist/functions/templates/uv/README.md +31 -0
- package/dist/functions/templates/uv/pyproject.toml +30 -0
- package/dist/functions/templates/uv/src/__init__.py +0 -0
- package/dist/functions/templates/uv/src/context.py +125 -0
- package/dist/functions/templates/uv/src/index.py +46 -0
- package/dist/init.d.ts +2 -0
- package/dist/init.js +57 -0
- package/dist/interactiveCLI.d.ts +31 -0
- package/dist/interactiveCLI.js +898 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +1172 -0
- package/dist/migrations/afterImportActions.d.ts +17 -0
- package/dist/migrations/afterImportActions.js +306 -0
- package/dist/migrations/appwriteToX.d.ts +211 -0
- package/dist/migrations/appwriteToX.js +491 -0
- package/dist/migrations/comprehensiveTransfer.d.ts +147 -0
- package/dist/migrations/comprehensiveTransfer.js +1317 -0
- package/dist/migrations/dataLoader.d.ts +753 -0
- package/dist/migrations/dataLoader.js +1250 -0
- package/dist/migrations/importController.d.ts +23 -0
- package/dist/migrations/importController.js +268 -0
- package/dist/migrations/importDataActions.d.ts +50 -0
- package/dist/migrations/importDataActions.js +230 -0
- package/dist/migrations/relationships.d.ts +29 -0
- package/dist/migrations/relationships.js +204 -0
- package/dist/migrations/services/DataTransformationService.d.ts +55 -0
- package/dist/migrations/services/DataTransformationService.js +158 -0
- package/dist/migrations/services/FileHandlerService.d.ts +75 -0
- package/dist/migrations/services/FileHandlerService.js +236 -0
- package/dist/migrations/services/ImportOrchestrator.d.ts +97 -0
- package/dist/migrations/services/ImportOrchestrator.js +485 -0
- package/dist/migrations/services/RateLimitManager.d.ts +138 -0
- package/dist/migrations/services/RateLimitManager.js +279 -0
- package/dist/migrations/services/RelationshipResolver.d.ts +120 -0
- package/dist/migrations/services/RelationshipResolver.js +332 -0
- package/dist/migrations/services/UserMappingService.d.ts +109 -0
- package/dist/migrations/services/UserMappingService.js +277 -0
- package/dist/migrations/services/ValidationService.d.ts +74 -0
- package/dist/migrations/services/ValidationService.js +260 -0
- package/dist/migrations/transfer.d.ts +26 -0
- package/dist/migrations/transfer.js +608 -0
- package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +131 -0
- package/dist/migrations/yaml/YamlImportConfigLoader.js +383 -0
- package/dist/migrations/yaml/YamlImportIntegration.d.ts +93 -0
- package/dist/migrations/yaml/YamlImportIntegration.js +341 -0
- package/dist/migrations/yaml/generateImportSchemas.d.ts +30 -0
- package/dist/migrations/yaml/generateImportSchemas.js +1327 -0
- package/dist/schemas/authUser.d.ts +24 -0
- package/dist/schemas/authUser.js +17 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +5 -0
- package/dist/setupCommands.d.ts +58 -0
- package/dist/setupCommands.js +490 -0
- package/dist/setupController.d.ts +9 -0
- package/dist/setupController.js +34 -0
- package/dist/shared/attributeMapper.d.ts +20 -0
- package/dist/shared/attributeMapper.js +203 -0
- package/dist/shared/backupMetadataSchema.d.ts +94 -0
- package/dist/shared/backupMetadataSchema.js +38 -0
- package/dist/shared/backupTracking.d.ts +18 -0
- package/dist/shared/backupTracking.js +176 -0
- package/dist/shared/confirmationDialogs.d.ts +75 -0
- package/dist/shared/confirmationDialogs.js +236 -0
- package/dist/shared/errorUtils.d.ts +54 -0
- package/dist/shared/errorUtils.js +95 -0
- package/dist/shared/functionManager.d.ts +48 -0
- package/dist/shared/functionManager.js +336 -0
- package/dist/shared/indexManager.d.ts +24 -0
- package/dist/shared/indexManager.js +151 -0
- package/dist/shared/jsonSchemaGenerator.d.ts +50 -0
- package/dist/shared/jsonSchemaGenerator.js +290 -0
- package/dist/shared/logging.d.ts +61 -0
- package/dist/shared/logging.js +116 -0
- package/dist/shared/messageFormatter.d.ts +39 -0
- package/dist/shared/messageFormatter.js +162 -0
- package/dist/shared/migrationHelpers.d.ts +61 -0
- package/dist/shared/migrationHelpers.js +145 -0
- package/dist/shared/operationLogger.d.ts +10 -0
- package/dist/shared/operationLogger.js +12 -0
- package/dist/shared/operationQueue.d.ts +40 -0
- package/dist/shared/operationQueue.js +311 -0
- package/dist/shared/operationsTable.d.ts +26 -0
- package/dist/shared/operationsTable.js +286 -0
- package/dist/shared/operationsTableSchema.d.ts +48 -0
- package/dist/shared/operationsTableSchema.js +35 -0
- package/dist/shared/progressManager.d.ts +62 -0
- package/dist/shared/progressManager.js +215 -0
- package/dist/shared/pydanticModelGenerator.d.ts +17 -0
- package/dist/shared/pydanticModelGenerator.js +615 -0
- package/dist/shared/relationshipExtractor.d.ts +56 -0
- package/dist/shared/relationshipExtractor.js +138 -0
- package/dist/shared/schemaGenerator.d.ts +40 -0
- package/dist/shared/schemaGenerator.js +556 -0
- package/dist/shared/selectionDialogs.d.ts +214 -0
- package/dist/shared/selectionDialogs.js +544 -0
- package/dist/storage/backupCompression.d.ts +20 -0
- package/dist/storage/backupCompression.js +67 -0
- package/dist/storage/methods.d.ts +32 -0
- package/dist/storage/methods.js +472 -0
- package/dist/storage/schemas.d.ts +842 -0
- package/dist/storage/schemas.js +175 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +3 -0
- package/dist/users/methods.d.ts +16 -0
- package/dist/users/methods.js +277 -0
- package/dist/utils/ClientFactory.d.ts +87 -0
- package/dist/utils/ClientFactory.js +212 -0
- package/dist/utils/configDiscovery.d.ts +78 -0
- package/dist/utils/configDiscovery.js +472 -0
- package/dist/utils/configMigration.d.ts +1 -0
- package/dist/utils/configMigration.js +261 -0
- package/dist/utils/constantsGenerator.d.ts +31 -0
- package/dist/utils/constantsGenerator.js +321 -0
- package/dist/utils/dataConverters.d.ts +46 -0
- package/dist/utils/dataConverters.js +139 -0
- package/dist/utils/directoryUtils.d.ts +22 -0
- package/dist/utils/directoryUtils.js +59 -0
- package/dist/utils/getClientFromConfig.d.ts +39 -0
- package/dist/utils/getClientFromConfig.js +199 -0
- package/dist/utils/helperFunctions.d.ts +63 -0
- package/dist/utils/helperFunctions.js +156 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/loadConfigs.d.ts +50 -0
- package/dist/utils/loadConfigs.js +358 -0
- package/dist/utils/pathResolvers.d.ts +53 -0
- package/dist/utils/pathResolvers.js +72 -0
- package/dist/utils/projectConfig.d.ts +119 -0
- package/dist/utils/projectConfig.js +171 -0
- package/dist/utils/retryFailedPromises.d.ts +2 -0
- package/dist/utils/retryFailedPromises.js +23 -0
- package/dist/utils/sessionAuth.d.ts +48 -0
- package/dist/utils/sessionAuth.js +164 -0
- package/dist/utils/setupFiles.d.ts +4 -0
- package/dist/utils/setupFiles.js +1192 -0
- package/dist/utils/typeGuards.d.ts +35 -0
- package/dist/utils/typeGuards.js +57 -0
- package/dist/utils/validationRules.d.ts +43 -0
- package/dist/utils/validationRules.js +42 -0
- package/dist/utils/versionDetection.d.ts +58 -0
- package/dist/utils/versionDetection.js +251 -0
- package/dist/utils/yamlConverter.d.ts +100 -0
- package/dist/utils/yamlConverter.js +428 -0
- package/dist/utils/yamlLoader.d.ts +70 -0
- package/dist/utils/yamlLoader.js +267 -0
- package/dist/utilsController.d.ts +106 -0
- package/dist/utilsController.js +863 -0
- package/package.json +75 -0
- package/scripts/copy-templates.ts +23 -0
- package/src/adapters/AdapterFactory.ts +510 -0
- package/src/adapters/DatabaseAdapter.ts +306 -0
- package/src/adapters/LegacyAdapter.ts +841 -0
- package/src/adapters/TablesDBAdapter.ts +773 -0
- package/src/adapters/index.ts +37 -0
- package/src/backups/operations/bucketBackup.ts +277 -0
- package/src/backups/operations/collectionBackup.ts +310 -0
- package/src/backups/operations/comprehensiveBackup.ts +342 -0
- package/src/backups/schemas/bucketManifest.ts +78 -0
- package/src/backups/schemas/comprehensiveManifest.ts +76 -0
- package/src/backups/tracking/centralizedTracking.ts +352 -0
- package/src/cli/commands/configCommands.ts +201 -0
- package/src/cli/commands/databaseCommands.ts +749 -0
- package/src/cli/commands/functionCommands.ts +418 -0
- package/src/cli/commands/schemaCommands.ts +200 -0
- package/src/cli/commands/storageCommands.ts +152 -0
- package/src/cli/commands/transferCommands.ts +457 -0
- package/src/collections/attributes.ts +2054 -0
- package/src/collections/attributes.ts.backup +1555 -0
- package/src/collections/indexes.ts +352 -0
- package/src/collections/methods.ts +745 -0
- package/src/collections/tableOperations.ts +506 -0
- package/src/collections/transferOperations.ts +590 -0
- package/src/collections/wipeOperations.ts +346 -0
- package/src/config/ConfigManager.ts +808 -0
- package/src/config/README.md +274 -0
- package/src/config/configMigration.ts +575 -0
- package/src/config/configValidation.ts +445 -0
- package/src/config/index.ts +10 -0
- package/src/config/services/ConfigDiscoveryService.ts +463 -0
- package/src/config/services/ConfigLoaderService.ts +740 -0
- package/src/config/services/ConfigMergeService.ts +388 -0
- package/src/config/services/ConfigValidationService.ts +394 -0
- package/src/config/services/SessionAuthService.ts +565 -0
- package/src/config/services/__tests__/ConfigMergeService.test.ts +351 -0
- package/src/config/services/index.ts +29 -0
- package/src/config/yamlConfig.ts +761 -0
- package/src/databases/methods.ts +49 -0
- package/src/databases/setup.ts +77 -0
- package/src/examples/yamlTerminologyExample.ts +346 -0
- package/src/functions/deployments.ts +220 -0
- package/src/functions/fnConfigDiscovery.ts +103 -0
- package/src/functions/methods.ts +271 -0
- package/src/functions/pathResolution.ts +227 -0
- package/src/functions/templates/count-docs-in-collection/README.md +54 -0
- package/src/functions/templates/count-docs-in-collection/src/main.ts +159 -0
- package/src/functions/templates/count-docs-in-collection/src/request.ts +9 -0
- package/src/functions/templates/hono-typescript/README.md +286 -0
- package/src/functions/templates/hono-typescript/src/adapters/request.ts +74 -0
- package/src/functions/templates/hono-typescript/src/adapters/response.ts +106 -0
- package/src/functions/templates/hono-typescript/src/app.ts +180 -0
- package/src/functions/templates/hono-typescript/src/context.ts +103 -0
- package/src/functions/templates/hono-typescript/src/index.ts +54 -0
- package/src/functions/templates/hono-typescript/src/middleware/appwrite.ts +119 -0
- package/src/functions/templates/typescript-node/README.md +32 -0
- package/src/functions/templates/typescript-node/src/context.ts +103 -0
- package/src/functions/templates/typescript-node/src/index.ts +29 -0
- package/src/functions/templates/uv/README.md +31 -0
- package/src/functions/templates/uv/pyproject.toml +30 -0
- package/src/functions/templates/uv/src/__init__.py +0 -0
- package/src/functions/templates/uv/src/context.py +125 -0
- package/src/functions/templates/uv/src/index.py +46 -0
- package/src/init.ts +62 -0
- package/src/interactiveCLI.ts +1136 -0
- package/src/main.ts +1661 -0
- package/src/migrations/afterImportActions.ts +580 -0
- package/src/migrations/appwriteToX.ts +664 -0
- package/src/migrations/comprehensiveTransfer.ts +2285 -0
- package/src/migrations/dataLoader.ts +1702 -0
- package/src/migrations/importController.ts +428 -0
- package/src/migrations/importDataActions.ts +315 -0
- package/src/migrations/relationships.ts +334 -0
- package/src/migrations/services/DataTransformationService.ts +196 -0
- package/src/migrations/services/FileHandlerService.ts +311 -0
- package/src/migrations/services/ImportOrchestrator.ts +666 -0
- package/src/migrations/services/RateLimitManager.ts +363 -0
- package/src/migrations/services/RelationshipResolver.ts +461 -0
- package/src/migrations/services/UserMappingService.ts +345 -0
- package/src/migrations/services/ValidationService.ts +349 -0
- package/src/migrations/transfer.ts +1068 -0
- package/src/migrations/yaml/YamlImportConfigLoader.ts +439 -0
- package/src/migrations/yaml/YamlImportIntegration.ts +446 -0
- package/src/migrations/yaml/generateImportSchemas.ts +1354 -0
- package/src/schemas/authUser.ts +23 -0
- package/src/setup.ts +8 -0
- package/src/setupCommands.ts +603 -0
- package/src/setupController.ts +43 -0
- package/src/shared/attributeMapper.ts +229 -0
- package/src/shared/backupMetadataSchema.ts +93 -0
- package/src/shared/backupTracking.ts +211 -0
- package/src/shared/confirmationDialogs.ts +327 -0
- package/src/shared/errorUtils.ts +110 -0
- package/src/shared/functionManager.ts +525 -0
- package/src/shared/indexManager.ts +254 -0
- package/src/shared/jsonSchemaGenerator.ts +383 -0
- package/src/shared/logging.ts +149 -0
- package/src/shared/messageFormatter.ts +208 -0
- package/src/shared/migrationHelpers.ts +232 -0
- package/src/shared/operationLogger.ts +20 -0
- package/src/shared/operationQueue.ts +377 -0
- package/src/shared/operationsTable.ts +338 -0
- package/src/shared/operationsTableSchema.ts +60 -0
- package/src/shared/progressManager.ts +278 -0
- package/src/shared/pydanticModelGenerator.ts +618 -0
- package/src/shared/relationshipExtractor.ts +214 -0
- package/src/shared/schemaGenerator.ts +644 -0
- package/src/shared/selectionDialogs.ts +749 -0
- package/src/storage/backupCompression.ts +88 -0
- package/src/storage/methods.ts +698 -0
- package/src/storage/schemas.ts +205 -0
- package/src/types/node-appwrite-tablesdb.d.ts +44 -0
- package/src/types.ts +9 -0
- package/src/users/methods.ts +359 -0
- package/src/utils/ClientFactory.ts +240 -0
- package/src/utils/configDiscovery.ts +557 -0
- package/src/utils/configMigration.ts +348 -0
- package/src/utils/constantsGenerator.ts +369 -0
- package/src/utils/dataConverters.ts +159 -0
- package/src/utils/directoryUtils.ts +61 -0
- package/src/utils/getClientFromConfig.ts +257 -0
- package/src/utils/helperFunctions.ts +228 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/loadConfigs.ts +449 -0
- package/src/utils/pathResolvers.ts +81 -0
- package/src/utils/projectConfig.ts +299 -0
- package/src/utils/retryFailedPromises.ts +29 -0
- package/src/utils/sessionAuth.ts +230 -0
- package/src/utils/setupFiles.ts +1238 -0
- package/src/utils/typeGuards.ts +65 -0
- package/src/utils/validationRules.ts +88 -0
- package/src/utils/versionDetection.ts +292 -0
- package/src/utils/yamlConverter.ts +542 -0
- package/src/utils/yamlLoader.ts +371 -0
- package/src/utilsController.ts +1203 -0
- package/tests/README.md +497 -0
- package/tests/adapters/AdapterFactory.test.ts +277 -0
- package/tests/integration/syncOperations.test.ts +463 -0
- package/tests/jest.config.js +25 -0
- package/tests/migration/configMigration.test.ts +546 -0
- package/tests/setup.ts +62 -0
- package/tests/testUtils.ts +340 -0
- package/tests/utils/loadConfigs.test.ts +350 -0
- package/tests/validation/configValidation.test.ts +412 -0
- package/tsconfig.json +44 -0
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
import type { ImportDataActions } from "./importDataActions.js";
|
|
2
|
+
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type ImportDef } from "@njdamstra/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
|
+
}
|