@goatlab/fluent-loki 0.7.12 → 0.7.14

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.
Files changed (2) hide show
  1. package/README.md +53 -36
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,49 +1,66 @@
1
- <!-- PROJECT SHIELDS -->
1
+ # @goatlab/fluent-loki
2
2
 
3
- [![Stargazers][stars-shield]][stars-url]
4
- [![Issues][issues-shield]][issues-url]
5
- [![MIT License][license-shield]][license-url]
6
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
3
+ LokiJS connector for the Goat Fluent query interface. Provides in-memory database capabilities with multiple storage adapters including IndexedDB, file system, and encrypted storage.
7
4
 
8
- <!-- PROJECT LOGO -->
9
- <br />
10
- <p align="center">
11
- <a href="https://github.com/github_username/repo">
12
- <img src="https://docs.goatlab.io/logo.png" alt="Logo" width="150" height="150">
13
- </a>
5
+ ## Installation
14
6
 
15
- <h3 align="center">GOAT - FLUENT-LOKI</h3>
16
-
17
- <p align="center">
18
- Fluent - Time Saving (TS) utils
19
- <br />
20
- <a href="https://docs.goatlab.io/#/0.7.x/fluent/fluent"><strong>Explore the docs »</strong></a>
21
- <br />
22
- <br />
23
- ·
24
- <a href="https://github.com/goat-io/fluent/issues">Report Bug</a>
25
- ·
26
- <a href="https://github.com/goat-io/fluent/issues">Request Feature</a>
27
- </p>
28
- </p>
29
- </p>
7
+ ```bash
8
+ npm install @goatlab/fluent-loki
9
+ # or
10
+ yarn add @goatlab/fluent-loki
11
+ # or
12
+ pnpm add @goatlab/fluent-loki
13
+ ```
30
14
 
31
- # Goat - Fluent
15
+ ## Usage
32
16
 
33
- Fluent query interface for Multiple database types and helpers for fast API generation and general App building.
17
+ ```typescript
18
+ import { Loki, LokiConnector, LokiStorageType } from '@goatlab/fluent-loki'
19
+ import { z } from 'zod'
34
20
 
35
- ## Supported Databases
21
+ // Define your schema
22
+ const UserSchema = z.object({
23
+ id: z.string(),
24
+ name: z.string(),
25
+ email: z.string().email(),
26
+ age: z.number()
27
+ })
36
28
 
37
- 1. LokiJS
29
+ // Create LokiJS database instance
30
+ const db = Loki.createDb({
31
+ dbName: 'myapp',
32
+ storage: LokiStorageType.memory // or indexedDB, file, fsStructured, cryptedFile
33
+ })
38
34
 
39
- ### Installing
35
+ // Create a User entity
36
+ class User {
37
+ static name = 'User'
38
+ }
40
39
 
41
- To install this package in your project, you can use the following command within your terminal.
40
+ // Initialize the connector
41
+ const userConnector = new LokiConnector({
42
+ entity: User,
43
+ dataSource: db,
44
+ inputSchema: UserSchema,
45
+ outputSchema: UserSchema
46
+ })
42
47
 
43
- ```bash
44
- yarn add @goatlab/fluent-loki
48
+ // Use the Fluent query interface
49
+ const users = await userConnector.findMany({
50
+ where: {
51
+ age: { gte: 18 }
52
+ },
53
+ orderBy: [{ name: 'asc' }],
54
+ limit: 10
55
+ })
45
56
  ```
46
57
 
47
- ### Documentation
58
+ ## Key Features
48
59
 
49
- To learn how to use this visit the [Goat Docs](https://docs.goatlab.io/#/0.7.x/fluent/fluent)
60
+ - **Multiple Storage Adapters**: Memory, IndexedDB, file system, structured file system, and encrypted file storage
61
+ - **Fluent Query Interface**: Chainable query methods compatible with Goat Fluent
62
+ - **Schema Validation**: Built-in Zod schema validation for input and output
63
+ - **TypeScript Support**: Full type safety with generics
64
+ - **Automatic ID Generation**: UUID-based ID generation for new records
65
+ - **Pagination Support**: Built-in pagination with offset and limit
66
+ - **Complex Queries**: Support for AND/OR conditions, nested properties, and various operators
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@goatlab/fluent-loki",
3
- "version": "0.7.12",
3
+ "version": "0.7.14",
4
4
  "dependencies": {
5
5
  "@goatlab/dates": "^0.6.6",
6
6
  "lokijs": "^1.5.12",
7
7
  "typeorm": "^0.3.25",
8
- "@goatlab/fluent": "0.7.41",
9
- "@goatlab/js-utils": "0.8.41",
10
- "@goatlab/tsconfig": "0.0.14"
8
+ "@goatlab/tsconfig": "0.0.15",
9
+ "@goatlab/js-utils": "0.8.42",
10
+ "@goatlab/fluent": "0.7.43"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/lokijs": "^1.5.7",