appwrite-utils-cli 1.2.24 → 1.2.26

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.
@@ -255,6 +255,11 @@ declare const YamlConfigSchema: z.ZodObject<{
255
255
  templateRootDirectory: z.ZodOptional<z.ZodString>;
256
256
  templateBranch: z.ZodOptional<z.ZodString>;
257
257
  specification: z.ZodOptional<z.ZodEnum<["s-0.5vcpu-512mb", "s-1vcpu-512mb", "s-1vcpu-1gb", "s-2vcpu-2gb", "s-2vcpu-4gb", "s-4vcpu-4gb", "s-4vcpu-8gb", "s-8vcpu-4gb", "s-8vcpu-8gb"]>>;
258
+ dirPath: z.ZodOptional<z.ZodString>;
259
+ predeployCommands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
+ deployDir: z.ZodOptional<z.ZodString>;
261
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
262
+ templateVersion: z.ZodOptional<z.ZodString>;
258
263
  }, "strip", z.ZodTypeAny, {
259
264
  name: string;
260
265
  id: string;
@@ -278,6 +283,11 @@ declare const YamlConfigSchema: z.ZodObject<{
278
283
  templateRootDirectory?: string | undefined;
279
284
  templateBranch?: string | undefined;
280
285
  specification?: "s-0.5vcpu-512mb" | "s-1vcpu-512mb" | "s-1vcpu-1gb" | "s-2vcpu-2gb" | "s-2vcpu-4gb" | "s-4vcpu-4gb" | "s-4vcpu-8gb" | "s-8vcpu-4gb" | "s-8vcpu-8gb" | undefined;
286
+ dirPath?: string | undefined;
287
+ predeployCommands?: string[] | undefined;
288
+ deployDir?: string | undefined;
289
+ ignore?: string[] | undefined;
290
+ templateVersion?: string | undefined;
281
291
  }, {
282
292
  name: string;
283
293
  id: string;
@@ -301,6 +311,11 @@ declare const YamlConfigSchema: z.ZodObject<{
301
311
  templateRootDirectory?: string | undefined;
302
312
  templateBranch?: string | undefined;
303
313
  specification?: "s-0.5vcpu-512mb" | "s-1vcpu-512mb" | "s-1vcpu-1gb" | "s-2vcpu-2gb" | "s-2vcpu-4gb" | "s-4vcpu-4gb" | "s-4vcpu-8gb" | "s-8vcpu-4gb" | "s-8vcpu-8gb" | undefined;
314
+ dirPath?: string | undefined;
315
+ predeployCommands?: string[] | undefined;
316
+ deployDir?: string | undefined;
317
+ ignore?: string[] | undefined;
318
+ templateVersion?: string | undefined;
304
319
  }>, "many">>>;
305
320
  }, "strip", z.ZodTypeAny, {
306
321
  appwrite: {
@@ -396,6 +411,11 @@ declare const YamlConfigSchema: z.ZodObject<{
396
411
  templateRootDirectory?: string | undefined;
397
412
  templateBranch?: string | undefined;
398
413
  specification?: "s-0.5vcpu-512mb" | "s-1vcpu-512mb" | "s-1vcpu-1gb" | "s-2vcpu-2gb" | "s-2vcpu-4gb" | "s-4vcpu-4gb" | "s-4vcpu-8gb" | "s-8vcpu-4gb" | "s-8vcpu-8gb" | undefined;
414
+ dirPath?: string | undefined;
415
+ predeployCommands?: string[] | undefined;
416
+ deployDir?: string | undefined;
417
+ ignore?: string[] | undefined;
418
+ templateVersion?: string | undefined;
399
419
  }[];
400
420
  }, {
401
421
  appwrite: {
@@ -485,6 +505,11 @@ declare const YamlConfigSchema: z.ZodObject<{
485
505
  templateRootDirectory?: string | undefined;
486
506
  templateBranch?: string | undefined;
487
507
  specification?: "s-0.5vcpu-512mb" | "s-1vcpu-512mb" | "s-1vcpu-1gb" | "s-2vcpu-2gb" | "s-2vcpu-4gb" | "s-4vcpu-4gb" | "s-4vcpu-8gb" | "s-8vcpu-4gb" | "s-8vcpu-8gb" | undefined;
508
+ dirPath?: string | undefined;
509
+ predeployCommands?: string[] | undefined;
510
+ deployDir?: string | undefined;
511
+ ignore?: string[] | undefined;
512
+ templateVersion?: string | undefined;
488
513
  }[] | undefined;
489
514
  }>;
490
515
  export type YamlConfig = z.infer<typeof YamlConfigSchema>;
@@ -123,6 +123,12 @@ const YamlConfigSchema = z.object({
123
123
  templateRootDirectory: z.string().optional(),
124
124
  templateBranch: z.string().optional(),
125
125
  specification: FunctionSpecifications.optional(),
126
+ // Critical missing fields for function deployment
127
+ dirPath: z.string().optional(),
128
+ predeployCommands: z.array(z.string()).optional(),
129
+ deployDir: z.string().optional(),
130
+ ignore: z.array(z.string()).optional(),
131
+ templateVersion: z.string().optional(),
126
132
  }))
127
133
  .optional()
128
134
  .default([]),
@@ -205,6 +211,12 @@ export const convertYamlToAppwriteConfig = (yamlConfig) => {
205
211
  templateRootDirectory: func.templateRootDirectory || "",
206
212
  templateBranch: func.templateBranch || "",
207
213
  specification: func.specification || "s-0.5vcpu-512mb",
214
+ // Include critical missing fields for function deployment
215
+ dirPath: func.dirPath,
216
+ predeployCommands: func.predeployCommands,
217
+ deployDir: func.deployDir,
218
+ ignore: func.ignore,
219
+ templateVersion: func.templateVersion,
208
220
  })),
209
221
  collections: [], // Note: Collections are managed separately in YAML configs via individual collection files
210
222
  };
@@ -487,8 +499,13 @@ export const writeYamlConfig = async (configPath, config) => {
487
499
  templateRepository: func.templateRepository,
488
500
  templateOwner: func.templateOwner,
489
501
  templateRootDirectory: func.templateRootDirectory,
490
- // templateBranch: func.templateBranch, // Not available in AppwriteFunction type
491
502
  specification: func.specification,
503
+ // Include critical fields for function deployment
504
+ dirPath: func.dirPath,
505
+ predeployCommands: func.predeployCommands,
506
+ deployDir: func.deployDir,
507
+ ignore: func.ignore,
508
+ templateVersion: func.templateVersion,
492
509
  })) || [],
493
510
  };
494
511
  // Write YAML config
@@ -553,7 +570,13 @@ export const addFunctionToYamlConfig = async (configPath, newFunction) => {
553
570
  entrypoint: newFunction.entrypoint || "",
554
571
  commands: newFunction.commands || "",
555
572
  scopes: newFunction.scopes || [],
556
- specification: newFunction.specification || "s-0.5vcpu-512mb"
573
+ specification: newFunction.specification || "s-0.5vcpu-512mb",
574
+ // Include critical fields for function deployment if they exist
575
+ ...(newFunction.dirPath && { dirPath: newFunction.dirPath }),
576
+ ...(newFunction.predeployCommands && { predeployCommands: newFunction.predeployCommands }),
577
+ ...(newFunction.deployDir && { deployDir: newFunction.deployDir }),
578
+ ...(newFunction.ignore && { ignore: newFunction.ignore }),
579
+ ...(newFunction.templateVersion && { templateVersion: newFunction.templateVersion }),
557
580
  };
558
581
  // Add new function
559
582
  yamlData.functions.push(yamlFunction);
@@ -473,6 +473,13 @@ export class InteractiveCLI {
473
473
  const functionNameLower = functionConfig.name
474
474
  .toLowerCase()
475
475
  .replace(/\s+/g, "-");
476
+ // Debug logging
477
+ console.log(chalk.blue(`🔍 Function deployment debug:`));
478
+ console.log(chalk.gray(` Function name: ${functionConfig.name}`));
479
+ console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
480
+ console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
481
+ console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
482
+ console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
476
483
  // Check locations in priority order:
477
484
  const priorityLocations = [
478
485
  // 1. Config dirPath if specified
@@ -484,11 +491,16 @@ export class InteractiveCLI {
484
491
  // 4. Current working directory/name
485
492
  join(process.cwd(), functionNameLower),
486
493
  ].filter((val) => val !== undefined); // Remove undefined entries (in case dirPath is undefined)
494
+ console.log(chalk.blue(`🔍 Priority locations to check:`));
495
+ priorityLocations.forEach((loc, i) => {
496
+ console.log(chalk.gray(` ${i + 1}. ${loc}`));
497
+ });
487
498
  let functionPath = null;
488
499
  // Check each priority location
489
500
  for (const location of priorityLocations) {
501
+ console.log(chalk.gray(` Checking: ${location} - ${fs.existsSync(location) ? 'EXISTS' : 'NOT FOUND'}`));
490
502
  if (fs.existsSync(location)) {
491
- console.log(chalk.green(`Found function at: ${location}`));
503
+ console.log(chalk.green(`✅ Found function at: ${location}`));
492
504
  functionPath = location;
493
505
  break;
494
506
  }
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": "1.2.24",
4
+ "version": "1.2.26",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -129,6 +129,12 @@ const YamlConfigSchema = z.object({
129
129
  templateRootDirectory: z.string().optional(),
130
130
  templateBranch: z.string().optional(),
131
131
  specification: FunctionSpecifications.optional(),
132
+ // Critical missing fields for function deployment
133
+ dirPath: z.string().optional(),
134
+ predeployCommands: z.array(z.string()).optional(),
135
+ deployDir: z.string().optional(),
136
+ ignore: z.array(z.string()).optional(),
137
+ templateVersion: z.string().optional(),
132
138
  })
133
139
  )
134
140
  .optional()
@@ -215,6 +221,12 @@ export const convertYamlToAppwriteConfig = (yamlConfig: YamlConfig): AppwriteCon
215
221
  templateRootDirectory: func.templateRootDirectory || "",
216
222
  templateBranch: func.templateBranch || "",
217
223
  specification: func.specification || "s-0.5vcpu-512mb",
224
+ // Include critical missing fields for function deployment
225
+ dirPath: func.dirPath,
226
+ predeployCommands: func.predeployCommands,
227
+ deployDir: func.deployDir,
228
+ ignore: func.ignore,
229
+ templateVersion: func.templateVersion,
218
230
  })),
219
231
  collections: [], // Note: Collections are managed separately in YAML configs via individual collection files
220
232
  };
@@ -517,8 +529,13 @@ export const writeYamlConfig = async (configPath: string, config: AppwriteConfig
517
529
  templateRepository: func.templateRepository,
518
530
  templateOwner: func.templateOwner,
519
531
  templateRootDirectory: func.templateRootDirectory,
520
- // templateBranch: func.templateBranch, // Not available in AppwriteFunction type
521
532
  specification: func.specification,
533
+ // Include critical fields for function deployment
534
+ dirPath: func.dirPath,
535
+ predeployCommands: func.predeployCommands,
536
+ deployDir: func.deployDir,
537
+ ignore: func.ignore,
538
+ templateVersion: func.templateVersion,
522
539
  })) || [],
523
540
  };
524
541
 
@@ -588,7 +605,13 @@ export const addFunctionToYamlConfig = async (configPath: string, newFunction: A
588
605
  entrypoint: newFunction.entrypoint || "",
589
606
  commands: newFunction.commands || "",
590
607
  scopes: newFunction.scopes || [],
591
- specification: newFunction.specification || "s-0.5vcpu-512mb"
608
+ specification: newFunction.specification || "s-0.5vcpu-512mb",
609
+ // Include critical fields for function deployment if they exist
610
+ ...(newFunction.dirPath && { dirPath: newFunction.dirPath }),
611
+ ...(newFunction.predeployCommands && { predeployCommands: newFunction.predeployCommands }),
612
+ ...(newFunction.deployDir && { deployDir: newFunction.deployDir }),
613
+ ...(newFunction.ignore && { ignore: newFunction.ignore }),
614
+ ...(newFunction.templateVersion && { templateVersion: newFunction.templateVersion }),
592
615
  };
593
616
 
594
617
  // Add new function
@@ -620,6 +620,14 @@ export class InteractiveCLI {
620
620
  .toLowerCase()
621
621
  .replace(/\s+/g, "-");
622
622
 
623
+ // Debug logging
624
+ console.log(chalk.blue(`🔍 Function deployment debug:`));
625
+ console.log(chalk.gray(` Function name: ${functionConfig.name}`));
626
+ console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
627
+ console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
628
+ console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
629
+ console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
630
+
623
631
  // Check locations in priority order:
624
632
  const priorityLocations = [
625
633
  // 1. Config dirPath if specified
@@ -636,12 +644,18 @@ export class InteractiveCLI {
636
644
  join(process.cwd(), functionNameLower),
637
645
  ].filter((val): val is string => val !== undefined); // Remove undefined entries (in case dirPath is undefined)
638
646
 
647
+ console.log(chalk.blue(`🔍 Priority locations to check:`));
648
+ priorityLocations.forEach((loc, i) => {
649
+ console.log(chalk.gray(` ${i + 1}. ${loc}`));
650
+ });
651
+
639
652
  let functionPath: string | null = null;
640
653
 
641
654
  // Check each priority location
642
655
  for (const location of priorityLocations) {
656
+ console.log(chalk.gray(` Checking: ${location} - ${fs.existsSync(location) ? 'EXISTS' : 'NOT FOUND'}`));
643
657
  if (fs.existsSync(location)) {
644
- console.log(chalk.green(`Found function at: ${location}`));
658
+ console.log(chalk.green(`✅ Found function at: ${location}`));
645
659
  functionPath = location;
646
660
  break;
647
661
  }