@xylabs/mongo 4.13.20 → 4.13.22

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 (2) hide show
  1. package/README.md +508 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -12,13 +12,518 @@
12
12
  [![snyk-badge][]][snyk-link]
13
13
  [![socket-badge][]][socket-link]
14
14
 
15
- Version: 4.13.19
16
15
 
17
16
  Base functionality used throughout XYO TypeScript/JavaScript libraries that access Mongo DB
18
17
 
19
- ## Documentation
18
+ ## Reference
19
+
20
+ **@xylabs/mongo**
21
+
22
+ ***
23
+
24
+ ## Classes
25
+
26
+ - [BaseMongoSdk](#classes/BaseMongoSdk)
27
+ - [MongoClientWrapper](#classes/MongoClientWrapper)
28
+
29
+ ## Interfaces
30
+
31
+ - [BaseMongoSdkPublicConfig](#interfaces/BaseMongoSdkPublicConfig)
32
+ - [BaseMongoSdkPrivateConfig](#interfaces/BaseMongoSdkPrivateConfig)
33
+
34
+ ## Type Aliases
35
+
36
+ - [BaseMongoSdkConfig](#type-aliases/BaseMongoSdkConfig)
37
+
38
+ ### classes
39
+
40
+ ### <a id="BaseMongoSdk"></a>BaseMongoSdk
41
+
42
+ [**@xylabs/mongo**](#../README)
43
+
44
+ ***
45
+
46
+ ## Type Parameters
47
+
48
+ ### T
49
+
50
+ `T` *extends* `Document`
51
+
52
+ ## Constructors
53
+
54
+ ### Constructor
55
+
56
+ ```ts
57
+ new BaseMongoSdk<T>(config): BaseMongoSdk<T>;
58
+ ```
59
+
60
+ ### Parameters
61
+
62
+ #### config
63
+
64
+ [`BaseMongoSdkConfig`](#../type-aliases/BaseMongoSdkConfig)
65
+
66
+ ### Returns
67
+
68
+ `BaseMongoSdk`\<`T`\>
69
+
70
+ ## Properties
71
+
72
+ ### config
73
+
74
+ ```ts
75
+ config: BaseMongoSdkConfig;
76
+ ```
77
+
78
+ ## Accessors
79
+
80
+ ### uri
81
+
82
+ ### Get Signature
83
+
84
+ ```ts
85
+ get uri(): string;
86
+ ```
87
+
88
+ #### Returns
89
+
90
+ `string`
91
+
92
+ ## Methods
93
+
94
+ ### deleteMany()
95
+
96
+ ```ts
97
+ deleteMany(filter): Promise<DeleteResult>;
98
+ ```
99
+
100
+ ### Parameters
101
+
102
+ #### filter
103
+
104
+ `Filter`\<`T`\>
105
+
106
+ ### Returns
107
+
108
+ `Promise`\<`DeleteResult`\>
109
+
110
+ ***
111
+
112
+ ### deleteOne()
113
+
114
+ ```ts
115
+ deleteOne(filter): Promise<DeleteResult>;
116
+ ```
117
+
118
+ ### Parameters
119
+
120
+ #### filter
121
+
122
+ `Filter`\<`T`\>
123
+
124
+ ### Returns
125
+
126
+ `Promise`\<`DeleteResult`\>
127
+
128
+ ***
129
+
130
+ ### find()
131
+
132
+ ```ts
133
+ find(filter): Promise<FindCursor<WithId<T>>>;
134
+ ```
135
+
136
+ ### Parameters
137
+
138
+ #### filter
139
+
140
+ `Filter`\<`T`\>
141
+
142
+ ### Returns
143
+
144
+ `Promise`\<`FindCursor`\<`WithId`\<`T`\>\>\>
145
+
146
+ ***
147
+
148
+ ### findOne()
149
+
150
+ ```ts
151
+ findOne(filter): Promise<null | WithId<T>>;
152
+ ```
153
+
154
+ ### Parameters
155
+
156
+ #### filter
157
+
158
+ `Filter`\<`T`\>
159
+
160
+ ### Returns
161
+
162
+ `Promise`\<`null` \| `WithId`\<`T`\>\>
163
+
164
+ ***
165
+
166
+ ### insertMany()
167
+
168
+ ```ts
169
+ insertMany(items, options?): Promise<InsertManyResult<T>>;
170
+ ```
171
+
172
+ ### Parameters
173
+
174
+ #### items
175
+
176
+ `OptionalUnlessRequiredId`\<`T`\>[]
177
+
178
+ #### options?
179
+
180
+ `BulkWriteOptions`
181
+
182
+ ### Returns
183
+
184
+ `Promise`\<`InsertManyResult`\<`T`\>\>
185
+
186
+ ***
187
+
188
+ ### insertOne()
189
+
190
+ ```ts
191
+ insertOne(item, options?): Promise<InsertOneResult<T>>;
192
+ ```
193
+
194
+ ### Parameters
195
+
196
+ #### item
197
+
198
+ `OptionalUnlessRequiredId`\<`T`\>
199
+
200
+ #### options?
201
+
202
+ `InsertOneOptions`
203
+
204
+ ### Returns
205
+
206
+ `Promise`\<`InsertOneResult`\<`T`\>\>
207
+
208
+ ***
209
+
210
+ ### replaceOne()
211
+
212
+ ```ts
213
+ replaceOne(
214
+ filter,
215
+ item,
216
+ options?): Promise<UpdateResult<T>>;
217
+ ```
218
+
219
+ ### Parameters
220
+
221
+ #### filter
222
+
223
+ `Filter`\<`T`\>
224
+
225
+ #### item
226
+
227
+ `OptionalUnlessRequiredId`\<`T`\>
228
+
229
+ #### options?
230
+
231
+ `ReplaceOptions`
232
+
233
+ ### Returns
234
+
235
+ `Promise`\<`UpdateResult`\<`T`\>\>
236
+
237
+ ***
238
+
239
+ ### updateOne()
240
+
241
+ ```ts
242
+ updateOne(filter, fields): Promise<UpdateResult<T>>;
243
+ ```
244
+
245
+ ### Parameters
246
+
247
+ #### filter
248
+
249
+ `Filter`\<`T`\>
250
+
251
+ #### fields
252
+
253
+ `UpdateFilter`\<`T`\>
254
+
255
+ ### Returns
256
+
257
+ `Promise`\<`UpdateResult`\<`T`\>\>
258
+
259
+ ***
260
+
261
+ ### upsertOne()
262
+
263
+ ```ts
264
+ upsertOne(filter, fields): Promise<UpdateResult<T>>;
265
+ ```
266
+
267
+ ### Parameters
268
+
269
+ #### filter
270
+
271
+ `Filter`\<`T`\>
272
+
273
+ #### fields
274
+
275
+ `UpdateFilter`\<`T`\>
276
+
277
+ ### Returns
278
+
279
+ `Promise`\<`UpdateResult`\<`T`\>\>
280
+
281
+ ***
282
+
283
+ ### useCollection()
284
+
285
+ ```ts
286
+ useCollection<R>(func): Promise<R>;
287
+ ```
288
+
289
+ ### Type Parameters
290
+
291
+ #### R
292
+
293
+ `R`
294
+
295
+ ### Parameters
296
+
297
+ #### func
298
+
299
+ (`collection`) => `R` \| `Promise`\<`R`\>
300
+
301
+ ### Returns
302
+
303
+ `Promise`\<`R`\>
304
+
305
+ ***
306
+
307
+ ### useMongo()
308
+
309
+ ```ts
310
+ useMongo<R>(func): Promise<R>;
311
+ ```
312
+
313
+ ### Type Parameters
314
+
315
+ #### R
316
+
317
+ `R`
318
+
319
+ ### Parameters
320
+
321
+ #### func
322
+
323
+ (`client`) => `R` \| `Promise`\<`R`\>
324
+
325
+ ### Returns
326
+
327
+ `Promise`\<`R`\>
328
+
329
+ ### <a id="MongoClientWrapper"></a>MongoClientWrapper
330
+
331
+ [**@xylabs/mongo**](#../README)
332
+
333
+ ***
334
+
335
+ ## Constructors
336
+
337
+ ### Constructor
338
+
339
+ ```ts
340
+ new MongoClientWrapper(
341
+ uri,
342
+ maxPoolSize?,
343
+ closeDelay?): MongoClientWrapper;
344
+ ```
345
+
346
+ ### Parameters
347
+
348
+ #### uri
349
+
350
+ `string`
351
+
352
+ #### maxPoolSize?
353
+
354
+ `number`
355
+
356
+ #### closeDelay?
357
+
358
+ `number`
359
+
360
+ ### Returns
361
+
362
+ `MongoClientWrapper`
363
+
364
+ ## Properties
365
+
366
+ ### clients
367
+
368
+ ```ts
369
+ readonly static clients: Map<string, MongoClientWrapper>;
370
+ ```
371
+
372
+ ## Methods
373
+
374
+ ### get()
375
+
376
+ ```ts
377
+ static get(
378
+ uri,
379
+ poolSize?,
380
+ closeDelay?): MongoClientWrapper;
381
+ ```
382
+
383
+ ### Parameters
384
+
385
+ #### uri
386
+
387
+ `string`
388
+
389
+ #### poolSize?
390
+
391
+ `number`
392
+
393
+ #### closeDelay?
394
+
395
+ `number`
396
+
397
+ ### Returns
398
+
399
+ `MongoClientWrapper`
400
+
401
+ ***
402
+
403
+ ### connect()
404
+
405
+ ```ts
406
+ connect(): Promise<MongoClient>;
407
+ ```
408
+
409
+ ### Returns
410
+
411
+ `Promise`\<`MongoClient`\>
412
+
413
+ ***
414
+
415
+ ### disconnect()
416
+
417
+ ```ts
418
+ disconnect(): Promise<number>;
419
+ ```
420
+
421
+ ### Returns
422
+
423
+ `Promise`\<`number`\>
424
+
425
+ ***
426
+
427
+ ### initiateClose()
428
+
429
+ ```ts
430
+ initiateClose(): Promise<void>;
431
+ ```
432
+
433
+ ### Returns
434
+
435
+ `Promise`\<`void`\>
436
+
437
+ ### interfaces
438
+
439
+ ### <a id="BaseMongoSdkPrivateConfig"></a>BaseMongoSdkPrivateConfig
440
+
441
+ [**@xylabs/mongo**](#../README)
442
+
443
+ ***
444
+
445
+ ## Properties
446
+
447
+ ### dbConnectionString?
448
+
449
+ ```ts
450
+ optional dbConnectionString: string;
451
+ ```
452
+
453
+ ***
454
+
455
+ ### dbDomain?
456
+
457
+ ```ts
458
+ optional dbDomain: string;
459
+ ```
460
+
461
+ ***
462
+
463
+ ### dbName?
464
+
465
+ ```ts
466
+ optional dbName: string;
467
+ ```
468
+
469
+ ***
470
+
471
+ ### dbPassword?
472
+
473
+ ```ts
474
+ optional dbPassword: string;
475
+ ```
476
+
477
+ ***
478
+
479
+ ### dbUserName?
480
+
481
+ ```ts
482
+ optional dbUserName: string;
483
+ ```
484
+
485
+ ### <a id="BaseMongoSdkPublicConfig"></a>BaseMongoSdkPublicConfig
486
+
487
+ [**@xylabs/mongo**](#../README)
488
+
489
+ ***
490
+
491
+ ## Properties
492
+
493
+ ### closeDelay?
494
+
495
+ ```ts
496
+ optional closeDelay: number;
497
+ ```
498
+
499
+ ***
500
+
501
+ ### collection
502
+
503
+ ```ts
504
+ collection: string;
505
+ ```
506
+
507
+ ***
508
+
509
+ ### maxPoolSize?
510
+
511
+ ```ts
512
+ optional maxPoolSize: number;
513
+ ```
514
+
515
+ ### type-aliases
516
+
517
+ ### <a id="BaseMongoSdkConfig"></a>BaseMongoSdkConfig
518
+
519
+ [**@xylabs/mongo**](#../README)
520
+
521
+ ***
522
+
523
+ ```ts
524
+ type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
525
+ ```
20
526
 
21
- Coming Soon!
22
527
 
23
528
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
24
529
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/mongo",
3
- "version": "4.13.20",
3
+ "version": "4.13.22",
4
4
  "description": "Base functionality used throughout XYO TypeScript/JavaScript libraries that access Mongo DB",
5
5
  "keywords": [
6
6
  "mongo",
@@ -48,7 +48,7 @@
48
48
  "src"
49
49
  ],
50
50
  "dependencies": {
51
- "@xylabs/assert": "^4.13.20",
51
+ "@xylabs/assert": "^4.13.22",
52
52
  "mongodb": "~6.17.0"
53
53
  },
54
54
  "devDependencies": {