@event-driven-io/pongo 0.17.0-alpha.4 → 0.17.0-alpha.6

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.
@@ -87,6 +87,10 @@ type DeleteOneOptions = {
87
87
  type DeleteManyOptions = {
88
88
  expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
89
89
  } & CollectionOperationOptions;
90
+ type FindOptions = {
91
+ limit?: number;
92
+ skip?: number;
93
+ } & CollectionOperationOptions;
90
94
  interface PongoCollection<T extends PongoDocument> {
91
95
  readonly dbName: string;
92
96
  readonly collectionName: string;
@@ -99,7 +103,7 @@ interface PongoCollection<T extends PongoDocument> {
99
103
  deleteOne(filter?: PongoFilter<T> | SQL, options?: DeleteOneOptions): Promise<PongoDeleteResult>;
100
104
  deleteMany(filter?: PongoFilter<T> | SQL, options?: DeleteManyOptions): Promise<PongoDeleteResult>;
101
105
  findOne(filter?: PongoFilter<T> | SQL, options?: CollectionOperationOptions): Promise<WithIdAndVersion<T> | null>;
102
- find(filter?: PongoFilter<T> | SQL, options?: CollectionOperationOptions): Promise<WithIdAndVersion<T>[]>;
106
+ find(filter?: PongoFilter<T> | SQL, options?: FindOptions): Promise<WithIdAndVersion<T>[]>;
103
107
  findOneAndDelete(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions): Promise<WithIdAndVersion<T> | null>;
104
108
  findOneAndReplace(filter: PongoFilter<T> | SQL, replacement: WithoutId<T>, options?: ReplaceOneOptions): Promise<WithIdAndVersion<T> | null>;
105
109
  findOneAndUpdate(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions): Promise<WithIdAndVersion<T> | null>;
@@ -357,4 +361,4 @@ declare const clientToDbOptions: <DbClientOptions extends AllowedDbClientOptions
357
361
  clientOptions: PongoClientOptions;
358
362
  }) => DbClientOptions;
359
363
 
360
- export { type WithoutIdAndVersion as $, type AllowedDbClientOptions as A, type PongoClient as B, type CollectionsMap as C, type DocumentHandler as D, type CollectionOperationOptions as E, type InsertManyOptions as F, type UpdateManyOptions as G, type HandleOptions as H, type InsertOneOptions as I, type DeleteOneOptions as J, type DeleteManyOptions as K, type HasId as L, type InferIdType as M, type NotPooledPongoOptions as N, ObjectId as O, type PongoDb as P, type EnhancedOmit as Q, type ReplaceOneOptions as R, type OptionalUnlessRequiredId as S, type OptionalUnlessRequiredVersion as T, type UpdateOneOptions as U, type OptionalUnlessRequiredIdAndVersion as V, type WithId as W, type WithoutId as X, type WithVersion as Y, type WithoutVersion as Z, type WithIdAndVersion as _, type PongoHandleResult as a, type RegExpOrString as a0, type Document as a1, type OptionalId as a2, type OptionalVersion as a3, type ObjectIdLike as a4, type NonObjectIdLikeDocument as a5, type AlternativeType as a6, type Condition as a7, type PongoFilter as a8, type RootFilterOperators as a9, postgresDb as aA, pongoDbSchemaComponent as aB, type PongoFilterOperator as aa, type $set as ab, type $unset as ac, type $inc as ad, type $push as ae, type ExpectedDocumentVersionGeneral as af, type ExpectedDocumentVersionValue as ag, type ExpectedDocumentVersion as ah, DOCUMENT_EXISTS as ai, DOCUMENT_DOES_NOT_EXIST as aj, NO_CONCURRENCY_CHECK as ak, isGeneralExpectedDocumentVersion as al, expectedVersionValue as am, expectedVersion as an, type PongoUpdate as ao, type OperationResult as ap, operationResult as aq, type PongoInsertOneResult as ar, type PongoInsertManyResult as as, type PongoUpdateResult as at, type PongoUpdateManyResult as au, type PongoDeleteResult as av, type PongoDeleteManyResult as aw, type PongoDocument as ax, type PostgresDbClientOptions as ay, isPostgresClientOptions as az, type PongoClientOptions as b, type PongoCollection as c, type PongoTransactionOptions as d, type PongoSession as e, type PongoDbTransaction as f, type PooledPongoClientOptions as g, clientToDbOptions as h, type PongoDbClientOptions as i, getPongoDb as j, type PongoCollectionSchema as k, type PongoDbSchema as l, type PongoClientSchema as m, type PongoDbWithSchema as n, type DBsMap as o, pongoClient as p, type PongoClientWithSchema as q, pongoSchema as r, proxyPongoDbWithSchema as s, proxyClientWithSchema as t, type PongoCollectionSchemaMetadata as u, type PongoDbSchemaMetadata as v, type PongoClientSchemaMetadata as w, toDbSchemaMetadata as x, toClientSchemaMetadata as y, type PongoSchemaConfig as z };
364
+ export { type WithIdAndVersion as $, type AllowedDbClientOptions as A, type PongoClient as B, type CollectionsMap as C, type DocumentHandler as D, type CollectionOperationOptions as E, type InsertManyOptions as F, type UpdateManyOptions as G, type HandleOptions as H, type InsertOneOptions as I, type DeleteOneOptions as J, type DeleteManyOptions as K, type FindOptions as L, type HasId as M, type NotPooledPongoOptions as N, ObjectId as O, type PongoDb as P, type InferIdType as Q, type ReplaceOneOptions as R, type EnhancedOmit as S, type OptionalUnlessRequiredId as T, type UpdateOneOptions as U, type OptionalUnlessRequiredVersion as V, type OptionalUnlessRequiredIdAndVersion as W, type WithId as X, type WithoutId as Y, type WithVersion as Z, type WithoutVersion as _, type PongoHandleResult as a, type WithoutIdAndVersion as a0, type RegExpOrString as a1, type Document as a2, type OptionalId as a3, type OptionalVersion as a4, type ObjectIdLike as a5, type NonObjectIdLikeDocument as a6, type AlternativeType as a7, type Condition as a8, type PongoFilter as a9, isPostgresClientOptions as aA, postgresDb as aB, pongoDbSchemaComponent as aC, type RootFilterOperators as aa, type PongoFilterOperator as ab, type $set as ac, type $unset as ad, type $inc as ae, type $push as af, type ExpectedDocumentVersionGeneral as ag, type ExpectedDocumentVersionValue as ah, type ExpectedDocumentVersion as ai, DOCUMENT_EXISTS as aj, DOCUMENT_DOES_NOT_EXIST as ak, NO_CONCURRENCY_CHECK as al, isGeneralExpectedDocumentVersion as am, expectedVersionValue as an, expectedVersion as ao, type PongoUpdate as ap, type OperationResult as aq, operationResult as ar, type PongoInsertOneResult as as, type PongoInsertManyResult as at, type PongoUpdateResult as au, type PongoUpdateManyResult as av, type PongoDeleteResult as aw, type PongoDeleteManyResult as ax, type PongoDocument as ay, type PostgresDbClientOptions as az, type PongoClientOptions as b, type PongoCollection as c, type PongoTransactionOptions as d, type PongoSession as e, type PongoDbTransaction as f, type PooledPongoClientOptions as g, clientToDbOptions as h, type PongoDbClientOptions as i, getPongoDb as j, type PongoCollectionSchema as k, type PongoDbSchema as l, type PongoClientSchema as m, type PongoDbWithSchema as n, type DBsMap as o, pongoClient as p, type PongoClientWithSchema as q, pongoSchema as r, proxyPongoDbWithSchema as s, proxyClientWithSchema as t, type PongoCollectionSchemaMetadata as u, type PongoDbSchemaMetadata as v, type PongoClientSchemaMetadata as w, toDbSchemaMetadata as x, toClientSchemaMetadata as y, type PongoSchemaConfig as z };
package/dist/shim.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkATI5CCCTcjs = require('./chunk-ATI5CCCT.cjs');
4
+ var _chunkAV4SHJQBcjs = require('./chunk-AV4SHJQB.cjs');
5
5
 
6
6
  // src/mongo/findCursor.ts
7
7
  var FindCursor = (_class = class {
@@ -40,6 +40,22 @@ require('mongodb');
40
40
 
41
41
  // src/mongo/mongoCollection.ts
42
42
  var toCollectionOperationOptions = (options) => _optionalChain([options, 'optionalAccess', _ => _.session]) ? { session: options.session } : void 0;
43
+ var toFindOptions = (options) => {
44
+ if (!_optionalChain([options, 'optionalAccess', _2 => _2.session]) && !_optionalChain([options, 'optionalAccess', _3 => _3.limit]) && !_optionalChain([options, 'optionalAccess', _4 => _4.skip])) {
45
+ return void 0;
46
+ }
47
+ const pongoFindOptions = {};
48
+ if (_optionalChain([options, 'optionalAccess', _5 => _5.session])) {
49
+ pongoFindOptions.session = options.session;
50
+ }
51
+ if (_optionalChain([options, 'optionalAccess', _6 => _6.limit]) !== void 0) {
52
+ pongoFindOptions.limit = options.limit;
53
+ }
54
+ if (_optionalChain([options, 'optionalAccess', _7 => _7.skip]) !== void 0) {
55
+ pongoFindOptions.skip = options.skip;
56
+ }
57
+ return pongoFindOptions;
58
+ };
43
59
  var Collection = class {
44
60
 
45
61
  constructor(collection) {
@@ -169,10 +185,7 @@ var Collection = class {
169
185
  }
170
186
  find(filter, options) {
171
187
  return new FindCursor(
172
- this.collection.find(
173
- filter,
174
- toCollectionOperationOptions(options)
175
- )
188
+ this.collection.find(filter, toFindOptions(options))
176
189
  );
177
190
  }
178
191
  options(_options) {
@@ -299,7 +312,7 @@ var Db = class {
299
312
  var MongoClient = class {
300
313
 
301
314
  constructor(connectionString, options = {}) {
302
- this.pongoClient = _chunkATI5CCCTcjs.pongoClient.call(void 0, connectionString, options);
315
+ this.pongoClient = _chunkAV4SHJQBcjs.pongoClient.call(void 0, connectionString, options);
303
316
  }
304
317
  async connect() {
305
318
  await this.pongoClient.connect();
@@ -312,12 +325,12 @@ var MongoClient = class {
312
325
  return new Db(this.pongoClient.db(dbName));
313
326
  }
314
327
  startSession(_options) {
315
- return _chunkATI5CCCTcjs.pongoSession.call(void 0, );
328
+ return _chunkAV4SHJQBcjs.pongoSession.call(void 0, );
316
329
  }
317
330
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
331
  async withSession(optionsOrExecutor, executor) {
319
332
  const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
320
- const session = _chunkATI5CCCTcjs.pongoSession.call(void 0, );
333
+ const session = _chunkAV4SHJQBcjs.pongoSession.call(void 0, );
321
334
  try {
322
335
  return await callback(session);
323
336
  } finally {
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/mongoDb.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoClient.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;AAAA,EAEA,MAAM,OAAA,CAAQ,QAAA,EAA2C;AACvD,IAAA,MAAM,KAAA,EAAO,MAAM,IAAA,CAAK,aAAA,CAAc,CAAA;AAEtC,IAAA,IAAA,CAAA,MAAW,IAAA,GAAO,IAAA,EAAM;AACtB,MAAA,QAAA,CAAS,GAAG,CAAA;AAAA,IACd;AACA,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,CAAA;AAAA,EACzB;AAAA,EAEA,OAAA,CAAA,EAAmB;AACjB,IAAA,GAAA,CAAI,IAAA,CAAK,UAAA,IAAc,IAAA,EAAM,MAAM,KAAA,CAAM,gCAAgC,CAAA;AACzE,IAAA,OAAO,IAAA,CAAK,MAAA,EAAQ,IAAA,CAAK,SAAA,CAAU,MAAA;AAAA,EACrC;AAAA,EAEA,MAAM,IAAA,CAAA,EAA0B;AAC9B,IAAA,MAAM,KAAA,EAAO,MAAM,IAAA,CAAK,aAAA,CAAc,CAAA;AACtC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,EAAA,mBAAK,IAAA,CAAK,IAAA,CAAK,KAAA,EAAO,CAAA,UAAK,OAAA,EAAQ,IAAA;AAAA,EACzD;AAAA,EAEA,MAAc,aAAA,CAA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AJgRY;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 Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\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 ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\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 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 PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\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\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\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 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<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\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(\n filter: Filter<T>,\n options: FindOptions<Document>,\n ): 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<Document>,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): Promise<import('mongodb').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(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ),\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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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\n | Promise<any[]>\n | Promise<import('mongodb').Flatten<import('mongodb').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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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 ): import('mongodb').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 { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\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"]}
1
+ {"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","../src/mongo/findCursor.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoClient.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLO,IAAM,WAAA,YAAN,MAAoB;AAAA,EACjB;AAAA,iBACA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A;AACR,EAAA;AACO,IAAA;AACP,EAAA;AAEI,EAAA;AACK,IAAA;AACT,EAAA;AAEA,EAAA;AASS,IAAA;AACT,EAAA;AACF;AFmRY;AACA;AI5SC;AACH,EAAA;AAER,EAAA;AACO,IAAA;AACP,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;AJ6RY;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 Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\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 ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\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 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 { 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\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\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 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<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\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(\n filter: Filter<T>,\n options: FindOptions<Document>,\n ): 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<Document>,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): Promise<import('mongodb').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(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document>,\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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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\n | Promise<any[]>\n | Promise<import('mongodb').Flatten<import('mongodb').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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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 ): import('mongodb').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 { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\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"]}
package/dist/shim.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ClientSessionOptions } from 'http2';
2
2
  import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, 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 { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-BpQPqFEh.cjs';
3
+ import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-D8jPedlZ.cjs';
4
4
  import '@event-driven-io/dumbo';
5
5
  import '@event-driven-io/dumbo/pg';
6
6
  import 'pg';
package/dist/shim.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ClientSessionOptions } from 'http2';
2
2
  import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, 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 { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-BpQPqFEh.js';
3
+ import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-D8jPedlZ.js';
4
4
  import '@event-driven-io/dumbo';
5
5
  import '@event-driven-io/dumbo/pg';
6
6
  import 'pg';
package/dist/shim.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pongoClient,
3
3
  pongoSession
4
- } from "./chunk-DRVOAVHN.js";
4
+ } from "./chunk-OO7GMTMP.js";
5
5
 
6
6
  // src/mongo/findCursor.ts
7
7
  var FindCursor = class {
@@ -40,6 +40,22 @@ import "mongodb";
40
40
 
41
41
  // src/mongo/mongoCollection.ts
42
42
  var toCollectionOperationOptions = (options) => options?.session ? { session: options.session } : void 0;
43
+ var toFindOptions = (options) => {
44
+ if (!options?.session && !options?.limit && !options?.skip) {
45
+ return void 0;
46
+ }
47
+ const pongoFindOptions = {};
48
+ if (options?.session) {
49
+ pongoFindOptions.session = options.session;
50
+ }
51
+ if (options?.limit !== void 0) {
52
+ pongoFindOptions.limit = options.limit;
53
+ }
54
+ if (options?.skip !== void 0) {
55
+ pongoFindOptions.skip = options.skip;
56
+ }
57
+ return pongoFindOptions;
58
+ };
43
59
  var Collection = class {
44
60
  collection;
45
61
  constructor(collection) {
@@ -169,10 +185,7 @@ var Collection = class {
169
185
  }
170
186
  find(filter, options) {
171
187
  return new FindCursor(
172
- this.collection.find(
173
- filter,
174
- toCollectionOperationOptions(options)
175
- )
188
+ this.collection.find(filter, toFindOptions(options))
176
189
  );
177
190
  }
178
191
  options(_options) {
package/dist/shim.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mongo/findCursor.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.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 {\n Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\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 ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\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 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 PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\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\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\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 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<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\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(\n filter: Filter<T>,\n options: FindOptions<Document>,\n ): 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<Document>,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): Promise<import('mongodb').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(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ),\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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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\n | Promise<any[]>\n | Promise<import('mongodb').Flatten<import('mongodb').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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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 ): import('mongodb').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 { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\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":";;;;;;AAAO,IAAM,aAAN,MAAoB;AAAA,EACjB;AAAA,EACA,YAAwB;AAAA,EACxB,QAAgB;AAAA,EAExB,YAAY,WAAyB;AACnC,SAAK,uBAAuB;AAAA,EAC9B;AAAA,EAEA,MAAM,UAAwB;AAC5B,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA,EAEA,MAAM,QAAQ,UAA2C;AACvD,UAAM,OAAO,MAAM,KAAK,cAAc;AAEtC,eAAW,OAAO,MAAM;AACtB,eAAS,GAAG;AAAA,IACd;AACA,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,UAAmB;AACjB,QAAI,KAAK,cAAc,KAAM,OAAM,MAAM,gCAAgC;AACzE,WAAO,KAAK,QAAQ,KAAK,UAAU;AAAA,EACrC;AAAA,EAEA,MAAM,OAA0B;AAC9B,UAAM,OAAO,MAAM,KAAK,cAAc;AACtC,WAAO,KAAK,QAAQ,IAAK,KAAK,KAAK,OAAO,KAAK,OAAQ;AA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AA,IAC3B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/mongo/findCursor.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.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 {\n Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\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 ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\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 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 { 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\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\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 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<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\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(\n filter: Filter<T>,\n options: FindOptions<Document>,\n ): 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<Document>,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): Promise<import('mongodb').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(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document>,\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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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\n | Promise<any[]>\n | Promise<import('mongodb').Flatten<import('mongodb').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<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\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 ): import('mongodb').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 { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\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":";;;;;;AAAO,IAAM,aAAN,MAAoB;AAAA,EACjB;AAAA,EACA,YAAwB;AAAA,EACxB,QAAgB;AAAA,EAExB,YAAY,WAAyB;AACnC,SAAK,uBAAuB;AAAA,EAC9B;AAAA,EAEA,MAAM,UAAwB;AAC5B,WAAO,KAAK,cAAc;AAAA,EAC5B;AAAA,EAEA,MAAM,QAAQ,UAA2C;AACvD,UAAM,OAAO,MAAM,KAAK,cAAc;AAEtC,eAAW,OAAO,MAAM;AACtB,eAAS,GAAG;AAAA,IACd;AACA,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,UAAmB;AACjB,QAAI,KAAK,cAAc,KAAM,OAAM,MAAM,gCAAgC;AACzE,WAAO,KAAK,QAAQ,KAAK,UAAU;AAAA,EACrC;AAAA,EAEA,MAAM,OAA0B;AAC9B,UAAM,OAAO,MAAM,KAAK,cAAc;AACtC,WAAO,KAAK,QAAQ,IAAK,KAAK,KAAK,OAAO,KAAK,OAAQ;AAAA,EACzD;AAAA,EAEA,MAAc,gBAA8B;AAC1C,SAAK,YAAY,MAAM,KAAK;AAC5B,WAAO,KAAK;AAAA,EACd;AACF;;;ACpCA,OAIO;;;ACuEP,IAAM,+BAA+B,CACnC,YAEA,SAAS,UACL,EAAE,SAAS,QAAQ,QAAmC,IACtD;AAEN,IAAM,gBAAgB,CACpB,YACiC;AACjC,MAAI,CAAC,SAAS,WAAW,CAAC,SAAS,SAAS,CAAC,SAAS,MAAM;AAC1D,WAAO;AAAA,EACT;AAEA,QAAM,mBAAqC,CAAC;AAE5C,MAAI,SAAS,SAAS;AACpB,qBAAiB,UAAU,QAAQ;AAAA,EACrC;AACA,MAAI,SAAS,UAAU,QAAW;AAChC,qBAAiB,QAAQ,QAAQ;AAAA,EACnC;AACA,MAAI,SAAS,SAAS,QAAW;AAC/B,qBAA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EA,MAAM,mBAAkC;AACtC,UAAM,KAAK,WAAW,iBAAiB;AAAA,EACzC;AAAA,EACA,MAAM,OACJ,IACA,QACA,SAC+B;AAC/B,WAAO,KAAK,WAAW,OAAO,GAAG,SAAS,GAAG,QAAQ,OAAO;AAAA,EAC9D;AACF;;;ADhjBO,IAAM,KAAN,MAAS;AAAA,EACN;AAAA,EACR,YAAY,SAAkB;AAC5B,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,IAAI,eAAuB;AACzB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,WACE,gBAOA;AACA,WAAO,IAAI,WAAc,KAAK,QAAQ,WAAc,cAAc,CAAC;AAAA,EACrE;AACF;;;AExBO,IAAM,cAAN,MAAkB;AAAA,EACf;AAAA,EAER,YAAY,kBAA0B,UAA8B,CAAC,GAAG;AACtE,SAAK,cAAc,YAAY,kBAAkB,OAAO;AAAA,EAC1D;AAAA,EAEA,MAAM,UAAU;AACd,UAAM,KAAK,YAAY,QAAQ;AAC/B,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,QAAQ;AACZ,UAAM,KAAK,YAAY,MAAM;AAAA,EAC/B;AAAA,EAEA,GAAG,QAAqB;AACtB,WAAO,IAAI,GAAG,KAAK,YAAY,GAAG,MAAM,CAAC;AAAA,EAC3C;AAAA,EACA,aAAa,UAAgD;AAC3D,WAAO,aAAa;AAAA,EACtB;AAAA;AAAA,EASA,MAAM,YACJ,mBACA,UACY;AACZ,UAAM,WACJ,OAAO,sBAAsB,aAAa,oBAAoB;AAEhE,UAAM,UAAU,aAAa;AAE7B,QAAI;AACF,aAAO,MAAM,SAAS,OAAO;AAAA,IAC/B,UAAE;AACA,YAAM,QAAQ,WAAW;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-driven-io/pongo",
3
- "version": "0.17.0-alpha.4",
3
+ "version": "0.17.0-alpha.6",
4
4
  "description": "Pongo - Mongo with strong consistency on top of Postgres",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -113,7 +113,7 @@
113
113
  "pongo": "./dist/cli.js"
114
114
  },
115
115
  "peerDependencies": {
116
- "@event-driven-io/dumbo": "0.13.0-alpha.4",
116
+ "@event-driven-io/dumbo": "0.13.0-alpha.6",
117
117
  "@types/mongodb": "^4.0.7",
118
118
  "@types/pg": "^8.11.11",
119
119
  "@types/sqlite3": "^5.1.0",