appwrite-utils
Advanced tools
Comparing version 0.1.225 to 0.2.0
@@ -15,4 +15,13 @@ import { stringAttributeSchema } from "../schemas/stringAttribute.js"; | ||
if (attribute.default !== undefined) { | ||
attributeToParse.xdefault = attribute.default; | ||
delete attributeToParse.default; | ||
if (attribute.array && attribute.default === null) { | ||
attributeToParse.xdefault = []; | ||
delete attributeToParse.default; | ||
} | ||
else if (attribute.default !== null) { | ||
attributeToParse.xdefault = attribute.default; | ||
delete attributeToParse.default; | ||
} | ||
else { | ||
delete attributeToParse.default; | ||
} | ||
} | ||
@@ -25,2 +34,5 @@ if (attributeToParse.type === "string" && | ||
} | ||
if (attributeToParse.type === "double") { | ||
attributeToParse.type = "float"; | ||
} | ||
switch (attributeToParse.type) { | ||
@@ -27,0 +39,0 @@ case "string": |
@@ -343,3 +343,3 @@ import { z } from "zod"; | ||
}>]>, "many">>; | ||
indexes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
indexes: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
key: z.ZodString; | ||
@@ -365,3 +365,17 @@ type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["key", "unique", "fulltext"]>>>; | ||
orders?: string[] | undefined; | ||
}>, "many">>>; | ||
}>, "many">>>, { | ||
type: "key" | "unique" | "fulltext"; | ||
key: string; | ||
attributes: string[]; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[], { | ||
key: string; | ||
attributes: string[]; | ||
type?: "key" | "unique" | "fulltext" | undefined; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[] | undefined>; | ||
importDefs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
@@ -641,2 +655,10 @@ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<["create", "update"]>>>; | ||
}[]; | ||
indexes: { | ||
type: "key" | "unique" | "fulltext"; | ||
key: string; | ||
attributes: string[]; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[]; | ||
importDefs: { | ||
@@ -679,10 +701,2 @@ filePath: string; | ||
documentSecurity?: boolean | undefined; | ||
indexes?: { | ||
type: "key" | "unique" | "fulltext"; | ||
key: string; | ||
attributes: string[]; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[] | undefined; | ||
databaseId?: string | undefined; | ||
@@ -964,2 +978,10 @@ }, { | ||
}[]; | ||
indexes: { | ||
type: "key" | "unique" | "fulltext"; | ||
key: string; | ||
attributes: string[]; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[]; | ||
importDefs: { | ||
@@ -1002,10 +1024,2 @@ filePath: string; | ||
documentSecurity?: boolean | undefined; | ||
indexes?: { | ||
type: "key" | "unique" | "fulltext"; | ||
key: string; | ||
attributes: string[]; | ||
status?: string | undefined; | ||
error?: string | undefined; | ||
orders?: string[] | undefined; | ||
}[] | undefined; | ||
databaseId?: string | undefined; | ||
@@ -1012,0 +1026,0 @@ }[] | undefined; |
@@ -43,5 +43,16 @@ import { z } from "zod"; | ||
.array(indexSchema) | ||
.optional() | ||
.default([]) | ||
.optional() | ||
.describe("The indexes of the collection"), | ||
.describe("The indexes of the collection") | ||
.transform((value) => { | ||
return value.map((index) => { | ||
if (index.orders) { | ||
return { | ||
...index, | ||
orders: index.orders.filter((order) => order !== null), | ||
}; | ||
} | ||
return index; | ||
}); | ||
}), | ||
importDefs: importDefSchemas.optional().default([]), | ||
@@ -48,0 +59,0 @@ databaseId: z |
{ | ||
"name": "appwrite-utils", | ||
"module": "dist/index.js", | ||
"version": "0.1.225", | ||
"version": "0.2.0", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
@@ -24,4 +24,11 @@ import { ID, IndexType, Permission } from "node-appwrite"; | ||
if (attribute.default !== undefined) { | ||
attributeToParse.xdefault = attribute.default; | ||
delete attributeToParse.default; | ||
if (attribute.array && attribute.default === null) { | ||
attributeToParse.xdefault = []; | ||
delete attributeToParse.default; | ||
} else if (attribute.default !== null) { | ||
attributeToParse.xdefault = attribute.default; | ||
delete attributeToParse.default; | ||
} else { | ||
delete attributeToParse.default; | ||
} | ||
} | ||
@@ -38,2 +45,6 @@ | ||
if (attributeToParse.type === "double") { | ||
attributeToParse.type = "float"; | ||
} | ||
switch (attributeToParse.type) { | ||
@@ -40,0 +51,0 @@ case "string": |
@@ -48,5 +48,16 @@ import { z } from "zod"; | ||
.array(indexSchema) | ||
.optional() | ||
.default([]) | ||
.optional() | ||
.describe("The indexes of the collection"), | ||
.describe("The indexes of the collection") | ||
.transform((value) => { | ||
return value.map((index) => { | ||
if (index.orders) { | ||
return { | ||
...index, | ||
orders: index.orders.filter((order) => order !== null), | ||
}; | ||
} | ||
return index; | ||
}); | ||
}), | ||
importDefs: importDefSchemas.optional().default([]), | ||
@@ -53,0 +64,0 @@ databaseId: z |
Sorry, the diff of this file is too big to display
325384
8572