Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

diagnostic-channel-publishers

Package Overview
Dependencies
Maintainers
8
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diagnostic-channel-publishers - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

dist/src/pg.pub.d.ts

@@ -25,3 +25,3 @@ import { IModulePatcher } from "diagnostic-channel";

export declare const postgres6: IModulePatcher;
export declare const postgres7: IModulePatcher;
export declare const postgres: IModulePatcher;
export declare function enable(): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.enable = exports.postgres7 = exports.postgres6 = void 0;
exports.enable = exports.postgres = exports.postgres6 = void 0;
// Copyright (c) Microsoft Corporation. All rights reserved.

@@ -130,3 +130,3 @@ // Licensed under the MIT license. See LICENSE file in the project root for details.

}
function postgres7PatchFunction(originalPg, originalPgPath) {
function postgresLatestPatchFunction(originalPg, originalPgPath) {
var originalClientQuery = originalPg.Client.prototype.query;

@@ -138,2 +138,3 @@ var diagnosticOriginalFunc = "__diagnosticOriginalFunc";

var _this = this;
var _a, _b;
var callbackProvided = !!callback; // Starting in pg@7.x+, Promise is returned only if !callbackProvided

@@ -151,4 +152,4 @@ var data = {

};
var queryResult;
var start = process.hrtime();
var queryResult;
function patchCallback(cb) {

@@ -220,2 +221,5 @@ if (cb && cb[diagnosticOriginalFunc]) {

}
else if (config.cursor) {
data.query.text = (_a = config.cursor) === null || _a === void 0 ? void 0 : _a.text;
}
else {

@@ -246,20 +250,41 @@ data.query.text = config.text;

arguments.length = (arguments.length > 3) ? arguments.length : 3;
queryResult = originalClientQuery.apply(this, arguments);
try {
queryResult = originalClientQuery.apply(this, arguments);
}
catch (err) {
patchCallback()(err, undefined);
throw err;
}
if (!callbackProvided) {
// no callback, so create a pass along promise
return queryResult
// pass resolved promise after publishing the event
.then(function (result) {
patchCallback()(undefined, result);
return new _this._Promise(function (resolve, reject) {
resolve(result);
if ((queryResult instanceof Promise)) {
return queryResult
// pass resolved promise after publishing the event
.then(function (result) {
patchCallback()(undefined, result);
return new _this._Promise(function (resolve, reject) {
resolve(result);
});
})
// pass along rejected promise after publishing the error
.catch(function (error) {
patchCallback()(error, undefined);
return new _this._Promise(function (resolve, reject) {
reject(error);
});
});
})
// pass along rejected promise after publishing the error
.catch(function (error) {
patchCallback()(error, undefined);
return new _this._Promise(function (resolve, reject) {
reject(error);
});
});
}
// Result could be a Cursor, QueryStream or Readable Stream
else {
var command = queryResult.text ? queryResult.text : "";
if (queryResult.cursor) {
command = (_b = queryResult.cursor) === null || _b === void 0 ? void 0 : _b.text;
}
if (command) {
var res = {
command: command,
rowCount: 0,
};
patchCallback()(undefined, res);
}
}
}

@@ -274,5 +299,5 @@ return queryResult;

};
exports.postgres7 = {
exports.postgres = {
versionSpecifier: ">=7.* <=8.*",
patch: postgres7PatchFunction,
patch: postgresLatestPatchFunction,
publisherName: publisherName

@@ -282,5 +307,5 @@ };

diagnostic_channel_1.channel.registerMonkeyPatch("pg", exports.postgres6);
diagnostic_channel_1.channel.registerMonkeyPatch("pg", exports.postgres7);
diagnostic_channel_1.channel.registerMonkeyPatch("pg", exports.postgres);
}
exports.enable = enable;
//# sourceMappingURL=pg.pub.js.map
{
"name": "diagnostic-channel-publishers",
"version": "1.0.5",
"version": "1.0.6",
"main": "dist/src/index.js",

@@ -8,3 +8,3 @@ "types": "dist/src/index.d.ts",

"build": "tsc && node copyTestAssets.js",
"lint": "tslint -c tslint.json -p tsconfig.json",
"lint": "eslint ./ --fix",
"clean": "rimraf ./dist",

@@ -42,3 +42,2 @@ "test": "mocha ./dist/tests/{*.js,**/*.js}",

"tedious": "^8.0.1",
"tslint": "^5.0.0",
"typescript": "4.1.2",

@@ -45,0 +44,0 @@ "winston": "^3.2.1",

@@ -15,1 +15,29 @@ # Diagnostic Channel Publishers

## Contributing
This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Data Collection
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft’s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
## License
[MIT](LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc