@@ -265,6 +265,48 @@ export const relationshipAttributeSchema = extendBase({
265265 }
266266} ) ;
267267
268+ // Text variant attribute schemas (node-appwrite v22+)
269+ export const varcharAttributeSchema = extendBase ( {
270+ type : z . literal ( "varchar" ) . describe ( "The type of the attribute" ) ,
271+ size : z . number ( ) . optional ( ) . describe ( "The max length of the attribute" ) ,
272+ xdefault : z . string ( ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
273+ encrypt : z . boolean ( ) . optional ( ) . describe ( "Whether the attribute is encrypted or not" ) ,
274+ } ) ;
275+
276+ export const textAttributeSchema = extendBase ( {
277+ type : z . literal ( "text" ) . describe ( "The type of the attribute" ) ,
278+ xdefault : z . string ( ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
279+ encrypt : z . boolean ( ) . optional ( ) . describe ( "Whether the attribute is encrypted or not" ) ,
280+ } ) ;
281+
282+ export const mediumtextAttributeSchema = extendBase ( {
283+ type : z . literal ( "mediumtext" ) . describe ( "The type of the attribute" ) ,
284+ xdefault : z . string ( ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
285+ encrypt : z . boolean ( ) . optional ( ) . describe ( "Whether the attribute is encrypted or not" ) ,
286+ } ) ;
287+
288+ export const longtextAttributeSchema = extendBase ( {
289+ type : z . literal ( "longtext" ) . describe ( "The type of the attribute" ) ,
290+ xdefault : z . string ( ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
291+ encrypt : z . boolean ( ) . optional ( ) . describe ( "Whether the attribute is encrypted or not" ) ,
292+ } ) ;
293+
294+ // Geospatial attribute schemas (node-appwrite v22+)
295+ export const pointAttributeSchema = extendBase ( {
296+ type : z . literal ( "point" ) . describe ( "The type of the attribute" ) ,
297+ xdefault : z . array ( z . any ( ) ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
298+ } ) ;
299+
300+ export const lineAttributeSchema = extendBase ( {
301+ type : z . literal ( "line" ) . describe ( "The type of the attribute" ) ,
302+ xdefault : z . array ( z . any ( ) ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
303+ } ) ;
304+
305+ export const polygonAttributeSchema = extendBase ( {
306+ type : z . literal ( "polygon" ) . describe ( "The type of the attribute" ) ,
307+ xdefault : z . array ( z . any ( ) ) . nullish ( ) . describe ( "The default value of the attribute" ) ,
308+ } ) ;
309+
268310const attributeVariants = z . discriminatedUnion ( "type" , [
269311 stringAttributeSchema ,
270312 integerAttributeSchema ,
@@ -277,12 +319,20 @@ const attributeVariants = z.discriminatedUnion("type", [
277319 urlAttributeSchema ,
278320 enumAttributeSchema ,
279321 relationshipAttributeSchema ,
322+ varcharAttributeSchema ,
323+ textAttributeSchema ,
324+ mediumtextAttributeSchema ,
325+ longtextAttributeSchema ,
326+ pointAttributeSchema ,
327+ lineAttributeSchema ,
328+ polygonAttributeSchema ,
280329] ) ;
281330
282331const attributeDefaultValueSchema = z . union ( [
283332 z . string ( ) ,
284333 z . number ( ) ,
285334 z . boolean ( ) ,
335+ z . array ( z . any ( ) ) ,
286336 z . null ( ) ,
287337] ) ;
288338
@@ -299,8 +349,8 @@ const attributeNormalizerSchema = z
299349 xdefault : attributeDefaultValueSchema . optional ( ) ,
300350 format : z . string ( ) . optional ( ) ,
301351 size : z . union ( [ z . number ( ) , z . string ( ) ] ) . optional ( ) ,
302- min : z . union ( [ z . number ( ) , z . string ( ) ] ) . optional ( ) ,
303- max : z . union ( [ z . number ( ) , z . string ( ) ] ) . optional ( ) ,
352+ min : z . union ( [ z . number ( ) , z . string ( ) , z . bigint ( ) ] ) . optional ( ) ,
353+ max : z . union ( [ z . number ( ) , z . string ( ) , z . bigint ( ) ] ) . optional ( ) ,
304354 elements : z . array ( z . string ( ) ) . optional ( ) ,
305355 encrypt : z . boolean ( ) . optional ( ) ,
306356 relatedCollection : z . string ( ) . optional ( ) ,
@@ -367,6 +417,15 @@ const attributeNormalizerSchema = z
367417 return undefined ;
368418 }
369419
420+ // Handle bigint values from node-appwrite v23+
421+ if ( typeof value === 'bigint' ) {
422+ const num = Number ( value ) ;
423+ if ( Math . abs ( num ) >= MIN_MAX_THRESHOLD ) {
424+ return undefined ;
425+ }
426+ return num ;
427+ }
428+
370429 // Handle string values that might be too large for Number()
371430 if ( typeof value === 'string' ) {
372431 try {
@@ -481,6 +540,13 @@ export type IpAttribute = z.infer<typeof ipAttributeSchema>;
481540export type UrlAttribute = z . infer < typeof urlAttributeSchema > ;
482541export type EnumAttribute = z . infer < typeof enumAttributeSchema > ;
483542export type RelationshipAttribute = z . infer < typeof relationshipAttributeSchema > ;
543+ export type VarcharAttribute = z . infer < typeof varcharAttributeSchema > ;
544+ export type TextAttribute = z . infer < typeof textAttributeSchema > ;
545+ export type MediumtextAttribute = z . infer < typeof mediumtextAttributeSchema > ;
546+ export type LongtextAttribute = z . infer < typeof longtextAttributeSchema > ;
547+ export type PointAttribute = z . infer < typeof pointAttributeSchema > ;
548+ export type LineAttribute = z . infer < typeof lineAttributeSchema > ;
549+ export type PolygonAttribute = z . infer < typeof polygonAttributeSchema > ;
484550
485551export const attributesSchema = z . array ( attributeSchema ) ;
486552
0 commit comments