appwrite-utils-cli 1.3.5 → 1.4.1

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 (116) hide show
  1. package/dist/adapters/AdapterFactory.d.ts +87 -0
  2. package/dist/adapters/AdapterFactory.js +217 -0
  3. package/dist/adapters/DatabaseAdapter.d.ts +217 -0
  4. package/dist/adapters/DatabaseAdapter.js +50 -0
  5. package/dist/adapters/LegacyAdapter.d.ts +49 -0
  6. package/dist/adapters/LegacyAdapter.js +382 -0
  7. package/dist/adapters/TablesDBAdapter.d.ts +55 -0
  8. package/dist/adapters/TablesDBAdapter.js +302 -0
  9. package/dist/adapters/index.d.ts +11 -0
  10. package/dist/adapters/index.js +12 -0
  11. package/dist/collections/attributes.js +41 -22
  12. package/dist/collections/methods.d.ts +4 -3
  13. package/dist/collections/methods.js +34 -14
  14. package/dist/config/yamlConfig.d.ts +40 -437
  15. package/dist/config/yamlConfig.js +8 -2
  16. package/dist/databases/setup.js +2 -2
  17. package/dist/main.js +0 -0
  18. package/dist/migrations/appwriteToX.d.ts +26 -37
  19. package/dist/migrations/comprehensiveTransfer.js +4 -4
  20. package/dist/migrations/dataLoader.d.ts +124 -1484
  21. package/dist/migrations/dataLoader.js +2 -1
  22. package/dist/migrations/relationships.d.ts +2 -3
  23. package/dist/migrations/relationships.js +1 -1
  24. package/dist/migrations/services/UserMappingService.js +1 -1
  25. package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +24 -279
  26. package/dist/migrations/yaml/YamlImportConfigLoader.js +7 -2
  27. package/dist/schemas/authUser.d.ts +7 -47
  28. package/dist/schemas/authUser.js +1 -1
  29. package/dist/shared/jsonSchemaGenerator.d.ts +0 -2
  30. package/dist/shared/jsonSchemaGenerator.js +4 -17
  31. package/dist/shared/migrationHelpers.d.ts +17 -119
  32. package/dist/shared/operationQueue.js +16 -7
  33. package/dist/shared/schemaGenerator.js +2 -17
  34. package/dist/storage/schemas.d.ts +149 -296
  35. package/dist/users/methods.d.ts +2 -2
  36. package/dist/utils/configMigration.js +0 -1
  37. package/dist/utils/getClientFromConfig.d.ts +26 -0
  38. package/dist/utils/getClientFromConfig.js +37 -0
  39. package/dist/utils/loadConfigs.js +0 -2
  40. package/dist/utils/schemaStrings.js +2 -17
  41. package/dist/utils/setupFiles.js +2 -0
  42. package/dist/utils/versionDetection.d.ts +56 -0
  43. package/dist/utils/versionDetection.js +217 -0
  44. package/dist/utils/yamlConverter.d.ts +0 -1
  45. package/dist/utils/yamlConverter.js +0 -2
  46. package/dist/utilsController.js +2 -0
  47. package/package.json +3 -2
  48. package/src/adapters/AdapterFactory.ts +296 -0
  49. package/src/adapters/DatabaseAdapter.ts +290 -0
  50. package/src/adapters/LegacyAdapter.ts +667 -0
  51. package/src/adapters/TablesDBAdapter.ts +429 -0
  52. package/src/adapters/index.ts +37 -0
  53. package/src/collections/attributes.ts +347 -153
  54. package/src/collections/methods.ts +43 -28
  55. package/src/config/yamlConfig.ts +8 -2
  56. package/src/databases/setup.ts +2 -2
  57. package/src/migrations/afterImportActions.ts +2 -2
  58. package/src/migrations/comprehensiveTransfer.ts +4 -0
  59. package/src/migrations/dataLoader.ts +2 -1
  60. package/src/migrations/relationships.ts +1 -1
  61. package/src/migrations/services/UserMappingService.ts +1 -1
  62. package/src/migrations/yaml/YamlImportConfigLoader.ts +7 -2
  63. package/src/schemas/authUser.ts +1 -1
  64. package/src/shared/jsonSchemaGenerator.ts +4 -19
  65. package/src/shared/operationQueue.ts +20 -13
  66. package/src/shared/schemaGenerator.ts +2 -16
  67. package/src/types/node-appwrite-tablesdb.d.ts +44 -0
  68. package/src/users/methods.ts +2 -2
  69. package/src/utils/configMigration.ts +0 -1
  70. package/src/utils/getClientFromConfig.ts +56 -0
  71. package/src/utils/loadConfigs.ts +0 -2
  72. package/src/utils/schemaStrings.ts +2 -16
  73. package/src/utils/setupFiles.ts +2 -0
  74. package/src/utils/versionDetection.ts +265 -0
  75. package/src/utils/yamlConverter.ts +0 -2
  76. package/src/utilsController.ts +2 -0
  77. package/dist/functions/openapi.d.ts +0 -4
  78. package/dist/functions/openapi.js +0 -60
  79. package/dist/migrations/attributes.d.ts +0 -4
  80. package/dist/migrations/attributes.js +0 -301
  81. package/dist/migrations/backup.d.ts +0 -687
  82. package/dist/migrations/backup.js +0 -175
  83. package/dist/migrations/collections.d.ts +0 -22
  84. package/dist/migrations/collections.js +0 -347
  85. package/dist/migrations/converters.d.ts +0 -46
  86. package/dist/migrations/converters.js +0 -139
  87. package/dist/migrations/databases.d.ts +0 -2
  88. package/dist/migrations/databases.js +0 -28
  89. package/dist/migrations/dbHelpers.d.ts +0 -5
  90. package/dist/migrations/dbHelpers.js +0 -57
  91. package/dist/migrations/helper.d.ts +0 -3
  92. package/dist/migrations/helper.js +0 -21
  93. package/dist/migrations/indexes.d.ts +0 -4
  94. package/dist/migrations/indexes.js +0 -19
  95. package/dist/migrations/logging.d.ts +0 -10
  96. package/dist/migrations/logging.js +0 -46
  97. package/dist/migrations/migrationHelper.d.ts +0 -173
  98. package/dist/migrations/migrationHelper.js +0 -130
  99. package/dist/migrations/openapi.d.ts +0 -4
  100. package/dist/migrations/openapi.js +0 -60
  101. package/dist/migrations/queue.d.ts +0 -13
  102. package/dist/migrations/queue.js +0 -79
  103. package/dist/migrations/schemaStrings.d.ts +0 -14
  104. package/dist/migrations/schemaStrings.js +0 -478
  105. package/dist/migrations/setupDatabase.d.ts +0 -6
  106. package/dist/migrations/setupDatabase.js +0 -115
  107. package/dist/migrations/storage.d.ts +0 -10
  108. package/dist/migrations/storage.js +0 -340
  109. package/dist/migrations/users.d.ts +0 -16
  110. package/dist/migrations/users.js +0 -276
  111. package/dist/migrations/validationRules.d.ts +0 -43
  112. package/dist/migrations/validationRules.js +0 -42
  113. package/dist/shared/attributeManager.d.ts +0 -17
  114. package/dist/shared/attributeManager.js +0 -272
  115. package/src/functions/openapi.ts +0 -83
  116. package/src/shared/attributeManager.ts +0 -428
@@ -619,7 +619,7 @@ export class DataLoader {
619
619
  userData.data.email = userData.data.email.toLowerCase();
620
620
  }
621
621
  if (!userData.success || !(userData.data.email || userData.data.phone)) {
622
- logger.error(`Invalid user data: ${JSON.stringify(userData.error?.errors, undefined, 2)} or missing email/phone`);
622
+ logger.error(`Invalid user data: ${JSON.stringify(userData.error?.issues, undefined, 2)} or missing email/phone`);
623
623
  const userKeys = ["email", "phone", "name", "labels", "prefs"];
624
624
  userKeys.forEach((key) => {
625
625
  if (transformedItem.hasOwnProperty(key)) {
@@ -719,6 +719,7 @@ export class DataLoader {
719
719
  const userDataToAdd = {
720
720
  rawData: item,
721
721
  finalData: userData.data,
722
+ context: {},
722
723
  };
723
724
  this.importMap.set(this.getCollectionKey("users"), {
724
725
  data: [...(usersMap?.data || []), userDataToAdd],
@@ -4,18 +4,17 @@ import type { AppwriteConfig } from "appwrite-utils";
4
4
  * Finds collections that have defined relationship attributes.
5
5
  */
6
6
  export declare const findCollectionsWithRelationships: (config: AppwriteConfig) => Map<string, {
7
- type: "relationship";
8
7
  key: string;
8
+ type: "relationship";
9
9
  relatedCollection: string;
10
10
  relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
11
11
  twoWay: boolean;
12
12
  twoWayKey: string;
13
13
  onDelete: "setNull" | "cascade" | "restrict";
14
14
  side: "parent" | "child";
15
- description?: string | Record<string, string> | null | undefined;
15
+ error?: string | undefined;
16
16
  required?: boolean | undefined;
17
17
  array?: boolean | undefined;
18
- error?: string | undefined;
19
18
  importMapping?: {
20
19
  originalIdField: string;
21
20
  targetField?: string | undefined;
@@ -136,7 +136,7 @@ async function prepareDocumentUpdates(database, dbId, collectionName, documents,
136
136
  console.log(`Related collection ${rel.relatedCollection} not found, skipping...`);
137
137
  continue;
138
138
  }
139
- const foundDocuments = await findDocumentsByOriginalId(database, dbId, relatedCollection, targetField, originalId);
139
+ const foundDocuments = await findDocumentsByOriginalId(database, dbId, relatedCollection, targetField, String(originalId));
140
140
  if (foundDocuments && foundDocuments.length > 0) {
141
141
  const relationshipKey = rel.key;
142
142
  const existingRefs = doc[relationshipKey] || [];
@@ -99,7 +99,7 @@ export class UserMappingService {
99
99
  userData.data.email = userData.data.email.toLowerCase();
100
100
  }
101
101
  if (!userData.success || !(userData.data.email || userData.data.phone)) {
102
- logger.error(`Invalid user data: ${JSON.stringify(userData.error?.errors, undefined, 2)} or missing email/phone`);
102
+ logger.error(`Invalid user data: ${JSON.stringify(userData.error?.issues, undefined, 2)} or missing email/phone`);
103
103
  const userKeys = ["email", "phone", "name", "labels", "prefs"];
104
104
  userKeys.forEach((key) => {
105
105
  if (transformedItem.hasOwnProperty(key)) {
@@ -4,180 +4,49 @@ export declare const YamlImportConfigSchema: z.ZodObject<{
4
4
  source: z.ZodObject<{
5
5
  file: z.ZodString;
6
6
  basePath: z.ZodOptional<z.ZodString>;
7
- type: z.ZodDefault<z.ZodEnum<["json", "csv", "yaml"]>>;
8
- }, "strip", z.ZodTypeAny, {
9
- type: "json" | "csv" | "yaml";
10
- file: string;
11
- basePath?: string | undefined;
12
- }, {
13
- file: string;
14
- type?: "json" | "csv" | "yaml" | undefined;
15
- basePath?: string | undefined;
16
- }>;
7
+ type: z.ZodDefault<z.ZodEnum<{
8
+ json: "json";
9
+ csv: "csv";
10
+ yaml: "yaml";
11
+ }>>;
12
+ }, z.core.$strip>;
17
13
  target: z.ZodObject<{
18
14
  collection: z.ZodString;
19
- type: z.ZodDefault<z.ZodEnum<["create", "update"]>>;
15
+ type: z.ZodDefault<z.ZodEnum<{
16
+ create: "create";
17
+ update: "update";
18
+ }>>;
20
19
  primaryKey: z.ZodDefault<z.ZodString>;
21
20
  createUsers: z.ZodDefault<z.ZodBoolean>;
22
- }, "strip", z.ZodTypeAny, {
23
- type: "create" | "update";
24
- collection: string;
25
- primaryKey: string;
26
- createUsers: boolean;
27
- }, {
28
- collection: string;
29
- type?: "create" | "update" | undefined;
30
- primaryKey?: string | undefined;
31
- createUsers?: boolean | undefined;
32
- }>;
21
+ }, z.core.$strip>;
33
22
  mapping: z.ZodObject<{
34
23
  attributes: z.ZodArray<z.ZodObject<{
35
24
  oldKey: z.ZodOptional<z.ZodString>;
36
- oldKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
+ oldKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
26
  targetKey: z.ZodString;
38
27
  valueToSet: z.ZodOptional<z.ZodAny>;
39
28
  fileData: z.ZodOptional<z.ZodObject<{
40
29
  path: z.ZodString;
41
30
  name: z.ZodString;
42
- }, "strip", z.ZodTypeAny, {
43
- path: string;
44
- name: string;
45
- }, {
46
- path: string;
47
- name: string;
48
- }>>;
49
- converters: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
31
+ }, z.core.$strip>>;
32
+ converters: z.ZodDefault<z.ZodArray<z.ZodString>>;
50
33
  validation: z.ZodDefault<z.ZodArray<z.ZodObject<{
51
34
  rule: z.ZodString;
52
- params: z.ZodArray<z.ZodString, "many">;
53
- }, "strip", z.ZodTypeAny, {
54
- params: string[];
55
- rule: string;
56
- }, {
57
- params: string[];
58
- rule: string;
59
- }>, "many">>;
35
+ params: z.ZodArray<z.ZodString>;
36
+ }, z.core.$strip>>>;
60
37
  afterImport: z.ZodDefault<z.ZodArray<z.ZodObject<{
61
38
  action: z.ZodString;
62
- params: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">;
63
- }, "strip", z.ZodTypeAny, {
64
- params: (string | Record<string, any>)[];
65
- action: string;
66
- }, {
67
- params: (string | Record<string, any>)[];
68
- action: string;
69
- }>, "many">>;
70
- }, "strip", z.ZodTypeAny, {
71
- validation: {
72
- params: string[];
73
- rule: string;
74
- }[];
75
- targetKey: string;
76
- converters: string[];
77
- afterImport: {
78
- params: (string | Record<string, any>)[];
79
- action: string;
80
- }[];
81
- oldKey?: string | undefined;
82
- oldKeys?: string[] | undefined;
83
- valueToSet?: any;
84
- fileData?: {
85
- path: string;
86
- name: string;
87
- } | undefined;
88
- }, {
89
- targetKey: string;
90
- validation?: {
91
- params: string[];
92
- rule: string;
93
- }[] | undefined;
94
- oldKey?: string | undefined;
95
- oldKeys?: string[] | undefined;
96
- valueToSet?: any;
97
- fileData?: {
98
- path: string;
99
- name: string;
100
- } | undefined;
101
- converters?: string[] | undefined;
102
- afterImport?: {
103
- params: (string | Record<string, any>)[];
104
- action: string;
105
- }[] | undefined;
106
- }>, "many">;
39
+ params: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
40
+ }, z.core.$strip>>>;
41
+ }, z.core.$strip>>;
107
42
  relationships: z.ZodDefault<z.ZodArray<z.ZodObject<{
108
43
  sourceField: z.ZodString;
109
44
  targetField: z.ZodString;
110
45
  targetCollection: z.ZodString;
111
46
  fieldToSet: z.ZodOptional<z.ZodString>;
112
47
  targetFieldToMatch: z.ZodOptional<z.ZodString>;
113
- }, "strip", z.ZodTypeAny, {
114
- targetField: string;
115
- sourceField: string;
116
- targetCollection: string;
117
- fieldToSet?: string | undefined;
118
- targetFieldToMatch?: string | undefined;
119
- }, {
120
- targetField: string;
121
- sourceField: string;
122
- targetCollection: string;
123
- fieldToSet?: string | undefined;
124
- targetFieldToMatch?: string | undefined;
125
- }>, "many">>;
126
- }, "strip", z.ZodTypeAny, {
127
- attributes: {
128
- validation: {
129
- params: string[];
130
- rule: string;
131
- }[];
132
- targetKey: string;
133
- converters: string[];
134
- afterImport: {
135
- params: (string | Record<string, any>)[];
136
- action: string;
137
- }[];
138
- oldKey?: string | undefined;
139
- oldKeys?: string[] | undefined;
140
- valueToSet?: any;
141
- fileData?: {
142
- path: string;
143
- name: string;
144
- } | undefined;
145
- }[];
146
- relationships: {
147
- targetField: string;
148
- sourceField: string;
149
- targetCollection: string;
150
- fieldToSet?: string | undefined;
151
- targetFieldToMatch?: string | undefined;
152
- }[];
153
- }, {
154
- attributes: {
155
- targetKey: string;
156
- validation?: {
157
- params: string[];
158
- rule: string;
159
- }[] | undefined;
160
- oldKey?: string | undefined;
161
- oldKeys?: string[] | undefined;
162
- valueToSet?: any;
163
- fileData?: {
164
- path: string;
165
- name: string;
166
- } | undefined;
167
- converters?: string[] | undefined;
168
- afterImport?: {
169
- params: (string | Record<string, any>)[];
170
- action: string;
171
- }[] | undefined;
172
- }[];
173
- relationships?: {
174
- targetField: string;
175
- sourceField: string;
176
- targetCollection: string;
177
- fieldToSet?: string | undefined;
178
- targetFieldToMatch?: string | undefined;
179
- }[] | undefined;
180
- }>;
48
+ }, z.core.$strip>>>;
49
+ }, z.core.$strip>;
181
50
  options: z.ZodDefault<z.ZodObject<{
182
51
  batchSize: z.ZodDefault<z.ZodNumber>;
183
52
  skipValidation: z.ZodDefault<z.ZodBoolean>;
@@ -186,133 +55,9 @@ export declare const YamlImportConfigSchema: z.ZodObject<{
186
55
  updateMapping: z.ZodOptional<z.ZodObject<{
187
56
  originalIdField: z.ZodString;
188
57
  targetField: z.ZodString;
189
- }, "strip", z.ZodTypeAny, {
190
- targetField: string;
191
- originalIdField: string;
192
- }, {
193
- targetField: string;
194
- originalIdField: string;
195
- }>>;
196
- }, "strip", z.ZodTypeAny, {
197
- batchSize: number;
198
- dryRun: boolean;
199
- skipValidation: boolean;
200
- continueOnError: boolean;
201
- updateMapping?: {
202
- targetField: string;
203
- originalIdField: string;
204
- } | undefined;
205
- }, {
206
- batchSize?: number | undefined;
207
- dryRun?: boolean | undefined;
208
- skipValidation?: boolean | undefined;
209
- continueOnError?: boolean | undefined;
210
- updateMapping?: {
211
- targetField: string;
212
- originalIdField: string;
213
- } | undefined;
214
- }>>;
215
- }, "strip", z.ZodTypeAny, {
216
- options: {
217
- batchSize: number;
218
- dryRun: boolean;
219
- skipValidation: boolean;
220
- continueOnError: boolean;
221
- updateMapping?: {
222
- targetField: string;
223
- originalIdField: string;
224
- } | undefined;
225
- };
226
- target: {
227
- type: "create" | "update";
228
- collection: string;
229
- primaryKey: string;
230
- createUsers: boolean;
231
- };
232
- source: {
233
- type: "json" | "csv" | "yaml";
234
- file: string;
235
- basePath?: string | undefined;
236
- };
237
- mapping: {
238
- attributes: {
239
- validation: {
240
- params: string[];
241
- rule: string;
242
- }[];
243
- targetKey: string;
244
- converters: string[];
245
- afterImport: {
246
- params: (string | Record<string, any>)[];
247
- action: string;
248
- }[];
249
- oldKey?: string | undefined;
250
- oldKeys?: string[] | undefined;
251
- valueToSet?: any;
252
- fileData?: {
253
- path: string;
254
- name: string;
255
- } | undefined;
256
- }[];
257
- relationships: {
258
- targetField: string;
259
- sourceField: string;
260
- targetCollection: string;
261
- fieldToSet?: string | undefined;
262
- targetFieldToMatch?: string | undefined;
263
- }[];
264
- };
265
- }, {
266
- target: {
267
- collection: string;
268
- type?: "create" | "update" | undefined;
269
- primaryKey?: string | undefined;
270
- createUsers?: boolean | undefined;
271
- };
272
- source: {
273
- file: string;
274
- type?: "json" | "csv" | "yaml" | undefined;
275
- basePath?: string | undefined;
276
- };
277
- mapping: {
278
- attributes: {
279
- targetKey: string;
280
- validation?: {
281
- params: string[];
282
- rule: string;
283
- }[] | undefined;
284
- oldKey?: string | undefined;
285
- oldKeys?: string[] | undefined;
286
- valueToSet?: any;
287
- fileData?: {
288
- path: string;
289
- name: string;
290
- } | undefined;
291
- converters?: string[] | undefined;
292
- afterImport?: {
293
- params: (string | Record<string, any>)[];
294
- action: string;
295
- }[] | undefined;
296
- }[];
297
- relationships?: {
298
- targetField: string;
299
- sourceField: string;
300
- targetCollection: string;
301
- fieldToSet?: string | undefined;
302
- targetFieldToMatch?: string | undefined;
303
- }[] | undefined;
304
- };
305
- options?: {
306
- batchSize?: number | undefined;
307
- dryRun?: boolean | undefined;
308
- skipValidation?: boolean | undefined;
309
- continueOnError?: boolean | undefined;
310
- updateMapping?: {
311
- targetField: string;
312
- originalIdField: string;
313
- } | undefined;
314
- } | undefined;
315
- }>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>;
316
61
  export type YamlImportConfig = z.infer<typeof YamlImportConfigSchema>;
317
62
  /**
318
63
  * Service for loading and converting YAML import configurations.
@@ -59,7 +59,12 @@ export const YamlImportConfigSchema = z.object({
59
59
  originalIdField: z.string().describe("Field in source data for matching"),
60
60
  targetField: z.string().describe("Field in collection to match against"),
61
61
  }).optional().describe("Configuration for update operations"),
62
- }).default({}),
62
+ }).default(() => ({
63
+ batchSize: 50,
64
+ skipValidation: false,
65
+ dryRun: false,
66
+ continueOnError: true
67
+ })),
63
68
  });
64
69
  /**
65
70
  * Service for loading and converting YAML import configurations.
@@ -92,7 +97,7 @@ export class YamlImportConfigLoader {
92
97
  }
93
98
  catch (error) {
94
99
  if (error instanceof z.ZodError) {
95
- const errorMessages = error.errors.map(err => `${err.path.join('.')}: ${err.message}`);
100
+ const errorMessages = error.issues.map(err => `${err.path.join('.')}: ${err.message}`);
96
101
  throw new Error(`Invalid import configuration in ${configPath}:\n${errorMessages.join('\n')}`);
97
102
  }
98
103
  throw new Error(`Failed to load import configuration ${configPath}: ${error}`);
@@ -7,58 +7,18 @@ export declare const AuthUserSchema: z.ZodObject<{
7
7
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
8
  phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
9
  prefs: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
10
- labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
11
- }, "strip", z.ZodTypeAny, {
12
- $id: string;
13
- prefs: Record<string, string>;
14
- labels: string[];
15
- name?: string | null | undefined;
16
- $createdAt?: string | undefined;
17
- $updatedAt?: string | undefined;
18
- email?: string | null | undefined;
19
- phone?: string | null | undefined;
20
- }, {
21
- $id: string;
22
- name?: string | null | undefined;
23
- $createdAt?: string | undefined;
24
- $updatedAt?: string | undefined;
25
- email?: string | null | undefined;
26
- phone?: string | null | undefined;
27
- prefs?: Record<string, string> | undefined;
28
- labels?: string[] | undefined;
29
- }>;
10
+ labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
11
+ }, z.core.$strip>;
30
12
  export type AuthUser = z.infer<typeof AuthUserSchema>;
31
- export declare const AuthUserCreateSchema: z.ZodObject<Omit<{
32
- $id: z.ZodString;
33
- $createdAt: z.ZodOptional<z.ZodString>;
34
- $updatedAt: z.ZodOptional<z.ZodString>;
13
+ export declare const AuthUserCreateSchema: z.ZodObject<{
35
14
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
15
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ $createdAt: z.ZodOptional<z.ZodString>;
17
+ $updatedAt: z.ZodOptional<z.ZodString>;
37
18
  phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
19
  prefs: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
39
- labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
40
- }, "$id"> & {
20
+ labels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
41
21
  userId: z.ZodOptional<z.ZodString>;
42
22
  password: z.ZodOptional<z.ZodString>;
43
- }, "strip", z.ZodTypeAny, {
44
- prefs: Record<string, string>;
45
- labels: string[];
46
- password?: string | undefined;
47
- name?: string | null | undefined;
48
- $createdAt?: string | undefined;
49
- $updatedAt?: string | undefined;
50
- email?: string | null | undefined;
51
- phone?: string | null | undefined;
52
- userId?: string | undefined;
53
- }, {
54
- password?: string | undefined;
55
- name?: string | null | undefined;
56
- $createdAt?: string | undefined;
57
- $updatedAt?: string | undefined;
58
- email?: string | null | undefined;
59
- phone?: string | null | undefined;
60
- prefs?: Record<string, string> | undefined;
61
- labels?: string[] | undefined;
62
- userId?: string | undefined;
63
- }>;
23
+ }, z.core.$strip>;
64
24
  export type AuthUserCreate = z.infer<typeof AuthUserCreateSchema>;
@@ -6,7 +6,7 @@ export const AuthUserSchema = z.object({
6
6
  name: z.string().nullish(),
7
7
  email: z.string().email("Invalid Email Address").nullish(),
8
8
  phone: z.string().nullish(),
9
- prefs: z.record(z.string()).optional().default({}),
9
+ prefs: z.record(z.string(), z.string()).optional().default({}),
10
10
  labels: z.array(z.string()).optional().default([]),
11
11
  });
12
12
  export const AuthUserCreateSchema = AuthUserSchema.omit({
@@ -1,7 +1,6 @@
1
1
  import type { AppwriteConfig } from "appwrite-utils";
2
2
  export interface JsonSchemaProperty {
3
3
  type: string | string[];
4
- description?: string;
5
4
  format?: string;
6
5
  minimum?: number;
7
6
  maximum?: number;
@@ -21,7 +20,6 @@ export interface JsonSchema {
21
20
  $schema: string;
22
21
  $id: string;
23
22
  title: string;
24
- description?: string;
25
23
  type: "object";
26
24
  properties: Record<string, JsonSchemaProperty>;
27
25
  required: string[];
@@ -35,12 +35,6 @@ export class JsonSchemaGenerator {
35
35
  const property = {
36
36
  type: "string" // Default type
37
37
  };
38
- // Set description if available
39
- if (attribute.description) {
40
- property.description = typeof attribute.description === 'string'
41
- ? attribute.description
42
- : JSON.stringify(attribute.description);
43
- }
44
38
  // Handle array attributes
45
39
  if (attribute.array) {
46
40
  property.type = "array";
@@ -118,7 +112,6 @@ export class JsonSchemaGenerator {
118
112
  }
119
113
  else {
120
114
  schema.type = "string";
121
- schema.description = "Document ID reference";
122
115
  }
123
116
  break;
124
117
  default:
@@ -132,31 +125,26 @@ export class JsonSchemaGenerator {
132
125
  $schema: "https://json-schema.org/draft/2020-12/schema",
133
126
  $id: `https://example.com/schemas/${toCamelCase(collection.name)}.json`,
134
127
  title: pascalName,
135
- description: collection.description || `Schema for ${collection.name} collection`,
136
128
  type: "object",
137
129
  properties: {
138
130
  // Standard Appwrite document fields
139
131
  $id: {
140
132
  type: "string",
141
- description: "Document ID",
142
133
  pattern: "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,35}$"
143
134
  },
144
135
  $createdAt: {
145
136
  type: "string",
146
- format: "date-time",
147
- description: "Document creation date"
137
+ format: "date-time"
148
138
  },
149
139
  $updatedAt: {
150
140
  type: "string",
151
- format: "date-time",
152
- description: "Document last update date"
141
+ format: "date-time"
153
142
  },
154
143
  $permissions: {
155
144
  type: "array",
156
145
  items: {
157
146
  type: "string"
158
- },
159
- description: "Document permissions"
147
+ }
160
148
  }
161
149
  },
162
150
  required: ["$id", "$createdAt", "$updatedAt"],
@@ -186,8 +174,7 @@ export class JsonSchemaGenerator {
186
174
  $createdAt: { type: "string", format: "date-time" },
187
175
  $updatedAt: { type: "string", format: "date-time" }
188
176
  },
189
- additionalProperties: true,
190
- description: `Reference to ${rel.relatedCollection} document`
177
+ additionalProperties: true
191
178
  };
192
179
  });
193
180
  }