astro-loader-pocketbase 2.7.0-next.1 → 2.7.0-next.2
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/README.md +17 -13
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -143,12 +143,16 @@ const blog = defineCollection({
|
|
|
143
143
|
...options,
|
|
144
144
|
superuserCredentials: {
|
|
145
145
|
email: "<superuser-email>",
|
|
146
|
-
password: "<superuser-password>"
|
|
146
|
+
password: "<superuser-password>",
|
|
147
|
+
// or
|
|
148
|
+
impersonateToken: "<superuser-impersonate-token>"
|
|
147
149
|
}
|
|
148
150
|
})
|
|
149
151
|
});
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
_It's recommended to use an [impersonate token (API token)](https://pocketbase.io/docs/authentication/#api-keys) instead of the email and password, as this is more secure and can be easily revoked._
|
|
155
|
+
|
|
152
156
|
Under the hood, the loader will use the [PocketBase API](https://pocketbase.io/docs/api-collections/#view-collection) to fetch the schema of your collection and generate types with Zod based on that schema.
|
|
153
157
|
|
|
154
158
|
### Local schema
|
|
@@ -193,18 +197,18 @@ This will remove `undefined` from the type of these fields and mark them as requ
|
|
|
193
197
|
|
|
194
198
|
## All options
|
|
195
199
|
|
|
196
|
-
| Option | Type
|
|
197
|
-
| ---------------------- |
|
|
198
|
-
| `url` | `string`
|
|
199
|
-
| `collectionName` | `string`
|
|
200
|
-
| `idField` | `string`
|
|
201
|
-
| `contentFields` | `string \| Array<string>`
|
|
202
|
-
| `updatedField` | `string`
|
|
203
|
-
| `filter` | `string`
|
|
204
|
-
| `superuserCredentials` | `{ email: string, password: string }` | | The email and password of
|
|
205
|
-
| `localSchema` | `string`
|
|
206
|
-
| `jsonSchemas` | `Record<string, z.ZodSchema>`
|
|
207
|
-
| `improveTypes` | `boolean`
|
|
200
|
+
| Option | Type | Required | Description |
|
|
201
|
+
| ---------------------- | --------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| `url` | `string` | x | The URL of your PocketBase instance. |
|
|
203
|
+
| `collectionName` | `string` | x | The name of the collection in your PocketBase instance. |
|
|
204
|
+
| `idField` | `string` | | The field in the collection to use as unique id. Defaults to `id`. |
|
|
205
|
+
| `contentFields` | `string \| Array<string>` | | The field in the collection to use as content. This can also be an array of fields. |
|
|
206
|
+
| `updatedField` | `string` | | The field in the collection that stores the last update date of an entry. This is used for incremental builds. |
|
|
207
|
+
| `filter` | `string` | | Custom filter to use when fetching entries. Used to filter the entries by specific conditions. |
|
|
208
|
+
| `superuserCredentials` | `{ email: string, password: string } \| { impersonateToken: string }` | | The email and password or impersonate token of a superuser of the PocketBase instance. This is used for automatic type generation. |
|
|
209
|
+
| `localSchema` | `string` | | The path to a local schema file. This is used for automatic type generation. |
|
|
210
|
+
| `jsonSchemas` | `Record<string, z.ZodSchema>` | | A record of Zod schemas to use for type generation of `json` fields. |
|
|
211
|
+
| `improveTypes` | `boolean` | | Whether to improve the types of `number` and `boolean` fields, removing `undefined` from them. |
|
|
208
212
|
|
|
209
213
|
## Special cases
|
|
210
214
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-loader-pocketbase",
|
|
3
|
-
"version": "2.7.0-next.
|
|
3
|
+
"version": "2.7.0-next.2",
|
|
4
4
|
"description": "A content loader for Astro that uses the PocketBase API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@commitlint/cli": "^19.8.1",
|
|
47
47
|
"@commitlint/config-conventional": "^19.8.1",
|
|
48
|
-
"@eslint/js": "^9.30.
|
|
49
|
-
"@stylistic/eslint-plugin": "^5.
|
|
48
|
+
"@eslint/js": "^9.30.1",
|
|
49
|
+
"@stylistic/eslint-plugin": "^5.1.0",
|
|
50
50
|
"@types/node": "^22.14.1",
|
|
51
51
|
"@vitest/coverage-v8": "^3.2.4",
|
|
52
|
-
"astro": "^5.
|
|
53
|
-
"eslint": "^9.30.
|
|
52
|
+
"astro": "^5.11.0",
|
|
53
|
+
"eslint": "^9.30.1",
|
|
54
54
|
"eslint-config-prettier": "^10.1.5",
|
|
55
|
-
"globals": "^16.
|
|
55
|
+
"globals": "^16.3.0",
|
|
56
56
|
"husky": "^9.1.7",
|
|
57
57
|
"lint-staged": "^16.1.2",
|
|
58
58
|
"prettier": "^3.6.2",
|
|
59
59
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
60
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
60
|
+
"prettier-plugin-packagejson": "^2.5.18",
|
|
61
61
|
"typescript": "^5.8.3",
|
|
62
|
-
"typescript-eslint": "^8.35.
|
|
62
|
+
"typescript-eslint": "^8.35.1",
|
|
63
63
|
"vitest": "^3.2.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|