appwrite-utils-cli 0.10.77 → 0.10.79
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 +2 -1
- package/dist/migrations/attributes.js +97 -38
- package/package.json +2 -2
- package/src/migrations/attributes.ts +110 -39
package/README.md
CHANGED
@@ -115,7 +115,7 @@ npx appwrite-utils-cli appwrite-migrate --transfer --fromBucketId sourceBucketId
|
|
115
115
|
|
116
116
|
### Update Function Specifications
|
117
117
|
|
118
|
-
**NOTE: IF IT DOES NOT WORK AND YOU ARE SELF-HOSTED, PLEASE SET MAX CPU_PER_FUNCTION AND RAM_PER_FUNCTION IN YOUR ENV VARS TO > 0, THIS IS A BUG IN 1.6.0**
|
118
|
+
**NOTE: IF IT DOES NOT WORK AND YOU ARE SELF-HOSTED, PLEASE SET MAX CPU_PER_FUNCTION AND RAM_PER_FUNCTION IN YOUR ENV VARS TO > 0, THIS IS A BUG IN 1.6.0 -- YOU SET THE FUNCTION RAM IN MB**
|
119
119
|
|
120
120
|
Update the CPU and RAM specifications for a function:
|
121
121
|
|
@@ -150,6 +150,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
150
150
|
|
151
151
|
## Changelog
|
152
152
|
|
153
|
+
- 0.10.78: Fixed `attributesSame` so it will properly update attributes that have changed
|
153
154
|
- 0.10.77: Added disclaimer to update function specifications for bug
|
154
155
|
- 0.10.76: Updated CLI commands to not require an `appwriteConfig.ts` if you set API Key, ProjectId, and Endpoint
|
155
156
|
- 0.10.75: Fixed slight issue writing ZOD Schema for collection without any attributes
|
@@ -5,23 +5,39 @@ import _ from "lodash";
|
|
5
5
|
import { tryAwaitWithRetry } from "../utils/helperFunctions.js";
|
6
6
|
const attributesSame = (databaseAttribute, configAttribute) => {
|
7
7
|
const attributesToCheck = [
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
"key",
|
9
|
+
"type",
|
10
|
+
"array",
|
11
|
+
"encrypted",
|
12
|
+
"required",
|
13
|
+
"size",
|
14
|
+
"min",
|
15
|
+
"max",
|
16
|
+
"xdefault",
|
17
|
+
"elements",
|
18
|
+
"relationType",
|
19
|
+
"twoWay",
|
20
|
+
"twoWayKey",
|
21
|
+
"onDelete",
|
22
|
+
"relatedCollection",
|
23
23
|
];
|
24
|
-
return attributesToCheck.every(attr => {
|
24
|
+
return attributesToCheck.every((attr) => {
|
25
|
+
// Special handling for min/max values
|
26
|
+
if (attr === "min" || attr === "max") {
|
27
|
+
const dbValue = databaseAttribute[attr];
|
28
|
+
const configValue = configAttribute[attr];
|
29
|
+
// Use type-specific default values when comparing
|
30
|
+
if (databaseAttribute.type === "integer") {
|
31
|
+
const defaultMin = attr === "min" ? -2147483647 : undefined;
|
32
|
+
const defaultMax = attr === "max" ? 2147483647 : undefined;
|
33
|
+
return (dbValue ?? defaultMin) === (configValue ?? defaultMax);
|
34
|
+
}
|
35
|
+
if (databaseAttribute.type === "float") {
|
36
|
+
const defaultMin = attr === "min" ? -2147483647 : undefined;
|
37
|
+
const defaultMax = attr === "max" ? 2147483647 : undefined;
|
38
|
+
return (dbValue ?? defaultMin) === (configValue ?? defaultMax);
|
39
|
+
}
|
40
|
+
}
|
25
41
|
// Check if both objects have the attribute
|
26
42
|
const dbHasAttr = attr in databaseAttribute;
|
27
43
|
const configHasAttr = attr in configAttribute;
|
@@ -30,7 +46,8 @@ const attributesSame = (databaseAttribute, configAttribute) => {
|
|
30
46
|
const dbValue = databaseAttribute[attr];
|
31
47
|
const configValue = configAttribute[attr];
|
32
48
|
// Consider undefined and null as equivalent
|
33
|
-
if ((dbValue === undefined || dbValue === null) &&
|
49
|
+
if ((dbValue === undefined || dbValue === null) &&
|
50
|
+
(configValue === undefined || configValue === null)) {
|
34
51
|
return true;
|
35
52
|
}
|
36
53
|
return dbValue === configValue;
|
@@ -66,19 +83,25 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
66
83
|
catch (error) {
|
67
84
|
foundAttribute = undefined;
|
68
85
|
}
|
69
|
-
if (foundAttribute &&
|
86
|
+
if (foundAttribute &&
|
87
|
+
attributesSame(foundAttribute, attribute) &&
|
88
|
+
updateEnabled) {
|
70
89
|
finalAttribute = {
|
71
90
|
...attribute,
|
72
91
|
...foundAttribute,
|
73
92
|
};
|
74
93
|
action = "update";
|
75
94
|
}
|
76
|
-
else if (foundAttribute &&
|
95
|
+
else if (foundAttribute &&
|
96
|
+
!attributesSame(foundAttribute, attribute) &&
|
97
|
+
updateEnabled) {
|
77
98
|
console.log(`Updating attribute with same key ${attribute.key} but different values`);
|
78
99
|
finalAttribute = attribute;
|
79
100
|
action = "update";
|
80
101
|
}
|
81
|
-
else if (!updateEnabled &&
|
102
|
+
else if (!updateEnabled &&
|
103
|
+
foundAttribute &&
|
104
|
+
!attributesSame(foundAttribute, attribute)) {
|
82
105
|
await db.deleteAttribute(dbId, collection.$id, attribute.key);
|
83
106
|
console.log(`Deleted attribute: ${attribute.key} to recreate it because they diff (update disabled temporarily)`);
|
84
107
|
return;
|
@@ -125,10 +148,14 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
125
148
|
switch (finalAttribute.type) {
|
126
149
|
case "string":
|
127
150
|
if (action === "create") {
|
128
|
-
await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
151
|
+
await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
152
|
+
? finalAttribute.xdefault
|
153
|
+
: null, finalAttribute.array || false, finalAttribute.encrypted));
|
129
154
|
}
|
130
155
|
else {
|
131
|
-
await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
156
|
+
await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
157
|
+
? finalAttribute.xdefault
|
158
|
+
: null));
|
132
159
|
}
|
133
160
|
break;
|
134
161
|
case "integer":
|
@@ -141,7 +168,9 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
141
168
|
BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
|
142
169
|
delete finalAttribute.max;
|
143
170
|
}
|
144
|
-
await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
171
|
+
await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
172
|
+
? finalAttribute.xdefault
|
173
|
+
: null, finalAttribute.array || false));
|
145
174
|
}
|
146
175
|
else {
|
147
176
|
if (finalAttribute.min &&
|
@@ -152,63 +181,93 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
152
181
|
BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
|
153
182
|
delete finalAttribute.max;
|
154
183
|
}
|
155
|
-
await tryAwaitWithRetry(async () => await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
184
|
+
await tryAwaitWithRetry(async () => await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
185
|
+
? finalAttribute.xdefault
|
186
|
+
: null));
|
156
187
|
}
|
157
188
|
break;
|
158
189
|
case "float":
|
159
190
|
if (action === "create") {
|
160
|
-
await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
191
|
+
await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
192
|
+
? finalAttribute.xdefault
|
193
|
+
: null, finalAttribute.array || false));
|
161
194
|
}
|
162
195
|
else {
|
163
|
-
await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
196
|
+
await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
197
|
+
? finalAttribute.xdefault
|
198
|
+
: null));
|
164
199
|
}
|
165
200
|
break;
|
166
201
|
case "boolean":
|
167
202
|
if (action === "create") {
|
168
|
-
await tryAwaitWithRetry(async () => await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
203
|
+
await tryAwaitWithRetry(async () => await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
204
|
+
? finalAttribute.xdefault
|
205
|
+
: null, finalAttribute.array || false));
|
169
206
|
}
|
170
207
|
else {
|
171
|
-
await tryAwaitWithRetry(async () => await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
208
|
+
await tryAwaitWithRetry(async () => await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
209
|
+
? finalAttribute.xdefault
|
210
|
+
: null));
|
172
211
|
}
|
173
212
|
break;
|
174
213
|
case "datetime":
|
175
214
|
if (action === "create") {
|
176
|
-
await tryAwaitWithRetry(async () => await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
215
|
+
await tryAwaitWithRetry(async () => await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
216
|
+
? finalAttribute.xdefault
|
217
|
+
: null, finalAttribute.array || false));
|
177
218
|
}
|
178
219
|
else {
|
179
|
-
await tryAwaitWithRetry(async () => await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
220
|
+
await tryAwaitWithRetry(async () => await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
221
|
+
? finalAttribute.xdefault
|
222
|
+
: null));
|
180
223
|
}
|
181
224
|
break;
|
182
225
|
case "email":
|
183
226
|
if (action === "create") {
|
184
|
-
await tryAwaitWithRetry(async () => await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
227
|
+
await tryAwaitWithRetry(async () => await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
228
|
+
? finalAttribute.xdefault
|
229
|
+
: null, finalAttribute.array || false));
|
185
230
|
}
|
186
231
|
else {
|
187
|
-
await tryAwaitWithRetry(async () => await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
232
|
+
await tryAwaitWithRetry(async () => await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
233
|
+
? finalAttribute.xdefault
|
234
|
+
: null));
|
188
235
|
}
|
189
236
|
break;
|
190
237
|
case "ip":
|
191
238
|
if (action === "create") {
|
192
|
-
await tryAwaitWithRetry(async () => await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
239
|
+
await tryAwaitWithRetry(async () => await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
240
|
+
? finalAttribute.xdefault
|
241
|
+
: null, finalAttribute.array || false));
|
193
242
|
}
|
194
243
|
else {
|
195
|
-
await tryAwaitWithRetry(async () => await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
244
|
+
await tryAwaitWithRetry(async () => await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
245
|
+
? finalAttribute.xdefault
|
246
|
+
: null));
|
196
247
|
}
|
197
248
|
break;
|
198
249
|
case "url":
|
199
250
|
if (action === "create") {
|
200
|
-
await tryAwaitWithRetry(async () => await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
251
|
+
await tryAwaitWithRetry(async () => await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
252
|
+
? finalAttribute.xdefault
|
253
|
+
: null, finalAttribute.array || false));
|
201
254
|
}
|
202
255
|
else {
|
203
|
-
await tryAwaitWithRetry(async () => await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
256
|
+
await tryAwaitWithRetry(async () => await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
257
|
+
? finalAttribute.xdefault
|
258
|
+
: null));
|
204
259
|
}
|
205
260
|
break;
|
206
261
|
case "enum":
|
207
262
|
if (action === "create") {
|
208
|
-
await tryAwaitWithRetry(async () => await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
263
|
+
await tryAwaitWithRetry(async () => await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
264
|
+
? finalAttribute.xdefault
|
265
|
+
: null, finalAttribute.array || false));
|
209
266
|
}
|
210
267
|
else {
|
211
|
-
await tryAwaitWithRetry(async () => await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
268
|
+
await tryAwaitWithRetry(async () => await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
269
|
+
? finalAttribute.xdefault
|
270
|
+
: null));
|
212
271
|
}
|
213
272
|
break;
|
214
273
|
case "relationship":
|
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.
|
4
|
+
"version": "0.10.79",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -31,7 +31,7 @@
|
|
31
31
|
},
|
32
32
|
"dependencies": {
|
33
33
|
"@types/inquirer": "^9.0.7",
|
34
|
-
"appwrite-utils": "^0.
|
34
|
+
"appwrite-utils": "^0.4.0",
|
35
35
|
"chalk": "^5.3.0",
|
36
36
|
"cli-progress": "^3.12.0",
|
37
37
|
"commander": "^12.1.0",
|
@@ -13,24 +13,42 @@ const attributesSame = (
|
|
13
13
|
configAttribute: Attribute
|
14
14
|
): boolean => {
|
15
15
|
const attributesToCheck = [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
"key",
|
17
|
+
"type",
|
18
|
+
"array",
|
19
|
+
"encrypted",
|
20
|
+
"required",
|
21
|
+
"size",
|
22
|
+
"min",
|
23
|
+
"max",
|
24
|
+
"xdefault",
|
25
|
+
"elements",
|
26
|
+
"relationType",
|
27
|
+
"twoWay",
|
28
|
+
"twoWayKey",
|
29
|
+
"onDelete",
|
30
|
+
"relatedCollection",
|
31
31
|
];
|
32
32
|
|
33
|
-
return attributesToCheck.every(attr => {
|
33
|
+
return attributesToCheck.every((attr) => {
|
34
|
+
// Special handling for min/max values
|
35
|
+
if (attr === "min" || attr === "max") {
|
36
|
+
const dbValue = databaseAttribute[attr as keyof typeof databaseAttribute];
|
37
|
+
const configValue = configAttribute[attr as keyof typeof configAttribute];
|
38
|
+
|
39
|
+
// Use type-specific default values when comparing
|
40
|
+
if (databaseAttribute.type === "integer") {
|
41
|
+
const defaultMin = attr === "min" ? -2147483647 : undefined;
|
42
|
+
const defaultMax = attr === "max" ? 2147483647 : undefined;
|
43
|
+
return (dbValue ?? defaultMin) === (configValue ?? defaultMax);
|
44
|
+
}
|
45
|
+
if (databaseAttribute.type === "float") {
|
46
|
+
const defaultMin = attr === "min" ? -2147483647 : undefined;
|
47
|
+
const defaultMax = attr === "max" ? 2147483647 : undefined;
|
48
|
+
return (dbValue ?? defaultMin) === (configValue ?? defaultMax);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
34
52
|
// Check if both objects have the attribute
|
35
53
|
const dbHasAttr = attr in databaseAttribute;
|
36
54
|
const configHasAttr = attr in configAttribute;
|
@@ -41,7 +59,10 @@ const attributesSame = (
|
|
41
59
|
const configValue = configAttribute[attr as keyof typeof configAttribute];
|
42
60
|
|
43
61
|
// Consider undefined and null as equivalent
|
44
|
-
if (
|
62
|
+
if (
|
63
|
+
(dbValue === undefined || dbValue === null) &&
|
64
|
+
(configValue === undefined || configValue === null)
|
65
|
+
) {
|
45
66
|
return true;
|
46
67
|
}
|
47
68
|
|
@@ -89,21 +110,35 @@ export const createOrUpdateAttribute = async (
|
|
89
110
|
foundAttribute = undefined;
|
90
111
|
}
|
91
112
|
|
92
|
-
if (
|
113
|
+
if (
|
114
|
+
foundAttribute &&
|
115
|
+
attributesSame(foundAttribute, attribute) &&
|
116
|
+
updateEnabled
|
117
|
+
) {
|
93
118
|
finalAttribute = {
|
94
119
|
...attribute,
|
95
120
|
...foundAttribute,
|
96
121
|
};
|
97
122
|
action = "update";
|
98
|
-
} else if (
|
123
|
+
} else if (
|
124
|
+
foundAttribute &&
|
125
|
+
!attributesSame(foundAttribute, attribute) &&
|
126
|
+
updateEnabled
|
127
|
+
) {
|
99
128
|
console.log(
|
100
129
|
`Updating attribute with same key ${attribute.key} but different values`
|
101
130
|
);
|
102
131
|
finalAttribute = attribute;
|
103
132
|
action = "update";
|
104
|
-
} else if (
|
133
|
+
} else if (
|
134
|
+
!updateEnabled &&
|
135
|
+
foundAttribute &&
|
136
|
+
!attributesSame(foundAttribute, attribute)
|
137
|
+
) {
|
105
138
|
await db.deleteAttribute(dbId, collection.$id, attribute.key);
|
106
|
-
console.log(
|
139
|
+
console.log(
|
140
|
+
`Deleted attribute: ${attribute.key} to recreate it because they diff (update disabled temporarily)`
|
141
|
+
);
|
107
142
|
return;
|
108
143
|
}
|
109
144
|
|
@@ -166,7 +201,9 @@ export const createOrUpdateAttribute = async (
|
|
166
201
|
finalAttribute.key,
|
167
202
|
finalAttribute.size,
|
168
203
|
finalAttribute.required || false,
|
169
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
204
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
205
|
+
? finalAttribute.xdefault
|
206
|
+
: null,
|
170
207
|
finalAttribute.array || false,
|
171
208
|
finalAttribute.encrypted
|
172
209
|
)
|
@@ -179,7 +216,9 @@ export const createOrUpdateAttribute = async (
|
|
179
216
|
collection.$id,
|
180
217
|
finalAttribute.key,
|
181
218
|
finalAttribute.required || false,
|
182
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
219
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
220
|
+
? finalAttribute.xdefault
|
221
|
+
: null
|
183
222
|
)
|
184
223
|
);
|
185
224
|
}
|
@@ -207,7 +246,9 @@ export const createOrUpdateAttribute = async (
|
|
207
246
|
finalAttribute.required || false,
|
208
247
|
finalAttribute.min || -2147483647,
|
209
248
|
finalAttribute.max || 2147483647,
|
210
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
249
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
250
|
+
? finalAttribute.xdefault
|
251
|
+
: null,
|
211
252
|
finalAttribute.array || false
|
212
253
|
)
|
213
254
|
);
|
@@ -233,7 +274,9 @@ export const createOrUpdateAttribute = async (
|
|
233
274
|
finalAttribute.required || false,
|
234
275
|
finalAttribute.min || -2147483647,
|
235
276
|
finalAttribute.max || 2147483647,
|
236
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
277
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
278
|
+
? finalAttribute.xdefault
|
279
|
+
: null
|
237
280
|
)
|
238
281
|
);
|
239
282
|
}
|
@@ -249,7 +292,9 @@ export const createOrUpdateAttribute = async (
|
|
249
292
|
finalAttribute.required || false,
|
250
293
|
finalAttribute.min || -2147483647,
|
251
294
|
finalAttribute.max || 2147483647,
|
252
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
295
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
296
|
+
? finalAttribute.xdefault
|
297
|
+
: null,
|
253
298
|
finalAttribute.array || false
|
254
299
|
)
|
255
300
|
);
|
@@ -263,7 +308,9 @@ export const createOrUpdateAttribute = async (
|
|
263
308
|
finalAttribute.required || false,
|
264
309
|
finalAttribute.min || -2147483647,
|
265
310
|
finalAttribute.max || 2147483647,
|
266
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
311
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
312
|
+
? finalAttribute.xdefault
|
313
|
+
: null
|
267
314
|
)
|
268
315
|
);
|
269
316
|
}
|
@@ -277,7 +324,9 @@ export const createOrUpdateAttribute = async (
|
|
277
324
|
collection.$id,
|
278
325
|
finalAttribute.key,
|
279
326
|
finalAttribute.required || false,
|
280
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
327
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
328
|
+
? finalAttribute.xdefault
|
329
|
+
: null,
|
281
330
|
finalAttribute.array || false
|
282
331
|
)
|
283
332
|
);
|
@@ -289,7 +338,9 @@ export const createOrUpdateAttribute = async (
|
|
289
338
|
collection.$id,
|
290
339
|
finalAttribute.key,
|
291
340
|
finalAttribute.required || false,
|
292
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
341
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
342
|
+
? finalAttribute.xdefault
|
343
|
+
: null
|
293
344
|
)
|
294
345
|
);
|
295
346
|
}
|
@@ -303,7 +354,9 @@ export const createOrUpdateAttribute = async (
|
|
303
354
|
collection.$id,
|
304
355
|
finalAttribute.key,
|
305
356
|
finalAttribute.required || false,
|
306
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
357
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
358
|
+
? finalAttribute.xdefault
|
359
|
+
: null,
|
307
360
|
finalAttribute.array || false
|
308
361
|
)
|
309
362
|
);
|
@@ -315,7 +368,9 @@ export const createOrUpdateAttribute = async (
|
|
315
368
|
collection.$id,
|
316
369
|
finalAttribute.key,
|
317
370
|
finalAttribute.required || false,
|
318
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
371
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
372
|
+
? finalAttribute.xdefault
|
373
|
+
: null
|
319
374
|
)
|
320
375
|
);
|
321
376
|
}
|
@@ -329,7 +384,9 @@ export const createOrUpdateAttribute = async (
|
|
329
384
|
collection.$id,
|
330
385
|
finalAttribute.key,
|
331
386
|
finalAttribute.required || false,
|
332
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
387
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
388
|
+
? finalAttribute.xdefault
|
389
|
+
: null,
|
333
390
|
finalAttribute.array || false
|
334
391
|
)
|
335
392
|
);
|
@@ -341,7 +398,9 @@ export const createOrUpdateAttribute = async (
|
|
341
398
|
collection.$id,
|
342
399
|
finalAttribute.key,
|
343
400
|
finalAttribute.required || false,
|
344
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
401
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
402
|
+
? finalAttribute.xdefault
|
403
|
+
: null
|
345
404
|
)
|
346
405
|
);
|
347
406
|
}
|
@@ -355,7 +414,9 @@ export const createOrUpdateAttribute = async (
|
|
355
414
|
collection.$id,
|
356
415
|
finalAttribute.key,
|
357
416
|
finalAttribute.required || false,
|
358
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
417
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
418
|
+
? finalAttribute.xdefault
|
419
|
+
: null,
|
359
420
|
finalAttribute.array || false
|
360
421
|
)
|
361
422
|
);
|
@@ -367,7 +428,9 @@ export const createOrUpdateAttribute = async (
|
|
367
428
|
collection.$id,
|
368
429
|
finalAttribute.key,
|
369
430
|
finalAttribute.required || false,
|
370
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
431
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
432
|
+
? finalAttribute.xdefault
|
433
|
+
: null
|
371
434
|
)
|
372
435
|
);
|
373
436
|
}
|
@@ -381,7 +444,9 @@ export const createOrUpdateAttribute = async (
|
|
381
444
|
collection.$id,
|
382
445
|
finalAttribute.key,
|
383
446
|
finalAttribute.required || false,
|
384
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
447
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
448
|
+
? finalAttribute.xdefault
|
449
|
+
: null,
|
385
450
|
finalAttribute.array || false
|
386
451
|
)
|
387
452
|
);
|
@@ -393,7 +458,9 @@ export const createOrUpdateAttribute = async (
|
|
393
458
|
collection.$id,
|
394
459
|
finalAttribute.key,
|
395
460
|
finalAttribute.required || false,
|
396
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
461
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
462
|
+
? finalAttribute.xdefault
|
463
|
+
: null
|
397
464
|
)
|
398
465
|
);
|
399
466
|
}
|
@@ -408,7 +475,9 @@ export const createOrUpdateAttribute = async (
|
|
408
475
|
finalAttribute.key,
|
409
476
|
finalAttribute.elements,
|
410
477
|
finalAttribute.required || false,
|
411
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
478
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
479
|
+
? finalAttribute.xdefault
|
480
|
+
: null,
|
412
481
|
finalAttribute.array || false
|
413
482
|
)
|
414
483
|
);
|
@@ -421,7 +490,9 @@ export const createOrUpdateAttribute = async (
|
|
421
490
|
finalAttribute.key,
|
422
491
|
finalAttribute.elements,
|
423
492
|
finalAttribute.required || false,
|
424
|
-
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
493
|
+
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
494
|
+
? finalAttribute.xdefault
|
495
|
+
: null
|
425
496
|
)
|
426
497
|
);
|
427
498
|
}
|