# claire-framework

> - được viết bằng TypeScript - hỗ trợ websocket và HTTP request - hỗ trợ CLI để generate base project (claire-cli)

Latest version **3.4.2** (published 2020-05-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install claire-framework
pnpm add claire-framework
yarn add claire-framework
bun add claire-framework
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.4.2 |
| Published | 2020-05-08 |
| First published | 2019-02-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 19 |
| Unpacked size | 475.3 KB |
| Known vulnerabilities | 0 (+18 in 5 direct dependencies) |
| Install scripts | no |
| Maintainers | athongintel |

## Links

- npm: https://www.npmjs.com/package/claire-framework
- npm.io page: https://npm.io/package/claire-framework

## Dependencies (19)

- [pg](https://npm.io/package/pg.md) ^7.8.0
- [npm](https://npm.io/package/npm.md) ^6.14.5
- [pug](https://npm.io/package/pug.md) ^2.0.4
- [redis](https://npm.io/package/redis.md) ^2.8.0
- [colors](https://npm.io/package/colors.md) ^1.3.3
- [dotenv](https://npm.io/package/dotenv.md) ^6.2.0
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [mysql2](https://npm.io/package/mysql2.md) ^1.6.4
- [express](https://npm.io/package/express.md) ^4.16.4
- [install](https://npm.io/package/install.md) ^0.13.0
- [mongoose](https://npm.io/package/mongoose.md) ^5.4.13
- [sequelize](https://npm.io/package/sequelize.md) ^5.21.2
- [socket.io](https://npm.io/package/socket.io.md) ^2.2.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.25
- [sequelize-cli](https://npm.io/package/sequelize-cli.md) ^5.5.1
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [@types/mime-types](https://npm.io/package/@types/mime-types.md) ^2.1.0
- [express-fileupload](https://npm.io/package/express-fileupload.md) ^1.1.6-alpha.6
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.16

## Recent versions

- 3.4.2 (latest) — 2020-05-08
- 3.4.1 — 2020-05-08
- 3.4.0 — 2020-05-08
- 3.3.3 — 2020-04-04
- 3.3.2 — 2020-04-04
- 3.3.1 — 2020-04-04
- 3.3.0 — 2020-04-04
- 3.2.14 — 2020-03-28
- 3.2.13 — 2020-03-26
- 3.2.12 — 2020-03-25
- 3.2.11 — 2020-03-22
- 3.2.10 — 2020-03-21
- 3.2.9 — 2020-03-16
- 3.2.8 — 2020-03-16
- 3.2.7 — 2020-03-16
- … 126 more at https://npm.io/package/claire-framework/versions

## README

##Claire v2 là một framework Javascript chuyên dùng cho API server.

- được viết bằng TypeScript
- hỗ trợ websocket và HTTP request
- hỗ trợ CLI để generate base project (claire-cli)


#### Change Log:

3.4.2 [Breaking change]
- allow numeric operators (>=, <=, ==, !=) in getAllResource controller

3.3.3 [Breaking change]
- fix orQueries when queries is empty
- fix orQueries not push result
- export bwi (between inclusive)
- getOne and getMany now support OR operator, receiving each object of query condition as operand
- add between operator for number

3.2.14
- add float data type for sql migration
- @PrimaryKey can be @AutoGen
- fix convertToDataObjects to avoid getter
- fix init database adapter
- fix postgres return string as big int
- fix order clause in database adapter from 3.2.8 (missing get clean object)
- fix order clause in database adapter from 3.2.7
- fix update and create got undefined in field value from 3.2.6
- fix null value of data object from 3.2.5
- fix default http resource controller update for getter fields
- fix default json responder
- deep json convert for DefaultJsonResponder (AbstractModel aware)
- introduce NoAccess decorator for http handler

3.2.0 [Breaking change]
- introduce DefaultAccessConditions

3.1.8
- Fix IsArray override inner data type
- DefaultSqlAdapter use Op.in for COMMON_BELONGS operator
- fix default value function generating
- fix order in IQuery required other fields
- DefaultDataValidator check for undefined of number value when using Optional()
- DefaultSqlAdapter use Op.or for COMMON_BELONGS operator
- add order in getOne and getMany query

3.0.15
- add BIGINT support
- data field should be required by default
- fix string required check with ''
- default value accepts function that returns string | number
- fix missing float data type for sql adapter
- fix DefaultDataValidator validate default value field
- fix convertToDataObject of bool value
- export missing things
- fix updateOne of database adapters

3.0.0 [Breaking change]
- introduce dependency injection

2.5.0
- update and fix Table Mapper bug

2.4.4 [Breaking change]
- single port for HTTP and Socket
- unify validator decorators
- add logic and data field name for model
- fix some validation logic

2.3.5 [Breaking change]
- Change DataTable decorator signature
- Change DataField decorator signature
 
2.3.4
- Allow DefaultSqlAdapter to omit migration

2.3.2
- DefaultEnvProvider parses simple env without env prefix

2.3.1
- fix DefaultStaticFileController

2.3.0 [Breaking change]
- fix request upgrader, merge handlers
- add new controller metadata interface, change HttpHandlerMetadata to ControllerHandlerMetadata

2.2.1
- fix request handler lost context when calling in lambda function, leads to wrong query, params and body passing

2.2.0 [Breaking change]
- Fix handler query, params, body async resolve
- Add @PermissionGroup for controller, modify @Permission for handler
- Reorder @Validator parameters

2.1.13
- refactor transaction
- DefaultHttpResourceController skips skipped field in model when createResource and updateResource
- fix ModelMetadata dependency sort

2.1.12
- fix transaction bug in DefaultSqlAdapter, DefaultNoSqlAdapter

2.1.11 [Breaking change]
- remove env provider from AppContext. We recommend to fully configure the app with env provider before running it. 

2.1.10
- add warning when override controller route
- fix DefaultEnvProvider parsing boolean
- add CORS and body parser default implementation
- add transaction support in database adapter

2.1.9
- fix DefaultHttpResourceController missing case for array value in getAllResources

2.1.8
- fix DefaultNoSqlAdapter requires primary key when autoInc with number data type (again, wtf)

2.1.7
- fix DefaultNoSqlAdapter requires primary key when autoInc with number data type
- populate autoInc primary key when insert rather than when get

2.1.6
- fix DefaultSqlAdapter updateMany return 0 when updated value matches found value

2.1.5
- default HttpResourceController getAllResources has query operator accepts primary key and foreign key query as an array of ids
- default HttpResourceController getAllResources has query operator accepts string key as regular expression
- add new regex operator for database adapter

2.1.4
- fix Boolean converting in DefaultDataValidator, missing data type in DefaultHttpResourceController

2.1 [Breaking change]
- FileLogMedia rotation by number of day
- remove using of callback in ClaireBuilder
- add implementation to almost all abstract classes and provider AppContext in init function
- fix absolute sequelize-cli call
- Controller: @OpenAccess decorator to by pass AuthorizationProvider
- DefaultEnvProvider: add fileNameResolver
- add SubSet DataValidationRule
- add query validation for DefaultHttpResourceController
- add RBAC and IAcccessCondition, ConditionValueType
- fix DefaultApiDocController exception when getting mount points
- Modify initable interface to include stop 
- Fix not bootstrap bug
- Add stoppable to Initable interface

2.0 [Breaking change]
- refactor set request handler
- abstract DefaultMongoDBAdapter to DefaultNoSqlAdapter
- rename Ws to Socket for all classes
- add DefaultApiDocController for exposing api document
- allow undefined in log media, controller and service array

1.9.0 [Breaking change]
- change HTTP controller decorator to Mapping
- add request params validation and data type parsing
- improve log readability
- fix bug of pre-using model -> injection of models
- adding log of HTTP method in DefaultHttpErrorHandler
- fix saveOne/saveMany does not populate default value
- fix findOne not check for primaryType for auto id

1.8.0 [Breaking change]
- refactor WsChannelHandler, using Message decorator
- update dependencies and test

1.7.0 [Breaking change] 
- getEnvProvider.load receive class argument instead of generic argument
- claire.start return Promise<IAppContext> and throw ClaireError
- fix bug: claire.start does not require argument

1.6 [Breaking change]
- refactor IQueryProvider and IQuery
- model does no longer need of constructor at definition

1.5 [Breaking change]
- remove TableMapper Encoding decorator
- change in DefaultEnvProvider: now using EnvTemplate decorator and EnvVar decorator
- remove operatorAliases in sequelize option

1.4 [Breaking change]
- getOne does no more throw Exception. F\*ck you getOne. F\*ck me too.

1.3 [Breaking change]
- Initable init function return Promise<void>
- add boolean type to QueryOperator

1.2 [Breaking change]
- remove HttpRouteHandler and getRoutes in AbstractHttpController, using decorator instead
- remove controller implementation of Initable
- DefaultStaticController has mount path of "/static"
- fix HttpRouteHandler not init prototype

1.1
- remove mandatory of responder, middleware, requestValidator, responseValidator in HttpRouteHandler
- remove generic from IHttpRequest
- add string validation for DefaultDataValidator
- add strictTypeCheck option to check HTTP request params (no-strict) and request body (strict)
- add projection option to getOne and getMany

---
_Source: https://npm.io/package/claire-framework · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
