@aneuhold/be-ts-db-lib 2.0.79 → 2.0.80

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 🔖 [2.0.80] (2025-10-17)
9
+
10
+ ### 🏗️ Changed
11
+
12
+ - Improved and expanded JSDoc comments and documentation for public types and methods throughout the package
13
+
8
14
  ## 🔖 [2.0.79] (2025-08-18)
9
15
 
10
16
  ### ✅ Added
@@ -46,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
46
52
 
47
53
  <!-- Link References -->
48
54
 
55
+ [2.0.80]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.79...be-ts-db-lib-v2.0.80
49
56
  [2.0.79]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.78...be-ts-db-lib-v2.0.79
50
57
  [2.0.78]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.77...be-ts-db-lib-v2.0.78
51
58
  [2.0.77]: https://github.com/aneuhold/ts-libs/compare/be-ts-db-lib-v2.0.76...be-ts-db-lib-v2.0.77
@@ -7,8 +7,24 @@ export default class DocumentDb {
7
7
  private static DB_NAME;
8
8
  private static mongoClient;
9
9
  private static db;
10
+ /**
11
+ * Gets or creates the MongoDB client instance.
12
+ *
13
+ * @returns A promise that resolves to the MongoDB client.
14
+ */
10
15
  private static getClient;
16
+ /**
17
+ * Gets a MongoDB collection with the specified type.
18
+ *
19
+ * @param collectionName - The name of the collection to retrieve.
20
+ * @returns A promise that resolves to the typed MongoDB collection.
21
+ */
11
22
  static getCollection<TDocType extends Document>(collectionName: string): Promise<Collection<TDocType>>;
23
+ /**
24
+ * Closes the active MongoDB connection.
25
+ *
26
+ * @returns A promise that resolves when the connection is closed.
27
+ */
12
28
  static closeDbConnection(): Promise<void>;
13
29
  }
14
30
  //# sourceMappingURL=DocumentDb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentDb.d.ts","sourceRoot":"","sources":["../../src/util/DocumentDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa;IAEnC,OAAO,CAAC,MAAM,CAAC,WAAW,CAA0B;IAEpD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAiB;mBAEb,SAAS;WAiBjB,aAAa,CAAC,QAAQ,SAAS,QAAQ,EAClD,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;WAQnB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAKhD"}
1
+ {"version":3,"file":"DocumentDb.d.ts","sourceRoot":"","sources":["../../src/util/DocumentDb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa;IAEnC,OAAO,CAAC,MAAM,CAAC,WAAW,CAA0B;IAEpD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAiB;IAElC;;;;OAIG;mBACkB,SAAS;IAiB9B;;;;;OAKG;WACU,aAAa,CAAC,QAAQ,SAAS,QAAQ,EAClD,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAQhC;;;;OAIG;WACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAKhD"}
@@ -7,6 +7,11 @@ export default class DocumentDb {
7
7
  static DB_NAME = 'default';
8
8
  static mongoClient;
9
9
  static db;
10
+ /**
11
+ * Gets or creates the MongoDB client instance.
12
+ *
13
+ * @returns A promise that resolves to the MongoDB client.
14
+ */
10
15
  static async getClient() {
11
16
  if (!ConfigService.isInitialized) {
12
17
  // Hard-coded local for now until there are move envs.
@@ -23,6 +28,12 @@ export default class DocumentDb {
23
28
  await this.mongoClient.connect();
24
29
  return this.mongoClient;
25
30
  }
31
+ /**
32
+ * Gets a MongoDB collection with the specified type.
33
+ *
34
+ * @param collectionName - The name of the collection to retrieve.
35
+ * @returns A promise that resolves to the typed MongoDB collection.
36
+ */
26
37
  static async getCollection(collectionName) {
27
38
  const client = await this.getClient();
28
39
  if (!DocumentDb.db) {
@@ -30,6 +41,11 @@ export default class DocumentDb {
30
41
  }
31
42
  return DocumentDb.db.collection(collectionName);
32
43
  }
44
+ /**
45
+ * Closes the active MongoDB connection.
46
+ *
47
+ * @returns A promise that resolves when the connection is closed.
48
+ */
33
49
  static async closeDbConnection() {
34
50
  if (DocumentDb.mongoClient) {
35
51
  await DocumentDb.mongoClient.close();
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentDb.js","sourceRoot":"","sources":["../../src/util/DocumentDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAkB,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IACrB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;IAE3B,MAAM,CAAC,WAAW,CAA0B;IAE5C,MAAM,CAAC,EAAE,CAAiB;IAE1B,MAAM,CAAC,KAAK,CAAC,SAAS;QAC5B,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;YACjC,sDAAsD;YACtD,MAAM,aAAa,CAAC,SA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+12,11 @@ export default class DocumentDb {
12
12
 
13
13
  private static db: Db | undefined;
14
14
 
15
+ /**
16
+ * Gets or creates the MongoDB client instance.
17
+ *
18
+ * @returns A promise that resolves to the MongoDB client.
19
+ */
15
20
  private static async getClient(): Promise<MongoClient> {
16
21
  if (!ConfigService.isInitialized) {
17
22
  // Hard-coded local for now until there are move envs.
@@ -29,6 +34,12 @@ export default class DocumentDb {
29
34
  return this.mongoClient;
30
35
  }
31
36
 
37
+ /**
38
+ * Gets a MongoDB collection with the specified type.
39
+ *
40
+ * @param collectionName - The name of the collection to retrieve.
41
+ * @returns A promise that resolves to the typed MongoDB collection.
42
+ */
32
43
  static async getCollection<TDocType extends Document>(
33
44
  collectionName: string
34
45
  ): Promise<Collection<TDocType>> {
@@ -39,6 +50,11 @@ export default class DocumentDb {
39
50
  return DocumentDb.db.collection<TDocType>(collectionName);
40
51
  }
41
52
 
53
+ /**
54
+ * Closes the active MongoDB connection.
55
+ *
56
+ * @returns A promise that resolves when the connection is closed.
57
+ */
42
58
  static async closeDbConnection(): Promise<void> {
43
59
  if (DocumentDb.mongoClient) {
44
60
  await DocumentDb.mongoClient.close();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aneuhold/be-ts-db-lib",
3
3
  "author": "Anton G. Neuhold Jr.",
4
4
  "license": "MIT",
5
- "version": "2.0.79",
5
+ "version": "2.0.80",
6
6
  "description": "A backend database library meant to actually interact with various databases in personal projects",
7
7
  "packageManager": "pnpm@10.12.1",
8
8
  "type": "module",