appwrite-utils-cli 0.0.286 → 0.9.0

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.
Files changed (109) hide show
  1. package/README.md +122 -96
  2. package/dist/collections/attributes.d.ts +4 -0
  3. package/dist/collections/attributes.js +224 -0
  4. package/dist/collections/indexes.d.ts +4 -0
  5. package/dist/collections/indexes.js +27 -0
  6. package/dist/collections/methods.d.ts +16 -0
  7. package/dist/collections/methods.js +216 -0
  8. package/dist/databases/methods.d.ts +6 -0
  9. package/dist/databases/methods.js +33 -0
  10. package/dist/interactiveCLI.d.ts +19 -0
  11. package/dist/interactiveCLI.js +555 -0
  12. package/dist/main.js +227 -62
  13. package/dist/migrations/afterImportActions.js +37 -40
  14. package/dist/migrations/appwriteToX.d.ts +26 -25
  15. package/dist/migrations/appwriteToX.js +42 -6
  16. package/dist/migrations/attributes.js +21 -20
  17. package/dist/migrations/backup.d.ts +93 -87
  18. package/dist/migrations/collections.d.ts +6 -0
  19. package/dist/migrations/collections.js +149 -20
  20. package/dist/migrations/converters.d.ts +2 -18
  21. package/dist/migrations/converters.js +13 -2
  22. package/dist/migrations/dataLoader.d.ts +276 -161
  23. package/dist/migrations/dataLoader.js +535 -292
  24. package/dist/migrations/databases.js +8 -2
  25. package/dist/migrations/helper.d.ts +3 -0
  26. package/dist/migrations/helper.js +21 -0
  27. package/dist/migrations/importController.d.ts +5 -2
  28. package/dist/migrations/importController.js +125 -88
  29. package/dist/migrations/importDataActions.d.ts +9 -1
  30. package/dist/migrations/importDataActions.js +15 -3
  31. package/dist/migrations/indexes.js +3 -2
  32. package/dist/migrations/logging.js +20 -8
  33. package/dist/migrations/migrationHelper.d.ts +9 -4
  34. package/dist/migrations/migrationHelper.js +6 -5
  35. package/dist/migrations/openapi.d.ts +1 -1
  36. package/dist/migrations/openapi.js +33 -18
  37. package/dist/migrations/queue.js +3 -2
  38. package/dist/migrations/relationships.d.ts +2 -2
  39. package/dist/migrations/schemaStrings.js +53 -41
  40. package/dist/migrations/setupDatabase.d.ts +2 -4
  41. package/dist/migrations/setupDatabase.js +24 -105
  42. package/dist/migrations/storage.d.ts +3 -1
  43. package/dist/migrations/storage.js +110 -16
  44. package/dist/migrations/transfer.d.ts +30 -0
  45. package/dist/migrations/transfer.js +337 -0
  46. package/dist/migrations/users.d.ts +2 -1
  47. package/dist/migrations/users.js +78 -43
  48. package/dist/schemas/authUser.d.ts +2 -2
  49. package/dist/storage/methods.d.ts +15 -0
  50. package/dist/storage/methods.js +207 -0
  51. package/dist/storage/schemas.d.ts +687 -0
  52. package/dist/storage/schemas.js +175 -0
  53. package/dist/utils/getClientFromConfig.d.ts +4 -0
  54. package/dist/utils/getClientFromConfig.js +16 -0
  55. package/dist/utils/helperFunctions.d.ts +11 -1
  56. package/dist/utils/helperFunctions.js +38 -0
  57. package/dist/utils/retryFailedPromises.d.ts +2 -0
  58. package/dist/utils/retryFailedPromises.js +21 -0
  59. package/dist/utils/schemaStrings.d.ts +13 -0
  60. package/dist/utils/schemaStrings.js +403 -0
  61. package/dist/utils/setupFiles.js +110 -61
  62. package/dist/utilsController.d.ts +40 -22
  63. package/dist/utilsController.js +164 -84
  64. package/package.json +13 -15
  65. package/src/collections/attributes.ts +483 -0
  66. package/src/collections/indexes.ts +53 -0
  67. package/src/collections/methods.ts +331 -0
  68. package/src/databases/methods.ts +47 -0
  69. package/src/init.ts +64 -64
  70. package/src/interactiveCLI.ts +767 -0
  71. package/src/main.ts +292 -83
  72. package/src/migrations/afterImportActions.ts +553 -490
  73. package/src/migrations/appwriteToX.ts +237 -174
  74. package/src/migrations/attributes.ts +483 -422
  75. package/src/migrations/backup.ts +205 -205
  76. package/src/migrations/collections.ts +545 -300
  77. package/src/migrations/converters.ts +161 -150
  78. package/src/migrations/dataLoader.ts +1615 -1304
  79. package/src/migrations/databases.ts +44 -25
  80. package/src/migrations/dbHelpers.ts +92 -92
  81. package/src/migrations/helper.ts +40 -0
  82. package/src/migrations/importController.ts +448 -384
  83. package/src/migrations/importDataActions.ts +315 -307
  84. package/src/migrations/indexes.ts +40 -37
  85. package/src/migrations/logging.ts +29 -16
  86. package/src/migrations/migrationHelper.ts +207 -201
  87. package/src/migrations/openapi.ts +83 -70
  88. package/src/migrations/queue.ts +118 -119
  89. package/src/migrations/relationships.ts +324 -324
  90. package/src/migrations/schemaStrings.ts +472 -460
  91. package/src/migrations/setupDatabase.ts +118 -219
  92. package/src/migrations/storage.ts +538 -358
  93. package/src/migrations/transfer.ts +608 -0
  94. package/src/migrations/users.ts +362 -285
  95. package/src/migrations/validationRules.ts +63 -63
  96. package/src/schemas/authUser.ts +23 -23
  97. package/src/setup.ts +8 -8
  98. package/src/storage/methods.ts +371 -0
  99. package/src/storage/schemas.ts +205 -0
  100. package/src/types.ts +9 -9
  101. package/src/utils/getClientFromConfig.ts +17 -0
  102. package/src/utils/helperFunctions.ts +181 -127
  103. package/src/utils/index.ts +2 -2
  104. package/src/utils/loadConfigs.ts +59 -59
  105. package/src/utils/retryFailedPromises.ts +27 -0
  106. package/src/utils/schemaStrings.ts +473 -0
  107. package/src/utils/setupFiles.ts +228 -182
  108. package/src/utilsController.ts +325 -194
  109. package/tsconfig.json +37 -37
@@ -1,88 +1,89 @@
1
- import { type Models } from "node-appwrite";
1
+ import { Storage, type Models } from "node-appwrite";
2
2
  import { type AppwriteConfig } from "appwrite-utils";
3
3
  export declare class AppwriteToX {
4
4
  config: AppwriteConfig;
5
+ storage: Storage;
5
6
  updatedConfig: AppwriteConfig;
6
7
  collToAttributeMap: Map<string, ({
7
8
  type: "string";
8
9
  key: string;
9
10
  size: number;
11
+ format?: string | null | undefined;
12
+ description?: string | Record<string, string> | undefined;
13
+ required?: boolean | undefined;
10
14
  array?: boolean | undefined;
11
15
  error?: string | undefined;
12
- required?: boolean | undefined;
13
16
  xdefault?: string | null | undefined;
14
17
  encrypted?: boolean | undefined;
15
- format?: string | null | undefined;
16
- description?: string | Record<string, string> | undefined;
17
18
  } | {
18
19
  type: "integer";
19
20
  key: string;
21
+ description?: string | Record<string, string> | null | undefined;
22
+ required?: boolean | undefined;
20
23
  array?: boolean | undefined;
21
24
  error?: string | undefined;
22
- required?: boolean | undefined;
23
25
  xdefault?: number | null | undefined;
24
- description?: string | Record<string, string> | null | undefined;
25
26
  min?: number | undefined;
26
27
  max?: number | undefined;
27
28
  } | {
28
29
  type: "float";
29
30
  key: string;
31
+ description?: string | Record<string, string> | null | undefined;
32
+ required?: boolean | undefined;
30
33
  array?: boolean | undefined;
31
34
  error?: string | undefined;
32
- required?: boolean | undefined;
33
35
  xdefault?: number | null | undefined;
34
- description?: string | Record<string, string> | null | undefined;
35
36
  min?: number | undefined;
36
37
  max?: number | undefined;
37
38
  } | {
38
39
  type: "boolean";
39
40
  key: string;
41
+ description?: string | Record<string, string> | null | undefined;
42
+ required?: boolean | undefined;
40
43
  array?: boolean | undefined;
41
44
  error?: string | undefined;
42
- required?: boolean | undefined;
43
45
  xdefault?: boolean | null | undefined;
44
- description?: string | Record<string, string> | null | undefined;
45
46
  } | {
46
47
  type: "datetime";
47
48
  key: string;
49
+ description?: string | Record<string, string> | null | undefined;
50
+ required?: boolean | undefined;
48
51
  array?: boolean | undefined;
49
52
  error?: string | undefined;
50
- required?: boolean | undefined;
51
53
  xdefault?: string | null | undefined;
52
- description?: string | Record<string, string> | null | undefined;
53
54
  } | {
54
55
  type: "email";
55
56
  key: string;
57
+ description?: string | Record<string, string> | null | undefined;
58
+ required?: boolean | undefined;
56
59
  array?: boolean | undefined;
57
60
  error?: string | undefined;
58
- required?: boolean | undefined;
59
61
  xdefault?: string | null | undefined;
60
- description?: string | Record<string, string> | null | undefined;
61
62
  } | {
62
63
  type: "ip";
63
64
  key: string;
65
+ description?: string | Record<string, string> | null | undefined;
66
+ required?: boolean | undefined;
64
67
  array?: boolean | undefined;
65
68
  error?: string | undefined;
66
- required?: boolean | undefined;
67
69
  xdefault?: string | null | undefined;
68
- description?: string | Record<string, string> | null | undefined;
69
70
  } | {
70
71
  type: "url";
71
72
  key: string;
73
+ description?: string | Record<string, string> | null | undefined;
74
+ required?: boolean | undefined;
72
75
  array?: boolean | undefined;
73
76
  error?: string | undefined;
74
- required?: boolean | undefined;
75
77
  xdefault?: string | null | undefined;
76
- description?: string | Record<string, string> | null | undefined;
77
78
  } | {
78
79
  type: "enum";
79
80
  key: string;
80
81
  elements: string[];
82
+ description?: string | Record<string, string> | null | undefined;
83
+ required?: boolean | undefined;
81
84
  array?: boolean | undefined;
82
85
  error?: string | undefined;
83
- required?: boolean | undefined;
84
86
  xdefault?: string | null | undefined;
85
- description?: string | Record<string, string> | null | undefined;
86
87
  } | {
87
88
  type: "relationship";
88
89
  key: string;
@@ -92,17 +93,17 @@ export declare class AppwriteToX {
92
93
  twoWayKey: string;
93
94
  onDelete: "setNull" | "cascade" | "restrict";
94
95
  side: "parent" | "child";
96
+ description?: string | Record<string, string> | null | undefined;
97
+ required?: boolean | undefined;
95
98
  array?: boolean | undefined;
96
99
  error?: string | undefined;
97
- required?: boolean | undefined;
98
- description?: string | Record<string, string> | null | undefined;
99
100
  importMapping?: {
100
101
  originalIdField: string;
101
102
  targetField?: string | undefined;
102
103
  } | undefined;
103
104
  })[]>;
104
105
  appwriteFolderPath: string;
105
- constructor(config: AppwriteConfig, appwriteFolderPath: string);
106
+ constructor(config: AppwriteConfig, appwriteFolderPath: string, storage: Storage);
106
107
  parsePermissionString: (permissionString: string) => {
107
108
  permission: string;
108
109
  target: string;
@@ -115,6 +116,6 @@ export declare class AppwriteToX {
115
116
  target: string;
116
117
  })[];
117
118
  updateCollectionConfigAttributes: (collection: Models.Collection) => void;
118
- appwriteSync(config: AppwriteConfig): Promise<void>;
119
- toSchemas(): Promise<void>;
119
+ appwriteSync(config: AppwriteConfig, databases?: Models.Database[]): Promise<void>;
120
+ toSchemas(databases?: Models.Database[]): Promise<void>;
120
121
  }
@@ -1,17 +1,20 @@
1
1
  import { SchemaGenerator } from "./schemaStrings.js";
2
- import { Databases, Query } from "node-appwrite";
2
+ import { Client, Compression, Databases, Query, Storage, } from "node-appwrite";
3
3
  import { fetchAllCollections } from "./collections.js";
4
4
  import { fetchAllDatabases } from "./databases.js";
5
5
  import { CollectionSchema, attributeSchema, AppwriteConfigSchema, permissionsSchema, attributesSchema, indexesSchema, parseAttribute, } from "appwrite-utils";
6
6
  import { getDatabaseFromConfig } from "./afterImportActions.js";
7
+ import { listBuckets } from "../storage/methods.js";
7
8
  export class AppwriteToX {
8
9
  config;
10
+ storage;
9
11
  updatedConfig;
10
12
  collToAttributeMap = new Map();
11
13
  appwriteFolderPath;
12
- constructor(config, appwriteFolderPath) {
14
+ constructor(config, appwriteFolderPath, storage) {
13
15
  this.config = config;
14
16
  this.updatedConfig = config;
17
+ this.storage = storage;
15
18
  this.appwriteFolderPath = appwriteFolderPath;
16
19
  }
17
20
  // Function to parse a single permission string
@@ -43,15 +46,36 @@ export class AppwriteToX {
43
46
  ?.push(attributeParsed);
44
47
  }
45
48
  };
46
- async appwriteSync(config) {
49
+ async appwriteSync(config, databases) {
47
50
  const db = getDatabaseFromConfig(config);
48
- const databases = await fetchAllDatabases(db);
51
+ if (!databases) {
52
+ databases = await fetchAllDatabases(db);
53
+ }
49
54
  let updatedConfig = { ...config };
55
+ // Fetch all buckets
56
+ const allBuckets = await listBuckets(this.storage);
50
57
  // Loop through each database
51
58
  for (const database of databases) {
52
59
  if (database.name.toLowerCase() === "migrations") {
53
60
  continue;
54
61
  }
62
+ // Match bucket to database
63
+ const matchedBucket = allBuckets.buckets.find((bucket) => bucket.$id.toLowerCase().includes(database.$id.toLowerCase()));
64
+ if (matchedBucket) {
65
+ const dbConfig = updatedConfig.databases.find((db) => db.$id === database.$id);
66
+ if (dbConfig) {
67
+ dbConfig.bucket = {
68
+ $id: matchedBucket.$id,
69
+ name: matchedBucket.name,
70
+ enabled: matchedBucket.enabled,
71
+ maximumFileSize: matchedBucket.maximumFileSize,
72
+ allowedFileExtensions: matchedBucket.allowedFileExtensions,
73
+ compression: matchedBucket.compression,
74
+ encryption: matchedBucket.encryption,
75
+ antivirus: matchedBucket.antivirus,
76
+ };
77
+ }
78
+ }
55
79
  const collections = await fetchAllCollections(database.$id, db);
56
80
  // Loop through each collection in the current database
57
81
  if (!updatedConfig.collections) {
@@ -117,10 +141,22 @@ export class AppwriteToX {
117
141
  }
118
142
  console.log(`Processed ${collections.length} collections in ${database.name}`);
119
143
  }
144
+ // Add unmatched buckets as global buckets
145
+ const globalBuckets = allBuckets.buckets.filter((bucket) => !updatedConfig.databases.some((db) => db.bucket && db.bucket.$id === bucket.$id));
146
+ updatedConfig.buckets = globalBuckets.map((bucket) => ({
147
+ $id: bucket.$id,
148
+ name: bucket.name,
149
+ enabled: bucket.enabled,
150
+ maximumFileSize: bucket.maximumFileSize,
151
+ allowedFileExtensions: bucket.allowedFileExtensions,
152
+ compression: bucket.compression,
153
+ encryption: bucket.encryption,
154
+ antivirus: bucket.antivirus,
155
+ }));
120
156
  this.updatedConfig = updatedConfig;
121
157
  }
122
- async toSchemas() {
123
- await this.appwriteSync(this.config);
158
+ async toSchemas(databases) {
159
+ await this.appwriteSync(this.config, databases);
124
160
  const generator = new SchemaGenerator(this.updatedConfig, this.appwriteFolderPath);
125
161
  generator.updateTsSchemas();
126
162
  generator.generateSchemas();
@@ -2,6 +2,7 @@ import { Query } from "node-appwrite";
2
2
  import { attributeSchema, parseAttribute, } from "appwrite-utils";
3
3
  import { nameToIdMapping, enqueueOperation } from "./queue.js";
4
4
  import _ from "lodash";
5
+ import { tryAwaitWithRetry } from "../utils/helperFunctions.js";
5
6
  const attributesSame = (databaseAttribute, configAttribute) => {
6
7
  return (databaseAttribute.key == configAttribute.key &&
7
8
  databaseAttribute.type == configAttribute.type &&
@@ -105,10 +106,10 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
105
106
  switch (finalAttribute.type) {
106
107
  case "string":
107
108
  if (action === "create") {
108
- await db.createStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.size, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array || false, finalAttribute.encrypted);
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));
109
110
  }
110
111
  else {
111
- await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined);
112
+ await tryAwaitWithRetry(async () => await db.updateStringAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
112
113
  }
113
114
  break;
114
115
  case "integer":
@@ -121,7 +122,7 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
121
122
  BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
122
123
  delete finalAttribute.max;
123
124
  }
124
- await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array);
125
+ await tryAwaitWithRetry(async () => await db.createIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array));
125
126
  }
126
127
  else {
127
128
  if (finalAttribute.min &&
@@ -132,71 +133,71 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
132
133
  BigInt(finalAttribute.max) === BigInt(9223372036854776000)) {
133
134
  delete finalAttribute.max;
134
135
  }
135
- await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined);
136
+ await tryAwaitWithRetry(async () => await db.updateIntegerAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined));
136
137
  }
137
138
  break;
138
139
  case "float":
139
140
  if (action === "create") {
140
- await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array);
141
+ await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min, finalAttribute.max, finalAttribute.xdefault || undefined, finalAttribute.array));
141
142
  }
142
143
  else {
143
- await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined);
144
+ await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || 0, finalAttribute.max || 2147483647, finalAttribute.xdefault || undefined));
144
145
  }
145
146
  break;
146
147
  case "boolean":
147
148
  if (action === "create") {
148
- await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
149
+ await tryAwaitWithRetry(async () => await db.createBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
149
150
  }
150
151
  else {
151
- await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || null);
152
+ await tryAwaitWithRetry(async () => await db.updateBooleanAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || null));
152
153
  }
153
154
  break;
154
155
  case "datetime":
155
156
  if (action === "create") {
156
- await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
157
+ await tryAwaitWithRetry(async () => await db.createDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
157
158
  }
158
159
  else {
159
- await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined);
160
+ await tryAwaitWithRetry(async () => await db.updateDatetimeAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
160
161
  }
161
162
  break;
162
163
  case "email":
163
164
  if (action === "create") {
164
- await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
165
+ await tryAwaitWithRetry(async () => await db.createEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
165
166
  }
166
167
  else {
167
- await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined);
168
+ await tryAwaitWithRetry(async () => await db.updateEmailAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
168
169
  }
169
170
  break;
170
171
  case "ip":
171
172
  if (action === "create") {
172
- await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
173
+ await tryAwaitWithRetry(async () => await db.createIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
173
174
  }
174
175
  else {
175
- await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined);
176
+ await tryAwaitWithRetry(async () => await db.updateIpAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
176
177
  }
177
178
  break;
178
179
  case "url":
179
180
  if (action === "create") {
180
- await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
181
+ await tryAwaitWithRetry(async () => await db.createUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
181
182
  }
182
183
  else {
183
- await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined);
184
+ await tryAwaitWithRetry(async () => await db.updateUrlAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.xdefault || undefined));
184
185
  }
185
186
  break;
186
187
  case "enum":
187
188
  if (action === "create") {
188
- await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array);
189
+ await tryAwaitWithRetry(async () => await db.createEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined, finalAttribute.array));
189
190
  }
190
191
  else {
191
- await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined);
192
+ await tryAwaitWithRetry(async () => await db.updateEnumAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.elements, finalAttribute.required || false, finalAttribute.xdefault || undefined));
192
193
  }
193
194
  break;
194
195
  case "relationship":
195
196
  if (action === "create") {
196
- await db.createRelationshipAttribute(dbId, collection.$id, relatedCollectionId, finalAttribute.relationType, finalAttribute.twoWay, finalAttribute.key, finalAttribute.twoWayKey, finalAttribute.onDelete);
197
+ await tryAwaitWithRetry(async () => await db.createRelationshipAttribute(dbId, collection.$id, relatedCollectionId, finalAttribute.relationType, finalAttribute.twoWay, finalAttribute.key, finalAttribute.twoWayKey, finalAttribute.onDelete));
197
198
  }
198
199
  else {
199
- await db.updateRelationshipAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.onDelete);
200
+ await tryAwaitWithRetry(async () => await db.updateRelationshipAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.onDelete));
200
201
  }
201
202
  break;
202
203
  default: