appwrite-utils-cli 0.10.74 → 0.10.75

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/README.md CHANGED
@@ -148,6 +148,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
148
148
 
149
149
  ## Changelog
150
150
 
151
+ - 0.10.75: Fixed slight issue writing ZOD Schema for collection without any attributes
151
152
  - 0.10.74: Fix moving users, should update Labels now
152
153
  - 0.10.73: Fix moving users, passwords should work now (from Appwrite, Argon2)
153
154
  - 0.10.71: Fix create template function `__dirname`
@@ -244,7 +244,7 @@ export default appwriteConfig;
244
244
  return;
245
245
  }
246
246
  this.config.collections.forEach((collection) => {
247
- const schemaString = this.createSchemaString(collection.name, collection.attributes);
247
+ const schemaString = this.createSchemaString(collection.name, collection.attributes || []);
248
248
  const camelCaseName = toCamelCase(collection.name);
249
249
  const schemaPath = path.join(this.appwriteFolderPath, "schemas", `${camelCaseName}.ts`);
250
250
  fs.writeFileSync(schemaPath, schemaString, { encoding: "utf-8" });
@@ -36,19 +36,19 @@ export class SchemaGenerator {
36
36
  usersCollectionName: "${this.config.usersCollectionName}",
37
37
  databases: ${JSON.stringify(this.config.databases)},
38
38
  buckets: ${JSON.stringify(this.config.buckets)},
39
- functions: ${JSON.stringify(functions.map(func => ({
39
+ functions: ${JSON.stringify(functions.map((func) => ({
40
40
  functionId: func.$id || ulid(),
41
41
  name: func.name,
42
42
  runtime: func.runtime,
43
43
  path: func.dirPath || `functions/${func.name}`,
44
- entrypoint: func.entrypoint || 'src/index.ts',
44
+ entrypoint: func.entrypoint || "src/index.ts",
45
45
  execute: func.execute,
46
46
  events: func.events || [],
47
- schedule: func.schedule || '',
47
+ schedule: func.schedule || "",
48
48
  timeout: func.timeout || 15,
49
49
  enabled: func.enabled !== false,
50
50
  logging: func.logging !== false,
51
- commands: func.commands || 'npm install',
51
+ commands: func.commands || "npm install",
52
52
  scopes: func.scopes || [],
53
53
  installationId: func.installationId,
54
54
  providerRepositoryId: func.providerRepositoryId,
@@ -56,8 +56,10 @@ export class SchemaGenerator {
56
56
  providerSilentMode: func.providerSilentMode,
57
57
  providerRootDirectory: func.providerRootDirectory,
58
58
  specification: func.specification,
59
- ...(func.predeployCommands ? { predeployCommands: func.predeployCommands } : {}),
60
- ...(func.deployDir ? { deployDir: func.deployDir } : {})
59
+ ...(func.predeployCommands
60
+ ? { predeployCommands: func.predeployCommands }
61
+ : {}),
62
+ ...(func.deployDir ? { deployDir: func.deployDir } : {}),
61
63
  })), null, 2)}
62
64
  };
63
65
 
@@ -84,7 +86,7 @@ export class SchemaGenerator {
84
86
  .join(",\n ")}
85
87
  ],
86
88
  attributes: [
87
- ${collection.attributes
89
+ ${(collection.attributes || [])
88
90
  .map((attr) => {
89
91
  return `{ ${Object.entries(attr)
90
92
  .map(([key, value]) => {
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.10.74",
4
+ "version": "0.10.75",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -308,7 +308,7 @@ export default appwriteConfig;
308
308
  this.config.collections.forEach((collection) => {
309
309
  const schemaString = this.createSchemaString(
310
310
  collection.name,
311
- collection.attributes
311
+ collection.attributes || []
312
312
  );
313
313
  const camelCaseName = toCamelCase(collection.name);
314
314
  const schemaPath = path.join(
@@ -55,29 +55,35 @@ export class SchemaGenerator {
55
55
  usersCollectionName: "${this.config.usersCollectionName}",
56
56
  databases: ${JSON.stringify(this.config.databases)},
57
57
  buckets: ${JSON.stringify(this.config.buckets)},
58
- functions: ${JSON.stringify(functions.map(func => ({
59
- functionId: func.$id || ulid(),
60
- name: func.name,
61
- runtime: func.runtime,
62
- path: func.dirPath || `functions/${func.name}`,
63
- entrypoint: func.entrypoint || 'src/index.ts',
64
- execute: func.execute,
65
- events: func.events || [],
66
- schedule: func.schedule || '',
67
- timeout: func.timeout || 15,
68
- enabled: func.enabled !== false,
69
- logging: func.logging !== false,
70
- commands: func.commands || 'npm install',
71
- scopes: func.scopes || [],
72
- installationId: func.installationId,
73
- providerRepositoryId: func.providerRepositoryId,
74
- providerBranch: func.providerBranch,
75
- providerSilentMode: func.providerSilentMode,
76
- providerRootDirectory: func.providerRootDirectory,
77
- specification: func.specification,
78
- ...(func.predeployCommands ? { predeployCommands: func.predeployCommands } : {}),
79
- ...(func.deployDir ? { deployDir: func.deployDir } : {})
80
- })), null, 2)}
58
+ functions: ${JSON.stringify(
59
+ functions.map((func) => ({
60
+ functionId: func.$id || ulid(),
61
+ name: func.name,
62
+ runtime: func.runtime,
63
+ path: func.dirPath || `functions/${func.name}`,
64
+ entrypoint: func.entrypoint || "src/index.ts",
65
+ execute: func.execute,
66
+ events: func.events || [],
67
+ schedule: func.schedule || "",
68
+ timeout: func.timeout || 15,
69
+ enabled: func.enabled !== false,
70
+ logging: func.logging !== false,
71
+ commands: func.commands || "npm install",
72
+ scopes: func.scopes || [],
73
+ installationId: func.installationId,
74
+ providerRepositoryId: func.providerRepositoryId,
75
+ providerBranch: func.providerBranch,
76
+ providerSilentMode: func.providerSilentMode,
77
+ providerRootDirectory: func.providerRootDirectory,
78
+ specification: func.specification,
79
+ ...(func.predeployCommands
80
+ ? { predeployCommands: func.predeployCommands }
81
+ : {}),
82
+ ...(func.deployDir ? { deployDir: func.deployDir } : {}),
83
+ })),
84
+ null,
85
+ 2
86
+ )}
81
87
  };
82
88
 
83
89
  export default appwriteConfig;
@@ -114,7 +120,7 @@ export class SchemaGenerator {
114
120
  .join(",\n ")}
115
121
  ],
116
122
  attributes: [
117
- ${collection.attributes
123
+ ${(collection.attributes || [])
118
124
  .map((attr) => {
119
125
  return `{ ${Object.entries(attr)
120
126
  .map(([key, value]) => {