@goatlab/fluent-formio 0.6.17 → 0.7.0
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 +52 -35
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,49 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
# @goatlab/fluent-formio
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[![Issues][issues-shield]][issues-url]
|
|
5
|
-
[![MIT License][license-shield]][license-url]
|
|
6
|
-
[](http://commitizen.github.io/cz-cli/)
|
|
3
|
+
A fluent query interface connector for Form.io that provides a consistent API for CRUD operations with Form.io data sources. Currently includes a mock in-memory implementation for testing and development.
|
|
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
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @goatlab/fluent-formio
|
|
9
|
+
# or
|
|
10
|
+
yarn add @goatlab/fluent-formio
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @goatlab/fluent-formio
|
|
13
|
+
```
|
|
16
14
|
|
|
17
|
-
|
|
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>
|
|
15
|
+
## Basic Usage
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
```typescript
|
|
18
|
+
import { FormioConnector } from '@goatlab/fluent-formio'
|
|
32
19
|
|
|
33
|
-
|
|
20
|
+
// Define your entity types
|
|
21
|
+
interface User {
|
|
22
|
+
id?: string
|
|
23
|
+
name: string
|
|
24
|
+
email: string
|
|
25
|
+
age: number
|
|
26
|
+
}
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
// Create a connector instance
|
|
29
|
+
const userConnector = new FormioConnector<User>({
|
|
30
|
+
baseEndPoint: 'http://localhost:3001/users',
|
|
31
|
+
token: 'your-formio-token' // optional
|
|
32
|
+
})
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
// Insert a single record
|
|
35
|
+
const user = await userConnector.insert({
|
|
36
|
+
name: 'John Doe',
|
|
37
|
+
email: 'john@example.com',
|
|
38
|
+
age: 30
|
|
39
|
+
})
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
// Find records with fluent query syntax
|
|
42
|
+
const adults = await userConnector.findMany({
|
|
43
|
+
where: { age: { greaterOrEqualThan: 18 } },
|
|
44
|
+
orderBy: [{ age: 'desc' }],
|
|
45
|
+
limit: 10
|
|
46
|
+
})
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
// Find by ID
|
|
49
|
+
const foundUser = await userConnector.findById(user.id)
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
// Update a record
|
|
52
|
+
await userConnector.updateById(user.id, {
|
|
53
|
+
age: 31
|
|
54
|
+
})
|
|
45
55
|
```
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
## Key Features
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
- **Fluent Query Interface** - Chain methods for complex queries with TypeScript support
|
|
60
|
+
- **Form.io Compatible** - Designed to work with Form.io REST APIs
|
|
61
|
+
- **In-Memory Mock Storage** - Built-in mock implementation for testing
|
|
62
|
+
- **Type-Safe** - Full TypeScript support with generic types
|
|
63
|
+
- **Standard CRUD Operations** - insert, findById, findMany, updateById, deleteById
|
|
64
|
+
- **Advanced Queries** - Support for where clauses, ordering, pagination
|
|
65
|
+
- **Batch Operations** - insertMany for bulk inserts
|
|
66
|
+
- **Utility Methods** - findFirst, requireById, requireFirst, pluck
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goatlab/fluent-formio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Readable query Interface & API generator for TS and Node",
|
|
5
5
|
"homepage": "https://docs.goatlab.io",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "ignacio.cabrera@goatlab.io",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@goatlab/
|
|
23
|
-
"@goatlab/
|
|
22
|
+
"@goatlab/fluent": "0.8.0",
|
|
23
|
+
"@goatlab/js-utils": "0.9.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^17.0.23",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"turbo": "^1.1.10",
|
|
33
33
|
"typescript": "^4.6.3",
|
|
34
34
|
"vitest": "^2.1.8",
|
|
35
|
-
"@goatlab/tsconfig": "0.0
|
|
35
|
+
"@goatlab/tsconfig": "0.1.0"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=14.16.0"
|