@ebarahona/loopback-connector-mongodb 1.0.0
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/LICENSE +21 -0
- package/README.md +526 -0
- package/dist/connector/coercion.d.ts +30 -0
- package/dist/connector/coercion.js +75 -0
- package/dist/connector/coercion.js.map +1 -0
- package/dist/connector/errors.d.ts +13 -0
- package/dist/connector/errors.js +20 -0
- package/dist/connector/errors.js.map +1 -0
- package/dist/connector/index.d.ts +6 -0
- package/dist/connector/index.js +24 -0
- package/dist/connector/index.js.map +1 -0
- package/dist/connector/mongo.connector.d.ts +171 -0
- package/dist/connector/mongo.connector.js +567 -0
- package/dist/connector/mongo.connector.js.map +1 -0
- package/dist/connector/property-mapping.d.ts +64 -0
- package/dist/connector/property-mapping.js +105 -0
- package/dist/connector/property-mapping.js.map +1 -0
- package/dist/connector/query-builder.d.ts +42 -0
- package/dist/connector/query-builder.js +204 -0
- package/dist/connector/query-builder.js.map +1 -0
- package/dist/datasource/index.d.ts +3 -0
- package/dist/datasource/index.js +10 -0
- package/dist/datasource/index.js.map +1 -0
- package/dist/datasource/mongo.datasource.d.ts +17 -0
- package/dist/datasource/mongo.datasource.factory.d.ts +30 -0
- package/dist/datasource/mongo.datasource.factory.js +44 -0
- package/dist/datasource/mongo.datasource.factory.js.map +1 -0
- package/dist/datasource/mongo.datasource.js +40 -0
- package/dist/datasource/mongo.datasource.js.map +1 -0
- package/dist/datasource/mongo.datasource.provider.d.ts +17 -0
- package/dist/datasource/mongo.datasource.provider.js +42 -0
- package/dist/datasource/mongo.datasource.provider.js.map +1 -0
- package/dist/helpers/config-validator.d.ts +34 -0
- package/dist/helpers/config-validator.js +79 -0
- package/dist/helpers/config-validator.js.map +1 -0
- package/dist/helpers/connection-manager.d.ts +78 -0
- package/dist/helpers/connection-manager.js +212 -0
- package/dist/helpers/connection-manager.js.map +1 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +15 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/topology.d.ts +23 -0
- package/dist/helpers/topology.js +27 -0
- package/dist/helpers/topology.js.map +1 -0
- package/dist/helpers/url-builder.d.ts +7 -0
- package/dist/helpers/url-builder.js +30 -0
- package/dist/helpers/url-builder.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +38 -0
- package/dist/keys.js +38 -0
- package/dist/keys.js.map +1 -0
- package/dist/mongo.component.d.ts +59 -0
- package/dist/mongo.component.js +138 -0
- package/dist/mongo.component.js.map +1 -0
- package/dist/providers/index.d.ts +0 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +7 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/mongo.service.d.ts +61 -0
- package/dist/services/mongo.service.impl.d.ts +58 -0
- package/dist/services/mongo.service.impl.js +211 -0
- package/dist/services/mongo.service.impl.js.map +1 -0
- package/dist/services/mongo.service.js +3 -0
- package/dist/services/mongo.service.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Binding, Component, Constructor, LifeCycleObserver } from '@loopback/core';
|
|
2
|
+
import { MongoConnectionManager } from './helpers/connection-manager';
|
|
3
|
+
import type { MongoService } from './services/mongo.service';
|
|
4
|
+
/**
|
|
5
|
+
* Lifecycle observer that connects and disconnects the shared
|
|
6
|
+
* MongoConnectionManager.
|
|
7
|
+
*
|
|
8
|
+
* On stop, also closes any change streams opened through the
|
|
9
|
+
* `MongoService` (if bound) before disconnecting the client, to
|
|
10
|
+
* prevent server-side cursor leaks on app shutdown.
|
|
11
|
+
*
|
|
12
|
+
* Idempotent: repeated start/stop cycles are safe.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare class MongoLifecycleObserver implements LifeCycleObserver {
|
|
17
|
+
private manager;
|
|
18
|
+
private service?;
|
|
19
|
+
constructor(manager: MongoConnectionManager, service?: MongoService | undefined);
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
stop(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* LoopBack 4 component that provides MongoDB connectivity.
|
|
25
|
+
*
|
|
26
|
+
* Registers:
|
|
27
|
+
* - MongoBindings.CONNECTION_MANAGER -- shared MongoConnectionManager
|
|
28
|
+
* singleton; owns the MongoClient and its lifecycle.
|
|
29
|
+
* - MongoBindings.SERVICE -- MongoService singleton for advanced
|
|
30
|
+
* native operations (aggregation, Change Streams, GridFS, ...).
|
|
31
|
+
* - MongoBindings.DATASOURCE -- juggler DataSource singleton wired
|
|
32
|
+
* to the shared manager, for repository-based code paths.
|
|
33
|
+
* - MongoBindings.DATASOURCE_FACTORY -- factory for per-tenant
|
|
34
|
+
* or per-database DataSource instances on the shared pool.
|
|
35
|
+
* - MongoLifecycleObserver -- connects on start, disconnects on stop.
|
|
36
|
+
*
|
|
37
|
+
* The juggler DataSource, the repositories built on it, and the
|
|
38
|
+
* MongoService all share one MongoConnectionManager, guaranteeing
|
|
39
|
+
* one connection pool, one lifecycle, and one topology state.
|
|
40
|
+
*
|
|
41
|
+
* Usage:
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const app = new Application();
|
|
44
|
+
* app.bind(MongoBindings.CONFIG).to({
|
|
45
|
+
* url: 'mongodb://localhost:27017',
|
|
46
|
+
* database: 'mydb',
|
|
47
|
+
* });
|
|
48
|
+
* app.component(MongoComponent);
|
|
49
|
+
*
|
|
50
|
+
* const ds = await app.get(MongoBindings.DATASOURCE);
|
|
51
|
+
* const service = await app.get(MongoBindings.SERVICE);
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export declare class MongoComponent implements Component {
|
|
57
|
+
readonly bindings: Binding<unknown>[];
|
|
58
|
+
readonly lifeCycleObservers: Constructor<LifeCycleObserver>[];
|
|
59
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MongoComponent = exports.MongoLifecycleObserver = void 0;
|
|
19
|
+
const core_1 = require("@loopback/core");
|
|
20
|
+
const debug_1 = __importDefault(require("debug"));
|
|
21
|
+
const keys_1 = require("./keys");
|
|
22
|
+
const connection_manager_1 = require("./helpers/connection-manager");
|
|
23
|
+
const mongo_datasource_provider_1 = require("./datasource/mongo.datasource.provider");
|
|
24
|
+
const mongo_datasource_factory_1 = require("./datasource/mongo.datasource.factory");
|
|
25
|
+
const mongo_service_impl_1 = require("./services/mongo.service.impl");
|
|
26
|
+
const debug = (0, debug_1.default)('loopback:connector:mongodb:lifecycle');
|
|
27
|
+
/**
|
|
28
|
+
* Provider that creates a singleton MongoConnectionManager.
|
|
29
|
+
*/
|
|
30
|
+
let ConnectionManagerProvider = class ConnectionManagerProvider {
|
|
31
|
+
constructor(config) {
|
|
32
|
+
this.config = config;
|
|
33
|
+
}
|
|
34
|
+
value() {
|
|
35
|
+
return new connection_manager_1.MongoConnectionManager(this.config ?? {});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
ConnectionManagerProvider = __decorate([
|
|
39
|
+
__param(0, (0, core_1.inject)(keys_1.MongoBindings.CONFIG, { optional: true })),
|
|
40
|
+
__metadata("design:paramtypes", [Object])
|
|
41
|
+
], ConnectionManagerProvider);
|
|
42
|
+
/**
|
|
43
|
+
* Lifecycle observer that connects and disconnects the shared
|
|
44
|
+
* MongoConnectionManager.
|
|
45
|
+
*
|
|
46
|
+
* On stop, also closes any change streams opened through the
|
|
47
|
+
* `MongoService` (if bound) before disconnecting the client, to
|
|
48
|
+
* prevent server-side cursor leaks on app shutdown.
|
|
49
|
+
*
|
|
50
|
+
* Idempotent: repeated start/stop cycles are safe.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
let MongoLifecycleObserver = class MongoLifecycleObserver {
|
|
55
|
+
constructor(manager, service) {
|
|
56
|
+
this.manager = manager;
|
|
57
|
+
this.service = service;
|
|
58
|
+
}
|
|
59
|
+
async start() {
|
|
60
|
+
await this.manager.connect();
|
|
61
|
+
debug('MongoClient connected');
|
|
62
|
+
}
|
|
63
|
+
async stop() {
|
|
64
|
+
if (this.service) {
|
|
65
|
+
try {
|
|
66
|
+
await this.service.closeAll();
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
debug('closeAll failed during shutdown: %O', err);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
await this.manager.disconnect();
|
|
73
|
+
debug('MongoClient disconnected');
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.MongoLifecycleObserver = MongoLifecycleObserver;
|
|
77
|
+
exports.MongoLifecycleObserver = MongoLifecycleObserver = __decorate([
|
|
78
|
+
(0, core_1.lifeCycleObserver)('mongodb'),
|
|
79
|
+
__param(0, (0, core_1.inject)(keys_1.MongoBindings.CONNECTION_MANAGER)),
|
|
80
|
+
__param(1, (0, core_1.inject)(keys_1.MongoBindings.SERVICE, { optional: true })),
|
|
81
|
+
__metadata("design:paramtypes", [connection_manager_1.MongoConnectionManager, Object])
|
|
82
|
+
], MongoLifecycleObserver);
|
|
83
|
+
/**
|
|
84
|
+
* LoopBack 4 component that provides MongoDB connectivity.
|
|
85
|
+
*
|
|
86
|
+
* Registers:
|
|
87
|
+
* - MongoBindings.CONNECTION_MANAGER -- shared MongoConnectionManager
|
|
88
|
+
* singleton; owns the MongoClient and its lifecycle.
|
|
89
|
+
* - MongoBindings.SERVICE -- MongoService singleton for advanced
|
|
90
|
+
* native operations (aggregation, Change Streams, GridFS, ...).
|
|
91
|
+
* - MongoBindings.DATASOURCE -- juggler DataSource singleton wired
|
|
92
|
+
* to the shared manager, for repository-based code paths.
|
|
93
|
+
* - MongoBindings.DATASOURCE_FACTORY -- factory for per-tenant
|
|
94
|
+
* or per-database DataSource instances on the shared pool.
|
|
95
|
+
* - MongoLifecycleObserver -- connects on start, disconnects on stop.
|
|
96
|
+
*
|
|
97
|
+
* The juggler DataSource, the repositories built on it, and the
|
|
98
|
+
* MongoService all share one MongoConnectionManager, guaranteeing
|
|
99
|
+
* one connection pool, one lifecycle, and one topology state.
|
|
100
|
+
*
|
|
101
|
+
* Usage:
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const app = new Application();
|
|
104
|
+
* app.bind(MongoBindings.CONFIG).to({
|
|
105
|
+
* url: 'mongodb://localhost:27017',
|
|
106
|
+
* database: 'mydb',
|
|
107
|
+
* });
|
|
108
|
+
* app.component(MongoComponent);
|
|
109
|
+
*
|
|
110
|
+
* const ds = await app.get(MongoBindings.DATASOURCE);
|
|
111
|
+
* const service = await app.get(MongoBindings.SERVICE);
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
class MongoComponent {
|
|
117
|
+
constructor() {
|
|
118
|
+
this.bindings = [
|
|
119
|
+
core_1.Binding.bind(keys_1.MongoBindings.CONNECTION_MANAGER)
|
|
120
|
+
.toProvider(ConnectionManagerProvider)
|
|
121
|
+
.inScope(core_1.BindingScope.SINGLETON),
|
|
122
|
+
core_1.Binding.bind(keys_1.MongoBindings.SERVICE)
|
|
123
|
+
.toClass(mongo_service_impl_1.MongoServiceImpl)
|
|
124
|
+
.inScope(core_1.BindingScope.SINGLETON),
|
|
125
|
+
core_1.Binding.bind(keys_1.MongoBindings.DATASOURCE)
|
|
126
|
+
.toProvider(mongo_datasource_provider_1.MongoDataSourceProvider)
|
|
127
|
+
.inScope(core_1.BindingScope.SINGLETON),
|
|
128
|
+
core_1.Binding.bind(keys_1.MongoBindings.DATASOURCE_FACTORY)
|
|
129
|
+
.toProvider(mongo_datasource_factory_1.MongoDataSourceFactoryProvider)
|
|
130
|
+
.inScope(core_1.BindingScope.SINGLETON),
|
|
131
|
+
];
|
|
132
|
+
this.lifeCycleObservers = [
|
|
133
|
+
MongoLifecycleObserver,
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.MongoComponent = MongoComponent;
|
|
138
|
+
//# sourceMappingURL=mongo.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo.component.js","sourceRoot":"","sources":["../src/mongo.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAQwB;AACxB,kDAAiC;AACjC,iCAAqC;AACrC,qEAAoE;AACpE,sFAA+E;AAC/E,oFAAqF;AACrF,sEAA+D;AAI/D,MAAM,KAAK,GAAG,IAAA,eAAY,EAAC,sCAAsC,CAAC,CAAC;AAEnE;;GAEG;AACH,IAAM,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AAC,CAAC,CAAA;qCAD/B,2CAAsB;GAH9B,sBAAsB,CAwBlC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAa,cAAc;IAA3B;QACW,aAAQ,GAAuB;YACtC,cAAO,CAAC,IAAI,CAAC,oBAAa,CAAC,kBAAkB,CAAC;iBAC3C,UAAU,CAAC,yBAAyB,CAAC;iBACrC,OAAO,CAAC,mBAAY,CAAC,SAAS,CAAC;YAClC,cAAO,CAAC,IAAI,CAAC,oBAAa,CAAC,OAAO,CAAC;iBAChC,OAAO,CAAC,qCAAgB,CAAC;iBACzB,OAAO,CAAC,mBAAY,CAAC,SAAS,CAAC;YAClC,cAAO,CAAC,IAAI,CAAC,oBAAa,CAAC,UAAU,CAAC;iBACnC,UAAU,CAAC,mDAAuB,CAAC;iBACnC,OAAO,CAAC,mBAAY,CAAC,SAAS,CAAC;YAClC,cAAO,CAAC,IAAI,CAAC,oBAAa,CAAC,kBAAkB,CAAC;iBAC3C,UAAU,CAAC,yDAA8B,CAAC;iBAC1C,OAAO,CAAC,mBAAY,CAAC,SAAS,CAAC;SACnC,CAAC;QAEO,uBAAkB,GAAqC;YAC9D,sBAAsB;SACvB,CAAC;IACJ,CAAC;CAAA;AAnBD,wCAmBC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,sEAAsE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MongoTopologyError = exports.MongoServiceImpl = void 0;
|
|
4
|
+
var mongo_service_impl_1 = require("./mongo.service.impl");
|
|
5
|
+
Object.defineProperty(exports, "MongoServiceImpl", { enumerable: true, get: function () { return mongo_service_impl_1.MongoServiceImpl; } });
|
|
6
|
+
Object.defineProperty(exports, "MongoTopologyError", { enumerable: true, get: function () { return mongo_service_impl_1.MongoTopologyError; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AACA,2DAA0E;AAAlE,sHAAA,gBAAgB,OAAA;AAAE,wHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { MongoClient, Db, Collection, Document, AggregateOptions, AggregationCursor, ChangeStream, ChangeStreamOptions, ChangeStreamDocument, CreateCollectionOptions, TimeSeriesCollectionOptions, GridFSBucket, GridFSBucketOptions, ClientSession, TransactionOptions, AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult, IndexSpecification, CreateIndexesOptions, IndexDescription, ListDatabasesResult, FindOptions, Filter, FindCursor, Admin } from 'mongodb';
|
|
2
|
+
/**
|
|
3
|
+
* Injectable service providing full native MongoDB driver access.
|
|
4
|
+
*
|
|
5
|
+
* Covers operations beyond CRUD that the connector/repository
|
|
6
|
+
* pattern does not support:
|
|
7
|
+
* - Aggregation pipelines
|
|
8
|
+
* - Change Streams (collection, database, client level)
|
|
9
|
+
* - Time Series collection creation with $jsonSchema
|
|
10
|
+
* - GridFS file storage
|
|
11
|
+
* - Transactions and sessions
|
|
12
|
+
* - Bulk operations
|
|
13
|
+
* - Tailable cursors
|
|
14
|
+
* - Index management
|
|
15
|
+
* - Admin commands
|
|
16
|
+
*
|
|
17
|
+
* Uses the same MongoClient singleton as the connector.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface MongoService {
|
|
22
|
+
getClient(): MongoClient;
|
|
23
|
+
getDb(name?: string): Db;
|
|
24
|
+
getCollection<T extends Document>(name: string, db?: string): Collection<T>;
|
|
25
|
+
aggregate<T extends Document>(collection: string, pipeline: Document[], options?: AggregateOptions & {
|
|
26
|
+
db?: string;
|
|
27
|
+
}): Promise<T[]>;
|
|
28
|
+
aggregateCursor<T extends Document>(collection: string, pipeline: Document[], options?: AggregateOptions & {
|
|
29
|
+
db?: string;
|
|
30
|
+
}): AggregationCursor<T>;
|
|
31
|
+
watchCollection<T extends Document>(collection: string, pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream<T, ChangeStreamDocument<T>>;
|
|
32
|
+
watchDatabase(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream;
|
|
33
|
+
watchClient(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream;
|
|
34
|
+
createTimeSeriesCollection(name: string, timeseriesOptions: TimeSeriesCollectionOptions, validatorSchema?: Document, options?: Omit<CreateCollectionOptions, 'timeseries' | 'validator'>): Promise<Collection>;
|
|
35
|
+
getGridFSBucket(bucketName?: string, options?: GridFSBucketOptions): GridFSBucket;
|
|
36
|
+
bulkWrite<T extends Document>(collection: string, operations: AnyBulkWriteOperation<T>[], options?: BulkWriteOptions & {
|
|
37
|
+
db?: string;
|
|
38
|
+
}): Promise<BulkWriteResult>;
|
|
39
|
+
withSession<T>(fn: (session: ClientSession) => Promise<T>): Promise<T>;
|
|
40
|
+
withTransaction<T>(fn: (session: ClientSession) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
41
|
+
tailableCursor<T extends Document>(collection: string, filter?: Filter<T>, options?: FindOptions): FindCursor<T>;
|
|
42
|
+
createIndex(collection: string, indexSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
|
|
43
|
+
createIndexes(collection: string, indexes: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]>;
|
|
44
|
+
listIndexes(collection: string): Promise<Document[]>;
|
|
45
|
+
dropIndex(collection: string, indexName: string): Promise<void>;
|
|
46
|
+
admin(): Admin;
|
|
47
|
+
listDatabases(): Promise<ListDatabasesResult>;
|
|
48
|
+
listCollections(db?: string, filter?: Document): Promise<Document[]>;
|
|
49
|
+
dbStats(db?: string): Promise<Document>;
|
|
50
|
+
command(command: Document, db?: string): Promise<Document>;
|
|
51
|
+
isReplicaSet(): boolean;
|
|
52
|
+
getTopologyType(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Close all change streams opened by this service. Idempotent.
|
|
55
|
+
* Called automatically by `MongoLifecycleObserver.stop()` to prevent
|
|
56
|
+
* server-side cursor leaks on app shutdown.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
closeAll(): Promise<void>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MongoClient, Db, Collection, Document, AggregateOptions, AggregationCursor, ChangeStream, ChangeStreamOptions, ChangeStreamDocument, CreateCollectionOptions, TimeSeriesCollectionOptions, GridFSBucket, GridFSBucketOptions, ClientSession, TransactionOptions, AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult, IndexSpecification, CreateIndexesOptions, IndexDescription, ListDatabasesResult, FindOptions, Filter, FindCursor, Admin } from 'mongodb';
|
|
2
|
+
import { MongoConnectionManager } from '../helpers/connection-manager';
|
|
3
|
+
import type { MongoService } from './mongo.service';
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when an operation requires a replica set or sharded cluster
|
|
6
|
+
* but the connected server is a standalone instance.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class MongoTopologyError extends Error {
|
|
11
|
+
readonly name = "MongoTopologyError";
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default implementation of {@link MongoService}, providing native MongoDB
|
|
16
|
+
* driver access on top of the shared {@link MongoConnectionManager}.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare class MongoServiceImpl implements MongoService {
|
|
21
|
+
private manager;
|
|
22
|
+
private readonly openStreams;
|
|
23
|
+
constructor(manager: MongoConnectionManager);
|
|
24
|
+
getClient(): MongoClient;
|
|
25
|
+
getDb(name?: string): Db;
|
|
26
|
+
getCollection<T extends Document>(name: string, db?: string): Collection<T>;
|
|
27
|
+
aggregate<T extends Document>(collection: string, pipeline: Document[], options?: AggregateOptions & {
|
|
28
|
+
db?: string;
|
|
29
|
+
}): Promise<T[]>;
|
|
30
|
+
aggregateCursor<T extends Document>(collection: string, pipeline: Document[], options?: AggregateOptions & {
|
|
31
|
+
db?: string;
|
|
32
|
+
}): AggregationCursor<T>;
|
|
33
|
+
watchCollection<T extends Document>(collection: string, pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream<T, ChangeStreamDocument<T>>;
|
|
34
|
+
watchDatabase(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream;
|
|
35
|
+
watchClient(pipeline?: Document[], options?: ChangeStreamOptions): ChangeStream;
|
|
36
|
+
private trackStream;
|
|
37
|
+
createTimeSeriesCollection(name: string, timeseriesOptions: TimeSeriesCollectionOptions, validatorSchema?: Document, options?: Omit<CreateCollectionOptions, 'timeseries' | 'validator'>): Promise<Collection>;
|
|
38
|
+
getGridFSBucket(bucketName?: string, options?: GridFSBucketOptions): GridFSBucket;
|
|
39
|
+
bulkWrite<T extends Document>(collection: string, operations: AnyBulkWriteOperation<T>[], options?: BulkWriteOptions & {
|
|
40
|
+
db?: string;
|
|
41
|
+
}): Promise<BulkWriteResult>;
|
|
42
|
+
withSession<T>(fn: (session: ClientSession) => Promise<T>): Promise<T>;
|
|
43
|
+
withTransaction<T>(fn: (session: ClientSession) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
44
|
+
tailableCursor<T extends Document>(collection: string, filter?: Filter<T>, options?: FindOptions): FindCursor<T>;
|
|
45
|
+
createIndex(collection: string, indexSpec: IndexSpecification, options?: CreateIndexesOptions): Promise<string>;
|
|
46
|
+
createIndexes(collection: string, indexes: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]>;
|
|
47
|
+
listIndexes(collection: string): Promise<Document[]>;
|
|
48
|
+
dropIndex(collection: string, indexName: string): Promise<void>;
|
|
49
|
+
admin(): Admin;
|
|
50
|
+
listDatabases(): Promise<ListDatabasesResult>;
|
|
51
|
+
listCollections(db?: string, filter?: Document): Promise<Document[]>;
|
|
52
|
+
dbStats(db?: string): Promise<Document>;
|
|
53
|
+
command(command: Document, db?: string): Promise<Document>;
|
|
54
|
+
isReplicaSet(): boolean;
|
|
55
|
+
getTopologyType(): string;
|
|
56
|
+
private assertReplicaSet;
|
|
57
|
+
closeAll(): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MongoServiceImpl = exports.MongoTopologyError = void 0;
|
|
19
|
+
const core_1 = require("@loopback/core");
|
|
20
|
+
const mongodb_1 = require("mongodb");
|
|
21
|
+
const debug_1 = __importDefault(require("debug"));
|
|
22
|
+
const keys_1 = require("../keys");
|
|
23
|
+
const connection_manager_1 = require("../helpers/connection-manager");
|
|
24
|
+
const debug = (0, debug_1.default)('loopback:connector:mongodb:service');
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when an operation requires a replica set or sharded cluster
|
|
27
|
+
* but the connected server is a standalone instance.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
class MongoTopologyError extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = 'MongoTopologyError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.MongoTopologyError = MongoTopologyError;
|
|
38
|
+
/**
|
|
39
|
+
* Default implementation of {@link MongoService}, providing native MongoDB
|
|
40
|
+
* driver access on top of the shared {@link MongoConnectionManager}.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
let MongoServiceImpl = class MongoServiceImpl {
|
|
45
|
+
constructor(manager) {
|
|
46
|
+
this.openStreams = new Set();
|
|
47
|
+
this.manager = manager;
|
|
48
|
+
}
|
|
49
|
+
// ---- Core access ----
|
|
50
|
+
getClient() {
|
|
51
|
+
return this.manager.getClient();
|
|
52
|
+
}
|
|
53
|
+
getDb(name) {
|
|
54
|
+
return this.manager.getDb(name);
|
|
55
|
+
}
|
|
56
|
+
getCollection(name, db) {
|
|
57
|
+
return this.getDb(db).collection(name);
|
|
58
|
+
}
|
|
59
|
+
// ---- Aggregation ----
|
|
60
|
+
async aggregate(collection, pipeline, options) {
|
|
61
|
+
const { db, ...driverOptions } = options ?? {};
|
|
62
|
+
debug('aggregate [%s] stages=%d', collection, pipeline.length);
|
|
63
|
+
return this.getDb(db)
|
|
64
|
+
.collection(collection)
|
|
65
|
+
.aggregate(pipeline, driverOptions)
|
|
66
|
+
.toArray();
|
|
67
|
+
}
|
|
68
|
+
aggregateCursor(collection, pipeline, options) {
|
|
69
|
+
const { db, ...driverOptions } = options ?? {};
|
|
70
|
+
return this.getDb(db)
|
|
71
|
+
.collection(collection)
|
|
72
|
+
.aggregate(pipeline, driverOptions);
|
|
73
|
+
}
|
|
74
|
+
// ---- Change Streams ----
|
|
75
|
+
watchCollection(collection, pipeline, options) {
|
|
76
|
+
this.assertReplicaSet('watchCollection');
|
|
77
|
+
debug('watchCollection [%s]', collection);
|
|
78
|
+
const stream = this.getCollection(collection).watch(pipeline, options);
|
|
79
|
+
this.trackStream(stream);
|
|
80
|
+
return stream;
|
|
81
|
+
}
|
|
82
|
+
watchDatabase(pipeline, options) {
|
|
83
|
+
this.assertReplicaSet('watchDatabase');
|
|
84
|
+
debug('watchDatabase');
|
|
85
|
+
const stream = this.getDb().watch(pipeline, options);
|
|
86
|
+
this.trackStream(stream);
|
|
87
|
+
return stream;
|
|
88
|
+
}
|
|
89
|
+
watchClient(pipeline, options) {
|
|
90
|
+
this.assertReplicaSet('watchClient');
|
|
91
|
+
debug('watchClient');
|
|
92
|
+
const stream = this.manager.getClient().watch(pipeline, options);
|
|
93
|
+
this.trackStream(stream);
|
|
94
|
+
return stream;
|
|
95
|
+
}
|
|
96
|
+
trackStream(stream) {
|
|
97
|
+
this.openStreams.add(stream);
|
|
98
|
+
const cleanup = () => {
|
|
99
|
+
this.openStreams.delete(stream);
|
|
100
|
+
};
|
|
101
|
+
stream.once('close', cleanup);
|
|
102
|
+
stream.once('end', cleanup);
|
|
103
|
+
}
|
|
104
|
+
// ---- Time Series ----
|
|
105
|
+
async createTimeSeriesCollection(name, timeseriesOptions, validatorSchema, options) {
|
|
106
|
+
debug('createTimeSeriesCollection [%s] timeField=%s', name, timeseriesOptions.timeField);
|
|
107
|
+
const createOptions = {
|
|
108
|
+
...options,
|
|
109
|
+
timeseries: timeseriesOptions,
|
|
110
|
+
};
|
|
111
|
+
if (validatorSchema) {
|
|
112
|
+
createOptions.validator = { $jsonSchema: validatorSchema };
|
|
113
|
+
}
|
|
114
|
+
return this.getDb().createCollection(name, createOptions);
|
|
115
|
+
}
|
|
116
|
+
// ---- GridFS ----
|
|
117
|
+
getGridFSBucket(bucketName, options) {
|
|
118
|
+
return new mongodb_1.GridFSBucket(this.getDb(), {
|
|
119
|
+
...options,
|
|
120
|
+
...(bucketName ? { bucketName } : {}),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// ---- Bulk operations ----
|
|
124
|
+
async bulkWrite(collection, operations, options) {
|
|
125
|
+
const { db, ...driverOptions } = options ?? {};
|
|
126
|
+
debug('bulkWrite [%s] ops=%d', collection, operations.length);
|
|
127
|
+
return this.getDb(db)
|
|
128
|
+
.collection(collection)
|
|
129
|
+
.bulkWrite(operations, driverOptions);
|
|
130
|
+
}
|
|
131
|
+
// ---- Transactions ----
|
|
132
|
+
async withSession(fn) {
|
|
133
|
+
return this.manager.getClient().withSession(fn);
|
|
134
|
+
}
|
|
135
|
+
async withTransaction(fn, options) {
|
|
136
|
+
let result;
|
|
137
|
+
await this.manager.getClient().withSession(async (session) => {
|
|
138
|
+
await session.withTransaction(async (s) => {
|
|
139
|
+
result = await fn(s);
|
|
140
|
+
}, options);
|
|
141
|
+
});
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
// ---- Tailable cursors ----
|
|
145
|
+
tailableCursor(collection, filter, options) {
|
|
146
|
+
debug('tailableCursor [%s]', collection);
|
|
147
|
+
const coll = this.getCollection(collection);
|
|
148
|
+
const emptyFilter = {};
|
|
149
|
+
return coll.find(filter ?? emptyFilter, {
|
|
150
|
+
...options,
|
|
151
|
+
tailable: true,
|
|
152
|
+
awaitData: true,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// ---- Index management ----
|
|
156
|
+
async createIndex(collection, indexSpec, options) {
|
|
157
|
+
return this.getCollection(collection).createIndex(indexSpec, options);
|
|
158
|
+
}
|
|
159
|
+
async createIndexes(collection, indexes, options) {
|
|
160
|
+
return this.getCollection(collection).createIndexes(indexes, options);
|
|
161
|
+
}
|
|
162
|
+
async listIndexes(collection) {
|
|
163
|
+
return this.getCollection(collection).listIndexes().toArray();
|
|
164
|
+
}
|
|
165
|
+
async dropIndex(collection, indexName) {
|
|
166
|
+
await this.getCollection(collection).dropIndex(indexName);
|
|
167
|
+
}
|
|
168
|
+
// ---- Admin ----
|
|
169
|
+
admin() {
|
|
170
|
+
return this.getDb().admin();
|
|
171
|
+
}
|
|
172
|
+
async listDatabases() {
|
|
173
|
+
return this.admin().listDatabases();
|
|
174
|
+
}
|
|
175
|
+
async listCollections(db, filter) {
|
|
176
|
+
return this.getDb(db).listCollections(filter).toArray();
|
|
177
|
+
}
|
|
178
|
+
async dbStats(db) {
|
|
179
|
+
return this.getDb(db).stats();
|
|
180
|
+
}
|
|
181
|
+
async command(command, db) {
|
|
182
|
+
return this.getDb(db).command(command);
|
|
183
|
+
}
|
|
184
|
+
// ---- Topology ----
|
|
185
|
+
isReplicaSet() {
|
|
186
|
+
return this.manager.getTopology().isReplicaSet;
|
|
187
|
+
}
|
|
188
|
+
getTopologyType() {
|
|
189
|
+
return this.manager.getTopology().topologyType;
|
|
190
|
+
}
|
|
191
|
+
assertReplicaSet(operation) {
|
|
192
|
+
const topo = this.manager.getTopology();
|
|
193
|
+
if (!topo.isReplicaSet) {
|
|
194
|
+
throw new MongoTopologyError(`${operation} requires a replica set or sharded cluster. ` +
|
|
195
|
+
`Current topology: ${topo.topologyType}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// ---- Lifecycle ----
|
|
199
|
+
async closeAll() {
|
|
200
|
+
const streams = [...this.openStreams];
|
|
201
|
+
this.openStreams.clear();
|
|
202
|
+
await Promise.allSettled(streams.map(s => s.close()));
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
exports.MongoServiceImpl = MongoServiceImpl;
|
|
206
|
+
exports.MongoServiceImpl = MongoServiceImpl = __decorate([
|
|
207
|
+
(0, core_1.injectable)({ scope: core_1.BindingScope.SINGLETON }),
|
|
208
|
+
__param(0, (0, core_1.inject)(keys_1.MongoBindings.CONNECTION_MANAGER)),
|
|
209
|
+
__metadata("design:paramtypes", [connection_manager_1.MongoConnectionManager])
|
|
210
|
+
], MongoServiceImpl);
|
|
211
|
+
//# sourceMappingURL=mongo.service.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo.service.impl.js","sourceRoot":"","sources":["../../src/services/mongo.service.impl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAAgE;AAChE,qCA2BiB;AACjB,kDAAiC;AACjC,kCAAsC;AACtC,sEAAqE;AAGrE,MAAM,KAAK,GAAG,IAAA,eAAY,EAAC,oCAAoC,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAE3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,SAAI,GAAG,oBAAoB,CAAC;IAG9C,CAAC;CACF;AALD,gDAKC;AAED;;;;;GAKG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAI3B,YAEE,OAA+B;QAJhB,gBAAW,GAAG,IAAI,GAAG,EAAgB,CAAC;QAMrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,wBAAwB;IAExB,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,IAAa;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,aAAa,CAAqB,IAAY,EAAE,EAAW;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,UAAU,CAAI,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,wBAAwB;IAExB,KAAK,CAAC,SAAS,CACb,UAAkB,EAClB,QAAoB,EACpB,OAA0C;QAE1C,MAAM,EAAC,EAAE,EAAE,GAAG,aAAa,EAAC,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7C,KAAK,CAAC,0BAA0B,EAAE,UAAU,EAAE,QA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