appwrite-utils-cli 0.0.285 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +122 -96
  2. package/dist/collections/attributes.d.ts +4 -0
  3. package/dist/collections/attributes.js +224 -0
  4. package/dist/collections/indexes.d.ts +4 -0
  5. package/dist/collections/indexes.js +27 -0
  6. package/dist/collections/methods.d.ts +16 -0
  7. package/dist/collections/methods.js +216 -0
  8. package/dist/databases/methods.d.ts +6 -0
  9. package/dist/databases/methods.js +33 -0
  10. package/dist/interactiveCLI.d.ts +19 -0
  11. package/dist/interactiveCLI.js +555 -0
  12. package/dist/main.js +227 -62
  13. package/dist/migrations/afterImportActions.js +37 -40
  14. package/dist/migrations/appwriteToX.d.ts +26 -25
  15. package/dist/migrations/appwriteToX.js +42 -6
  16. package/dist/migrations/attributes.js +21 -20
  17. package/dist/migrations/backup.d.ts +93 -87
  18. package/dist/migrations/collections.d.ts +6 -0
  19. package/dist/migrations/collections.js +149 -20
  20. package/dist/migrations/converters.d.ts +2 -18
  21. package/dist/migrations/converters.js +13 -2
  22. package/dist/migrations/dataLoader.d.ts +276 -161
  23. package/dist/migrations/dataLoader.js +535 -292
  24. package/dist/migrations/databases.js +8 -2
  25. package/dist/migrations/helper.d.ts +3 -0
  26. package/dist/migrations/helper.js +21 -0
  27. package/dist/migrations/importController.d.ts +5 -2
  28. package/dist/migrations/importController.js +125 -88
  29. package/dist/migrations/importDataActions.d.ts +9 -1
  30. package/dist/migrations/importDataActions.js +15 -3
  31. package/dist/migrations/indexes.js +3 -2
  32. package/dist/migrations/logging.js +20 -8
  33. package/dist/migrations/migrationHelper.d.ts +9 -4
  34. package/dist/migrations/migrationHelper.js +6 -5
  35. package/dist/migrations/openapi.d.ts +1 -1
  36. package/dist/migrations/openapi.js +33 -18
  37. package/dist/migrations/queue.js +3 -2
  38. package/dist/migrations/relationships.d.ts +2 -2
  39. package/dist/migrations/schemaStrings.js +53 -41
  40. package/dist/migrations/setupDatabase.d.ts +2 -4
  41. package/dist/migrations/setupDatabase.js +24 -105
  42. package/dist/migrations/storage.d.ts +3 -1
  43. package/dist/migrations/storage.js +110 -16
  44. package/dist/migrations/transfer.d.ts +30 -0
  45. package/dist/migrations/transfer.js +337 -0
  46. package/dist/migrations/users.d.ts +2 -1
  47. package/dist/migrations/users.js +78 -43
  48. package/dist/schemas/authUser.d.ts +2 -2
  49. package/dist/storage/methods.d.ts +15 -0
  50. package/dist/storage/methods.js +207 -0
  51. package/dist/storage/schemas.d.ts +687 -0
  52. package/dist/storage/schemas.js +175 -0
  53. package/dist/utils/getClientFromConfig.d.ts +4 -0
  54. package/dist/utils/getClientFromConfig.js +16 -0
  55. package/dist/utils/helperFunctions.d.ts +11 -1
  56. package/dist/utils/helperFunctions.js +38 -0
  57. package/dist/utils/retryFailedPromises.d.ts +2 -0
  58. package/dist/utils/retryFailedPromises.js +21 -0
  59. package/dist/utils/schemaStrings.d.ts +13 -0
  60. package/dist/utils/schemaStrings.js +403 -0
  61. package/dist/utils/setupFiles.js +110 -61
  62. package/dist/utilsController.d.ts +40 -22
  63. package/dist/utilsController.js +164 -84
  64. package/package.json +13 -15
  65. package/src/collections/attributes.ts +483 -0
  66. package/src/collections/indexes.ts +53 -0
  67. package/src/collections/methods.ts +331 -0
  68. package/src/databases/methods.ts +47 -0
  69. package/src/init.ts +64 -64
  70. package/src/interactiveCLI.ts +767 -0
  71. package/src/main.ts +292 -83
  72. package/src/migrations/afterImportActions.ts +553 -490
  73. package/src/migrations/appwriteToX.ts +237 -174
  74. package/src/migrations/attributes.ts +483 -422
  75. package/src/migrations/backup.ts +205 -205
  76. package/src/migrations/collections.ts +545 -300
  77. package/src/migrations/converters.ts +161 -150
  78. package/src/migrations/dataLoader.ts +1615 -1304
  79. package/src/migrations/databases.ts +44 -25
  80. package/src/migrations/dbHelpers.ts +92 -92
  81. package/src/migrations/helper.ts +40 -0
  82. package/src/migrations/importController.ts +448 -384
  83. package/src/migrations/importDataActions.ts +315 -307
  84. package/src/migrations/indexes.ts +40 -37
  85. package/src/migrations/logging.ts +29 -16
  86. package/src/migrations/migrationHelper.ts +207 -201
  87. package/src/migrations/openapi.ts +83 -70
  88. package/src/migrations/queue.ts +118 -119
  89. package/src/migrations/relationships.ts +324 -324
  90. package/src/migrations/schemaStrings.ts +472 -460
  91. package/src/migrations/setupDatabase.ts +118 -219
  92. package/src/migrations/storage.ts +538 -358
  93. package/src/migrations/transfer.ts +608 -0
  94. package/src/migrations/users.ts +362 -285
  95. package/src/migrations/validationRules.ts +63 -63
  96. package/src/schemas/authUser.ts +23 -23
  97. package/src/setup.ts +8 -8
  98. package/src/storage/methods.ts +371 -0
  99. package/src/storage/schemas.ts +205 -0
  100. package/src/types.ts +9 -9
  101. package/src/utils/getClientFromConfig.ts +17 -0
  102. package/src/utils/helperFunctions.ts +181 -127
  103. package/src/utils/index.ts +2 -2
  104. package/src/utils/loadConfigs.ts +59 -59
  105. package/src/utils/retryFailedPromises.ts +27 -0
  106. package/src/utils/schemaStrings.ts +473 -0
  107. package/src/utils/setupFiles.ts +228 -182
  108. package/src/utilsController.ts +325 -194
  109. package/tsconfig.json +37 -37
@@ -1,194 +1,325 @@
1
- import { Client, Databases, Storage } from "node-appwrite";
2
- import { startSetup } from "./migrations/setupDatabase.js";
3
- import path from "path";
4
- import fs from "fs";
5
- import { load } from "js-yaml";
6
- import { ImportDataActions } from "./migrations/importDataActions.js";
7
- import { readFileSync } from "./utils/helperFunctions.js";
8
- import { afterImportActions } from "./migrations/afterImportActions.js";
9
- import {
10
- type AfterImportActions,
11
- type ConverterFunctions,
12
- converterFunctions,
13
- validationRules,
14
- type ValidationRules,
15
- type AppwriteConfig,
16
- AppwriteConfigSchema,
17
- } from "appwrite-utils";
18
- import { ImportController } from "./migrations/importController.js";
19
- import _ from "lodash";
20
- import { AppwriteToX } from "./migrations/appwriteToX.js";
21
- import { loadConfig as loadTsConfig } from "./utils/loadConfigs.js";
22
- import { findAppwriteConfig } from "./utils/loadConfigs.js";
23
-
24
- // async function loadConfig(configPath: string) {
25
- // if (!fs.existsSync(configPath)) {
26
- // throw new Error(`Configuration file not found at ${configPath}`);
27
- // }
28
- // const configModule = await load(readFileSync(configPath), {
29
- // json: true,
30
- // });
31
- // return AppwriteConfigSchema.parse(configModule);
32
- // }
33
-
34
- export interface SetupOptions {
35
- sync: boolean;
36
- runProd: boolean;
37
- runStaging: boolean;
38
- runDev: boolean;
39
- doBackup: boolean;
40
- wipeDatabases: boolean;
41
- wipeDocumentStorage: boolean;
42
- wipeUsers: boolean;
43
- generateSchemas: boolean;
44
- generateMockData: boolean;
45
- importData: boolean;
46
- checkDuplicates: boolean;
47
- shouldWriteFile: boolean;
48
- endpoint?: string;
49
- project?: string;
50
- key?: string;
51
- }
52
-
53
- export class UtilsController {
54
- private appwriteFolderPath: string;
55
- private appwriteConfigPath: string;
56
- private config?: AppwriteConfig;
57
- private appwriteServer?: Client;
58
- private database?: Databases;
59
- private storage?: Storage;
60
- public converterDefinitions: ConverterFunctions = converterFunctions;
61
- public validityRuleDefinitions: ValidationRules = validationRules;
62
- public afterImportActionsDefinitions: AfterImportActions = afterImportActions;
63
-
64
- constructor(currentUserDir: string) {
65
- const basePath = currentUserDir; // Gets the current working directory
66
- const appwriteConfigFound = findAppwriteConfig(basePath);
67
- if (!appwriteConfigFound) {
68
- throw new Error("Failed to find appwriteConfig.ts");
69
- }
70
- this.appwriteConfigPath = appwriteConfigFound;
71
- this.appwriteFolderPath = path.dirname(appwriteConfigFound);
72
- if (!this.appwriteFolderPath) {
73
- throw new Error("Failed to get appwriteFolderPath");
74
- }
75
- }
76
-
77
- // async loadCustomDefinitions(): Promise<void> {
78
- // try {
79
- // const customDefinitionsPath = path.join(
80
- // this.appwriteFolderPath,
81
- // "customDefinitions.ts"
82
- // );
83
- // if (fs.existsSync(customDefinitionsPath)) {
84
- // // Dynamically import custom definitions
85
- // const customDefinitions = (await import(
86
- // customDefinitionsPath
87
- // )) as typeof import("customDefinitions");
88
- // this.converterDefinitions = {
89
- // ...this.converterDefinitions,
90
- // ...customDefinitions.converterDefinitions,
91
- // };
92
- // this.validityRuleDefinitions = {
93
- // ...this.validityRuleDefinitions,
94
- // ...customDefinitions.validityRuleDefinitions,
95
- // };
96
- // this.afterImportActionsDefinitions = {
97
- // ...this.afterImportActionsDefinitions,
98
- // ...customDefinitions.afterImportActionsDefinitions,
99
- // };
100
- // }
101
- // } catch (error) {
102
- // console.error("Failed to load custom definitions:", error);
103
- // }
104
- // }
105
-
106
- async init(setupOptions: SetupOptions) {
107
- if (!this.config) {
108
- console.log("Initializing appwrite client & loading config...");
109
- this.config = await loadTsConfig(this.appwriteFolderPath);
110
- if (!this.config) {
111
- throw new Error("Failed to load config");
112
- }
113
- this.appwriteServer = new Client();
114
- if (setupOptions.endpoint) {
115
- if (!setupOptions.project || !setupOptions.key) {
116
- throw new Error(
117
- "Project ID and API key required when setting endpoint"
118
- );
119
- }
120
- this.appwriteServer
121
- .setEndpoint(setupOptions.endpoint)
122
- .setProject(setupOptions.project)
123
- .setKey(setupOptions.key);
124
- } else {
125
- this.appwriteServer
126
- .setEndpoint(this.config.appwriteEndpoint)
127
- .setProject(this.config.appwriteProject)
128
- .setKey(this.config.appwriteKey);
129
- }
130
- this.database = new Databases(this.appwriteServer);
131
- this.storage = new Storage(this.appwriteServer);
132
- this.config.appwriteClient = this.appwriteServer;
133
- // await this.loadCustomDefinitions();
134
- }
135
- }
136
-
137
- async run(options: SetupOptions) {
138
- await this.init(options); // Ensure initialization is done
139
- if (!this.database || !this.storage || !this.config) {
140
- throw new Error("Database or storage not initialized");
141
- }
142
-
143
- if (options.sync) {
144
- console.log("Starting synchronization with server...");
145
- const appwriteToX = new AppwriteToX(this.config, this.appwriteFolderPath);
146
- await appwriteToX.toSchemas();
147
- console.log("Synchronization complete, YAML and Schemas updated");
148
- }
149
-
150
- // Start the setup
151
- console.log(
152
- "Starting setup, this step sets up migrations, runs backup, wipes databases, and updates schemas (depending on your options)..."
153
- );
154
- await startSetup(
155
- this.database,
156
- this.storage,
157
- this.config,
158
- options,
159
- this.appwriteFolderPath
160
- );
161
- console.log("Setup complete.");
162
-
163
- if (options.generateMockData) {
164
- // TODO: Figure out how to do this dynamically
165
- // await this.generateMockData();
166
- }
167
-
168
- if (options.importData) {
169
- console.log("Starting import data...");
170
- const importDataActions = new ImportDataActions(
171
- this.database,
172
- this.storage,
173
- this.config,
174
- this.converterDefinitions,
175
- this.validityRuleDefinitions,
176
- this.afterImportActionsDefinitions
177
- );
178
- const importController = new ImportController(
179
- this.config!,
180
- this.database!,
181
- this.storage!,
182
- this.appwriteFolderPath,
183
- importDataActions,
184
- options
185
- );
186
- await importController.run();
187
- console.log("Import data complete.");
188
- }
189
-
190
- // if (options.checkDuplicates) {
191
- // await this.checkDuplicates();
192
- // }
193
- }
194
- }
1
+ import { Client, Databases, Query, Storage, type Models } from "node-appwrite";
2
+ import { type AppwriteConfig } from "appwrite-utils";
3
+ import { loadConfig, findAppwriteConfig } from "./utils/loadConfigs.js";
4
+ import { UsersController } from "./migrations/users.js";
5
+ import { AppwriteToX } from "./migrations/appwriteToX.js";
6
+ import { ImportController } from "./migrations/importController.js";
7
+ import { ImportDataActions } from "./migrations/importDataActions.js";
8
+ import {
9
+ setupMigrationDatabase,
10
+ ensureDatabasesExist,
11
+ wipeOtherDatabases,
12
+ } from "./migrations/setupDatabase.js";
13
+ import {
14
+ createOrUpdateCollections,
15
+ wipeDatabase,
16
+ generateSchemas,
17
+ fetchAllCollections,
18
+ } from "./collections/methods.js";
19
+ import {
20
+ backupDatabase,
21
+ initOrGetBackupStorage,
22
+ wipeDocumentStorage,
23
+ } from "./storage/methods.js";
24
+ import path from "path";
25
+ import {
26
+ type AfterImportActions,
27
+ type ConverterFunctions,
28
+ converterFunctions,
29
+ validationRules,
30
+ type ValidationRules,
31
+ } from "appwrite-utils";
32
+ import { afterImportActions } from "./migrations/afterImportActions.js";
33
+ import {
34
+ transferDatabaseLocalToLocal,
35
+ transferDatabaseLocalToRemote,
36
+ transferStorageLocalToLocal,
37
+ transferStorageLocalToRemote,
38
+ type TransferOptions,
39
+ } from "./migrations/transfer.js";
40
+ import { getClient } from "./utils/getClientFromConfig.js";
41
+ import { fetchAllDatabases } from "./migrations/databases.js";
42
+
43
+ export interface SetupOptions {
44
+ databases?: Models.Database[];
45
+ collections?: string[];
46
+ doBackup?: boolean;
47
+ wipeDatabase?: boolean;
48
+ wipeDocumentStorage?: boolean;
49
+ wipeUsers?: boolean;
50
+ generateSchemas?: boolean;
51
+ importData?: boolean;
52
+ checkDuplicates?: boolean;
53
+ shouldWriteFile?: boolean;
54
+ }
55
+
56
+ export class UtilsController {
57
+ private appwriteFolderPath: string;
58
+ private appwriteConfigPath: string;
59
+ public config?: AppwriteConfig;
60
+ public appwriteServer?: Client;
61
+ public database?: Databases;
62
+ public storage?: Storage;
63
+ public converterDefinitions: ConverterFunctions = converterFunctions;
64
+ public validityRuleDefinitions: ValidationRules = validationRules;
65
+ public afterImportActionsDefinitions: AfterImportActions = afterImportActions;
66
+
67
+ constructor(currentUserDir: string) {
68
+ const basePath = currentUserDir;
69
+ const appwriteConfigFound = findAppwriteConfig(basePath);
70
+ if (!appwriteConfigFound) {
71
+ throw new Error("Failed to find appwriteConfig.ts");
72
+ }
73
+ this.appwriteConfigPath = appwriteConfigFound;
74
+ this.appwriteFolderPath = path.dirname(appwriteConfigFound);
75
+ if (!this.appwriteFolderPath) {
76
+ throw new Error("Failed to get appwriteFolderPath");
77
+ }
78
+ }
79
+
80
+ async init() {
81
+ if (!this.config) {
82
+ console.log("Initializing appwrite client & loading config...");
83
+ this.config = await loadConfig(this.appwriteFolderPath);
84
+ if (!this.config) {
85
+ throw new Error("Failed to load config");
86
+ }
87
+ this.appwriteServer = new Client();
88
+ this.appwriteServer
89
+ .setEndpoint(this.config.appwriteEndpoint)
90
+ .setProject(this.config.appwriteProject)
91
+ .setKey(this.config.appwriteKey);
92
+ this.database = new Databases(this.appwriteServer);
93
+ this.storage = new Storage(this.appwriteServer);
94
+ this.config.appwriteClient = this.appwriteServer;
95
+ }
96
+ }
97
+
98
+ async setupMigrationDatabase() {
99
+ await this.init();
100
+ if (!this.config) throw new Error("Config not initialized");
101
+ await setupMigrationDatabase(this.config);
102
+ }
103
+
104
+ async ensureDatabasesExist(databases?: Models.Database[]) {
105
+ await this.init();
106
+ if (!this.config) throw new Error("Config not initialized");
107
+ await this.setupMigrationDatabase();
108
+ await ensureDatabasesExist(this.config);
109
+ }
110
+
111
+ async getDatabasesByIds(ids: string[]) {
112
+ await this.init();
113
+ if (!this.database) throw new Error("Database not initialized");
114
+ const dbs = await this.database.list([
115
+ Query.limit(500),
116
+ Query.equal("$id", ids),
117
+ ]);
118
+ return dbs.databases;
119
+ }
120
+
121
+ async wipeOtherDatabases(databasesToKeep: Models.Database[]) {
122
+ await this.init();
123
+ if (!this.database) throw new Error("Database not initialized");
124
+ await wipeOtherDatabases(this.database, databasesToKeep);
125
+ }
126
+
127
+ async wipeUsers() {
128
+ await this.init();
129
+ if (!this.config || !this.database)
130
+ throw new Error("Config or database not initialized");
131
+ const usersController = new UsersController(this.config, this.database);
132
+ await usersController.wipeUsers();
133
+ }
134
+
135
+ async backupDatabase(database: Models.Database) {
136
+ await this.init();
137
+ if (!this.database || !this.storage || !this.config)
138
+ throw new Error("Database, storage, or config not initialized");
139
+ await backupDatabase(
140
+ this.config,
141
+ this.database,
142
+ database.$id,
143
+ this.storage
144
+ );
145
+ }
146
+
147
+ async wipeDatabase(database: Models.Database) {
148
+ await this.init();
149
+ if (!this.database) throw new Error("Database not initialized");
150
+ return await wipeDatabase(this.database, database.$id);
151
+ }
152
+
153
+ async wipeDocumentStorage(bucketId: string) {
154
+ await this.init();
155
+ if (!this.storage) throw new Error("Storage not initialized");
156
+ await wipeDocumentStorage(this.storage, bucketId);
157
+ }
158
+
159
+ async createOrUpdateCollectionsForDatabases(databases: Models.Database[]) {
160
+ await this.init();
161
+ if (!this.database || !this.config)
162
+ throw new Error("Database or config not initialized");
163
+ for (const database of databases) {
164
+ await this.createOrUpdateCollections(database);
165
+ }
166
+ }
167
+
168
+ async createOrUpdateCollections(
169
+ database: Models.Database,
170
+ deletedCollections?: { collectionId: string; collectionName: string }[]
171
+ ) {
172
+ await this.init();
173
+ if (!this.database || !this.config)
174
+ throw new Error("Database or config not initialized");
175
+ await createOrUpdateCollections(
176
+ this.database,
177
+ database.$id,
178
+ this.config,
179
+ deletedCollections
180
+ );
181
+ }
182
+
183
+ async generateSchemas() {
184
+ await this.init();
185
+ if (!this.config) throw new Error("Config not initialized");
186
+ await generateSchemas(this.config, this.appwriteFolderPath);
187
+ }
188
+
189
+ async importData(options: SetupOptions) {
190
+ await this.init();
191
+ if (!this.config || !this.database || !this.storage)
192
+ throw new Error("Config, database, or storage not initialized");
193
+ const importDataActions = new ImportDataActions(
194
+ this.database,
195
+ this.storage,
196
+ this.config,
197
+ this.converterDefinitions,
198
+ this.validityRuleDefinitions,
199
+ this.afterImportActionsDefinitions
200
+ );
201
+ const importController = new ImportController(
202
+ this.config,
203
+ this.database,
204
+ this.storage,
205
+ this.appwriteFolderPath,
206
+ importDataActions,
207
+ options
208
+ );
209
+ await importController.run();
210
+ }
211
+
212
+ async synchronizeConfigurations(
213
+ databases?: Models.Database[],
214
+ config?: AppwriteConfig
215
+ ) {
216
+ await this.init();
217
+ if (!this.storage) throw new Error("Storage not initialized");
218
+ const configToUse = config || this.config;
219
+ if (!configToUse) throw new Error("Config not initialized");
220
+ const appwriteToX = new AppwriteToX(
221
+ configToUse,
222
+ this.appwriteFolderPath,
223
+ this.storage
224
+ );
225
+ await appwriteToX.toSchemas(databases);
226
+ }
227
+
228
+ async syncDb() {
229
+ await this.init();
230
+ if (!this.database) throw new Error("Database not initialized");
231
+ const databases = await fetchAllDatabases(this.database);
232
+ await this.ensureDatabasesExist(databases);
233
+ await this.createOrUpdateCollectionsForDatabases(databases);
234
+ }
235
+
236
+ getAppwriteFolderPath() {
237
+ return this.appwriteFolderPath;
238
+ }
239
+
240
+ async transferData(options: TransferOptions): Promise<void> {
241
+ if (!this.database) {
242
+ throw new Error(
243
+ "Database is not initialized, is the config file correct & created?"
244
+ );
245
+ }
246
+
247
+ let sourceClient = this.database;
248
+ let targetClient: Databases;
249
+ let sourceDatabases: Models.Database[];
250
+ let targetDatabases: Models.Database[];
251
+
252
+ if (options.isRemote) {
253
+ if (
254
+ !options.transferEndpoint ||
255
+ !options.transferProject ||
256
+ !options.transferKey
257
+ ) {
258
+ throw new Error("Remote transfer options are missing");
259
+ }
260
+
261
+ const remoteClient = getClient(
262
+ options.transferEndpoint,
263
+ options.transferProject,
264
+ options.transferKey
265
+ );
266
+ targetClient = new Databases(remoteClient);
267
+
268
+ sourceDatabases = await fetchAllDatabases(sourceClient);
269
+ targetDatabases = await fetchAllDatabases(targetClient);
270
+ } else {
271
+ targetClient = sourceClient;
272
+ sourceDatabases = targetDatabases = await fetchAllDatabases(sourceClient);
273
+ }
274
+
275
+ // Validate that the provided databases exist in the fetched lists
276
+ const fromDb = sourceDatabases.find((db) => db.$id === options.fromDb.$id);
277
+ const targetDb = targetDatabases.find(
278
+ (db) => db.$id === options.targetDb.$id
279
+ );
280
+
281
+ if (!fromDb || !targetDb) {
282
+ throw new Error("Source or target database not found");
283
+ }
284
+
285
+ if (options.isRemote) {
286
+ // Remote transfer
287
+ await transferDatabaseLocalToRemote(
288
+ sourceClient,
289
+ options.transferEndpoint!,
290
+ options.transferProject!,
291
+ options.transferKey!,
292
+ fromDb.$id,
293
+ targetDb.$id
294
+ );
295
+
296
+ if (this.storage && options.sourceBucket && options.targetBucket) {
297
+ await transferStorageLocalToRemote(
298
+ this.storage,
299
+ options.transferEndpoint!,
300
+ options.transferProject!,
301
+ options.transferKey!,
302
+ options.sourceBucket.$id,
303
+ options.targetBucket.$id
304
+ );
305
+ }
306
+ } else {
307
+ // Local transfer
308
+ await transferDatabaseLocalToLocal(
309
+ sourceClient,
310
+ fromDb.$id,
311
+ targetDb.$id
312
+ );
313
+
314
+ if (this.storage && options.sourceBucket && options.targetBucket) {
315
+ await transferStorageLocalToLocal(
316
+ this.storage,
317
+ options.sourceBucket.$id,
318
+ options.targetBucket.$id
319
+ );
320
+ }
321
+ }
322
+
323
+ console.log("Data transfer completed");
324
+ }
325
+ }
package/tsconfig.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "compilerOptions": {
3
- // Enable latest features
4
- "target": "ESNext",
5
- "module": "NodeNext",
6
- "lib": ["ESNext"],
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
- "allowArbitraryExtensions": true,
11
- "allowSyntheticDefaultImports": true,
12
- "resolveJsonModule": true,
13
-
14
- // NodeNext mode
15
- "moduleResolution": "NodeNext",
16
- "verbatimModuleSyntax": true,
17
- "noEmit": false,
18
- "emitDeclarationOnly": false,
19
-
20
- // Best practices
21
- "strict": true,
22
- "skipLibCheck": true,
23
- "noFallthroughCasesInSwitch": true,
24
-
25
- // Some stricter flags (disabled by default)
26
- "noUnusedLocals": false,
27
- "noUnusedParameters": false,
28
- "noPropertyAccessFromIndexSignature": false,
29
- "baseUrl": ".",
30
- "esModuleInterop": true,
31
- "outDir": "./dist",
32
- "rootDir": "./src",
33
- "declaration": true
34
- },
35
- "include": ["src/**/*"],
36
- "exclude": ["node_modules", "dist", "src/appwrite", "example/*"]
37
- }
1
+ {
2
+ "compilerOptions": {
3
+ // Enable latest features
4
+ "target": "ESNext",
5
+ "module": "NodeNext",
6
+ "lib": ["ESNext"],
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+ "allowArbitraryExtensions": true,
11
+ "allowSyntheticDefaultImports": true,
12
+ "resolveJsonModule": true,
13
+
14
+ // NodeNext mode
15
+ "moduleResolution": "NodeNext",
16
+ "verbatimModuleSyntax": true,
17
+ "noEmit": false,
18
+ "emitDeclarationOnly": false,
19
+
20
+ // Best practices
21
+ "strict": true,
22
+ "skipLibCheck": true,
23
+ "noFallthroughCasesInSwitch": true,
24
+
25
+ // Some stricter flags (disabled by default)
26
+ "noUnusedLocals": false,
27
+ "noUnusedParameters": false,
28
+ "noPropertyAccessFromIndexSignature": false,
29
+ "baseUrl": ".",
30
+ "esModuleInterop": true,
31
+ "outDir": "./dist",
32
+ "rootDir": "./src",
33
+ "declaration": true
34
+ },
35
+ "include": ["src/**/*"],
36
+ "exclude": ["node_modules", "dist", "src/appwrite", "example/*"]
37
+ }