@event-driven-io/pongo 0.17.0-beta.34 → 0.17.0-beta.36
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/dist/cli.cjs +311 -494
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +4 -4
- package/dist/cli.d.ts +4 -3
- package/dist/cli.js +279 -494
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare.cjs +36 -48
- package/dist/cloudflare.cjs.map +1 -1
- package/dist/cloudflare.d.cts +7 -7
- package/dist/cloudflare.d.ts +7 -7
- package/dist/cloudflare.js +29 -47
- package/dist/cloudflare.js.map +1 -1
- package/dist/core-CwxxuUAn.cjs +1590 -0
- package/dist/core-CwxxuUAn.cjs.map +1 -0
- package/dist/core-D_iZiiYe.js +1308 -0
- package/dist/core-D_iZiiYe.js.map +1 -0
- package/dist/core-DwoTLYbR.cjs +319 -0
- package/dist/core-DwoTLYbR.cjs.map +1 -0
- package/dist/core-fsJmsQDa.js +307 -0
- package/dist/core-fsJmsQDa.js.map +1 -0
- package/dist/index-DMq6F3x9.d.ts +705 -0
- package/dist/index-Du_IHXAj.d.ts +10 -0
- package/dist/index-ZKOB86ub.d.cts +10 -0
- package/dist/index-qeC-p0Tq.d.cts +705 -0
- package/dist/index.cjs +61 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -130
- package/dist/index.d.ts +11 -130
- package/dist/index.js +14 -119
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +214 -320
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +24 -22
- package/dist/pg.d.ts +24 -22
- package/dist/pg.js +209 -321
- package/dist/pg.js.map +1 -1
- package/dist/shim.cjs +281 -367
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +140 -137
- package/dist/shim.d.ts +140 -137
- package/dist/shim.js +275 -366
- package/dist/shim.js.map +1 -1
- package/dist/sqlite3.cjs +41 -56
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +9 -9
- package/dist/sqlite3.d.ts +9 -9
- package/dist/sqlite3.js +35 -56
- package/dist/sqlite3.js.map +1 -1
- package/package.json +15 -15
- package/dist/chunk-OJVG4KXA.js +0 -399
- package/dist/chunk-OJVG4KXA.js.map +0 -1
- package/dist/chunk-TYTEQJBC.cjs +0 -1583
- package/dist/chunk-TYTEQJBC.cjs.map +0 -1
- package/dist/chunk-U4NNEXNH.js +0 -1583
- package/dist/chunk-U4NNEXNH.js.map +0 -1
- package/dist/chunk-UP6HTRMM.cjs +0 -399
- package/dist/chunk-UP6HTRMM.cjs.map +0 -1
- package/dist/index-DHszkVjP.d.ts +0 -8
- package/dist/index-DLDCIBgH.d.cts +0 -8
- package/dist/pongoTransactionCache-BsigBOq1.d.cts +0 -556
- package/dist/pongoTransactionCache-BsigBOq1.d.ts +0 -556
package/dist/shim.js
CHANGED
|
@@ -1,380 +1,289 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
pongoSession
|
|
4
|
-
} from "./chunk-U4NNEXNH.js";
|
|
1
|
+
import { o as pongoClient, s as pongoSession } from "./core-D_iZiiYe.js";
|
|
2
|
+
import { parseConnectionString, toDatabaseDriverType } from "@event-driven-io/dumbo";
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
//#region src/mongo/findCursor.ts
|
|
7
5
|
var FindCursor = class {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return this.documents;
|
|
35
|
-
}
|
|
6
|
+
findDocumentsPromise;
|
|
7
|
+
documents = null;
|
|
8
|
+
index = 0;
|
|
9
|
+
constructor(documents) {
|
|
10
|
+
this.findDocumentsPromise = documents;
|
|
11
|
+
}
|
|
12
|
+
async toArray() {
|
|
13
|
+
return this.findDocuments();
|
|
14
|
+
}
|
|
15
|
+
async forEach(callback) {
|
|
16
|
+
const docs = await this.findDocuments();
|
|
17
|
+
for (const doc of docs) callback(doc);
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
hasNext() {
|
|
21
|
+
if (this.documents === null) throw Error("Error while fetching documents");
|
|
22
|
+
return this.index < this.documents.length;
|
|
23
|
+
}
|
|
24
|
+
async next() {
|
|
25
|
+
const docs = await this.findDocuments();
|
|
26
|
+
return this.hasNext() ? docs[this.index++] ?? null : null;
|
|
27
|
+
}
|
|
28
|
+
async findDocuments() {
|
|
29
|
+
this.documents = await this.findDocumentsPromise;
|
|
30
|
+
return this.documents;
|
|
31
|
+
}
|
|
36
32
|
};
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
const pongoFindOptions = {};
|
|
51
|
-
if (options?.session) {
|
|
52
|
-
pongoFindOptions.session = options.session;
|
|
53
|
-
}
|
|
54
|
-
if (options?.limit !== void 0) {
|
|
55
|
-
pongoFindOptions.limit = options.limit;
|
|
56
|
-
}
|
|
57
|
-
if (options?.skip !== void 0) {
|
|
58
|
-
pongoFindOptions.skip = options.skip;
|
|
59
|
-
}
|
|
60
|
-
return pongoFindOptions;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/mongo/mongoCollection.ts
|
|
36
|
+
const toCollectionOperationOptions = (options) => options?.session ? { session: options.session } : void 0;
|
|
37
|
+
const toFindOptions = (options) => {
|
|
38
|
+
if (!options?.session && !options?.limit && !options?.skip && !options?.sort) return;
|
|
39
|
+
const pongoFindOptions = {};
|
|
40
|
+
if (options?.session) pongoFindOptions.session = options.session;
|
|
41
|
+
if (options?.limit !== void 0) pongoFindOptions.limit = options.limit;
|
|
42
|
+
if (options?.skip !== void 0) pongoFindOptions.skip = options.skip;
|
|
43
|
+
if (options?.sort !== void 0) pongoFindOptions.sort = options.sort;
|
|
44
|
+
return pongoFindOptions;
|
|
61
45
|
};
|
|
62
46
|
var Collection = class {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
indexes(_options) {
|
|
245
|
-
throw new Error("Method not implemented.");
|
|
246
|
-
}
|
|
247
|
-
findOneAndDelete(filter, options) {
|
|
248
|
-
return this.collection.findOneAndDelete(
|
|
249
|
-
filter,
|
|
250
|
-
toCollectionOperationOptions(options)
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
findOneAndReplace(filter, replacement, options) {
|
|
254
|
-
return this.collection.findOneAndReplace(
|
|
255
|
-
filter,
|
|
256
|
-
replacement,
|
|
257
|
-
toCollectionOperationOptions(options)
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
findOneAndUpdate(filter, update, options) {
|
|
261
|
-
return this.collection.findOneAndUpdate(
|
|
262
|
-
filter,
|
|
263
|
-
update,
|
|
264
|
-
toCollectionOperationOptions(options)
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
aggregate(_pipeline, _options) {
|
|
268
|
-
throw new Error("Method not implemented.");
|
|
269
|
-
}
|
|
270
|
-
watch(_pipeline, _options) {
|
|
271
|
-
throw new Error("Method not implemented.");
|
|
272
|
-
}
|
|
273
|
-
initializeUnorderedBulkOp(_options) {
|
|
274
|
-
throw new Error("Method not implemented.");
|
|
275
|
-
}
|
|
276
|
-
initializeOrderedBulkOp(_options) {
|
|
277
|
-
throw new Error("Method not implemented.");
|
|
278
|
-
}
|
|
279
|
-
count(filter, options) {
|
|
280
|
-
return this.collection.countDocuments(
|
|
281
|
-
filter ?? {},
|
|
282
|
-
toCollectionOperationOptions(options)
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
listSearchIndexes(_name, _options) {
|
|
286
|
-
throw new Error("Method not implemented.");
|
|
287
|
-
}
|
|
288
|
-
createSearchIndex(_description) {
|
|
289
|
-
throw new Error("Method not implemented.");
|
|
290
|
-
}
|
|
291
|
-
createSearchIndexes(_descriptions) {
|
|
292
|
-
throw new Error("Method not implemented.");
|
|
293
|
-
}
|
|
294
|
-
dropSearchIndex(_name) {
|
|
295
|
-
throw new Error("Method not implemented.");
|
|
296
|
-
}
|
|
297
|
-
updateSearchIndex(_name, _definition) {
|
|
298
|
-
throw new Error("Method not implemented.");
|
|
299
|
-
}
|
|
300
|
-
async createCollection() {
|
|
301
|
-
await this.collection.createCollection();
|
|
302
|
-
}
|
|
303
|
-
async handle(id, handle, options) {
|
|
304
|
-
return this.collection.handle(id.toString(), handle, options);
|
|
305
|
-
}
|
|
47
|
+
collection;
|
|
48
|
+
database;
|
|
49
|
+
constructor(database, collection) {
|
|
50
|
+
this.collection = collection;
|
|
51
|
+
this.database = database;
|
|
52
|
+
}
|
|
53
|
+
get db() {
|
|
54
|
+
return this.database;
|
|
55
|
+
}
|
|
56
|
+
get dbName() {
|
|
57
|
+
return this.collection.dbName;
|
|
58
|
+
}
|
|
59
|
+
get collectionName() {
|
|
60
|
+
return this.collection.collectionName;
|
|
61
|
+
}
|
|
62
|
+
get namespace() {
|
|
63
|
+
return `${this.dbName}.${this.collectionName}`;
|
|
64
|
+
}
|
|
65
|
+
get readConcern() {}
|
|
66
|
+
get readPreference() {}
|
|
67
|
+
get bsonOptions() {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
get writeConcern() {}
|
|
71
|
+
get hint() {}
|
|
72
|
+
get timeoutMS() {}
|
|
73
|
+
set hint(v) {
|
|
74
|
+
throw new Error("Method not implemented.");
|
|
75
|
+
}
|
|
76
|
+
async insertOne(doc, options) {
|
|
77
|
+
const result = await this.collection.insertOne(doc, toCollectionOperationOptions(options));
|
|
78
|
+
return {
|
|
79
|
+
acknowledged: result.acknowledged,
|
|
80
|
+
insertedId: result.insertedId
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async insertMany(docs, options) {
|
|
84
|
+
const result = await this.collection.insertMany(docs, toCollectionOperationOptions(options));
|
|
85
|
+
return {
|
|
86
|
+
acknowledged: result.acknowledged,
|
|
87
|
+
insertedIds: result.insertedIds,
|
|
88
|
+
insertedCount: result.insertedCount
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
bulkWrite(_operations, _options) {
|
|
92
|
+
throw new Error("Method not implemented.");
|
|
93
|
+
}
|
|
94
|
+
async updateOne(filter, update, options) {
|
|
95
|
+
const result = await this.collection.updateOne(filter, update, toCollectionOperationOptions(options));
|
|
96
|
+
return {
|
|
97
|
+
acknowledged: result.acknowledged,
|
|
98
|
+
matchedCount: result.modifiedCount,
|
|
99
|
+
modifiedCount: result.modifiedCount,
|
|
100
|
+
upsertedCount: result.modifiedCount,
|
|
101
|
+
upsertedId: null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
replaceOne(filter, document, options) {
|
|
105
|
+
return this.collection.replaceOne(filter, document, toCollectionOperationOptions(options));
|
|
106
|
+
}
|
|
107
|
+
async updateMany(filter, update, options) {
|
|
108
|
+
const result = await this.collection.updateMany(filter, update, toCollectionOperationOptions(options));
|
|
109
|
+
return {
|
|
110
|
+
acknowledged: result.acknowledged,
|
|
111
|
+
matchedCount: result.modifiedCount,
|
|
112
|
+
modifiedCount: result.modifiedCount,
|
|
113
|
+
upsertedCount: result.modifiedCount,
|
|
114
|
+
upsertedId: null
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
async deleteOne(filter, options) {
|
|
118
|
+
const result = await this.collection.deleteOne(filter, toCollectionOperationOptions(options));
|
|
119
|
+
return {
|
|
120
|
+
acknowledged: result.acknowledged,
|
|
121
|
+
deletedCount: result.deletedCount
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async deleteMany(filter, options) {
|
|
125
|
+
const result = await this.collection.deleteMany(filter, toCollectionOperationOptions(options));
|
|
126
|
+
return {
|
|
127
|
+
acknowledged: result.acknowledged,
|
|
128
|
+
deletedCount: result.deletedCount
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async rename(newName, options) {
|
|
132
|
+
await this.collection.rename(newName, toCollectionOperationOptions(options));
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
drop(options) {
|
|
136
|
+
return this.collection.drop(toCollectionOperationOptions(options));
|
|
137
|
+
}
|
|
138
|
+
async findOne(filter, options) {
|
|
139
|
+
return await this.collection.findOne(filter, toCollectionOperationOptions(options));
|
|
140
|
+
}
|
|
141
|
+
find(filter, options) {
|
|
142
|
+
return new FindCursor(this.collection.find(filter, toFindOptions(options)));
|
|
143
|
+
}
|
|
144
|
+
options(_options) {
|
|
145
|
+
throw new Error("Method not implemented.");
|
|
146
|
+
}
|
|
147
|
+
isCapped(_options) {
|
|
148
|
+
throw new Error("Method not implemented.");
|
|
149
|
+
}
|
|
150
|
+
createIndex(_indexSpec, _options) {
|
|
151
|
+
throw new Error("Method not implemented.");
|
|
152
|
+
}
|
|
153
|
+
createIndexes(_indexSpecs, _options) {
|
|
154
|
+
throw new Error("Method not implemented.");
|
|
155
|
+
}
|
|
156
|
+
dropIndex(_indexName, _options) {
|
|
157
|
+
throw new Error("Method not implemented.");
|
|
158
|
+
}
|
|
159
|
+
dropIndexes(_options) {
|
|
160
|
+
throw new Error("Method not implemented.");
|
|
161
|
+
}
|
|
162
|
+
listIndexes(_options) {
|
|
163
|
+
throw new Error("Method not implemented.");
|
|
164
|
+
}
|
|
165
|
+
indexExists(_indexes, _options) {
|
|
166
|
+
throw new Error("Method not implemented.");
|
|
167
|
+
}
|
|
168
|
+
indexInformation(_options) {
|
|
169
|
+
throw new Error("Method not implemented.");
|
|
170
|
+
}
|
|
171
|
+
estimatedDocumentCount(options) {
|
|
172
|
+
return this.collection.countDocuments({}, toCollectionOperationOptions(options));
|
|
173
|
+
}
|
|
174
|
+
countDocuments(filter, options) {
|
|
175
|
+
return this.collection.countDocuments(filter, toCollectionOperationOptions(options));
|
|
176
|
+
}
|
|
177
|
+
distinct(_key, _filter, _options) {
|
|
178
|
+
throw new Error("Method not implemented.");
|
|
179
|
+
}
|
|
180
|
+
indexes(_options) {
|
|
181
|
+
throw new Error("Method not implemented.");
|
|
182
|
+
}
|
|
183
|
+
findOneAndDelete(filter, options) {
|
|
184
|
+
return this.collection.findOneAndDelete(filter, toCollectionOperationOptions(options));
|
|
185
|
+
}
|
|
186
|
+
findOneAndReplace(filter, replacement, options) {
|
|
187
|
+
return this.collection.findOneAndReplace(filter, replacement, toCollectionOperationOptions(options));
|
|
188
|
+
}
|
|
189
|
+
findOneAndUpdate(filter, update, options) {
|
|
190
|
+
return this.collection.findOneAndUpdate(filter, update, toCollectionOperationOptions(options));
|
|
191
|
+
}
|
|
192
|
+
aggregate(_pipeline, _options) {
|
|
193
|
+
throw new Error("Method not implemented.");
|
|
194
|
+
}
|
|
195
|
+
watch(_pipeline, _options) {
|
|
196
|
+
throw new Error("Method not implemented.");
|
|
197
|
+
}
|
|
198
|
+
initializeUnorderedBulkOp(_options) {
|
|
199
|
+
throw new Error("Method not implemented.");
|
|
200
|
+
}
|
|
201
|
+
initializeOrderedBulkOp(_options) {
|
|
202
|
+
throw new Error("Method not implemented.");
|
|
203
|
+
}
|
|
204
|
+
count(filter, options) {
|
|
205
|
+
return this.collection.countDocuments(filter ?? {}, toCollectionOperationOptions(options));
|
|
206
|
+
}
|
|
207
|
+
listSearchIndexes(_name, _options) {
|
|
208
|
+
throw new Error("Method not implemented.");
|
|
209
|
+
}
|
|
210
|
+
createSearchIndex(_description) {
|
|
211
|
+
throw new Error("Method not implemented.");
|
|
212
|
+
}
|
|
213
|
+
createSearchIndexes(_descriptions) {
|
|
214
|
+
throw new Error("Method not implemented.");
|
|
215
|
+
}
|
|
216
|
+
dropSearchIndex(_name) {
|
|
217
|
+
throw new Error("Method not implemented.");
|
|
218
|
+
}
|
|
219
|
+
updateSearchIndex(_name, _definition) {
|
|
220
|
+
throw new Error("Method not implemented.");
|
|
221
|
+
}
|
|
222
|
+
async createCollection() {
|
|
223
|
+
await this.collection.createCollection();
|
|
224
|
+
}
|
|
225
|
+
async handle(id, handle, options) {
|
|
226
|
+
return this.collection.handle(id.toString(), handle, options);
|
|
227
|
+
}
|
|
306
228
|
};
|
|
307
229
|
|
|
308
|
-
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/mongo/mongoDb.ts
|
|
309
232
|
var Db = class {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
this.pongoDb.collection(collectionName, options)
|
|
321
|
-
);
|
|
322
|
-
}
|
|
233
|
+
pongoDb;
|
|
234
|
+
constructor(pongoDb) {
|
|
235
|
+
this.pongoDb = pongoDb;
|
|
236
|
+
}
|
|
237
|
+
get databaseName() {
|
|
238
|
+
return this.pongoDb.databaseName;
|
|
239
|
+
}
|
|
240
|
+
collection(collectionName, options) {
|
|
241
|
+
return new Collection(this, this.pongoDb.collection(collectionName, options));
|
|
242
|
+
}
|
|
323
243
|
};
|
|
324
244
|
|
|
325
|
-
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/mongo/mongoClient.ts
|
|
326
247
|
var MongoClient = class {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
async withSession(optionsOrExecutor, executor) {
|
|
365
|
-
const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
|
|
366
|
-
const session = pongoSession();
|
|
367
|
-
try {
|
|
368
|
-
return await callback(session);
|
|
369
|
-
} finally {
|
|
370
|
-
await session.endSession();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
export {
|
|
375
|
-
Collection,
|
|
376
|
-
Db,
|
|
377
|
-
FindCursor,
|
|
378
|
-
MongoClient
|
|
248
|
+
pongoClient;
|
|
249
|
+
constructor(connectionStringOrOptions, options) {
|
|
250
|
+
if (typeof connectionStringOrOptions !== "string") {
|
|
251
|
+
this.pongoClient = pongoClient(connectionStringOrOptions);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const { databaseType, driverName } = parseConnectionString(connectionStringOrOptions);
|
|
255
|
+
const driver = options?.driver ?? pongoDriverRegistry.tryGet(toDatabaseDriverType(databaseType, driverName));
|
|
256
|
+
if (driver === null) throw new Error(`No database driver registered for ${databaseType} with name ${driverName}`);
|
|
257
|
+
this.pongoClient = pongoClient({
|
|
258
|
+
...options ?? {},
|
|
259
|
+
connectionString: connectionStringOrOptions,
|
|
260
|
+
driver
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async connect() {
|
|
264
|
+
await this.pongoClient.connect();
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
async close() {
|
|
268
|
+
await this.pongoClient.close();
|
|
269
|
+
}
|
|
270
|
+
db(dbName) {
|
|
271
|
+
return new Db(this.pongoClient.db(dbName));
|
|
272
|
+
}
|
|
273
|
+
startSession(_options) {
|
|
274
|
+
return pongoSession();
|
|
275
|
+
}
|
|
276
|
+
async withSession(optionsOrExecutor, executor) {
|
|
277
|
+
const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
|
|
278
|
+
const session = pongoSession();
|
|
279
|
+
try {
|
|
280
|
+
return await callback(session);
|
|
281
|
+
} finally {
|
|
282
|
+
await session.endSession();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
379
285
|
};
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
export { Collection, Db, FindCursor, MongoClient };
|
|
380
289
|
//# sourceMappingURL=shim.js.map
|