@iglo.tech/iglo.base 1.0.1-rc.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ - README: a pointer to the generated types (`iglo-base schema types`), for the types of your own collections. No code changes from 1.0.1-rc.0.
4
+
1
5
  ## 1.0.1-rc.0
2
6
 
3
7
  - Prerelease that validates npm trusted publishing from CI (OIDC, no token). No code changes from 1.0.0; published under the `next` tag.
package/README.md CHANGED
@@ -301,6 +301,19 @@ If you want to manually cancel pending requests, you could use `pb.cancelAllRequ
301
301
 
302
302
  ### Specify TypeScript definitions
303
303
 
304
+ For the types of your own collections, generate them from the schema with `schema types` (see [docs/schema.md](../docs/schema.md#types)). `pb.collection("posts")` is then typed as `PostsResponse`, and a collection name the schema does not have is a type error:
305
+
306
+ ```ts
307
+ import PocketBase from "@iglo.tech/iglo.base";
308
+ import type { TypedPocketBase } from "./iglo.types";
309
+
310
+ const pb = new PocketBase("https://example.com") as TypedPocketBase;
311
+ ```
312
+
313
+ The server and browser clients keep their methods when you pass their class: `createBrowserClient({ url }) as TypedPocketBase<BrowserClient>`.
314
+
315
+ Without generated types, use the generics below.
316
+
304
317
  You could specify custom TypeScript definitions for your Record models using generics:
305
318
 
306
319
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iglo.tech/iglo.base",
3
- "version": "1.0.1-rc.0",
3
+ "version": "1.0.1",
4
4
  "description": "JavaScript SDK for iglo.base (fork of the PocketBase JavaScript SDK v0.28.1)",
5
5
  "keywords": [
6
6
  "iglo.base",