@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.
- package/README.md +53 -36
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,49 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
# @goatlab/fluent-loki
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[![Issues][issues-shield]][issues-url]
|
|
5
|
-
[![MIT License][license-shield]][license-url]
|
|
6
|
-
[](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
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
15
|
+
## Usage
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
```typescript
|
|
18
|
+
import { Loki, LokiConnector, LokiStorageType } from '@goatlab/fluent-loki'
|
|
19
|
+
import { z } from 'zod'
|
|
34
20
|
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
35
|
+
// Create a User entity
|
|
36
|
+
class User {
|
|
37
|
+
static name = 'User'
|
|
38
|
+
}
|
|
40
39
|
|
|
41
|
-
|
|
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
|
-
|
|
44
|
-
|
|
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
|
-
|
|
58
|
+
## Key Features
|
|
48
59
|
|
|
49
|
-
|
|
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.
|
|
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/
|
|
9
|
-
"@goatlab/js-utils": "0.8.
|
|
10
|
-
"@goatlab/
|
|
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",
|