@event-driven-io/pongo 0.17.0-beta.2 → 0.17.0-beta.21
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/{chunk-ECQ2CKZE.cjs → chunk-A4DCNQJR.cjs} +45 -43
- package/dist/chunk-A4DCNQJR.cjs.map +1 -0
- package/dist/{chunk-4BL6YWLW.cjs → chunk-BZRKCNRY.cjs} +105 -72
- package/dist/chunk-BZRKCNRY.cjs.map +1 -0
- package/dist/{chunk-NCNRRYVE.js → chunk-H637RRXS.js} +85 -52
- package/dist/chunk-H637RRXS.js.map +1 -0
- package/dist/{chunk-Y7LRKJLJ.js → chunk-TTZGGAZV.js} +40 -38
- package/dist/chunk-TTZGGAZV.js.map +1 -0
- package/dist/cli.cjs +43 -37
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +34 -28
- package/dist/cli.js.map +1 -1
- package/dist/cloudflare.cjs +53 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +11 -0
- package/dist/cloudflare.d.ts +11 -0
- package/dist/{d1.js → cloudflare.js} +19 -20
- package/dist/cloudflare.js.map +1 -0
- package/dist/{index-BJopB-em.d.cts → index-BAiq0hu3.d.cts} +3 -2
- package/dist/{index-G5DECNb_.d.ts → index-DF5J9nRH.d.ts} +3 -2
- package/dist/index.cjs +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -9
- package/dist/index.d.ts +17 -9
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +344 -4
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +10 -9
- package/dist/pg.d.ts +10 -9
- package/dist/pg.js +350 -10
- package/dist/pg.js.map +1 -1
- package/dist/{pongoCollectionSchemaComponent-t_e9n2Wc.d.ts → pongoCollectionSchemaComponent-BhsINgDe.d.cts} +44 -34
- package/dist/{pongoCollectionSchemaComponent-t_e9n2Wc.d.cts → pongoCollectionSchemaComponent-BhsINgDe.d.ts} +44 -34
- package/dist/shim.cjs +12 -14
- package/dist/shim.cjs.map +1 -1
- package/dist/shim.d.cts +4 -4
- package/dist/shim.d.ts +4 -4
- package/dist/shim.js +7 -9
- package/dist/shim.js.map +1 -1
- package/dist/sqlite3.cjs +21 -26
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +6 -6
- package/dist/sqlite3.d.ts +6 -6
- package/dist/sqlite3.js +20 -25
- package/dist/sqlite3.js.map +1 -1
- package/package.json +50 -36
- package/dist/chunk-4BL6YWLW.cjs.map +0 -1
- package/dist/chunk-ECQ2CKZE.cjs.map +0 -1
- package/dist/chunk-EYQDS752.js +0 -364
- package/dist/chunk-EYQDS752.js.map +0 -1
- package/dist/chunk-NCNRRYVE.js.map +0 -1
- package/dist/chunk-WH26IXHN.js +0 -10
- package/dist/chunk-WH26IXHN.js.map +0 -1
- package/dist/chunk-WKW4LGF6.cjs +0 -10
- package/dist/chunk-WKW4LGF6.cjs.map +0 -1
- package/dist/chunk-Y7LRKJLJ.js.map +0 -1
- package/dist/chunk-ZPWKWNK2.cjs +0 -364
- package/dist/chunk-ZPWKWNK2.cjs.map +0 -1
- package/dist/d1.cjs +0 -54
- 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.map +0 -1
- package/dist/pg-73DOKU64.js +0 -11
- package/dist/pg-73DOKU64.js.map +0 -1
- package/dist/pg-I267A7IL.cjs +0 -11
- package/dist/pg-I267A7IL.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabaseDriverType, SchemaComponent, MigrationStyle, WithDatabaseTransactionFactory, AnyConnection, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, SchemaComponentOptions } from '@event-driven-io/dumbo';
|
|
1
|
+
import { DatabaseDriverType, SchemaComponent, JSONSerializationOptions, MigrationStyle, JSONSerializer, WithDatabaseTransactionFactory, AnyConnection, DatabaseTransaction, SQLExecutor, SQL, RunSQLMigrationsResult, QueryResultRow, QueryResult, SQLQueryOptions, SQLCommandOptions, SchemaComponentOptions } from '@event-driven-io/dumbo';
|
|
2
2
|
|
|
3
3
|
interface PongoCollectionSchema<T extends PongoDocument = PongoDocument> {
|
|
4
4
|
name: string;
|
|
@@ -68,49 +68,42 @@ type PongoDatabaseSQLBuilder<DriverType extends DatabaseDriverType = DatabaseDri
|
|
|
68
68
|
collection: PongoCollectionSQLBuilder;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
type PongoDriverOptions<ConnectionOptions = unknown> = {
|
|
72
72
|
connectionOptions?: ConnectionOptions | undefined;
|
|
73
|
-
}
|
|
74
|
-
type
|
|
75
|
-
type PongoDatabaseFactoryOptions<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>, DriverOptions extends
|
|
73
|
+
} & JSONSerializationOptions;
|
|
74
|
+
type AnyPongoDriverOptions = PongoDriverOptions<any>;
|
|
75
|
+
type PongoDatabaseFactoryOptions<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>, DriverOptions extends AnyPongoDriverOptions = AnyPongoDriverOptions> = {
|
|
76
76
|
databaseName?: string | undefined;
|
|
77
77
|
schema?: {
|
|
78
78
|
autoMigration?: MigrationStyle;
|
|
79
79
|
definition?: PongoDbSchema<CollectionsSchema>;
|
|
80
80
|
} | undefined;
|
|
81
|
+
serializer: JSONSerializer;
|
|
81
82
|
errors?: {
|
|
82
83
|
throwOnOperationFailures?: boolean;
|
|
83
84
|
} | undefined;
|
|
84
85
|
} & DriverOptions;
|
|
85
|
-
|
|
86
|
-
databaseName?: string | undefined;
|
|
87
|
-
};
|
|
88
|
-
type DatabaseDriverOptionsWithConnectionString = {
|
|
89
|
-
connectionString?: string | undefined;
|
|
90
|
-
};
|
|
91
|
-
interface PongoDatabaseDriver<Database extends AnyPongoDb = AnyPongoDb, DriverOptions extends AnyPongoDatabaseDriverOptions = AnyPongoDatabaseDriverOptions> {
|
|
86
|
+
interface PongoDriver<Database extends AnyPongoDb = AnyPongoDb, DriverOptions extends AnyPongoDriverOptions = AnyPongoDriverOptions> {
|
|
92
87
|
driverType: Database['driverType'];
|
|
93
88
|
databaseFactory<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>>(options: PongoDatabaseFactoryOptions<CollectionsSchema, DriverOptions>): Database & PongoDb<Database['driverType']>;
|
|
94
|
-
getDatabaseNameOrDefault?<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>>(options: PongoDatabaseFactoryOptions<CollectionsSchema, DriverOptions>): string;
|
|
95
|
-
defaultConnectionString: string;
|
|
96
89
|
}
|
|
97
|
-
type
|
|
98
|
-
type
|
|
99
|
-
type ExtractPongoDatabaseTypeFromDriver<DatabaseDriver> = DatabaseDriver extends
|
|
100
|
-
declare const
|
|
101
|
-
register: <Database extends AnyPongoDb = AnyPongoDb>(driverType: Database["driverType"], driver:
|
|
102
|
-
tryResolve: <Driver extends
|
|
103
|
-
tryGet: <Driver extends
|
|
90
|
+
type AnyPongoDriver = PongoDriver<AnyPongoDb, AnyPongoDriverOptions>;
|
|
91
|
+
type ExtractPongoDriverOptions<DatabaseDriver> = DatabaseDriver extends PongoDriver<any, infer O> ? O : never;
|
|
92
|
+
type ExtractPongoDatabaseTypeFromDriver<DatabaseDriver> = DatabaseDriver extends PongoDriver<infer D, any> ? D : never;
|
|
93
|
+
declare const PongoDriverRegistry: () => {
|
|
94
|
+
register: <Database extends AnyPongoDb = AnyPongoDb>(driverType: Database["driverType"], driver: PongoDriver<Database> | (() => Promise<PongoDriver<Database>>)) => void;
|
|
95
|
+
tryResolve: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Promise<Driver | null>;
|
|
96
|
+
tryGet: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Driver | null;
|
|
104
97
|
has: (driverType: DatabaseDriverType) => boolean;
|
|
105
98
|
readonly databaseDriverTypes: DatabaseDriverType[];
|
|
106
99
|
};
|
|
107
100
|
declare global {
|
|
108
|
-
var
|
|
101
|
+
var pongoDriverRegistry: ReturnType<typeof PongoDriverRegistry>;
|
|
109
102
|
}
|
|
110
|
-
declare const
|
|
111
|
-
register: <Database extends AnyPongoDb = AnyPongoDb>(driverType: Database["driverType"], driver:
|
|
112
|
-
tryResolve: <Driver extends
|
|
113
|
-
tryGet: <Driver extends
|
|
103
|
+
declare const pongoDriverRegistry: {
|
|
104
|
+
register: <Database extends AnyPongoDb = AnyPongoDb>(driverType: Database["driverType"], driver: PongoDriver<Database> | (() => Promise<PongoDriver<Database>>)) => void;
|
|
105
|
+
tryResolve: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Promise<Driver | null>;
|
|
106
|
+
tryGet: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Driver | null;
|
|
114
107
|
has: (driverType: DatabaseDriverType) => boolean;
|
|
115
108
|
readonly databaseDriverTypes: DatabaseDriverType[];
|
|
116
109
|
};
|
|
@@ -123,7 +116,7 @@ interface PongoClient<DriverType extends DatabaseDriverType = DatabaseDriverType
|
|
|
123
116
|
startSession(): PongoSession<DriverType>;
|
|
124
117
|
withSession<T = unknown>(callback: (session: PongoSession<DriverType>) => Promise<T>): Promise<T>;
|
|
125
118
|
}
|
|
126
|
-
type PongoClientOptions<DatabaseDriver extends
|
|
119
|
+
type PongoClientOptions<DatabaseDriver extends AnyPongoDriver = AnyPongoDriver, TypedClientSchema extends PongoClientSchema = PongoClientSchema> = ExtractPongoDriverOptions<DatabaseDriver> extends infer Options ? Options extends unknown ? {
|
|
127
120
|
driver: DatabaseDriver;
|
|
128
121
|
schema?: {
|
|
129
122
|
autoMigration?: MigrationStyle;
|
|
@@ -132,7 +125,7 @@ type PongoClientOptions<DatabaseDriver extends AnyPongoDatabaseDriver = AnyPongo
|
|
|
132
125
|
errors?: {
|
|
133
126
|
throwOnOperationFailures?: boolean;
|
|
134
127
|
} | undefined;
|
|
135
|
-
} & Omit<Options, 'driver'> : never : never;
|
|
128
|
+
} & JSONSerializationOptions & Omit<Options, 'driver'> : never : never;
|
|
136
129
|
declare interface PongoTransactionOptions {
|
|
137
130
|
get snapshotEnabled(): boolean;
|
|
138
131
|
maxCommitTimeMS?: number;
|
|
@@ -162,23 +155,39 @@ interface PongoSession<DriverType extends DatabaseDriverType = DatabaseDriverTyp
|
|
|
162
155
|
abortTransaction(): Promise<void>;
|
|
163
156
|
withTransaction<T = unknown>(fn: (session: PongoSession<DriverType>) => Promise<T>, options?: PongoTransactionOptions): Promise<T>;
|
|
164
157
|
}
|
|
158
|
+
type PongoDBCollectionOptions<T extends PongoDocument, Payload extends PongoDocument = T> = {
|
|
159
|
+
schema?: {
|
|
160
|
+
versioning?: {
|
|
161
|
+
upcast?: (document: Payload) => T;
|
|
162
|
+
downcast?: (document: T) => Payload;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
errors?: {
|
|
166
|
+
throwOnOperationFailures?: boolean;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
165
169
|
interface PongoDb<DriverType extends DatabaseDriverType = DatabaseDriverType> extends WithDatabaseTransactionFactory<AnyConnection> {
|
|
166
170
|
driverType: DriverType;
|
|
167
171
|
databaseName: string;
|
|
168
172
|
connect(): Promise<void>;
|
|
169
173
|
close(): Promise<void>;
|
|
170
|
-
collection<T extends PongoDocument>(name: string): PongoCollection<T>;
|
|
174
|
+
collection<T extends PongoDocument, Payload extends PongoDocument = T>(name: string, options?: PongoDBCollectionOptions<T, Payload>): PongoCollection<T>;
|
|
171
175
|
collections(): ReadonlyArray<PongoCollection<PongoDocument>>;
|
|
172
176
|
readonly schema: Readonly<{
|
|
173
177
|
component: PongoDatabaseSchemaComponent<DriverType>;
|
|
174
|
-
migrate(): Promise<
|
|
178
|
+
migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
|
|
175
179
|
}>;
|
|
176
180
|
sql: {
|
|
177
|
-
query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions): Promise<Result[]>;
|
|
178
|
-
command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions): Promise<QueryResult<Result>>;
|
|
181
|
+
query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions & SQLQueryOptions): Promise<Result[]>;
|
|
182
|
+
command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions & SQLCommandOptions): Promise<QueryResult<Result>>;
|
|
179
183
|
};
|
|
180
184
|
}
|
|
181
185
|
type AnyPongoDb = PongoDb<DatabaseDriverType>;
|
|
186
|
+
type PongoMigrationOptions = {
|
|
187
|
+
dryRun?: boolean | undefined;
|
|
188
|
+
ignoreMigrationHashMismatch?: boolean | undefined;
|
|
189
|
+
migrationTimeoutMs?: number | undefined;
|
|
190
|
+
};
|
|
182
191
|
type CollectionOperationOptions = {
|
|
183
192
|
session?: PongoSession;
|
|
184
193
|
};
|
|
@@ -232,7 +241,7 @@ interface PongoCollection<T extends PongoDocument> {
|
|
|
232
241
|
handle(id: string, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
|
|
233
242
|
readonly schema: Readonly<{
|
|
234
243
|
component: PongoCollectionSchemaComponent;
|
|
235
|
-
migrate(): Promise<
|
|
244
|
+
migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
|
|
236
245
|
}>;
|
|
237
246
|
sql: {
|
|
238
247
|
query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions): Promise<Result[]>;
|
|
@@ -352,6 +361,7 @@ type OperationResult = {
|
|
|
352
361
|
declare const operationResult: <T extends OperationResult>(result: Omit<T, "assertSuccess" | "acknowledged" | "assertSuccessful">, options: {
|
|
353
362
|
operationName: string;
|
|
354
363
|
collectionName: string;
|
|
364
|
+
serializer: JSONSerializer;
|
|
355
365
|
errors?: {
|
|
356
366
|
throwOnOperationFailures?: boolean;
|
|
357
367
|
} | undefined;
|
|
@@ -423,4 +433,4 @@ type PongoCollectionSchemaComponent = SchemaComponent<PongoCollectionURN> & {
|
|
|
423
433
|
};
|
|
424
434
|
declare const PongoCollectionSchemaComponent: <DriverType extends DatabaseDriverType = DatabaseDriverType>({ definition, migrationsOrSchemaComponents, sqlBuilder, }: PongoCollectionSchemaComponentOptions<DriverType>) => PongoCollectionSchemaComponent;
|
|
425
435
|
|
|
426
|
-
export { type DeleteOneOptions as $, type AnyPongoDb as A, type
|
|
436
|
+
export { type DeleteOneOptions as $, type AnyPongoDb as A, type ExtractPongoDriverOptions as B, type CollectionOperationOptions as C, PongoDriverRegistry as D, type ExtractPongoDatabaseTypeFromDriver as E, pongoDriverRegistry as F, type CollectionsMap as G, type PongoDbWithSchema as H, type DBsMap as I, pongoSchema as J, proxyPongoDbWithSchema as K, proxyClientWithSchema as L, type PongoCollectionSchemaMetadata as M, type PongoDbSchemaMetadata as N, type PongoClientSchemaMetadata as O, type PongoDriver as P, toDbSchemaMetadata as Q, toClientSchemaMetadata as R, type PongoSchemaConfig as S, type PongoDBCollectionOptions as T, type PongoMigrationOptions as U, type InsertOneOptions as V, type InsertManyOptions as W, type UpdateOneOptions as X, type UpdateManyOptions as Y, type HandleOptions as Z, type ReplaceOneOptions as _, type PongoDb as a, type DeleteManyOptions as a0, type FindOptions as a1, ObjectId as a2, type HasId as a3, type InferIdType as a4, type EnhancedOmit as a5, type OptionalUnlessRequiredId as a6, type OptionalUnlessRequiredVersion as a7, type OptionalUnlessRequiredIdAndVersion as a8, type WithId as a9, isGeneralExpectedDocumentVersion as aA, expectedVersionValue as aB, expectedVersion as aC, type PongoUpdate as aD, type OperationResult as aE, operationResult as aF, type PongoInsertOneResult as aG, type PongoInsertManyResult as aH, type PongoUpdateResult as aI, type PongoUpdateManyResult as aJ, type PongoDeleteResult as aK, type PongoDeleteManyResult as aL, type PongoHandleResult as aM, type DocumentHandler as aN, type WithoutId as aa, type WithVersion as ab, type WithoutVersion as ac, type WithIdAndVersion as ad, type WithoutIdAndVersion as ae, type RegExpOrString as af, type Document as ag, type OptionalId as ah, type OptionalVersion as ai, type ObjectIdLike as aj, type NonObjectIdLikeDocument as ak, type AlternativeType as al, type Condition as am, type PongoFilter as an, type RootFilterOperators as ao, type PongoFilterOperator as ap, type $set as aq, type $unset as ar, type $inc as as, type $push as at, type ExpectedDocumentVersionGeneral as au, type ExpectedDocumentVersionValue as av, type ExpectedDocumentVersion as aw, DOCUMENT_EXISTS as ax, DOCUMENT_DOES_NOT_EXIST as ay, NO_CONCURRENCY_CHECK as az, type PongoDriverOptions as b, type PongoDocument as c, PongoCollectionSchemaComponent as d, type PongoCollection as e, type PongoClientSchema as f, type PongoCollectionSchema as g, type PongoDatabaseFactoryOptions as h, PongoDatabaseSchemaComponent as i, type PongoDbSchema as j, type AnyPongoDriver as k, type PongoClientOptions as l, type PongoClient as m, type PongoClientWithSchema as n, type PongoTransactionOptions as o, type PongoSession as p, type PongoDbTransaction as q, type PongoCollectionSQLBuilder as r, type PongoCollectionURNType as s, type PongoCollectionURN as t, type PongoCollectionSchemaComponentOptions as u, type PongoDatabaseURNType as v, type PongoDatabaseURN as w, type PongoDatabaseSchemaComponentOptions as x, type PongoDatabaseSQLBuilder as y, type AnyPongoDriverOptions as z };
|
package/dist/shim.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
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;
|
|
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
|
-
|
|
5
|
-
var _chunk4BL6YWLWcjs = require('./chunk-4BL6YWLW.cjs');
|
|
4
|
+
var _chunkBZRKCNRYcjs = require('./chunk-BZRKCNRY.cjs');
|
|
6
5
|
|
|
7
6
|
// src/mongo/findCursor.ts
|
|
8
7
|
var FindCursor = (_class = class {
|
|
@@ -41,10 +40,6 @@ var FindCursor = (_class = class {
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
var _dumbo = require('@event-driven-io/dumbo');
|
|
44
|
-
require('http2');
|
|
45
|
-
|
|
46
|
-
// src/mongo/mongoDb.ts
|
|
47
|
-
require('mongodb');
|
|
48
43
|
|
|
49
44
|
// src/mongo/mongoCollection.ts
|
|
50
45
|
var toCollectionOperationOptions = (options) => _optionalChain([options, 'optionalAccess', _ => _.session]) ? { session: options.session } : void 0;
|
|
@@ -319,8 +314,11 @@ var Db = class {
|
|
|
319
314
|
get databaseName() {
|
|
320
315
|
return this.pongoDb.databaseName;
|
|
321
316
|
}
|
|
322
|
-
collection(collectionName) {
|
|
323
|
-
return new Collection(
|
|
317
|
+
collection(collectionName, options) {
|
|
318
|
+
return new Collection(
|
|
319
|
+
this,
|
|
320
|
+
this.pongoDb.collection(collectionName, options)
|
|
321
|
+
);
|
|
324
322
|
}
|
|
325
323
|
};
|
|
326
324
|
|
|
@@ -329,13 +327,13 @@ var MongoClient = class {
|
|
|
329
327
|
|
|
330
328
|
constructor(connectionStringOrOptions, options) {
|
|
331
329
|
if (typeof connectionStringOrOptions !== "string") {
|
|
332
|
-
this.pongoClient =
|
|
330
|
+
this.pongoClient = _chunkBZRKCNRYcjs.pongoClient.call(void 0, connectionStringOrOptions);
|
|
333
331
|
return;
|
|
334
332
|
}
|
|
335
333
|
const { databaseType, driverName } = _dumbo.parseConnectionString.call(void 0,
|
|
336
334
|
connectionStringOrOptions
|
|
337
335
|
);
|
|
338
|
-
const driver = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _8 => _8.driver]), () => (
|
|
336
|
+
const driver = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _8 => _8.driver]), () => ( pongoDriverRegistry.tryGet(
|
|
339
337
|
_dumbo.toDatabaseDriverType.call(void 0, databaseType, driverName)
|
|
340
338
|
)));
|
|
341
339
|
if (driver === null) {
|
|
@@ -343,7 +341,7 @@ var MongoClient = class {
|
|
|
343
341
|
`No database driver registered for ${databaseType} with name ${driverName}`
|
|
344
342
|
);
|
|
345
343
|
}
|
|
346
|
-
this.pongoClient =
|
|
344
|
+
this.pongoClient = _chunkBZRKCNRYcjs.pongoClient.call(void 0, {
|
|
347
345
|
..._nullishCoalesce(options, () => ( {})),
|
|
348
346
|
...{ connectionString: connectionStringOrOptions },
|
|
349
347
|
driver
|
|
@@ -360,12 +358,12 @@ var MongoClient = class {
|
|
|
360
358
|
return new Db(this.pongoClient.db(dbName));
|
|
361
359
|
}
|
|
362
360
|
startSession(_options) {
|
|
363
|
-
return
|
|
361
|
+
return _chunkBZRKCNRYcjs.pongoSession.call(void 0, );
|
|
364
362
|
}
|
|
365
363
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
366
364
|
async withSession(optionsOrExecutor, executor) {
|
|
367
365
|
const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
|
|
368
|
-
const session =
|
|
366
|
+
const session = _chunkBZRKCNRYcjs.pongoSession.call(void 0, );
|
|
369
367
|
try {
|
|
370
368
|
return await callback(session);
|
|
371
369
|
} 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/mongoClient.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.ts"],"names":[],"mappings":"AAAA,6tBAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACNO,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;A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AA;AASM,EAAA;AAIE,IAAA;AAGA,IAAA;AAEF,IAAA;AACF,MAAA;AACF,IAAA;AACQ,MAAA;AACR,IAAA;AACF,EAAA;AACF;AFwQY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","sourcesContent":[null,"export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import {\n parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport { type ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type 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"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","../src/mongo/findCursor.ts","../src/mongo/mongoClient.ts","../src/mongo/mongoCollection.ts","../src/mongo/m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,uBAAA;AACD,MAAA;AACF,IAAA;AACF,EAAA;AAQA,EAAA;AAIQ,IAAA;AACR,EAAA;AACA,EAAA;AACQ,IAAA;AACR,EAAA;AACA,EAAA;AAGQ,IAAA;AACR,EAAA;AACA,EAAA;AACQ,IAAA;AACR,EAAA;AACA,EAAA;AACQ,IAAA;AACR,EAAA;AAEM,EAAA;AACE,IAAA;AACR,EAAA;AACM,EAAA;AAKG,IAAA;AACT,EAAA;AACF;AH9QY;AACA;AIxSL;AACG,EAAA;AACR,EAAA;AACO,IAAA;AACP,EAAA;AAEI,EAAA;AACK,IAAA;AACT,EAAA;AAEA,EAAA;AAUS,IAAA;AACL,MAAA;AACK,MAAA;AACP,IAAA;AACF,EAAA;AACF;AJ+RY;AACA;AEpTC;AAIH,EAAA;AAcR,EAAA;AAWM,IAAA;AACG,MAAA;AACL,MAAA;AACF,IAAA;AAEQ,IAAA;AACN,MAAA;AACF,IAAA;AAEM,IAAA;AAGF,MAAA;AACF,IAAA;AAEE,IAAA;AACI,MAAA;AACJ,QAAA;AACF,MAAA;AACF,IAAA;AAEK,IAAA;AACC,MAAA;AACC,MAAA;AACL,MAAA;AACD,IAAA;AACH,EAAA;AAEM,EAAA;AACE,IAAA;AACC,IAAA;AACT,EAAA;AAEM,EAAA;AACE,IAAA;AACR,EAAA;AAEG,EAAA;AACM,IAAA;AACT,EAAA;AACA,EAAA;AACS,IAAA;AACT,EAAA;AAAA;AASM,EAAA;AAIE,IAAA;AAGA,IAAA;AAEF,IAAA;AACF,MAAA;AACF,IAAA;AACQ,MAAA;AACR,IAAA;AACF,EAAA;AACF;AFsQY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","sourcesContent":[null,"export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import {\n parseConnectionString,\n toDatabaseDriverType,\n} from '@event-driven-io/dumbo';\nimport type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type AnyPongoDriver,\n type PongoClient,\n type PongoClientOptions,\n type PongoClientSchema,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient<\n DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver,\n TypedClientSchema extends PongoClientSchema = PongoClientSchema,\n> {\n private pongoClient: PongoClient;\n\n constructor(\n options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n );\n constructor(\n connectionString: string,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n );\n constructor(\n connectionStringOrOptions:\n | string\n | PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n options?: Omit<\n PongoClientOptions<DatabaseDriverType, TypedClientSchema>,\n 'connectionString'\n > & {\n driver?: AnyPongoDriver;\n },\n ) {\n if (typeof connectionStringOrOptions !== 'string') {\n this.pongoClient = pongoClient(connectionStringOrOptions);\n return;\n }\n\n const { databaseType, driverName } = parseConnectionString(\n connectionStringOrOptions,\n );\n\n const driver =\n options?.driver ??\n pongoDriverRegistry.tryGet(\n toDatabaseDriverType(databaseType, driverName),\n );\n\n if (driver === null) {\n throw new Error(\n `No database driver registered for ${databaseType} with name ${driverName}`,\n );\n }\n\n this.pongoClient = pongoClient({\n ...(options ?? {}),\n ...{ connectionString: connectionStringOrOptions },\n driver,\n });\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n Db,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n FindOptions as PongoFindOptions,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport type { Db as ShimDb } from '../shim';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nconst toFindOptions = (\n options: FindOptions | undefined,\n): PongoFindOptions | undefined => {\n if (!options?.session && !options?.limit && !options?.skip) {\n return undefined;\n }\n\n const pongoFindOptions: PongoFindOptions = {};\n\n if (options?.session) {\n pongoFindOptions.session = options.session as unknown as PongoSession;\n }\n if (options?.limit !== undefined) {\n pongoFindOptions.limit = options.limit;\n }\n if (options?.skip !== undefined) {\n pongoFindOptions.skip = options.skip;\n }\n\n return pongoFindOptions;\n};\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n private database: ShimDb;\n\n constructor(database: ShimDb, collection: PongoCollection<T>) {\n this.collection = collection;\n this.database = database;\n }\n get db(): Db {\n return this.database as unknown as Db;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n get timeoutMS(): number | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n ) as unknown as Promise<UpdateResult<T>>;\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateMany(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(\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<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<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n estimatedDocumentCount(\n options?: EstimatedDocumentCountOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T>,\n options?: CountDocumentsOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n options: CommandOperationOptions,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string): Promise<any[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string, filter: Filter<T>): Promise<any[]>;\n distinct(\n key: string,\n filter: Filter<T>,\n options: CommandOperationOptions, // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any[]>;\n distinct(\n _key: unknown,\n _filter?: unknown,\n _options?: unknown,\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-imports\n Promise<any[]> | Promise<import('mongodb').Flatten<WithId<T>[Key]>[]> {\n throw new Error('Method not implemented.');\n }\n indexes(\n options: IndexInformationOptions & { full?: true | undefined },\n ): Promise<IndexDescriptionInfo[]>;\n indexes(\n options: IndexInformationOptions & { full: false },\n ): Promise<IndexDescriptionCompact>;\n indexes(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;\n indexes(\n _options?: unknown,\n ):\n | Promise<IndexDescriptionInfo[]>\n | Promise<IndexDescriptionCompact>\n | Promise<IndexDescriptionCompact | IndexDescriptionInfo[]> {\n throw new Error('Method not implemented.');\n }\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null>;\n findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: unknown,\n options?: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndDelete(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: unknown,\n replacement: unknown,\n options?: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndReplace(\n filter as PongoFilter<T>,\n replacement as WithoutId<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: unknown,\n update: unknown,\n options?: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndUpdate(\n filter as PongoFilter<T>,\n update as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n aggregate<T extends Document = Document>(\n _pipeline?: Document[],\n _options?: AggregateOptions,\n ): AggregationCursor<T> {\n throw new Error('Method not implemented.');\n }\n watch<\n TLocal extends Document = T,\n TChange extends Document = ChangeStreamDocument<TLocal>,\n >(\n _pipeline?: Document[],\n _options?: ChangeStreamOptions,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(filter?: Filter<T>, options?: CountOptions): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { Collection as MongoCollection, ObjectId } from 'mongodb';\nimport type { Document } from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoDBCollectionOptions,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n private pongoDb: PongoDb;\n constructor(pongoDb: PongoDb) {\n this.pongoDb = pongoDb;\n }\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n options?: PongoDBCollectionOptions<T>,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(\n this,\n this.pongoDb.collection<T>(collectionName, options),\n );\n }\n}\n"]}
|
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, Db as Db$1, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
|
|
3
|
-
import { a as PongoDb, aN as DocumentHandler, Z as HandleOptions, aM as PongoHandleResult, k as
|
|
3
|
+
import { a as PongoDb, T as PongoDBCollectionOptions, aN as DocumentHandler, Z as HandleOptions, aM as PongoHandleResult, k as AnyPongoDriver, f as PongoClientSchema, l as PongoClientOptions, e as PongoCollection } from './pongoCollectionSchemaComponent-BhsINgDe.cjs';
|
|
4
4
|
import '@event-driven-io/dumbo';
|
|
5
5
|
|
|
6
6
|
declare class FindCursor<T> {
|
|
@@ -19,16 +19,16 @@ declare class Db {
|
|
|
19
19
|
private pongoDb;
|
|
20
20
|
constructor(pongoDb: PongoDb);
|
|
21
21
|
get databaseName(): string;
|
|
22
|
-
collection<T extends Document>(collectionName: string): Collection$1<T> & {
|
|
22
|
+
collection<T extends Document>(collectionName: string, options?: PongoDBCollectionOptions<T>): Collection$1<T> & {
|
|
23
23
|
handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
declare class MongoClient<DatabaseDriverType extends
|
|
27
|
+
declare class MongoClient<DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver, TypedClientSchema extends PongoClientSchema = PongoClientSchema> {
|
|
28
28
|
private pongoClient;
|
|
29
29
|
constructor(options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>);
|
|
30
30
|
constructor(connectionString: string, options?: Omit<PongoClientOptions<DatabaseDriverType, TypedClientSchema>, 'connectionString'> & {
|
|
31
|
-
driver?:
|
|
31
|
+
driver?: AnyPongoDriver;
|
|
32
32
|
});
|
|
33
33
|
connect(): Promise<this>;
|
|
34
34
|
close(): Promise<void>;
|
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, Db as Db$1, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
|
|
3
|
-
import { a as PongoDb, aN as DocumentHandler, Z as HandleOptions, aM as PongoHandleResult, k as
|
|
3
|
+
import { a as PongoDb, T as PongoDBCollectionOptions, aN as DocumentHandler, Z as HandleOptions, aM as PongoHandleResult, k as AnyPongoDriver, f as PongoClientSchema, l as PongoClientOptions, e as PongoCollection } from './pongoCollectionSchemaComponent-BhsINgDe.js';
|
|
4
4
|
import '@event-driven-io/dumbo';
|
|
5
5
|
|
|
6
6
|
declare class FindCursor<T> {
|
|
@@ -19,16 +19,16 @@ declare class Db {
|
|
|
19
19
|
private pongoDb;
|
|
20
20
|
constructor(pongoDb: PongoDb);
|
|
21
21
|
get databaseName(): string;
|
|
22
|
-
collection<T extends Document>(collectionName: string): Collection$1<T> & {
|
|
22
|
+
collection<T extends Document>(collectionName: string, options?: PongoDBCollectionOptions<T>): Collection$1<T> & {
|
|
23
23
|
handle(id: ObjectId, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
declare class MongoClient<DatabaseDriverType extends
|
|
27
|
+
declare class MongoClient<DatabaseDriverType extends AnyPongoDriver = AnyPongoDriver, TypedClientSchema extends PongoClientSchema = PongoClientSchema> {
|
|
28
28
|
private pongoClient;
|
|
29
29
|
constructor(options: PongoClientOptions<DatabaseDriverType, TypedClientSchema>);
|
|
30
30
|
constructor(connectionString: string, options?: Omit<PongoClientOptions<DatabaseDriverType, TypedClientSchema>, 'connectionString'> & {
|
|
31
|
-
driver?:
|
|
31
|
+
driver?: AnyPongoDriver;
|
|
32
32
|
});
|
|
33
33
|
connect(): Promise<this>;
|
|
34
34
|
close(): Promise<void>;
|
package/dist/shim.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import "./chunk-WH26IXHN.js";
|
|
2
1
|
import {
|
|
3
2
|
pongoClient,
|
|
4
3
|
pongoSession
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H637RRXS.js";
|
|
6
5
|
|
|
7
6
|
// src/mongo/findCursor.ts
|
|
8
7
|
var FindCursor = class {
|
|
@@ -41,10 +40,6 @@ import {
|
|
|
41
40
|
parseConnectionString,
|
|
42
41
|
toDatabaseDriverType
|
|
43
42
|
} from "@event-driven-io/dumbo";
|
|
44
|
-
import "http2";
|
|
45
|
-
|
|
46
|
-
// src/mongo/mongoDb.ts
|
|
47
|
-
import "mongodb";
|
|
48
43
|
|
|
49
44
|
// src/mongo/mongoCollection.ts
|
|
50
45
|
var toCollectionOperationOptions = (options) => options?.session ? { session: options.session } : void 0;
|
|
@@ -319,8 +314,11 @@ var Db = class {
|
|
|
319
314
|
get databaseName() {
|
|
320
315
|
return this.pongoDb.databaseName;
|
|
321
316
|
}
|
|
322
|
-
collection(collectionName) {
|
|
323
|
-
return new Collection(
|
|
317
|
+
collection(collectionName, options) {
|
|
318
|
+
return new Collection(
|
|
319
|
+
this,
|
|
320
|
+
this.pongoDb.collection(collectionName, options)
|
|
321
|
+
);
|
|
324
322
|
}
|
|
325
323
|
};
|
|
326
324
|
|
|
@@ -335,7 +333,7 @@ var MongoClient = class {
|
|
|
335
333
|
const { databaseType, driverName } = parseConnectionString(
|
|
336
334
|
connectionStringOrOptions
|
|
337
335
|
);
|
|
338
|
-
const driver = options?.driver ??
|
|
336
|
+
const driver = options?.driver ?? pongoDriverRegistry.tryGet(
|
|
339
337
|
toDatabaseDriverType(databaseType, driverName)
|
|
340
338
|
);
|
|
341
339
|
if (driver === null) {
|