# @ng-pocketbase/core

> A implementation of the pocketbase api for Angular

Latest version **0.1.0** (published 2023-05-06) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ng-pocketbase/core
pnpm add @ng-pocketbase/core
yarn add @ng-pocketbase/core
bun add @ng-pocketbase/core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-05-06 |
| First published | 2023-03-10 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 314 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexander Lindner |
| Maintainers | alindner |

## Links

- npm: https://www.npmjs.com/package/@ng-pocketbase/core
- Repository: https://github.com/alexander-lindner/ng-pocketbase-core
- Homepage: https://github.com/alexander-lindner/ng-pocketbase-core/tree/main/projects/ng-pocketbase-core
- Issues: https://github.com/alexander-lindner/ng-pocketbase-core/issues
- npm.io page: https://npm.io/package/@ng-pocketbase/core

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0
- [pocketbase](https://npm.io/package/pocketbase.md) ^0.12.1

## Recent versions

- 0.1.0 (latest) — 2023-05-06
- 0.0.11 — 2023-03-18
- 0.0.10 — 2023-03-17
- 0.0.9 — 2023-03-17
- 0.0.8 — 2023-03-15
- 0.0.7 — 2023-03-15
- 0.0.6 — 2023-03-13
- 0.0.5 — 2023-03-11
- 0.0.4 — 2023-03-11
- 0.0.3 — 2023-03-11
- 0.0.2 — 2023-03-10
- 0.0.1 — 2023-03-10

## README

# @ng-pocketbase/core

This library provides a set of components and services for the usage with [Pocketbase](https://github.com/pocketbase/pocketbase).
It heavily uses pocketbase's realtime api, so any changes made to the database will be reflected in the app instantly without polling. 
## Installation
`yarn add @ng-pocketbase/core` or `npm install @ng-pocketbase/core`

## Documentation

See [GitHub](https://github.com/alexander-lindner/ng-pocketbase-core).

## Examples
```typescript
@Injectable({providedIn: "root"})
export class DetailsService extends BasicCrud<Detail> {
  constructor(pbs: PocketBaseService) {
    super(pbs, "details");
    this.requestRecords();
  }

  protected createItem(record: Record): Detail {
    return {
      id: record.id,
      feed: record.feed,
      weight: parseInt(record.weight),
      name: record.name,
    };
  }
}
```
Now you can use it like so

```typescript
export class DetailsComponent implements OnInit {
    constructor(private DetailsService: DetailsService) {
    }

    public ngOnInit(): void {
        this.DetailsService.getItems().subscribe((value: Array<Detail>) => {
            this.details = value;
        });

        this.DetailsService.create({...}).subscribe((value: Detail) => { console.log(value.id); // fdsafdsadadfs });
        this.DetailsService.getById("fdsafdsadadfs").subscribe((value: Detail) => { });
        this.DetailsService.update("fdsafdsadadfs", {name: "test"}).subscribe((value: Detail) => { });
        this.DetailsService.delete("fdsafdsadadfs").subscribe((success: boolean) => { });
    }
}
```

## Changelog

* 0.0.5
  * fix: only adding realtime records if they are not already loaded
  * feature: auth interceptor
  * feature: differential of admins and normal users

## License
Mozilla Public License Version 2.0

---
_Source: https://npm.io/package/@ng-pocketbase/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
