@mongosh/service-provider-core 2.2.6 → 2.2.10
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/cursors.d.ts +48 -0
- package/lib/cursors.js +3 -0
- package/lib/cursors.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js.map +1 -1
- package/lib/readable.d.ts +7 -6
- package/lib/writable.d.ts +3 -2
- package/package.json +6 -6
- package/src/cursors.ts +69 -0
- package/src/index.ts +8 -0
- package/src/readable.ts +10 -7
- package/src/writable.ts +3 -2
package/lib/cursors.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CollationOptions, CountOptions, CursorFlag, Document, ExplainVerbosityLike, ReadConcernLike, ReadPreferenceLike, ResumeToken } from './all-transport-types';
|
|
2
|
+
interface ServiceProviderBaseCursor<TSchema = Document> {
|
|
3
|
+
close(): Promise<void>;
|
|
4
|
+
hasNext(): Promise<boolean>;
|
|
5
|
+
next(): Promise<TSchema | null>;
|
|
6
|
+
tryNext(): Promise<TSchema | null>;
|
|
7
|
+
readonly closed: boolean;
|
|
8
|
+
[Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
|
|
9
|
+
}
|
|
10
|
+
export interface ServiceProviderAbstractCursor<TSchema = Document> extends ServiceProviderBaseCursor<TSchema> {
|
|
11
|
+
batchSize(number: number): void;
|
|
12
|
+
maxTimeMS(value: number): void;
|
|
13
|
+
bufferedCount(): number;
|
|
14
|
+
readBufferedDocuments(number?: number): TSchema[];
|
|
15
|
+
toArray(): Promise<TSchema[]>;
|
|
16
|
+
}
|
|
17
|
+
export interface ServiceProviderAggregationOrFindCursor<TSchema = Document> extends ServiceProviderAbstractCursor<TSchema> {
|
|
18
|
+
project($project: Document): void;
|
|
19
|
+
skip($skip: number): void;
|
|
20
|
+
sort($sort: Document): void;
|
|
21
|
+
explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
|
|
22
|
+
addCursorFlag(flag: CursorFlag, value: boolean): void;
|
|
23
|
+
withReadPreference(readPreference: ReadPreferenceLike): this;
|
|
24
|
+
withReadConcern(readConcern: ReadConcernLike): this;
|
|
25
|
+
}
|
|
26
|
+
export interface ServiceProviderRunCommandCursor<TSchema = Document> extends ServiceProviderAbstractCursor<TSchema> {
|
|
27
|
+
}
|
|
28
|
+
export interface ServiceProviderFindCursor<TSchema = Document> extends ServiceProviderAggregationOrFindCursor<TSchema> {
|
|
29
|
+
allowDiskUse(allow?: boolean): void;
|
|
30
|
+
collation(value: CollationOptions): void;
|
|
31
|
+
comment(value: string): void;
|
|
32
|
+
maxAwaitTimeMS(value: number): void;
|
|
33
|
+
count(options?: CountOptions): Promise<number>;
|
|
34
|
+
hint(hint: string | Document): void;
|
|
35
|
+
max(max: Document): void;
|
|
36
|
+
min(min: Document): void;
|
|
37
|
+
limit(value: number): void;
|
|
38
|
+
skip(value: number): void;
|
|
39
|
+
returnKey(value: boolean): void;
|
|
40
|
+
showRecordId(value: boolean): void;
|
|
41
|
+
}
|
|
42
|
+
export interface ServiceProviderAggregationCursor<TSchema = Document> extends ServiceProviderAggregationOrFindCursor<TSchema> {
|
|
43
|
+
}
|
|
44
|
+
export interface ServiceProviderChangeStream<TSchema = Document> extends ServiceProviderBaseCursor<TSchema> {
|
|
45
|
+
next(): Promise<TSchema>;
|
|
46
|
+
readonly resumeToken: ResumeToken;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
package/lib/cursors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursors.js","sourceRoot":"","sources":["../src/cursors.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export * from './all-fle-types';
|
|
|
10
10
|
export { MapReduceOptions, FinalizeFunction } from './map-reduce-options';
|
|
11
11
|
export { CreateEncryptedCollectionOptions, CheckMetadataConsistencyOptions, ConnectionInfo, } from './admin';
|
|
12
12
|
export { bson } from './bson-export';
|
|
13
|
+
export { ServiceProviderAbstractCursor, ServiceProviderAggregationCursor, ServiceProviderFindCursor, ServiceProviderRunCommandCursor, ServiceProviderChangeStream, } from './cursors';
|
|
13
14
|
export { ServiceProvider, ShellAuthOptions, getConnectExtraInfo, ReplPlatform, DEFAULT_DB, ServiceProviderCore, bsonStringifiers, ConnectionExtraInfo, };
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA0E;AAiCxE,oGAjCwB,sCAAmB,OAiCxB;AAhCrB,kEAA0E;AA6BxE,8BA7BK,sBAAmB,CA6BL;AA3BrB,MAAM,UAAU,GAAG,MAAM,CAAC;AA6BxB,gCAAU;AA5BZ,qDAAoD;AA8BlD,iGA9BO,iCAAgB,OA8BP;AA5BlB,wDAAsC;AACtC,kDAAgC;AAUhC,6CAAqC;AAA5B,mGAAA,IAAI,OAAA"}
|
package/lib/readable.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type { Document, AggregateOptions, CountOptions, CountDocumentsOptions, DistinctOptions, EstimatedDocumentCountOptions, FindOptions, ListCollectionsOptions, ListIndexesOptions,
|
|
2
|
-
import type {
|
|
1
|
+
import type { Document, AggregateOptions, CountOptions, CountDocumentsOptions, DistinctOptions, EstimatedDocumentCountOptions, FindOptions, ListCollectionsOptions, ListIndexesOptions, DbOptions, ReadPreferenceFromOptions, ReadPreferenceLike } from './all-transport-types';
|
|
2
|
+
import type { ChangeStreamOptions } from './all-transport-types';
|
|
3
|
+
import type { ServiceProviderAggregationCursor, ServiceProviderChangeStream, ServiceProviderFindCursor } from './cursors';
|
|
3
4
|
export default interface Readable {
|
|
4
|
-
aggregate(database: string, collection: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions):
|
|
5
|
-
aggregateDb(database: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions):
|
|
5
|
+
aggregate(database: string, collection: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
|
|
6
|
+
aggregateDb(database: string, pipeline: Document[], options?: AggregateOptions, dbOptions?: DbOptions): ServiceProviderAggregationCursor;
|
|
6
7
|
count(db: string, coll: string, query?: Document, options?: CountOptions, dbOptions?: DbOptions): Promise<number>;
|
|
7
8
|
countDocuments(database: string, collection: string, filter?: Document, options?: CountDocumentsOptions, dbOptions?: DbOptions): Promise<number>;
|
|
8
9
|
distinct(database: string, collection: string, fieldName: string, filter?: Document, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
9
10
|
estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
|
|
10
|
-
find(database: string, collection: string, filter?: Document, options?: FindOptions, dbOptions?: DbOptions):
|
|
11
|
+
find(database: string, collection: string, filter?: Document, options?: FindOptions, dbOptions?: DbOptions): ServiceProviderFindCursor;
|
|
11
12
|
getTopology(): any;
|
|
12
13
|
getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document[]>;
|
|
13
14
|
listCollections(database: string, filter?: Document, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document[]>;
|
|
14
15
|
readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
|
|
15
|
-
watch(pipeline: Document[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string):
|
|
16
|
+
watch(pipeline: Document[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string): ServiceProviderChangeStream;
|
|
16
17
|
getSearchIndexes(database: string, collection: string, indexName?: string, options?: Document, dbOptions?: DbOptions): Promise<Document[]>;
|
|
17
18
|
}
|
package/lib/writable.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RunCursorCommandOptions } from 'mongodb';
|
|
2
2
|
import type { Document, InsertOneOptions, InsertOneResult, Collection, RenameOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, BulkWriteOptions, AnyBulkWriteOperation, DeleteOptions, DeleteResult, InsertManyResult, ReplaceOptions, UpdateResult, UpdateOptions, DropDatabaseOptions, CreateIndexesOptions, DropCollectionOptions, BulkWriteResult, RunCommandOptions, DbOptions, OrderedBulkOperation, UnorderedBulkOperation } from './all-transport-types';
|
|
3
|
+
import type { ServiceProviderRunCommandCursor } from './cursors';
|
|
3
4
|
export default interface Writable {
|
|
4
5
|
runCommand(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
5
6
|
runCommandWithCheck(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
6
|
-
runCursorCommand(db: string, spec: Document, options: RunCursorCommandOptions, dbOptions?: DbOptions):
|
|
7
|
+
runCursorCommand(db: string, spec: Document, options: RunCursorCommandOptions, dbOptions?: DbOptions): ServiceProviderRunCommandCursor;
|
|
7
8
|
dropDatabase(database: string, options: DropDatabaseOptions, dbOptions?: DbOptions): Promise<Document>;
|
|
8
9
|
bulkWrite(database: string, collection: string, requests: AnyBulkWriteOperation[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<BulkWriteResult>;
|
|
9
10
|
deleteMany(database: string, collection: string, filter: Document, options: DeleteOptions, dbOptions?: DbOptions): Promise<DeleteResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/service-provider-core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10",
|
|
4
4
|
"description": "MongoDB Shell Core Service Provider Package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@aws-sdk/credential-providers": "^3.525.0",
|
|
47
|
-
"@mongosh/errors": "2.2.
|
|
47
|
+
"@mongosh/errors": "2.2.10",
|
|
48
48
|
"bson": "^6.7.0",
|
|
49
|
-
"mongodb": "^6.
|
|
49
|
+
"mongodb": "^6.7.0",
|
|
50
50
|
"mongodb-build-info": "^1.7.2",
|
|
51
51
|
"mongodb-client-encryption": "^6.0.0"
|
|
52
52
|
},
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"mongodb-client-encryption": "^6.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@mongodb-js/eslint-config-mongosh": "2.2.
|
|
57
|
+
"@mongodb-js/eslint-config-mongosh": "2.2.10",
|
|
58
58
|
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
59
|
-
"@mongodb-js/tsconfig-mongosh": "2.2.
|
|
59
|
+
"@mongodb-js/tsconfig-mongosh": "2.2.10",
|
|
60
60
|
"depcheck": "^1.4.3",
|
|
61
61
|
"eslint": "^7.25.0",
|
|
62
62
|
"prettier": "^2.8.8"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cf5fc49a73529188a17387e80d9e88b1d9eb904a"
|
|
65
65
|
}
|
package/src/cursors.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CollationOptions,
|
|
3
|
+
CountOptions,
|
|
4
|
+
CursorFlag,
|
|
5
|
+
Document,
|
|
6
|
+
ExplainVerbosityLike,
|
|
7
|
+
ReadConcernLike,
|
|
8
|
+
ReadPreferenceLike,
|
|
9
|
+
ResumeToken,
|
|
10
|
+
} from './all-transport-types';
|
|
11
|
+
|
|
12
|
+
interface ServiceProviderBaseCursor<TSchema = Document> {
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
hasNext(): Promise<boolean>;
|
|
15
|
+
next(): Promise<TSchema | null>;
|
|
16
|
+
tryNext(): Promise<TSchema | null>;
|
|
17
|
+
readonly closed: boolean;
|
|
18
|
+
[Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ServiceProviderAbstractCursor<TSchema = Document>
|
|
22
|
+
extends ServiceProviderBaseCursor<TSchema> {
|
|
23
|
+
batchSize(number: number): void;
|
|
24
|
+
maxTimeMS(value: number): void;
|
|
25
|
+
bufferedCount(): number;
|
|
26
|
+
readBufferedDocuments(number?: number): TSchema[];
|
|
27
|
+
toArray(): Promise<TSchema[]>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ServiceProviderAggregationOrFindCursor<TSchema = Document>
|
|
31
|
+
extends ServiceProviderAbstractCursor<TSchema> {
|
|
32
|
+
project($project: Document): void;
|
|
33
|
+
skip($skip: number): void;
|
|
34
|
+
sort($sort: Document): void;
|
|
35
|
+
explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
|
|
36
|
+
addCursorFlag(flag: CursorFlag, value: boolean): void;
|
|
37
|
+
withReadPreference(readPreference: ReadPreferenceLike): this;
|
|
38
|
+
withReadConcern(readConcern: ReadConcernLike): this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
42
|
+
export interface ServiceProviderRunCommandCursor<TSchema = Document>
|
|
43
|
+
extends ServiceProviderAbstractCursor<TSchema> {}
|
|
44
|
+
|
|
45
|
+
export interface ServiceProviderFindCursor<TSchema = Document>
|
|
46
|
+
extends ServiceProviderAggregationOrFindCursor<TSchema> {
|
|
47
|
+
allowDiskUse(allow?: boolean): void;
|
|
48
|
+
collation(value: CollationOptions): void;
|
|
49
|
+
comment(value: string): void;
|
|
50
|
+
maxAwaitTimeMS(value: number): void;
|
|
51
|
+
count(options?: CountOptions): Promise<number>;
|
|
52
|
+
hint(hint: string | Document): void;
|
|
53
|
+
max(max: Document): void;
|
|
54
|
+
min(min: Document): void;
|
|
55
|
+
limit(value: number): void;
|
|
56
|
+
skip(value: number): void;
|
|
57
|
+
returnKey(value: boolean): void;
|
|
58
|
+
showRecordId(value: boolean): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
62
|
+
export interface ServiceProviderAggregationCursor<TSchema = Document>
|
|
63
|
+
extends ServiceProviderAggregationOrFindCursor<TSchema> {}
|
|
64
|
+
|
|
65
|
+
export interface ServiceProviderChangeStream<TSchema = Document>
|
|
66
|
+
extends ServiceProviderBaseCursor<TSchema> {
|
|
67
|
+
next(): Promise<TSchema>;
|
|
68
|
+
readonly resumeToken: ResumeToken;
|
|
69
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,14 @@ export {
|
|
|
18
18
|
|
|
19
19
|
export { bson } from './bson-export';
|
|
20
20
|
|
|
21
|
+
export {
|
|
22
|
+
ServiceProviderAbstractCursor,
|
|
23
|
+
ServiceProviderAggregationCursor,
|
|
24
|
+
ServiceProviderFindCursor,
|
|
25
|
+
ServiceProviderRunCommandCursor,
|
|
26
|
+
ServiceProviderChangeStream,
|
|
27
|
+
} from './cursors';
|
|
28
|
+
|
|
21
29
|
export {
|
|
22
30
|
ServiceProvider,
|
|
23
31
|
ShellAuthOptions,
|
package/src/readable.ts
CHANGED
|
@@ -8,13 +8,16 @@ import type {
|
|
|
8
8
|
FindOptions,
|
|
9
9
|
ListCollectionsOptions,
|
|
10
10
|
ListIndexesOptions,
|
|
11
|
-
AggregationCursor,
|
|
12
|
-
FindCursor,
|
|
13
11
|
DbOptions,
|
|
14
12
|
ReadPreferenceFromOptions,
|
|
15
13
|
ReadPreferenceLike,
|
|
16
14
|
} from './all-transport-types';
|
|
17
|
-
import type {
|
|
15
|
+
import type { ChangeStreamOptions } from './all-transport-types';
|
|
16
|
+
import type {
|
|
17
|
+
ServiceProviderAggregationCursor,
|
|
18
|
+
ServiceProviderChangeStream,
|
|
19
|
+
ServiceProviderFindCursor,
|
|
20
|
+
} from './cursors';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Interface for read operations in the CRUD specification.
|
|
@@ -37,7 +40,7 @@ export default interface Readable {
|
|
|
37
40
|
pipeline: Document[],
|
|
38
41
|
options?: AggregateOptions,
|
|
39
42
|
dbOptions?: DbOptions
|
|
40
|
-
):
|
|
43
|
+
): ServiceProviderAggregationCursor;
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* Run an aggregation pipeline on the DB.
|
|
@@ -54,7 +57,7 @@ export default interface Readable {
|
|
|
54
57
|
pipeline: Document[],
|
|
55
58
|
options?: AggregateOptions,
|
|
56
59
|
dbOptions?: DbOptions
|
|
57
|
-
):
|
|
60
|
+
): ServiceProviderAggregationCursor;
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
* Returns the count of documents that would match a find() query for the
|
|
@@ -152,7 +155,7 @@ export default interface Readable {
|
|
|
152
155
|
filter?: Document,
|
|
153
156
|
options?: FindOptions,
|
|
154
157
|
dbOptions?: DbOptions
|
|
155
|
-
):
|
|
158
|
+
): ServiceProviderFindCursor;
|
|
156
159
|
|
|
157
160
|
/**
|
|
158
161
|
* Get currently known topology information.
|
|
@@ -215,7 +218,7 @@ export default interface Readable {
|
|
|
215
218
|
dbOptions?: DbOptions,
|
|
216
219
|
db?: string,
|
|
217
220
|
coll?: string
|
|
218
|
-
):
|
|
221
|
+
): ServiceProviderChangeStream;
|
|
219
222
|
|
|
220
223
|
/**
|
|
221
224
|
* Returns an array of documents that identify and describe the existing
|
package/src/writable.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RunCursorCommandOptions } from 'mongodb';
|
|
2
2
|
import type {
|
|
3
3
|
Document,
|
|
4
4
|
InsertOneOptions,
|
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
OrderedBulkOperation,
|
|
26
26
|
UnorderedBulkOperation,
|
|
27
27
|
} from './all-transport-types';
|
|
28
|
+
import type { ServiceProviderRunCommandCursor } from './cursors';
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Interface for write operations in the CRUD specification.
|
|
@@ -70,7 +71,7 @@ export default interface Writable {
|
|
|
70
71
|
spec: Document,
|
|
71
72
|
options: RunCursorCommandOptions,
|
|
72
73
|
dbOptions?: DbOptions
|
|
73
|
-
):
|
|
74
|
+
): ServiceProviderRunCommandCursor;
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
77
|
* Drop a database
|