@xylabs/mongo 4.13.3 → 4.13.5

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.
@@ -1,60 +1,46 @@
1
- import type { BulkWriteOptions } from 'mongodb';
2
- import type { Collection } from 'mongodb';
3
- import type { DeleteResult } from 'mongodb';
4
- import type { Document } from 'mongodb';
5
- import type { Filter } from 'mongodb';
6
- import type { FindCursor } from 'mongodb';
7
- import { InsertManyResult } from 'mongodb';
8
- import type { InsertOneOptions } from 'mongodb';
9
- import { InsertOneResult } from 'mongodb';
10
- import { MongoClient } from 'mongodb';
11
- import type { OptionalUnlessRequiredId } from 'mongodb';
12
- import type { ReplaceOptions } from 'mongodb';
13
- import type { UpdateFilter } from 'mongodb';
14
- import { UpdateResult } from 'mongodb';
15
- import type { WithId } from 'mongodb';
16
-
17
- export declare class BaseMongoSdk<T extends Document> {
18
- config: BaseMongoSdkConfig;
19
- constructor(config: BaseMongoSdkConfig);
20
- get uri(): string;
21
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
22
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
23
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
24
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
25
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
26
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
27
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<UpdateResult<T>>;
28
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
29
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
30
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
31
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
32
- }
33
-
34
- export declare type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
35
-
36
- export declare interface BaseMongoSdkPrivateConfig {
37
- dbConnectionString?: string;
38
- dbDomain?: string;
39
- dbName?: string;
40
- dbPassword?: string;
41
- dbUserName?: string;
42
- }
43
-
44
- export declare interface BaseMongoSdkPublicConfig {
45
- closeDelay?: number;
46
- collection: string;
47
- maxPoolSize?: number;
48
- }
49
-
50
- export declare class MongoClientWrapper {
51
- static readonly clients: Map<string, MongoClientWrapper>;
52
- private client;
53
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
54
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
55
- connect(): Promise<MongoClient>;
56
- disconnect(): Promise<number>;
57
- initiateClose(): Promise<void>;
58
- }
59
-
60
- export { }
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,60 +1,46 @@
1
- import type { BulkWriteOptions } from 'mongodb';
2
- import type { Collection } from 'mongodb';
3
- import type { DeleteResult } from 'mongodb';
4
- import type { Document } from 'mongodb';
5
- import type { Filter } from 'mongodb';
6
- import type { FindCursor } from 'mongodb';
7
- import { InsertManyResult } from 'mongodb';
8
- import type { InsertOneOptions } from 'mongodb';
9
- import { InsertOneResult } from 'mongodb';
10
- import { MongoClient } from 'mongodb';
11
- import type { OptionalUnlessRequiredId } from 'mongodb';
12
- import type { ReplaceOptions } from 'mongodb';
13
- import type { UpdateFilter } from 'mongodb';
14
- import { UpdateResult } from 'mongodb';
15
- import type { WithId } from 'mongodb';
16
-
17
- export declare class BaseMongoSdk<T extends Document> {
18
- config: BaseMongoSdkConfig;
19
- constructor(config: BaseMongoSdkConfig);
20
- get uri(): string;
21
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
22
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
23
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
24
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
25
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
26
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
27
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<UpdateResult<T>>;
28
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
29
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
30
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
31
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
32
- }
33
-
34
- export declare type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
35
-
36
- export declare interface BaseMongoSdkPrivateConfig {
37
- dbConnectionString?: string;
38
- dbDomain?: string;
39
- dbName?: string;
40
- dbPassword?: string;
41
- dbUserName?: string;
42
- }
43
-
44
- export declare interface BaseMongoSdkPublicConfig {
45
- closeDelay?: number;
46
- collection: string;
47
- maxPoolSize?: number;
48
- }
49
-
50
- export declare class MongoClientWrapper {
51
- static readonly clients: Map<string, MongoClientWrapper>;
52
- private client;
53
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
54
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
55
- connect(): Promise<MongoClient>;
56
- disconnect(): Promise<number>;
57
- initiateClose(): Promise<void>;
58
- }
59
-
60
- export { }
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,60 +1,46 @@
1
- import type { BulkWriteOptions } from 'mongodb';
2
- import type { Collection } from 'mongodb';
3
- import type { DeleteResult } from 'mongodb';
4
- import type { Document } from 'mongodb';
5
- import type { Filter } from 'mongodb';
6
- import type { FindCursor } from 'mongodb';
7
- import { InsertManyResult } from 'mongodb';
8
- import type { InsertOneOptions } from 'mongodb';
9
- import { InsertOneResult } from 'mongodb';
10
- import { MongoClient } from 'mongodb';
11
- import type { OptionalUnlessRequiredId } from 'mongodb';
12
- import type { ReplaceOptions } from 'mongodb';
13
- import type { UpdateFilter } from 'mongodb';
14
- import { UpdateResult } from 'mongodb';
15
- import type { WithId } from 'mongodb';
16
-
17
- export declare class BaseMongoSdk<T extends Document> {
18
- config: BaseMongoSdkConfig;
19
- constructor(config: BaseMongoSdkConfig);
20
- get uri(): string;
21
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
22
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
23
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
24
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
25
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
26
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
27
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<UpdateResult<T>>;
28
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
29
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<UpdateResult<T>>;
30
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
31
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
32
- }
33
-
34
- export declare type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
35
-
36
- export declare interface BaseMongoSdkPrivateConfig {
37
- dbConnectionString?: string;
38
- dbDomain?: string;
39
- dbName?: string;
40
- dbPassword?: string;
41
- dbUserName?: string;
42
- }
43
-
44
- export declare interface BaseMongoSdkPublicConfig {
45
- closeDelay?: number;
46
- collection: string;
47
- maxPoolSize?: number;
48
- }
49
-
50
- export declare class MongoClientWrapper {
51
- static readonly clients: Map<string, MongoClientWrapper>;
52
- private client;
53
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
54
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
55
- connect(): Promise<MongoClient>;
56
- disconnect(): Promise<number>;
57
- initiateClose(): Promise<void>;
58
- }
59
-
60
- export { }
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/mongo",
3
- "version": "4.13.3",
3
+ "version": "4.13.5",
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.3",
43
+ "@xylabs/assert": "^4.13.5",
44
44
  "mongodb": "~6.17.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.7",
48
- "@xylabs/tsconfig": "^7.0.0-rc.7",
47
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.8",
48
+ "@xylabs/tsconfig": "^7.0.0-rc.8",
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4"
51
51
  },