@common-stack/server-stack 8.6.1-alpha.28 → 8.6.1-alpha.29
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';var mongoose=require('mongoose'),_=require('lodash-es'),mongooseExecutionTime=require('mongoose-execution-time'),server=require('@cdm-logger/server'),envConfig=require('../config/env-config.cjs');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespaceDefault(_);class MongoConnector {
|
|
2
2
|
client;
|
|
3
|
-
db;
|
|
4
3
|
opts;
|
|
5
4
|
uri;
|
|
6
5
|
logger;
|
|
@@ -21,17 +20,6 @@
|
|
|
21
20
|
const conn = mongoose.createConnection(this.uri, this.opts).asPromise();
|
|
22
21
|
conn.then((result) => {
|
|
23
22
|
this.client = result;
|
|
24
|
-
this.db = result.db;
|
|
25
|
-
// Mongoose 7 removed the native-like .collection() from Connection.
|
|
26
|
-
// Proxy it to connection.db.collection() so callers can use
|
|
27
|
-
// `this.db.collection(name)` instead of `this.db.db.collection(name)`.
|
|
28
|
-
const originalCollection = result.collection.bind(result);
|
|
29
|
-
result.collection = (name, ...args) => {
|
|
30
|
-
if (result.db) {
|
|
31
|
-
return result.db.collection(name, ...args);
|
|
32
|
-
}
|
|
33
|
-
return originalCollection(name);
|
|
34
|
-
};
|
|
35
23
|
this.logger.info(' MongoDB has connected successfully.');
|
|
36
24
|
result.on('disconnected', () => this.logger.warn('Mongoose has disconnected.'));
|
|
37
25
|
result.on('error', (err) => this.logger.error(err, 'MongoDB error.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-connector.cjs","sources":["../../src/connectors/mongo-connector.ts"],"sourcesContent":[null],"names":["_","logger","createConnection","config","plugin","logExecutionTime","LoggerVerbosity"],"mappings":"+
|
|
1
|
+
{"version":3,"file":"mongo-connector.cjs","sources":["../../src/connectors/mongo-connector.ts"],"sourcesContent":[null],"names":["_","logger","createConnection","config","plugin","logExecutionTime","LoggerVerbosity"],"mappings":"+iBASa,cAAc,CAAA;AACf,IAAA,MAAM,CAAa;AAEnB,IAAA,IAAI,CAAiB;AAErB,IAAA,GAAG,CAAS;AAEZ,IAAA,MAAM,CAAU;IAExB,WAAY,CAAA,GAAW,EAAE,IAAqB,EAAA;QAC1C,IAAI,CAAC,IAAI,GAAGA,YAAC,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACrC,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACf,QAAA,IAAI,CAAC,MAAM,GAAGC,aAAM,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;KAC/D;AAED;;;;AAIG;AACI,IAAA,MAAM,OAAO,GAAA;AAChB,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;AACD,QAAA,MAAM,IAAI,GAAGC,yBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAE/D,QAAA,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;AACjB,YAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;AACzD,YAAA,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC;YAChF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACtE,YAAA,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC;AAChF,SAAC,CAAC,CAAC;AAEH,QAAA,IACIC,gBAAM,CAAC,QAAQ,KAAK,aAAa;;YAEjCA,gBAAM,CAAC,SAAS,KAAK,OAAO;AAC5B,YAAAA,gBAAM,CAAC,SAAS,KAAK,OAAO,EAC9B;YACEC,eAAM,CAACC,sCAAgB,EAAE;gBACrB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,eAAe,EAAEC,qCAAe,CAAC,IAAI;gBACrC,WAAW,EAAEH,gBAAM,CAAC,SAAS;AAChC,aAAA,CAAC,CAAC;SACN;;;;;AAMD,QAAA,OAAO,IAAI,CAAC;KACf;AAED;;;;AAIG;AACI,IAAA,MAAM,UAAU,GAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,OAAO;SACV;AACD,QAAA,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAC7B;AACJ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {createConnection,plugin}from'mongoose';import*as _ from'lodash-es';import {logExecutionTime,LoggerVerbosity}from'mongoose-execution-time';import {logger}from'@cdm-logger/server';import {config}from'../config/env-config.mjs';class MongoConnector {
|
|
2
2
|
client;
|
|
3
|
-
db;
|
|
4
3
|
opts;
|
|
5
4
|
uri;
|
|
6
5
|
logger;
|
|
@@ -21,17 +20,6 @@ import {createConnection,plugin}from'mongoose';import*as _ from'lodash-es';impor
|
|
|
21
20
|
const conn = createConnection(this.uri, this.opts).asPromise();
|
|
22
21
|
conn.then((result) => {
|
|
23
22
|
this.client = result;
|
|
24
|
-
this.db = result.db;
|
|
25
|
-
// Mongoose 7 removed the native-like .collection() from Connection.
|
|
26
|
-
// Proxy it to connection.db.collection() so callers can use
|
|
27
|
-
// `this.db.collection(name)` instead of `this.db.db.collection(name)`.
|
|
28
|
-
const originalCollection = result.collection.bind(result);
|
|
29
|
-
result.collection = (name, ...args) => {
|
|
30
|
-
if (result.db) {
|
|
31
|
-
return result.db.collection(name, ...args);
|
|
32
|
-
}
|
|
33
|
-
return originalCollection(name);
|
|
34
|
-
};
|
|
35
23
|
this.logger.info(' MongoDB has connected successfully.');
|
|
36
24
|
result.on('disconnected', () => this.logger.warn('Mongoose has disconnected.'));
|
|
37
25
|
result.on('error', (err) => this.logger.error(err, 'MongoDB error.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-connector.mjs","sources":["../../src/connectors/mongo-connector.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mongo-connector.mjs","sources":["../../src/connectors/mongo-connector.ts"],"sourcesContent":[null],"names":[],"mappings":"8OASa,cAAc,CAAA;AACf,IAAA,MAAM,CAAa;AAEnB,IAAA,IAAI,CAAiB;AAErB,IAAA,GAAG,CAAS;AAEZ,IAAA,MAAM,CAAU;IAExB,WAAY,CAAA,GAAW,EAAE,IAAqB,EAAA;QAC1C,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACrC,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACf,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;KAC/D;AAED;;;;AAIG;AACI,IAAA,MAAM,OAAO,GAAA;AAChB,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,OAAO,IAAI,CAAC,MAAM,CAAC;SACtB;AACD,QAAA,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAE/D,QAAA,IAAI,CAAC,IA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"common core for higher packages to depend on",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@cdm-logger/server": "^9.0.17",
|
|
34
34
|
"@cdmbase/graphql-type-uri": "^4.0.0",
|
|
35
35
|
"@common-stack/codegen-zod": "8.6.1-alpha.28",
|
|
36
|
-
"@common-stack/graphql-api": "8.6.1-alpha.
|
|
36
|
+
"@common-stack/graphql-api": "8.6.1-alpha.29",
|
|
37
37
|
"@common-stack/store-redis": "8.6.1-alpha.28",
|
|
38
38
|
"@graphql-tools/links": "^9.0.1",
|
|
39
39
|
"@graphql-tools/schema": "^10.0.6",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "6c683604a3f68effb15d11d192692eb111f1b442",
|
|
100
100
|
"typescript": {
|
|
101
101
|
"definition": "lib/index.d.ts"
|
|
102
102
|
}
|