appwrite-utils-cli 0.9.64 → 0.9.66

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.65: Temporary fix for Appwrite's `updateStringAttribute` bug
127
128
  - 0.9.64: Fixed string attribute requiring xdefault
128
129
  - 0.9.61: Remove fileURLToPath -- should hopefully fix windows
129
130
  - 0.9.60: Fix init command to repository URL
@@ -4,14 +4,12 @@ import { nameToIdMapping, enqueueOperation } from "./queue.js";
4
4
  import _ from "lodash";
5
5
  import { tryAwaitWithRetry } from "../utils/helperFunctions.js";
6
6
  const attributesSame = (databaseAttribute, configAttribute) => {
7
- return (databaseAttribute.key == configAttribute.key &&
8
- databaseAttribute.type == configAttribute.type &&
9
- databaseAttribute.array == configAttribute.array);
7
+ return databaseAttribute.key === configAttribute.key;
10
8
  };
11
9
  export const createOrUpdateAttribute = async (db, dbId, collection, attribute) => {
12
10
  let action = "create";
13
11
  let foundAttribute;
14
- const updateEnabled = false;
12
+ const updateEnabled = true;
15
13
  let finalAttribute = attribute;
16
14
  try {
17
15
  const collectionAttr = collection.attributes.find(
@@ -22,30 +20,21 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
22
20
  catch (error) {
23
21
  foundAttribute = undefined;
24
22
  }
25
- if (foundAttribute &&
26
- attributesSame(foundAttribute, attribute) &&
27
- updateEnabled) {
28
- // Check if mutable properties have changed and set action to "update" if necessary
29
- const requiredChanged = "required" in foundAttribute && "required" in attribute
30
- ? foundAttribute.required !== attribute.required
31
- : false;
32
- // const xdefaultChanged =
33
- // "xdefault" in foundAttribute && "xdefault" in attribute
34
- // ? foundAttribute.xdefault !== attribute.xdefault
35
- // : false;
36
- const onDeleteChanged = foundAttribute.type === "relationship" &&
37
- attribute.type === "relationship" &&
38
- "onDelete" in foundAttribute &&
39
- "onDelete" in attribute
40
- ? foundAttribute.onDelete !== attribute.onDelete
41
- : false;
42
- if (requiredChanged || onDeleteChanged) {
43
- console.log(`Required changed: ${requiredChanged}\nOnDelete changed: ${onDeleteChanged}`);
44
- console.log(`Found attribute: ${JSON.stringify(foundAttribute, null, 2)}`);
45
- console.log(`Attribute: ${JSON.stringify(attribute, null, 2)}`);
23
+ if (foundAttribute && updateEnabled) {
24
+ const changedProperties = Object.keys(attribute).filter(key => {
25
+ // Only consider properties that are defined and not null in the new attribute
26
+ if (attribute[key] !== undefined && attribute[key] !== null && attribute[key] !== '') {
27
+ // Check if the property exists in the found attribute and is different
28
+ return foundAttribute[key] !== attribute[key];
29
+ }
30
+ return false;
31
+ });
32
+ if (changedProperties.length > 0) {
33
+ console.log(`Changed properties: ${changedProperties.join(', ')}`);
34
+ // Merge the attributes, prioritizing the new attribute's values
46
35
  finalAttribute = {
47
- ...attribute,
48
36
  ...foundAttribute,
37
+ ...attribute,
49
38
  };
50
39
  action = "update";
51
40
  }
@@ -54,16 +43,13 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
54
43
  return;
55
44
  }
56
45
  }
57
- else if (foundAttribute &&
58
- !attributesSame(foundAttribute, attribute) &&
59
- updateEnabled) {
60
- console.log(`Deleting attribute with same key ${attribute.key} -- but different values -- ${JSON.stringify(attribute, null, 2)} -- ${JSON.stringify(foundAttribute, null, 2)}`);
61
- await db.deleteAttribute(dbId, collection.$id, attribute.key);
62
- // After deletion, you might want to create the attribute anew
46
+ else if (!foundAttribute) {
47
+ // If the attribute doesn't exist, we'll create it
63
48
  finalAttribute = attribute;
64
49
  action = "create";
65
50
  }
66
- else if (!updateEnabled && foundAttribute) {
51
+ else if (!updateEnabled) {
52
+ // If updates are not enabled and the attribute exists, we do nothing
67
53
  return;
68
54
  }
69
55
  // Relationship attribute logic with adjustments
@@ -106,10 +92,10 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
106
92
  switch (finalAttribute.type) {
107
93
  case "string":
108
94
  if (action === "create") {
109
- await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array || false, finalAttribute.encrypted));
95
+ await tryAwaitWithRetry(async () => await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array, finalAttribute.encrypted));
110
96
  }
111
97
  else {
112
- await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
98
+ await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.size));
113
99
  }
114
100
  break;
115
101
  case "integer":
@@ -122,7 +108,7 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
122
108
  BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
123
109
  delete finalAttribute.max;
124
110
  }
125
- await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array));
111
+ await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault, finalAttribute.array));
126
112
  }
127
113
  else {
128
114
  if (finalAttribute.min &&
@@ -133,63 +119,63 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
133
119
  BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
134
120
  delete finalAttribute.max;
135
121
  }
136
- await tryAwaitWithRetry(async () => await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined));
122
+ await tryAwaitWithRetry(async () => await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault));
137
123
  }
138
124
  break;
139
125
  case "float":
140
126
  if (action === "create") {
141
- await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array));
127
+ await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault, finalAttribute.array));
142
128
  }
143
129
  else {
144
- await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined));
130
+ await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault));
145
131
  }
146
132
  break;
147
133
  case "boolean":
148
134
  if (action === "create") {
149
- await tryAwaitWithRetry(async () => await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
135
+ await tryAwaitWithRetry(async () => await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
150
136
  }
151
137
  else {
152
- await tryAwaitWithRetry(async () => await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || null));
138
+ await tryAwaitWithRetry(async () => await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault));
153
139
  }
154
140
  break;
155
141
  case "datetime":
156
142
  if (action === "create") {
157
- await tryAwaitWithRetry(async () => await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
143
+ await tryAwaitWithRetry(async () => await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
158
144
  }
159
145
  else {
160
- await tryAwaitWithRetry(async () => await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
146
+ await tryAwaitWithRetry(async () => await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault));
161
147
  }
162
148
  break;
163
149
  case "email":
164
150
  if (action === "create") {
165
- await tryAwaitWithRetry(async () => await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
151
+ await tryAwaitWithRetry(async () => await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
166
152
  }
167
153
  else {
168
- await tryAwaitWithRetry(async () => await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
154
+ await tryAwaitWithRetry(async () => await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault));
169
155
  }
170
156
  break;
171
157
  case "ip":
172
158
  if (action === "create") {
173
- await tryAwaitWithRetry(async () => await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
159
+ await tryAwaitWithRetry(async () => await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
174
160
  }
175
161
  else {
176
- await tryAwaitWithRetry(async () => await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
162
+ await tryAwaitWithRetry(async () => await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault));
177
163
  }
178
164
  break;
179
165
  case "url":
180
166
  if (action === "create") {
181
- await tryAwaitWithRetry(async () => await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
167
+ await tryAwaitWithRetry(async () => await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
182
168
  }
183
169
  else {
184
- await tryAwaitWithRetry(async () => await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
170
+ await tryAwaitWithRetry(async () => await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required, finalAttribute.xdefault));
185
171
  }
186
172
  break;
187
173
  case "enum":
188
174
  if (action === "create") {
189
- await tryAwaitWithRetry(async () => await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
175
+ await tryAwaitWithRetry(async () => await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required, finalAttribute.xdefault, finalAttribute.array));
190
176
  }
191
177
  else {
192
- await tryAwaitWithRetry(async () => await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined));
178
+ await tryAwaitWithRetry(async () => await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required, finalAttribute.xdefault));
193
179
  }
194
180
  break;
195
181
  case "relationship":
@@ -105,7 +105,7 @@ export const tryAwaitWithRetry = async (createFunction, attemptNum = 0, throwErr
105
105
  if (throwError) {
106
106
  throw error;
107
107
  }
108
- console.error("Error during retryAwait function: " + error);
108
+ console.error("Error during retryAwait function: ", error);
109
109
  // @ts-ignore
110
110
  return Promise.resolve();
111
111
  }
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.64",
4
+ "version": "0.9.66",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -12,11 +12,7 @@ const attributesSame = (
12
12
  databaseAttribute: Attribute,
13
13
  configAttribute: Attribute
14
14
  ): boolean => {
15
- return (
16
- databaseAttribute.key == configAttribute.key &&
17
- databaseAttribute.type == configAttribute.type &&
18
- databaseAttribute.array == configAttribute.array
19
- );
15
+ return databaseAttribute.key === configAttribute.key;
20
16
  };
21
17
 
22
18
  export const createOrUpdateAttribute = async (
@@ -27,7 +23,7 @@ export const createOrUpdateAttribute = async (
27
23
  ): Promise<void> => {
28
24
  let action = "create";
29
25
  let foundAttribute: Attribute | undefined;
30
- const updateEnabled = false;
26
+ const updateEnabled = true;
31
27
  let finalAttribute: any = attribute;
32
28
  try {
33
29
  const collectionAttr = collection.attributes.find(
@@ -39,66 +35,35 @@ export const createOrUpdateAttribute = async (
39
35
  foundAttribute = undefined;
40
36
  }
41
37
 
42
- if (
43
- foundAttribute &&
44
- attributesSame(foundAttribute, attribute) &&
45
- updateEnabled
46
- ) {
47
- // Check if mutable properties have changed and set action to "update" if necessary
48
- const requiredChanged =
49
- "required" in foundAttribute && "required" in attribute
50
- ? foundAttribute.required !== attribute.required
51
- : false;
52
-
53
- // const xdefaultChanged =
54
- // "xdefault" in foundAttribute && "xdefault" in attribute
55
- // ? foundAttribute.xdefault !== attribute.xdefault
56
- // : false;
38
+ if (foundAttribute && updateEnabled) {
39
+ const changedProperties = Object.keys(attribute).filter(key => {
40
+ // Only consider properties that are defined and not null in the new attribute
41
+ if (attribute[key as keyof typeof attribute] !== undefined && attribute[key as keyof typeof attribute] !== null && attribute[key as keyof typeof attribute] !== '') {
42
+ // Check if the property exists in the found attribute and is different
43
+ return foundAttribute[key as keyof typeof foundAttribute] !== attribute[key as keyof typeof attribute];
44
+ }
45
+ return false;
46
+ });
57
47
 
58
- const onDeleteChanged =
59
- foundAttribute.type === "relationship" &&
60
- attribute.type === "relationship" &&
61
- "onDelete" in foundAttribute &&
62
- "onDelete" in attribute
63
- ? foundAttribute.onDelete !== attribute.onDelete
64
- : false;
48
+ if (changedProperties.length > 0) {
49
+ console.log(`Changed properties: ${changedProperties.join(', ')}`);
65
50
 
66
- if (requiredChanged || onDeleteChanged) {
67
- console.log(
68
- `Required changed: ${requiredChanged}\nOnDelete changed: ${onDeleteChanged}`
69
- );
70
- console.log(
71
- `Found attribute: ${JSON.stringify(foundAttribute, null, 2)}`
72
- );
73
- console.log(`Attribute: ${JSON.stringify(attribute, null, 2)}`);
51
+ // Merge the attributes, prioritizing the new attribute's values
74
52
  finalAttribute = {
75
- ...attribute,
76
53
  ...foundAttribute,
54
+ ...attribute,
77
55
  };
78
56
  action = "update";
79
57
  } else {
80
58
  // If no properties that can be updated have changed, return early
81
59
  return;
82
60
  }
83
- } else if (
84
- foundAttribute &&
85
- !attributesSame(foundAttribute, attribute) &&
86
- updateEnabled
87
- ) {
88
- console.log(
89
- `Deleting attribute with same key ${
90
- attribute.key
91
- } -- but different values -- ${JSON.stringify(
92
- attribute,
93
- null,
94
- 2
95
- )} -- ${JSON.stringify(foundAttribute, null, 2)}`
96
- );
97
- await db.deleteAttribute(dbId, collection.$id, attribute.key);
98
- // After deletion, you might want to create the attribute anew
61
+ } else if (!foundAttribute) {
62
+ // If the attribute doesn't exist, we'll create it
99
63
  finalAttribute = attribute;
100
64
  action = "create";
101
- } else if (!updateEnabled && foundAttribute) {
65
+ } else if (!updateEnabled) {
66
+ // If updates are not enabled and the attribute exists, we do nothing
102
67
  return;
103
68
  }
104
69
 
@@ -157,9 +122,9 @@ export const createOrUpdateAttribute = async (
157
122
  collection.$id,
158
123
  finalAttribute.key,
159
124
  finalAttribute.size,
160
- finalAttribute.required || false,
161
- finalAttribute.xdefault || undefined,
162
- finalAttribute.array || false,
125
+ finalAttribute.required,
126
+ finalAttribute.xdefault,
127
+ finalAttribute.array,
163
128
  finalAttribute.encrypted
164
129
  )
165
130
  );
@@ -170,8 +135,9 @@ export const createOrUpdateAttribute = async (
170
135
  dbId,
171
136
  collection.$id,
172
137
  finalAttribute.key,
173
- finalAttribute.required || false,
174
- finalAttribute.xdefault || undefined
138
+ finalAttribute.required,
139
+ finalAttribute.xdefault,
140
+ finalAttribute.size
175
141
  )
176
142
  );
177
143
  }
@@ -196,10 +162,10 @@ export const createOrUpdateAttribute = async (
196
162
  dbId,
197
163
  collection.$id,
198
164
  finalAttribute.key,
199
- finalAttribute.required || false,
165
+ finalAttribute.required,
200
166
  finalAttribute.min,
201
167
  finalAttribute.max,
202
- finalAttribute.xdefault || undefined,
168
+ finalAttribute.xdefault,
203
169
  finalAttribute.array
204
170
  )
205
171
  );
@@ -222,10 +188,10 @@ export const createOrUpdateAttribute = async (
222
188
  dbId,
223
189
  collection.$id,
224
190
  finalAttribute.key,
225
- finalAttribute.required || false,
226
- finalAttribute.min || 0,
227
- finalAttribute.max || 2147483647,
228
- finalAttribute.xdefault || undefined
191
+ finalAttribute.required,
192
+ finalAttribute.min,
193
+ finalAttribute.max,
194
+ finalAttribute.xdefault
229
195
  )
230
196
  );
231
197
  }
@@ -238,10 +204,10 @@ export const createOrUpdateAttribute = async (
238
204
  dbId,
239
205
  collection.$id,
240
206
  finalAttribute.key,
241
- finalAttribute.required || false,
207
+ finalAttribute.required,
242
208
  finalAttribute.min,
243
209
  finalAttribute.max,
244
- finalAttribute.xdefault || undefined,
210
+ finalAttribute.xdefault,
245
211
  finalAttribute.array
246
212
  )
247
213
  );
@@ -252,10 +218,10 @@ export const createOrUpdateAttribute = async (
252
218
  dbId,
253
219
  collection.$id,
254
220
  finalAttribute.key,
255
- finalAttribute.required || false,
256
- finalAttribute.min || 0,
257
- finalAttribute.max || 2147483647,
258
- finalAttribute.xdefault || undefined
221
+ finalAttribute.required,
222
+ finalAttribute.min,
223
+ finalAttribute.max,
224
+ finalAttribute.xdefault
259
225
  )
260
226
  );
261
227
  }
@@ -268,8 +234,8 @@ export const createOrUpdateAttribute = async (
268
234
  dbId,
269
235
  collection.$id,
270
236
  finalAttribute.key,
271
- finalAttribute.required || false,
272
- finalAttribute.xdefault || undefined,
237
+ finalAttribute.required,
238
+ finalAttribute.xdefault,
273
239
  finalAttribute.array
274
240
  )
275
241
  );
@@ -280,8 +246,8 @@ export const createOrUpdateAttribute = async (
280
246
  dbId,
281
247
  collection.$id,
282
248
  finalAttribute.key,
283
- finalAttribute.required || false,
284
- finalAttribute.xdefault || null
249
+ finalAttribute.required,
250
+ finalAttribute.xdefault
285
251
  )
286
252
  );
287
253
  }
@@ -294,8 +260,8 @@ export const createOrUpdateAttribute = async (
294
260
  dbId,
295
261
  collection.$id,
296
262
  finalAttribute.key,
297
- finalAttribute.required || false,
298
- finalAttribute.xdefault || undefined,
263
+ finalAttribute.required,
264
+ finalAttribute.xdefault,
299
265
  finalAttribute.array
300
266
  )
301
267
  );
@@ -306,8 +272,8 @@ export const createOrUpdateAttribute = async (
306
272
  dbId,
307
273
  collection.$id,
308
274
  finalAttribute.key,
309
- finalAttribute.required || false,
310
- finalAttribute.xdefault || undefined
275
+ finalAttribute.required,
276
+ finalAttribute.xdefault
311
277
  )
312
278
  );
313
279
  }
@@ -320,8 +286,8 @@ export const createOrUpdateAttribute = async (
320
286
  dbId,
321
287
  collection.$id,
322
288
  finalAttribute.key,
323
- finalAttribute.required || false,
324
- finalAttribute.xdefault || undefined,
289
+ finalAttribute.required,
290
+ finalAttribute.xdefault,
325
291
  finalAttribute.array
326
292
  )
327
293
  );
@@ -332,8 +298,8 @@ export const createOrUpdateAttribute = async (
332
298
  dbId,
333
299
  collection.$id,
334
300
  finalAttribute.key,
335
- finalAttribute.required || false,
336
- finalAttribute.xdefault || undefined
301
+ finalAttribute.required,
302
+ finalAttribute.xdefault
337
303
  )
338
304
  );
339
305
  }
@@ -346,8 +312,8 @@ export const createOrUpdateAttribute = async (
346
312
  dbId,
347
313
  collection.$id,
348
314
  finalAttribute.key,
349
- finalAttribute.required || false,
350
- finalAttribute.xdefault || undefined,
315
+ finalAttribute.required,
316
+ finalAttribute.xdefault,
351
317
  finalAttribute.array
352
318
  )
353
319
  );
@@ -358,8 +324,8 @@ export const createOrUpdateAttribute = async (
358
324
  dbId,
359
325
  collection.$id,
360
326
  finalAttribute.key,
361
- finalAttribute.required || false,
362
- finalAttribute.xdefault || undefined
327
+ finalAttribute.required,
328
+ finalAttribute.xdefault
363
329
  )
364
330
  );
365
331
  }
@@ -372,8 +338,8 @@ export const createOrUpdateAttribute = async (
372
338
  dbId,
373
339
  collection.$id,
374
340
  finalAttribute.key,
375
- finalAttribute.required || false,
376
- finalAttribute.xdefault || undefined,
341
+ finalAttribute.required,
342
+ finalAttribute.xdefault,
377
343
  finalAttribute.array
378
344
  )
379
345
  );
@@ -384,8 +350,8 @@ export const createOrUpdateAttribute = async (
384
350
  dbId,
385
351
  collection.$id,
386
352
  finalAttribute.key,
387
- finalAttribute.required || false,
388
- finalAttribute.xdefault || undefined
353
+ finalAttribute.required,
354
+ finalAttribute.xdefault
389
355
  )
390
356
  );
391
357
  }
@@ -399,8 +365,8 @@ export const createOrUpdateAttribute = async (
399
365
  collection.$id,
400
366
  finalAttribute.key,
401
367
  finalAttribute.elements,
402
- finalAttribute.required || false,
403
- finalAttribute.xdefault || undefined,
368
+ finalAttribute.required,
369
+ finalAttribute.xdefault,
404
370
  finalAttribute.array
405
371
  )
406
372
  );
@@ -412,8 +378,8 @@ export const createOrUpdateAttribute = async (
412
378
  collection.$id,
413
379
  finalAttribute.key,
414
380
  finalAttribute.elements,
415
- finalAttribute.required || false,
416
- finalAttribute.xdefault || undefined
381
+ finalAttribute.required,
382
+ finalAttribute.xdefault
417
383
  )
418
384
  );
419
385
  }
@@ -163,7 +163,7 @@ export const tryAwaitWithRetry = async <T>(
163
163
  if (throwError) {
164
164
  throw error;
165
165
  }
166
- console.error("Error during retryAwait function: " + error);
166
+ console.error("Error during retryAwait function: ", error);
167
167
  // @ts-ignore
168
168
  return Promise.resolve();
169
169
  }