appwrite-utils-cli 0.9.70 → 0.9.72

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
@@ -124,6 +124,8 @@ This updated CLI ensures that developers have robust tools at their fingertips t
124
124
 
125
125
  ## Changelog
126
126
 
127
+ - 0.9.72: Fixed my own null bug
128
+ - 0.9.71: Reverted `node-appwrite` to 14, this seems to fix the xdefault error
127
129
  - 0.9.70: I think I stopped it from deleting attributes, my bad on that
128
130
  - 0.9.68: Temporarily disabled updating Attributes until `updateStringAttribute` is fixed -- it just deletes them now
129
131
  - 0.9.65: Temporary fix for Appwrite's `updateStringAttribute` bug
@@ -97,7 +97,7 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
97
97
  else {
98
98
  await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault
99
99
  ? `${finalAttribute.xdefault}`
100
- : undefined, finalAttribute.size));
100
+ : undefined));
101
101
  }
102
102
  break;
103
103
  case "integer":
@@ -55,7 +55,7 @@ const attributesSame = (databaseAttribute, configAttribute) => {
55
55
  export const createOrUpdateAttribute = async (db, dbId, collection, attribute) => {
56
56
  let action = "create";
57
57
  let foundAttribute;
58
- const updateEnabled = false;
58
+ const updateEnabled = true;
59
59
  let finalAttribute = attribute;
60
60
  try {
61
61
  const collectionAttr = collection.attributes.find(
@@ -124,10 +124,10 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
124
124
  switch (finalAttribute.type) {
125
125
  case "string":
126
126
  if (action === "create") {
127
- await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault || (finalAttribute.required ? undefined : null), finalAttribute.array || false, finalAttribute.encrypted));
127
+ await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault || null, finalAttribute.array || false, finalAttribute.encrypted));
128
128
  }
129
129
  else {
130
- await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || (finalAttribute.required ? undefined : ""), finalAttribute.size));
130
+ await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || null));
131
131
  }
132
132
  break;
133
133
  case "integer":
@@ -140,7 +140,7 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
140
140
  BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
141
141
  delete finalAttribute.max;
142
142
  }
143
- await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault || (finalAttribute.required ? undefined : ""), finalAttribute.array || false));
143
+ await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault || null, finalAttribute.array || false));
144
144
  }
145
145
  else {
146
146
  if (finalAttribute.min &&
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.70",
4
+ "version": "0.9.72",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "lodash": "^4.17.21",
39
39
  "luxon": "^3.5.0",
40
40
  "nanostores": "^0.10.3",
41
- "node-appwrite": "^14.1.0",
41
+ "node-appwrite": "14.0.0",
42
42
  "tsx": "^4.17.0",
43
43
  "ulidx": "^2.4.0",
44
44
  "winston": "^3.14.2",
@@ -151,7 +151,6 @@ export const createOrUpdateAttribute = async (
151
151
  finalAttribute.xdefault
152
152
  ? `${finalAttribute.xdefault}`
153
153
  : undefined,
154
- finalAttribute.size
155
154
  )
156
155
  );
157
156
  }
@@ -77,7 +77,7 @@ export const createOrUpdateAttribute = async (
77
77
  ): Promise<void> => {
78
78
  let action = "create";
79
79
  let foundAttribute: Attribute | undefined;
80
- const updateEnabled = false;
80
+ const updateEnabled = true;
81
81
  let finalAttribute: any = attribute;
82
82
  try {
83
83
  const collectionAttr = collection.attributes.find(
@@ -165,7 +165,7 @@ export const createOrUpdateAttribute = async (
165
165
  finalAttribute.key,
166
166
  finalAttribute.size,
167
167
  finalAttribute.required || false,
168
- finalAttribute.xdefault || (finalAttribute.required ? undefined : null),
168
+ finalAttribute.xdefault || null,
169
169
  finalAttribute.array || false,
170
170
  finalAttribute.encrypted
171
171
  )
@@ -178,8 +178,7 @@ export const createOrUpdateAttribute = async (
178
178
  collection.$id,
179
179
  finalAttribute.key,
180
180
  finalAttribute.required || false,
181
- finalAttribute.xdefault || (finalAttribute.required ? undefined : ""),
182
- finalAttribute.size
181
+ finalAttribute.xdefault || null,
183
182
  )
184
183
  );
185
184
  }
@@ -207,7 +206,7 @@ export const createOrUpdateAttribute = async (
207
206
  finalAttribute.required || false,
208
207
  finalAttribute.min || -2147483647,
209
208
  finalAttribute.max || 2147483647,
210
- finalAttribute.xdefault || (finalAttribute.required ? undefined : ""),
209
+ finalAttribute.xdefault || null,
211
210
  finalAttribute.array || false
212
211
  )
213
212
  );