Skip to content

Commit 26f41b8

Browse files
authored
Merge branch 'master' into add-tests
2 parents da6cd78 + b952118 commit 26f41b8

24 files changed

+355
-111
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ pnpm add stenodb
2020
| ------- | ------ | ----------- |
2121
| [@stenodb/node](./packages/node) | [![](https://img.shields.io/npm/v/@stenodb/node)](https://npm.im/@stenodb/node) | Node.js |
2222
| [@stenodb/browser](./packages/browser) | [![](https://img.shields.io/npm/v/@stenodb/browser)](https://npm.im/@stenodb/browser) | Browser (localStorage, sessionStorage) |
23-
| [@stenodb/nest](./packages/nest) | [![](https://img.shields.io/npm/v/@stenodb/nest)](https://npm.im/@stenodb/nest) | Nest.js |
24-
| [@stenodb/lodash](./packages/lodash) | [![](https://img.shields.io/npm/v/@stenodb/lodash)](https://npm.im/@stenodb/lodash) | Lodash wrapper |
23+
| [@stenodb/nest](./packages/nest) | [![](https://img.shields.io/npm/v/@stenodb/nest)](https://npm.im/@stenodb/nest) | Nest.js module |
24+
| [@stenodb/fastify](./packages/fastify) | [![](https://img.shields.io/npm/v/@stenodb/fastify)](https://npm.im/@stenodb/fastify) | Fastify plugin |
25+
| [@stenodb/lodash](./packages/lodash) | [![](https://img.shields.io/npm/v/@stenodb/lodash)](https://npm.im/@stenodb/lodash) | Lodash wrapper for Node.js and Browser |
2526
| [@stenodb/logger](./packages/logger) | [![](https://img.shields.io/npm/v/@stenodb/logger)](https://npm.im/@stenodb/logger) | Logger |
2627

2728
## Examples
@@ -194,8 +195,11 @@ pnpm add stenodb
194195
## Credits
195196

196197
- [steno](https://github.com/typicode/steno) - Specialized fast async file writer.
198+
- [fastify-plugin](https://github.com/fastify/fastify-plugin) - Plugin helper for Fastify.
199+
- [nest](https://github.com/nestjs/nest) - A progressive Node.js framework for building efficient and scalable server-side applications.
197200
- [class-transformer](https://github.com/typestack/class-transformer) - Decorator-based transformation, serialization, and deserialization between objects and classes.
198201
- [class-validator](https://github.com/typestack/class-validator) - Decorator-based property validation for classes.
202+
- [class-validator-jsonschema](https://github.com/epiphone/class-validator-jsonschema) - Convert `class-validator` decorated classes into JSON schema.
199203
- [json-difference](https://github.com/lukascivil/json-difference) - A simple way to find the difference between two objects or json diff.
200204
- [tslog](https://github.com/fullstack-build/tslog) - Universal Logger for TypeScript and JavaScript.
201205

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stenodb/workspace",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"type": "module",
55
"private": true,
66
"workspaces": [
@@ -16,7 +16,7 @@
1616
"format": "prettier --write --ignore-unknown **"
1717
},
1818
"devDependencies": {
19-
"@crashmax/prettier-config": "2.2.1",
19+
"@crashmax/prettier-config": "3.0.1",
2020
"@crashmax/tsconfig": "1.0.2",
2121
"cross-env": "7.0.3",
2222
"nodemon": "2.0.20",

packages/browser/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ db.write()
7575
- [steno](https://github.com/typicode/steno) - Specialized fast async file writer.
7676
- [class-transformer](https://github.com/typestack/class-transformer) - Decorator-based transformation, serialization, and deserialization between objects and classes.
7777
- [class-validator](https://github.com/typestack/class-validator) - Decorator-based property validation for classes.
78-
- [json-difference](https://github.com/lukascivil/json-difference) - A simple way to find the difference between two objects or json diff.
79-
- [tslog](https://github.com/fullstack-build/tslog) - Universal Logger for TypeScript and JavaScript.
8078

8179
## License
8280

packages/browser/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stenodb/browser",
33
"description": "✍ Easy to use local JSON database",
4-
"version": "3.4.0",
4+
"version": "3.4.1",
55
"exports": {
66
".": {
77
"types": "./dist/index.d.ts",
@@ -46,11 +46,11 @@
4646
"build": "tsup src/index.ts --format esm,cjs --dts --clean"
4747
},
4848
"dependencies": {
49-
"@stenodb/logger": "workspace:3.4.0",
50-
"@stenodb/utils": "workspace:3.4.0"
49+
"@stenodb/logger": "workspace:3.4.1",
50+
"@stenodb/utils": "workspace:3.4.1"
5151
},
5252
"peerDependencies": {
53-
"@stenodb/logger": "workspace:3.4.0"
53+
"@stenodb/logger": "workspace:3.4.1"
5454
},
5555
"engines": {
5656
"node": ">=14.16"

packages/browser/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@crashmax/tsconfig",
33
"compilerOptions": {
4+
"target": "ESNext",
45
"outDir": "dist"
56
},
67
"include": [

packages/fastify/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# @stenodb/fastify [![](https://img.shields.io/npm/v/@stenodb/fastify)](https://www.npmjs.org/package/@stenodb/fastify)
2+
3+
> ✍ Easy to use local JSON database for [Fastify](https://fastify.io)
4+
5+
## Install
6+
7+
```sh
8+
npm install @stenodb/fastify
9+
```
10+
11+
```sh
12+
yarn add @stenodb/fastify
13+
```
14+
15+
```sh
16+
pnpm add @stenodb/fastify
17+
```
18+
19+
## Usage
20+
21+
```ts
22+
// index.ts
23+
import Fastify from 'fastify'
24+
import { resolve } from 'node:path'
25+
import { AsyncAdapter, FastifySteno } from '@stenodb/fastify'
26+
import { Users, User } from './entities.js'
27+
28+
const fastify = Fastify()
29+
30+
const initialData = new Users(
31+
new User('John'),
32+
new User('Alice')
33+
)
34+
35+
const usersAdapter = new AsyncAdapter(
36+
'users',
37+
Users,
38+
initialData
39+
)
40+
41+
fastify.register(FastifySteno, {
42+
path: resolve(dirname(fileURLToPath(import.meta.url)), '..', 'db'),
43+
entities: [User, Post],
44+
adapters: [usersAdapter]
45+
})
46+
47+
fastify.get('/users', () => {
48+
const users = fastify.steno.get<Users>('users')
49+
return users.data
50+
})
51+
52+
fastify.listen({ host: '0.0.0.0', port: 3000 }, (err, address) => {
53+
if (err) throw err
54+
console.log(address)
55+
})
56+
```
57+
58+
## Credits
59+
60+
- [steno](https://github.com/typicode/steno) - Specialized fast async file writer.
61+
- [fastify-plugin](https://github.com/fastify/fastify-plugin) - Plugin helper for Fastify.
62+
- [class-transformer](https://github.com/typestack/class-transformer) - Decorator-based transformation, serialization, and deserialization between objects and classes.
63+
- [class-validator](https://github.com/typestack/class-validator) - Decorator-based property validation for classes.
64+
- [class-validator-jsonschema](https://github.com/epiphone/class-validator-jsonschema) - Convert `class-validator` decorated classes into JSON schema.
65+
- [json-difference](https://github.com/lukascivil/json-difference) - A simple way to find the difference between two objects or json diff.
66+
- [tslog](https://github.com/fullstack-build/tslog) - Universal Logger for TypeScript and JavaScript.
67+
68+
## License
69+
70+
MIT - [crashmax](https://github.com/crashmax-dev)

packages/fastify/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stenodb/fastify",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"exports": {
55
".": {
66
"types": "./dist/index.d.ts",
@@ -20,7 +20,7 @@
2020
"build": "tsup src/index.ts --format esm,cjs --dts --clean"
2121
},
2222
"dependencies": {
23-
"@stenodb/node": "workspace:3.4.0",
23+
"@stenodb/node": "workspace:3.4.1",
2424
"class-validator-jsonschema": "5.0.0",
2525
"fastify-plugin": "4.5.0"
2626
},
@@ -29,7 +29,7 @@
2929
"fastify": "^4.13.0"
3030
},
3131
"peerDependencies": {
32-
"@stenodb/node": "workspace:3.4.0",
32+
"@stenodb/node": "workspace:3.4.1",
3333
"fastify": "^4.0.0"
3434
},
3535
"engines": {

packages/fastify/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@crashmax/tsconfig",
33
"compilerOptions": {
4+
"target": "ESNext",
45
"outDir": "dist"
56
},
67
"include": [

packages/lodash/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stenodb/lodash",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"exports": {
55
".": {
66
"types": "./dist/index.d.ts",
@@ -30,17 +30,17 @@
3030
"build": "tsup src/index.ts src/node.ts src/browser.ts --format esm,cjs --dts --clean"
3131
},
3232
"dependencies": {
33-
"@stenodb/browser": "workspace:3.4.0",
34-
"@stenodb/node": "workspace:3.4.0",
33+
"@stenodb/browser": "workspace:3.4.1",
34+
"@stenodb/node": "workspace:3.4.1",
3535
"@types/lodash": "4.14.191",
3636
"lodash": "4.17.21"
3737
},
3838
"devDependencies": {
3939
"@types/node": "18.11.19"
4040
},
4141
"peerDependencies": {
42-
"@stenodb/browser": "workspace:3.4.0",
43-
"@stenodb/node": "workspace:3.4.0",
42+
"@stenodb/browser": "workspace:3.4.1",
43+
"@stenodb/node": "workspace:3.4.1",
4444
"@types/lodash": "^4.14.191",
4545
"lodash": "^4.17.21"
4646
},

packages/lodash/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "@crashmax/tsconfig",
33
"compilerOptions": {
4+
"target": "ESNext",
45
"outDir": "dist"
56
},
67
"include": [

0 commit comments

Comments
 (0)