@xylabs/mongo 4.12.44 → 4.13.0

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.
@@ -0,0 +1,60 @@
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 { }
@@ -0,0 +1,60 @@
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 { }
@@ -0,0 +1,60 @@
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 { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/mongo",
3
- "version": "4.12.44",
3
+ "version": "4.13.0",
4
4
  "description": "Base functionality used throughout XYO TypeScript/JavaScript libraries that access Mongo DB",
5
5
  "keywords": [
6
6
  "mongo",
@@ -25,27 +25,27 @@
25
25
  "exports": {
26
26
  ".": {
27
27
  "browser": {
28
- "types": "./dist/types/index.d.ts",
28
+ "types": "./dist/browser/index.d.ts",
29
29
  "default": "./dist/browser/index.mjs"
30
30
  },
31
31
  "node": {
32
- "types": "./dist/types/index.d.ts",
32
+ "types": "./dist/node/index.d.ts",
33
33
  "default": "./dist/node/index.mjs"
34
34
  },
35
- "types": "./dist/types/index.d.ts",
35
+ "types": "./dist/node/index.d.ts",
36
36
  "default": "./dist/node/index.mjs"
37
37
  },
38
38
  "./package.json": "./package.json"
39
39
  },
40
40
  "module": "dist/node/index.mjs",
41
- "types": "dist/types/index.d.ts",
41
+ "types": "dist/node/index.d.ts",
42
42
  "dependencies": {
43
- "@xylabs/assert": "^4.12.44",
43
+ "@xylabs/assert": "^4.13.0",
44
44
  "mongodb": "~6.17.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@xylabs/ts-scripts-yarn3": "^6.5.12",
48
- "@xylabs/tsconfig": "^6.5.12",
47
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.7",
48
+ "@xylabs/tsconfig": "^7.0.0-rc.7",
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4"
51
51
  },
@@ -1,19 +0,0 @@
1
- import type { BulkWriteOptions, Collection, DeleteResult, Document, Filter, FindCursor, InsertOneOptions, MongoClient, OptionalUnlessRequiredId, ReplaceOptions, UpdateFilter, WithId } from 'mongodb';
2
- import type { BaseMongoSdkConfig } from './Config.js';
3
- export declare class BaseMongoSdk<T extends Document> {
4
- config: BaseMongoSdkConfig;
5
- constructor(config: BaseMongoSdkConfig);
6
- get uri(): string;
7
- deleteMany(filter: Filter<T>): Promise<DeleteResult>;
8
- deleteOne(filter: Filter<T>): Promise<DeleteResult>;
9
- find(filter: Filter<T>): Promise<FindCursor<WithId<T>>>;
10
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
11
- insertMany(items: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<import("mongodb").InsertManyResult<T>>;
12
- insertOne(item: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<import("mongodb").InsertOneResult<T>>;
13
- replaceOne(filter: Filter<T>, item: OptionalUnlessRequiredId<T>, options?: ReplaceOptions): Promise<import("mongodb").UpdateResult<T>>;
14
- updateOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<import("mongodb").UpdateResult<T>>;
15
- upsertOne(filter: Filter<T>, fields: UpdateFilter<T>): Promise<import("mongodb").UpdateResult<T>>;
16
- useCollection<R>(func: (collection: Collection<T>) => Promise<R> | R): Promise<R>;
17
- useMongo<R>(func: (client: MongoClient) => Promise<R> | R): Promise<R>;
18
- }
19
- //# sourceMappingURL=Base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,YAAY,EACZ,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGrD,qBAAa,YAAY,CAAC,CAAC,SAAS,QAAQ;IAC1C,MAAM,EAAE,kBAAkB,CAAA;gBAEd,MAAM,EAAE,kBAAkB;IAItC,IAAI,GAAG,WAMN;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAM5B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAM3B,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAMtB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAMzB,UAAU,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAM3E,SAAS,CAAC,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAMvE,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;IAMzF,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAMpD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAMpD,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAMpE,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;CAUhE"}
@@ -1,14 +0,0 @@
1
- export interface BaseMongoSdkPublicConfig {
2
- closeDelay?: number;
3
- collection: string;
4
- maxPoolSize?: number;
5
- }
6
- export interface BaseMongoSdkPrivateConfig {
7
- dbConnectionString?: string;
8
- dbDomain?: string;
9
- dbName?: string;
10
- dbPassword?: string;
11
- dbUserName?: string;
12
- }
13
- export type BaseMongoSdkConfig = BaseMongoSdkPublicConfig & BaseMongoSdkPrivateConfig;
14
- //# sourceMappingURL=Config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,yBAAyB,CAAA"}
@@ -1,11 +0,0 @@
1
- import { MongoClient } from 'mongodb';
2
- export declare class MongoClientWrapper {
3
- static readonly clients: Map<string, MongoClientWrapper>;
4
- private client;
5
- constructor(uri: string, maxPoolSize?: number, closeDelay?: number);
6
- static get(uri: string, poolSize?: number, closeDelay?: number): MongoClientWrapper;
7
- connect(): Promise<MongoClient>;
8
- disconnect(): Promise<number>;
9
- initiateClose(): Promise<void>;
10
- }
11
- //# sourceMappingURL=Wrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../src/Wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,QAAQ,CAAC,OAAO,kCAAwC;IAE/D,OAAO,CAAC,MAAM,CAAa;gBAEf,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAKlE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IASxD,OAAO;IAIP,UAAU;IAIV,aAAa;CAGpB"}
@@ -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 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}