appwrite-utils-cli 0.9.55 → 0.9.56
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.56: Changed the updateAttribute so it doesn't always update attributes and hopefully fixed the required error
|
127
128
|
- 0.9.55: Updated to use `node-appwrite@14` for appwrite 1.6.0
|
128
129
|
- 0.9.54: Added small delay (`100ms`) between collection deletions, reduced other delays from `1000` to `500/250ms`
|
129
130
|
- 0.9.53: Reduced delay, went too far
|
@@ -35,10 +35,7 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
35
35
|
"onDelete" in attribute
|
36
36
|
? foundAttribute.onDelete !== attribute.onDelete
|
37
37
|
: false;
|
38
|
-
if (requiredChanged ||
|
39
|
-
xdefaultChanged ||
|
40
|
-
onDeleteChanged ||
|
41
|
-
!attributesSame(foundAttribute, attribute)) {
|
38
|
+
if (requiredChanged || xdefaultChanged || onDeleteChanged) {
|
42
39
|
console.log(`Updating attribute: ${attribute.key}\nRequired changed: ${requiredChanged}\nDefault changed: ${xdefaultChanged}\nOnDelete changed: ${onDeleteChanged}`);
|
43
40
|
console.log(`Found attribute: ${JSON.stringify(foundAttribute, null, 2)}`);
|
44
41
|
console.log(`New attribute: ${JSON.stringify(attribute, null, 2)}`);
|
@@ -93,10 +90,14 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
93
90
|
switch (finalAttribute.type) {
|
94
91
|
case "string":
|
95
92
|
if (action === "create") {
|
96
|
-
await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault
|
93
|
+
await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault
|
94
|
+
? `${finalAttribute.xdefault}`
|
95
|
+
: undefined, finalAttribute.array || false, finalAttribute.encrypted));
|
97
96
|
}
|
98
97
|
else {
|
99
|
-
await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault
|
98
|
+
await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault
|
99
|
+
? `${finalAttribute.xdefault}`
|
100
|
+
: undefined, finalAttribute.size));
|
100
101
|
}
|
101
102
|
break;
|
102
103
|
case "integer":
|
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.
|
4
|
+
"version": "0.9.56",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -58,12 +58,7 @@ export const createOrUpdateAttribute = async (
|
|
58
58
|
? foundAttribute.onDelete !== attribute.onDelete
|
59
59
|
: false;
|
60
60
|
|
61
|
-
if (
|
62
|
-
requiredChanged ||
|
63
|
-
xdefaultChanged ||
|
64
|
-
onDeleteChanged ||
|
65
|
-
!attributesSame(foundAttribute, attribute)
|
66
|
-
) {
|
61
|
+
if (requiredChanged || xdefaultChanged || onDeleteChanged) {
|
67
62
|
console.log(
|
68
63
|
`Updating attribute: ${attribute.key}\nRequired changed: ${requiredChanged}\nDefault changed: ${xdefaultChanged}\nOnDelete changed: ${onDeleteChanged}`
|
69
64
|
);
|
@@ -138,7 +133,9 @@ export const createOrUpdateAttribute = async (
|
|
138
133
|
finalAttribute.key,
|
139
134
|
finalAttribute.size,
|
140
135
|
finalAttribute.required || false,
|
141
|
-
|
136
|
+
finalAttribute.xdefault
|
137
|
+
? `${finalAttribute.xdefault}`
|
138
|
+
: undefined,
|
142
139
|
finalAttribute.array || false,
|
143
140
|
finalAttribute.encrypted
|
144
141
|
)
|
@@ -151,7 +148,10 @@ export const createOrUpdateAttribute = async (
|
|
151
148
|
collection.$id,
|
152
149
|
finalAttribute.key,
|
153
150
|
finalAttribute.required || false,
|
154
|
-
|
151
|
+
finalAttribute.xdefault
|
152
|
+
? `${finalAttribute.xdefault}`
|
153
|
+
: undefined,
|
154
|
+
finalAttribute.size
|
155
155
|
)
|
156
156
|
);
|
157
157
|
}
|