File tree Expand file tree Collapse file tree 7 files changed +23
-28
lines changed Expand file tree Collapse file tree 7 files changed +23
-28
lines changed Original file line number Diff line number Diff line change
1
+ export enum PoolState {
2
+ IDLE = 0 ,
3
+ STARTED = 1 ,
4
+ CLOSING = 2 ,
5
+ CLOSED = 3 ,
6
+ }
7
+
8
+ export enum ResourceState {
9
+ IDLE = 0 ,
10
+ ACQUIRED = 1 ,
11
+ VALIDATION = 2 ,
12
+ }
Original file line number Diff line number Diff line change 1
- import { PoolConfiguration , PoolFactory } from './definitions.js' ;
2
1
import { Pool } from './pool.js' ;
2
+ import { PoolConfiguration , PoolFactory } from './types.js' ;
3
3
4
4
export * from './abort-error.js' ;
5
- export * from './definitions .js' ;
5
+ export * from './constants .js' ;
6
6
export * from './pool.js' ;
7
+ export * from './types.js' ;
7
8
8
9
export function createPool < T = any > (
9
10
factory : PoolFactory < T > ,
Original file line number Diff line number Diff line change 1
1
import { EventEmitter } from 'events' ;
2
- import { PoolConfiguration } from './definitions .js' ;
3
- import { Pool } from './pool .js' ;
2
+ import type { Pool } from './pool .js' ;
3
+ import type { PoolConfiguration } from './types .js' ;
4
4
5
5
const defaultValues = {
6
6
acquireMaxRetries : 0 ,
Original file line number Diff line number Diff line change 1
- import { Callback } from './definitions .js' ;
2
- import { Pool } from './pool .js' ;
1
+ import type { Pool } from './pool .js' ;
2
+ import type { Callback } from './types .js' ;
3
3
4
4
function noop ( ) { }
5
5
Original file line number Diff line number Diff line change @@ -2,16 +2,11 @@ import DoublyLinked from 'doublylinked';
2
2
import { EventEmitter } from 'events' ;
3
3
import promisify from 'putil-promisify' ;
4
4
import { AbortError } from './abort-error.js' ;
5
- import {
6
- Callback ,
7
- PoolConfiguration ,
8
- PoolFactory ,
9
- PoolState ,
10
- ResourceState ,
11
- } from './definitions.js' ;
5
+ import { PoolState , ResourceState } from './constants.js' ;
12
6
import { PoolOptions } from './pool-options.js' ;
13
7
import { PoolRequest } from './pool-request.js' ;
14
8
import { ResourceItem } from './resource-item.js' ;
9
+ import type { Callback , PoolConfiguration , PoolFactory } from './types.js' ;
15
10
16
11
export class Pool < T = any > extends EventEmitter {
17
12
private readonly _options : PoolOptions ;
Original file line number Diff line number Diff line change 1
- import { DoublyLinked } from 'doublylinked' ;
2
- import { ResourceState } from './definitions .js' ;
1
+ import type { DoublyLinked } from 'doublylinked' ;
2
+ import { ResourceState } from './constants .js' ;
3
3
4
4
export class ResourceItem < T > {
5
5
state : ResourceState = ResourceState . IDLE ;
Original file line number Diff line number Diff line change 1
1
export type Callback = ( e ?: unknown , ...args : any [ ] ) => void ;
2
2
3
- export enum PoolState {
4
- IDLE = 0 ,
5
- STARTED = 1 ,
6
- CLOSING = 2 ,
7
- CLOSED = 3 ,
8
- }
9
-
10
- export enum ResourceState {
11
- IDLE = 0 ,
12
- ACQUIRED = 1 ,
13
- VALIDATION = 2 ,
14
- }
15
-
16
3
export interface PoolFactory < T = any > {
17
4
create ( info ?: { tries : number ; maxRetries : number } ) : Promise < T > | T ;
18
5
You can’t perform that action at this time.
0 commit comments