@mongosh/shell-api 3.20.0 → 3.23.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/lib/api-raw.d.ts CHANGED
@@ -3,26 +3,20 @@
3
3
  import type { Agent } from 'https';
4
4
  import type { AgentConnectOpts } from 'agent-base';
5
5
  import { Binary } from 'bson';
6
+ import type { BSON } from '@mongosh/shell-bson';
6
7
  import { BSONRegExp } from 'bson';
7
- import { BSONSymbol } from 'bson';
8
8
  import { BSONType } from 'bson';
9
- import { calculateObjectSize } from 'bson';
10
9
  import type { ClientRequest } from 'http';
11
- import { Code } from 'bson';
12
10
  import type { ConnectionOptions } from 'tls';
13
- import { DBRef } from 'bson';
14
11
  import { Decimal128 } from 'bson';
15
12
  import type { DeserializeOptions } from 'bson';
16
13
  import { Document as Document_2 } from 'bson';
17
14
  import { Double } from 'bson';
18
15
  import type { Duplex } from 'stream';
19
- import { EJSONOptions } from 'bson';
20
16
  import { EventEmitter } from 'events';
21
17
  import type { IncomingMessage } from 'http';
22
18
  import { Int32 } from 'bson';
23
19
  import { Long } from 'bson';
24
- import { MaxKey } from 'bson';
25
- import { MinKey } from 'bson';
26
20
  import { ObjectId } from 'bson';
27
21
  import type { ObjectIdLike } from 'bson';
28
22
  import { Readable } from 'stream';
@@ -30,6 +24,7 @@ import type { RequestOptions } from 'https';
30
24
  import type { SecureContextOptions } from 'tls';
31
25
  import type { SerializeOptions } from 'bson';
32
26
  import type { ServerResponse } from 'http';
27
+ import { ShellBson } from '@mongosh/shell-bson';
33
28
  import type { SrvRecord } from 'dns';
34
29
  import type { TcpNetConnectOpts } from 'net';
35
30
  import { Timestamp } from 'bson';
@@ -254,33 +249,6 @@ declare abstract class AbstractCursor<TSchema = any, CursorEvents extends Abstra
254
249
  /* Excluded from this release type: throwIfInitialized */
255
250
  }
256
251
 
257
- declare abstract class AbstractCursor_2<CursorType extends ServiceProviderAggregationCursor | ServiceProviderFindCursor | ServiceProviderRunCommandCursor> extends ShellApiWithMongoClass {
258
- _mongo: Mongo;
259
- _cursor: CursorType;
260
- _transform: ((doc: any) => any) | null;
261
- _currentIterationResult: CursorIterationResult | null;
262
- constructor(mongo: Mongo, cursor: CursorType);
263
- [asPrintable](): Promise<CursorIterationResult>;
264
- _it(): Promise<CursorIterationResult>;
265
- batchSize(size: number): this;
266
- close(): Promise<void>;
267
- forEach(f: (doc: Document_2) => void | boolean | Promise<void> | Promise<boolean>): Promise<void>;
268
- hasNext(): Promise<boolean>;
269
- tryNext(): Promise<Document_2 | null>;
270
- _tryNext(): Promise<Document_2 | null>;
271
- _canDelegateIterationToUnderlyingCursor(): boolean;
272
- [Symbol.asyncIterator](): AsyncGenerator<Document_2, void, void>;
273
- isClosed(): boolean;
274
- isExhausted(): boolean;
275
- itcount(): Promise<number>;
276
- toArray(): Promise<Document_2[]>;
277
- pretty(): this;
278
- map(f: (doc: Document_2) => Document_2): this;
279
- maxTimeMS(value: number): this;
280
- next(): Promise<Document_2 | null>;
281
- objsLeftInBatch(): number;
282
- }
283
-
284
252
  /** @public */
285
253
  declare type AbstractCursorEvents = {
286
254
  [AbstractCursor.CLOSE](): void;
@@ -364,6 +332,17 @@ declare interface AbstractCursorOptions extends BSONSerializeOptions {
364
332
  /* Excluded from this release type: timeoutContext */
365
333
  }
366
334
 
335
+ declare abstract class AbstractFiniteCursor<CursorType extends ServiceProviderAggregationCursor | ServiceProviderFindCursor | ServiceProviderRunCommandCursor> extends BaseCursor<CursorType> {
336
+ _currentIterationResult: CursorIterationResult | null;
337
+ constructor(mongo: Mongo, cursor: CursorType);
338
+ [asPrintable](): Promise<CursorIterationResult | string>;
339
+ _it(): Promise<CursorIterationResult>;
340
+ batchSize(size: number): this;
341
+ toArray(): Promise<Document_2[]>;
342
+ maxTimeMS(value: number): this;
343
+ objsLeftInBatch(): number;
344
+ }
345
+
367
346
  /** @public */
368
347
  declare type AcceptedFields<TSchema, FieldType, AssignableType> = {
369
348
  readonly [key in KeysOfAType<TSchema, FieldType>]?: AssignableType;
@@ -474,7 +453,7 @@ declare class Admin {
474
453
  declare interface Admin_2 {
475
454
  platform: ReplPlatform;
476
455
  initialDb: string;
477
- bsonLibrary: typeof bson;
456
+ bsonLibrary: BSON;
478
457
  listDatabases(database: string, options?: ListDatabasesOptions): Promise<Document_2>;
479
458
  getNewConnection(uri: string, options: MongoClientOptions): Promise<any>;
480
459
  getURI(): string | undefined;
@@ -538,7 +517,7 @@ declare interface AggregateOptions extends Omit<CommandOperationOptions, 'explai
538
517
  /* Excluded from this release type: timeoutMode */
539
518
  }
540
519
 
541
- declare abstract class AggregateOrFindCursor<CursorType extends ServiceProviderAggregationCursor | ServiceProviderFindCursor> extends AbstractCursor_2<CursorType> {
520
+ declare abstract class AggregateOrFindCursor<CursorType extends ServiceProviderAggregationCursor | ServiceProviderFindCursor> extends AbstractFiniteCursor<CursorType> {
542
521
  projection(spec: Document_2): this;
543
522
  skip(value: number): this;
544
523
  sort(spec: Document_2): this;
@@ -1039,6 +1018,33 @@ declare type AzureKMSProviderConfiguration = {
1039
1018
  accessToken: string;
1040
1019
  };
1041
1020
 
1021
+ declare abstract class BaseCursor<CursorType extends ServiceProviderBaseCursor> extends ShellApiWithMongoClass {
1022
+ _mongo: Mongo;
1023
+ _cursor: CursorType;
1024
+ _transform: ((doc: any) => any) | null;
1025
+ _blockingWarningDisabled: boolean;
1026
+ constructor(mongo: Mongo, cursor: CursorType);
1027
+ close(): Promise<void>;
1028
+ forEach(f: (doc: Document_2) => void | boolean | Promise<void> | Promise<boolean>): Promise<void>;
1029
+ hasNext(): Promise<boolean>;
1030
+ tryNext(): Promise<Document_2 | null>;
1031
+ _tryNext(): Promise<Document_2 | null>;
1032
+ _canDelegateIterationToUnderlyingCursor(): boolean;
1033
+ [Symbol.asyncIterator](): AsyncGenerator<Document_2, void, void>;
1034
+ isClosed(): boolean;
1035
+ isExhausted(): boolean;
1036
+ itcount(): Promise<number>;
1037
+ pretty(): this;
1038
+ map(f: (doc: Document_2) => Document_2): this;
1039
+ next(): Promise<Document_2 | null>;
1040
+ disableBlockWarnings(): this;
1041
+ abstract batchSize(size: number): this;
1042
+ abstract toArray(): Promise<Document_2[]>;
1043
+ abstract maxTimeMS(value: number): this;
1044
+ abstract objsLeftInBatch(): number;
1045
+ abstract _it(): Promise<CursorIterationResult>;
1046
+ }
1047
+
1042
1048
  declare interface BaseSocks5RequestMetadata {
1043
1049
  srcAddr: string;
1044
1050
  srcPort: number;
@@ -1076,29 +1082,6 @@ declare type BatchType = (typeof BatchType)[keyof typeof BatchType];
1076
1082
  /** @public */
1077
1083
  declare type BitwiseFilter = number /** numeric bit mask */ | Binary /** BinData bit mask */ | ReadonlyArray<number>;
1078
1084
 
1079
- declare const bson: {
1080
- ObjectId: typeof ObjectId;
1081
- DBRef: typeof DBRef;
1082
- MaxKey: typeof MaxKey;
1083
- MinKey: typeof MinKey;
1084
- Timestamp: typeof Timestamp;
1085
- BSONSymbol: typeof BSONSymbol;
1086
- Code: typeof Code;
1087
- Decimal128: typeof Decimal128;
1088
- Int32: typeof Int32;
1089
- Long: typeof Long;
1090
- Binary: typeof Binary;
1091
- calculateObjectSize: typeof calculateObjectSize;
1092
- Double: typeof Double;
1093
- EJSON: {
1094
- parse: (text: string, options?: EJSONOptions) => any;
1095
- stringify: (value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONOptions, space?: string | number, options?: EJSONOptions) => string;
1096
- serialize: (value: any, options?: EJSONOptions) => Document_2;
1097
- deserialize: (ejson: Document_2, options?: EJSONOptions) => any;
1098
- };
1099
- BSONRegExp: typeof BSONRegExp;
1100
- };
1101
-
1102
1085
  /**
1103
1086
  * BSON Serialization options.
1104
1087
  * @public
@@ -1486,28 +1469,21 @@ declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCo
1486
1469
  operationType: 'createIndexes';
1487
1470
  }
1488
1471
 
1489
- declare class ChangeStreamCursor extends ShellApiWithMongoClass {
1490
- _mongo: Mongo;
1491
- _cursor: ServiceProviderChangeStream<Document_2>;
1472
+ declare class ChangeStreamCursor extends BaseCursor<ServiceProviderChangeStream> {
1492
1473
  _currentIterationResult: CursorIterationResult | null;
1493
1474
  _on: string;
1494
- constructor(cursor: ServiceProviderChangeStream<Document_2>, on: string, mongo: Mongo);
1475
+ constructor(cursor: ServiceProviderChangeStream, on: string, mongo: Mongo);
1495
1476
  _it(): Promise<CursorIterationResult>;
1496
- [asPrintable](): string;
1497
- close(): Promise<void>;
1477
+ [asPrintable](): Promise<string>;
1498
1478
  hasNext(): Promise<boolean>;
1499
1479
  tryNext(): Promise<Document_2 | null>;
1500
- [Symbol.asyncIterator](): AsyncGenerator<Document_2, void, unknown>;
1501
- isClosed(): boolean;
1502
1480
  isExhausted(): never;
1503
- itcount(): Promise<number>;
1504
1481
  next(): Promise<Document_2>;
1505
1482
  getResumeToken(): ResumeToken;
1506
- map(): ChangeStreamCursor;
1507
- forEach(): Promise<void>;
1508
- toArray(): Promise<Document_2[]>;
1509
- objsLeftInBatch(): void;
1510
- pretty(): ChangeStreamCursor;
1483
+ toArray(): never;
1484
+ batchSize(): never;
1485
+ objsLeftInBatch(): never;
1486
+ maxTimeMS(): never;
1511
1487
  }
1512
1488
 
1513
1489
  /**
@@ -2376,7 +2352,7 @@ declare interface ClientEncryptionEncryptOptions {
2376
2352
  /**
2377
2353
  * The algorithm to use for encryption.
2378
2354
  */
2379
- algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range';
2355
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random' | 'Indexed' | 'Unindexed' | 'Range' | 'TextPreview';
2380
2356
  /**
2381
2357
  * The id of the Binary dataKey to use for encryption
2382
2358
  */
@@ -2390,9 +2366,15 @@ declare interface ClientEncryptionEncryptOptions {
2390
2366
  /**
2391
2367
  * The query type.
2392
2368
  */
2393
- queryType?: 'equality' | 'range';
2369
+ queryType?: 'equality' | 'range' | 'prefixPreview' | 'suffixPreview' | 'substringPreview';
2394
2370
  /** The index options for a Queryable Encryption field supporting "range" queries.*/
2395
2371
  rangeOptions?: RangeOptions;
2372
+ /**
2373
+ * Options for a Queryable Encryption field supporting text queries. Only valid when `algorithm` is `TextPreview`.
2374
+ *
2375
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
2376
+ */
2377
+ textOptions?: TextQueryOptions;
2396
2378
  }
2397
2379
 
2398
2380
  /**
@@ -2483,7 +2465,7 @@ declare interface ClientEncryptionRewrapManyDataKeyProviderOptions {
2483
2465
  *
2484
2466
  * These options are not included in the type, and are ignored if provided.
2485
2467
  */
2486
- declare type ClientEncryptionTlsOptions = Pick<MongoClientOptions, 'tlsCAFile' | 'tlsCertificateKeyFile' | 'tlsCertificateKeyFilePassword'>;
2468
+ declare type ClientEncryptionTlsOptions = Pick<MongoClientOptions, 'tlsCAFile' | 'tlsCertificateKeyFile' | 'tlsCertificateKeyFilePassword' | 'secureContext'>;
2487
2469
 
2488
2470
  /** @public */
2489
2471
  declare interface ClientInsertOneModel<TSchema> extends ClientWriteModel {
@@ -3167,10 +3149,10 @@ declare class Collection_2<TSchema extends Document_2 = Document_2> {
3167
3149
  */
3168
3150
  findOne(): Promise<WithId<TSchema> | null>;
3169
3151
  findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
3170
- findOne(filter: Filter<TSchema>, options: Omit<FindOptions, 'timeoutMode'> & Abortable): Promise<WithId<TSchema> | null>;
3152
+ findOne(filter: Filter<TSchema>, options: Omit<FindOneOptions, 'timeoutMode'> & Abortable): Promise<WithId<TSchema> | null>;
3171
3153
  findOne<T = TSchema>(): Promise<T | null>;
3172
3154
  findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
3173
- findOne<T = TSchema>(filter: Filter<TSchema>, options?: Omit<FindOptions, 'timeoutMode'> & Abortable): Promise<T | null>;
3155
+ findOne<T = TSchema>(filter: Filter<TSchema>, options?: Omit<FindOneOptions, 'timeoutMode'> & Abortable): Promise<T | null>;
3174
3156
  /**
3175
3157
  * Creates a cursor for a filter that can be used to iterate over results from MongoDB
3176
3158
  *
@@ -3344,6 +3326,9 @@ declare class Collection_2<TSchema extends Document_2 = Document_2> {
3344
3326
  distinct<Key extends keyof WithId<TSchema>>(key: Key): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3345
3327
  distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3346
3328
  distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>, options: DistinctOptions): Promise<Array<Flatten<WithId<TSchema>[Key]>>>;
3329
+ distinct<Key extends keyof WithId<TSchema>>(key: Key, filter: Filter<TSchema>, options: DistinctOptions & {
3330
+ explain: ExplainVerbosityLike | ExplainCommandOptions;
3331
+ }): Promise<Document_2>;
3347
3332
  distinct(key: string): Promise<any[]>;
3348
3333
  distinct(key: string, filter: Filter<TSchema>): Promise<any[]>;
3349
3334
  distinct(key: string, filter: Filter<TSchema>, options: DistinctOptions): Promise<any[]>;
@@ -5465,6 +5450,16 @@ declare interface FindOneAndUpdateOptions extends CommandOperationOptions {
5465
5450
  includeResultMetadata?: boolean;
5466
5451
  }
5467
5452
 
5453
+ /** @public */
5454
+ declare interface FindOneOptions extends FindOptions {
5455
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5456
+ batchSize?: number;
5457
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5458
+ limit?: number;
5459
+ /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
5460
+ noCursorTimeout?: boolean;
5461
+ }
5462
+
5468
5463
  /**
5469
5464
  * A builder object that is returned from {@link BulkOperationBase#find}.
5470
5465
  * Is used to build a write operation that involves a query filter.
@@ -5669,30 +5664,6 @@ declare interface HedgeOptions {
5669
5664
  enabled?: boolean;
5670
5665
  }
5671
5666
 
5672
- declare class Help {
5673
- private help;
5674
- private docs;
5675
- private attr;
5676
- constructor(properties: HelpProperties, options?: HelpOptions);
5677
- [asPrintable](): HelpProperties;
5678
- get [shellApiType](): string;
5679
- }
5680
-
5681
- declare type HelpOptions = {
5682
- translate(key: string): string | undefined;
5683
- };
5684
-
5685
- declare type HelpProperties = {
5686
- help: string;
5687
- docs?: string;
5688
- attr?: HelpPropertiesAttr[];
5689
- };
5690
-
5691
- declare type HelpPropertiesAttr = {
5692
- name?: string;
5693
- description: string;
5694
- };
5695
-
5696
5667
  /** @public */
5697
5668
  declare type Hint = string | Document_2;
5698
5669
 
@@ -6337,8 +6308,6 @@ declare interface LogComponentSeveritiesClientOptions {
6337
6308
  default?: SeverityLevel;
6338
6309
  }
6339
6310
 
6340
- declare type LongWithoutAccidentallyExposedMethods = Omit<typeof bson.Long, 'fromExtendedJSON'>;
6341
-
6342
6311
  declare type MapReduceShellOptions = Document_2 | string;
6343
6312
 
6344
6313
  declare type MasterKey = AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions;
@@ -6384,7 +6353,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6384
6353
  _listDatabases(opts?: ListDatabasesOptions): Promise<{
6385
6354
  databases: {
6386
6355
  name: string;
6387
- sizeOnDisk: number | ShellBson['Long'];
6356
+ sizeOnDisk: number | BSON['Long']['prototype'];
6388
6357
  empty: boolean;
6389
6358
  }[];
6390
6359
  ok: 1;
@@ -6393,7 +6362,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6393
6362
  getDBs(options?: ListDatabasesOptions): Promise<{
6394
6363
  databases: {
6395
6364
  name: string;
6396
- sizeOnDisk: number | ShellBson['Long'];
6365
+ sizeOnDisk: number | BSON['Long']['prototype'];
6397
6366
  empty: boolean;
6398
6367
  }[];
6399
6368
  ok: 1;
@@ -6423,7 +6392,7 @@ export declare class Mongo<M extends GenericServerSideSchema = GenericServerSide
6423
6392
  watch(pipeline?: MQLPipeline | ChangeStreamOptions, options?: ChangeStreamOptions): Promise<ChangeStreamCursor>;
6424
6393
  getClientEncryption(): ClientEncryption_2;
6425
6394
  getKeyVault(): Promise<KeyVault>;
6426
- convertShardKeyToHashed(value: any): Promise<unknown>;
6395
+ convertShardKeyToHashed(value: any): Promise<ShellBson['Long']['prototype']>;
6427
6396
  }
6428
6397
 
6429
6398
  /** @public */
@@ -7052,7 +7021,7 @@ declare interface MongoDBOIDCLogEventsMap {
7052
7021
  }) => void;
7053
7022
  'mongodb-oidc-plugin:skip-auth-attempt': (event: {
7054
7023
  authStateId: string;
7055
- reason: string;
7024
+ reason: 'not-expired' | 'not-expired-refresh-failed' | 'refresh-succeeded';
7056
7025
  }) => void;
7057
7026
  'mongodb-oidc-plugin:auth-failed': (event: {
7058
7027
  authStateId: string;
@@ -7641,7 +7610,6 @@ declare interface OperationOptions extends BSONSerializeOptions {
7641
7610
  /** The preferred read preference (ReadPreference.primary, ReadPreference.primary_preferred, ReadPreference.secondary, ReadPreference.secondary_preferred, ReadPreference.nearest). */
7642
7611
  readPreference?: ReadPreferenceLike;
7643
7612
  /* Excluded from this release type: bypassPinningCheck */
7644
- omitReadPreference?: boolean;
7645
7613
  /* Excluded from this release type: omitMaxTimeMS */
7646
7614
  /**
7647
7615
  * @experimental
@@ -7825,7 +7793,7 @@ declare interface Readable_2 {
7825
7793
  distinct(database: string, collection: string, fieldName: string, filter?: Document_2, options?: DistinctOptions, dbOptions?: DbOptions): Promise<Document_2>;
7826
7794
  estimatedDocumentCount(database: string, collection: string, options?: EstimatedDocumentCountOptions, dbOptions?: DbOptions): Promise<number>;
7827
7795
  find(database: string, collection: string, filter?: Document_2, options?: FindOptions, dbOptions?: DbOptions): ServiceProviderFindCursor;
7828
- getTopology(): any;
7796
+ getTopologyDescription(): TopologyDescription_2 | undefined;
7829
7797
  getIndexes(database: string, collection: string, options: ListIndexesOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7830
7798
  listCollections(database: string, filter?: Document_2, options?: ListCollectionsOptions, dbOptions?: DbOptions): Promise<Document_2[]>;
7831
7799
  readPreferenceFromOptions(options?: Omit<ReadPreferenceFromOptions, 'session'>): ReadPreferenceLike | undefined;
@@ -8179,7 +8147,7 @@ declare class RunCommandCursor extends AbstractCursor {
8179
8147
  /* Excluded from this release type: getMore */
8180
8148
  }
8181
8149
 
8182
- declare class RunCommandCursor_2 extends AbstractCursor_2<ServiceProviderRunCommandCursor> {
8150
+ declare class RunCommandCursor_2 extends AbstractFiniteCursor<ServiceProviderRunCommandCursor> {
8183
8151
  constructor(mongo: Mongo, cursor: ServiceProviderRunCommandCursor);
8184
8152
  }
8185
8153
 
@@ -8195,7 +8163,8 @@ declare type RunCommandOptions = {
8195
8163
  */
8196
8164
  timeoutMS?: number;
8197
8165
  /* Excluded from this release type: omitMaxTimeMS */
8198
- } & BSONSerializeOptions;
8166
+ /* Excluded from this release type: bypassPinningCheck */
8167
+ } & BSONSerializeOptions & Abortable;
8199
8168
 
8200
8169
  /** @public */
8201
8170
  declare type RunCursorCommandOptions = {
@@ -8345,6 +8314,11 @@ declare class ServerDescription {
8345
8314
  equals(other?: ServerDescription | null): boolean;
8346
8315
  }
8347
8316
 
8317
+ declare interface ServerDescription_2 {
8318
+ type?: ServerType;
8319
+ setName?: string | null;
8320
+ }
8321
+
8348
8322
  /**
8349
8323
  * Emitted when server description changes, but does NOT include changes to the RTT.
8350
8324
  * @public
@@ -8740,7 +8714,7 @@ export declare class ShellApi extends ShellApiClass {
8740
8714
  api?: ServerApi | ServerApiVersion;
8741
8715
  }): Promise<Mongo>;
8742
8716
  connect(uri: string, user?: string, pwd?: string): Promise<DatabaseWithSchema>;
8743
- it(): Promise<any>;
8717
+ it(): Promise<CursorIterationResult>;
8744
8718
  version(): string;
8745
8719
  load(filename: string): Promise<true>;
8746
8720
  enableTelemetry(): Promise<any>;
@@ -8783,36 +8757,7 @@ declare interface ShellAuthOptions {
8783
8757
  authDb?: string;
8784
8758
  }
8785
8759
 
8786
- export declare type ShellBson = WithHelp<ShellBsonBase>;
8787
-
8788
- declare interface ShellBsonBase {
8789
- DBRef: (namespace: string, oid: any, db?: string, fields?: Document_2) => typeof bson.DBRef.prototype;
8790
- bsonsize: (object: any) => number;
8791
- MaxKey: () => typeof bson.MaxKey.prototype;
8792
- MinKey: () => typeof bson.MinKey.prototype;
8793
- ObjectId: (id?: string | number | typeof bson.ObjectId.prototype | Buffer) => typeof bson.ObjectId.prototype;
8794
- Timestamp: (t?: number | typeof bson.Long.prototype | {
8795
- t: number;
8796
- i: number;
8797
- }, i?: number) => typeof bson.Timestamp.prototype;
8798
- Code: (c?: string | Function, s?: any) => typeof bson.Code.prototype;
8799
- NumberDecimal: (s?: string) => typeof bson.Decimal128.prototype;
8800
- NumberInt: (v?: string) => typeof bson.Int32.prototype;
8801
- NumberLong: (s?: string | number) => typeof bson.Long.prototype;
8802
- ISODate: (input?: string) => Date;
8803
- BinData: (subtype: number, b64string: string) => Binary;
8804
- HexData: (subtype: number, hexstr: string) => Binary;
8805
- UUID: (hexstr?: string) => Binary;
8806
- MD5: (hexstr: string) => Binary;
8807
- Decimal128: typeof bson.Decimal128;
8808
- BSONSymbol: typeof bson.BSONSymbol;
8809
- Int32: typeof bson.Int32;
8810
- Long: LongWithoutAccidentallyExposedMethods;
8811
- Binary: typeof bson.Binary;
8812
- Double: typeof bson.Double;
8813
- EJSON: typeof bson.EJSON;
8814
- BSONRegExp: typeof bson.BSONRegExp;
8815
- }
8760
+ export { ShellBson }
8816
8761
 
8817
8762
  declare interface ShellCliOptions {
8818
8763
  nodb?: boolean;
@@ -8830,7 +8775,7 @@ declare class ShellConfig extends ShellApiClass {
8830
8775
  }
8831
8776
 
8832
8777
  declare class ShellInstanceState {
8833
- currentCursor: Cursor | AggregationCursor_2 | ChangeStreamCursor | RunCommandCursor_2 | null;
8778
+ currentCursor: BaseCursor<ServiceProviderBaseCursor> | null;
8834
8779
  currentDb: DatabaseWithSchema;
8835
8780
  messageBus: MongoshBus;
8836
8781
  initialServiceProvider: ServiceProvider;
@@ -8855,6 +8800,7 @@ declare class ShellInstanceState {
8855
8800
  private alreadyTransformedErrors;
8856
8801
  private preFetchCollectionAndDatabaseNames;
8857
8802
  constructor(initialServiceProvider: ServiceProvider, messageBus?: any, cliOptions?: ShellCliOptions);
8803
+ private constructShellBson;
8858
8804
  fetchConnectionInfo(): Promise<ConnectionInfo_2 | undefined>;
8859
8805
  cachedConnectionInfo(): ConnectionInfo_2 | undefined;
8860
8806
  close(): Promise<void>;
@@ -9069,6 +9015,39 @@ declare type TagSet = {
9069
9015
  [key: string]: string;
9070
9016
  };
9071
9017
 
9018
+ /**
9019
+ * Options for a Queryable Encryption field supporting text queries.
9020
+ *
9021
+ * @public
9022
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
9023
+ */
9024
+ declare interface TextQueryOptions {
9025
+ /** Indicates that text indexes for this field are case sensitive */
9026
+ caseSensitive: boolean;
9027
+ /** Indicates that text indexes for this field are diacritic sensitive. */
9028
+ diacriticSensitive: boolean;
9029
+ prefix?: {
9030
+ /** The maximum allowed query length. */
9031
+ strMaxQueryLength: Int32 | number;
9032
+ /** The minimum allowed query length. */
9033
+ strMinQueryLength: Int32 | number;
9034
+ };
9035
+ suffix?: {
9036
+ /** The maximum allowed query length. */
9037
+ strMaxQueryLength: Int32 | number;
9038
+ /** The minimum allowed query length. */
9039
+ strMinQueryLength: Int32 | number;
9040
+ };
9041
+ substring?: {
9042
+ /** The maximum allowed length to insert. */
9043
+ strMaxLength: Int32 | number;
9044
+ /** The maximum allowed query length. */
9045
+ strMaxQueryLength: Int32 | number;
9046
+ /** The minimum allowed query length. */
9047
+ strMinQueryLength: Int32 | number;
9048
+ };
9049
+ }
9050
+
9072
9051
  /** @public
9073
9052
  * Configuration options for timeseries collections
9074
9053
  * @see https://www.mongodb.com/docs/manual/core/timeseries-collections/
@@ -9142,6 +9121,12 @@ declare class TopologyDescription {
9142
9121
  toJSON(): Document_2;
9143
9122
  }
9144
9123
 
9124
+ declare interface TopologyDescription_2 {
9125
+ type?: TopologyType;
9126
+ setName?: string | null;
9127
+ servers?: Map<string, ServerDescription_2>;
9128
+ }
9129
+
9145
9130
  /**
9146
9131
  * Emitted when topology description changes.
9147
9132
  * @public
@@ -9516,12 +9501,6 @@ declare interface ValidateCollectionOptions extends CommandOperationOptions {
9516
9501
  /** @public */
9517
9502
  declare type W = number | 'majority';
9518
9503
 
9519
- declare type WithHelp<T> = {
9520
- [prop in keyof T]: T[prop] & {
9521
- help?: () => Help;
9522
- };
9523
- };
9524
-
9525
9504
  /** Add an _id field to an object shaped type @public */
9526
9505
  declare type WithId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
9527
9506
  _id: InferIdType<TSchema>;
package/lib/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CollectionWithSchema } from './collection';
2
- export { ShellBson } from './shell-bson';
2
+ export { ShellBson } from '@mongosh/shell-bson';
3
3
  export { Streams } from './streams';
4
4
  export { DatabaseWithSchema } from './database';
5
5
  import Shard from './shard';
@@ -1,28 +1,21 @@
1
- import { ShellApiWithMongoClass } from './decorators';
2
1
  import type { ServiceProviderChangeStream, Document, ResumeToken } from '@mongosh/service-provider-core';
3
2
  import { CursorIterationResult } from './result';
4
3
  import { asPrintable } from './enums';
5
4
  import type Mongo from './mongo';
6
- export default class ChangeStreamCursor extends ShellApiWithMongoClass {
7
- _mongo: Mongo;
8
- _cursor: ServiceProviderChangeStream<Document>;
5
+ import { BaseCursor } from './abstract-cursor';
6
+ export default class ChangeStreamCursor extends BaseCursor<ServiceProviderChangeStream> {
9
7
  _currentIterationResult: CursorIterationResult | null;
10
8
  _on: string;
11
- constructor(cursor: ServiceProviderChangeStream<Document>, on: string, mongo: Mongo);
9
+ constructor(cursor: ServiceProviderChangeStream, on: string, mongo: Mongo);
12
10
  _it(): Promise<CursorIterationResult>;
13
- [asPrintable](): string;
14
- close(): Promise<void>;
11
+ [asPrintable](): Promise<string>;
15
12
  hasNext(): Promise<boolean>;
16
13
  tryNext(): Promise<Document | null>;
17
- [Symbol.asyncIterator](): AsyncGenerator<Document, void, unknown>;
18
- isClosed(): boolean;
19
14
  isExhausted(): never;
20
- itcount(): Promise<number>;
21
15
  next(): Promise<Document>;
22
16
  getResumeToken(): ResumeToken;
23
- map(): ChangeStreamCursor;
24
- forEach(): Promise<void>;
25
- toArray(): Promise<Document[]>;
26
- objsLeftInBatch(): void;
27
- pretty(): ChangeStreamCursor;
17
+ toArray(): never;
18
+ batchSize(): never;
19
+ objsLeftInBatch(): never;
20
+ maxTimeMS(): never;
28
21
  }