@njdamstra/appwrite-utils-cli 1.8.9 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/CONFIG_TODO.md +1189 -0
- package/SELECTION_DIALOGS.md +146 -0
- package/SERVICE_IMPLEMENTATION_REPORT.md +462 -0
- package/dist/adapters/index.d.ts +7 -8
- package/dist/adapters/index.js +7 -9
- package/dist/backups/operations/bucketBackup.js +2 -2
- package/dist/backups/operations/collectionBackup.d.ts +1 -1
- package/dist/backups/operations/collectionBackup.js +3 -3
- package/dist/backups/operations/comprehensiveBackup.d.ts +1 -1
- package/dist/backups/operations/comprehensiveBackup.js +2 -2
- package/dist/backups/tracking/centralizedTracking.d.ts +1 -1
- package/dist/backups/tracking/centralizedTracking.js +2 -2
- package/dist/cli/commands/configCommands.js +51 -7
- package/dist/cli/commands/databaseCommands.d.ts +1 -0
- package/dist/cli/commands/databaseCommands.js +119 -9
- package/dist/cli/commands/functionCommands.js +3 -3
- package/dist/cli/commands/importFileCommands.d.ts +7 -0
- package/dist/cli/commands/importFileCommands.js +674 -0
- package/dist/cli/commands/schemaCommands.js +3 -3
- package/dist/cli/commands/storageCommands.js +2 -3
- package/dist/cli/commands/transferCommands.js +3 -5
- package/dist/collections/attributes.d.ts +1 -1
- package/dist/collections/attributes.js +85 -35
- package/dist/collections/indexes.js +2 -4
- package/dist/collections/methods.d.ts +1 -1
- package/dist/collections/methods.js +111 -192
- package/dist/collections/tableOperations.d.ts +1 -0
- package/dist/collections/tableOperations.js +90 -23
- package/dist/collections/transferOperations.d.ts +1 -1
- package/dist/collections/transferOperations.js +3 -4
- package/dist/collections/wipeOperations.d.ts +4 -3
- package/dist/collections/wipeOperations.js +112 -39
- package/dist/databases/methods.js +2 -2
- package/dist/databases/setup.js +2 -2
- package/dist/examples/yamlTerminologyExample.js +2 -2
- package/dist/functions/deployments.d.ts +1 -1
- package/dist/functions/deployments.js +5 -5
- package/dist/functions/fnConfigDiscovery.js +2 -2
- package/dist/functions/methods.js +16 -4
- package/dist/init.js +1 -1
- package/dist/interactiveCLI.d.ts +6 -1
- package/dist/interactiveCLI.js +64 -10
- package/dist/main.js +130 -177
- package/dist/migrations/afterImportActions.js +2 -3
- package/dist/migrations/appwriteToX.d.ts +97 -1
- package/dist/migrations/appwriteToX.js +9 -7
- package/dist/migrations/comprehensiveTransfer.js +3 -5
- package/dist/migrations/dataLoader.d.ts +194 -2
- package/dist/migrations/dataLoader.js +2 -5
- package/dist/migrations/importController.js +3 -4
- package/dist/migrations/importDataActions.js +3 -3
- package/dist/migrations/relationships.js +1 -2
- package/dist/migrations/services/DataTransformationService.js +2 -2
- package/dist/migrations/services/FileHandlerService.js +1 -1
- package/dist/migrations/services/ImportOrchestrator.js +4 -4
- package/dist/migrations/services/RateLimitManager.js +1 -1
- package/dist/migrations/services/RelationshipResolver.js +1 -1
- package/dist/migrations/services/UserMappingService.js +1 -1
- package/dist/migrations/services/ValidationService.js +1 -1
- package/dist/migrations/transfer.d.ts +8 -4
- package/dist/migrations/transfer.js +106 -55
- package/dist/migrations/yaml/YamlImportConfigLoader.js +1 -1
- package/dist/migrations/yaml/YamlImportIntegration.js +2 -2
- package/dist/migrations/yaml/generateImportSchemas.js +1 -1
- package/dist/setupCommands.d.ts +1 -1
- package/dist/setupCommands.js +5 -6
- package/dist/setupController.js +1 -1
- package/dist/shared/backupTracking.d.ts +1 -1
- package/dist/shared/backupTracking.js +2 -2
- package/dist/shared/confirmationDialogs.js +1 -1
- package/dist/shared/migrationHelpers.d.ts +1 -1
- package/dist/shared/migrationHelpers.js +3 -3
- package/dist/shared/operationQueue.d.ts +1 -1
- package/dist/shared/operationQueue.js +2 -3
- package/dist/shared/operationsTable.d.ts +1 -1
- package/dist/shared/operationsTable.js +2 -2
- package/dist/shared/progressManager.js +1 -1
- package/dist/shared/selectionDialogs.js +9 -8
- package/dist/storage/methods.js +4 -4
- package/dist/storage/schemas.d.ts +386 -2
- package/dist/tables/indexManager.d.ts +65 -0
- package/dist/tables/indexManager.js +294 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/users/methods.js +2 -3
- package/dist/utils/configMigration.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/loadConfigs.d.ts +2 -2
- package/dist/utils/loadConfigs.js +6 -7
- package/dist/utils/setupFiles.js +5 -7
- package/dist/utilsController.d.ts +15 -8
- package/dist/utilsController.js +57 -28
- package/package.json +8 -4
- package/src/adapters/index.ts +8 -34
- package/src/backups/operations/bucketBackup.ts +2 -2
- package/src/backups/operations/collectionBackup.ts +4 -4
- package/src/backups/operations/comprehensiveBackup.ts +3 -3
- package/src/backups/tracking/centralizedTracking.ts +3 -3
- package/src/cli/commands/configCommands.ts +72 -8
- package/src/cli/commands/databaseCommands.ts +161 -9
- package/src/cli/commands/functionCommands.ts +4 -3
- package/src/cli/commands/importFileCommands.ts +815 -0
- package/src/cli/commands/schemaCommands.ts +3 -3
- package/src/cli/commands/storageCommands.ts +2 -3
- package/src/cli/commands/transferCommands.ts +3 -6
- package/src/collections/attributes.ts +155 -39
- package/src/collections/indexes.ts +5 -7
- package/src/collections/methods.ts +115 -150
- package/src/collections/tableOperations.ts +92 -21
- package/src/collections/transferOperations.ts +4 -5
- package/src/collections/wipeOperations.ts +154 -51
- package/src/databases/methods.ts +2 -2
- package/src/databases/setup.ts +2 -2
- package/src/examples/yamlTerminologyExample.ts +2 -2
- package/src/functions/deployments.ts +6 -5
- package/src/functions/fnConfigDiscovery.ts +2 -2
- package/src/functions/methods.ts +19 -6
- package/src/init.ts +1 -1
- package/src/interactiveCLI.ts +78 -13
- package/src/main.ts +143 -287
- package/src/migrations/afterImportActions.ts +2 -3
- package/src/migrations/appwriteToX.ts +12 -8
- package/src/migrations/comprehensiveTransfer.ts +6 -6
- package/src/migrations/dataLoader.ts +2 -5
- package/src/migrations/importController.ts +3 -4
- package/src/migrations/importDataActions.ts +3 -3
- package/src/migrations/relationships.ts +1 -2
- package/src/migrations/services/DataTransformationService.ts +2 -2
- package/src/migrations/services/FileHandlerService.ts +1 -1
- package/src/migrations/services/ImportOrchestrator.ts +4 -4
- package/src/migrations/services/RateLimitManager.ts +1 -1
- package/src/migrations/services/RelationshipResolver.ts +1 -1
- package/src/migrations/services/UserMappingService.ts +1 -1
- package/src/migrations/services/ValidationService.ts +1 -1
- package/src/migrations/transfer.ts +126 -83
- package/src/migrations/yaml/YamlImportConfigLoader.ts +1 -1
- package/src/migrations/yaml/YamlImportIntegration.ts +2 -2
- package/src/migrations/yaml/generateImportSchemas.ts +1 -1
- package/src/setupCommands.ts +5 -6
- package/src/setupController.ts +1 -1
- package/src/shared/backupTracking.ts +3 -3
- package/src/shared/confirmationDialogs.ts +1 -1
- package/src/shared/migrationHelpers.ts +4 -4
- package/src/shared/operationQueue.ts +3 -4
- package/src/shared/operationsTable.ts +3 -3
- package/src/shared/progressManager.ts +1 -1
- package/src/shared/selectionDialogs.ts +9 -8
- package/src/storage/methods.ts +4 -4
- package/src/tables/indexManager.ts +409 -0
- package/src/types.ts +2 -2
- package/src/users/methods.ts +2 -3
- package/src/utils/configMigration.ts +1 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/loadConfigs.ts +15 -7
- package/src/utils/setupFiles.ts +5 -7
- package/src/utilsController.ts +86 -32
- package/dist/adapters/AdapterFactory.d.ts +0 -94
- package/dist/adapters/AdapterFactory.js +0 -405
- package/dist/adapters/DatabaseAdapter.d.ts +0 -233
- package/dist/adapters/DatabaseAdapter.js +0 -50
- package/dist/adapters/LegacyAdapter.d.ts +0 -50
- package/dist/adapters/LegacyAdapter.js +0 -612
- package/dist/adapters/TablesDBAdapter.d.ts +0 -45
- package/dist/adapters/TablesDBAdapter.js +0 -571
- package/dist/config/ConfigManager.d.ts +0 -445
- package/dist/config/ConfigManager.js +0 -625
- 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 -126
- package/dist/config/services/ConfigDiscoveryService.js +0 -374
- package/dist/config/services/ConfigLoaderService.d.ts +0 -129
- package/dist/config/services/ConfigLoaderService.js +0 -540
- package/dist/config/services/ConfigMergeService.d.ts +0 -208
- package/dist/config/services/ConfigMergeService.js +0 -308
- package/dist/config/services/ConfigValidationService.d.ts +0 -214
- package/dist/config/services/ConfigValidationService.js +0 -310
- package/dist/config/services/SessionAuthService.d.ts +0 -225
- package/dist/config/services/SessionAuthService.js +0 -456
- package/dist/config/services/__tests__/ConfigMergeService.test.d.ts +0 -1
- package/dist/config/services/__tests__/ConfigMergeService.test.js +0 -271
- package/dist/config/services/index.d.ts +0 -13
- package/dist/config/services/index.js +0 -10
- package/dist/config/yamlConfig.d.ts +0 -722
- package/dist/config/yamlConfig.js +0 -702
- package/dist/functions/pathResolution.d.ts +0 -37
- package/dist/functions/pathResolution.js +0 -185
- package/dist/shared/attributeMapper.d.ts +0 -20
- package/dist/shared/attributeMapper.js +0 -203
- package/dist/shared/errorUtils.d.ts +0 -54
- package/dist/shared/errorUtils.js +0 -95
- package/dist/shared/functionManager.d.ts +0 -48
- package/dist/shared/functionManager.js +0 -336
- package/dist/shared/indexManager.d.ts +0 -24
- package/dist/shared/indexManager.js +0 -151
- package/dist/shared/jsonSchemaGenerator.d.ts +0 -50
- package/dist/shared/jsonSchemaGenerator.js +0 -290
- package/dist/shared/logging.d.ts +0 -61
- package/dist/shared/logging.js +0 -116
- package/dist/shared/messageFormatter.d.ts +0 -39
- package/dist/shared/messageFormatter.js +0 -162
- package/dist/shared/pydanticModelGenerator.d.ts +0 -17
- package/dist/shared/pydanticModelGenerator.js +0 -615
- package/dist/shared/schemaGenerator.d.ts +0 -40
- package/dist/shared/schemaGenerator.js +0 -556
- package/dist/utils/ClientFactory.d.ts +0 -87
- package/dist/utils/ClientFactory.js +0 -212
- package/dist/utils/configDiscovery.d.ts +0 -78
- package/dist/utils/configDiscovery.js +0 -472
- package/dist/utils/constantsGenerator.d.ts +0 -31
- package/dist/utils/constantsGenerator.js +0 -321
- package/dist/utils/dataConverters.d.ts +0 -46
- package/dist/utils/dataConverters.js +0 -139
- package/dist/utils/directoryUtils.d.ts +0 -22
- package/dist/utils/directoryUtils.js +0 -59
- package/dist/utils/getClientFromConfig.d.ts +0 -39
- package/dist/utils/getClientFromConfig.js +0 -199
- package/dist/utils/helperFunctions.d.ts +0 -63
- package/dist/utils/helperFunctions.js +0 -156
- package/dist/utils/pathResolvers.d.ts +0 -53
- package/dist/utils/pathResolvers.js +0 -72
- package/dist/utils/projectConfig.d.ts +0 -119
- package/dist/utils/projectConfig.js +0 -171
- package/dist/utils/retryFailedPromises.d.ts +0 -2
- package/dist/utils/retryFailedPromises.js +0 -23
- package/dist/utils/sessionAuth.d.ts +0 -48
- package/dist/utils/sessionAuth.js +0 -164
- package/dist/utils/typeGuards.d.ts +0 -35
- package/dist/utils/typeGuards.js +0 -57
- package/dist/utils/validationRules.d.ts +0 -43
- package/dist/utils/validationRules.js +0 -42
- package/dist/utils/versionDetection.d.ts +0 -58
- package/dist/utils/versionDetection.js +0 -251
- package/dist/utils/yamlConverter.d.ts +0 -100
- package/dist/utils/yamlConverter.js +0 -428
- package/dist/utils/yamlLoader.d.ts +0 -70
- package/dist/utils/yamlLoader.js +0 -267
- package/src/adapters/AdapterFactory.ts +0 -510
- package/src/adapters/DatabaseAdapter.ts +0 -306
- package/src/adapters/LegacyAdapter.ts +0 -841
- package/src/adapters/TablesDBAdapter.ts +0 -773
- package/src/config/ConfigManager.ts +0 -808
- 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 -463
- package/src/config/services/ConfigLoaderService.ts +0 -740
- 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/shared/attributeMapper.ts +0 -229
- package/src/shared/errorUtils.ts +0 -110
- package/src/shared/functionManager.ts +0 -525
- package/src/shared/indexManager.ts +0 -254
- 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 -299
- 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
|
@@ -14,18 +14,15 @@ import {
|
|
|
14
14
|
} from "@njdamstra/appwrite-utils";
|
|
15
15
|
import path from "path";
|
|
16
16
|
import fs from "fs";
|
|
17
|
-
import { convertObjectByAttributeMappings } from "
|
|
17
|
+
import { convertObjectByAttributeMappings } from "@njdamstra/appwrite-utils-helpers";
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
import { checkForCollection } from "../collections/methods.js";
|
|
20
20
|
import { ID, Users, type Databases } from "node-appwrite";
|
|
21
|
-
import { logger } from "
|
|
21
|
+
import { logger, LegacyAdapter, MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
22
22
|
import { findOrCreateOperation, updateOperation } from "../shared/migrationHelpers.js";
|
|
23
23
|
import { AuthUserCreateSchema } from "../schemas/authUser.js";
|
|
24
|
-
import { LegacyAdapter } from "../adapters/LegacyAdapter.js";
|
|
25
24
|
import { UsersController } from "../users/methods.js";
|
|
26
|
-
import { finalizeByAttributeMap } from "../utils/helperFunctions.js";
|
|
27
25
|
import { isEmpty } from "es-toolkit/compat";
|
|
28
|
-
import { MessageFormatter } from "../shared/messageFormatter.js";
|
|
29
26
|
|
|
30
27
|
// Define a schema for the structure of collection import data using Zod for validation
|
|
31
28
|
export const CollectionImportDataSchema = z.object({
|
|
@@ -13,13 +13,12 @@ import type {
|
|
|
13
13
|
AttributeMappings,
|
|
14
14
|
} from "@njdamstra/appwrite-utils";
|
|
15
15
|
import type { ImportDataActions } from "./importDataActions.js";
|
|
16
|
-
import { areCollectionNamesSame, tryAwaitWithRetry } from "
|
|
16
|
+
import { areCollectionNamesSame, tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
17
17
|
import type { SetupOptions } from "../utilsController.js";
|
|
18
18
|
import { resolveAndUpdateRelationships } from "./relationships.js";
|
|
19
19
|
import { UsersController } from "../users/methods.js";
|
|
20
|
-
import { logger } from "
|
|
20
|
+
import { logger, LegacyAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
21
21
|
import { updateOperation } from "../shared/migrationHelpers.js";
|
|
22
|
-
import { LegacyAdapter } from "../adapters/LegacyAdapter.js";
|
|
23
22
|
import {
|
|
24
23
|
BatchSchema,
|
|
25
24
|
OperationCreateSchema,
|
|
@@ -30,7 +29,7 @@ import {
|
|
|
30
29
|
transferDatabaseLocalToLocal,
|
|
31
30
|
transferStorageLocalToLocal,
|
|
32
31
|
} from "./transfer.js";
|
|
33
|
-
import { MessageFormatter } from "
|
|
32
|
+
import { MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
34
33
|
import { ProgressManager } from "../shared/progressManager.js";
|
|
35
34
|
|
|
36
35
|
export class ImportController {
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
type AttributeMappings,
|
|
7
7
|
} from "@njdamstra/appwrite-utils";
|
|
8
8
|
import { converterFunctions, type ConverterFunctions } from "@njdamstra/appwrite-utils";
|
|
9
|
-
import { convertObjectBySchema } from "
|
|
9
|
+
import { convertObjectBySchema } from "@njdamstra/appwrite-utils-helpers";
|
|
10
10
|
import { type AfterImportActions } from "@njdamstra/appwrite-utils";
|
|
11
11
|
import { afterImportActions } from "./afterImportActions.js";
|
|
12
|
-
import { logger } from "
|
|
13
|
-
import { tryAwaitWithRetry } from "
|
|
12
|
+
import { logger } from "@njdamstra/appwrite-utils-helpers";
|
|
13
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
14
14
|
|
|
15
15
|
export class ImportDataActions {
|
|
16
16
|
private db: Databases;
|
|
@@ -5,8 +5,7 @@ import type {
|
|
|
5
5
|
Attribute,
|
|
6
6
|
RelationshipAttribute,
|
|
7
7
|
} from "@njdamstra/appwrite-utils";
|
|
8
|
-
import { logger } from "
|
|
9
|
-
import { MessageFormatter } from "../shared/messageFormatter.js";
|
|
8
|
+
import { logger, MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Finds collections that have defined relationship attributes.
|
|
@@ -5,8 +5,8 @@ import type {
|
|
|
5
5
|
CollectionCreate,
|
|
6
6
|
} from "@njdamstra/appwrite-utils";
|
|
7
7
|
import type { ImportDataActions } from "../importDataActions.js";
|
|
8
|
-
import { convertObjectByAttributeMappings } from "
|
|
9
|
-
import { logger } from
|
|
8
|
+
import { convertObjectByAttributeMappings } from "@njdamstra/appwrite-utils-helpers";
|
|
9
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Service responsible for data transformation during import.
|
|
@@ -2,7 +2,7 @@ import path from "path";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import type { AttributeMappings, AppwriteConfig } from "@njdamstra/appwrite-utils";
|
|
4
4
|
import type { ImportDataActions } from "../importDataActions.js";
|
|
5
|
-
import { logger } from
|
|
5
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
6
6
|
import { RateLimitManager } from "./RateLimitManager.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -23,12 +23,12 @@ import { RelationshipResolver, type CollectionImportData } from "./RelationshipR
|
|
|
23
23
|
import type { ImportDataActions } from "../importDataActions.js";
|
|
24
24
|
import type { SetupOptions } from "../../utilsController.js";
|
|
25
25
|
import { UsersController } from "../../users/methods.js";
|
|
26
|
-
import { logger } from
|
|
27
|
-
import { MessageFormatter } from
|
|
26
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
27
|
+
import { MessageFormatter } from '@njdamstra/appwrite-utils-helpers';
|
|
28
28
|
import { ProgressManager } from "../../shared/progressManager.js";
|
|
29
|
-
import { tryAwaitWithRetry } from "
|
|
29
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
30
30
|
import { updateOperation, findOrCreateOperation } from "../../shared/migrationHelpers.js";
|
|
31
|
-
import { LegacyAdapter } from
|
|
31
|
+
import { LegacyAdapter } from '@njdamstra/appwrite-utils-helpers';
|
|
32
32
|
import { resolveAndUpdateRelationships } from "../relationships.js";
|
|
33
33
|
|
|
34
34
|
// Enhanced rate limiting configuration - now managed by RateLimitManager
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
AppwriteConfig,
|
|
5
5
|
CollectionCreate,
|
|
6
6
|
} from "@njdamstra/appwrite-utils";
|
|
7
|
-
import { logger } from
|
|
7
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
8
8
|
import { isEmpty } from "es-toolkit/compat";
|
|
9
9
|
import type { UserMappingService } from "./UserMappingService.js";
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
AppwriteConfig,
|
|
6
6
|
} from "@njdamstra/appwrite-utils";
|
|
7
7
|
import { AuthUserCreateSchema } from "../../schemas/authUser.js";
|
|
8
|
-
import { logger } from
|
|
8
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
9
9
|
import type { DataTransformationService } from "./DataTransformationService.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
CollectionCreate,
|
|
5
5
|
} from "@njdamstra/appwrite-utils";
|
|
6
6
|
import type { ImportDataActions } from "../importDataActions.js";
|
|
7
|
-
import { logger } from
|
|
7
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
8
8
|
import fs from "fs";
|
|
9
9
|
import path from "path";
|
|
10
10
|
|
|
@@ -9,18 +9,16 @@ import {
|
|
|
9
9
|
type Models,
|
|
10
10
|
} from "node-appwrite";
|
|
11
11
|
import { InputFile } from "node-appwrite/file";
|
|
12
|
-
import { getAppwriteClient } from "
|
|
12
|
+
import { getAppwriteClient } from "@njdamstra/appwrite-utils-helpers";
|
|
13
13
|
// Legacy attribute helpers retained only for local-to-local flows if needed
|
|
14
14
|
import { parseAttribute } from "@njdamstra/appwrite-utils";
|
|
15
15
|
import chalk from "chalk";
|
|
16
16
|
import { fetchAllCollections } from "../collections/methods.js";
|
|
17
|
-
import { MessageFormatter } from "
|
|
18
|
-
import { LegacyAdapter } from "../adapters/LegacyAdapter.js";
|
|
17
|
+
import { MessageFormatter, mapToCreateAttributeParams } from "@njdamstra/appwrite-utils-helpers";
|
|
19
18
|
import { ProgressManager } from "../shared/progressManager.js";
|
|
20
|
-
import { getClient, getAdapter } from "
|
|
19
|
+
import { getClient, getAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
21
20
|
import { diffTableColumns } from "../collections/tableOperations.js";
|
|
22
|
-
import {
|
|
23
|
-
import type { DatabaseAdapter } from "../adapters/DatabaseAdapter.js";
|
|
21
|
+
import { LegacyAdapter, type DatabaseAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
24
22
|
|
|
25
23
|
export interface TransferOptions {
|
|
26
24
|
fromDb: Models.Database | undefined;
|
|
@@ -241,99 +239,137 @@ export const transferStorageLocalToRemote = async (
|
|
|
241
239
|
// Remote document transfer functions moved to collections/methods.ts with enhanced UX
|
|
242
240
|
|
|
243
241
|
/**
|
|
244
|
-
* Transfers all collections and documents from one local database to another local database.
|
|
242
|
+
* Transfers all tables/collections and documents from one local database to another local database.
|
|
243
|
+
* Uses the DatabaseAdapter for unified TablesDB / legacy support.
|
|
245
244
|
*
|
|
246
|
-
* @param {Databases} localDb - The local database instance.
|
|
245
|
+
* @param {Databases} localDb - The local database instance (kept for signature compat).
|
|
247
246
|
* @param {string} fromDbId - The ID of the source database.
|
|
248
247
|
* @param {string} targetDbId - The ID of the target database.
|
|
248
|
+
* @param {string[]} collectionIds - Optional filter: specific table/collection IDs to transfer. undefined = all, empty array = none.
|
|
249
|
+
* @param {DatabaseAdapter} adapter - The database adapter (TablesDB or Legacy).
|
|
249
250
|
* @return {Promise<void>} A promise that resolves when the transfer is complete.
|
|
250
251
|
*/
|
|
251
252
|
export const transferDatabaseLocalToLocal = async (
|
|
252
253
|
localDb: Databases,
|
|
253
254
|
fromDbId: string,
|
|
254
|
-
targetDbId: string
|
|
255
|
+
targetDbId: string,
|
|
256
|
+
collectionIds?: string[],
|
|
257
|
+
adapter?: DatabaseAdapter
|
|
255
258
|
) => {
|
|
259
|
+
// If no adapter provided, fall back to creating a LegacyAdapter from the Databases client
|
|
260
|
+
const dbAdapter: DatabaseAdapter = adapter || new LegacyAdapter((localDb as any).client);
|
|
261
|
+
|
|
256
262
|
MessageFormatter.info(
|
|
257
|
-
`Starting database transfer from ${fromDbId} to ${targetDbId}`,
|
|
263
|
+
`Starting database transfer from ${fromDbId} to ${targetDbId} (mode: ${dbAdapter.getApiMode()})`,
|
|
258
264
|
{ prefix: "Transfer" }
|
|
259
265
|
);
|
|
260
|
-
|
|
261
|
-
|
|
266
|
+
|
|
267
|
+
// Get all tables/collections from source database via adapter
|
|
268
|
+
const sourceListRes = await dbAdapter.listTables({ databaseId: fromDbId, queries: [Query.limit(500)] });
|
|
269
|
+
let sourceTables: any[] = sourceListRes.tables || sourceListRes.collections || sourceListRes.data || [];
|
|
270
|
+
|
|
271
|
+
// Filter by collectionIds if provided (match by $id or by name)
|
|
272
|
+
if (collectionIds !== undefined) {
|
|
273
|
+
if (collectionIds.length === 0) {
|
|
274
|
+
MessageFormatter.info("No tables/collections selected for transfer, skipping.", { prefix: "Transfer" });
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const idSet = new Set(collectionIds);
|
|
278
|
+
sourceTables = sourceTables.filter((c: any) => idSet.has(c.$id) || idSet.has(c.name));
|
|
279
|
+
}
|
|
280
|
+
|
|
262
281
|
MessageFormatter.info(
|
|
263
|
-
`Found ${
|
|
282
|
+
`Found ${sourceTables.length} tables/collections in source database`,
|
|
264
283
|
{ prefix: "Transfer" }
|
|
265
284
|
);
|
|
266
285
|
|
|
267
|
-
// Process each collection
|
|
268
|
-
for (const
|
|
286
|
+
// Process each table/collection
|
|
287
|
+
for (const table of sourceTables) {
|
|
269
288
|
MessageFormatter.processing(
|
|
270
|
-
`Processing
|
|
289
|
+
`Processing table: ${table.name} (${table.$id})`,
|
|
271
290
|
{ prefix: "Transfer" }
|
|
272
291
|
);
|
|
273
292
|
|
|
274
293
|
try {
|
|
275
|
-
//
|
|
276
|
-
let
|
|
277
|
-
|
|
278
|
-
localDb.listCollections(targetDbId, [
|
|
279
|
-
Query.equal("$id", collection.$id),
|
|
280
|
-
])
|
|
281
|
-
);
|
|
294
|
+
// Check if table exists in target via adapter
|
|
295
|
+
let targetTableId = table.$id;
|
|
296
|
+
let targetTableData: any;
|
|
282
297
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
`Collection ${collection.name} exists in target database`,
|
|
287
|
-
{ prefix: "Transfer" }
|
|
288
|
-
);
|
|
298
|
+
try {
|
|
299
|
+
const existingRes = await dbAdapter.getTable({ databaseId: targetDbId, tableId: table.$id });
|
|
300
|
+
targetTableData = existingRes.data || (existingRes.tables && existingRes.tables[0]);
|
|
289
301
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
targetCollection.$permissions !== collection.$permissions ||
|
|
294
|
-
targetCollection.documentSecurity !== collection.documentSecurity ||
|
|
295
|
-
targetCollection.enabled !== collection.enabled
|
|
296
|
-
) {
|
|
297
|
-
targetCollection = await tryAwaitWithRetry(async () =>
|
|
298
|
-
localDb.updateCollection(
|
|
299
|
-
targetDbId,
|
|
300
|
-
collection.$id,
|
|
301
|
-
collection.name,
|
|
302
|
-
collection.$permissions,
|
|
303
|
-
collection.documentSecurity,
|
|
304
|
-
collection.enabled
|
|
305
|
-
)
|
|
306
|
-
);
|
|
307
|
-
MessageFormatter.success(
|
|
308
|
-
`Collection ${collection.name} updated`,
|
|
302
|
+
if (targetTableData) {
|
|
303
|
+
MessageFormatter.info(
|
|
304
|
+
`Table ${table.name} exists in target database`,
|
|
309
305
|
{ prefix: "Transfer" }
|
|
310
306
|
);
|
|
307
|
+
|
|
308
|
+
// Update table if needed
|
|
309
|
+
const securityField = table.rowSecurity ?? table.documentSecurity ?? false;
|
|
310
|
+
const targetSecurity = targetTableData.rowSecurity ?? targetTableData.documentSecurity ?? false;
|
|
311
|
+
if (
|
|
312
|
+
targetTableData.name !== table.name ||
|
|
313
|
+
JSON.stringify(targetTableData.$permissions) !== JSON.stringify(table.$permissions) ||
|
|
314
|
+
targetSecurity !== securityField ||
|
|
315
|
+
targetTableData.enabled !== table.enabled
|
|
316
|
+
) {
|
|
317
|
+
await tryAwaitWithRetry(async () =>
|
|
318
|
+
dbAdapter.updateTable({
|
|
319
|
+
databaseId: targetDbId,
|
|
320
|
+
id: table.$id,
|
|
321
|
+
name: table.name,
|
|
322
|
+
permissions: table.$permissions,
|
|
323
|
+
documentSecurity: table.documentSecurity,
|
|
324
|
+
rowSecurity: table.rowSecurity,
|
|
325
|
+
enabled: table.enabled,
|
|
326
|
+
})
|
|
327
|
+
);
|
|
328
|
+
MessageFormatter.success(
|
|
329
|
+
`Table ${table.name} updated`,
|
|
330
|
+
{ prefix: "Transfer" }
|
|
331
|
+
);
|
|
332
|
+
}
|
|
311
333
|
}
|
|
312
|
-
}
|
|
334
|
+
} catch {
|
|
335
|
+
// Table does not exist in target, create it
|
|
336
|
+
targetTableData = null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (!targetTableData) {
|
|
313
340
|
MessageFormatter.progress(
|
|
314
|
-
`Creating
|
|
341
|
+
`Creating table ${table.name} in target database...`,
|
|
315
342
|
{ prefix: "Transfer" }
|
|
316
343
|
);
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
targetDbId,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
344
|
+
const createRes = await tryAwaitWithRetry(async () =>
|
|
345
|
+
dbAdapter.createTable({
|
|
346
|
+
databaseId: targetDbId,
|
|
347
|
+
id: table.$id,
|
|
348
|
+
name: table.name,
|
|
349
|
+
permissions: table.$permissions,
|
|
350
|
+
documentSecurity: table.documentSecurity,
|
|
351
|
+
rowSecurity: table.rowSecurity,
|
|
352
|
+
enabled: table.enabled,
|
|
353
|
+
})
|
|
326
354
|
);
|
|
355
|
+
targetTableData = createRes.data || (createRes.tables && createRes.tables[0]);
|
|
327
356
|
}
|
|
328
357
|
|
|
329
|
-
// Create attributes via
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
358
|
+
// Create attributes via adapter
|
|
359
|
+
MessageFormatter.info(`Creating attributes for ${table.name} via adapter...`, { prefix: 'Transfer' });
|
|
360
|
+
|
|
361
|
+
// Fetch existing attributes in target to skip already-created ones
|
|
362
|
+
const targetTableRes = await dbAdapter.getTable({ databaseId: targetDbId, tableId: targetTableId });
|
|
363
|
+
const targetInfo = targetTableRes.data || (targetTableRes.tables && targetTableRes.tables[0]);
|
|
364
|
+
const existingAttrs = targetInfo?.attributes || targetInfo?.columns || [];
|
|
365
|
+
const existingKeys = new Set(existingAttrs.map((a: any) => a.key || a.$id));
|
|
366
|
+
|
|
367
|
+
const uniformAttrs = (table.attributes || []).map((attr: any) => parseAttribute(attr as any));
|
|
333
368
|
const nonRel = uniformAttrs.filter((a: any) => a.type !== 'relationship');
|
|
334
369
|
for (const attr of nonRel) {
|
|
335
|
-
|
|
336
|
-
|
|
370
|
+
if (existingKeys.has(attr.key)) continue;
|
|
371
|
+
const params = mapToCreateAttributeParams(attr as any, { databaseId: targetDbId, tableId: targetTableId });
|
|
372
|
+
await dbAdapter.createAttribute(params);
|
|
337
373
|
await new Promise((r) => setTimeout(r, 150));
|
|
338
374
|
}
|
|
339
375
|
|
|
@@ -343,8 +379,9 @@ export const transferDatabaseLocalToLocal = async (
|
|
|
343
379
|
let lastStatus = '';
|
|
344
380
|
while (Date.now() - start < maxWait) {
|
|
345
381
|
try {
|
|
346
|
-
const tableRes = await
|
|
347
|
-
const
|
|
382
|
+
const tableRes = await dbAdapter.getTable({ databaseId: targetDbId, tableId: targetTableId });
|
|
383
|
+
const tInfo = tableRes.data || (tableRes.tables && tableRes.tables[0]);
|
|
384
|
+
const attrs = tInfo?.attributes || tInfo?.columns || [];
|
|
348
385
|
const found = attrs.find((a: any) => a.key === attr.key);
|
|
349
386
|
if (found) {
|
|
350
387
|
if (found.status === 'available') break;
|
|
@@ -366,17 +403,18 @@ export const transferDatabaseLocalToLocal = async (
|
|
|
366
403
|
// Relationship attributes
|
|
367
404
|
const rels = uniformAttrs.filter((a: any) => a.type === 'relationship');
|
|
368
405
|
for (const attr of rels) {
|
|
369
|
-
|
|
370
|
-
|
|
406
|
+
if (existingKeys.has(attr.key)) continue;
|
|
407
|
+
const params = mapToCreateAttributeParams(attr as any, { databaseId: targetDbId, tableId: targetTableId });
|
|
408
|
+
await dbAdapter.createAttribute(params);
|
|
371
409
|
await new Promise((r) => setTimeout(r, 150));
|
|
372
410
|
}
|
|
373
411
|
|
|
374
412
|
// Handle indexes via adapter (create or update)
|
|
375
|
-
for (const idx of
|
|
413
|
+
for (const idx of (table.indexes || [])) {
|
|
376
414
|
try {
|
|
377
|
-
await
|
|
415
|
+
await dbAdapter.createIndex({
|
|
378
416
|
databaseId: targetDbId,
|
|
379
|
-
tableId:
|
|
417
|
+
tableId: targetTableId,
|
|
380
418
|
key: (idx as any).key,
|
|
381
419
|
type: (idx as any).type,
|
|
382
420
|
attributes: (idx as any).attributes,
|
|
@@ -387,10 +425,10 @@ export const transferDatabaseLocalToLocal = async (
|
|
|
387
425
|
} catch (e) {
|
|
388
426
|
// Try update path by deleting and recreating if necessary
|
|
389
427
|
try {
|
|
390
|
-
await
|
|
391
|
-
await
|
|
428
|
+
await dbAdapter.deleteIndex({ databaseId: targetDbId, tableId: targetTableId, key: (idx as any).key });
|
|
429
|
+
await dbAdapter.createIndex({
|
|
392
430
|
databaseId: targetDbId,
|
|
393
|
-
tableId:
|
|
431
|
+
tableId: targetTableId,
|
|
394
432
|
key: (idx as any).key,
|
|
395
433
|
type: (idx as any).type,
|
|
396
434
|
attributes: (idx as any).attributes,
|
|
@@ -404,20 +442,20 @@ export const transferDatabaseLocalToLocal = async (
|
|
|
404
442
|
}
|
|
405
443
|
}
|
|
406
444
|
|
|
407
|
-
// Transfer documents
|
|
445
|
+
// Transfer documents/rows via adapter
|
|
408
446
|
const { transferDocumentsBetweenDbsLocalToLocal } = await import(
|
|
409
|
-
"../collections/
|
|
447
|
+
"../collections/transferOperations.js"
|
|
410
448
|
);
|
|
411
449
|
await transferDocumentsBetweenDbsLocalToLocal(
|
|
412
|
-
|
|
450
|
+
dbAdapter,
|
|
413
451
|
fromDbId,
|
|
414
452
|
targetDbId,
|
|
415
|
-
|
|
416
|
-
|
|
453
|
+
table.$id,
|
|
454
|
+
targetTableId
|
|
417
455
|
);
|
|
418
456
|
} catch (error) {
|
|
419
457
|
MessageFormatter.error(
|
|
420
|
-
`Error processing
|
|
458
|
+
`Error processing table ${table.name}`,
|
|
421
459
|
error instanceof Error ? error : new Error(String(error)),
|
|
422
460
|
{ prefix: "Transfer" }
|
|
423
461
|
);
|
|
@@ -431,13 +469,18 @@ export const transferDatabaseLocalToRemote = async (
|
|
|
431
469
|
projectId: string,
|
|
432
470
|
apiKey: string,
|
|
433
471
|
fromDbId: string,
|
|
434
|
-
toDbId: string
|
|
472
|
+
toDbId: string,
|
|
473
|
+
collectionIds?: string[]
|
|
435
474
|
) => {
|
|
436
475
|
const client = getAppwriteClient(endpoint, projectId, apiKey);
|
|
437
476
|
const remoteDb = new Databases(client);
|
|
438
477
|
|
|
439
478
|
// Get all collections from source database
|
|
440
|
-
|
|
479
|
+
let sourceCollections = await fetchAllCollections(fromDbId, localDb);
|
|
480
|
+
if (collectionIds && collectionIds.length > 0) {
|
|
481
|
+
const idSet = new Set(collectionIds);
|
|
482
|
+
sourceCollections = sourceCollections.filter((c) => idSet.has(c.$id));
|
|
483
|
+
}
|
|
441
484
|
MessageFormatter.info(
|
|
442
485
|
`Found ${sourceCollections.length} collections in source database`,
|
|
443
486
|
{ prefix: "Transfer" }
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import yaml from "js-yaml";
|
|
5
|
-
import { logger } from
|
|
5
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
6
6
|
import type { ImportDef, AttributeMappings } from "@njdamstra/appwrite-utils";
|
|
7
7
|
|
|
8
8
|
// YAML Import Configuration Schema
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CollectionCreate, ImportDef } from "@njdamstra/appwrite-utils";
|
|
2
2
|
import { YamlImportConfigLoader, type YamlImportConfig } from "./YamlImportConfigLoader.js";
|
|
3
3
|
import { createImportSchemas, createImportExamples } from "./generateImportSchemas.js";
|
|
4
|
-
import { logger } from
|
|
5
|
-
import { normalizeYamlData, usesTableTerminology, convertTerminology, type YamlCollectionData } from "
|
|
4
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
5
|
+
import { normalizeYamlData, usesTableTerminology, convertTerminology, type YamlCollectionData } from "@njdamstra/appwrite-utils-helpers";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import yaml from "js-yaml";
|
package/src/setupCommands.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync, existsSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ulid } from "ulidx";
|
|
4
|
-
import { MessageFormatter } from "
|
|
4
|
+
import { MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
5
5
|
import {
|
|
6
6
|
detectAppwriteVersionCached,
|
|
7
7
|
fetchServerVersion,
|
|
8
8
|
isVersionAtLeast,
|
|
9
9
|
type ApiMode
|
|
10
|
-
} from "
|
|
10
|
+
} from "@njdamstra/appwrite-utils-helpers";
|
|
11
11
|
import {
|
|
12
12
|
loadAppwriteProjectConfig,
|
|
13
13
|
findAppwriteProjectConfig,
|
|
14
14
|
isTablesDBProject
|
|
15
|
-
} from "
|
|
16
|
-
import { findYamlConfig, generateYamlConfigTemplate } from "
|
|
17
|
-
import {
|
|
18
|
-
import { hasSessionAuth } from "./utils/sessionAuth.js";
|
|
15
|
+
} from "@njdamstra/appwrite-utils-helpers";
|
|
16
|
+
import { findYamlConfig, generateYamlConfigTemplate, loadYamlConfig } from "@njdamstra/appwrite-utils-helpers";
|
|
17
|
+
import { hasSessionAuth } from "@njdamstra/appwrite-utils-helpers";
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Terminology configuration for API mode-specific naming
|
package/src/setupController.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { loadConfig } from "./utils/loadConfigs.js";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import type { AppwriteConfig } from "@njdamstra/appwrite-utils";
|
|
6
|
-
import { MessageFormatter } from "
|
|
6
|
+
import { MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
7
7
|
|
|
8
8
|
export class SetupController {
|
|
9
9
|
private currentDir: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseAdapter } from "
|
|
2
|
-
import { logger } from
|
|
3
|
-
import { tryAwaitWithRetry } from "
|
|
1
|
+
import type { DatabaseAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
2
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
3
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
4
4
|
import { Query, ID } from "node-appwrite";
|
|
5
5
|
import {
|
|
6
6
|
BACKUP_TABLE_ID,
|
|
@@ -2,15 +2,15 @@ import { ID, Query, type Databases } from "node-appwrite";
|
|
|
2
2
|
import { BatchSchema, OperationSchema, type Operation } from "../storage/schemas.js";
|
|
3
3
|
import { AttributeMappingsSchema } from "@njdamstra/appwrite-utils";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { logger } from
|
|
6
|
-
import { tryAwaitWithRetry } from "
|
|
5
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
6
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
7
7
|
import {
|
|
8
8
|
findOrCreateOperation as findOrCreateOp,
|
|
9
9
|
updateOperation as updateOp,
|
|
10
10
|
getOperation as getOp
|
|
11
11
|
} from "./operationsTable.js";
|
|
12
|
-
import type { DatabaseAdapter } from "
|
|
13
|
-
import { MessageFormatter } from
|
|
12
|
+
import type { DatabaseAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
13
|
+
import { MessageFormatter } from '@njdamstra/appwrite-utils-helpers';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Object that contains the context for an action that needs to be executed after import
|
|
@@ -2,10 +2,9 @@ import { Query, type Databases, type Models } from "node-appwrite";
|
|
|
2
2
|
import type { Attribute } from "@njdamstra/appwrite-utils";
|
|
3
3
|
import { createOrUpdateAttributeWithStatusCheck } from "../collections/attributes.js";
|
|
4
4
|
import { fetchAndCacheCollectionByName } from "../collections/methods.js";
|
|
5
|
-
import { tryAwaitWithRetry } from "
|
|
6
|
-
import type { DatabaseAdapter } from "
|
|
7
|
-
import { logger } from "
|
|
8
|
-
import { MessageFormatter } from "../shared/messageFormatter.js";
|
|
5
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
6
|
+
import type { DatabaseAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
7
|
+
import { logger, MessageFormatter } from "@njdamstra/appwrite-utils-helpers";
|
|
9
8
|
|
|
10
9
|
export interface QueuedOperation {
|
|
11
10
|
type: "attribute";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DatabaseAdapter } from "
|
|
2
|
-
import { logger } from
|
|
3
|
-
import { tryAwaitWithRetry } from "
|
|
1
|
+
import type { DatabaseAdapter } from "@njdamstra/appwrite-utils-helpers";
|
|
2
|
+
import { logger } from '@njdamstra/appwrite-utils-helpers';
|
|
3
|
+
import { tryAwaitWithRetry } from "@njdamstra/appwrite-utils-helpers";
|
|
4
4
|
import { Query, ID } from "node-appwrite";
|
|
5
5
|
import {
|
|
6
6
|
OPERATIONS_TABLE_ID,
|