@point-hub/papi 0.7.1 → 0.7.2
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/lib/index.js
CHANGED
|
@@ -69755,6 +69755,15 @@ class MongoTestService {
|
|
|
69755
69755
|
this.db = this.mongoClient.db(name);
|
|
69756
69756
|
this.mongoService = new MongoService(this.db);
|
|
69757
69757
|
}
|
|
69758
|
+
get client() {
|
|
69759
|
+
return this.mongoClient;
|
|
69760
|
+
}
|
|
69761
|
+
get database() {
|
|
69762
|
+
return this.db;
|
|
69763
|
+
}
|
|
69764
|
+
get service() {
|
|
69765
|
+
return this.mongoService;
|
|
69766
|
+
}
|
|
69758
69767
|
async open() {
|
|
69759
69768
|
await this.mongoClient.connect();
|
|
69760
69769
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Db, MongoClient } from 'mongodb';
|
|
1
2
|
import type { ISchema } from '../../interfaces/types';
|
|
3
|
+
import { MongoService } from './mongo.service';
|
|
2
4
|
/**
|
|
3
5
|
* Provides utilities for managing a MongoDB database during tests.
|
|
4
6
|
*
|
|
@@ -33,6 +35,44 @@ export declare class MongoTestService {
|
|
|
33
35
|
* @param name - Name of the test database.
|
|
34
36
|
*/
|
|
35
37
|
constructor(uri: string, name: string);
|
|
38
|
+
/**
|
|
39
|
+
* Provides access to the MongoDB client.
|
|
40
|
+
*
|
|
41
|
+
* Use this to access native MongoDB client functionality,
|
|
42
|
+
* such as creating sessions and managing transactions.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const session = mongoTestService.client.startSession()
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
get client(): MongoClient;
|
|
50
|
+
/**
|
|
51
|
+
* Provides access to the MongoDB database.
|
|
52
|
+
*
|
|
53
|
+
* Use this to perform direct database operations in tests,
|
|
54
|
+
* such as inserting fixtures and querying documents.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* await mongoTestService.database.collection('users').insertOne({
|
|
59
|
+
* email: 'john@example.com'
|
|
60
|
+
* })
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
get database(): Db;
|
|
64
|
+
/**
|
|
65
|
+
* Provides access to the MongoDB service.
|
|
66
|
+
*
|
|
67
|
+
* Use this to perform MongoDB operations through the service abstraction
|
|
68
|
+
* instead of accessing the database directly.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* await mongoTestService.service.createUnique('users', { email: 1 })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
get service(): MongoService;
|
|
36
76
|
/**
|
|
37
77
|
* Establishes a connection to MongoDB.
|
|
38
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo-test.service.d.ts","sourceRoot":"","sources":["../../../../src/database/mongodb/mongo-test.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mongo-test.service.d.ts","sourceRoot":"","sources":["../../../../src/database/mongodb/mongo-test.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,WAAW,EAAsB,MAAM,SAAS,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,EAAE,CAAK;IAEf;;;;;;;;OAQG;gBACS,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAWrC;;;;;;;;;;OAUG;IACH,IAAW,MAAM,IAAI,WAAW,CAE/B;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,QAAQ,IAAI,EAAE,CAExB;IAED;;;;;;;;;;OAUG;IACH,IAAW,OAAO,IAAI,YAAY,CAEjC;IAED;;;;OAIG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC;;;;OAIG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;;;;;;;;;;;;;;;;;OAkBG;IACU,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCtE;;;;;;;;;;;OAWG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;;;;;;;OAWG;IACU,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAShD;;;;;;;;;;;;OAYG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAOpC"}
|