appwrite-utils-cli 0.9.71 → 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,7 @@ 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
127
128
  - 0.9.71: Reverted `node-appwrite` to 14, this seems to fix the xdefault error
128
129
  - 0.9.70: I think I stopped it from deleting attributes, my bad on that
129
130
  - 0.9.68: Temporarily disabled updating Attributes until `updateStringAttribute` is fixed -- it just deletes them now
@@ -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 : "")));
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.71",
4
+ "version": "0.9.72",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -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,7 +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 : ""),
181
+ finalAttribute.xdefault || null,
182
182
  )
183
183
  );
184
184
  }
@@ -206,7 +206,7 @@ export const createOrUpdateAttribute = async (
206
206
  finalAttribute.required || false,
207
207
  finalAttribute.min || -2147483647,
208
208
  finalAttribute.max || 2147483647,
209
- finalAttribute.xdefault || (finalAttribute.required ? undefined : ""),
209
+ finalAttribute.xdefault || null,
210
210
  finalAttribute.array || false
211
211
  )
212
212
  );