Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions examples/with-browser-lodash/index.html

This file was deleted.

23 changes: 0 additions & 23 deletions examples/with-browser-lodash/package.json

This file was deleted.

71 changes: 0 additions & 71 deletions examples/with-browser-lodash/src/index.ts

This file was deleted.

44 changes: 0 additions & 44 deletions examples/with-browser-lodash/src/storage.ts

This file was deleted.

1 change: 0 additions & 1 deletion examples/with-browser-lodash/src/vite-env.d.ts

This file was deleted.

22 changes: 0 additions & 22 deletions examples/with-browser-lodash/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "with-node-lodash",
"name": "with-lodash",
"type": "module",
"private": true,
"scripts": {
Expand All @@ -8,13 +8,12 @@
"build": "del-cli dist && tsc"
},
"dependencies": {
"@stenodb/lodash": "workspace:*",
"@stenodb/node": "workspace:*",
"class-transformer": "0.5.1",
"lodash": "4.17.21",
"reflect-metadata": "0.1.13"
},
"devDependencies": {
"@types/node": "18.11.19",
"@types/lodash": "4.14.191"
"@types/node": "18.11.19"
}
}
20 changes: 20 additions & 0 deletions examples/with-lodash/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'reflect-metadata'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { NodeLodash } from '@stenodb/lodash'
import { AsyncAdapter, NodeProvider } from '@stenodb/node'
import { User, Users } from './entities.js'

const path = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'database')
const initialData = new Users(new User(1, 'John Doe'))
const adapter = new AsyncAdapter('users', Users, initialData)
const provider = new NodeProvider({ path })

const database = new NodeLodash(await provider.create(adapter))
await database.read()

function findUserById(id: number) {
return database.data.get('users').find({ id }).value()
}

console.log(findUserById(1))
2 changes: 1 addition & 1 deletion examples/with-nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"prebuild": "rimraf dist",
"build": "nest build",
"start": "nest start",
"start:dev": "nest start --watch",
"dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"test": "jest",
Expand Down
9 changes: 2 additions & 7 deletions examples/with-nest/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common'
import { UsersService } from './app.service'
import { CreateUserDto } from './dto/users.dto'

Expand All @@ -21,12 +21,7 @@ export class UsersController {
await this.usersService.add(user)
}

@Post('reset')
async resetUsers() {
await this.usersService.reset()
}

@Post('remove/:id')
@Delete(':id')
async removeUser(@Param('id') id: string) {
await this.usersService.remove(Number(id))
}
Expand Down
4 changes: 0 additions & 4 deletions examples/with-nest/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export class UsersService implements OnModuleInit {
this.usersProvider.data.users = users
}

async reset(): Promise<void> {
await this.usersProvider.reset()
}

findById(id: number): CreateUserDto {
return this.users.find((user) => user.id === id)
}
Expand Down
5 changes: 4 additions & 1 deletion examples/with-nest/src/dto/users.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Exclude, Type } from 'class-transformer'
import { Length, Max, Min } from 'class-validator'
import { IsNumber, IsString, Length, Max, Min } from 'class-validator'

export class Users {
@Type(() => CreateUserDto)
Expand All @@ -11,12 +11,15 @@ export class Users {
}

export class CreateUserDto {
@IsNumber()
@Exclude({ toPlainOnly: true })
id: number

@IsString()
@Length(1, 20)
name: string

@IsNumber()
@Min(12)
@Max(100)
age: number
Expand Down
20 changes: 0 additions & 20 deletions examples/with-node-lodash/src/entities.ts

This file was deleted.

45 changes: 0 additions & 45 deletions examples/with-node-lodash/src/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stenodb/workspace",
"version": "3.1.0",
"version": "3.3.0",
"type": "module",
"private": true,
"workspaces": [
Expand Down
16 changes: 7 additions & 9 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "@stenodb/browser",
"description": "✍ Easy to use local JSON database",
"version": "3.2.1",
"version": "3.3.0",
"type": "module",
"source": "./src/index.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.esm.js"
}
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"default": "./dist/index.esm.js"
},
"types": "./dist/index.d.ts",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -48,11 +46,11 @@
"build": "del-cli dist && microbundle --format esm,cjs --target web"
},
"dependencies": {
"@stenodb/logger": "workspace:3.2.1",
"@stenodb/utils": "workspace:3.2.1"
"@stenodb/logger": "workspace:3.3.0",
"@stenodb/utils": "workspace:3.3.0"
},
"peerDependencies": {
"@stenodb/logger": "workspace:3.2.1"
"@stenodb/logger": "workspace:3.3.0"
},
"engines": {
"node": ">=14.16"
Expand Down
Loading