@xylabs/mongo 4.13.15 → 4.13.16

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 (41) hide show
  1. package/README.md +22 -31
  2. package/dist/browser/index.d.ts +4 -46
  3. package/dist/browser/spec/Base.spec.d.ts +2 -0
  4. package/dist/browser/spec/Base.spec.d.ts.map +1 -0
  5. package/dist/browser/spec/Wrapper.spec.d.ts +14 -0
  6. package/dist/browser/spec/Wrapper.spec.d.ts.map +1 -0
  7. package/dist/neutral/index.d.ts +4 -46
  8. package/dist/neutral/spec/Base.spec.d.ts +2 -0
  9. package/dist/neutral/spec/Base.spec.d.ts.map +1 -0
  10. package/dist/neutral/spec/Wrapper.spec.d.ts +14 -0
  11. package/dist/neutral/spec/Wrapper.spec.d.ts.map +1 -0
  12. package/dist/node/index.d.ts +4 -46
  13. package/dist/node/spec/Base.spec.d.ts +2 -0
  14. package/dist/node/spec/Base.spec.d.ts.map +1 -0
  15. package/dist/node/spec/Wrapper.spec.d.ts +14 -0
  16. package/dist/node/spec/Wrapper.spec.d.ts.map +1 -0
  17. package/package.json +4 -4
  18. package/build/browser/index.d.ts +0 -4
  19. package/build/neutral/index.d.ts +0 -4
  20. package/build/node/index.d.ts +0 -4
  21. /package/{build → dist}/browser/Base.d.ts +0 -0
  22. /package/{build → dist}/browser/Base.d.ts.map +0 -0
  23. /package/{build → dist}/browser/Config.d.ts +0 -0
  24. /package/{build → dist}/browser/Config.d.ts.map +0 -0
  25. /package/{build → dist}/browser/Wrapper.d.ts +0 -0
  26. /package/{build → dist}/browser/Wrapper.d.ts.map +0 -0
  27. /package/{build → dist}/browser/index.d.ts.map +0 -0
  28. /package/{build → dist}/neutral/Base.d.ts +0 -0
  29. /package/{build → dist}/neutral/Base.d.ts.map +0 -0
  30. /package/{build → dist}/neutral/Config.d.ts +0 -0
  31. /package/{build → dist}/neutral/Config.d.ts.map +0 -0
  32. /package/{build → dist}/neutral/Wrapper.d.ts +0 -0
  33. /package/{build → dist}/neutral/Wrapper.d.ts.map +0 -0
  34. /package/{build → dist}/neutral/index.d.ts.map +0 -0
  35. /package/{build → dist}/node/Base.d.ts +0 -0
  36. /package/{build → dist}/node/Base.d.ts.map +0 -0
  37. /package/{build → dist}/node/Config.d.ts +0 -0
  38. /package/{build → dist}/node/Config.d.ts.map +0 -0
  39. /package/{build → dist}/node/Wrapper.d.ts +0 -0
  40. /package/{build → dist}/node/Wrapper.d.ts.map +0 -0
  41. /package/{build → dist}/node/index.d.ts.map +0 -0
package/README.md CHANGED
@@ -1,63 +1,54 @@
1
- [![logo][]](https://xylabs.com)
2
-
3
1
  # @xylabs/mongo
4
2
 
3
+ [![logo][]](https://xylabs.com)
4
+
5
+ [![main-build][]][main-build-link]
5
6
  [![npm-badge][]][npm-link]
6
7
  [![npm-downloads-badge][]][npm-link]
7
8
  [![jsdelivr-badge][]][jsdelivr-link]
8
9
  [![npm-license-badge][]](LICENSE)
10
+ [![codacy-badge][]][codacy-link]
11
+ [![codeclimate-badge][]][codeclimate-link]
12
+ [![snyk-badge][]][snyk-link]
9
13
  [![socket-badge][]][socket-link]
10
14
 
11
- > XY Labs Logger Helpers
12
-
13
- ## Table of Contents
14
-
15
- - [Description](#description)
16
- - [Install](#install)
17
- - [Maintainers](#maintainers)
18
- - [License](#license)
19
- - [Credits](#credits)
20
-
21
- ## Description
15
+ Version: 4.13.15
22
16
 
23
- Various Mongo helper functions
17
+ Base functionality used throughout XYO TypeScript/JavaScript libraries that access Mongo DB
24
18
 
25
- ## Install
26
-
27
- Using npm:
28
-
29
- ```sh
30
- npm i --save @xylabs/mongo
31
- ```
19
+ ## Documentation
32
20
 
33
- Using yarn:
21
+ Coming Soon!
34
22
 
35
- ```sh
36
- yarn add @xylabs/mongo
37
- ```
38
-
39
- ## Documentation
40
- [Developer Reference](https://xylabs.github.io/sdk-js)
23
+ Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
41
24
 
42
25
  ## Maintainers
43
26
 
44
27
  - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
45
- - [Joel Carter](https://github.com/JoelBCarter)
46
28
  - [Matt Jones](https://github.com/jonesmac)
29
+ - [Joel Carter](https://github.com/JoelBCarter)
47
30
  - [Jordan Trouw](https://github.com/jordantrouw)
48
31
 
49
32
  ## License
50
33
 
51
- See the [LICENSE](LICENSE) file for license details
34
+ > See the [LICENSE](LICENSE) file for license details
52
35
 
53
36
  ## Credits
54
37
 
55
- [Made with 🔥and ❄️ by XY Labs](https://xylabs.com)
38
+ [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
56
39
 
57
40
  [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
58
41
 
42
+ [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
43
+ [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
59
44
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/mongo.svg
60
45
  [npm-link]: https://www.npmjs.com/package/@xylabs/mongo
46
+ [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
47
+ [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
48
+ [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
49
+ [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
50
+ [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
51
+ [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
61
52
 
62
53
  [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/mongo
63
54
  [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/mongo
@@ -1,46 +1,4 @@
1
- import * as mongodb from 'mongodb';
2
- import { Document, Filter, DeleteResult, FindCursor, WithId, OptionalUnlessRequiredId, BulkWriteOptions, InsertOneOptions, ReplaceOptions, UpdateFilter, Collection, MongoClient } from 'mongodb';
3
-
4
- interface BaseMongoSdkPublicConfig {
5
- closeDelay?: number;
6
- collection: string;
7
- maxPoolSize?: number;
8
- }
9
- interface BaseMongoSdkPrivateConfig {
10
- dbConnectionString?: string;
11
- dbDomain?: string;
12
- dbName?: string;
13
- dbPassword?: string;
14
- dbUserName?: string;
15
- }
16
- type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
17
-
18
- declare class BaseMongoSdk<T extends Document> {
19
- config: BaseMongoSdkConfig;
20
- constructor(config: BaseMongoSdkConfig);
21
- get uri(): string;
22
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
23
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
24
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
25
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
26
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<mongodb.InsertManyResult<T>>;
27
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<mongodb.InsertOneResult<T>>;
28
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<mongodb.UpdateResult<T>>;
29
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
30
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
31
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
32
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
33
- }
34
-
35
- declare class MongoClientWrapper {
36
- static readonly clients: Map<string, MongoClientWrapper>;
37
- private client;
38
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
39
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
40
- connect(): Promise<MongoClient>;
41
- disconnect(): Promise<number>;
42
- initiateClose(): Promise<void>;
43
- }
44
-
45
- export { BaseMongoSdk, MongoClientWrapper };
46
- export type { BaseMongoSdkConfig, BaseMongoSdkPrivateConfig, BaseMongoSdkPublicConfig };
1
+ export * from './Base.js';
2
+ export * from './Config.js';
3
+ export * from './Wrapper.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Base.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Base.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Starts a heap profiler session.
3
+ * @param type 'sampling' or 'snapshot'
4
+ * @param outPath Output directory (default: './heap-profiles')
5
+ */
6
+ export declare function startHeapProfile(type?: 'sampling' | 'snapshot', outPath?: string): Promise<void>;
7
+ /**
8
+ * Stops the heap profiler and writes the output to file.
9
+ * @param fileName Optional output filename
10
+ * @param outPath Output directory (default: './heap-profiles')
11
+ * @returns Full path to the heap profile file
12
+ */
13
+ export declare function stopHeapProfile(fileName?: string, outPath?: string): Promise<string>;
14
+ //# sourceMappingURL=Wrapper.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wrapper.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Wrapper.spec.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,UAAU,GAAG,UAAuB,EAC1C,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
@@ -1,46 +1,4 @@
1
- import * as mongodb from 'mongodb';
2
- import { Document, Filter, DeleteResult, FindCursor, WithId, OptionalUnlessRequiredId, BulkWriteOptions, InsertOneOptions, ReplaceOptions, UpdateFilter, Collection, MongoClient } from 'mongodb';
3
-
4
- interface BaseMongoSdkPublicConfig {
5
- closeDelay?: number;
6
- collection: string;
7
- maxPoolSize?: number;
8
- }
9
- interface BaseMongoSdkPrivateConfig {
10
- dbConnectionString?: string;
11
- dbDomain?: string;
12
- dbName?: string;
13
- dbPassword?: string;
14
- dbUserName?: string;
15
- }
16
- type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
17
-
18
- declare class BaseMongoSdk<T extends Document> {
19
- config: BaseMongoSdkConfig;
20
- constructor(config: BaseMongoSdkConfig);
21
- get uri(): string;
22
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
23
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
24
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
25
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
26
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<mongodb.InsertManyResult<T>>;
27
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<mongodb.InsertOneResult<T>>;
28
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<mongodb.UpdateResult<T>>;
29
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
30
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
31
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
32
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
33
- }
34
-
35
- declare class MongoClientWrapper {
36
- static readonly clients: Map<string, MongoClientWrapper>;
37
- private client;
38
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
39
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
40
- connect(): Promise<MongoClient>;
41
- disconnect(): Promise<number>;
42
- initiateClose(): Promise<void>;
43
- }
44
-
45
- export { BaseMongoSdk, MongoClientWrapper };
46
- export type { BaseMongoSdkConfig, BaseMongoSdkPrivateConfig, BaseMongoSdkPublicConfig };
1
+ export * from './Base.js';
2
+ export * from './Config.js';
3
+ export * from './Wrapper.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Base.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Base.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Starts a heap profiler session.
3
+ * @param type 'sampling' or 'snapshot'
4
+ * @param outPath Output directory (default: './heap-profiles')
5
+ */
6
+ export declare function startHeapProfile(type?: 'sampling' | 'snapshot', outPath?: string): Promise<void>;
7
+ /**
8
+ * Stops the heap profiler and writes the output to file.
9
+ * @param fileName Optional output filename
10
+ * @param outPath Output directory (default: './heap-profiles')
11
+ * @returns Full path to the heap profile file
12
+ */
13
+ export declare function stopHeapProfile(fileName?: string, outPath?: string): Promise<string>;
14
+ //# sourceMappingURL=Wrapper.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wrapper.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Wrapper.spec.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,UAAU,GAAG,UAAuB,EAC1C,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
@@ -1,46 +1,4 @@
1
- import * as mongodb from 'mongodb';
2
- import { Document, Filter, DeleteResult, FindCursor, WithId, OptionalUnlessRequiredId, BulkWriteOptions, InsertOneOptions, ReplaceOptions, UpdateFilter, Collection, MongoClient } from 'mongodb';
3
-
4
- interface BaseMongoSdkPublicConfig {
5
- closeDelay?: number;
6
- collection: string;
7
- maxPoolSize?: number;
8
- }
9
- interface BaseMongoSdkPrivateConfig {
10
- dbConnectionString?: string;
11
- dbDomain?: string;
12
- dbName?: string;
13
- dbPassword?: string;
14
- dbUserName?: string;
15
- }
16
- type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
17
-
18
- declare class BaseMongoSdk<T extends Document> {
19
- config: BaseMongoSdkConfig;
20
- constructor(config: BaseMongoSdkConfig);
21
- get uri(): string;
22
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
23
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
24
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
25
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
26
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<mongodb.InsertManyResult<T>>;
27
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<mongodb.InsertOneResult<T>>;
28
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<mongodb.UpdateResult<T>>;
29
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
30
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<mongodb.UpdateResult<T>>;
31
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
32
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
33
- }
34
-
35
- declare class MongoClientWrapper {
36
- static readonly clients: Map<string, MongoClientWrapper>;
37
- private client;
38
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
39
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
40
- connect(): Promise<MongoClient>;
41
- disconnect(): Promise<number>;
42
- initiateClose(): Promise<void>;
43
- }
44
-
45
- export { BaseMongoSdk, MongoClientWrapper };
46
- export type { BaseMongoSdkConfig, BaseMongoSdkPrivateConfig, BaseMongoSdkPublicConfig };
1
+ export * from './Base.js';
2
+ export * from './Config.js';
3
+ export * from './Wrapper.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Base.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Base.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Starts a heap profiler session.
3
+ * @param type 'sampling' or 'snapshot'
4
+ * @param outPath Output directory (default: './heap-profiles')
5
+ */
6
+ export declare function startHeapProfile(type?: 'sampling' | 'snapshot', outPath?: string): Promise<void>;
7
+ /**
8
+ * Stops the heap profiler and writes the output to file.
9
+ * @param fileName Optional output filename
10
+ * @param outPath Output directory (default: './heap-profiles')
11
+ * @returns Full path to the heap profile file
12
+ */
13
+ export declare function stopHeapProfile(fileName?: string, outPath?: string): Promise<string>;
14
+ //# sourceMappingURL=Wrapper.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wrapper.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/Wrapper.spec.ts"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,UAAU,GAAG,UAAuB,EAC1C,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,MAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/mongo",
3
- "version": "4.13.15",
3
+ "version": "4.13.16",
4
4
  "description": "Base functionality used throughout XYO TypeScript/JavaScript libraries that access Mongo DB",
5
5
  "keywords": [
6
6
  "mongo",
@@ -40,12 +40,12 @@
40
40
  "module": "dist/node/index.mjs",
41
41
  "types": "dist/node/index.d.ts",
42
42
  "dependencies": {
43
- "@xylabs/assert": "^4.13.15",
43
+ "@xylabs/assert": "^4.13.16",
44
44
  "mongodb": "~6.17.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
48
- "@xylabs/tsconfig": "^7.0.0-rc.20",
47
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
48
+ "@xylabs/tsconfig": "^7.0.0-rc.27",
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4"
51
51
  },
@@ -1,4 +0,0 @@
1
- export * from './Base.js';
2
- export * from './Config.js';
3
- export * from './Wrapper.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- export * from './Base.js';
2
- export * from './Config.js';
3
- export * from './Wrapper.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- export * from './Base.js';
2
- export * from './Config.js';
3
- export * from './Wrapper.js';
4
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes