@google-cloud/promisify 2.0.0 → 2.0.4
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/CHANGELOG.md +28 -0
- package/README.md +31 -8
- package/build/src/index.js +9 -6
- package/package.json +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/nodejs-promisify?activeTab=versions
|
|
6
6
|
|
|
7
|
+
### [2.0.4](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.3...v2.0.4) (2021-09-09)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **build:** switch primary branch to main ([#270](https://www.github.com/googleapis/nodejs-promisify/issues/270)) ([11242f7](https://www.github.com/googleapis/nodejs-promisify/commit/11242f7f76e170dae7a429f8d4064bf33be9bb3f))
|
|
13
|
+
|
|
14
|
+
### [2.0.3](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.2...v2.0.3) (2020-09-04)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* allow excluding accessor methods ([#228](https://www.github.com/googleapis/nodejs-promisify/issues/228)) ([114d8bc](https://www.github.com/googleapis/nodejs-promisify/commit/114d8bcef7093bdfda195a15e0c2f376195fd3fc))
|
|
20
|
+
|
|
21
|
+
### [2.0.2](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.1...v2.0.2) (2020-07-06)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* update node issue template ([#204](https://www.github.com/googleapis/nodejs-promisify/issues/204)) ([a2ba8d8](https://www.github.com/googleapis/nodejs-promisify/commit/a2ba8d8e45ef03d093d987292a467696745fc9fd))
|
|
27
|
+
|
|
28
|
+
### [2.0.1](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.0...v2.0.1) (2020-05-08)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* apache license URL ([#468](https://www.github.com/googleapis/nodejs-promisify/issues/468)) ([#191](https://www.github.com/googleapis/nodejs-promisify/issues/191)) ([0edc724](https://www.github.com/googleapis/nodejs-promisify/commit/0edc7246c53d25d9dd220b813561bcee97250783))
|
|
34
|
+
|
|
7
35
|
## [2.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.4...v2.0.0) (2020-03-23)
|
|
8
36
|
|
|
9
37
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://cloud.google.com/terms/launch-stages)
|
|
8
8
|
[](https://www.npmjs.org/package/@google-cloud/promisify)
|
|
9
|
-
[](https://codecov.io/gh/googleapis/nodejs-promisify)
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
A simple utility for promisifying functions and classes.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
A comprehensive list of changes in each version may be found in
|
|
18
|
+
[the CHANGELOG](https://github.com/googleapis/nodejs-promisify/blob/main/CHANGELOG.md).
|
|
19
|
+
|
|
17
20
|
* [Google Cloud Common Promisify Node.js Client API Reference][client-docs]
|
|
18
21
|
|
|
19
22
|
* [github.com/googleapis/nodejs-promisify](https://github.com/googleapis/nodejs-promisify)
|
|
@@ -77,18 +80,38 @@ installed as a dependency when you install other `@google-cloud` packages.
|
|
|
77
80
|
|
|
78
81
|
## Samples
|
|
79
82
|
|
|
80
|
-
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-promisify/tree/
|
|
81
|
-
has instructions for running the samples.
|
|
83
|
+
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-promisify/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample.
|
|
82
84
|
|
|
83
85
|
| Sample | Source Code | Try it |
|
|
84
86
|
| --------------------------- | --------------------------------- | ------ |
|
|
85
|
-
| Quickstart | [source code](https://github.com/googleapis/nodejs-promisify/blob/
|
|
87
|
+
| Quickstart | [source code](https://github.com/googleapis/nodejs-promisify/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-promisify&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
|
|
86
88
|
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
The [Google Cloud Common Promisify Node.js Client API Reference][client-docs] documentation
|
|
90
92
|
also contains samples.
|
|
91
93
|
|
|
94
|
+
## Supported Node.js Versions
|
|
95
|
+
|
|
96
|
+
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
|
|
97
|
+
Libraries are compatible with all current _active_ and _maintenance_ versions of
|
|
98
|
+
Node.js.
|
|
99
|
+
|
|
100
|
+
Client libraries targeting some end-of-life versions of Node.js are available, and
|
|
101
|
+
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
|
|
102
|
+
The dist-tags follow the naming convention `legacy-(version)`.
|
|
103
|
+
|
|
104
|
+
_Legacy Node.js versions are supported as a best effort:_
|
|
105
|
+
|
|
106
|
+
* Legacy versions will not be tested in continuous integration.
|
|
107
|
+
* Some security patches may not be able to be backported.
|
|
108
|
+
* Dependencies will not be kept up-to-date, and features will not be backported.
|
|
109
|
+
|
|
110
|
+
#### Legacy tags available
|
|
111
|
+
|
|
112
|
+
* `legacy-8`: install client libraries from this dist-tag for versions
|
|
113
|
+
compatible with Node.js 8.
|
|
114
|
+
|
|
92
115
|
## Versioning
|
|
93
116
|
|
|
94
117
|
This library follows [Semantic Versioning](http://semver.org/).
|
|
@@ -110,19 +133,19 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages]
|
|
|
110
133
|
|
|
111
134
|
## Contributing
|
|
112
135
|
|
|
113
|
-
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-promisify/blob/
|
|
136
|
+
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-promisify/blob/main/CONTRIBUTING.md).
|
|
114
137
|
|
|
115
138
|
Please note that this `README.md`, the `samples/README.md`,
|
|
116
139
|
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
|
|
117
140
|
are generated from a central template. To edit one of these files, make an edit
|
|
118
|
-
to its
|
|
119
|
-
[directory](https://github.com/googleapis/synthtool
|
|
141
|
+
to its templates in
|
|
142
|
+
[directory](https://github.com/googleapis/synthtool).
|
|
120
143
|
|
|
121
144
|
## License
|
|
122
145
|
|
|
123
146
|
Apache Version 2.0
|
|
124
147
|
|
|
125
|
-
See [LICENSE](https://github.com/googleapis/nodejs-promisify/blob/
|
|
148
|
+
See [LICENSE](https://github.com/googleapis/nodejs-promisify/blob/main/LICENSE)
|
|
126
149
|
|
|
127
150
|
[client-docs]: https://googleapis.dev/nodejs/promisify/latest
|
|
128
151
|
|
package/build/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable prefer-rest-params */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.callbackifyAll = exports.callbackify = exports.promisifyAll = exports.promisify = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* Wraps a callback style function to conditionally return a promise.
|
|
6
7
|
*
|
|
@@ -73,9 +74,10 @@ function promisifyAll(Class, options) {
|
|
|
73
74
|
const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
|
|
74
75
|
const methods = ownPropertyNames.filter(methodName => {
|
|
75
76
|
// clang-format off
|
|
76
|
-
return (
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
return (!exclude.includes(methodName) &&
|
|
78
|
+
typeof Class.prototype[methodName] === 'function' && // is it a function?
|
|
79
|
+
!/(^_|(Stream|_)|promise$)|^constructor$/.test(methodName) // is it promisable?
|
|
80
|
+
);
|
|
79
81
|
// clang-format on
|
|
80
82
|
});
|
|
81
83
|
methods.forEach(methodName => {
|
|
@@ -129,9 +131,10 @@ Class, options) {
|
|
|
129
131
|
const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
|
|
130
132
|
const methods = ownPropertyNames.filter(methodName => {
|
|
131
133
|
// clang-format off
|
|
132
|
-
return (
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
return (!exclude.includes(methodName) &&
|
|
135
|
+
typeof Class.prototype[methodName] === 'function' && // is it a function?
|
|
136
|
+
!/^_|(Stream|_)|^constructor$/.test(methodName) // is it callbackifyable?
|
|
137
|
+
);
|
|
135
138
|
// clang-format on
|
|
136
139
|
});
|
|
137
140
|
methods.forEach(methodName => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-cloud/promisify",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "A simple utility for promisifying functions and classes.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"system-test": "mocha build/system-test",
|
|
19
19
|
"docs-test": "linkinator docs",
|
|
20
20
|
"predocs-test": "npm run docs",
|
|
21
|
-
"prelint": "cd samples; npm link ../; npm
|
|
21
|
+
"prelint": "cd samples; npm link ../; npm install",
|
|
22
|
+
"clean": "gts clean",
|
|
23
|
+
"precompile": "gts clean"
|
|
22
24
|
},
|
|
23
25
|
"keywords": [],
|
|
24
26
|
"files": [
|
|
@@ -29,17 +31,17 @@
|
|
|
29
31
|
"license": "Apache-2.0",
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@compodoc/compodoc": "^1.1.9",
|
|
32
|
-
"@types/mocha": "^
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"@types/sinon": "^
|
|
34
|
+
"@types/mocha": "^8.0.0",
|
|
35
|
+
"@types/node": "^14.0.0",
|
|
36
|
+
"@types/sinon": "^10.0.0",
|
|
35
37
|
"c8": "^7.0.0",
|
|
36
38
|
"chai": "^4.2.0",
|
|
37
39
|
"codecov": "^3.0.4",
|
|
38
|
-
"gts": "^2.0.0
|
|
40
|
+
"gts": "^2.0.0",
|
|
39
41
|
"hard-rejection": "^2.1.0",
|
|
40
42
|
"linkinator": "^2.0.0",
|
|
41
|
-
"mocha": "^
|
|
42
|
-
"sinon": "^
|
|
43
|
+
"mocha": "^8.0.0",
|
|
44
|
+
"sinon": "^11.0.0",
|
|
43
45
|
"typescript": "^3.8.3"
|
|
44
46
|
},
|
|
45
47
|
"engines": {
|