fib-pool 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.travis.yml CHANGED
@@ -26,6 +26,15 @@ matrix:
26
26
  - os: linux
27
27
  env:
28
28
  - VERSION=0.27.0
29
+ - os: linux
30
+ env:
31
+ - VERSION=0.28.0
32
+ - os: linux
33
+ env:
34
+ - VERSION=0.29.0
35
+ - os: linux
36
+ env:
37
+ - VERSION=0.30.0
29
38
  - os: osx
30
39
  osx_image: xcode9
31
40
  env:
@@ -58,6 +67,18 @@ matrix:
58
67
  osx_image: xcode9
59
68
  env:
60
69
  - VERSION=0.27.0
70
+ - os: osx
71
+ osx_image: xcode9
72
+ env:
73
+ - VERSION=0.28.0
74
+ - os: osx
75
+ osx_image: xcode9
76
+ env:
77
+ - VERSION=0.29.0
78
+ - os: osx
79
+ osx_image: xcode9
80
+ env:
81
+ - VERSION=0.30.0
61
82
  before_install:
62
83
  - OS=linux
63
84
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
package/appveyor.yml CHANGED
@@ -9,6 +9,9 @@ environment:
9
9
  - VERSION: 0.26.0
10
10
  - VERSION: 0.26.1
11
11
  - VERSION: 0.27.0
12
+ - VERSION: 0.28.0
13
+ - VERSION: 0.29.0
14
+ - VERSION: 0.30.0
12
15
 
13
16
  install:
14
17
  - ps: Install-Product node $env:nodejs_version
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  const coroutine = require("coroutine");
2
3
  const util = require("util");
3
4
  function ensureError(e) {
@@ -5,7 +6,7 @@ function ensureError(e) {
5
6
  e = new Error(e);
6
7
  return e;
7
8
  }
8
- const GetPool = function (_opt, maxsize, timeout) {
9
+ module.exports = function GetPool(_opt, maxsize, timeout) {
9
10
  let opt = _opt;
10
11
  if (util.isFunction(_opt)) {
11
12
  opt = {
@@ -87,6 +88,7 @@ const GetPool = function (_opt, maxsize, timeout) {
87
88
  break;
88
89
  }
89
90
  catch (e) {
91
+ console.log(e);
90
92
  if (++cn >= retry) {
91
93
  err = e;
92
94
  break;
@@ -160,4 +162,3 @@ const GetPool = function (_opt, maxsize, timeout) {
160
162
  };
161
163
  return pool;
162
164
  };
163
- module.exports = GetPool;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "fib-pool",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Generic resource pooling for fibjs",
5
5
  "main": "./lib",
6
- "types": "@types/index.d.ts",
6
+ "types": "typings/index.d.ts",
7
7
  "repository": "git://github.com/fibjs/fib-pool.git",
8
8
  "author": "Liu Hu <lion@9465.net>",
9
9
  "contributors": [
@@ -20,7 +20,7 @@
20
20
  "fibjs"
21
21
  ],
22
22
  "scripts": {
23
- "build": "fib-typify src -o lib",
23
+ "build": "ftsc ./src/* --outDir lib",
24
24
  "test": "fibjs test",
25
25
  "ci": "npm run build && npm run test",
26
26
  "prepublishOnly": "npm run build"
@@ -28,7 +28,7 @@
28
28
  "devDependencies": {
29
29
  "@fibjs/ci": "^2.3.0",
30
30
  "@fibjs/types": "^0.27.1",
31
- "fib-typify": "^0.6.0"
31
+ "fib-typify": "^0.8.4"
32
32
  },
33
33
  "ci": {
34
34
  "type": "travis, appveyor",
@@ -40,7 +40,10 @@
40
40
  "0.25.0",
41
41
  "0.26.0",
42
42
  "0.26.1",
43
- "0.27.0"
43
+ "0.27.0",
44
+ "0.28.0",
45
+ "0.29.0",
46
+ "0.30.0"
44
47
  ]
45
48
  }
46
49
  }
package/tsconfig.json CHANGED
@@ -4,9 +4,10 @@
4
4
  "module": "commonjs",
5
5
  "alwaysStrict": false,
6
6
  "removeComments": true,
7
- "typeRoots": [
8
- "node_modules",
9
- "types"
7
+ "declaration": true,
8
+ "declarationDir": "typings",
9
+ "types": [
10
+ "@fibjs/types"
10
11
  ]
11
12
  }
12
13
  }
@@ -0,0 +1,41 @@
1
+ declare namespace FibPoolNS {
2
+ type FirstParameter<T> = T extends (arg: infer T, ...args: any[]) => any ? T : never;
3
+ interface DippedItemStruct {
4
+ close?: FibPoolOptionResult['destroy'];
5
+ destroy?: FibPoolOptionResult['destroy'];
6
+ dispose?: FibPoolOptionResult['destroy'];
7
+ }
8
+ interface FibPoolOptionArgs<T extends DippedItemStruct = {}> {
9
+ create: (name: string) => T;
10
+ destroy?: (item?: T) => any;
11
+ maxsize?: number;
12
+ timeout?: number;
13
+ retry?: number | boolean;
14
+ }
15
+ interface FibPoolOptionResult<T extends DippedItemStruct = {}> {
16
+ create: FibPoolOptionArgs<T>['create'];
17
+ destroy: FibPoolOptionArgs<T>['destroy'];
18
+ maxsize: FibPoolOptionArgs<T>['maxsize'];
19
+ timeout: FibPoolOptionArgs<T>['timeout'];
20
+ retry: FibPoolOptionArgs<T>['retry'];
21
+ }
22
+ interface FibPoolDipperFn<T_CREATED_ITEM, T_POOL_FUNC_RETURN = any> {
23
+ (o: T_CREATED_ITEM): T_POOL_FUNC_RETURN;
24
+ }
25
+ type FibPool<T_CREATED_ITEM, T_POOL_FUNC_RETURN = any> = {
26
+ <T_RETURN = T_POOL_FUNC_RETURN>(name: string, func: FibPoolDipperFn<T_CREATED_ITEM, T_RETURN>): T_RETURN;
27
+ <T_RETURN = T_POOL_FUNC_RETURN>(func: FibPoolDipperFn<T_CREATED_ITEM, T_RETURN>): T_RETURN;
28
+ } & {
29
+ connections?(): number;
30
+ info?(): {
31
+ maxsize: number;
32
+ count: number;
33
+ running: number;
34
+ wait: number;
35
+ timeout: number;
36
+ };
37
+ clear?(): void;
38
+ };
39
+ }
40
+ declare const _default: <T_CREATED_ITEM extends FibPoolNS.DippedItemStruct, T_POOL_FUNC_RETURN>(_opt: FibPoolNS.FibPoolOptionArgs<T_CREATED_ITEM> | ((name: string) => T_CREATED_ITEM), maxsize?: number, timeout?: number) => FibPoolNS.FibPool<T_CREATED_ITEM, T_POOL_FUNC_RETURN>;
41
+ export = _default;
package/@types/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference path="type.d.ts" />
2
-
3
- export = FibPoolNS.FibPoolGenerator
package/@types/type.d.ts DELETED
@@ -1,58 +0,0 @@
1
- /// <reference types="@fibjs/types" />
2
-
3
- declare namespace FibPoolNS {
4
- type FirstParameter<T> = T extends (arg: infer T, ...args: any[]) => any ? T : never;
5
-
6
- interface DippedItemStruct {
7
- close?: FibPoolOptionResult['destroy'];
8
- destroy?: FibPoolOptionResult['destroy'];
9
- dispose?: FibPoolOptionResult['destroy'];
10
- }
11
-
12
- interface FibPoolOptionArgs<T extends DippedItemStruct = Fibjs.AnyObject> {
13
- create: (name: string) => T
14
- destroy?: (item?: T) => any;
15
- maxsize?: number
16
- timeout?: number
17
- retry?: number | boolean
18
- }
19
- interface FibPoolOptionResult<T extends DippedItemStruct = Fibjs.AnyObject> {
20
- create: FibPoolOptionArgs<T>['create']
21
- destroy: FibPoolOptionArgs<T>['destroy']
22
- maxsize: FibPoolOptionArgs<T>['maxsize']
23
- timeout: FibPoolOptionArgs<T>['timeout']
24
- retry: FibPoolOptionArgs<T>['retry']
25
- }
26
-
27
- interface FibPoolDipperFn<T_CREATED_ITEM, T_POOL_FUNC_RETURN = any> {
28
- (o: T_CREATED_ITEM): T_POOL_FUNC_RETURN
29
- }
30
-
31
- type FibPool<T_CREATED_ITEM, T_POOL_FUNC_RETURN = any> = {
32
- <T_RETURN = T_POOL_FUNC_RETURN>(name: string, func: FibPoolDipperFn<T_CREATED_ITEM, T_RETURN>): T_RETURN
33
- <T_RETURN = T_POOL_FUNC_RETURN>(func: FibPoolDipperFn<T_CREATED_ITEM, T_RETURN>): T_RETURN
34
- } & {
35
- connections?(): number;
36
- info?(): {
37
- maxsize: number;
38
- count: number;
39
- running: number;
40
- wait: number;
41
- timeout: number;
42
- };
43
- clear?(): void;
44
- }
45
-
46
- function FibPoolGenerator<
47
- T_CREATED_ITEM extends DippedItemStruct = Fibjs.AnyObject,
48
- T_POOL_FUNC_RETURN = any
49
- > (
50
- opt: FibPoolOptionArgs<T_CREATED_ITEM> | FibPoolOptionArgs<T_CREATED_ITEM>['create'],
51
- maxsize?: number,
52
- timeout?: number
53
- ): FibPool<T_CREATED_ITEM, T_POOL_FUNC_RETURN>;
54
- }
55
-
56
- declare module "fib-pool" {
57
- export = FibPoolNS.FibPoolGenerator
58
- }
File without changes