astro-loader-pocketbase 2.3.0-next.1 → 2.3.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-loader-pocketbase",
|
|
3
|
-
"version": "2.3.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A content loader for Astro that uses the PocketBase API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Luis Wolf <development@pawcode.de> (https://pawcode.de)",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"astro": "^5.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.
|
|
25
|
-
"@stylistic/eslint-plugin": "^
|
|
26
|
-
"@types/node": "^22.
|
|
27
|
-
"astro": "^5.
|
|
28
|
-
"eslint": "^9.
|
|
24
|
+
"@eslint/js": "^9.19.0",
|
|
25
|
+
"@stylistic/eslint-plugin": "^3.0.1",
|
|
26
|
+
"@types/node": "^22.13.0",
|
|
27
|
+
"astro": "^5.2.3",
|
|
28
|
+
"eslint": "^9.19.0",
|
|
29
29
|
"globals": "^15.14.0",
|
|
30
30
|
"husky": "^9.1.7",
|
|
31
31
|
"typescript": "^5.7.3",
|
|
32
|
-
"typescript-eslint": "^8.
|
|
32
|
+
"typescript-eslint": "^8.22.0"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"astro",
|
package/src/pocketbase-loader.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Loader, LoaderContext } from "astro/loaders";
|
|
2
|
+
import type { ZodSchema } from "astro/zod";
|
|
2
3
|
import packageJson from "./../package.json";
|
|
3
4
|
import { cleanupEntries } from "./cleanup-entries";
|
|
4
5
|
import { generateSchema } from "./generate-schema";
|
|
@@ -85,7 +86,7 @@ export function pocketbaseLoader(options: PocketBaseLoaderOptions): Loader {
|
|
|
85
86
|
|
|
86
87
|
context.meta.set("version", packageJson.version);
|
|
87
88
|
},
|
|
88
|
-
schema: async () => {
|
|
89
|
+
schema: async (): Promise<ZodSchema> => {
|
|
89
90
|
// Generate the schema for the collection according to the API
|
|
90
91
|
return await generateSchema(options);
|
|
91
92
|
}
|
|
@@ -106,7 +106,7 @@ export function parseSchema(
|
|
|
106
106
|
function parseSingleOrMultipleValues(
|
|
107
107
|
field: PocketBaseSchemaEntry,
|
|
108
108
|
type: z.ZodType
|
|
109
|
-
) {
|
|
109
|
+
): z.ZodType {
|
|
110
110
|
// If the select allows multiple values, create an array of the enum
|
|
111
111
|
if (field.maxSelect === undefined || field.maxSelect === 1) {
|
|
112
112
|
return type;
|