appwrite-utils-cli 0.9.994 → 0.9.996

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.
@@ -5,8 +5,8 @@ import { getAppwriteClient } from "../utils/helperFunctions.js";
5
5
  import { createOrUpdateAttribute, createUpdateCollectionAttributes, } from "../collections/attributes.js";
6
6
  import { parseAttribute } from "appwrite-utils";
7
7
  import chalk from "chalk";
8
- import { fetchAllCollections } from "src/collections/methods.js";
9
- import { createOrUpdateIndex, createOrUpdateIndexes, } from "src/collections/indexes.js";
8
+ import { fetchAllCollections } from "../collections/methods.js";
9
+ import { createOrUpdateIndex, createOrUpdateIndexes, } from "../collections/indexes.js";
10
10
  export const transferStorageLocalToLocal = async (storage, fromBucketId, toBucketId) => {
11
11
  console.log(`Transferring files from ${fromBucketId} to ${toBucketId}`);
12
12
  let lastFileId;
@@ -1,6 +1,6 @@
1
1
  import { Client, Databases, Query, Storage } from "node-appwrite";
2
2
  import {} from "appwrite-utils";
3
- import { loadConfig, findAppwriteConfig, findFunctionsDir } from "./utils/loadConfigs.js";
3
+ import { loadConfig, findAppwriteConfig, findFunctionsDir, } from "./utils/loadConfigs.js";
4
4
  import { UsersController } from "./migrations/users.js";
5
5
  import { AppwriteToX } from "./migrations/appwriteToX.js";
6
6
  import { ImportController } from "./migrations/importController.js";
@@ -14,7 +14,7 @@ import { afterImportActions } from "./migrations/afterImportActions.js";
14
14
  import { transferDatabaseLocalToLocal, transferDatabaseLocalToRemote, transferStorageLocalToLocal, transferStorageLocalToRemote, } from "./migrations/transfer.js";
15
15
  import { getClient } from "./utils/getClientFromConfig.js";
16
16
  import { fetchAllDatabases } from "./migrations/databases.js";
17
- import { listFunctions, updateFunctionSpecifications } from "./functions/methods.js";
17
+ import { listFunctions, updateFunctionSpecifications, } from "./functions/methods.js";
18
18
  import chalk from "chalk";
19
19
  import { deployLocalFunction } from "./functions/deployments.js";
20
20
  import fs from "node:fs";
@@ -131,7 +131,9 @@ export class UtilsController {
131
131
  await this.init();
132
132
  if (!this.appwriteServer)
133
133
  throw new Error("Appwrite server not initialized");
134
- const { functions } = await listFunctions(this.appwriteServer, [Query.limit(1000)]);
134
+ const { functions } = await listFunctions(this.appwriteServer, [
135
+ Query.limit(1000),
136
+ ]);
135
137
  return functions;
136
138
  }
137
139
  async findFunctionDirectories() {
@@ -145,7 +147,7 @@ export class UtilsController {
145
147
  const functionPath = path.join(functionsDir, entry.name);
146
148
  // Match with config functions by name
147
149
  if (this.config?.functions) {
148
- const matchingFunc = this.config.functions.find(f => f.name.toLowerCase() === entry.name.toLowerCase());
150
+ const matchingFunc = this.config.functions.find((f) => f.name.toLowerCase() === entry.name.toLowerCase());
149
151
  if (matchingFunc) {
150
152
  functionDirMap.set(matchingFunc.name, functionPath);
151
153
  }
@@ -159,7 +161,7 @@ export class UtilsController {
159
161
  if (!this.appwriteServer)
160
162
  throw new Error("Appwrite server not initialized");
161
163
  if (!functionConfig) {
162
- functionConfig = this.config?.functions?.find(f => f.name === functionName);
164
+ functionConfig = this.config?.functions?.find((f) => f.name === functionName);
163
165
  }
164
166
  if (!functionConfig)
165
167
  throw new Error(`Function ${functionName} not found in config`);
@@ -170,7 +172,9 @@ export class UtilsController {
170
172
  if (!this.appwriteServer)
171
173
  throw new Error("Appwrite server not initialized");
172
174
  const localFunctions = this.config?.functions || [];
173
- const remoteFunctions = await listFunctions(this.appwriteServer, [Query.limit(1000)]);
175
+ const remoteFunctions = await listFunctions(this.appwriteServer, [
176
+ Query.limit(1000),
177
+ ]);
174
178
  for (const localFunction of localFunctions) {
175
179
  console.log(chalk.blue(`Syncing function ${localFunction.name}...`));
176
180
  await this.deployFunction(localFunction.name);
@@ -188,19 +192,22 @@ export class UtilsController {
188
192
  }
189
193
  async wipeBucketFromDatabase(database) {
190
194
  // Check configured bucket in database config
191
- const configuredBucket = this.config?.databases?.find(db => db.$id === database.$id)?.bucket;
195
+ const configuredBucket = this.config?.databases?.find((db) => db.$id === database.$id)?.bucket;
192
196
  if (configuredBucket?.$id) {
193
197
  await this.wipeDocumentStorage(configuredBucket.$id);
194
198
  }
195
199
  // Also check for document bucket ID pattern
196
200
  if (this.config?.documentBucketId) {
197
- const documentBucketId = `${this.config.documentBucketId}_${database.$id.toLowerCase().trim().replace(/\s+/g, "")}`;
201
+ const documentBucketId = `${this.config.documentBucketId}_${database.$id
202
+ .toLowerCase()
203
+ .trim()
204
+ .replace(/\s+/g, "")}`;
198
205
  try {
199
206
  await this.wipeDocumentStorage(documentBucketId);
200
207
  }
201
208
  catch (error) {
202
209
  // Ignore if bucket doesn't exist
203
- if (error?.type !== 'storage_bucket_not_found') {
210
+ if (error?.type !== "storage_bucket_not_found") {
204
211
  throw error;
205
212
  }
206
213
  }
@@ -278,11 +285,13 @@ export class UtilsController {
278
285
  return this.appwriteFolderPath;
279
286
  }
280
287
  async transferData(options) {
281
- // Remove database requirement check
282
288
  let sourceClient = this.database;
283
289
  let targetClient;
284
290
  let sourceDatabases = [];
285
291
  let targetDatabases = [];
292
+ if (!sourceClient) {
293
+ throw new Error("Source database not initialized");
294
+ }
286
295
  if (options.isRemote) {
287
296
  if (!options.transferEndpoint ||
288
297
  !options.transferProject ||
@@ -290,39 +299,47 @@ export class UtilsController {
290
299
  throw new Error("Remote transfer options are missing");
291
300
  }
292
301
  const remoteClient = getClient(options.transferEndpoint, options.transferProject, options.transferKey);
293
- if (this.database) {
294
- targetClient = new Databases(remoteClient);
295
- sourceDatabases = await fetchAllDatabases(sourceClient);
296
- targetDatabases = await fetchAllDatabases(targetClient);
297
- }
302
+ targetClient = new Databases(remoteClient);
303
+ sourceDatabases = await fetchAllDatabases(sourceClient);
304
+ targetDatabases = await fetchAllDatabases(targetClient);
298
305
  }
299
- else if (this.database) {
306
+ else {
300
307
  targetClient = sourceClient;
301
308
  sourceDatabases = targetDatabases = await fetchAllDatabases(sourceClient);
302
309
  }
303
- // Only validate databases if they're provided in options
310
+ // Always perform database transfer if databases are specified
304
311
  if (options.fromDb && options.targetDb) {
305
312
  const fromDb = sourceDatabases.find((db) => db.$id === options.fromDb.$id);
306
313
  const targetDb = targetDatabases.find((db) => db.$id === options.targetDb.$id);
307
314
  if (!fromDb || !targetDb) {
308
315
  throw new Error("Source or target database not found");
309
316
  }
317
+ console.log(chalk.blue(`Starting database transfer from ${fromDb.$id} to ${targetDb.$id}`));
310
318
  if (options.isRemote && targetClient) {
311
319
  await transferDatabaseLocalToRemote(sourceClient, options.transferEndpoint, options.transferProject, options.transferKey, fromDb.$id, targetDb.$id);
312
320
  }
313
- else if (targetClient) {
321
+ else {
314
322
  await transferDatabaseLocalToLocal(sourceClient, fromDb.$id, targetDb.$id);
315
323
  }
316
324
  }
317
- // Handle storage transfer separately
325
+ // Handle storage transfer
318
326
  if (this.storage && (options.sourceBucket || options.fromDb)) {
319
327
  const sourceBucketId = options.sourceBucket?.$id ||
320
- (options.fromDb && this.config?.documentBucketId &&
321
- `${this.config.documentBucketId}_${options.fromDb.$id.toLowerCase().trim().replace(" ", "")}`);
328
+ (options.fromDb &&
329
+ this.config?.documentBucketId &&
330
+ `${this.config.documentBucketId}_${options.fromDb.$id
331
+ .toLowerCase()
332
+ .trim()
333
+ .replace(/\s+/g, "")}`);
322
334
  const targetBucketId = options.targetBucket?.$id ||
323
- (options.targetDb && this.config?.documentBucketId &&
324
- `${this.config.documentBucketId}_${options.targetDb.$id.toLowerCase().trim().replace(" ", "")}`);
335
+ (options.targetDb &&
336
+ this.config?.documentBucketId &&
337
+ `${this.config.documentBucketId}_${options.targetDb.$id
338
+ .toLowerCase()
339
+ .trim()
340
+ .replace(/\s+/g, "")}`);
325
341
  if (sourceBucketId && targetBucketId) {
342
+ console.log(chalk.blue(`Starting storage transfer from ${sourceBucketId} to ${targetBucketId}`));
326
343
  if (options.isRemote) {
327
344
  await transferStorageLocalToRemote(this.storage, options.transferEndpoint, options.transferProject, options.transferKey, sourceBucketId, targetBucketId);
328
345
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "appwrite-utils-cli",
3
3
  "description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
4
- "version": "0.9.994",
4
+ "version": "0.9.996",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -15,11 +15,11 @@ import {
15
15
  } from "../collections/attributes.js";
16
16
  import { parseAttribute } from "appwrite-utils";
17
17
  import chalk from "chalk";
18
- import { fetchAllCollections } from "src/collections/methods.js";
18
+ import { fetchAllCollections } from "../collections/methods.js";
19
19
  import {
20
20
  createOrUpdateIndex,
21
21
  createOrUpdateIndexes,
22
- } from "src/collections/indexes.js";
22
+ } from "../collections/indexes.js";
23
23
 
24
24
  export interface TransferOptions {
25
25
  fromDb: Models.Database | undefined;
@@ -1,6 +1,14 @@
1
1
  import { Client, Databases, Query, Storage, type Models } from "node-appwrite";
2
- import { type AppwriteConfig, type AppwriteFunction, type Specification } from "appwrite-utils";
3
- import { loadConfig, findAppwriteConfig, findFunctionsDir } from "./utils/loadConfigs.js";
2
+ import {
3
+ type AppwriteConfig,
4
+ type AppwriteFunction,
5
+ type Specification,
6
+ } from "appwrite-utils";
7
+ import {
8
+ loadConfig,
9
+ findAppwriteConfig,
10
+ findFunctionsDir,
11
+ } from "./utils/loadConfigs.js";
4
12
  import { UsersController } from "./migrations/users.js";
5
13
  import { AppwriteToX } from "./migrations/appwriteToX.js";
6
14
  import { ImportController } from "./migrations/importController.js";
@@ -42,7 +50,10 @@ import {
42
50
  } from "./migrations/transfer.js";
43
51
  import { getClient } from "./utils/getClientFromConfig.js";
44
52
  import { fetchAllDatabases } from "./migrations/databases.js";
45
- import { listFunctions, updateFunctionSpecifications } from "./functions/methods.js";
53
+ import {
54
+ listFunctions,
55
+ updateFunctionSpecifications,
56
+ } from "./functions/methods.js";
46
57
  import chalk from "chalk";
47
58
  import { deployLocalFunction } from "./functions/deployments.js";
48
59
  import fs from "node:fs";
@@ -106,13 +117,13 @@ export class UtilsController {
106
117
  async reloadConfig() {
107
118
  this.config = await loadConfig(this.appwriteFolderPath);
108
119
  this.appwriteServer = new Client();
109
- this.appwriteServer
110
- .setEndpoint(this.config.appwriteEndpoint)
111
- .setProject(this.config.appwriteProject)
112
- .setKey(this.config.appwriteKey);
113
- this.database = new Databases(this.appwriteServer);
114
- this.storage = new Storage(this.appwriteServer);
115
- this.config.appwriteClient = this.appwriteServer;
120
+ this.appwriteServer
121
+ .setEndpoint(this.config.appwriteEndpoint)
122
+ .setProject(this.config.appwriteProject)
123
+ .setKey(this.config.appwriteKey);
124
+ this.database = new Databases(this.appwriteServer);
125
+ this.storage = new Storage(this.appwriteServer);
126
+ this.config.appwriteClient = this.appwriteServer;
116
127
  }
117
128
 
118
129
  async setupMigrationDatabase() {
@@ -139,8 +150,11 @@ export class UtilsController {
139
150
  await this.ensureDatabaseConfigBucketsExist(databases);
140
151
  await ensureDatabasesExist(this.config, databases);
141
152
  }
142
-
143
- async ensureCollectionsExist(database: Models.Database, collections?: Models.Collection[]) {
153
+
154
+ async ensureCollectionsExist(
155
+ database: Models.Database,
156
+ collections?: Models.Collection[]
157
+ ) {
144
158
  await this.init();
145
159
  if (!this.config) throw new Error("Config not initialized");
146
160
  await ensureCollectionsExist(this.config, database, collections);
@@ -185,25 +199,28 @@ export class UtilsController {
185
199
 
186
200
  async listAllFunctions() {
187
201
  await this.init();
188
- if (!this.appwriteServer) throw new Error("Appwrite server not initialized");
189
- const { functions } = await listFunctions(this.appwriteServer, [Query.limit(1000)]);
202
+ if (!this.appwriteServer)
203
+ throw new Error("Appwrite server not initialized");
204
+ const { functions } = await listFunctions(this.appwriteServer, [
205
+ Query.limit(1000),
206
+ ]);
190
207
  return functions;
191
208
  }
192
209
 
193
210
  async findFunctionDirectories() {
194
211
  const functionsDir = findFunctionsDir(this.appwriteFolderPath);
195
212
  if (!functionsDir) return new Map();
196
-
213
+
197
214
  const functionDirMap = new Map<string, string>();
198
215
  const entries = fs.readdirSync(functionsDir, { withFileTypes: true });
199
-
216
+
200
217
  for (const entry of entries) {
201
218
  if (entry.isDirectory()) {
202
219
  const functionPath = path.join(functionsDir, entry.name);
203
220
  // Match with config functions by name
204
221
  if (this.config?.functions) {
205
222
  const matchingFunc = this.config.functions.find(
206
- f => f.name.toLowerCase() === entry.name.toLowerCase()
223
+ (f) => f.name.toLowerCase() === entry.name.toLowerCase()
207
224
  );
208
225
  if (matchingFunc) {
209
226
  functionDirMap.set(matchingFunc.name, functionPath);
@@ -214,30 +231,46 @@ export class UtilsController {
214
231
  return functionDirMap;
215
232
  }
216
233
 
217
- async deployFunction(functionName: string, functionPath?: string, functionConfig?: AppwriteFunction) {
234
+ async deployFunction(
235
+ functionName: string,
236
+ functionPath?: string,
237
+ functionConfig?: AppwriteFunction
238
+ ) {
218
239
  await this.init();
219
- if (!this.appwriteServer) throw new Error("Appwrite server not initialized");
220
-
240
+ if (!this.appwriteServer)
241
+ throw new Error("Appwrite server not initialized");
242
+
221
243
  if (!functionConfig) {
222
- functionConfig = this.config?.functions?.find(f => f.name === functionName);
244
+ functionConfig = this.config?.functions?.find(
245
+ (f) => f.name === functionName
246
+ );
223
247
  }
224
- if (!functionConfig) throw new Error(`Function ${functionName} not found in config`);
225
-
226
- await deployLocalFunction(this.appwriteServer, functionName, functionConfig, functionPath);
248
+ if (!functionConfig)
249
+ throw new Error(`Function ${functionName} not found in config`);
250
+
251
+ await deployLocalFunction(
252
+ this.appwriteServer,
253
+ functionName,
254
+ functionConfig,
255
+ functionPath
256
+ );
227
257
  }
228
-
258
+
229
259
  async syncFunctions() {
230
260
  await this.init();
231
- if (!this.appwriteServer) throw new Error("Appwrite server not initialized");
232
-
261
+ if (!this.appwriteServer)
262
+ throw new Error("Appwrite server not initialized");
263
+
233
264
  const localFunctions = this.config?.functions || [];
234
- const remoteFunctions = await listFunctions(this.appwriteServer, [Query.limit(1000)]);
235
-
265
+ const remoteFunctions = await listFunctions(this.appwriteServer, [
266
+ Query.limit(1000),
267
+ ]);
268
+
236
269
  for (const localFunction of localFunctions) {
237
270
  console.log(chalk.blue(`Syncing function ${localFunction.name}...`));
238
271
  await this.deployFunction(localFunction.name);
239
272
  }
240
-
273
+
241
274
  console.log(chalk.green("✨ All functions synchronized successfully!"));
242
275
  }
243
276
 
@@ -252,26 +285,34 @@ export class UtilsController {
252
285
 
253
286
  async wipeBucketFromDatabase(database: Models.Database) {
254
287
  // Check configured bucket in database config
255
- const configuredBucket = this.config?.databases?.find(db => db.$id === database.$id)?.bucket;
288
+ const configuredBucket = this.config?.databases?.find(
289
+ (db) => db.$id === database.$id
290
+ )?.bucket;
256
291
  if (configuredBucket?.$id) {
257
292
  await this.wipeDocumentStorage(configuredBucket.$id);
258
293
  }
259
294
 
260
295
  // Also check for document bucket ID pattern
261
296
  if (this.config?.documentBucketId) {
262
- const documentBucketId = `${this.config.documentBucketId}_${database.$id.toLowerCase().trim().replace(/\s+/g, "")}`;
297
+ const documentBucketId = `${this.config.documentBucketId}_${database.$id
298
+ .toLowerCase()
299
+ .trim()
300
+ .replace(/\s+/g, "")}`;
263
301
  try {
264
302
  await this.wipeDocumentStorage(documentBucketId);
265
303
  } catch (error: any) {
266
304
  // Ignore if bucket doesn't exist
267
- if (error?.type !== 'storage_bucket_not_found') {
305
+ if (error?.type !== "storage_bucket_not_found") {
268
306
  throw error;
269
307
  }
270
308
  }
271
309
  }
272
310
  }
273
311
 
274
- async wipeCollection(database: Models.Database, collection: Models.Collection) {
312
+ async wipeCollection(
313
+ database: Models.Database,
314
+ collection: Models.Collection
315
+ ) {
275
316
  await this.init();
276
317
  if (!this.database) throw new Error("Database not initialized");
277
318
  await wipeCollection(this.database, database.$id, collection.$id);
@@ -283,7 +324,10 @@ export class UtilsController {
283
324
  await wipeDocumentStorage(this.storage, bucketId);
284
325
  }
285
326
 
286
- async createOrUpdateCollectionsForDatabases(databases: Models.Database[], collections: Models.Collection[] = []) {
327
+ async createOrUpdateCollectionsForDatabases(
328
+ databases: Models.Database[],
329
+ collections: Models.Collection[] = []
330
+ ) {
287
331
  await this.init();
288
332
  if (!this.database || !this.config)
289
333
  throw new Error("Database or config not initialized");
@@ -359,7 +403,10 @@ export class UtilsController {
359
403
  await appwriteToX.toSchemas(databases);
360
404
  }
361
405
 
362
- async syncDb(databases: Models.Database[] = [], collections: Models.Collection[] = []) {
406
+ async syncDb(
407
+ databases: Models.Database[] = [],
408
+ collections: Models.Collection[] = []
409
+ ) {
363
410
  await this.init();
364
411
  if (!this.database) throw new Error("Database not initialized");
365
412
  if (databases.length === 0) {
@@ -376,12 +423,15 @@ export class UtilsController {
376
423
  }
377
424
 
378
425
  async transferData(options: TransferOptions): Promise<void> {
379
- // Remove database requirement check
380
426
  let sourceClient = this.database;
381
427
  let targetClient: Databases | undefined;
382
428
  let sourceDatabases: Models.Database[] = [];
383
429
  let targetDatabases: Models.Database[] = [];
384
430
 
431
+ if (!sourceClient) {
432
+ throw new Error("Source database not initialized");
433
+ }
434
+
385
435
  if (options.isRemote) {
386
436
  if (
387
437
  !options.transferEndpoint ||
@@ -396,20 +446,20 @@ export class UtilsController {
396
446
  options.transferProject,
397
447
  options.transferKey
398
448
  );
399
-
400
- if (this.database) {
401
- targetClient = new Databases(remoteClient);
402
- sourceDatabases = await fetchAllDatabases(sourceClient!);
403
- targetDatabases = await fetchAllDatabases(targetClient);
404
- }
405
- } else if (this.database) {
449
+
450
+ targetClient = new Databases(remoteClient);
451
+ sourceDatabases = await fetchAllDatabases(sourceClient);
452
+ targetDatabases = await fetchAllDatabases(targetClient);
453
+ } else {
406
454
  targetClient = sourceClient;
407
- sourceDatabases = targetDatabases = await fetchAllDatabases(sourceClient!);
455
+ sourceDatabases = targetDatabases = await fetchAllDatabases(sourceClient);
408
456
  }
409
457
 
410
- // Only validate databases if they're provided in options
458
+ // Always perform database transfer if databases are specified
411
459
  if (options.fromDb && options.targetDb) {
412
- const fromDb = sourceDatabases.find((db) => db.$id === options.fromDb!.$id);
460
+ const fromDb = sourceDatabases.find(
461
+ (db) => db.$id === options.fromDb!.$id
462
+ );
413
463
  const targetDb = targetDatabases.find(
414
464
  (db) => db.$id === options.targetDb!.$id
415
465
  );
@@ -418,35 +468,57 @@ export class UtilsController {
418
468
  throw new Error("Source or target database not found");
419
469
  }
420
470
 
471
+ console.log(
472
+ chalk.blue(
473
+ `Starting database transfer from ${fromDb.$id} to ${targetDb.$id}`
474
+ )
475
+ );
476
+
421
477
  if (options.isRemote && targetClient) {
422
478
  await transferDatabaseLocalToRemote(
423
- sourceClient!,
479
+ sourceClient,
424
480
  options.transferEndpoint!,
425
481
  options.transferProject!,
426
482
  options.transferKey!,
427
483
  fromDb.$id,
428
484
  targetDb.$id
429
485
  );
430
- } else if (targetClient) {
486
+ } else {
431
487
  await transferDatabaseLocalToLocal(
432
- sourceClient!,
488
+ sourceClient,
433
489
  fromDb.$id,
434
490
  targetDb.$id
435
491
  );
436
492
  }
437
493
  }
438
494
 
439
- // Handle storage transfer separately
495
+ // Handle storage transfer
440
496
  if (this.storage && (options.sourceBucket || options.fromDb)) {
441
- const sourceBucketId = options.sourceBucket?.$id ||
442
- (options.fromDb && this.config?.documentBucketId &&
443
- `${this.config.documentBucketId}_${options.fromDb.$id.toLowerCase().trim().replace(" ", "")}`);
444
-
445
- const targetBucketId = options.targetBucket?.$id ||
446
- (options.targetDb && this.config?.documentBucketId &&
447
- `${this.config.documentBucketId}_${options.targetDb.$id.toLowerCase().trim().replace(" ", "")}`);
497
+ const sourceBucketId =
498
+ options.sourceBucket?.$id ||
499
+ (options.fromDb &&
500
+ this.config?.documentBucketId &&
501
+ `${this.config.documentBucketId}_${options.fromDb.$id
502
+ .toLowerCase()
503
+ .trim()
504
+ .replace(/\s+/g, "")}`);
505
+
506
+ const targetBucketId =
507
+ options.targetBucket?.$id ||
508
+ (options.targetDb &&
509
+ this.config?.documentBucketId &&
510
+ `${this.config.documentBucketId}_${options.targetDb.$id
511
+ .toLowerCase()
512
+ .trim()
513
+ .replace(/\s+/g, "")}`);
448
514
 
449
515
  if (sourceBucketId && targetBucketId) {
516
+ console.log(
517
+ chalk.blue(
518
+ `Starting storage transfer from ${sourceBucketId} to ${targetBucketId}`
519
+ )
520
+ );
521
+
450
522
  if (options.isRemote) {
451
523
  await transferStorageLocalToRemote(
452
524
  this.storage,
@@ -469,11 +541,27 @@ export class UtilsController {
469
541
  console.log(chalk.green("Transfer completed"));
470
542
  }
471
543
 
472
- async updateFunctionSpecifications(functionId: string, specification: Specification) {
544
+ async updateFunctionSpecifications(
545
+ functionId: string,
546
+ specification: Specification
547
+ ) {
473
548
  await this.init();
474
- if (!this.appwriteServer) throw new Error("Appwrite server not initialized");
475
- console.log(chalk.green(`Updating function specifications for ${functionId} to ${specification}`));
476
- await updateFunctionSpecifications(this.appwriteServer, functionId, specification);
477
- console.log(chalk.green(`Successfully updated function specifications for ${functionId} to ${specification}`));
549
+ if (!this.appwriteServer)
550
+ throw new Error("Appwrite server not initialized");
551
+ console.log(
552
+ chalk.green(
553
+ `Updating function specifications for ${functionId} to ${specification}`
554
+ )
555
+ );
556
+ await updateFunctionSpecifications(
557
+ this.appwriteServer,
558
+ functionId,
559
+ specification
560
+ );
561
+ console.log(
562
+ chalk.green(
563
+ `Successfully updated function specifications for ${functionId} to ${specification}`
564
+ )
565
+ );
478
566
  }
479
567
  }