@mongosh/service-provider-core 1.9.0 → 1.10.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.
package/AUTHORS CHANGED
@@ -13,3 +13,4 @@ Leonardo Rossi <leonardo.rossi@gmail.com>
13
13
  Le Roux Bodenstein <lerouxb@gmail.com>
14
14
  Bailey Pearson <bailey.pearson@mongodb.com>
15
15
  Himanshu Singh <himanshu.singhs@outlook.in>
16
+ Martin Rodriguez Reboredo <yakoyoku@gmail.com>
package/lib/admin.d.ts CHANGED
@@ -10,6 +10,12 @@ export interface CreateEncryptedCollectionOptions {
10
10
  };
11
11
  masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions;
12
12
  }
13
+ export interface CheckMetadataConsistencyOptions {
14
+ cursor?: {
15
+ batchSize: number;
16
+ };
17
+ checkIndexes?: 1;
18
+ }
13
19
  export default interface Admin {
14
20
  platform: ReplPlatform;
15
21
  initialDb: string;
@@ -1 +1 @@
1
- export type { AggregateOptions, AggregationCursor, AnyBulkWriteOperation, Batch, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, ClientSession, CloseOptions, CollationOptions, CollStatsOptions, Collection, CommandOperationOptions, CountDocumentsOptions, CountOptions, CreateCollectionOptions, CreateIndexesOptions, ClientSessionOptions, ClusterTime, FindCursor, CursorFlag, Db, DbOptions, DeleteOptions, DeleteResult, DistinctOptions, Document, DropCollectionOptions, DropDatabaseOptions, EstimatedDocumentCountOptions, ExplainOptions, ExplainVerbosityLike, FindOneAndDeleteOptions, FindOneAndUpdateOptions, FindOneAndReplaceOptions, FindOperators, FindOptions, HedgeOptions, IndexDescription, InsertManyResult, InsertOneOptions, InsertOneResult, ListCollectionsOptions, ListDatabasesOptions, ListIndexesOptions, MongoClientOptions, OrderedBulkOperation, ReadConcern, ReadConcernLike, ReadConcernLevel, ReadPreference, ReadPreferenceLike, ReadPreferenceFromOptions, ReadPreferenceMode, RenameOptions, ReplaceOptions, ResumeToken, RunCommandOptions, ServerSessionId, TagSet, TransactionOptions, UpdateOptions, UpdateResult, UnorderedBulkOperation, WriteConcern, ObjectId as ObjectIdType, Timestamp as TimestampType, Binary as BinaryType, TopologyDescription, TopologyType, ServerType, AutoEncryptionOptions, ServerApi, ServerApiVersion, MongoClient } from 'mongodb';
1
+ export type { AggregateOptions, AggregationCursor, AnyBulkWriteOperation, Batch, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamOptions, ClientSession, CloseOptions, CollationOptions, CollStatsOptions, Collection, CommandOperationOptions, CountDocumentsOptions, CountOptions, CreateCollectionOptions, CreateIndexesOptions, ClientSessionOptions, ClusterTime, FindCursor, CursorFlag, RunCommandCursor, Db, DbOptions, DeleteOptions, DeleteResult, DistinctOptions, Document, DropCollectionOptions, DropDatabaseOptions, EstimatedDocumentCountOptions, ExplainOptions, ExplainVerbosityLike, FindOneAndDeleteOptions, FindOneAndUpdateOptions, FindOneAndReplaceOptions, FindOperators, FindOptions, HedgeOptions, IndexDescription, InsertManyResult, InsertOneOptions, InsertOneResult, ListCollectionsOptions, ListDatabasesOptions, ListIndexesOptions, MongoClientOptions, OrderedBulkOperation, ReadConcern, ReadConcernLike, ReadConcernLevel, ReadPreference, ReadPreferenceLike, ReadPreferenceFromOptions, ReadPreferenceMode, RenameOptions, ReplaceOptions, ResumeToken, RunCommandOptions, ServerSessionId, TagSet, TransactionOptions, UpdateOptions, UpdateResult, UnorderedBulkOperation, WriteConcern, ObjectId as ObjectIdType, Timestamp as TimestampType, Binary as BinaryType, TopologyDescription, TopologyType, ServerType, AutoEncryptionOptions, ServerApi, ServerApiVersion, MongoClient } from 'mongodb';
package/lib/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import ShellAuthOptions from './shell-auth-options';
9
9
  export * from './all-transport-types';
10
10
  export * from './all-fle-types';
11
11
  export { MapReduceOptions, FinalizeFunction } from './map-reduce-options';
12
- export { CreateEncryptedCollectionOptions } from './admin';
12
+ export { CreateEncryptedCollectionOptions, CheckMetadataConsistencyOptions } from './admin';
13
13
  declare const bson: {
14
14
  ObjectId: typeof ObjectId;
15
15
  DBRef: typeof DBRef;
package/lib/readable.d.ts CHANGED
@@ -13,4 +13,5 @@ export default interface Readable {
13
13
  listCollections(database: string, filter?: Document, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document[]>;
14
14
  readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
15
15
  watch(pipeline: Document[], options: ChangeStreamOptions, dbOptions?: DbOptions, db?: string, coll?: string): ChangeStream<Document>;
16
+ getSearchIndexes(database: string, collection: string, indexName?: string, options?: Document, dbOptions?: DbOptions): Promise<Document[]>;
16
17
  }
package/lib/writable.d.ts CHANGED
@@ -1,7 +1,9 @@
1
+ import { RunCommandCursor, RunCursorCommandOptions } from 'mongodb';
1
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';
2
3
  export default interface Writable {
3
4
  runCommand(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
4
5
  runCommandWithCheck(db: string, spec: Document, options: RunCommandOptions, dbOptions?: DbOptions): Promise<Document>;
6
+ runCursorCommand(db: string, spec: Document, options: RunCursorCommandOptions, dbOptions?: DbOptions): RunCommandCursor;
5
7
  dropDatabase(database: string, options: DropDatabaseOptions, dbOptions?: DbOptions): Promise<Document>;
6
8
  bulkWrite(database: string, collection: string, requests: AnyBulkWriteOperation[], options: BulkWriteOptions, dbOptions?: DbOptions): Promise<BulkWriteResult>;
7
9
  deleteMany(database: string, collection: string, filter: Document, options: DeleteOptions, dbOptions?: DbOptions): Promise<DeleteResult>;
@@ -18,4 +20,10 @@ export default interface Writable {
18
20
  dropCollection(database: string, collection: string, options: DropCollectionOptions, dbOptions?: DbOptions): Promise<boolean>;
19
21
  renameCollection(database: string, oldName: string, newName: string, options?: RenameOptions, dbOptions?: DbOptions): Promise<Collection>;
20
22
  initializeBulkOp(dbName: string, collName: string, ordered: boolean, options?: BulkWriteOptions, dbOptions?: DbOptions): Promise<OrderedBulkOperation | UnorderedBulkOperation>;
23
+ createSearchIndexes(database: string, collection: string, specs: {
24
+ name: string;
25
+ definition: Document;
26
+ }[], dbOptions?: DbOptions): Promise<string[]>;
27
+ dropSearchIndex(database: string, collection: string, index: string, dbOptions?: DbOptions): Promise<void>;
28
+ updateSearchIndex(database: string, collection: string, index: string, definition: Document, dbOptions?: DbOptions): Promise<void>;
21
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongosh/service-provider-core",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "MongoDB Shell Core Service Provider Package",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -37,10 +37,10 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "@aws-sdk/credential-providers": "^3.262.0",
41
- "@mongosh/errors": "1.9.0",
40
+ "@aws-sdk/credential-providers": "^3.347.1",
41
+ "@mongosh/errors": "1.10.0",
42
42
  "bson": "^5.2.0",
43
- "mongodb": "^5.5.0",
43
+ "mongodb": "^5.6.0",
44
44
  "mongodb-build-info": "^1.5.0",
45
45
  "mongodb-client-encryption": "^2.8.0"
46
46
  },
@@ -58,5 +58,5 @@
58
58
  "encoding"
59
59
  ]
60
60
  },
61
- "gitHead": "938c3c1cdd0f8511b40a08c22e440106d4572b2b"
61
+ "gitHead": "6a6f97712a596a21c61408dfb925e729306030f8"
62
62
  }
package/src/admin.ts CHANGED
@@ -30,6 +30,13 @@ export interface CreateEncryptedCollectionOptions {
30
30
  masterKey?: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions;
31
31
  }
32
32
 
33
+ export interface CheckMetadataConsistencyOptions {
34
+ cursor?: {
35
+ batchSize: number
36
+ },
37
+ checkIndexes?: 1
38
+ }
39
+
33
40
  export default interface Admin {
34
41
  /**
35
42
  * What platform (Compass/CLI/Browser)
@@ -21,6 +21,7 @@ export type {
21
21
  ClusterTime,
22
22
  FindCursor,
23
23
  CursorFlag,
24
+ RunCommandCursor,
24
25
  Db,
25
26
  DbOptions,
26
27
  DeleteOptions,
package/src/index.ts CHANGED
@@ -27,7 +27,7 @@ export * from './all-fle-types';
27
27
 
28
28
  export { MapReduceOptions, FinalizeFunction } from './map-reduce-options';
29
29
 
30
- export { CreateEncryptedCollectionOptions } from './admin';
30
+ export { CreateEncryptedCollectionOptions, CheckMetadataConsistencyOptions } from './admin';
31
31
 
32
32
  const bson = {
33
33
  ObjectId,
package/src/readable.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  FindCursor,
13
13
  DbOptions,
14
14
  ReadPreferenceFromOptions,
15
- ReadPreferenceLike
15
+ ReadPreferenceLike,
16
16
  } from './all-transport-types';
17
17
  import { ChangeStream, ChangeStreamOptions } from './all-transport-types';
18
18
 
@@ -206,5 +206,24 @@ export default interface Readable {
206
206
  db?: string,
207
207
  coll?: string
208
208
  ): ChangeStream<Document>;
209
+
210
+ /**
211
+ * Returns an array of documents that identify and describe the existing
212
+ * search indexes on the collection.
213
+ *
214
+ * @param {String} database - The db name.
215
+ * @param {String} collection - The collection name.
216
+ * @param {Document} options - The command options.
217
+ * @param {DbOptions} dbOptions - The database options
218
+ *
219
+ * @return {Promise}
220
+ */
221
+ getSearchIndexes(
222
+ database: string,
223
+ collection: string,
224
+ indexName?: string,
225
+ // TODO(MONGOSH-1471): use ListSearchIndexesOptions once available
226
+ options?: Document,
227
+ dbOptions?: DbOptions): Promise<Document[]>;
209
228
  }
210
229
 
package/src/writable.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { RunCommandCursor, RunCursorCommandOptions } from 'mongodb';
1
2
  import type {
2
3
  Document,
3
4
  InsertOneOptions,
@@ -58,6 +59,20 @@ export default interface Writable {
58
59
  dbOptions?: DbOptions
59
60
  ): Promise<Document>;
60
61
 
62
+ /**
63
+ * @param {String} db - the db name
64
+ * @param spec
65
+ * @param options
66
+ * @param {DbOptions} dbOptions - The database options
67
+ * @return {Promise<Document>}
68
+ */
69
+ runCursorCommand(
70
+ db: string,
71
+ spec: Document,
72
+ options: RunCursorCommandOptions,
73
+ dbOptions?: DbOptions
74
+ ): RunCommandCursor;
75
+
61
76
  /**
62
77
  * Drop a database
63
78
  *
@@ -345,5 +360,54 @@ export default interface Writable {
345
360
  options?: BulkWriteOptions,
346
361
  dbOptions?: DbOptions
347
362
  ): Promise<OrderedBulkOperation | UnorderedBulkOperation>;
363
+
364
+ /**
365
+ * Adds new search indexes to a collection.
366
+ *
367
+ * @param {String} database - The db name.
368
+ * @param {String} collection - The collection name.
369
+ * @param {Object[]} descriptions - The specs of the indexes to be created.
370
+ * @param {DbOptions} dbOptions - The database options
371
+ */
372
+ createSearchIndexes(
373
+ database: string,
374
+ collection: string,
375
+ // TODO(MONGOSH-1471): use SearchIndexDescription[] once available
376
+ specs: {name: string, definition: Document}[],
377
+ dbOptions?: DbOptions
378
+ ): Promise<string[]>
379
+
380
+ /**
381
+ * Drops a search index.
382
+ *
383
+ * @param {String} database - The db name.
384
+ * @param {String} collection - The collection name.
385
+ * @param {String} indexName - The index name
386
+ * @param {DbOptions} dbOptions - The database options
387
+ */
388
+ dropSearchIndex(
389
+ database: string,
390
+ collection: string,
391
+ index: string,
392
+ dbOptions?: DbOptions
393
+ ): Promise<void>
394
+
395
+ /**
396
+ * Update a search index.
397
+ *
398
+ * @param {String} database - The db name.
399
+ * @param {String} collection - The collection name.
400
+ * @param {String} indexName - The index name.
401
+ * @param {Object} description - The update.
402
+ * @param {DbOptions} dbOptions - The database options
403
+ */
404
+ updateSearchIndex(
405
+ database: string,
406
+ collection: string,
407
+ index: string,
408
+ // TODO(MONGOSH-1471): use SearchIndexDescription once available
409
+ definition: Document,
410
+ dbOptions?: DbOptions
411
+ ): Promise<void>
348
412
  }
349
413