@discue/mongodb-resource-client
Advanced tools
Comparing version 0.24.0 to 0.25.0
@@ -87,2 +87,3 @@ const { createTracer } = require('@discue/open-telemetry-tracing') | ||
eventEmitter.on(`${this._usageEventPrefix}.delete`, (event) => this._eventHandler('delete', event)) | ||
eventEmitter.on(`${this._usageEventPrefix}.close`, () => this.close()) | ||
} | ||
@@ -89,0 +90,0 @@ |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
export = exports; | ||
@@ -14,2 +15,3 @@ declare class exports { | ||
_collectionName: string; | ||
_eventEmitter: import("events"); | ||
_emitUsageEventEnabled: boolean; | ||
@@ -16,0 +18,0 @@ _emiteUsageEvent: ({ context, resourceIds, before, after }: { |
@@ -88,2 +88,3 @@ const { MongoClient, Timestamp } = require('mongodb') | ||
this._eventEmitter = eventEmitter | ||
this._emitUsageEventEnabled = eventEmitter != null | ||
@@ -526,5 +527,8 @@ this._emiteUsageEvent = eventTrigger(this.usageEventPrefix, collectionName, eventEmitter) | ||
*/ | ||
close() { | ||
async close() { | ||
if (this._emitUsageEventEnabled) { | ||
await this._emiteUsageEvent({ context: 'close' }) | ||
} | ||
return this._mongoDbClient.close() | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.24.0", | ||
"version": "0.25.0", | ||
"description": "Simple wrapper around mongodb client allowing easier managing of resources", | ||
@@ -8,0 +8,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107820
2656