@event-driven-io/pongo 0.17.0-beta.4 → 0.17.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +311 -487
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +4 -4
- package/dist/cli.d.ts +4 -3
- package/dist/cli.js +279 -487
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare.cjs +41 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +12 -0
- package/dist/cloudflare.d.ts +12 -0
- package/dist/cloudflare.js +35 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/core-BHdOCUrr.js +1429 -0
- package/dist/core-BHdOCUrr.js.map +1 -0
- package/dist/core-C9SB3XMx.cjs +1717 -0
- package/dist/core-C9SB3XMx.cjs.map +1 -0
- package/dist/core-CH0SOCr3.js +361 -0
- package/dist/core-CH0SOCr3.js.map +1 -0
- package/dist/core-CkmE5dkK.cjs +373 -0
- package/dist/core-CkmE5dkK.cjs.map +1 -0
- package/dist/index-C3pnS1S_.d.cts +720 -0
- package/dist/index-CZOmOsQt.d.ts +10 -0
- package/dist/index-FXnldVnn.d.cts +10 -0
- package/dist/index-r7V4paf_.d.ts +720 -0
- package/dist/index.cjs +67 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -105
- package/dist/index.d.ts +16 -105
- package/dist/index.js +17 -73
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +319 -288
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +29 -25
- package/dist/pg.d.ts +29 -25
- package/dist/pg.js +309 -284
- package/dist/pg.js.map +1 -1
- package/dist/shim.cjs +291 -368
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +141 -137
- package/dist/shim.d.ts +141 -137
- package/dist/shim.js +285 -367
- package/dist/shim.js.map +1 -1
- package/dist/sqlite3.cjs +43 -62
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +12 -11
- package/dist/sqlite3.d.ts +12 -11
- package/dist/sqlite3.js +36 -61
- package/dist/sqlite3.js.map +1 -1
- package/package.json +42 -44
- package/dist/chunk-4BL6YWLW.cjs +0 -872
- package/dist/chunk-4BL6YWLW.cjs.map +0 -1
- package/dist/chunk-ECQ2CKZE.cjs +0 -330
- package/dist/chunk-ECQ2CKZE.cjs.map +0 -1
- package/dist/chunk-NCNRRYVE.js +0 -872
- package/dist/chunk-NCNRRYVE.js.map +0 -1
- package/dist/chunk-Y7LRKJLJ.js +0 -330
- package/dist/chunk-Y7LRKJLJ.js.map +0 -1
- package/dist/d1.cjs +0 -53
- package/dist/d1.cjs.map +0 -1
- package/dist/d1.d.cts +0 -11
- package/dist/d1.d.ts +0 -11
- package/dist/d1.js +0 -53
- package/dist/d1.js.map +0 -1
- package/dist/index-BJopB-em.d.cts +0 -7
- package/dist/index-G5DECNb_.d.ts +0 -7
- package/dist/pongoCollectionSchemaComponent-t_e9n2Wc.d.cts +0 -426
- package/dist/pongoCollectionSchemaComponent-t_e9n2Wc.d.ts +0 -426
package/dist/shim.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mongo/findCursor.ts","../src/mongo/mongoClient.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.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 parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport { type ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type AnyPongoDatabaseDriver,\n type PongoClient,\n type PongoClientOptions,\n type PongoClientSchema,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient<\n DatabaseDriverType extends AnyPongoDatabaseDriver = AnyPongoDatabaseDriver,\n TypedClientSchema extends PongoClientSchema = PongoClientSchema,\n> {\n private pongoClient: PongoClient;\n\n constructor(\n options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n );\n constructor(\n connectionString: string,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDatabaseDriver;\n },\n );\n constructor(\n connectionStringOrOptions:\n | string\n | PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDatabaseDriver;\n },\n ) {\n if (typeof connectionStringOrOptions !== 'string') {\n this.pongoClient = pongoClient(connectionStringOrOptions);\n return;\n }\n\n const { databaseType, driverName } = parseConnectionString(\n connectionStringOrOptions,\n );\n\n const driver =\n options?.driver ??\n pongoDatabaseDriverRegistry.tryGet(\n toDatabaseDriverType(databaseType, driverName),\n );\n\n if (driver === null) {\n throw new Error(\n `No database driver registered for ${databaseType} with name ${driverName}`,\n );\n }\n\n this.pongoClient = pongoClient({\n ...(options ?? {}),\n ...{ connectionString: connectionStringOrOptions },\n driver,\n });\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n","import {\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, 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 Db,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n FindOptions as PongoFindOptions,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport type { Db as ShimDb } from '../shim';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nconst toFindOptions = (\n options: FindOptions | undefined,\n): PongoFindOptions | undefined => {\n if (!options?.session && !options?.limit && !options?.skip) {\n return undefined;\n }\n\n const pongoFindOptions: PongoFindOptions = {};\n\n if (options?.session) {\n pongoFindOptions.session = options.session as unknown as PongoSession;\n }\n if (options?.limit !== undefined) {\n pongoFindOptions.limit = options.limit;\n }\n if (options?.skip !== undefined) {\n pongoFindOptions.skip = options.skip;\n }\n\n return pongoFindOptions;\n};\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n private database: ShimDb;\n\n constructor(database: ShimDb, collection: PongoCollection<T>) {\n this.collection = collection;\n this.database = database;\n }\n get db(): Db {\n return this.database as unknown as Db;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n get timeoutMS(): number | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n ) as unknown as Promise<UpdateResult<T>>;\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateMany(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(\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"],"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;AA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A,MACnC;AAAA,IACF;AAEA,UAAM,SACJ,SAAS,UACT,4BAA4B;AAAA,MAC1B,qBAAqB,cAAc,UAAU;AAAA,IAC/C;AAEF,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI;AAAA,QACR,qCAAqC,YAAY,cAAc,UAAU;AAAA,MAC3E;AAAA,IACF;AAEA,SAAK,cAAc,YAAY;AAAA,MAC7B,GAAI,WAAW,CAAC;AAAA,MAChB,GAAG,EAAE,kBAAkB,0BAA0B;AAAA,MACjD;AAAA,IACF,CAAC;AAAA,EACH;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":[]}
|
|
1
|
+
{"version":3,"file":"shim.js","names":[],"sources":["../src/mongo/findCursor.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoClient.ts"],"sourcesContent":["export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n Db,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n FindOptions as PongoFindOptions,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport type { Db as ShimDb } from '../shim';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nconst toFindOptions = (\n options: FindOptions | undefined,\n): PongoFindOptions | undefined => {\n if (\n !options?.session &&\n !options?.limit &&\n !options?.skip &&\n !options?.sort\n ) {\n return undefined;\n }\n\n const pongoFindOptions: PongoFindOptions = {};\n\n if (options?.session) {\n pongoFindOptions.session = options.session as unknown as PongoSession;\n }\n if (options?.limit !== undefined) {\n pongoFindOptions.limit = options.limit;\n }\n if (options?.skip !== undefined) {\n pongoFindOptions.skip = options.skip;\n }\n if (options?.sort !== undefined) {\n pongoFindOptions.sort = options.sort as { [field: string]: 1 | -1 };\n }\n\n return pongoFindOptions;\n};\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n private database: ShimDb;\n\n constructor(database: ShimDb, collection: PongoCollection<T>) {\n this.collection = collection;\n this.database = database;\n }\n get db(): Db {\n return this.database as unknown as Db;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n get timeoutMS(): number | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.matchedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.upsertedCount,\n upsertedId: result.upsertedId as unknown as InferIdType<T>,\n };\n }\n async replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n {\n ...toCollectionOperationOptions(options),\n upsert: options?.upsert ?? false,\n },\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.matchedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.upsertedCount,\n upsertedId: result.upsertedId as unknown as InferIdType<T>,\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.matchedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: 0,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>, options: FindOptions): Promise<WithId<T> | null>;\n findOne<TS = T>(): Promise<TS | null>;\n findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;\n findOne<TS = T>(\n filter: Filter<TS>,\n options?: FindOptions,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions,\n ): Promise<WithId<T> | T | null> {\n return await this.collection.findOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n find(): MongoFindCursor<WithId<T>>;\n find(filter: Filter<T>, options?: FindOptions): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(filter as PongoFilter<T>, toFindOptions(options)),\n ) as unknown as MongoFindCursor<T>;\n }\n options(_options?: OperationOptions): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n isCapped(_options?: OperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n createIndex(\n _indexSpec: IndexSpecification,\n _options?: CreateIndexesOptions,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createIndexes(\n _indexSpecs: IndexDescription[],\n _options?: CreateIndexesOptions,\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropIndex(\n _indexName: string,\n _options?: CommandOperationOptions,\n ): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n dropIndexes(_options?: CommandOperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor {\n throw new Error('Method not implemented.');\n }\n indexExists(\n _indexes: string | string[],\n _options?: AbstractCursorOptions,\n ): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n indexInformation(\n options: IndexInformationOptions & { full: true },\n ): Promise<IndexDescriptionInfo[]>;\n indexInformation(\n options: IndexInformationOptions & { full?: false | undefined },\n ): Promise<IndexDescriptionCompact>;\n indexInformation(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexInformation(): Promise<IndexDescriptionCompact>;\n indexInformation(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n estimatedDocumentCount(\n options?: EstimatedDocumentCountOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T>,\n options?: CountDocumentsOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n options: CommandOperationOptions,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string): Promise<any[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string, filter: Filter<T>): Promise<any[]>;\n distinct(\n key: string,\n filter: Filter<T>,\n options: CommandOperationOptions, // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any[]>;\n distinct(\n _key: unknown,\n _filter?: unknown,\n _options?: unknown,\n ):\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-imports\n Promise<any[]> | Promise<import('mongodb').Flatten<WithId<T>[Key]>[]> {\n throw new Error('Method not implemented.');\n }\n indexes(\n options: IndexInformationOptions & { full?: true | undefined },\n ): Promise<IndexDescriptionInfo[]>;\n indexes(\n options: IndexInformationOptions & { full: false },\n ): Promise<IndexDescriptionCompact>;\n indexes(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;\n indexes(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null>;\n findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: unknown,\n options?: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndDelete(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: unknown,\n replacement: unknown,\n options?: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndReplace(\n filter as PongoFilter<T>,\n replacement as WithoutId<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: unknown,\n update: unknown,\n options?: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndUpdate(\n filter as PongoFilter<T>,\n update as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n aggregate<T extends Document = Document>(\n _pipeline?: Document[],\n _options?: AggregateOptions,\n ): AggregationCursor<T> {\n throw new Error('Method not implemented.');\n }\n watch<\n TLocal extends Document = T,\n TChange extends Document = ChangeStreamDocument<TLocal>,\n >(\n _pipeline?: Document[],\n _options?: ChangeStreamOptions,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(filter?: Filter<T>, options?: CountOptions): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { Collection as MongoCollection, ObjectId } from 'mongodb';\nimport type { Document } from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoDBCollectionOptions,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n private pongoDb: PongoDb;\n constructor(pongoDb: PongoDb) {\n this.pongoDb = pongoDb;\n }\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n options?: PongoDBCollectionOptions<T>,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(\n this,\n this.pongoDb.collection<T>(collectionName, options),\n );\n }\n}\n","import {\n parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type AnyPongoDriver,\n type PongoClient,\n type PongoClientOptions,\n type PongoClientSchema,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient<\n DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver,\n TypedClientSchema extends PongoClientSchema = PongoClientSchema,\n> {\n private pongoClient: PongoClient;\n\n constructor(\n options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n );\n constructor(\n connectionString: string,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n );\n constructor(\n connectionStringOrOptions:\n string | PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n ) {\n if (typeof connectionStringOrOptions !== 'string') {\n this.pongoClient = pongoClient(connectionStringOrOptions);\n return;\n }\n\n const { databaseType, driverName } = parseConnectionString(\n connectionStringOrOptions,\n );\n\n const driver =\n options?.driver ??\n pongoDriverRegistry.tryGet(\n toDatabaseDriverType(databaseType, driverName),\n );\n\n if (driver === null) {\n throw new Error(\n `No database driver registered for ${databaseType} with name ${driverName}`,\n );\n }\n\n this.pongoClient = pongoClient({\n ...(options ?? {}),\n ...{ connectionString: connectionStringOrOptions },\n driver,\n } as unknown as PongoClientOptions<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>['driver'] &\n AnyPongoDriver,\n TypedClientSchema\n >);\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n"],"mappings":";;;;AAAA,IAAa,aAAb,MAA2B;CACzB,AAAQ;CACR,AAAQ,YAAwB;CAChC,AAAQ,QAAgB;CAExB,YAAY,WAAyB;AACnC,OAAK,uBAAuB;;CAG9B,MAAM,UAAwB;AAC5B,SAAO,KAAK,eAAe;;CAG7B,MAAM,QAAQ,UAA2C;EACvD,MAAM,OAAO,MAAM,KAAK,eAAe;AAEvC,OAAK,MAAM,OAAO,KAChB,UAAS,IAAI;AAEf,SAAO,QAAQ,SAAS;;CAG1B,UAAmB;AACjB,MAAI,KAAK,cAAc,KAAM,OAAM,MAA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|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
driverType: _sqlite3.SQLite3DriverType,
|
|
35
|
-
definition: schema,
|
|
36
|
-
migrationsOrSchemaComponents: {
|
|
37
|
-
migrations: _chunkECQ2CKZEcjs.pongoCollectionSQLiteMigrations.call(void 0, schema.name)
|
|
38
|
-
},
|
|
39
|
-
sqlBuilder: _chunkECQ2CKZEcjs.sqliteSQLBuilder.call(void 0, schema.name)
|
|
40
|
-
}),
|
|
41
|
-
definition: _nullishCoalesce(_optionalChain([options, 'access', _ => _.schema, 'optionalAccess', _2 => _2.definition]), () => ( _chunk4BL6YWLWcjs.pongoSchema.db(databaseName, {})))
|
|
42
|
-
}),
|
|
43
|
-
databaseName
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
getDatabaseNameOrDefault: (options) => {
|
|
47
|
-
return _nullishCoalesce(options.databaseName, () => ( getDatabaseNameOrDefault(options.connectionString)));
|
|
48
|
-
},
|
|
49
|
-
defaultConnectionString: ":memory:"
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core = require('./core-C9SB3XMx.cjs');
|
|
3
|
+
const require_cli = require('./cli.cjs');
|
|
4
|
+
const require_core$1 = require('./core-CkmE5dkK.cjs');
|
|
5
|
+
let _event_driven_io_dumbo = require("@event-driven-io/dumbo");
|
|
6
|
+
let _event_driven_io_dumbo_sqlite3 = require("@event-driven-io/dumbo/sqlite3");
|
|
7
|
+
|
|
8
|
+
//#region src/storage/sqlite/sqlite3/index.ts
|
|
9
|
+
const sqlite3PongoDriver = {
|
|
10
|
+
driverType: _event_driven_io_dumbo_sqlite3.SQLite3DriverType,
|
|
11
|
+
databaseFactory: (options) => {
|
|
12
|
+
const databaseName = options.databaseName ?? "db:default";
|
|
13
|
+
return require_core.PongoDatabase({
|
|
14
|
+
...options,
|
|
15
|
+
pool: (0, _event_driven_io_dumbo.dumbo)({
|
|
16
|
+
connectionString: options.connectionString,
|
|
17
|
+
driver: _event_driven_io_dumbo_sqlite3.sqlite3DumboDriver,
|
|
18
|
+
...options.connectionOptions,
|
|
19
|
+
serialization: { serializer: options.serializer }
|
|
20
|
+
}),
|
|
21
|
+
schemaComponent: require_core.PongoDatabaseSchemaComponent({
|
|
22
|
+
driverType: _event_driven_io_dumbo_sqlite3.SQLite3DriverType,
|
|
23
|
+
collectionFactory: (schema) => require_core.PongoCollectionSchemaComponent({
|
|
24
|
+
driverType: _event_driven_io_dumbo_sqlite3.SQLite3DriverType,
|
|
25
|
+
definition: schema,
|
|
26
|
+
migrationsOrSchemaComponents: { migrations: require_core$1.pongoCollectionSQLiteMigrations(schema.name) },
|
|
27
|
+
sqlBuilder: require_core$1.sqliteSQLBuilder(schema.name, options.serialization?.serializer ?? _event_driven_io_dumbo.JSONSerializer)
|
|
28
|
+
}),
|
|
29
|
+
definition: options.schema?.definition ?? require_core.pongoSchema.db(databaseName, {})
|
|
30
|
+
}),
|
|
31
|
+
databaseName
|
|
32
|
+
});
|
|
33
|
+
}
|
|
50
34
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_sqlite3.SQLite3DriverType,
|
|
54
|
-
sqlite3DatabaseDriver
|
|
55
|
-
);
|
|
35
|
+
const useSqlite3PongoDriver = () => {
|
|
36
|
+
require_core.pongoDriverRegistry.register(_event_driven_io_dumbo_sqlite3.SQLite3DriverType, sqlite3PongoDriver);
|
|
56
37
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
exports.
|
|
38
|
+
useSqlite3PongoDriver();
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.pongoCollectionSQLiteMigrations = require_core$1.pongoCollectionSQLiteMigrations;
|
|
42
|
+
exports.pongoDriver = sqlite3PongoDriver;
|
|
43
|
+
exports.sqlite3Driver = sqlite3PongoDriver;
|
|
44
|
+
exports.sqliteSQLBuilder = require_core$1.sqliteSQLBuilder;
|
|
45
|
+
exports.useSqlite3PongoDriver = useSqlite3PongoDriver;
|
|
65
46
|
//# sourceMappingURL=sqlite3.cjs.map
|
package/dist/sqlite3.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sqlite3.cjs","names":["SQLite3DriverType","PongoDatabase","dumboDriver","PongoDatabaseSchemaComponent","PongoCollectionSchemaComponent","pongoCollectionSQLiteMigrations","sqliteSQLBuilder","JSONSerializer","pongoSchema"],"sources":["../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["import { dumbo, JSONSerializer } from '@event-driven-io/dumbo';\nimport {\n sqlite3DumboDriver as dumboDriver,\n SQLite3DriverType,\n} from '@event-driven-io/dumbo/sqlite3';\nimport {\n PongoCollectionSchemaComponent,\n PongoDatabase,\n PongoDatabaseSchemaComponent,\n pongoDriverRegistry,\n pongoSchema,\n type PongoDb,\n type PongoDriver,\n type PongoDriverOptions,\n} from '../../../core';\nimport { pongoCollectionSQLiteMigrations, sqliteSQLBuilder } from '../core';\n\nexport type SQLitePongoClientOptions = object;\n\ntype SQLiteDatabaseDriverOptions =\n PongoDriverOptions<SQLitePongoClientOptions> & {\n databaseName?: string | undefined;\n connectionString: string;\n };\n\nconst sqlite3PongoDriver: PongoDriver<\n PongoDb<SQLite3DriverType>,\n SQLiteDatabaseDriverOptions\n> = {\n driverType: SQLite3DriverType,\n databaseFactory: (options) => {\n const databaseName = options.databaseName ?? 'db:default';\n\n return PongoDatabase({\n ...options,\n pool: dumbo({\n connectionString: options.connectionString,\n driver: dumboDriver,\n ...options.connectionOptions,\n serialization: { serializer: options.serializer },\n }),\n schemaComponent: PongoDatabaseSchemaComponent({\n driverType: SQLite3DriverType,\n collectionFactory: (schema) =>\n PongoCollectionSchemaComponent({\n driverType: SQLite3DriverType,\n definition: schema,\n migrationsOrSchemaComponents: {\n migrations: pongoCollectionSQLiteMigrations(schema.name),\n },\n sqlBuilder: sqliteSQLBuilder(\n schema.name,\n options.serialization?.serializer ?? JSONSerializer,\n ),\n }),\n definition:\n options.schema?.definition ?? pongoSchema.db(databaseName, {}),\n }),\n databaseName,\n });\n },\n};\n\nexport const useSqlite3PongoDriver = () => {\n pongoDriverRegistry.register(SQLite3DriverType, sqlite3PongoDriver);\n};\n\nuseSqlite3PongoDriver();\n\nexport {\n sqlite3PongoDriver as pongoDriver,\n sqlite3PongoDriver as sqlite3Driver,\n};\n"],"mappings":";;;;;;;;AAyBA,MAAM,qBAGF;CACF,YAAYA;CACZ,kBAAkB,YAAY;EAC5B,MAAM,eAAe,QAAQ,gBAAgB;AAE7C,SAAOC,2BAAc;GACnB,GAAG;GACH,wCAAY;IACV,kBAAkB,QAAQ;IAC1B,QAAQC;IACR,GAAG,QAAQ;IACX,eAAe,EAAE,YAAY,QAAQ,YAAY;IAClD,CAAC;GACF,iBAAiBC,0CAA6B;IAC5C,YAAYH;IACZ,oBAAoB,WAClBI,4CAA+B;KAC7B,YAAYJ;KACZ,YAAY;KACZ,8BAA8B,EAC5B,YAAYK,+CAAgC,OAAO,KAAK,EACzD;KACD,YAAYC,gCACV,OAAO,MACP,QAAQ,eAAe,cAAcC,sCACtC;KACF,CAAC;IACJ,YACE,QAAQ,QAAQ,cAAcC,yBAAY,GAAG,cAAc,EAAE,CAAC;IACjE,CAAC;GACF;GACD,CAAC;;CAEL;AAED,MAAa,8BAA8B;AACzC,kCAAoB,SAASR,kDAAmB,mBAAmB;;AAGrE,uBAAuB"}
|
package/dist/sqlite3.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '@event-driven-io/dumbo';
|
|
1
|
+
import { _t as PongoDb, in as PongoDriverOptions, rn as PongoDriver } from "./index-C3pnS1S_.cjs";
|
|
2
|
+
import { n as sqliteSQLBuilder, t as pongoCollectionSQLiteMigrations } from "./index-FXnldVnn.cjs";
|
|
3
|
+
import { SQLite3DriverType } from "@event-driven-io/dumbo/sqlite3";
|
|
5
4
|
|
|
5
|
+
//#region src/storage/sqlite/sqlite3/index.d.ts
|
|
6
6
|
type SQLitePongoClientOptions = object;
|
|
7
|
-
type SQLiteDatabaseDriverOptions =
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type SQLiteDatabaseDriverOptions = PongoDriverOptions<SQLitePongoClientOptions> & {
|
|
8
|
+
databaseName?: string | undefined;
|
|
9
|
+
connectionString: string;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
13
|
-
|
|
14
|
-
export {
|
|
11
|
+
declare const sqlite3PongoDriver: PongoDriver<PongoDb<SQLite3DriverType>, SQLiteDatabaseDriverOptions>;
|
|
12
|
+
declare const useSqlite3PongoDriver: () => void;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SQLitePongoClientOptions, pongoCollectionSQLiteMigrations, sqlite3PongoDriver as pongoDriver, sqlite3PongoDriver as sqlite3Driver, sqliteSQLBuilder, useSqlite3PongoDriver };
|
|
15
|
+
//# sourceMappingURL=sqlite3.d.cts.map
|
package/dist/sqlite3.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '@event-driven-io/dumbo';
|
|
1
|
+
import { _t as PongoDb, in as PongoDriverOptions, rn as PongoDriver } from "./index-r7V4paf_.js";
|
|
2
|
+
import { n as sqliteSQLBuilder, t as pongoCollectionSQLiteMigrations } from "./index-CZOmOsQt.js";
|
|
3
|
+
import { SQLite3DriverType } from "@event-driven-io/dumbo/sqlite3";
|
|
5
4
|
|
|
5
|
+
//#region src/storage/sqlite/sqlite3/index.d.ts
|
|
6
6
|
type SQLitePongoClientOptions = object;
|
|
7
|
-
type SQLiteDatabaseDriverOptions =
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type SQLiteDatabaseDriverOptions = PongoDriverOptions<SQLitePongoClientOptions> & {
|
|
8
|
+
databaseName?: string | undefined;
|
|
9
|
+
connectionString: string;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
13
|
-
|
|
14
|
-
export {
|
|
11
|
+
declare const sqlite3PongoDriver: PongoDriver<PongoDb<SQLite3DriverType>, SQLiteDatabaseDriverOptions>;
|
|
12
|
+
declare const useSqlite3PongoDriver: () => void;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SQLitePongoClientOptions, pongoCollectionSQLiteMigrations, sqlite3PongoDriver as pongoDriver, sqlite3PongoDriver as sqlite3Driver, sqliteSQLBuilder, useSqlite3PongoDriver };
|
|
15
|
+
//# sourceMappingURL=sqlite3.d.ts.map
|
package/dist/sqlite3.js
CHANGED
|
@@ -1,65 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
import {
|
|
6
|
-
PongoCollectionSchemaComponent,
|
|
7
|
-
PongoDatabase,
|
|
8
|
-
PongoDatabaseSchemaComponent,
|
|
9
|
-
pongoDatabaseDriverRegistry,
|
|
10
|
-
pongoSchema
|
|
11
|
-
} from "./chunk-NCNRRYVE.js";
|
|
1
|
+
import { L as PongoCollectionSchemaComponent, d as PongoDatabase, f as PongoDatabaseSchemaComponent, p as pongoSchema, u as pongoDriverRegistry } from "./core-BHdOCUrr.js";
|
|
2
|
+
import { n as sqliteSQLBuilder, t as pongoCollectionSQLiteMigrations } from "./core-CH0SOCr3.js";
|
|
3
|
+
import { JSONSerializer, dumbo } from "@event-driven-io/dumbo";
|
|
4
|
+
import { SQLite3DriverType, sqlite3DumboDriver } from "@event-driven-io/dumbo/sqlite3";
|
|
12
5
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
sqlBuilder: sqliteSQLBuilder(schema.name)
|
|
40
|
-
}),
|
|
41
|
-
definition: options.schema?.definition ?? pongoSchema.db(databaseName, {})
|
|
42
|
-
}),
|
|
43
|
-
databaseName
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
getDatabaseNameOrDefault: (options) => {
|
|
47
|
-
return options.databaseName ?? getDatabaseNameOrDefault(options.connectionString);
|
|
48
|
-
},
|
|
49
|
-
defaultConnectionString: ":memory:"
|
|
6
|
+
//#region src/storage/sqlite/sqlite3/index.ts
|
|
7
|
+
const sqlite3PongoDriver = {
|
|
8
|
+
driverType: SQLite3DriverType,
|
|
9
|
+
databaseFactory: (options) => {
|
|
10
|
+
const databaseName = options.databaseName ?? "db:default";
|
|
11
|
+
return PongoDatabase({
|
|
12
|
+
...options,
|
|
13
|
+
pool: dumbo({
|
|
14
|
+
connectionString: options.connectionString,
|
|
15
|
+
driver: sqlite3DumboDriver,
|
|
16
|
+
...options.connectionOptions,
|
|
17
|
+
serialization: { serializer: options.serializer }
|
|
18
|
+
}),
|
|
19
|
+
schemaComponent: PongoDatabaseSchemaComponent({
|
|
20
|
+
driverType: SQLite3DriverType,
|
|
21
|
+
collectionFactory: (schema) => PongoCollectionSchemaComponent({
|
|
22
|
+
driverType: SQLite3DriverType,
|
|
23
|
+
definition: schema,
|
|
24
|
+
migrationsOrSchemaComponents: { migrations: pongoCollectionSQLiteMigrations(schema.name) },
|
|
25
|
+
sqlBuilder: sqliteSQLBuilder(schema.name, options.serialization?.serializer ?? JSONSerializer)
|
|
26
|
+
}),
|
|
27
|
+
definition: options.schema?.definition ?? pongoSchema.db(databaseName, {})
|
|
28
|
+
}),
|
|
29
|
+
databaseName
|
|
30
|
+
});
|
|
31
|
+
}
|
|
50
32
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
SQLite3DriverType,
|
|
54
|
-
sqlite3DatabaseDriver
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
useSqlite3DatabaseDriver();
|
|
58
|
-
export {
|
|
59
|
-
sqlite3DatabaseDriver as databaseDriver,
|
|
60
|
-
pongoCollectionSQLiteMigrations,
|
|
61
|
-
sqlite3DatabaseDriver as sqlite3Driver,
|
|
62
|
-
sqliteSQLBuilder,
|
|
63
|
-
useSqlite3DatabaseDriver
|
|
33
|
+
const useSqlite3PongoDriver = () => {
|
|
34
|
+
pongoDriverRegistry.register(SQLite3DriverType, sqlite3PongoDriver);
|
|
64
35
|
};
|
|
36
|
+
useSqlite3PongoDriver();
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { pongoCollectionSQLiteMigrations, sqlite3PongoDriver as pongoDriver, sqlite3PongoDriver as sqlite3Driver, sqliteSQLBuilder, useSqlite3PongoDriver };
|
|
65
40
|
//# sourceMappingURL=sqlite3.js.map
|
package/dist/sqlite3.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["import { dumbo } from '@event-driven-io/dumbo';\nimport {\n
|
|
1
|
+
{"version":3,"file":"sqlite3.js","names":["dumboDriver"],"sources":["../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["import { dumbo, JSONSerializer } from '@event-driven-io/dumbo';\nimport {\n sqlite3DumboDriver as dumboDriver,\n SQLite3DriverType,\n} from '@event-driven-io/dumbo/sqlite3';\nimport {\n PongoCollectionSchemaComponent,\n PongoDatabase,\n PongoDatabaseSchemaComponent,\n pongoDriverRegistry,\n pongoSchema,\n type PongoDb,\n type PongoDriver,\n type PongoDriverOptions,\n} from '../../../core';\nimport { pongoCollectionSQLiteMigrations, sqliteSQLBuilder } from '../core';\n\nexport type SQLitePongoClientOptions = object;\n\ntype SQLiteDatabaseDriverOptions =\n PongoDriverOptions<SQLitePongoClientOptions> & {\n databaseName?: string | undefined;\n connectionString: string;\n };\n\nconst sqlite3PongoDriver: PongoDriver<\n PongoDb<SQLite3DriverType>,\n SQLiteDatabaseDriverOptions\n> = {\n driverType: SQLite3DriverType,\n databaseFactory: (options) => {\n const databaseName = options.databaseName ?? 'db:default';\n\n return PongoDatabase({\n ...options,\n pool: dumbo({\n connectionString: options.connectionString,\n driver: dumboDriver,\n ...options.connectionOptions,\n serialization: { serializer: options.serializer },\n }),\n schemaComponent: PongoDatabaseSchemaComponent({\n driverType: SQLite3DriverType,\n collectionFactory: (schema) =>\n PongoCollectionSchemaComponent({\n driverType: SQLite3DriverType,\n definition: schema,\n migrationsOrSchemaComponents: {\n migrations: pongoCollectionSQLiteMigrations(schema.name),\n },\n sqlBuilder: sqliteSQLBuilder(\n schema.name,\n options.serialization?.serializer ?? JSONSerializer,\n ),\n }),\n definition:\n options.schema?.definition ?? pongoSchema.db(databaseName, {}),\n }),\n databaseName,\n });\n },\n};\n\nexport const useSqlite3PongoDriver = () => {\n pongoDriverRegistry.register(SQLite3DriverType, sqlite3PongoDriver);\n};\n\nuseSqlite3PongoDriver();\n\nexport {\n sqlite3PongoDriver as pongoDriver,\n sqlite3PongoDriver as sqlite3Driver,\n};\n"],"mappings":";;;;;;AAyBA,MAAM,qBAGF;CACF,YAAY;CACZ,kBAAkB,YAAY;EAC5B,MAAM,eAAe,QAAQ,gBAAgB;AAE7C,SAAO,cAAc;GACnB,GAAG;GACH,MAAM,MAAM;IACV,kBAAkB,QAAQ;IAC1B,QAAQA;IACR,GAAG,QAAQ;IACX,eAAe,EAAE,YAAY,QAAQ,YAAY;IAClD,CAAC;GACF,iBAAiB,6BAA6B;IAC5C,YAAY;IACZ,oBAAoB,WAClB,+BAA+B;KAC7B,YAAY;KACZ,YAAY;KACZ,8BAA8B,EAC5B,YAAY,gCAAgC,OAAO,KAAK,EACzD;KACD,YAAY,iBACV,OAAO,MACP,QAAQ,eAAe,cAAc,eACtC;KACF,CAAC;IACJ,YACE,QAAQ,QAAQ,cAAc,YAAY,GAAG,cAAc,EAAE,CAAC;IACjE,CAAC;GACF;GACD,CAAC;;CAEL;AAED,MAAa,8BAA8B;AACzC,qBAAoB,SAAS,mBAAmB,mBAAmB;;AAGrE,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-driven-io/pongo",
|
|
3
|
-
"version": "0.17.0-beta.
|
|
4
|
-
"description": "Pongo - Mongo with strong consistency on top of
|
|
3
|
+
"version": "0.17.0-beta.40",
|
|
4
|
+
"description": "Pongo - Mongo with strong consistency on top of PostgreSQL",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "tsdown",
|
|
8
8
|
"build:ts": "tsc -b",
|
|
9
9
|
"build:ts:watch": "tsc -b --watch",
|
|
10
10
|
"test": "run-s test:unit test:int test:e2e",
|
|
11
11
|
"test:postgresql": "run-s test:unit:postgresql test:int:postgresql test:e2e:postgresql",
|
|
12
12
|
"test:sqlite": "run-s test:unit:sqlite test:int:sqlite test:e2e:sqlite",
|
|
13
|
-
"test:unit": "
|
|
14
|
-
"test:unit:postgresql": "
|
|
15
|
-
"test:unit:sqlite": "
|
|
16
|
-
"test:int": "
|
|
17
|
-
"test:int:postgresql": "
|
|
18
|
-
"test:int:sqlite": "
|
|
19
|
-
"test:e2e": "
|
|
20
|
-
"test:e2e:postgresql": "
|
|
21
|
-
"test:e2e:sqlite": "
|
|
22
|
-
"test:
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
25
|
-
"test:
|
|
13
|
+
"test:unit": "vitest run \".unit.spec\"",
|
|
14
|
+
"test:unit:postgresql": "vitest run postgresql \".unit.spec\"",
|
|
15
|
+
"test:unit:sqlite": "vitest run sqlite \".unit.spec\"",
|
|
16
|
+
"test:int": "vitest run \".int.spec\"",
|
|
17
|
+
"test:int:postgresql": "vitest run postgresql \".int.spec\"",
|
|
18
|
+
"test:int:sqlite": "vitest run sqlite \".int.spec\"",
|
|
19
|
+
"test:e2e": "vitest run \".e2e.spec\"",
|
|
20
|
+
"test:e2e:postgresql": "vitest run postgresql \".e2e.spec\"",
|
|
21
|
+
"test:e2e:sqlite": "vitest run sqlite \".e2e.spec\"",
|
|
22
|
+
"test:file": "vitest run --no-file-parallelism",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:unit:watch": "vitest \".unit.spec\"",
|
|
25
|
+
"test:int:watch": "vitest \".int.spec\"",
|
|
26
|
+
"test:e2e:watch": "vitest \".e2e.spec\"",
|
|
26
27
|
"cli:sql:print": "tsx src/cli.ts migrate sql --collection users",
|
|
27
28
|
"cli:migrate:dryRun": "tsx src/cli.ts migrate run --config src/e2e/cli-config.ts -cs postgresql://postgres:postgres@localhost:5432/postgres",
|
|
28
29
|
"cli:config:print": "tsx src/cli.ts config sample --print",
|
|
@@ -91,22 +92,19 @@
|
|
|
91
92
|
"default": "./dist/sqlite3.cjs"
|
|
92
93
|
}
|
|
93
94
|
},
|
|
94
|
-
"./
|
|
95
|
+
"./cloudflare": {
|
|
95
96
|
"import": {
|
|
96
|
-
"types": "./dist/
|
|
97
|
-
"default": "./dist/
|
|
97
|
+
"types": "./dist/cloudflare.d.ts",
|
|
98
|
+
"default": "./dist/cloudflare.js"
|
|
98
99
|
},
|
|
99
100
|
"require": {
|
|
100
|
-
"types": "./dist/
|
|
101
|
-
"default": "./dist/
|
|
101
|
+
"types": "./dist/cloudflare.d.cts",
|
|
102
|
+
"default": "./dist/cloudflare.cjs"
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
},
|
|
105
106
|
"typesVersions": {
|
|
106
107
|
"*": {
|
|
107
|
-
".": [
|
|
108
|
-
"./dist/index.d.ts"
|
|
109
|
-
],
|
|
110
108
|
"shim": [
|
|
111
109
|
"./dist/shim.d.ts"
|
|
112
110
|
],
|
|
@@ -119,8 +117,8 @@
|
|
|
119
117
|
"sqlite3": [
|
|
120
118
|
"./dist/sqlite3.d.ts"
|
|
121
119
|
],
|
|
122
|
-
"
|
|
123
|
-
"./dist/
|
|
120
|
+
"cloudflare": [
|
|
121
|
+
"./dist/cloudflare.d.ts"
|
|
124
122
|
]
|
|
125
123
|
}
|
|
126
124
|
},
|
|
@@ -131,20 +129,22 @@
|
|
|
131
129
|
"dist"
|
|
132
130
|
],
|
|
133
131
|
"bin": {
|
|
134
|
-
"pongo": "
|
|
132
|
+
"pongo": "dist/cli.js"
|
|
135
133
|
},
|
|
136
|
-
"
|
|
137
|
-
"@event-driven-io/dumbo": "0.13.0-beta.
|
|
138
|
-
"@cloudflare/workers-types": "^4.20260115.0",
|
|
134
|
+
"dependencies": {
|
|
135
|
+
"@event-driven-io/dumbo": "0.13.0-beta.40",
|
|
139
136
|
"@types/mongodb": "^4.0.7",
|
|
140
|
-
"
|
|
141
|
-
"pg": "^8.16.3",
|
|
142
|
-
"uuid": "^13.0.0",
|
|
143
|
-
"ansis": "^4.1.0",
|
|
137
|
+
"ansis": "^4.2.0",
|
|
144
138
|
"cli-table3": "^0.6.5",
|
|
145
|
-
"commander": "^14.0.
|
|
146
|
-
"
|
|
147
|
-
"
|
|
139
|
+
"commander": "^14.0.3",
|
|
140
|
+
"lru-cache": "^11.3.5",
|
|
141
|
+
"uuid": "^14.0.0"
|
|
142
|
+
},
|
|
143
|
+
"peerDependencies": {
|
|
144
|
+
"@cloudflare/workers-types": "^4.20260421.1",
|
|
145
|
+
"@types/pg": "^8.20.0",
|
|
146
|
+
"pg": "^8.20.0",
|
|
147
|
+
"sqlite3": "^6.0.1"
|
|
148
148
|
},
|
|
149
149
|
"peerDependenciesMeta": {
|
|
150
150
|
"@types/pg": {
|
|
@@ -153,9 +153,6 @@
|
|
|
153
153
|
"pg": {
|
|
154
154
|
"optional": true
|
|
155
155
|
},
|
|
156
|
-
"pg-connection-string": {
|
|
157
|
-
"optional": true
|
|
158
|
-
},
|
|
159
156
|
"sqlite3": {
|
|
160
157
|
"optional": true
|
|
161
158
|
},
|
|
@@ -164,9 +161,10 @@
|
|
|
164
161
|
}
|
|
165
162
|
},
|
|
166
163
|
"devDependencies": {
|
|
167
|
-
"@types
|
|
168
|
-
"
|
|
169
|
-
"pg
|
|
170
|
-
"
|
|
164
|
+
"@cloudflare/workers-types": "^4.20260421.1",
|
|
165
|
+
"@types/node": "^25.6.0",
|
|
166
|
+
"@types/pg": "^8.20.0",
|
|
167
|
+
"pg": "^8.20.0",
|
|
168
|
+
"sqlite3": "^6.0.1"
|
|
171
169
|
}
|
|
172
170
|
}
|