Extract redux, http-types, http-client and test-utils
This commit is contained in:
parent
f509004dac
commit
eebe26f706
3
package-lock.json
generated
3
package-lock.json
generated
@ -2153,6 +2153,9 @@
|
|||||||
"@rondo.dev/logger": {
|
"@rondo.dev/logger": {
|
||||||
"version": "file:packages/logger"
|
"version": "file:packages/logger"
|
||||||
},
|
},
|
||||||
|
"@rondo.dev/redux-util": {
|
||||||
|
"version": "file:packages/redux-util"
|
||||||
|
},
|
||||||
"@rondo.dev/scripts": {
|
"@rondo.dev/scripts": {
|
||||||
"version": "file:packages/scripts"
|
"version": "file:packages/scripts"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,7 +12,11 @@
|
|||||||
"@rondo.dev/scripts": "file:packages/scripts",
|
"@rondo.dev/scripts": "file:packages/scripts",
|
||||||
"@rondo.dev/argparse": "file:packages/argparse",
|
"@rondo.dev/argparse": "file:packages/argparse",
|
||||||
"@rondo.dev/logger": "file:packages/logger",
|
"@rondo.dev/logger": "file:packages/logger",
|
||||||
"@rondo.dev/config": "file:packages/config"
|
"@rondo.dev/config": "file:packages/config",
|
||||||
|
"@rondo.dev/redux": "file:packages/redux",
|
||||||
|
"@rondo.dev/http-client": "file:packages/http-client",
|
||||||
|
"@rondo.dev/test-utils": "file:packages/test-utils",
|
||||||
|
"@rondo.dev/http-types": "file:packages/http-types"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bcrypt": "^3.0.0",
|
"@types/bcrypt": "^3.0.0",
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
import {History, Location} from 'history'
|
import {History, Location} from 'history'
|
||||||
import {IWithRouterProps} from './IWithRouterProps'
|
import {IWithRouterProps} from './IWithRouterProps'
|
||||||
import {Link as RouterLink, LinkProps} from 'react-router-dom'
|
import {Link as RouterLink, LinkProps} from 'react-router-dom'
|
||||||
import {URLFormatter} from '@rondo.dev/common'
|
import {URLFormatter} from '@rondo.dev/http-client'
|
||||||
import {withRouter} from 'react-router'
|
import {withRouter} from 'react-router'
|
||||||
|
|
||||||
export interface ILinkProps
|
export interface ILinkProps
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import {createCRUDActions} from './CRUDActions'
|
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||||
import React from 'react'
|
import { TMethod } from '@rondo.dev/http-types'
|
||||||
import {AnyAction} from 'redux'
|
import { IPendingAction } from '@rondo.dev/redux'
|
||||||
import {CRUDReducer, TCRUDMethod, TCRUDAsyncMethod} from './'
|
import { getError } from '@rondo.dev/test-utils'
|
||||||
import {HTTPClientMock, TestUtils, getError} from '../test-utils'
|
import { AnyAction } from 'redux'
|
||||||
import {TMethod} from '@rondo.dev/common'
|
import { TestUtils } from '../test-utils'
|
||||||
import {IPendingAction} from '../actions'
|
import { CRUDReducer, TCRUDAsyncMethod } from './'
|
||||||
|
import { createCRUDActions } from './CRUDActions'
|
||||||
|
|
||||||
describe('CRUD', () => {
|
describe('CRUD', () => {
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import {IHTTPClient, ITypedRequestParams} from '../http'
|
import { TFilter, TOnlyDefined } from '@rondo.dev/common'
|
||||||
import {IRoutes, TFilter, TOnlyDefined} from '@rondo.dev/common'
|
import { IHTTPClient } from '@rondo.dev/http-client'
|
||||||
import {TCRUDAction} from './TCRUDAction'
|
import { IRoutes } from '@rondo.dev/http-types'
|
||||||
import {TCRUDChangeAction} from './TCRUDAction'
|
import { TCRUDAction, TCRUDChangeAction, TCRUDCreateAction, TCRUDEditAction } from './TCRUDAction'
|
||||||
import {TCRUDCreateAction} from './TCRUDAction'
|
import { TCRUDMethod } from './TCRUDMethod'
|
||||||
import {TCRUDEditAction} from './TCRUDAction'
|
|
||||||
import {TCRUDMethod} from './TCRUDMethod'
|
|
||||||
|
|
||||||
type TAction <T, ActionType extends string, Method extends TCRUDMethod> =
|
type TAction <T, ActionType extends string, Method extends TCRUDMethod> =
|
||||||
TFilter<TCRUDAction<T, ActionType> , {method: Method, status: 'pending'}>
|
TFilter<TCRUDAction<T, ActionType> , {method: Method, status: 'pending'}>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {IAction, IResolvedAction} from '../actions'
|
import {IAction, IResolvedAction} from '@rondo.dev/redux'
|
||||||
import {TCRUDAction} from './TCRUDAction'
|
import {TCRUDAction} from './TCRUDAction'
|
||||||
import {TCRUDMethod} from './TCRUDMethod'
|
import {TCRUDMethod} from './TCRUDMethod'
|
||||||
import {indexBy, without, TFilter} from '@rondo.dev/common'
|
import {indexBy, without, TFilter} from '@rondo.dev/common'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {IAction, TAsyncAction} from '../actions'
|
import {IAction, TAsyncAction} from '@rondo.dev/redux'
|
||||||
import {TCRUDMethod} from './TCRUDMethod'
|
import {TCRUDMethod} from './TCRUDMethod'
|
||||||
|
|
||||||
// Async actions
|
// Async actions
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {TGetAction, IAction} from '../actions'
|
import {TGetAction, IAction} from '@rondo.dev/redux'
|
||||||
import {ICrumbLink} from './ICrumbLink'
|
import {ICrumbLink} from './ICrumbLink'
|
||||||
|
|
||||||
export interface ICrumbs {
|
export interface ICrumbs {
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import {Crumb} from './Crumb'
|
import { TStateSelector } from '@rondo.dev/redux'
|
||||||
import {Connector, TStateSelector} from '../redux'
|
import { Connector } from '../redux'
|
||||||
import {ICrumbsState} from './CrumbsReducer'
|
import { Crumb } from './Crumb'
|
||||||
import {CrumbsActions} from './CrumbsActions'
|
import { CrumbsActions } from './CrumbsActions'
|
||||||
|
import { ICrumbsState } from './CrumbsReducer'
|
||||||
|
|
||||||
export class CrumbsConnector extends Connector<ICrumbsState> {
|
export class CrumbsConnector extends Connector<ICrumbsState> {
|
||||||
protected readonly breadcrumbsActions = new CrumbsActions()
|
protected readonly breadcrumbsActions = new CrumbsActions()
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
export * from './actions'
|
|
||||||
export * from './components'
|
export * from './components'
|
||||||
export * from './crud'
|
export * from './crud'
|
||||||
export * from './crumbs'
|
export * from './crumbs'
|
||||||
export * from './csrf'
|
export * from './csrf'
|
||||||
export * from './http'
|
|
||||||
export * from './login'
|
export * from './login'
|
||||||
export * from './middleware'
|
|
||||||
export * from './redux'
|
export * from './redux'
|
||||||
export * from './renderer'
|
export * from './renderer'
|
||||||
export * from './store'
|
|
||||||
export * from './test-utils'
|
export * from './test-utils'
|
||||||
|
|
||||||
import * as team from './team'
|
import * as team from './team'
|
||||||
export {team}
|
export { team }
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {TGetAction, TAsyncAction, IAction, PendingAction} from '../actions'
|
import {TGetAction, TAsyncAction, IAction, PendingAction} from '@rondo.dev/redux'
|
||||||
import {IAPIDef, ICredentials, INewUser, IUser} from '@rondo.dev/common'
|
import {IAPIDef, ICredentials, INewUser, IUser} from '@rondo.dev/common'
|
||||||
import {IHTTPClient} from '../http/IHTTPClient'
|
import {IHTTPClient} from '@rondo.dev/http-client'
|
||||||
|
|
||||||
export type TLoginAction =
|
export type TLoginAction =
|
||||||
TAsyncAction<IUser, 'LOGIN'>
|
TAsyncAction<IUser, 'LOGIN'>
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import {Connector} from '../redux/Connector'
|
import { ICredentials } from '@rondo.dev/common'
|
||||||
import {ICredentials} from '@rondo.dev/common'
|
import { TStateSelector } from '@rondo.dev/redux'
|
||||||
import {ILoginState} from './LoginReducer'
|
import { bindActionCreators } from 'redux'
|
||||||
import {TStateSelector} from '../redux'
|
import { Connector } from '../redux/Connector'
|
||||||
import {LoginActions} from './LoginActions'
|
import { LoginActions } from './LoginActions'
|
||||||
import {LoginForm} from './LoginForm'
|
import { LoginForm } from './LoginForm'
|
||||||
import {bindActionCreators} from 'redux'
|
import { ILoginState } from './LoginReducer'
|
||||||
import {withForm} from './withForm'
|
import { withForm } from './withForm'
|
||||||
|
|
||||||
const defaultCredentials: ICredentials = {
|
const defaultCredentials: ICredentials = {
|
||||||
username: '',
|
username: '',
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import * as Feature from './'
|
import { IAPIDef } from '@rondo.dev/common'
|
||||||
|
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||||
|
import { getError } from '@rondo.dev/test-utils'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import T from 'react-dom/test-utils'
|
import T from 'react-dom/test-utils'
|
||||||
import {HTTPClientMock, TestUtils, getError} from '../test-utils'
|
import { MemoryRouter } from 'react-router-dom'
|
||||||
import {IAPIDef} from '@rondo.dev/common'
|
import { TestUtils } from '../test-utils'
|
||||||
import {MemoryRouter} from 'react-router-dom'
|
import * as Feature from './'
|
||||||
|
|
||||||
const test = new TestUtils()
|
const test = new TestUtils()
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import {Connector} from '../redux/Connector'
|
import {Connector} from '../redux/Connector'
|
||||||
import {INewUser} from '@rondo.dev/common'
|
import {INewUser} from '@rondo.dev/common'
|
||||||
import {ILoginState} from './LoginReducer'
|
import {ILoginState} from './LoginReducer'
|
||||||
import {TStateSelector} from '../redux'
|
import {TStateSelector} from '@rondo.dev/redux'
|
||||||
import {LoginActions} from './LoginActions'
|
import {LoginActions} from './LoginActions'
|
||||||
import {RegisterForm} from './RegisterForm'
|
import {RegisterForm} from './RegisterForm'
|
||||||
import {bindActionCreators} from 'redux'
|
import {bindActionCreators} from 'redux'
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import * as Feature from './'
|
import { IAPIDef } from '@rondo.dev/common'
|
||||||
|
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||||
|
import { getError } from '@rondo.dev/test-utils'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import T from 'react-dom/test-utils'
|
import T from 'react-dom/test-utils'
|
||||||
import {HTTPClientMock, TestUtils, getError} from '../test-utils'
|
import { MemoryRouter } from 'react-router-dom'
|
||||||
import {IAPIDef} from '@rondo.dev/common'
|
import { TestUtils } from '../test-utils'
|
||||||
import {MemoryRouter} from 'react-router-dom'
|
import * as Feature from './'
|
||||||
|
|
||||||
const test = new TestUtils()
|
const test = new TestUtils()
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {IPendingAction} from '../actions'
|
import {IPendingAction} from '@rondo.dev/redux'
|
||||||
|
|
||||||
export interface IComponentProps<Data> {
|
export interface IComponentProps<Data> {
|
||||||
onSubmit: () => void
|
onSubmit: () => void
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {TStateSelector} from './TStateSelector'
|
import {TStateSelector} from '@rondo.dev/redux'
|
||||||
import {connect, Omit} from 'react-redux'
|
import {connect, Omit} from 'react-redux'
|
||||||
import {Dispatch} from 'redux'
|
import {Dispatch} from 'redux'
|
||||||
import {ComponentType} from 'react'
|
import {ComponentType} from 'react'
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
/*
|
|
||||||
* Select and return a part of the state
|
|
||||||
*/
|
|
||||||
export type TStateSelector<GlobalState, StateSlice>
|
|
||||||
= (state: GlobalState) => StateSlice
|
|
||||||
@ -1,3 +1 @@
|
|||||||
export * from './Connector'
|
export * from './Connector'
|
||||||
export * from './TStateSelector'
|
|
||||||
export * from './pack'
|
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
// import React from 'react'
|
|
||||||
// import {connect, Omit} from 'react-redux'
|
|
||||||
|
|
||||||
// interface IProps {
|
|
||||||
// a: number
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class NumberDisplay extends React.PureComponent<IProps> {
|
|
||||||
// render() {
|
|
||||||
// return `${this.props.a}`
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Case 1: this works
|
|
||||||
// function mapStateToProps(state: any) {
|
|
||||||
// return {a: 1}
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const ConnectedNumberDisplay1 = connect(mapStateToProps)(NumberDisplay)
|
|
||||||
|
|
||||||
// export const display1 = <ConnectedNumberDisplay1 />
|
|
||||||
|
|
||||||
// // Case 2: this doesn't work
|
|
||||||
// function wrap<State, StateProps, ComponentProps>(
|
|
||||||
// mapState: (state: State) => StateProps,
|
|
||||||
// Component: React.ComponentType<ComponentProps>,
|
|
||||||
// ): React.ComponentType<
|
|
||||||
// Omit<ComponentProps, keyof StateProps & keyof ComponentProps>
|
|
||||||
// > {
|
|
||||||
// return connect(mapState)(Component as any) as any
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const ConnectedNumberDisplay2 = wrap(mapStateToProps, NumberDisplay)
|
|
||||||
// export const display2 = <ConnectedNumberDisplay2 />
|
|
||||||
@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'
|
|||||||
import {Action} from 'redux'
|
import {Action} from 'redux'
|
||||||
import {IAPIDef} from '@rondo.dev/common'
|
import {IAPIDef} from '@rondo.dev/common'
|
||||||
import {IClientConfig} from './IClientConfig'
|
import {IClientConfig} from './IClientConfig'
|
||||||
import {IHTTPClient, HTTPClient} from '../http'
|
import {IHTTPClient, HTTPClient} from '@rondo.dev/http-client'
|
||||||
import {IRenderer} from './IRenderer'
|
import {IRenderer} from './IRenderer'
|
||||||
import {Provider} from 'react-redux'
|
import {Provider} from 'react-redux'
|
||||||
import {Router} from 'react-router-dom'
|
import {Router} from 'react-router-dom'
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { renderToNodeStream } from 'react-dom/server'
|
||||||
|
import { Provider } from 'react-redux'
|
||||||
|
import { StaticRouterContext } from 'react-router'
|
||||||
|
import { StaticRouter } from 'react-router-dom'
|
||||||
import ssrPrepass from 'react-ssr-prepass'
|
import ssrPrepass from 'react-ssr-prepass'
|
||||||
import {Action} from 'redux'
|
import { Store } from 'redux'
|
||||||
import {IAPIDef} from '@rondo.dev/common'
|
import { IClientConfig } from './IClientConfig'
|
||||||
import {IClientConfig} from './IClientConfig'
|
import { IRenderer } from './IRenderer'
|
||||||
import {IHTTPClient, HTTPClient} from '../http'
|
|
||||||
import {IRenderer} from './IRenderer'
|
|
||||||
import {Provider} from 'react-redux'
|
|
||||||
import {StaticRouterContext} from 'react-router'
|
|
||||||
import {StaticRouter} from 'react-router-dom'
|
|
||||||
import {Store} from 'redux'
|
|
||||||
import {renderToNodeStream} from 'react-dom/server'
|
|
||||||
|
|
||||||
export class ServerRenderer<Props> implements IRenderer<Props> {
|
export class ServerRenderer<Props> implements IRenderer<Props> {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {IAPIDef} from '@rondo.dev/common'
|
import {IAPIDef} from '@rondo.dev/common'
|
||||||
import {TGetPendingAction, TAsyncAction, PendingAction} from '../actions'
|
import {TGetPendingAction, TAsyncAction, PendingAction} from '@rondo.dev/redux'
|
||||||
import {IHTTPClient} from '../http/IHTTPClient'
|
import {IHTTPClient} from '@rondo.dev/http-client'
|
||||||
import {ITeam, IUser, IUserInTeam} from '@rondo.dev/common'
|
import {ITeam, IUser, IUserInTeam} from '@rondo.dev/common'
|
||||||
|
|
||||||
export type TTeamAction =
|
export type TTeamAction =
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import * as Feature from './'
|
import * as Feature from './'
|
||||||
// export ReactDOM from 'react-dom'
|
// export ReactDOM from 'react-dom'
|
||||||
import T from 'react-dom/test-utils'
|
import T from 'react-dom/test-utils'
|
||||||
import {HTTPClientMock, TestUtils, getError} from '../test-utils'
|
import {TestUtils} from '../test-utils'
|
||||||
|
import {HTTPClientMock} from '@rondo.dev/http-client'
|
||||||
|
import {getError} from '@rondo.dev/test-utils'
|
||||||
import {IAPIDef, ITeam, IUserInTeam} from '@rondo.dev/common'
|
import {IAPIDef, ITeam, IUserInTeam} from '@rondo.dev/common'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {MemoryRouter} from 'react-router-dom'
|
import {MemoryRouter} from 'react-router-dom'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import {Connector} from '../redux/Connector'
|
import {Connector} from '../redux/Connector'
|
||||||
import {pack, TStateSelector} from '../redux'
|
import {pack, TStateSelector} from '@rondo.dev/redux'
|
||||||
import {ITeamState} from './TeamReducer'
|
import {ITeamState} from './TeamReducer'
|
||||||
import {TeamActions} from './TeamActions'
|
import {TeamActions} from './TeamActions'
|
||||||
import {TeamManager} from './TeamManager'
|
import {TeamManager} from './TeamManager'
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import {
|
|||||||
ITeam, IUserInTeam, TReadonlyRecord, indexBy, without,
|
ITeam, IUserInTeam, TReadonlyRecord, indexBy, without,
|
||||||
} from '@rondo.dev/common'
|
} from '@rondo.dev/common'
|
||||||
import {TTeamAction} from './TeamActions'
|
import {TTeamAction} from './TeamActions'
|
||||||
import {TGetResolvedAction} from '../actions'
|
import {TGetResolvedAction} from '@rondo.dev/redux'
|
||||||
|
|
||||||
export interface ITeamState {
|
export interface ITeamState {
|
||||||
readonly error: string
|
readonly error: string
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import T from 'react-dom/test-utils'
|
import T from 'react-dom/test-utils'
|
||||||
import {TStateSelector} from '../redux'
|
import {createStore, TStateSelector} from '@rondo.dev/redux'
|
||||||
import {Provider} from 'react-redux'
|
import {Provider} from 'react-redux'
|
||||||
import {createStore} from '../store'
|
|
||||||
import {
|
import {
|
||||||
Action,
|
Action,
|
||||||
AnyAction,
|
AnyAction,
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Waits for a promise be rejected and return the error. If a promise resolves
|
|
||||||
* it will throw an error. To be used during testing since
|
|
||||||
* `expect(...).toThrowError()` only works with synchronous calls
|
|
||||||
*/
|
|
||||||
export async function getError(promise: Promise<any>): Promise<Error> {
|
|
||||||
let error: Error
|
|
||||||
try {
|
|
||||||
await promise
|
|
||||||
} catch (err) {
|
|
||||||
error = err
|
|
||||||
}
|
|
||||||
expect(error!).toBeTruthy()
|
|
||||||
return error!
|
|
||||||
}
|
|
||||||
@ -1,3 +1 @@
|
|||||||
export * from './HTTPClientMock'
|
|
||||||
export * from './TestUtils'
|
export * from './TestUtils'
|
||||||
export * from './getError'
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
"rootDir": "src"
|
"rootDir": "src"
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
|
{"path": "../redux"},
|
||||||
{"path": "../comments-common"}
|
{"path": "../comments-common"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,16 +4,13 @@ export * from './IAPIDef'
|
|||||||
export * from './ICredentials'
|
export * from './ICredentials'
|
||||||
export * from './ILogger'
|
export * from './ILogger'
|
||||||
export * from './INewUser'
|
export * from './INewUser'
|
||||||
export * from './IRequestParams'
|
|
||||||
export * from './IRole'
|
export * from './IRole'
|
||||||
export * from './IRoutes'
|
|
||||||
export * from './ITeam'
|
export * from './ITeam'
|
||||||
export * from './IUser'
|
export * from './IUser'
|
||||||
export * from './IUser'
|
export * from './IUser'
|
||||||
export * from './IUserInTeam'
|
export * from './IUserInTeam'
|
||||||
export * from './IUserTeam'
|
export * from './IUserTeam'
|
||||||
export * from './StringUtils'
|
export * from './StringUtils'
|
||||||
export * from './URLFormatter'
|
|
||||||
export * from './filterProps'
|
export * from './filterProps'
|
||||||
export * from './indexBy'
|
export * from './indexBy'
|
||||||
export * from './types'
|
export * from './types'
|
||||||
|
|||||||
@ -3,5 +3,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "esm"
|
"outDir": "esm"
|
||||||
},
|
},
|
||||||
"references": []
|
"references": [
|
||||||
}
|
]
|
||||||
|
}
|
||||||
|
|||||||
@ -3,5 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"rootDir": "src"
|
"rootDir": "src"
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
9
packages/config/tsconfig.esm.json
Normal file
9
packages/config/tsconfig.esm.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "esm"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{"path": "../logger/tsconfig.esm.json"}
|
||||||
|
]
|
||||||
|
}
|
||||||
16
packages/http-client/jest.config.js
Normal file
16
packages/http-client/jest.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module.exports = {
|
||||||
|
roots: [
|
||||||
|
'<rootDir>/src'
|
||||||
|
],
|
||||||
|
transform: {
|
||||||
|
'^.+\\.tsx?$': 'ts-jest'
|
||||||
|
},
|
||||||
|
testRegex: '(/__tests__/.*|\\.(test|spec))\\.tsx?$',
|
||||||
|
moduleFileExtensions: [
|
||||||
|
'ts',
|
||||||
|
'tsx',
|
||||||
|
'js',
|
||||||
|
'jsx'
|
||||||
|
],
|
||||||
|
setupFiles: ['<rootDir>/jest.setup.js']
|
||||||
|
}
|
||||||
4
packages/http-client/jest.setup.js
Normal file
4
packages/http-client/jest.setup.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
if (!process.env.LOG) {
|
||||||
|
process.env.LOG = 'sql:warn'
|
||||||
|
}
|
||||||
|
process.chdir(__dirname)
|
||||||
16
packages/http-client/package.json
Normal file
16
packages/http-client/package.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "@rondo.dev/http-client",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
|
"lint": "tslint --project .",
|
||||||
|
"compile": "tsc",
|
||||||
|
"clean": "rm -rf lib/"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.19.0"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"module": "esm/index.js",
|
||||||
|
"types": "lib/index.d.ts"
|
||||||
|
}
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import {IHTTPClient} from './IHTTPClient'
|
import {IHTTPClient} from './IHTTPClient'
|
||||||
import {IHeader} from './IHeader'
|
import {IHeader} from './IHeader'
|
||||||
import {TMethod, IRoutes, URLFormatter} from '@rondo.dev/common'
|
import {TMethod, IRoutes} from '@rondo.dev/http-types'
|
||||||
|
import {URLFormatter} from './URLFormatter'
|
||||||
import {IRequest} from './IRequest'
|
import {IRequest} from './IRequest'
|
||||||
import {IResponse} from './IResponse'
|
import {IResponse} from './IResponse'
|
||||||
import {ITypedRequestParams} from './ITypedRequestParams'
|
import {ITypedRequestParams} from './ITypedRequestParams'
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import {HTTPClientMock} from './HTTPClientMock'
|
import {HTTPClientMock} from './HTTPClientMock'
|
||||||
import {getError} from './getError'
|
import {getError} from '@rondo.dev/test-utils'
|
||||||
|
|
||||||
describe('HTTPClientMock', () => {
|
describe('HTTPClientMock', () => {
|
||||||
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
import {HTTPClient} from '../http/HTTPClient'
|
import {HTTPClient} from './HTTPClient'
|
||||||
import {IRequest} from '../http/IRequest'
|
import {IRequest} from './IRequest'
|
||||||
import {IResponse} from '../http/IResponse'
|
import {IResponse} from './IResponse'
|
||||||
import {IRoutes, TMethod} from '@rondo.dev/common'
|
import {IRoutes, TMethod} from '@rondo.dev/http-types'
|
||||||
import {ITypedRequestParams} from '../http/ITypedRequestParams'
|
import {ITypedRequestParams} from './ITypedRequestParams'
|
||||||
|
|
||||||
interface IReqRes {
|
interface IReqRes {
|
||||||
req: IRequest
|
req: IRequest
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import {TMethod, IRoutes} from '@rondo.dev/common'
|
import {TMethod, IRoutes} from '@rondo.dev/http-types'
|
||||||
import {ITypedRequestParams} from './ITypedRequestParams'
|
import {ITypedRequestParams} from './ITypedRequestParams'
|
||||||
|
|
||||||
export interface IHTTPClient<T extends IRoutes> {
|
export interface IHTTPClient<T extends IRoutes> {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import {TMethod} from '@rondo.dev/common'
|
import {TMethod} from '@rondo.dev/http-types'
|
||||||
|
|
||||||
export interface IRequest {
|
export interface IRequest {
|
||||||
method: TMethod,
|
method: TMethod,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import {IRoutes, TMethod} from '@rondo.dev/common'
|
import {IRoutes, TMethod} from '@rondo.dev/http-types'
|
||||||
|
|
||||||
export interface ITypedRequestParams<
|
export interface ITypedRequestParams<
|
||||||
T extends IRoutes,
|
T extends IRoutes,
|
||||||
@ -1,4 +1,3 @@
|
|||||||
import assert from 'assert'
|
|
||||||
import {IRequestParams} from './IRequestParams'
|
import {IRequestParams} from './IRequestParams'
|
||||||
import {IRequestQuery} from './IRequestQuery'
|
import {IRequestQuery} from './IRequestQuery'
|
||||||
|
|
||||||
@ -1,6 +1,10 @@
|
|||||||
export * from './HTTPClient'
|
export * from './HTTPClient'
|
||||||
export * from './IHTTPClient'
|
export * from './HTTPClientMock'
|
||||||
export * from './IHeader'
|
export * from './IHeader'
|
||||||
|
export * from './IHTTPClient'
|
||||||
export * from './IRequest'
|
export * from './IRequest'
|
||||||
|
export * from './IRequestParams'
|
||||||
|
export * from './IRequestQuery'
|
||||||
export * from './IResponse'
|
export * from './IResponse'
|
||||||
export * from './ITypedRequestParams'
|
export * from './ITypedRequestParams'
|
||||||
|
export * from './URLFormatter'
|
||||||
11
packages/http-client/tsconfig.esm.json
Normal file
11
packages/http-client/tsconfig.esm.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "esm"
|
||||||
|
},
|
||||||
|
"references": [{
|
||||||
|
"path": "../test-utils/tsconfig.esm.json"
|
||||||
|
}, {
|
||||||
|
"path": "../http-types/tsconfig.json"
|
||||||
|
}]
|
||||||
|
}
|
||||||
11
packages/http-client/tsconfig.json
Normal file
11
packages/http-client/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.common.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": "src"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{"path": "../test-utils"},
|
||||||
|
{"path": "../http-types"}
|
||||||
|
]
|
||||||
|
}
|
||||||
10
packages/http-client/tslint.json
Normal file
10
packages/http-client/tslint.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"../tslint.json"
|
||||||
|
],
|
||||||
|
"linterOptions": {
|
||||||
|
"exclude": [
|
||||||
|
"src/migrations/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
16
packages/http-types/jest.config.js
Normal file
16
packages/http-types/jest.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module.exports = {
|
||||||
|
roots: [
|
||||||
|
'<rootDir>/src'
|
||||||
|
],
|
||||||
|
transform: {
|
||||||
|
'^.+\\.tsx?$': 'ts-jest'
|
||||||
|
},
|
||||||
|
testRegex: '(/__tests__/.*|\\.(test|spec))\\.tsx?$',
|
||||||
|
moduleFileExtensions: [
|
||||||
|
'ts',
|
||||||
|
'tsx',
|
||||||
|
'js',
|
||||||
|
'jsx'
|
||||||
|
],
|
||||||
|
setupFiles: ['<rootDir>/jest.setup.js']
|
||||||
|
}
|
||||||
4
packages/http-types/jest.setup.js
Normal file
4
packages/http-types/jest.setup.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
if (!process.env.LOG) {
|
||||||
|
process.env.LOG = 'sql:warn'
|
||||||
|
}
|
||||||
|
process.chdir(__dirname)
|
||||||
14
packages/http-types/package.json
Normal file
14
packages/http-types/package.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "@rondo.dev/http-types",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
|
"lint": "tslint --project .",
|
||||||
|
"compile": "tsc",
|
||||||
|
"clean": "rm -rf lib/"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"module": "esm/index.js",
|
||||||
|
"types": "lib/index.d.ts"
|
||||||
|
}
|
||||||
8
packages/http-types/tsconfig.esm.json
Normal file
8
packages/http-types/tsconfig.esm.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "esm"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
]
|
||||||
|
}
|
||||||
9
packages/http-types/tsconfig.json
Normal file
9
packages/http-types/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.common.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": "src"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
]
|
||||||
|
}
|
||||||
10
packages/http-types/tslint.json
Normal file
10
packages/http-types/tslint.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"../tslint.json"
|
||||||
|
],
|
||||||
|
"linterOptions": {
|
||||||
|
"exclude": [
|
||||||
|
"src/migrations/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,7 +10,7 @@ import {Contextual, TPendingActions, TAllActions} from './types'
|
|||||||
import {combineReducers} from 'redux'
|
import {combineReducers} from 'redux'
|
||||||
import {createActions, createReducer} from './redux'
|
import {createActions, createReducer} from './redux'
|
||||||
import {createRemoteClient} from './remote'
|
import {createRemoteClient} from './remote'
|
||||||
import {createStore} from '@rondo.dev/client'
|
import {createStore} from '@rondo.dev/redux'
|
||||||
import {jsonrpc} from './express'
|
import {jsonrpc} from './express'
|
||||||
import {keys} from 'ts-transformer-keys'
|
import {keys} from 'ts-transformer-keys'
|
||||||
import {noopLogger} from './test-utils'
|
import {noopLogger} from './test-utils'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {IPendingAction, IResolvedAction, IRejectedAction} from '@rondo.dev/client'
|
import {IPendingAction, IResolvedAction, IRejectedAction} from '@rondo.dev/redux'
|
||||||
|
|
||||||
export type ArgumentTypes<T> =
|
export type ArgumentTypes<T> =
|
||||||
T extends (...args: infer U) => infer R ? U : never
|
T extends (...args: infer U) => infer R ? U : never
|
||||||
|
|||||||
3
packages/redux/README.md
Normal file
3
packages/redux/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# @rondo.dev/redux
|
||||||
|
|
||||||
|
Client-side utilities and type helpers for Redux.
|
||||||
16
packages/redux/jest.config.js
Normal file
16
packages/redux/jest.config.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module.exports = {
|
||||||
|
roots: [
|
||||||
|
'<rootDir>/src'
|
||||||
|
],
|
||||||
|
transform: {
|
||||||
|
'^.+\\.tsx?$': 'ts-jest'
|
||||||
|
},
|
||||||
|
testRegex: '(/__tests__/.*|\\.(test|spec))\\.tsx?$',
|
||||||
|
moduleFileExtensions: [
|
||||||
|
'ts',
|
||||||
|
'tsx',
|
||||||
|
'js',
|
||||||
|
'jsx'
|
||||||
|
],
|
||||||
|
setupFiles: ['<rootDir>/jest.setup.js']
|
||||||
|
}
|
||||||
4
packages/redux/jest.setup.js
Normal file
4
packages/redux/jest.setup.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
if (!process.env.LOG) {
|
||||||
|
process.env.LOG = 'sql:warn'
|
||||||
|
}
|
||||||
|
process.chdir(__dirname)
|
||||||
14
packages/redux/package.json
Normal file
14
packages/redux/package.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "@rondo.dev/redux",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
|
"lint": "tslint --project .",
|
||||||
|
"compile": "tsc",
|
||||||
|
"clean": "rm -rf lib/"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"module": "esm/index.js",
|
||||||
|
"types": "lib/index.d.ts"
|
||||||
|
}
|
||||||
4
packages/redux/src/index.ts
Normal file
4
packages/redux/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './actions'
|
||||||
|
export * from './middleware'
|
||||||
|
export * from './store'
|
||||||
|
export * from './pack'
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import {createStore, applyMiddleware, Store} from 'redux'
|
import {createStore, applyMiddleware, Store} from 'redux'
|
||||||
import {PromiseMiddleware} from './PromiseMiddleware'
|
import {PromiseMiddleware} from './PromiseMiddleware'
|
||||||
import {getError} from '../test-utils'
|
import {getError} from '@rondo.dev/test-utils'
|
||||||
|
|
||||||
describe('PromiseMiddleware', () => {
|
describe('PromiseMiddleware', () => {
|
||||||
|
|
||||||
@ -3,7 +3,7 @@ import {
|
|||||||
IAction, IPendingAction, IResolvedAction, IRejectedAction,
|
IAction, IPendingAction, IResolvedAction, IRejectedAction,
|
||||||
} from '../actions'
|
} from '../actions'
|
||||||
import {applyMiddleware, createStore, AnyAction} from 'redux'
|
import {applyMiddleware, createStore, AnyAction} from 'redux'
|
||||||
import {getError} from '../test-utils'
|
import { getError } from '@rondo.dev/test-utils'
|
||||||
|
|
||||||
describe('WaitMiddleware', () => {
|
describe('WaitMiddleware', () => {
|
||||||
|
|
||||||
@ -3,8 +3,7 @@ import ReactDOM from 'react-dom'
|
|||||||
import TestUtils from 'react-dom/test-utils'
|
import TestUtils from 'react-dom/test-utils'
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { createStore } from 'redux'
|
import { createStore } from 'redux'
|
||||||
import { pack } from './pack'
|
import { pack, TStateSelector } from './pack'
|
||||||
import { TStateSelector } from './TStateSelector'
|
|
||||||
|
|
||||||
describe('pack', () => {
|
describe('pack', () => {
|
||||||
|
|
||||||
@ -1,7 +1,12 @@
|
|||||||
import { ComponentType, PureComponent } from 'react'
|
import { ComponentType, PureComponent } from 'react'
|
||||||
import { connect, Omit, MapDispatchToPropsParam, Matching, GetProps, ResolveThunks } from 'react-redux'
|
import { connect, Omit, MapDispatchToPropsParam, Matching, GetProps, ResolveThunks } from 'react-redux'
|
||||||
import { Dispatch } from 'redux'
|
import { Dispatch } from 'redux'
|
||||||
import { TStateSelector } from './TStateSelector'
|
|
||||||
|
/*
|
||||||
|
* Select and return a part of the state
|
||||||
|
*/
|
||||||
|
export type TStateSelector<GlobalState, StateSlice>
|
||||||
|
= (state: GlobalState) => StateSlice
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function can be used to pack React components into reusable modules.
|
* This function can be used to pack React components into reusable modules.
|
||||||
9
packages/redux/tsconfig.esm.json
Normal file
9
packages/redux/tsconfig.esm.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "esm"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{"path": "../test-utils/tsconfig.esm.json"}
|
||||||
|
]
|
||||||
|
}
|
||||||
10
packages/redux/tsconfig.json
Normal file
10
packages/redux/tsconfig.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.common.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": "src"
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{"path": "../test-utils"}
|
||||||
|
]
|
||||||
|
}
|
||||||
10
packages/redux/tslint.json
Normal file
10
packages/redux/tslint.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"../tslint.json"
|
||||||
|
],
|
||||||
|
"linterOptions": {
|
||||||
|
"exclude": [
|
||||||
|
"src/migrations/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,20 +1,20 @@
|
|||||||
import cookieParser from 'cookie-parser'
|
import { IContext } from '@rondo.dev/common'
|
||||||
|
import { IRoutes } from '@rondo.dev/http-types'
|
||||||
|
import { bulkjsonrpc, jsonrpc } from '@rondo.dev/jsonrpc'
|
||||||
import { json } from 'body-parser'
|
import { json } from 'body-parser'
|
||||||
|
import cookieParser from 'cookie-parser'
|
||||||
import { IDatabase } from '../database'
|
import { IDatabase } from '../database'
|
||||||
import { loggerFactory } from '../logger'
|
import { loggerFactory } from '../logger'
|
||||||
import * as Middleware from '../middleware'
|
import * as Middleware from '../middleware'
|
||||||
|
import { TransactionalRouter } from '../router'
|
||||||
|
import * as routes from '../routes'
|
||||||
|
import * as rpc from '../rpc'
|
||||||
import * as Services from '../services'
|
import * as Services from '../services'
|
||||||
import * as Team from '../team'
|
import * as Team from '../team'
|
||||||
import * as User from '../user'
|
import * as User from '../user'
|
||||||
import { IServerConfig } from './IServerConfig'
|
|
||||||
import { IConfig } from './IConfig'
|
import { IConfig } from './IConfig'
|
||||||
|
import { IServerConfig } from './IServerConfig'
|
||||||
import { IServices } from './IServices'
|
import { IServices } from './IServices'
|
||||||
import * as routes from '../routes'
|
|
||||||
import { TransactionalRouter } from '../router'
|
|
||||||
import { IRoutes, IContext } from '@rondo.dev/common'
|
|
||||||
import { Express } from 'express-serve-static-core'
|
|
||||||
import { jsonrpc, bulkjsonrpc } from '@rondo.dev/jsonrpc'
|
|
||||||
import * as rpc from '../rpc'
|
|
||||||
|
|
||||||
export type ServerConfigurator<
|
export type ServerConfigurator<
|
||||||
T extends IServerConfig = IServerConfig
|
T extends IServerConfig = IServerConfig
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export {ILogger} from '@rondo.dev/common'
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import {ILogger} from './ILogger'
|
import {ILogger} from '@rondo.dev/logger'
|
||||||
import {Logger, QueryRunner} from 'typeorm'
|
import {Logger, QueryRunner} from 'typeorm'
|
||||||
import {Namespace} from 'cls-hooked'
|
import {Namespace} from 'cls-hooked'
|
||||||
import {CORRELATION_ID} from '../middleware/Transaction'
|
import {CORRELATION_ID} from '../middleware/Transaction'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import {TErrorHandler} from './TErrorHandler'
|
import {TErrorHandler} from './TErrorHandler'
|
||||||
import {ILogger} from '../logger/ILogger'
|
import {ILogger} from '@rondo.dev/logger'
|
||||||
import {IMiddleware} from './IMiddleware'
|
import {IMiddleware} from './IMiddleware'
|
||||||
import {ValidationError} from '../validator'
|
import {ValidationError} from '../validator'
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import {ILogger} from '../logger/ILogger'
|
import {ILogger} from '@rondo.dev/logger'
|
||||||
import {IMiddleware} from './IMiddleware'
|
import {IMiddleware} from './IMiddleware'
|
||||||
import {TErrorHandler} from './TErrorHandler'
|
import {TErrorHandler} from './TErrorHandler'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import {THandler} from './THandler'
|
import {THandler} from './THandler'
|
||||||
import {ILogger} from '../logger/ILogger'
|
import {ILogger} from '@rondo.dev/logger'
|
||||||
import {IMiddleware} from './IMiddleware'
|
import {IMiddleware} from './IMiddleware'
|
||||||
import shortid from 'shortid'
|
import shortid from 'shortid'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import {IRoutes, TMethod} from '@rondo.dev/common'
|
import {IRoutes, TMethod} from '@rondo.dev/http-types'
|
||||||
import {TTypedHandler, TTypedMiddleware} from './TTypedHandler'
|
import {TTypedHandler, TTypedMiddleware} from './TTypedHandler'
|
||||||
|
|
||||||
export class AsyncRouter<R extends IRoutes> {
|
export class AsyncRouter<R extends IRoutes> {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import {IRoute} from '@rondo.dev/common'
|
import {IRoute} from '@rondo.dev/http-types'
|
||||||
|
|
||||||
export interface ITypedRequest<T extends IRoute> extends express.Request {
|
export interface ITypedRequest<T extends IRoute> extends express.Request {
|
||||||
body: T['body']
|
body: T['body']
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import {IRoutes, TMethod} from '@rondo.dev/common'
|
import {IRoutes, TMethod} from '@rondo.dev/http-types'
|
||||||
import {ITypedRequest} from './ITypedRequest'
|
import {ITypedRequest} from './ITypedRequest'
|
||||||
|
|
||||||
export type TTypedMiddleware<
|
export type TTypedMiddleware<
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import {AsyncRouter} from './AsyncRouter'
|
import {AsyncRouter} from './AsyncRouter'
|
||||||
import {IRoutes, TMethod} from '@rondo.dev/common'
|
import {IRoutes, TMethod} from '@rondo.dev/http-types'
|
||||||
import {ITransactionManager} from '../database/ITransactionManager'
|
import {ITransactionManager} from '../database/ITransactionManager'
|
||||||
import {TTypedHandler} from './TTypedHandler'
|
import {TTypedHandler} from './TTypedHandler'
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {THandler} from '../middleware/THandler'
|
import {THandler} from '../middleware/THandler'
|
||||||
import {AsyncRouter} from '../router'
|
import {AsyncRouter} from '../router'
|
||||||
import {IRoutes} from '@rondo.dev/common'
|
import {IRoutes} from '@rondo.dev/http-types'
|
||||||
|
|
||||||
export abstract class BaseRoute<T extends IRoutes> {
|
export abstract class BaseRoute<T extends IRoutes> {
|
||||||
readonly handle: THandler
|
readonly handle: THandler
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user