@event-driven-io/pongo 0.17.0-beta.35 → 0.17.0-beta.36

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.
Files changed (61) hide show
  1. package/dist/cli.cjs +311 -494
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.d.cts +4 -4
  4. package/dist/cli.d.ts +4 -3
  5. package/dist/cli.js +279 -494
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cloudflare.cjs +36 -48
  8. package/dist/cloudflare.cjs.map +1 -1
  9. package/dist/cloudflare.d.cts +7 -7
  10. package/dist/cloudflare.d.ts +7 -7
  11. package/dist/cloudflare.js +29 -47
  12. package/dist/cloudflare.js.map +1 -1
  13. package/dist/core-CwxxuUAn.cjs +1590 -0
  14. package/dist/core-CwxxuUAn.cjs.map +1 -0
  15. package/dist/core-D_iZiiYe.js +1308 -0
  16. package/dist/core-D_iZiiYe.js.map +1 -0
  17. package/dist/core-DwoTLYbR.cjs +319 -0
  18. package/dist/core-DwoTLYbR.cjs.map +1 -0
  19. package/dist/core-fsJmsQDa.js +307 -0
  20. package/dist/core-fsJmsQDa.js.map +1 -0
  21. package/dist/index-DMq6F3x9.d.ts +705 -0
  22. package/dist/index-Du_IHXAj.d.ts +10 -0
  23. package/dist/index-ZKOB86ub.d.cts +10 -0
  24. package/dist/index-qeC-p0Tq.d.cts +705 -0
  25. package/dist/index.cjs +61 -118
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +11 -130
  28. package/dist/index.d.ts +11 -130
  29. package/dist/index.js +14 -119
  30. package/dist/index.js.map +1 -1
  31. package/dist/pg.cjs +214 -320
  32. package/dist/pg.cjs.map +1 -1
  33. package/dist/pg.d.cts +24 -22
  34. package/dist/pg.d.ts +24 -22
  35. package/dist/pg.js +209 -321
  36. package/dist/pg.js.map +1 -1
  37. package/dist/shim.cjs +281 -367
  38. package/dist/shim.cjs.map +1 -1
  39. package/dist/shim.d.cts +140 -137
  40. package/dist/shim.d.ts +140 -137
  41. package/dist/shim.js +275 -366
  42. package/dist/shim.js.map +1 -1
  43. package/dist/sqlite3.cjs +41 -56
  44. package/dist/sqlite3.cjs.map +1 -1
  45. package/dist/sqlite3.d.cts +9 -9
  46. package/dist/sqlite3.d.ts +9 -9
  47. package/dist/sqlite3.js +35 -56
  48. package/dist/sqlite3.js.map +1 -1
  49. package/package.json +15 -15
  50. package/dist/chunk-EQ3T4XHT.cjs +0 -1583
  51. package/dist/chunk-EQ3T4XHT.cjs.map +0 -1
  52. package/dist/chunk-H6YIW5C5.js +0 -399
  53. package/dist/chunk-H6YIW5C5.js.map +0 -1
  54. package/dist/chunk-NTHMSHNG.cjs +0 -399
  55. package/dist/chunk-NTHMSHNG.cjs.map +0 -1
  56. package/dist/chunk-NWYI26VT.js +0 -1583
  57. package/dist/chunk-NWYI26VT.js.map +0 -1
  58. package/dist/index-BfBszcG4.d.ts +0 -8
  59. package/dist/index-a-fxODW1.d.cts +0 -8
  60. package/dist/pongoTransactionCache-CRuPGag3.d.cts +0 -556
  61. package/dist/pongoTransactionCache-CRuPGag3.d.ts +0 -556
package/dist/shim.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","../src/mongo/findCursor.ts","../src/mongo/mongoClient.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoDb.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLO,IAAM,WAAA,YAAN,MAAoB;AAAA,EACjB;AAAA,iBACA,UAAA,EAAwB,KAAA;AAAA,kBACxB,MAAA,EAAgB,EAAA;AAAA,EAExB,WAAA,CAAY,SAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,qBAAA,EAAuB,SAAA;AAAA,EAC9B;AAAA,EAEA,MAAM,OAAA,CAAA,EAAwB;AAC5B,IAAA,OAAO,IAAA,CAAK,aAAA,CAAc,CAAA;AAAA,EAC5B;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AAA;AACT,EAAA;AAEA,EAAA;AAUS,IAAA;AACL,MAAA;AACK,MAAA;AACP,IAAA;AACF,EAAA;AACF;AJ+RY;AACA;AEpTC;AAIH,EAAA;AAcR,EAAA;AAWM,IAAA;AACG,MAAA;AACL,MAAA;AACF,IAAA;AAEQ,IAAA;AACN,MAAA;AACF,IAAA;AAEM,IAAA;AAGF,MAAA;AACF,IAAA;AAEE,IAAA;AACI,MAAA;AACJ,QAAA;AACF,MAAA;AACF,IAAA;AAEK,IAAA;AACC,MAAA;AACC,MAAA;AACL,MAAA;AACD,IAAA;AACH,EAAA;AAEM,EAAA;AACE,IAAA;AACC,IAAA;AACT,EAAA;AAEM,EAAA;AACE,IAAA;AACR,EAAA;AAEG,EAAA;AACM,IAAA;AACT,EAAA;AACA,EAAA;AACS,IAAA;AACT,EAAA;AAAA;AASM,EAAA;AAIE,IAAA;AAGA,IAAA;AAEF,IAAA;AACF,MAAA;AACF,IAAA;AACQ,MAAA;AACR,IAAA;AACF,EAAA;AACF;AFsQY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","sourcesContent":[null,"export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import {\n parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type AnyPongoDriver,\n type PongoClient,\n type PongoClientOptions,\n type PongoClientSchema,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient<\n DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver,\n TypedClientSchema extends PongoClientSchema = PongoClientSchema,\n> {\n private pongoClient: PongoClient;\n\n constructor(\n options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n );\n constructor(\n connectionString: string,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n );\n constructor(\n connectionStringOrOptions:\n | string\n | PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n ) {\n if (typeof connectionStringOrOptions !== 'string') {\n this.pongoClient = pongoClient(connectionStringOrOptions);\n return;\n }\n\n const { databaseType, driverName } = parseConnectionString(\n connectionStringOrOptions,\n );\n\n const driver =\n options?.driver ??\n pongoDriverRegistry.tryGet(\n toDatabaseDriverType(databaseType, driverName),\n );\n\n if (driver === null) {\n throw new Error(\n `No database driver registered for ${databaseType} with name ${driverName}`,\n );\n }\n\n this.pongoClient = pongoClient({\n ...(options ?? {}),\n ...{ connectionString: connectionStringOrOptions },\n driver,\n });\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n Db,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n FindOptions as PongoFindOptions,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport type { Db as ShimDb } from '../shim';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nconst toFindOptions = (\n options: FindOptions | undefined,\n): PongoFindOptions | undefined => {\n if (!options?.session && !options?.limit && !options?.skip) {\n return undefined;\n }\n\n const pongoFindOptions: PongoFindOptions = {};\n\n if (options?.session) {\n pongoFindOptions.session = options.session as unknown as PongoSession;\n }\n if (options?.limit !== undefined) {\n pongoFindOptions.limit = options.limit;\n }\n if (options?.skip !== undefined) {\n pongoFindOptions.skip = options.skip;\n }\n\n return pongoFindOptions;\n};\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n private database: ShimDb;\n\n constructor(database: ShimDb, collection: PongoCollection<T>) {\n this.collection = collection;\n this.database = database;\n }\n get db(): Db {\n return this.database as unknown as Db;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n get timeoutMS(): number | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n ) as unknown as Promise<UpdateResult<T>>;\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateMany(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>, options: FindOptions): Promise<WithId<T> | null>;\n findOne<TS = T>(): Promise<TS | null>;\n findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;\n findOne<TS = T>(\n filter: Filter<TS>,\n options?: FindOptions,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions,\n ): Promise<WithId<T> | T | null> {\n return (await this.collection.findOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n )) as T;\n }\n find(): MongoFindCursor<WithId<T>>;\n find(filter: Filter<T>, options?: FindOptions): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(filter as PongoFilter<T>, toFindOptions(options)),\n ) as unknown as MongoFindCursor<T>;\n }\n options(_options?: OperationOptions): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n isCapped(_options?: OperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n createIndex(\n _indexSpec: IndexSpecification,\n _options?: CreateIndexesOptions,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createIndexes(\n _indexSpecs: IndexDescription[],\n _options?: CreateIndexesOptions,\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropIndex(\n _indexName: string,\n _options?: CommandOperationOptions,\n ): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n dropIndexes(_options?: CommandOperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor {\n throw new Error('Method not implemented.');\n }\n indexExists(\n _indexes: string | string[],\n _options?: AbstractCursorOptions,\n ): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n indexInformation(\n options: IndexInformationOptions & { full: true },\n ): Promise<IndexDescriptionInfo[]>;\n indexInformation(\n options: IndexInformationOptions & { full?: false | undefined },\n ): Promise<IndexDescriptionCompact>;\n indexInformation(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexInformation(): Promise<IndexDescriptionCompact>;\n indexInformation(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n estimatedDocumentCount(\n options?: EstimatedDocumentCountOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T>,\n options?: CountDocumentsOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n options: CommandOperationOptions,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string): Promise<any[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string, filter: Filter<T>): Promise<any[]>;\n distinct(\n key: string,\n filter: Filter<T>,\n options: CommandOperationOptions, // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any[]>;\n distinct(\n _key: unknown,\n _filter?: unknown,\n _options?: unknown,\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-imports\n Promise<any[]> | Promise<import('mongodb').Flatten<WithId<T>[Key]>[]> {\n throw new Error('Method not implemented.');\n }\n indexes(\n options: IndexInformationOptions & { full?: true | undefined },\n ): Promise<IndexDescriptionInfo[]>;\n indexes(\n options: IndexInformationOptions & { full: false },\n ): Promise<IndexDescriptionCompact>;\n indexes(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;\n indexes(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null>;\n findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: unknown,\n options?: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndDelete(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: unknown,\n replacement: unknown,\n options?: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndReplace(\n filter as PongoFilter<T>,\n replacement as WithoutId<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: unknown,\n update: unknown,\n options?: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndUpdate(\n filter as PongoFilter<T>,\n update as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n aggregate<T extends Document = Document>(\n _pipeline?: Document[],\n _options?: AggregateOptions,\n ): AggregationCursor<T> {\n throw new Error('Method not implemented.');\n }\n watch<\n TLocal extends Document = T,\n TChange extends Document = ChangeStreamDocument<TLocal>,\n >(\n _pipeline?: Document[],\n _options?: ChangeStreamOptions,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(filter?: Filter<T>, options?: CountOptions): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { Collection as MongoCollection, ObjectId } from 'mongodb';\nimport type { Document } from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoDBCollectionOptions,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n private pongoDb: PongoDb;\n constructor(pongoDb: PongoDb) {\n this.pongoDb = pongoDb;\n }\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n options?: PongoDBCollectionOptions<T>,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(\n this,\n this.pongoDb.collection<T>(collectionName, options),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"shim.cjs","names":["pongoClient","pongoSession"],"sources":["../src/mongo/findCursor.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoClient.ts"],"sourcesContent":["export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n Db,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n FindOptions as PongoFindOptions,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport type { Db as ShimDb } from '../shim';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nconst toFindOptions = (\n options: FindOptions | undefined,\n): PongoFindOptions | undefined => {\n if (\n !options?.session &&\n !options?.limit &&\n !options?.skip &&\n !options?.sort\n ) {\n return undefined;\n }\n\n const pongoFindOptions: PongoFindOptions = {};\n\n if (options?.session) {\n pongoFindOptions.session = options.session as unknown as PongoSession;\n }\n if (options?.limit !== undefined) {\n pongoFindOptions.limit = options.limit;\n }\n if (options?.skip !== undefined) {\n pongoFindOptions.skip = options.skip;\n }\n if (options?.sort !== undefined) {\n pongoFindOptions.sort = options.sort as { [field: string]: 1 | -1 };\n }\n\n return pongoFindOptions;\n};\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n private database: ShimDb;\n\n constructor(database: ShimDb, collection: PongoCollection<T>) {\n this.collection = collection;\n this.database = database;\n }\n get db(): Db {\n return this.database as unknown as Db;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n get timeoutMS(): number | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n ) as unknown as Promise<UpdateResult<T>>;\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateMany(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>, options: FindOptions): Promise<WithId<T> | null>;\n findOne<TS = T>(): Promise<TS | null>;\n findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;\n findOne<TS = T>(\n filter: Filter<TS>,\n options?: FindOptions,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions,\n ): Promise<WithId<T> | T | null> {\n return (await this.collection.findOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n )) as T;\n }\n find(): MongoFindCursor<WithId<T>>;\n find(filter: Filter<T>, options?: FindOptions): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(filter as PongoFilter<T>, toFindOptions(options)),\n ) as unknown as MongoFindCursor<T>;\n }\n options(_options?: OperationOptions): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n isCapped(_options?: OperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n createIndex(\n _indexSpec: IndexSpecification,\n _options?: CreateIndexesOptions,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createIndexes(\n _indexSpecs: IndexDescription[],\n _options?: CreateIndexesOptions,\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropIndex(\n _indexName: string,\n _options?: CommandOperationOptions,\n ): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n dropIndexes(_options?: CommandOperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor {\n throw new Error('Method not implemented.');\n }\n indexExists(\n _indexes: string | string[],\n _options?: AbstractCursorOptions,\n ): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n indexInformation(\n options: IndexInformationOptions & { full: true },\n ): Promise<IndexDescriptionInfo[]>;\n indexInformation(\n options: IndexInformationOptions & { full?: false | undefined },\n ): Promise<IndexDescriptionCompact>;\n indexInformation(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexInformation(): Promise<IndexDescriptionCompact>;\n indexInformation(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n estimatedDocumentCount(\n options?: EstimatedDocumentCountOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T>,\n options?: CountDocumentsOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n options: CommandOperationOptions,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string): Promise<any[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string, filter: Filter<T>): Promise<any[]>;\n distinct(\n key: string,\n filter: Filter<T>,\n options: CommandOperationOptions, // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any[]>;\n distinct(\n _key: unknown,\n _filter?: unknown,\n _options?: unknown,\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-imports\n Promise<any[]> | Promise<import('mongodb').Flatten<WithId<T>[Key]>[]> {\n throw new Error('Method not implemented.');\n }\n indexes(\n options: IndexInformationOptions & { full?: true | undefined },\n ): Promise<IndexDescriptionInfo[]>;\n indexes(\n options: IndexInformationOptions & { full: false },\n ): Promise<IndexDescriptionCompact>;\n indexes(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;\n indexes(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null>;\n findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: unknown,\n options?: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndDelete(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: unknown,\n replacement: unknown,\n options?: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndReplace(\n filter as PongoFilter<T>,\n replacement as WithoutId<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: unknown,\n update: unknown,\n options?: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndUpdate(\n filter as PongoFilter<T>,\n update as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n aggregate<T extends Document = Document>(\n _pipeline?: Document[],\n _options?: AggregateOptions,\n ): AggregationCursor<T> {\n throw new Error('Method not implemented.');\n }\n watch<\n TLocal extends Document = T,\n TChange extends Document = ChangeStreamDocument<TLocal>,\n >(\n _pipeline?: Document[],\n _options?: ChangeStreamOptions,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(filter?: Filter<T>, options?: CountOptions): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { Collection as MongoCollection, ObjectId } from 'mongodb';\nimport type { Document } from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoDBCollectionOptions,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n private pongoDb: PongoDb;\n constructor(pongoDb: PongoDb) {\n this.pongoDb = pongoDb;\n }\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n options?: PongoDBCollectionOptions<T>,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(\n this,\n this.pongoDb.collection<T>(collectionName, options),\n );\n }\n}\n","import {\n parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type AnyPongoDriver,\n type PongoClient,\n type PongoClientOptions,\n type PongoClientSchema,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient<\n DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver,\n TypedClientSchema extends PongoClientSchema = PongoClientSchema,\n> {\n private pongoClient: PongoClient;\n\n constructor(\n options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n );\n constructor(\n connectionString: string,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n );\n constructor(\n connectionStringOrOptions:\n | string\n | PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n ) {\n if (typeof connectionStringOrOptions !== 'string') {\n this.pongoClient = pongoClient(connectionStringOrOptions);\n return;\n }\n\n const { databaseType, driverName } = parseConnectionString(\n connectionStringOrOptions,\n );\n\n const driver =\n options?.driver ??\n pongoDriverRegistry.tryGet(\n toDatabaseDriverType(databaseType, driverName),\n );\n\n if (driver === null) {\n throw new Error(\n `No database driver registered for ${databaseType} with name ${driverName}`,\n );\n }\n\n this.pongoClient = pongoClient({\n ...(options ?? {}),\n ...{ connectionString: connectionStringOrOptions },\n driver,\n } as unknown as PongoClientOptions<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>['driver'] &\n AnyPongoDriver,\n TypedClientSchema\n >);\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAa,aAAb,MAA2B;CACzB,AAAQ;CACR,AAAQ,YAAwB;CAChC,AAAQ,QAAgB;CAExB,YAAY,WAAyB;AACnC,OAAK,uBAAuB;;CAG9B,MAAM,UAAwB;AAC5B,SAAO,KAAK,eAAe;;CAG7B,MAAM,QAAQ,UAA2C;EACvD,MAAM,OAAO,MAAM,KAAK,eAAe;AAEvC,OAAK,MAAM,OAAO,KAChB,UAAS,IAAI;AAEf,SAAO,QAAQ,SAAS;;CAG1B,UAAmB;AACjB,MAAI,KAAK,cAAc,KAAM,OAAM,MAAM,iCAAiC;AAC1E,SAAO,KAAK,QAAQ,KAAK,UAAU;;CAGrC,MAAM,OAA0B;EAC9B,MAAM,OAAO,MAAM,KAAK,eAAe;AACvC,SAAO,KAAK,SAAS,GAAI,KAAK,KAAK,YAAY,OAAQ;;CAGzD,MAAc,gBAA8B;AAC1C,OAAK,YAAY,MAAM,KAAK;AAC5B,SAAO,KAAK;;;;;;AC2ChB,MAAM,gCACJ,YAEA,SAAS,UACL,EAAE,SAAS,QAAQ,SAAoC,GACvD;AAEN,MAAM,iBACJ,YACiC;AACjC,KACE,CAAC,SAAS,WACV,CAAC,SAAS,SACV,CAAC,SAAS,QACV,CAAC,SAAS,KAEV;CAGF,MAAM,mBAAqC,EAAE;AAE7C,KAAI,SAAS,QACX,kBAAiB,UAAU,QAAQ;AAErC,KAAI,SAAS,UAAU,OACrB,kBAAiB,QAAQ,QAAQ;AAEnC,KAAI,SAAS,SAAS,OACpB,kBAAiB,OAAO,QAAQ;AAElC,KAAI,SAAS,SAAS,OACpB,kBAAiB,OAAO,QAAQ;AAGlC,QAAO;;AAGT,IAAa,aAAb,MAA0E;CACxE,AAAQ;CACR,AAAQ;CAER,YAAY,UAAkB,YAAgC;A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,WAAW,kBAAkB;;CAE1C,MAAM,OACJ,IACA,QACA,SAC+B;AAC/B,SAAO,KAAK,WAAW,OAAO,GAAG,UAAU,EAAE,QAAQ,QAAQ;;;;;;ACrjBjE,IAAa,KAAb,MAAgB;CACd,AAAQ;CACR,YAAY,SAAkB;AAC5B,OAAK,UAAU;;CAGjB,IAAI,eAAuB;AACzB,SAAO,KAAK,QAAQ;;CAGtB,WACE,gBACA,SAOA;AACA,SAAO,IAAI,WACT,MACA,KAAK,QAAQ,WAAc,gBAAgB,QAAQ,CACpD;;;;;;AClBL,IAAa,cAAb,MAGE;CACA,AAAQ;CAcR,YACE,2BAGA,SAMA;AACA,MAAI,OAAO,8BAA8B,UAAU;AACjD,QAAK,cAAcA,yBAAY,0BAA0B;AACzD;;EAGF,MAAM,EAAE,cAAc,iEACpB,0BACD;EAED,MAAM,SACJ,SAAS,UACT,oBAAoB,wDACG,cAAc,WAAW,CAC/C;AAEH,MAAI,WAAW,KACb,OAAM,IAAI,MACR,qCAAqC,aAAa,aAAa,aAChE;AAGH,OAAK,cAAcA,yBAAY;GAC7B,GAAI,WAAW,EAAE;GACZ,kBAAkB;GACvB;GACD,CAIC;;CAGJ,MAAM,UAAU;AACd,QAAM,KAAK,YAAY,SAAS;AAChC,SAAO;;CAGT,MAAM,QAAQ;AACZ,QAAM,KAAK,YAAY,OAAO;;CAGhC,GAAG,QAAqB;AACtB,SAAO,IAAI,GAAG,KAAK,YAAY,GAAG,OAAO,CAAC;;CAE5C,aAAa,UAAgD;AAC3D,SAAOC,2BAAc;;CAUvB,MAAM,YACJ,mBACA,UACY;EACZ,MAAM,WACJ,OAAO,sBAAsB,aAAa,oBAAoB;EAEhE,MAAM,UAAUA,2BAAc;AAE9B,MAAI;AACF,UAAO,MAAM,SAAS,QAAQ;YACtB;AACR,SAAM,QAAQ,YAAY"}
package/dist/shim.d.cts CHANGED
@@ -1,147 +1,150 @@
1
- import { ClientSessionOptions } from 'http2';
2
- import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, Db as Db$1, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
3
- import { a as PongoDb, ao as PongoDBCollectionOptions, T as DocumentHandler, _ as HandleOptions, aB as PongoHandleResult, o as AnyPongoDriver, j as PongoClientSchema, p as PongoClientOptions, g as PongoCollection } from './pongoTransactionCache-CRuPGag3.cjs';
4
- import '@event-driven-io/dumbo';
5
- import 'lru-cache';
1
+ import { G as DocumentHandler, Xt as AnyPongoDriver, Z as HandleOptions, fn as PongoClientSchema, gt as PongoDb, ht as PongoDBCollectionOptions, mt as PongoCollection, pt as PongoClientOptions, wt as PongoHandleResult } from "./index-qeC-p0Tq.cjs";
2
+ import { ClientSessionOptions } from "http2";
3
+ import { AbstractCursorOptions, AggregateOptions, AggregationCursor, AnyBulkWriteOperation, BSONSerializeOptions, BulkWriteOptions, BulkWriteResult, ChangeStream, ChangeStreamDocument, ChangeStreamOptions, ClientSession, Collection as Collection$1, CommandOperationOptions, CountDocumentsOptions, CountOptions, CreateIndexesOptions, Db as Db$1, DeleteOptions, DeleteResult, Document, DropCollectionOptions, EnhancedOmit, EstimatedDocumentCountOptions, Filter, FindCursor as FindCursor$1, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, Flatten, Hint, IndexDescription, IndexDescriptionCompact, IndexDescriptionInfo, IndexInformationOptions, IndexSpecification, InsertManyResult, InsertOneOptions, InsertOneResult, ListIndexesCursor, ListSearchIndexesCursor, ListSearchIndexesOptions, ModifyResult, ObjectId, OperationOptions, OptionalUnlessRequiredId, OrderedBulkOperation, ReadConcern, ReadPreference, RenameOptions, ReplaceOptions, SearchIndexDescription, UnorderedBulkOperation, UpdateFilter, UpdateOptions, UpdateResult, WithId, WithSessionCallback, WithoutId, WriteConcern } from "mongodb";
6
4
 
5
+ //#region src/mongo/findCursor.d.ts
7
6
  declare class FindCursor<T> {
8
- private findDocumentsPromise;
9
- private documents;
10
- private index;
11
- constructor(documents: Promise<T[]>);
12
- toArray(): Promise<T[]>;
13
- forEach(callback: (doc: T) => void): Promise<void>;
14
- hasNext(): boolean;
15
- next(): Promise<T | null>;
16
- private findDocuments;
7
+ private findDocumentsPromise;
8
+ private documents;
9
+ private index;
10
+ constructor(documents: Promise<T[]>);
11
+ toArray(): Promise<T[]>;
12
+ forEach(callback: (doc: T) => void): Promise<void>;
13
+ hasNext(): boolean;
14
+ next(): Promise<T | null>;
15
+ private findDocuments;
17
16
  }
18
-
17
+ //#endregion
18
+ //#region src/mongo/mongoDb.d.ts
19
19
  declare class Db {
20
- private pongoDb;
21
- constructor(pongoDb: PongoDb);
22
- get databaseName(): string;
23
- collection<T extends Document>(collectionName: string, options?: PongoDBCollectionOptions<T>): Collection$1<T> & {
24
- handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
25
- };
20
+ private pongoDb;
21
+ constructor(pongoDb: PongoDb);
22
+ get databaseName(): string;
23
+ collection<T extends Document>(collectionName: string, options?: PongoDBCollectionOptions<T>): Collection$1<T> & {
24
+ handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
25
+ };
26
26
  }
27
-
27
+ //#endregion
28
+ //#region src/mongo/mongoClient.d.ts
28
29
  declare class MongoClient<DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver, TypedClientSchema extends PongoClientSchema = PongoClientSchema> {
29
- private pongoClient;
30
- constructor(options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>);
31
- constructor(connectionString: string, options?: Omit<PongoClientOptions<DatabaseDriverType, TypedClientSchema>, 'connectionString'> & {
32
- driver?: AnyPongoDriver;
33
- });
34
- connect(): Promise<this>;
35
- close(): Promise<void>;
36
- db(dbName?: string): Db;
37
- startSession(_options?: ClientSessionOptions): ClientSession;
38
- withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;
39
- withSession<T = any>(_options: ClientSessionOptions, _executor: WithSessionCallback<T>): Promise<T>;
30
+ private pongoClient;
31
+ constructor(options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>);
32
+ constructor(connectionString: string, options?: Omit<PongoClientOptions<DatabaseDriverType, TypedClientSchema>, 'connectionString'> & {
33
+ driver?: AnyPongoDriver;
34
+ });
35
+ connect(): Promise<this>;
36
+ close(): Promise<void>;
37
+ db(dbName?: string): Db;
38
+ startSession(_options?: ClientSessionOptions): ClientSession;
39
+ withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;
40
+ withSession<T = any>(_options: ClientSessionOptions, _executor: WithSessionCallback<T>): Promise<T>;
40
41
  }
41
-
42
+ //#endregion
43
+ //#region src/mongo/mongoCollection.d.ts
42
44
  declare class Collection<T extends Document> implements Collection$1<T> {
43
- private collection;
44
- private database;
45
- constructor(database: Db, collection: PongoCollection<T>);
46
- get db(): Db$1;
47
- get dbName(): string;
48
- get collectionName(): string;
49
- get namespace(): string;
50
- get readConcern(): ReadConcern | undefined;
51
- get readPreference(): ReadPreference | undefined;
52
- get bsonOptions(): BSONSerializeOptions;
53
- get writeConcern(): WriteConcern | undefined;
54
- get hint(): Hint | undefined;
55
- get timeoutMS(): number | undefined;
56
- set hint(v: Hint | undefined);
57
- insertOne(doc: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
58
- insertMany(docs: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
59
- bulkWrite(_operations: AnyBulkWriteOperation<T>[], _options?: BulkWriteOptions): Promise<BulkWriteResult>;
60
- updateOne(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
61
- replaceOne(filter: Filter<T>, document: WithoutId<T>, options?: ReplaceOptions): Promise<UpdateResult<T>>;
62
- updateMany(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
63
- deleteOne(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
64
- deleteMany(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
65
- rename(newName: string, options?: RenameOptions): Promise<Collection<Document>>;
66
- drop(options?: DropCollectionOptions): Promise<boolean>;
67
- findOne(): Promise<WithId<T> | null>;
68
- findOne(filter: Filter<T>): Promise<WithId<T> | null>;
69
- findOne(filter: Filter<T>, options: FindOptions): Promise<WithId<T> | null>;
70
- findOne<TS = T>(): Promise<TS | null>;
71
- findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;
72
- findOne<TS = T>(filter: Filter<TS>, options?: FindOptions): Promise<TS | null>;
73
- find(): FindCursor$1<WithId<T>>;
74
- find(filter: Filter<T>, options?: FindOptions): FindCursor$1<WithId<T>>;
75
- find<T extends Document>(filter: Filter<T>, options?: FindOptions): FindCursor$1<T>;
76
- options(_options?: OperationOptions): Promise<Document>;
77
- isCapped(_options?: OperationOptions): Promise<boolean>;
78
- createIndex(_indexSpec: IndexSpecification, _options?: CreateIndexesOptions): Promise<string>;
79
- createIndexes(_indexSpecs: IndexDescription[], _options?: CreateIndexesOptions): Promise<string[]>;
80
- dropIndex(_indexName: string, _options?: CommandOperationOptions): Promise<Document>;
81
- dropIndexes(_options?: CommandOperationOptions): Promise<boolean>;
82
- listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor;
83
- indexExists(_indexes: string | string[], _options?: AbstractCursorOptions): Promise<boolean>;
84
- indexInformation(options: IndexInformationOptions & {
85
- full: true;
86
- }): Promise<IndexDescriptionInfo[]>;
87
- indexInformation(options: IndexInformationOptions & {
88
- full?: false | undefined;
89
- }): Promise<IndexDescriptionCompact>;
90
- indexInformation(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
91
- indexInformation(): Promise<IndexDescriptionCompact>;
92
- estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
93
- countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<number>;
94
- distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key): Promise<Flatten<WithId<T>[Key]>[]>;
95
- distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>): Promise<Flatten<WithId<T>[Key]>[]>;
96
- distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>, options: CommandOperationOptions): Promise<Flatten<WithId<T>[Key]>[]>;
97
- distinct(key: string): Promise<any[]>;
98
- distinct(key: string, filter: Filter<T>): Promise<any[]>;
99
- distinct(key: string, filter: Filter<T>, options: CommandOperationOptions): Promise<any[]>;
100
- indexes(options: IndexInformationOptions & {
101
- full?: true | undefined;
102
- }): Promise<IndexDescriptionInfo[]>;
103
- indexes(options: IndexInformationOptions & {
104
- full: false;
105
- }): Promise<IndexDescriptionCompact>;
106
- indexes(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
107
- indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;
108
- findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions & {
109
- includeResultMetadata: true;
110
- }): Promise<ModifyResult<T>>;
111
- findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions & {
112
- includeResultMetadata: false;
113
- }): Promise<WithId<T> | null>;
114
- findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions): Promise<WithId<T> | null>;
115
- findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;
116
- findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions & {
117
- includeResultMetadata: true;
118
- }): Promise<ModifyResult<T>>;
119
- findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions & {
120
- includeResultMetadata: false;
121
- }): Promise<WithId<T> | null>;
122
- findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions): Promise<WithId<T> | null>;
123
- findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>): Promise<WithId<T> | null>;
124
- findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions & {
125
- includeResultMetadata: true;
126
- }): Promise<ModifyResult<T>>;
127
- findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions & {
128
- includeResultMetadata: false;
129
- }): Promise<WithId<T> | null>;
130
- findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions): Promise<WithId<T> | null>;
131
- findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>): Promise<WithId<T> | null>;
132
- aggregate<T extends Document = Document>(_pipeline?: Document[], _options?: AggregateOptions): AggregationCursor<T>;
133
- watch<TLocal extends Document = T, TChange extends Document = ChangeStreamDocument<TLocal>>(_pipeline?: Document[], _options?: ChangeStreamOptions): ChangeStream<TLocal, TChange>;
134
- initializeUnorderedBulkOp(_options?: BulkWriteOptions): UnorderedBulkOperation;
135
- initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation;
136
- count(filter?: Filter<T>, options?: CountOptions): Promise<number>;
137
- listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
138
- listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
139
- createSearchIndex(_description: SearchIndexDescription): Promise<string>;
140
- createSearchIndexes(_descriptions: SearchIndexDescription[]): Promise<string[]>;
141
- dropSearchIndex(_name: string): Promise<void>;
142
- updateSearchIndex(_name: string, _definition: Document): Promise<void>;
143
- createCollection(): Promise<void>;
144
- handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
45
+ private collection;
46
+ private database;
47
+ constructor(database: Db, collection: PongoCollection<T>);
48
+ get db(): Db$1;
49
+ get dbName(): string;
50
+ get collectionName(): string;
51
+ get namespace(): string;
52
+ get readConcern(): ReadConcern | undefined;
53
+ get readPreference(): ReadPreference | undefined;
54
+ get bsonOptions(): BSONSerializeOptions;
55
+ get writeConcern(): WriteConcern | undefined;
56
+ get hint(): Hint | undefined;
57
+ get timeoutMS(): number | undefined;
58
+ set hint(v: Hint | undefined);
59
+ insertOne(doc: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
60
+ insertMany(docs: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
61
+ bulkWrite(_operations: AnyBulkWriteOperation<T>[], _options?: BulkWriteOptions): Promise<BulkWriteResult>;
62
+ updateOne(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
63
+ replaceOne(filter: Filter<T>, document: WithoutId<T>, options?: ReplaceOptions): Promise<UpdateResult<T>>;
64
+ updateMany(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
65
+ deleteOne(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
66
+ deleteMany(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
67
+ rename(newName: string, options?: RenameOptions): Promise<Collection<Document>>;
68
+ drop(options?: DropCollectionOptions): Promise<boolean>;
69
+ findOne(): Promise<WithId<T> | null>;
70
+ findOne(filter: Filter<T>): Promise<WithId<T> | null>;
71
+ findOne(filter: Filter<T>, options: FindOptions): Promise<WithId<T> | null>;
72
+ findOne<TS = T>(): Promise<TS | null>;
73
+ findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;
74
+ findOne<TS = T>(filter: Filter<TS>, options?: FindOptions): Promise<TS | null>;
75
+ find(): FindCursor$1<WithId<T>>;
76
+ find(filter: Filter<T>, options?: FindOptions): FindCursor$1<WithId<T>>;
77
+ find<T extends Document>(filter: Filter<T>, options?: FindOptions): FindCursor$1<T>;
78
+ options(_options?: OperationOptions): Promise<Document>;
79
+ isCapped(_options?: OperationOptions): Promise<boolean>;
80
+ createIndex(_indexSpec: IndexSpecification, _options?: CreateIndexesOptions): Promise<string>;
81
+ createIndexes(_indexSpecs: IndexDescription[], _options?: CreateIndexesOptions): Promise<string[]>;
82
+ dropIndex(_indexName: string, _options?: CommandOperationOptions): Promise<Document>;
83
+ dropIndexes(_options?: CommandOperationOptions): Promise<boolean>;
84
+ listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor;
85
+ indexExists(_indexes: string | string[], _options?: AbstractCursorOptions): Promise<boolean>;
86
+ indexInformation(options: IndexInformationOptions & {
87
+ full: true;
88
+ }): Promise<IndexDescriptionInfo[]>;
89
+ indexInformation(options: IndexInformationOptions & {
90
+ full?: false | undefined;
91
+ }): Promise<IndexDescriptionCompact>;
92
+ indexInformation(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
93
+ indexInformation(): Promise<IndexDescriptionCompact>;
94
+ estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
95
+ countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<number>;
96
+ distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key): Promise<Flatten<WithId<T>[Key]>[]>;
97
+ distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>): Promise<Flatten<WithId<T>[Key]>[]>;
98
+ distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>, options: CommandOperationOptions): Promise<Flatten<WithId<T>[Key]>[]>;
99
+ distinct(key: string): Promise<any[]>;
100
+ distinct(key: string, filter: Filter<T>): Promise<any[]>;
101
+ distinct(key: string, filter: Filter<T>, options: CommandOperationOptions): Promise<any[]>;
102
+ indexes(options: IndexInformationOptions & {
103
+ full?: true | undefined;
104
+ }): Promise<IndexDescriptionInfo[]>;
105
+ indexes(options: IndexInformationOptions & {
106
+ full: false;
107
+ }): Promise<IndexDescriptionCompact>;
108
+ indexes(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
109
+ indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;
110
+ findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions & {
111
+ includeResultMetadata: true;
112
+ }): Promise<ModifyResult<T>>;
113
+ findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions & {
114
+ includeResultMetadata: false;
115
+ }): Promise<WithId<T> | null>;
116
+ findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions): Promise<WithId<T> | null>;
117
+ findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;
118
+ findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions & {
119
+ includeResultMetadata: true;
120
+ }): Promise<ModifyResult<T>>;
121
+ findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions & {
122
+ includeResultMetadata: false;
123
+ }): Promise<WithId<T> | null>;
124
+ findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>, options: FindOneAndReplaceOptions): Promise<WithId<T> | null>;
125
+ findOneAndReplace(filter: Filter<T>, replacement: WithoutId<T>): Promise<WithId<T> | null>;
126
+ findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions & {
127
+ includeResultMetadata: true;
128
+ }): Promise<ModifyResult<T>>;
129
+ findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions & {
130
+ includeResultMetadata: false;
131
+ }): Promise<WithId<T> | null>;
132
+ findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions): Promise<WithId<T> | null>;
133
+ findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>): Promise<WithId<T> | null>;
134
+ aggregate<T extends Document = Document>(_pipeline?: Document[], _options?: AggregateOptions): AggregationCursor<T>;
135
+ watch<TLocal extends Document = T, TChange extends Document = ChangeStreamDocument<TLocal>>(_pipeline?: Document[], _options?: ChangeStreamOptions): ChangeStream<TLocal, TChange>;
136
+ initializeUnorderedBulkOp(_options?: BulkWriteOptions): UnorderedBulkOperation;
137
+ initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation;
138
+ count(filter?: Filter<T>, options?: CountOptions): Promise<number>;
139
+ listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
140
+ listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
141
+ createSearchIndex(_description: SearchIndexDescription): Promise<string>;
142
+ createSearchIndexes(_descriptions: SearchIndexDescription[]): Promise<string[]>;
143
+ dropSearchIndex(_name: string): Promise<void>;
144
+ updateSearchIndex(_name: string, _definition: Document): Promise<void>;
145
+ createCollection(): Promise<void>;
146
+ handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
145
147
  }
146
-
148
+ //#endregion
147
149
  export { Collection, Db, FindCursor, MongoClient };
150
+ //# sourceMappingURL=shim.d.cts.map