appwrite-utils-cli 1.11.0 → 1.12.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 (250) hide show
  1. package/{src/adapters/index.ts → dist/adapters/index.d.ts} +0 -1
  2. package/dist/adapters/index.js +10 -0
  3. package/dist/backups/operations/bucketBackup.d.ts +19 -0
  4. package/dist/backups/operations/bucketBackup.js +197 -0
  5. package/dist/backups/operations/collectionBackup.d.ts +30 -0
  6. package/dist/backups/operations/collectionBackup.js +201 -0
  7. package/dist/backups/operations/comprehensiveBackup.d.ts +25 -0
  8. package/dist/backups/operations/comprehensiveBackup.js +238 -0
  9. package/dist/backups/schemas/bucketManifest.d.ts +93 -0
  10. package/dist/backups/schemas/bucketManifest.js +33 -0
  11. package/dist/backups/schemas/comprehensiveManifest.d.ts +108 -0
  12. package/dist/backups/schemas/comprehensiveManifest.js +32 -0
  13. package/dist/backups/tracking/centralizedTracking.d.ts +34 -0
  14. package/dist/backups/tracking/centralizedTracking.js +274 -0
  15. package/dist/cli/commands/configCommands.d.ts +8 -0
  16. package/dist/cli/commands/configCommands.js +210 -0
  17. package/dist/cli/commands/databaseCommands.d.ts +14 -0
  18. package/dist/cli/commands/databaseCommands.js +696 -0
  19. package/dist/cli/commands/functionCommands.d.ts +7 -0
  20. package/dist/cli/commands/functionCommands.js +330 -0
  21. package/dist/cli/commands/importFileCommands.d.ts +7 -0
  22. package/dist/cli/commands/importFileCommands.js +674 -0
  23. package/dist/cli/commands/schemaCommands.d.ts +7 -0
  24. package/dist/cli/commands/schemaCommands.js +169 -0
  25. package/dist/cli/commands/storageCommands.d.ts +5 -0
  26. package/dist/cli/commands/storageCommands.js +142 -0
  27. package/dist/cli/commands/transferCommands.d.ts +5 -0
  28. package/dist/cli/commands/transferCommands.js +382 -0
  29. package/dist/collections/columns.d.ts +13 -0
  30. package/dist/collections/columns.js +1339 -0
  31. package/dist/collections/indexes.d.ts +12 -0
  32. package/dist/collections/indexes.js +215 -0
  33. package/dist/collections/methods.d.ts +19 -0
  34. package/dist/collections/methods.js +605 -0
  35. package/dist/collections/tableOperations.d.ts +87 -0
  36. package/dist/collections/tableOperations.js +466 -0
  37. package/dist/collections/transferOperations.d.ts +8 -0
  38. package/dist/collections/transferOperations.js +411 -0
  39. package/dist/collections/wipeOperations.d.ts +17 -0
  40. package/dist/collections/wipeOperations.js +306 -0
  41. package/dist/databases/methods.d.ts +6 -0
  42. package/dist/databases/methods.js +35 -0
  43. package/dist/databases/setup.d.ts +5 -0
  44. package/dist/databases/setup.js +45 -0
  45. package/dist/examples/yamlTerminologyExample.d.ts +42 -0
  46. package/dist/examples/yamlTerminologyExample.js +272 -0
  47. package/dist/functions/deployments.d.ts +4 -0
  48. package/dist/functions/deployments.js +146 -0
  49. package/dist/functions/fnConfigDiscovery.d.ts +3 -0
  50. package/dist/functions/fnConfigDiscovery.js +108 -0
  51. package/dist/functions/methods.d.ts +16 -0
  52. package/dist/functions/methods.js +174 -0
  53. package/dist/init.d.ts +2 -0
  54. package/dist/init.js +57 -0
  55. package/dist/interactiveCLI.d.ts +36 -0
  56. package/dist/interactiveCLI.js +952 -0
  57. package/dist/main.d.ts +2 -0
  58. package/dist/main.js +1125 -0
  59. package/dist/migrations/afterImportActions.d.ts +17 -0
  60. package/dist/migrations/afterImportActions.js +305 -0
  61. package/dist/migrations/appwriteToX.d.ts +211 -0
  62. package/dist/migrations/appwriteToX.js +493 -0
  63. package/dist/migrations/comprehensiveTransfer.d.ts +147 -0
  64. package/dist/migrations/comprehensiveTransfer.js +1315 -0
  65. package/dist/migrations/dataLoader.d.ts +755 -0
  66. package/dist/migrations/dataLoader.js +1272 -0
  67. package/dist/migrations/importController.d.ts +25 -0
  68. package/dist/migrations/importController.js +283 -0
  69. package/dist/migrations/importDataActions.d.ts +50 -0
  70. package/dist/migrations/importDataActions.js +230 -0
  71. package/dist/migrations/relationships.d.ts +29 -0
  72. package/dist/migrations/relationships.js +203 -0
  73. package/dist/migrations/services/DataTransformationService.d.ts +55 -0
  74. package/dist/migrations/services/DataTransformationService.js +158 -0
  75. package/dist/migrations/services/FileHandlerService.d.ts +75 -0
  76. package/dist/migrations/services/FileHandlerService.js +236 -0
  77. package/dist/migrations/services/ImportOrchestrator.d.ts +99 -0
  78. package/dist/migrations/services/ImportOrchestrator.js +493 -0
  79. package/dist/migrations/services/RateLimitManager.d.ts +138 -0
  80. package/dist/migrations/services/RateLimitManager.js +279 -0
  81. package/dist/migrations/services/RelationshipResolver.d.ts +120 -0
  82. package/dist/migrations/services/RelationshipResolver.js +332 -0
  83. package/dist/migrations/services/UserMappingService.d.ts +109 -0
  84. package/dist/migrations/services/UserMappingService.js +277 -0
  85. package/dist/migrations/services/ValidationService.d.ts +74 -0
  86. package/dist/migrations/services/ValidationService.js +260 -0
  87. package/dist/migrations/transfer.d.ts +30 -0
  88. package/dist/migrations/transfer.js +661 -0
  89. package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +131 -0
  90. package/dist/migrations/yaml/YamlImportConfigLoader.js +383 -0
  91. package/dist/migrations/yaml/YamlImportIntegration.d.ts +93 -0
  92. package/dist/migrations/yaml/YamlImportIntegration.js +341 -0
  93. package/dist/migrations/yaml/generateImportSchemas.d.ts +30 -0
  94. package/dist/migrations/yaml/generateImportSchemas.js +1327 -0
  95. package/dist/schemas/authUser.d.ts +24 -0
  96. package/dist/schemas/authUser.js +17 -0
  97. package/dist/setup.d.ts +2 -0
  98. package/{src/setup.ts → dist/setup.js} +0 -3
  99. package/dist/setupCommands.d.ts +58 -0
  100. package/dist/setupCommands.js +489 -0
  101. package/dist/setupController.d.ts +9 -0
  102. package/dist/setupController.js +34 -0
  103. package/dist/shared/backupMetadataSchema.d.ts +94 -0
  104. package/dist/shared/backupMetadataSchema.js +38 -0
  105. package/dist/shared/backupTracking.d.ts +18 -0
  106. package/dist/shared/backupTracking.js +176 -0
  107. package/dist/shared/confirmationDialogs.d.ts +75 -0
  108. package/dist/shared/confirmationDialogs.js +236 -0
  109. package/dist/shared/migrationHelpers.d.ts +61 -0
  110. package/dist/shared/migrationHelpers.js +145 -0
  111. package/{src/shared/operationLogger.ts → dist/shared/operationLogger.d.ts} +1 -11
  112. package/dist/shared/operationLogger.js +12 -0
  113. package/dist/shared/operationQueue.d.ts +40 -0
  114. package/dist/shared/operationQueue.js +310 -0
  115. package/dist/shared/operationsTable.d.ts +26 -0
  116. package/dist/shared/operationsTable.js +287 -0
  117. package/dist/shared/operationsTableSchema.d.ts +48 -0
  118. package/dist/shared/operationsTableSchema.js +35 -0
  119. package/dist/shared/progressManager.d.ts +62 -0
  120. package/dist/shared/progressManager.js +215 -0
  121. package/dist/shared/relationshipExtractor.d.ts +56 -0
  122. package/dist/shared/relationshipExtractor.js +138 -0
  123. package/dist/shared/selectionDialogs.d.ts +220 -0
  124. package/dist/shared/selectionDialogs.js +588 -0
  125. package/dist/storage/backupCompression.d.ts +20 -0
  126. package/dist/storage/backupCompression.js +67 -0
  127. package/dist/storage/methods.d.ts +44 -0
  128. package/dist/storage/methods.js +475 -0
  129. package/dist/storage/schemas.d.ts +842 -0
  130. package/dist/storage/schemas.js +175 -0
  131. package/dist/tables/indexManager.d.ts +65 -0
  132. package/dist/tables/indexManager.js +294 -0
  133. package/{src/types.ts → dist/types.d.ts} +1 -6
  134. package/dist/types.js +3 -0
  135. package/dist/users/methods.d.ts +16 -0
  136. package/dist/users/methods.js +276 -0
  137. package/dist/utils/configMigration.d.ts +1 -0
  138. package/dist/utils/configMigration.js +261 -0
  139. package/dist/utils/index.js +2 -0
  140. package/dist/utils/loadConfigs.d.ts +50 -0
  141. package/dist/utils/loadConfigs.js +357 -0
  142. package/dist/utils/setupFiles.d.ts +4 -0
  143. package/dist/utils/setupFiles.js +1190 -0
  144. package/dist/utilsController.d.ts +114 -0
  145. package/dist/utilsController.js +898 -0
  146. package/package.json +6 -3
  147. package/CHANGELOG.md +0 -35
  148. package/CONFIG_TODO.md +0 -1189
  149. package/SELECTION_DIALOGS.md +0 -146
  150. package/SERVICE_IMPLEMENTATION_REPORT.md +0 -462
  151. package/scripts/copy-templates.ts +0 -23
  152. package/src/backups/operations/bucketBackup.ts +0 -277
  153. package/src/backups/operations/collectionBackup.ts +0 -310
  154. package/src/backups/operations/comprehensiveBackup.ts +0 -342
  155. package/src/backups/schemas/bucketManifest.ts +0 -78
  156. package/src/backups/schemas/comprehensiveManifest.ts +0 -76
  157. package/src/backups/tracking/centralizedTracking.ts +0 -352
  158. package/src/cli/commands/configCommands.ts +0 -265
  159. package/src/cli/commands/databaseCommands.ts +0 -931
  160. package/src/cli/commands/functionCommands.ts +0 -419
  161. package/src/cli/commands/importFileCommands.ts +0 -815
  162. package/src/cli/commands/schemaCommands.ts +0 -200
  163. package/src/cli/commands/storageCommands.ts +0 -151
  164. package/src/cli/commands/transferCommands.ts +0 -454
  165. package/src/collections/attributes.ts.backup +0 -1555
  166. package/src/collections/columns.ts +0 -2025
  167. package/src/collections/indexes.ts +0 -350
  168. package/src/collections/methods.ts +0 -714
  169. package/src/collections/tableOperations.ts +0 -542
  170. package/src/collections/transferOperations.ts +0 -589
  171. package/src/collections/wipeOperations.ts +0 -449
  172. package/src/databases/methods.ts +0 -49
  173. package/src/databases/setup.ts +0 -77
  174. package/src/examples/yamlTerminologyExample.ts +0 -346
  175. package/src/functions/deployments.ts +0 -221
  176. package/src/functions/fnConfigDiscovery.ts +0 -103
  177. package/src/functions/methods.ts +0 -284
  178. package/src/init.ts +0 -62
  179. package/src/interactiveCLI.ts +0 -1201
  180. package/src/main.ts +0 -1517
  181. package/src/migrations/afterImportActions.ts +0 -579
  182. package/src/migrations/appwriteToX.ts +0 -668
  183. package/src/migrations/comprehensiveTransfer.ts +0 -2285
  184. package/src/migrations/dataLoader.ts +0 -1729
  185. package/src/migrations/importController.ts +0 -440
  186. package/src/migrations/importDataActions.ts +0 -315
  187. package/src/migrations/relationships.ts +0 -333
  188. package/src/migrations/services/DataTransformationService.ts +0 -196
  189. package/src/migrations/services/FileHandlerService.ts +0 -311
  190. package/src/migrations/services/ImportOrchestrator.ts +0 -675
  191. package/src/migrations/services/RateLimitManager.ts +0 -363
  192. package/src/migrations/services/RelationshipResolver.ts +0 -461
  193. package/src/migrations/services/UserMappingService.ts +0 -345
  194. package/src/migrations/services/ValidationService.ts +0 -349
  195. package/src/migrations/transfer.ts +0 -1113
  196. package/src/migrations/yaml/YamlImportConfigLoader.ts +0 -439
  197. package/src/migrations/yaml/YamlImportIntegration.ts +0 -446
  198. package/src/migrations/yaml/generateImportSchemas.ts +0 -1354
  199. package/src/schemas/authUser.ts +0 -23
  200. package/src/setupCommands.ts +0 -602
  201. package/src/setupController.ts +0 -43
  202. package/src/shared/backupMetadataSchema.ts +0 -93
  203. package/src/shared/backupTracking.ts +0 -211
  204. package/src/shared/confirmationDialogs.ts +0 -327
  205. package/src/shared/migrationHelpers.ts +0 -232
  206. package/src/shared/operationQueue.ts +0 -376
  207. package/src/shared/operationsTable.ts +0 -338
  208. package/src/shared/operationsTableSchema.ts +0 -60
  209. package/src/shared/progressManager.ts +0 -278
  210. package/src/shared/relationshipExtractor.ts +0 -214
  211. package/src/shared/selectionDialogs.ts +0 -802
  212. package/src/storage/backupCompression.ts +0 -88
  213. package/src/storage/methods.ts +0 -711
  214. package/src/storage/schemas.ts +0 -205
  215. package/src/tables/indexManager.ts +0 -409
  216. package/src/types/node-appwrite-tablesdb.d.ts +0 -44
  217. package/src/users/methods.ts +0 -358
  218. package/src/utils/configMigration.ts +0 -348
  219. package/src/utils/loadConfigs.ts +0 -457
  220. package/src/utils/setupFiles.ts +0 -1236
  221. package/src/utilsController.ts +0 -1263
  222. package/tests/README.md +0 -497
  223. package/tests/adapters/AdapterFactory.test.ts +0 -277
  224. package/tests/integration/syncOperations.test.ts +0 -463
  225. package/tests/jest.config.js +0 -25
  226. package/tests/migration/configMigration.test.ts +0 -546
  227. package/tests/setup.ts +0 -62
  228. package/tests/testUtils.ts +0 -340
  229. package/tests/utils/loadConfigs.test.ts +0 -350
  230. package/tests/validation/configValidation.test.ts +0 -412
  231. package/tsconfig.json +0 -44
  232. /package/{src → dist}/functions/templates/count-docs-in-collection/README.md +0 -0
  233. /package/{src → dist}/functions/templates/count-docs-in-collection/src/main.ts +0 -0
  234. /package/{src → dist}/functions/templates/count-docs-in-collection/src/request.ts +0 -0
  235. /package/{src → dist}/functions/templates/hono-typescript/README.md +0 -0
  236. /package/{src → dist}/functions/templates/hono-typescript/src/adapters/request.ts +0 -0
  237. /package/{src → dist}/functions/templates/hono-typescript/src/adapters/response.ts +0 -0
  238. /package/{src → dist}/functions/templates/hono-typescript/src/app.ts +0 -0
  239. /package/{src → dist}/functions/templates/hono-typescript/src/context.ts +0 -0
  240. /package/{src → dist}/functions/templates/hono-typescript/src/main.ts +0 -0
  241. /package/{src → dist}/functions/templates/hono-typescript/src/middleware/appwrite.ts +0 -0
  242. /package/{src → dist}/functions/templates/typescript-node/README.md +0 -0
  243. /package/{src → dist}/functions/templates/typescript-node/src/context.ts +0 -0
  244. /package/{src → dist}/functions/templates/typescript-node/src/main.ts +0 -0
  245. /package/{src → dist}/functions/templates/uv/README.md +0 -0
  246. /package/{src → dist}/functions/templates/uv/pyproject.toml +0 -0
  247. /package/{src → dist}/functions/templates/uv/src/__init__.py +0 -0
  248. /package/{src → dist}/functions/templates/uv/src/context.py +0 -0
  249. /package/{src → dist}/functions/templates/uv/src/main.py +0 -0
  250. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -0,0 +1,755 @@
1
+ import type { ImportDataActions } from "./importDataActions.js";
2
+ import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type ImportDef } from "appwrite-utils";
3
+ import { z } from "zod";
4
+ import { type Databases } from "node-appwrite";
5
+ import { AuthUserCreateSchema } from "../schemas/authUser.js";
6
+ export declare const CollectionImportDataSchema: z.ZodObject<{
7
+ collection: z.ZodOptional<z.ZodObject<{
8
+ name: z.ZodString;
9
+ attributes: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
10
+ key: z.ZodString;
11
+ type: z.ZodString;
12
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ error: z.ZodOptional<z.ZodString>;
15
+ required: z.ZodOptional<z.ZodBoolean>;
16
+ array: z.ZodOptional<z.ZodBoolean>;
17
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
18
+ xdefault: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
19
+ format: z.ZodOptional<z.ZodString>;
20
+ size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
21
+ min: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
22
+ max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
23
+ elements: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
+ encrypt: z.ZodOptional<z.ZodBoolean>;
25
+ relatedCollection: z.ZodOptional<z.ZodString>;
26
+ relationType: z.ZodOptional<z.ZodString>;
27
+ twoWay: z.ZodOptional<z.ZodBoolean>;
28
+ twoWayKey: z.ZodOptional<z.ZodString>;
29
+ onDelete: z.ZodOptional<z.ZodString>;
30
+ side: z.ZodOptional<z.ZodString>;
31
+ importMapping: z.ZodOptional<z.ZodObject<{
32
+ originalIdField: z.ZodString;
33
+ targetField: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$loose>, z.ZodDiscriminatedUnion<[z.ZodObject<{
36
+ array: z.ZodOptional<z.ZodBoolean>;
37
+ format: z.ZodOptional<z.ZodString>;
38
+ key: z.ZodString;
39
+ status: z.ZodOptional<z.ZodString>;
40
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
43
+ $createdAt: z.ZodOptional<z.ZodString>;
44
+ $updatedAt: z.ZodOptional<z.ZodString>;
45
+ error: z.ZodOptional<z.ZodString>;
46
+ type: z.ZodLiteral<"string">;
47
+ size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
48
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ encrypt: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ array: z.ZodOptional<z.ZodBoolean>;
52
+ format: z.ZodOptional<z.ZodString>;
53
+ key: z.ZodString;
54
+ status: z.ZodOptional<z.ZodString>;
55
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
57
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
58
+ $createdAt: z.ZodOptional<z.ZodString>;
59
+ $updatedAt: z.ZodOptional<z.ZodString>;
60
+ error: z.ZodOptional<z.ZodString>;
61
+ type: z.ZodLiteral<"integer">;
62
+ min: z.ZodOptional<z.ZodNumber>;
63
+ max: z.ZodOptional<z.ZodNumber>;
64
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ array: z.ZodOptional<z.ZodBoolean>;
67
+ format: z.ZodOptional<z.ZodString>;
68
+ key: z.ZodString;
69
+ status: z.ZodOptional<z.ZodString>;
70
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
73
+ $createdAt: z.ZodOptional<z.ZodString>;
74
+ $updatedAt: z.ZodOptional<z.ZodString>;
75
+ error: z.ZodOptional<z.ZodString>;
76
+ type: z.ZodLiteral<"double">;
77
+ min: z.ZodOptional<z.ZodNumber>;
78
+ max: z.ZodOptional<z.ZodNumber>;
79
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ array: z.ZodOptional<z.ZodBoolean>;
82
+ format: z.ZodOptional<z.ZodString>;
83
+ key: z.ZodString;
84
+ status: z.ZodOptional<z.ZodString>;
85
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
88
+ $createdAt: z.ZodOptional<z.ZodString>;
89
+ $updatedAt: z.ZodOptional<z.ZodString>;
90
+ error: z.ZodOptional<z.ZodString>;
91
+ type: z.ZodLiteral<"float">;
92
+ min: z.ZodOptional<z.ZodNumber>;
93
+ max: z.ZodOptional<z.ZodNumber>;
94
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ array: z.ZodOptional<z.ZodBoolean>;
97
+ format: z.ZodOptional<z.ZodString>;
98
+ key: z.ZodString;
99
+ status: z.ZodOptional<z.ZodString>;
100
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
103
+ $createdAt: z.ZodOptional<z.ZodString>;
104
+ $updatedAt: z.ZodOptional<z.ZodString>;
105
+ error: z.ZodOptional<z.ZodString>;
106
+ type: z.ZodLiteral<"boolean">;
107
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ array: z.ZodOptional<z.ZodBoolean>;
110
+ format: z.ZodOptional<z.ZodString>;
111
+ key: z.ZodString;
112
+ status: z.ZodOptional<z.ZodString>;
113
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
116
+ $createdAt: z.ZodOptional<z.ZodString>;
117
+ $updatedAt: z.ZodOptional<z.ZodString>;
118
+ error: z.ZodOptional<z.ZodString>;
119
+ type: z.ZodLiteral<"datetime">;
120
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ array: z.ZodOptional<z.ZodBoolean>;
123
+ format: z.ZodOptional<z.ZodString>;
124
+ key: z.ZodString;
125
+ status: z.ZodOptional<z.ZodString>;
126
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
129
+ $createdAt: z.ZodOptional<z.ZodString>;
130
+ $updatedAt: z.ZodOptional<z.ZodString>;
131
+ error: z.ZodOptional<z.ZodString>;
132
+ type: z.ZodLiteral<"email">;
133
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ array: z.ZodOptional<z.ZodBoolean>;
136
+ format: z.ZodOptional<z.ZodString>;
137
+ key: z.ZodString;
138
+ status: z.ZodOptional<z.ZodString>;
139
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
142
+ $createdAt: z.ZodOptional<z.ZodString>;
143
+ $updatedAt: z.ZodOptional<z.ZodString>;
144
+ error: z.ZodOptional<z.ZodString>;
145
+ type: z.ZodLiteral<"ip">;
146
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ array: z.ZodOptional<z.ZodBoolean>;
149
+ format: z.ZodOptional<z.ZodString>;
150
+ key: z.ZodString;
151
+ status: z.ZodOptional<z.ZodString>;
152
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
155
+ $createdAt: z.ZodOptional<z.ZodString>;
156
+ $updatedAt: z.ZodOptional<z.ZodString>;
157
+ error: z.ZodOptional<z.ZodString>;
158
+ type: z.ZodLiteral<"url">;
159
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ array: z.ZodOptional<z.ZodBoolean>;
162
+ format: z.ZodOptional<z.ZodString>;
163
+ key: z.ZodString;
164
+ status: z.ZodOptional<z.ZodString>;
165
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
166
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
167
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
168
+ $createdAt: z.ZodOptional<z.ZodString>;
169
+ $updatedAt: z.ZodOptional<z.ZodString>;
170
+ error: z.ZodOptional<z.ZodString>;
171
+ type: z.ZodLiteral<"enum">;
172
+ elements: z.ZodDefault<z.ZodArray<z.ZodString>>;
173
+ xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
174
+ }, z.core.$strip>, z.ZodObject<{
175
+ array: z.ZodOptional<z.ZodBoolean>;
176
+ format: z.ZodOptional<z.ZodString>;
177
+ key: z.ZodString;
178
+ status: z.ZodOptional<z.ZodString>;
179
+ attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
182
+ $createdAt: z.ZodOptional<z.ZodString>;
183
+ $updatedAt: z.ZodOptional<z.ZodString>;
184
+ error: z.ZodOptional<z.ZodString>;
185
+ type: z.ZodLiteral<"relationship">;
186
+ relatedCollection: z.ZodString;
187
+ relationType: z.ZodEnum<{
188
+ oneToMany: "oneToMany";
189
+ manyToOne: "manyToOne";
190
+ oneToOne: "oneToOne";
191
+ manyToMany: "manyToMany";
192
+ }>;
193
+ twoWay: z.ZodBoolean;
194
+ twoWayKey: z.ZodOptional<z.ZodString>;
195
+ onDelete: z.ZodDefault<z.ZodEnum<{
196
+ setNull: "setNull";
197
+ cascade: "cascade";
198
+ restrict: "restrict";
199
+ }>>;
200
+ side: z.ZodOptional<z.ZodEnum<{
201
+ parent: "parent";
202
+ child: "child";
203
+ }>>;
204
+ importMapping: z.ZodOptional<z.ZodObject<{
205
+ originalIdField: z.ZodString;
206
+ targetField: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>>;
208
+ }, z.core.$strip>], "type">>>>;
209
+ $id: z.ZodOptional<z.ZodString>;
210
+ enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
211
+ documentSecurity: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
212
+ $permissions: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
213
+ permission: z.ZodString;
214
+ target: z.ZodString;
215
+ }, z.core.$strip>>>>;
216
+ indexes: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
217
+ key: z.ZodString;
218
+ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
219
+ key: "key";
220
+ unique: "unique";
221
+ fulltext: "fulltext";
222
+ }>>>;
223
+ status: z.ZodOptional<z.ZodString>;
224
+ error: z.ZodOptional<z.ZodString>;
225
+ attributes: z.ZodArray<z.ZodString>;
226
+ orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
227
+ }, z.core.$strip>>>>, z.ZodTransform<{
228
+ key: string;
229
+ type: "key" | "unique" | "fulltext";
230
+ attributes: string[];
231
+ status?: string | undefined;
232
+ error?: string | undefined;
233
+ orders?: string[] | undefined;
234
+ }[], {
235
+ key: string;
236
+ type: "key" | "unique" | "fulltext";
237
+ attributes: string[];
238
+ status?: string | undefined;
239
+ error?: string | undefined;
240
+ orders?: string[] | undefined;
241
+ }[]>>;
242
+ importDefs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
243
+ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
244
+ create: "create";
245
+ update: "update";
246
+ }>>>;
247
+ filePath: z.ZodString;
248
+ basePath: z.ZodOptional<z.ZodString>;
249
+ primaryKeyField: z.ZodDefault<z.ZodString>;
250
+ idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
251
+ sourceField: z.ZodString;
252
+ fieldToSet: z.ZodOptional<z.ZodString>;
253
+ targetFieldToMatch: z.ZodOptional<z.ZodString>;
254
+ targetField: z.ZodString;
255
+ targetCollection: z.ZodString;
256
+ }, z.core.$strip>>>;
257
+ createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
258
+ updateMapping: z.ZodOptional<z.ZodObject<{
259
+ originalIdField: z.ZodString;
260
+ targetField: z.ZodString;
261
+ }, z.core.$strip>>;
262
+ attributeMappings: z.ZodArray<z.ZodObject<{
263
+ oldKey: z.ZodOptional<z.ZodString>;
264
+ oldKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
265
+ targetKey: z.ZodString;
266
+ valueToSet: z.ZodOptional<z.ZodAny>;
267
+ fileData: z.ZodOptional<z.ZodObject<{
268
+ name: z.ZodString;
269
+ path: z.ZodString;
270
+ }, z.core.$strip>>;
271
+ converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
272
+ validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
273
+ action: z.ZodString;
274
+ params: z.ZodArray<z.ZodString>;
275
+ }, z.core.$strip>>>>;
276
+ postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
277
+ action: z.ZodString;
278
+ params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
279
+ }, z.core.$strip>>>>;
280
+ }, z.core.$strip>>;
281
+ }, z.core.$strip>>>>;
282
+ databaseId: z.ZodOptional<z.ZodString>;
283
+ databaseIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
284
+ }, z.core.$strip>>;
285
+ data: z.ZodArray<z.ZodObject<{
286
+ rawData: z.ZodAny;
287
+ finalData: z.ZodAny;
288
+ context: z.ZodAny;
289
+ importDef: z.ZodOptional<z.ZodObject<{
290
+ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
291
+ create: "create";
292
+ update: "update";
293
+ }>>>;
294
+ filePath: z.ZodString;
295
+ basePath: z.ZodOptional<z.ZodString>;
296
+ primaryKeyField: z.ZodDefault<z.ZodString>;
297
+ idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
298
+ sourceField: z.ZodString;
299
+ fieldToSet: z.ZodOptional<z.ZodString>;
300
+ targetFieldToMatch: z.ZodOptional<z.ZodString>;
301
+ targetField: z.ZodString;
302
+ targetCollection: z.ZodString;
303
+ }, z.core.$strip>>>;
304
+ createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
305
+ updateMapping: z.ZodOptional<z.ZodObject<{
306
+ originalIdField: z.ZodString;
307
+ targetField: z.ZodString;
308
+ }, z.core.$strip>>;
309
+ attributeMappings: z.ZodArray<z.ZodObject<{
310
+ oldKey: z.ZodOptional<z.ZodString>;
311
+ oldKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
312
+ targetKey: z.ZodString;
313
+ valueToSet: z.ZodOptional<z.ZodAny>;
314
+ fileData: z.ZodOptional<z.ZodObject<{
315
+ name: z.ZodString;
316
+ path: z.ZodString;
317
+ }, z.core.$strip>>;
318
+ converters: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
319
+ validationActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
320
+ action: z.ZodString;
321
+ params: z.ZodArray<z.ZodString>;
322
+ }, z.core.$strip>>>>;
323
+ postImportActions: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
324
+ action: z.ZodString;
325
+ params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
326
+ }, z.core.$strip>>>>;
327
+ }, z.core.$strip>>;
328
+ }, z.core.$strip>>;
329
+ }, z.core.$strip>>;
330
+ }, z.core.$strip>;
331
+ export type CollectionImportData = z.infer<typeof CollectionImportDataSchema>;
332
+ export declare class DataLoader {
333
+ private appwriteFolderPath;
334
+ private importDataActions;
335
+ private database;
336
+ private usersController;
337
+ private config;
338
+ importMap: Map<string, {
339
+ data: {
340
+ rawData: any;
341
+ finalData: any;
342
+ context: any;
343
+ importDef?: {
344
+ filePath: string;
345
+ primaryKeyField: string;
346
+ attributeMappings: {
347
+ targetKey: string;
348
+ oldKey?: string | undefined;
349
+ oldKeys?: string[] | undefined;
350
+ valueToSet?: any;
351
+ fileData?: {
352
+ name: string;
353
+ path: string;
354
+ } | undefined;
355
+ converters?: string[] | undefined;
356
+ validationActions?: {
357
+ action: string;
358
+ params: string[];
359
+ }[] | undefined;
360
+ postImportActions?: {
361
+ action: string;
362
+ params: (string | Record<string, any>)[];
363
+ }[] | undefined;
364
+ }[];
365
+ type?: "create" | "update" | undefined;
366
+ basePath?: string | undefined;
367
+ idMappings?: {
368
+ sourceField: string;
369
+ targetField: string;
370
+ targetCollection: string;
371
+ fieldToSet?: string | undefined;
372
+ targetFieldToMatch?: string | undefined;
373
+ }[] | undefined;
374
+ createUsers?: boolean | null | undefined;
375
+ updateMapping?: {
376
+ originalIdField: string;
377
+ targetField: string;
378
+ } | undefined;
379
+ } | undefined;
380
+ }[];
381
+ collection?: {
382
+ name: string;
383
+ attributes: ({
384
+ key: string;
385
+ required: boolean;
386
+ type: "string";
387
+ size: number;
388
+ array?: boolean | undefined;
389
+ format?: string | undefined;
390
+ status?: string | undefined;
391
+ attributes?: string[] | undefined;
392
+ orders?: string[] | undefined;
393
+ $createdAt?: string | undefined;
394
+ $updatedAt?: string | undefined;
395
+ error?: string | undefined;
396
+ xdefault?: string | null | undefined;
397
+ encrypt?: boolean | undefined;
398
+ } | {
399
+ key: string;
400
+ required: boolean;
401
+ type: "integer";
402
+ array?: boolean | undefined;
403
+ format?: string | undefined;
404
+ status?: string | undefined;
405
+ attributes?: string[] | undefined;
406
+ orders?: string[] | undefined;
407
+ $createdAt?: string | undefined;
408
+ $updatedAt?: string | undefined;
409
+ error?: string | undefined;
410
+ min?: number | undefined;
411
+ max?: number | undefined;
412
+ xdefault?: number | null | undefined;
413
+ } | {
414
+ key: string;
415
+ required: boolean;
416
+ type: "double";
417
+ array?: boolean | undefined;
418
+ format?: string | undefined;
419
+ status?: string | undefined;
420
+ attributes?: string[] | undefined;
421
+ orders?: string[] | undefined;
422
+ $createdAt?: string | undefined;
423
+ $updatedAt?: string | undefined;
424
+ error?: string | undefined;
425
+ min?: number | undefined;
426
+ max?: number | undefined;
427
+ xdefault?: number | null | undefined;
428
+ } | {
429
+ key: string;
430
+ required: boolean;
431
+ type: "float";
432
+ array?: boolean | undefined;
433
+ format?: string | undefined;
434
+ status?: string | undefined;
435
+ attributes?: string[] | undefined;
436
+ orders?: string[] | undefined;
437
+ $createdAt?: string | undefined;
438
+ $updatedAt?: string | undefined;
439
+ error?: string | undefined;
440
+ min?: number | undefined;
441
+ max?: number | undefined;
442
+ xdefault?: number | null | undefined;
443
+ } | {
444
+ key: string;
445
+ required: boolean;
446
+ type: "boolean";
447
+ array?: boolean | undefined;
448
+ format?: string | undefined;
449
+ status?: string | undefined;
450
+ attributes?: string[] | undefined;
451
+ orders?: string[] | undefined;
452
+ $createdAt?: string | undefined;
453
+ $updatedAt?: string | undefined;
454
+ error?: string | undefined;
455
+ xdefault?: boolean | null | undefined;
456
+ } | {
457
+ key: string;
458
+ required: boolean;
459
+ type: "datetime";
460
+ array?: boolean | undefined;
461
+ format?: string | undefined;
462
+ status?: string | undefined;
463
+ attributes?: string[] | undefined;
464
+ orders?: string[] | undefined;
465
+ $createdAt?: string | undefined;
466
+ $updatedAt?: string | undefined;
467
+ error?: string | undefined;
468
+ xdefault?: string | null | undefined;
469
+ } | {
470
+ key: string;
471
+ required: boolean;
472
+ type: "email";
473
+ array?: boolean | undefined;
474
+ format?: string | undefined;
475
+ status?: string | undefined;
476
+ attributes?: string[] | undefined;
477
+ orders?: string[] | undefined;
478
+ $createdAt?: string | undefined;
479
+ $updatedAt?: string | undefined;
480
+ error?: string | undefined;
481
+ xdefault?: string | null | undefined;
482
+ } | {
483
+ key: string;
484
+ required: boolean;
485
+ type: "ip";
486
+ array?: boolean | undefined;
487
+ format?: string | undefined;
488
+ status?: string | undefined;
489
+ attributes?: string[] | undefined;
490
+ orders?: string[] | undefined;
491
+ $createdAt?: string | undefined;
492
+ $updatedAt?: string | undefined;
493
+ error?: string | undefined;
494
+ xdefault?: string | null | undefined;
495
+ } | {
496
+ key: string;
497
+ required: boolean;
498
+ type: "url";
499
+ array?: boolean | undefined;
500
+ format?: string | undefined;
501
+ status?: string | undefined;
502
+ attributes?: string[] | undefined;
503
+ orders?: string[] | undefined;
504
+ $createdAt?: string | undefined;
505
+ $updatedAt?: string | undefined;
506
+ error?: string | undefined;
507
+ xdefault?: string | null | undefined;
508
+ } | {
509
+ key: string;
510
+ required: boolean;
511
+ type: "enum";
512
+ elements: string[];
513
+ array?: boolean | undefined;
514
+ format?: string | undefined;
515
+ status?: string | undefined;
516
+ attributes?: string[] | undefined;
517
+ orders?: string[] | undefined;
518
+ $createdAt?: string | undefined;
519
+ $updatedAt?: string | undefined;
520
+ error?: string | undefined;
521
+ xdefault?: string | null | undefined;
522
+ } | {
523
+ key: string;
524
+ required: boolean;
525
+ type: "relationship";
526
+ relatedCollection: string;
527
+ relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
528
+ twoWay: boolean;
529
+ onDelete: "setNull" | "cascade" | "restrict";
530
+ array?: boolean | undefined;
531
+ format?: string | undefined;
532
+ status?: string | undefined;
533
+ attributes?: string[] | undefined;
534
+ orders?: string[] | undefined;
535
+ $createdAt?: string | undefined;
536
+ $updatedAt?: string | undefined;
537
+ error?: string | undefined;
538
+ twoWayKey?: string | undefined;
539
+ side?: "parent" | "child" | undefined;
540
+ importMapping?: {
541
+ originalIdField: string;
542
+ targetField?: string | undefined;
543
+ } | undefined;
544
+ })[];
545
+ $permissions: {
546
+ permission: string;
547
+ target: string;
548
+ }[];
549
+ indexes: {
550
+ key: string;
551
+ type: "key" | "unique" | "fulltext";
552
+ attributes: string[];
553
+ status?: string | undefined;
554
+ error?: string | undefined;
555
+ orders?: string[] | undefined;
556
+ }[];
557
+ importDefs: {
558
+ filePath: string;
559
+ primaryKeyField: string;
560
+ attributeMappings: {
561
+ targetKey: string;
562
+ oldKey?: string | undefined;
563
+ oldKeys?: string[] | undefined;
564
+ valueToSet?: any;
565
+ fileData?: {
566
+ name: string;
567
+ path: string;
568
+ } | undefined;
569
+ converters?: string[] | undefined;
570
+ validationActions?: {
571
+ action: string;
572
+ params: string[];
573
+ }[] | undefined;
574
+ postImportActions?: {
575
+ action: string;
576
+ params: (string | Record<string, any>)[];
577
+ }[] | undefined;
578
+ }[];
579
+ type?: "create" | "update" | undefined;
580
+ basePath?: string | undefined;
581
+ idMappings?: {
582
+ sourceField: string;
583
+ targetField: string;
584
+ targetCollection: string;
585
+ fieldToSet?: string | undefined;
586
+ targetFieldToMatch?: string | undefined;
587
+ }[] | undefined;
588
+ createUsers?: boolean | null | undefined;
589
+ updateMapping?: {
590
+ originalIdField: string;
591
+ targetField: string;
592
+ } | undefined;
593
+ }[];
594
+ $id?: string | undefined;
595
+ enabled?: boolean | undefined;
596
+ documentSecurity?: boolean | undefined;
597
+ databaseId?: string | undefined;
598
+ databaseIds?: string[] | undefined;
599
+ } | undefined;
600
+ }>;
601
+ private oldIdToNewIdPerCollectionMap;
602
+ collectionImportOperations: Map<string, string>;
603
+ private mergedUserMap;
604
+ private emailToUserIdMap;
605
+ private phoneToUserIdMap;
606
+ private userIdSet;
607
+ userExistsMap: Map<string, boolean>;
608
+ private shouldWriteFile;
609
+ private _adapter;
610
+ private getAdapter;
611
+ constructor(appwriteFolderPath: string, importDataActions: ImportDataActions, database: Databases, config: AppwriteConfig, shouldWriteFile?: boolean);
612
+ getCollectionKey(name: string): string;
613
+ /**
614
+ * Merges two objects by updating the source object with the target object's values.
615
+ * It iterates through the target object's keys and updates the source object if:
616
+ * - The source object has the key.
617
+ * - The target object's value for that key is not null, undefined, or an empty string.
618
+ * - If the target object has an array value, it concatenates the values and removes duplicates.
619
+ *
620
+ * @param source - The source object to be updated.
621
+ * @param target - The target object with values to update the source object.
622
+ * @returns The updated source object.
623
+ */
624
+ mergeObjects(source: any, update: any): any;
625
+ loadData(importDef: ImportDef): any[];
626
+ checkMapValuesForId(newId: string, collectionName: string): string | false;
627
+ getTrueUniqueId(collectionName: string): string;
628
+ createContext(db: ConfigDatabase, collection: CollectionCreate, item: any, docId: string): any;
629
+ /**
630
+ * Transforms the given item based on the provided attribute mappings.
631
+ * This method applies conversion rules to the item's attributes as defined in the attribute mappings.
632
+ *
633
+ * @param item - The item to be transformed.
634
+ * @param attributeMappings - The mappings that define how each attribute should be transformed.
635
+ * @returns The transformed item.
636
+ */
637
+ transformData(item: any, attributeMappings: AttributeMappings): any;
638
+ setupMaps(dbId: string, specificCollections?: string[]): Promise<void>;
639
+ getAllUsers(): Promise<import("node-appwrite").Models.User<import("node-appwrite").Models.Preferences>[]>;
640
+ start(dbId: string, specificCollections?: string[]): Promise<void>;
641
+ /**
642
+ * Deals with merged users by iterating through all collections in the configuration.
643
+ * We have merged users if there are duplicate emails or phones in the import data.
644
+ * This function will iterate through all collections that are the same name as the
645
+ * users collection and pull out their primaryKeyField's. It will then loop through
646
+ * each collection and find any documents that have a
647
+ *
648
+ * @return {void} This function does not return anything.
649
+ */
650
+ /**
651
+ * Gets the value to match for a given key in the final data or context.
652
+ * @param finalData - The final data object.
653
+ * @param context - The context object.
654
+ * @param key - The key to get the value for.
655
+ * @returns The value to match for from finalData or Context
656
+ */
657
+ getValueFromData(finalData: any, context: any, key: string): any;
658
+ updateOldReferencesForNew(): void;
659
+ private writeMapsToJsonFile;
660
+ /**
661
+ * Prepares user data by checking for duplicates based on email or phone, adding to a duplicate map if found,
662
+ * and then returning the transformed item without user-specific keys.
663
+ *
664
+ * @param item - The raw item to be processed.
665
+ * @param attributeMappings - The attribute mappings for the item.
666
+ * @returns The transformed item with user-specific keys removed.
667
+ */
668
+ prepareUserData(item: any, attributeMappings: AttributeMappings, primaryKeyField: string, newId: string): {
669
+ transformedItem: any;
670
+ existingId: string | undefined;
671
+ userData: {
672
+ rawData: any;
673
+ finalData: z.infer<typeof AuthUserCreateSchema>;
674
+ };
675
+ };
676
+ /**
677
+ * Prepares the data for creating user collection documents.
678
+ * This involves loading the data, transforming it according to the import definition,
679
+ * and handling the creation of new unique IDs for each item.
680
+ *
681
+ * @param db - The database configuration.
682
+ * @param collection - The collection configuration.
683
+ * @param importDef - The import definition containing the attribute mappings and other relevant info.
684
+ */
685
+ prepareUserCollectionCreateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
686
+ /**
687
+ * Prepares the data for creating documents in a collection.
688
+ * This involves loading the data, transforming it, and handling ID mappings.
689
+ *
690
+ * @param db - The database configuration.
691
+ * @param collection - The collection configuration.
692
+ * @param importDef - The import definition containing the attribute mappings and other relevant info.
693
+ */
694
+ prepareCreateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
695
+ /**
696
+ * Prepares the data for updating documents within a collection.
697
+ * This method loads the raw data based on the import definition, transforms it according to the attribute mappings,
698
+ * finds the new ID for each item based on the primary key or update mapping, and then validates the transformed data.
699
+ * If the data is valid, it updates the import definition with any post-import actions and adds the item to the current collection data.
700
+ *
701
+ * @param db - The database configuration.
702
+ * @param collection - The collection configuration.
703
+ * @param importDef - The import definition containing the attribute mappings and other relevant info.
704
+ */
705
+ prepareUpdateData(db: ConfigDatabase, collection: CollectionCreate, importDef: ImportDef): Promise<void>;
706
+ private updateReferencesBasedOnAttributeMappings;
707
+ private getMergedId;
708
+ /**
709
+ * Generates attribute mappings with post-import actions based on the provided attribute mappings.
710
+ * This method checks each mapping for a fileData attribute and adds a post-import action to create a file
711
+ * and update the field with the file's ID if necessary.
712
+ *
713
+ * @param attributeMappings - The attribute mappings from the import definition.
714
+ * @param context - The context object containing information about the database, collection, and document.
715
+ * @param item - The item being imported, used for resolving template paths in fileData mappings.
716
+ * @returns The attribute mappings updated with any necessary post-import actions.
717
+ */
718
+ getAttributeMappingsWithActions(attributeMappings: AttributeMappings, context: any, item: any): ({
719
+ targetKey: string;
720
+ oldKey?: string | undefined;
721
+ oldKeys?: string[] | undefined;
722
+ valueToSet?: any;
723
+ fileData?: {
724
+ name: string;
725
+ path: string;
726
+ } | undefined;
727
+ converters?: string[] | undefined;
728
+ validationActions?: {
729
+ action: string;
730
+ params: string[];
731
+ }[] | undefined;
732
+ postImportActions?: {
733
+ action: string;
734
+ params: (string | Record<string, any>)[];
735
+ }[] | undefined;
736
+ } | {
737
+ postImportActions: {
738
+ action: string;
739
+ params: any[];
740
+ }[];
741
+ targetKey: string;
742
+ oldKey?: string | undefined;
743
+ oldKeys?: string[] | undefined;
744
+ valueToSet?: any;
745
+ fileData?: {
746
+ name: string;
747
+ path: string;
748
+ } | undefined;
749
+ converters?: string[] | undefined;
750
+ validationActions?: {
751
+ action: string;
752
+ params: string[];
753
+ }[] | undefined;
754
+ })[];
755
+ }