@event-driven-io/pongo 0.17.0-beta.4 → 0.17.0-beta.40

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