appwrite-utils-cli 1.2.3 → 1.2.4

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.
@@ -114,6 +114,7 @@ export declare class AppwriteToX {
114
114
  })[]>;
115
115
  appwriteFolderPath: string;
116
116
  constructor(config: AppwriteConfig, appwriteFolderPath: string, storage: Storage);
117
+ private ensureClientInitialized;
117
118
  parsePermissionString: (permissionString: string) => {
118
119
  permission: string;
119
120
  target: string;
@@ -18,6 +18,17 @@ export class AppwriteToX {
18
18
  this.updatedConfig = config;
19
19
  this.storage = storage;
20
20
  this.appwriteFolderPath = appwriteFolderPath;
21
+ this.ensureClientInitialized();
22
+ }
23
+ ensureClientInitialized() {
24
+ if (!this.config.appwriteClient) {
25
+ const client = new Client();
26
+ client
27
+ .setEndpoint(this.config.appwriteEndpoint)
28
+ .setProject(this.config.appwriteProject)
29
+ .setKey(this.config.appwriteKey);
30
+ this.config.appwriteClient = client;
31
+ }
21
32
  }
22
33
  // Function to parse a single permission string
23
34
  parsePermissionString = (permissionString) => {
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.3",
4
+ "version": "1.2.4",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -45,6 +45,18 @@ export class AppwriteToX {
45
45
  this.updatedConfig = config;
46
46
  this.storage = storage;
47
47
  this.appwriteFolderPath = appwriteFolderPath;
48
+ this.ensureClientInitialized();
49
+ }
50
+
51
+ private ensureClientInitialized() {
52
+ if (!this.config.appwriteClient) {
53
+ const client = new Client();
54
+ client
55
+ .setEndpoint(this.config.appwriteEndpoint)
56
+ .setProject(this.config.appwriteProject)
57
+ .setKey(this.config.appwriteKey);
58
+ this.config.appwriteClient = client;
59
+ }
48
60
  }
49
61
 
50
62
  // Function to parse a single permission string