@event-driven-io/pongo 0.16.4 → 0.17.0-alpha.2

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.
@@ -0,0 +1,39 @@
1
+ import { P as PongoDb, V as OptionalUnlessRequiredIdAndVersion, a8 as PongoFilter, ao as PongoUpdate, U as UpdateOneOptions, X as WithoutId, R as ReplaceOneOptions, J as DeleteOneOptions, E as CollectionOperationOptions, ax as PongoDocument, c as PongoCollection } from './pongoClient-CJBLCrlZ.cjs';
2
+ import { Dumbo, SQLMigration, SQL, MigrationStyle, SQLExecutor, SchemaComponent } from '@event-driven-io/dumbo';
3
+
4
+ type PongoCollectionOptions<ConnectorType extends string = string> = {
5
+ db: PongoDb<ConnectorType>;
6
+ collectionName: string;
7
+ pool: Dumbo;
8
+ sqlBuilder: PongoCollectionSQLBuilder;
9
+ schema?: {
10
+ autoMigration?: MigrationStyle;
11
+ };
12
+ errors?: {
13
+ throwOnOperationFailures?: boolean;
14
+ };
15
+ };
16
+ declare const transactionExecutorOrDefault: <ConnectorType extends string = string>(db: PongoDb<ConnectorType>, options: CollectionOperationOptions | undefined, defaultSqlExecutor: SQLExecutor) => Promise<SQLExecutor>;
17
+ declare const pongoCollection: <T extends PongoDocument, ConnectorType extends string = string>({ db, collectionName, pool, sqlBuilder: SqlFor, schema, errors, }: PongoCollectionOptions<ConnectorType>) => PongoCollection<T>;
18
+ declare const pongoCollectionSchemaComponent: (collectionName: string) => SchemaComponent;
19
+ type PongoCollectionSQLBuilder = {
20
+ migrations: () => SQLMigration[];
21
+ createCollection: () => SQL;
22
+ insertOne: <T>(document: OptionalUnlessRequiredIdAndVersion<T>) => SQL;
23
+ insertMany: <T>(documents: OptionalUnlessRequiredIdAndVersion<T>[]) => SQL;
24
+ updateOne: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions) => SQL;
25
+ replaceOne: <T>(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions) => SQL;
26
+ updateMany: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL) => SQL;
27
+ deleteOne: <T>(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions) => SQL;
28
+ deleteMany: <T>(filter: PongoFilter<T> | SQL) => SQL;
29
+ findOne: <T>(filter: PongoFilter<T> | SQL) => SQL;
30
+ find: <T>(filter: PongoFilter<T> | SQL) => SQL;
31
+ countDocuments: <T>(filter: PongoFilter<T> | SQL) => SQL;
32
+ rename: (newName: string) => SQL;
33
+ drop: () => SQL;
34
+ };
35
+
36
+ declare const pongoCollectionPostgreSQLMigrations: (collectionName: string) => SQLMigration[];
37
+ declare const postgresSQLBuilder: (collectionName: string) => PongoCollectionSQLBuilder;
38
+
39
+ export { type PongoCollectionOptions as P, pongoCollectionSchemaComponent as a, type PongoCollectionSQLBuilder as b, pongoCollectionPostgreSQLMigrations as c, postgresSQLBuilder as d, pongoCollection as p, transactionExecutorOrDefault as t };
package/dist/pg.cjs ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+ var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
8
+
9
+
10
+
11
+
12
+
13
+
14
+ exports.isPostgresClientOptions = _chunkLNVXUDQHcjs.isPostgresClientOptions; exports.pongoCollectionPostgreSQLMigrations = _chunkLNVXUDQHcjs.pongoCollectionPostgreSQLMigrations; exports.pongoDbSchemaComponent = _chunkLNVXUDQHcjs.pongoDbSchemaComponent; exports.postgresDb = _chunkLNVXUDQHcjs.postgresDb; exports.postgresSQLBuilder = _chunkLNVXUDQHcjs.postgresSQLBuilder;
15
+ //# sourceMappingURL=pg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/pg.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,kXAAC","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/pg.cjs"}
package/dist/pg.d.cts ADDED
@@ -0,0 +1,4 @@
1
+ export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-CJBLCrlZ.cjs';
2
+ export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-DMJLxTdz.cjs';
3
+ import '@event-driven-io/dumbo';
4
+ import 'pg';
package/dist/pg.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { ay as PostgresDbClientOptions, az as isPostgresClientOptions, aB as pongoDbSchemaComponent, aA as postgresDb } from './pongoClient-CJBLCrlZ.js';
2
+ export { c as pongoCollectionPostgreSQLMigrations, d as postgresSQLBuilder } from './pg-CGd2X9NW.js';
3
+ import '@event-driven-io/dumbo';
4
+ import 'pg';
package/dist/pg.js ADDED
@@ -0,0 +1,15 @@
1
+ import {
2
+ isPostgresClientOptions,
3
+ pongoCollectionPostgreSQLMigrations,
4
+ pongoDbSchemaComponent,
5
+ postgresDb,
6
+ postgresSQLBuilder
7
+ } from "./chunk-VZKV7AMY.js";
8
+ export {
9
+ isPostgresClientOptions,
10
+ pongoCollectionPostgreSQLMigrations,
11
+ pongoDbSchemaComponent,
12
+ postgresDb,
13
+ postgresSQLBuilder
14
+ };
15
+ //# sourceMappingURL=pg.js.map
package/dist/pg.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,11 @@
1
- import { DatabaseTransaction, SQLExecutor, DatabaseTransactionFactory, SchemaComponent, QueryResultRow, SQL, QueryResult, PostgresConnector, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
1
+ import { PostgresConnector, SchemaComponent, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
2
2
  import pg from 'pg';
3
3
 
4
+ type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
5
+ declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
6
+ declare const postgresDb: (options: PostgresDbClientOptions) => PongoDb<PostgresConnector>;
7
+ declare const pongoDbSchemaComponent: (collections: string[] | SchemaComponent[]) => SchemaComponent;
8
+
4
9
  interface PongoClient {
5
10
  connect(): Promise<this>;
6
11
  close(): Promise<void>;
@@ -262,6 +267,14 @@ type PongoHandleResult<T> = (PongoInsertOneResult & {
262
267
  type PongoDocument = Record<string, unknown>;
263
268
  type DocumentHandler<T extends PongoDocument> = ((document: T | null) => T | null) | ((document: T | null) => Promise<T | null>);
264
269
 
270
+ type PongoDbClientOptions<ConnectorType extends string = string> = {
271
+ connectorType: ConnectorType;
272
+ connectionString: string;
273
+ dbName: string | undefined;
274
+ } & PongoClientOptions;
275
+ type AllowedDbClientOptions = PostgresDbClientOptions;
276
+ declare const getPongoDb: <DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(options: DbClientOptions) => PongoDb;
277
+
265
278
  interface PongoCollectionSchema<T extends PongoDocument = PongoDocument> {
266
279
  name: string;
267
280
  }
@@ -306,19 +319,6 @@ interface PongoSchemaConfig<TypedClientSchema extends PongoClientSchema = PongoC
306
319
  schema: TypedClientSchema;
307
320
  }
308
321
 
309
- type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
310
- declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
311
- declare const postgresDb: (options: PostgresDbClientOptions) => PongoDb<PostgresConnector>;
312
- declare const pongoDbSchemaComponent: (collections: string[] | SchemaComponent[]) => SchemaComponent;
313
-
314
- type PongoDbClientOptions<ConnectorType extends string = string> = {
315
- connectorType: ConnectorType;
316
- connectionString: string;
317
- dbName: string | undefined;
318
- } & PongoClientOptions;
319
- type AllowedDbClientOptions = PostgresDbClientOptions;
320
- declare const getPongoDb: <DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(options: DbClientOptions) => PongoDb;
321
-
322
322
  type PooledPongoClientOptions = {
323
323
  pool: pg.Pool;
324
324
  } | {
@@ -348,11 +348,11 @@ type PongoClientOptions<TypedClientSchema extends PongoClientSchema = PongoClien
348
348
  };
349
349
  connectionOptions?: PooledPongoClientOptions | NotPooledPongoOptions;
350
350
  };
351
- declare const pongoClient: <TypedClientSchema extends PongoClientSchema = PongoClientSchema<Record<string, PongoDbSchema<Record<string, PongoCollectionSchema<PongoDocument>>>>>, DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(connectionString: string, options?: PongoClientOptions<TypedClientSchema>) => PongoClient & PongoClientWithSchema<TypedClientSchema>;
352
- declare const clientToDbOptions: <DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(options: {
351
+ declare const pongoClient: <TypedClientSchema extends PongoClientSchema = PongoClientSchema, DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(connectionString: string, options?: PongoClientOptions<TypedClientSchema>) => PongoClient & PongoClientWithSchema<TypedClientSchema>;
352
+ declare const clientToDbOptions: <DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(options: {
353
353
  connectionString: string;
354
354
  dbName?: string;
355
355
  clientOptions: PongoClientOptions;
356
356
  }) => DbClientOptions;
357
357
 
358
- export { type WithIdAndVersion as $, type AllowedDbClientOptions as A, toDbSchemaMetadata as B, type CollectionOperationOptions as C, type DeleteOneOptions as D, toClientSchemaMetadata as E, type PongoSchemaConfig as F, type PongoClient as G, type InsertManyOptions as H, type InsertOneOptions as I, type UpdateManyOptions as J, type HandleOptions as K, type DeleteManyOptions as L, ObjectId as M, type NotPooledPongoOptions as N, type OptionalUnlessRequiredIdAndVersion as O, type PongoDb as P, type HasId as Q, type ReplaceOneOptions as R, type InferIdType as S, type EnhancedOmit as T, type UpdateOneOptions as U, type OptionalUnlessRequiredId as V, type WithoutId as W, type OptionalUnlessRequiredVersion as X, type WithId as Y, type WithVersion as Z, type WithoutVersion as _, type PongoDocument as a, type WithoutIdAndVersion as a0, type RegExpOrString as a1, type Document as a2, type OptionalId as a3, type OptionalVersion as a4, type ObjectIdLike as a5, type NonObjectIdLikeDocument as a6, type AlternativeType as a7, type Condition as a8, type RootFilterOperators as a9, postgresDb as aA, pongoDbSchemaComponent as aB, type PongoFilterOperator as aa, type $set as ab, type $unset as ac, type $inc as ad, type $push as ae, type ExpectedDocumentVersionGeneral as af, type ExpectedDocumentVersionValue as ag, type ExpectedDocumentVersion as ah, DOCUMENT_EXISTS as ai, DOCUMENT_DOES_NOT_EXIST as aj, NO_CONCURRENCY_CHECK as ak, isGeneralExpectedDocumentVersion as al, expectedVersionValue as am, expectedVersion as an, type OperationResult as ao, operationResult as ap, type PongoInsertOneResult as aq, type PongoInsertManyResult as ar, type PongoUpdateResult as as, type PongoUpdateManyResult as at, type PongoDeleteResult as au, type PongoDeleteManyResult as av, type PongoHandleResult as aw, type DocumentHandler as ax, type PostgresDbClientOptions as ay, isPostgresClientOptions as az, type PongoCollection as b, type PongoFilter as c, type PongoUpdate as d, type PongoTransactionOptions as e, type PongoSession as f, type PongoDbTransaction as g, type PooledPongoClientOptions as h, type PongoClientOptions as i, clientToDbOptions as j, type PongoDbClientOptions as k, getPongoDb as l, type PongoCollectionSchema as m, type PongoDbSchema as n, type PongoClientSchema as o, pongoClient as p, type CollectionsMap as q, type PongoDbWithSchema as r, type DBsMap as s, type PongoClientWithSchema as t, pongoSchema as u, proxyPongoDbWithSchema as v, proxyClientWithSchema as w, type PongoCollectionSchemaMetadata as x, type PongoDbSchemaMetadata as y, type PongoClientSchemaMetadata as z };
358
+ export { type WithoutIdAndVersion as $, type AllowedDbClientOptions as A, type PongoClient as B, type CollectionsMap as C, type DocumentHandler as D, type CollectionOperationOptions as E, type InsertManyOptions as F, type UpdateManyOptions as G, type HandleOptions as H, type InsertOneOptions as I, type DeleteOneOptions as J, type DeleteManyOptions as K, type HasId as L, type InferIdType as M, type NotPooledPongoOptions as N, ObjectId as O, type PongoDb as P, type EnhancedOmit as Q, type ReplaceOneOptions as R, type OptionalUnlessRequiredId as S, type OptionalUnlessRequiredVersion as T, type UpdateOneOptions as U, type OptionalUnlessRequiredIdAndVersion as V, type WithId as W, type WithoutId as X, type WithVersion as Y, type WithoutVersion as Z, type WithIdAndVersion as _, type PongoHandleResult as a, type RegExpOrString as a0, type Document as a1, type OptionalId as a2, type OptionalVersion as a3, type ObjectIdLike as a4, type NonObjectIdLikeDocument as a5, type AlternativeType as a6, type Condition as a7, type PongoFilter as a8, type RootFilterOperators as a9, postgresDb as aA, pongoDbSchemaComponent as aB, type PongoFilterOperator as aa, type $set as ab, type $unset as ac, type $inc as ad, type $push as ae, type ExpectedDocumentVersionGeneral as af, type ExpectedDocumentVersionValue as ag, type ExpectedDocumentVersion as ah, DOCUMENT_EXISTS as ai, DOCUMENT_DOES_NOT_EXIST as aj, NO_CONCURRENCY_CHECK as ak, isGeneralExpectedDocumentVersion as al, expectedVersionValue as am, expectedVersion as an, type PongoUpdate as ao, type OperationResult as ap, operationResult as aq, type PongoInsertOneResult as ar, type PongoInsertManyResult as as, type PongoUpdateResult as at, type PongoUpdateManyResult as au, type PongoDeleteResult as av, type PongoDeleteManyResult as aw, type PongoDocument as ax, type PostgresDbClientOptions as ay, isPostgresClientOptions as az, type PongoClientOptions as b, type PongoCollection as c, type PongoTransactionOptions as d, type PongoSession as e, type PongoDbTransaction as f, type PooledPongoClientOptions as g, clientToDbOptions as h, type PongoDbClientOptions as i, getPongoDb as j, type PongoCollectionSchema as k, type PongoDbSchema as l, type PongoClientSchema as m, type PongoDbWithSchema as n, type DBsMap as o, pongoClient as p, type PongoClientWithSchema as q, pongoSchema as r, proxyPongoDbWithSchema as s, proxyClientWithSchema as t, type PongoCollectionSchemaMetadata as u, type PongoDbSchemaMetadata as v, type PongoClientSchemaMetadata as w, toDbSchemaMetadata as x, toClientSchemaMetadata as y, type PongoSchemaConfig as z };
@@ -1,6 +1,11 @@
1
- import { DatabaseTransaction, SQLExecutor, DatabaseTransactionFactory, SchemaComponent, QueryResultRow, SQL, QueryResult, PostgresConnector, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
1
+ import { PostgresConnector, SchemaComponent, DatabaseTransactionFactory, DatabaseTransaction, SQLExecutor, SQL, QueryResultRow, QueryResult, NodePostgresConnection, MigrationStyle } from '@event-driven-io/dumbo';
2
2
  import pg from 'pg';
3
3
 
4
+ type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
5
+ declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
6
+ declare const postgresDb: (options: PostgresDbClientOptions) => PongoDb<PostgresConnector>;
7
+ declare const pongoDbSchemaComponent: (collections: string[] | SchemaComponent[]) => SchemaComponent;
8
+
4
9
  interface PongoClient {
5
10
  connect(): Promise<this>;
6
11
  close(): Promise<void>;
@@ -262,6 +267,14 @@ type PongoHandleResult<T> = (PongoInsertOneResult & {
262
267
  type PongoDocument = Record<string, unknown>;
263
268
  type DocumentHandler<T extends PongoDocument> = ((document: T | null) => T | null) | ((document: T | null) => Promise<T | null>);
264
269
 
270
+ type PongoDbClientOptions<ConnectorType extends string = string> = {
271
+ connectorType: ConnectorType;
272
+ connectionString: string;
273
+ dbName: string | undefined;
274
+ } & PongoClientOptions;
275
+ type AllowedDbClientOptions = PostgresDbClientOptions;
276
+ declare const getPongoDb: <DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(options: DbClientOptions) => PongoDb;
277
+
265
278
  interface PongoCollectionSchema<T extends PongoDocument = PongoDocument> {
266
279
  name: string;
267
280
  }
@@ -306,19 +319,6 @@ interface PongoSchemaConfig<TypedClientSchema extends PongoClientSchema = PongoC
306
319
  schema: TypedClientSchema;
307
320
  }
308
321
 
309
- type PostgresDbClientOptions = PongoDbClientOptions<PostgresConnector>;
310
- declare const isPostgresClientOptions: (options: PongoDbClientOptions) => options is PostgresDbClientOptions;
311
- declare const postgresDb: (options: PostgresDbClientOptions) => PongoDb<PostgresConnector>;
312
- declare const pongoDbSchemaComponent: (collections: string[] | SchemaComponent[]) => SchemaComponent;
313
-
314
- type PongoDbClientOptions<ConnectorType extends string = string> = {
315
- connectorType: ConnectorType;
316
- connectionString: string;
317
- dbName: string | undefined;
318
- } & PongoClientOptions;
319
- type AllowedDbClientOptions = PostgresDbClientOptions;
320
- declare const getPongoDb: <DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(options: DbClientOptions) => PongoDb;
321
-
322
322
  type PooledPongoClientOptions = {
323
323
  pool: pg.Pool;
324
324
  } | {
@@ -348,11 +348,11 @@ type PongoClientOptions<TypedClientSchema extends PongoClientSchema = PongoClien
348
348
  };
349
349
  connectionOptions?: PooledPongoClientOptions | NotPooledPongoOptions;
350
350
  };
351
- declare const pongoClient: <TypedClientSchema extends PongoClientSchema = PongoClientSchema<Record<string, PongoDbSchema<Record<string, PongoCollectionSchema<PongoDocument>>>>>, DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(connectionString: string, options?: PongoClientOptions<TypedClientSchema>) => PongoClient & PongoClientWithSchema<TypedClientSchema>;
352
- declare const clientToDbOptions: <DbClientOptions extends AllowedDbClientOptions = PostgresDbClientOptions>(options: {
351
+ declare const pongoClient: <TypedClientSchema extends PongoClientSchema = PongoClientSchema, DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(connectionString: string, options?: PongoClientOptions<TypedClientSchema>) => PongoClient & PongoClientWithSchema<TypedClientSchema>;
352
+ declare const clientToDbOptions: <DbClientOptions extends AllowedDbClientOptions = AllowedDbClientOptions>(options: {
353
353
  connectionString: string;
354
354
  dbName?: string;
355
355
  clientOptions: PongoClientOptions;
356
356
  }) => DbClientOptions;
357
357
 
358
- export { type WithIdAndVersion as $, type AllowedDbClientOptions as A, toDbSchemaMetadata as B, type CollectionOperationOptions as C, type DeleteOneOptions as D, toClientSchemaMetadata as E, type PongoSchemaConfig as F, type PongoClient as G, type InsertManyOptions as H, type InsertOneOptions as I, type UpdateManyOptions as J, type HandleOptions as K, type DeleteManyOptions as L, ObjectId as M, type NotPooledPongoOptions as N, type OptionalUnlessRequiredIdAndVersion as O, type PongoDb as P, type HasId as Q, type ReplaceOneOptions as R, type InferIdType as S, type EnhancedOmit as T, type UpdateOneOptions as U, type OptionalUnlessRequiredId as V, type WithoutId as W, type OptionalUnlessRequiredVersion as X, type WithId as Y, type WithVersion as Z, type WithoutVersion as _, type PongoDocument as a, type WithoutIdAndVersion as a0, type RegExpOrString as a1, type Document as a2, type OptionalId as a3, type OptionalVersion as a4, type ObjectIdLike as a5, type NonObjectIdLikeDocument as a6, type AlternativeType as a7, type Condition as a8, type RootFilterOperators as a9, postgresDb as aA, pongoDbSchemaComponent as aB, type PongoFilterOperator as aa, type $set as ab, type $unset as ac, type $inc as ad, type $push as ae, type ExpectedDocumentVersionGeneral as af, type ExpectedDocumentVersionValue as ag, type ExpectedDocumentVersion as ah, DOCUMENT_EXISTS as ai, DOCUMENT_DOES_NOT_EXIST as aj, NO_CONCURRENCY_CHECK as ak, isGeneralExpectedDocumentVersion as al, expectedVersionValue as am, expectedVersion as an, type OperationResult as ao, operationResult as ap, type PongoInsertOneResult as aq, type PongoInsertManyResult as ar, type PongoUpdateResult as as, type PongoUpdateManyResult as at, type PongoDeleteResult as au, type PongoDeleteManyResult as av, type PongoHandleResult as aw, type DocumentHandler as ax, type PostgresDbClientOptions as ay, isPostgresClientOptions as az, type PongoCollection as b, type PongoFilter as c, type PongoUpdate as d, type PongoTransactionOptions as e, type PongoSession as f, type PongoDbTransaction as g, type PooledPongoClientOptions as h, type PongoClientOptions as i, clientToDbOptions as j, type PongoDbClientOptions as k, getPongoDb as l, type PongoCollectionSchema as m, type PongoDbSchema as n, type PongoClientSchema as o, pongoClient as p, type CollectionsMap as q, type PongoDbWithSchema as r, type DBsMap as s, type PongoClientWithSchema as t, pongoSchema as u, proxyPongoDbWithSchema as v, proxyClientWithSchema as w, type PongoCollectionSchemaMetadata as x, type PongoDbSchemaMetadata as y, type PongoClientSchemaMetadata as z };
358
+ export { type WithoutIdAndVersion as $, type AllowedDbClientOptions as A, type PongoClient as B, type CollectionsMap as C, type DocumentHandler as D, type CollectionOperationOptions as E, type InsertManyOptions as F, type UpdateManyOptions as G, type HandleOptions as H, type InsertOneOptions as I, type DeleteOneOptions as J, type DeleteManyOptions as K, type HasId as L, type InferIdType as M, type NotPooledPongoOptions as N, ObjectId as O, type PongoDb as P, type EnhancedOmit as Q, type ReplaceOneOptions as R, type OptionalUnlessRequiredId as S, type OptionalUnlessRequiredVersion as T, type UpdateOneOptions as U, type OptionalUnlessRequiredIdAndVersion as V, type WithId as W, type WithoutId as X, type WithVersion as Y, type WithoutVersion as Z, type WithIdAndVersion as _, type PongoHandleResult as a, type RegExpOrString as a0, type Document as a1, type OptionalId as a2, type OptionalVersion as a3, type ObjectIdLike as a4, type NonObjectIdLikeDocument as a5, type AlternativeType as a6, type Condition as a7, type PongoFilter as a8, type RootFilterOperators as a9, postgresDb as aA, pongoDbSchemaComponent as aB, type PongoFilterOperator as aa, type $set as ab, type $unset as ac, type $inc as ad, type $push as ae, type ExpectedDocumentVersionGeneral as af, type ExpectedDocumentVersionValue as ag, type ExpectedDocumentVersion as ah, DOCUMENT_EXISTS as ai, DOCUMENT_DOES_NOT_EXIST as aj, NO_CONCURRENCY_CHECK as ak, isGeneralExpectedDocumentVersion as al, expectedVersionValue as am, expectedVersion as an, type PongoUpdate as ao, type OperationResult as ap, operationResult as aq, type PongoInsertOneResult as ar, type PongoInsertManyResult as as, type PongoUpdateResult as at, type PongoUpdateManyResult as au, type PongoDeleteResult as av, type PongoDeleteManyResult as aw, type PongoDocument as ax, type PostgresDbClientOptions as ay, isPostgresClientOptions as az, type PongoClientOptions as b, type PongoCollection as c, type PongoTransactionOptions as d, type PongoSession as e, type PongoDbTransaction as f, type PooledPongoClientOptions as g, clientToDbOptions as h, type PongoDbClientOptions as i, getPongoDb as j, type PongoCollectionSchema as k, type PongoDbSchema as l, type PongoClientSchema as m, type PongoDbWithSchema as n, type DBsMap as o, pongoClient as p, type PongoClientWithSchema as q, pongoSchema as r, proxyPongoDbWithSchema as s, proxyClientWithSchema as t, type PongoCollectionSchemaMetadata as u, type PongoDbSchemaMetadata as v, type PongoClientSchemaMetadata as w, toDbSchemaMetadata as x, toClientSchemaMetadata as y, type PongoSchemaConfig as z };
package/dist/shim.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
2
 
3
3
 
4
- var _chunkHZVM5GBHcjs = require('./chunk-HZVM5GBH.cjs');
4
+ var _chunkLNVXUDQHcjs = require('./chunk-LNVXUDQH.cjs');
5
5
 
6
6
  // src/mongo/findCursor.ts
7
7
  var FindCursor = (_class = class {
@@ -283,6 +283,7 @@ var Collection = class {
283
283
 
284
284
  // src/mongo/mongoDb.ts
285
285
  var Db = class {
286
+
286
287
  constructor(pongoDb) {
287
288
  this.pongoDb = pongoDb;
288
289
  }
@@ -298,7 +299,7 @@ var Db = class {
298
299
  var MongoClient = class {
299
300
 
300
301
  constructor(connectionString, options = {}) {
301
- this.pongoClient = _chunkHZVM5GBHcjs.pongoClient.call(void 0, connectionString, options);
302
+ this.pongoClient = _chunkLNVXUDQHcjs.pongoClient.call(void 0, connectionString, options);
302
303
  }
303
304
  async connect() {
304
305
  await this.pongoClient.connect();
@@ -311,12 +312,12 @@ var MongoClient = class {
311
312
  return new Db(this.pongoClient.db(dbName));
312
313
  }
313
314
  startSession(_options) {
314
- return _chunkHZVM5GBHcjs.pongoSession.call(void 0, );
315
+ return _chunkLNVXUDQHcjs.pongoSession.call(void 0, );
315
316
  }
316
317
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
317
318
  async withSession(optionsOrExecutor, executor) {
318
319
  const callback = typeof optionsOrExecutor === "function" ? optionsOrExecutor : executor;
319
- const session = _chunkHZVM5GBHcjs.pongoSession.call(void 0, );
320
+ const session = _chunkLNVXUDQHcjs.pongoSession.call(void 0, );
320
321
  try {
321
322
  return await callback(session);
322
323
  } finally {
package/dist/shim.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","../src/mongo/findCursor.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoClient.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLO,IAAM,WAAA,YAAN,MAAoB;AAAA,EACjB;AAAA,iBACA,UAAA,EAAwB,KAAA;AAAA,kBACxB,MAAA,EAAgB,EAAA;AAAA,EAExB,WAAA,CAAY,SAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,qBAAA,EAAuB,SAAA;AAAA,EAC9B;AAAA,EAEA,MAAM,OAAA,CAAA,EAAwB;AAC5B,IAAA,OAAO,IAAA,CAAK,aAAA,CAAc,CAAA;AAAA,EAC5B;AAAA,EAEA,MAAM,OAAA,CAAQ,QAAA,EAA2C;AACvD,IAAA,MAAM,KAAA,EAAO,MAAM,IAAA,CAAK,aAAA,CAAc,CAAA;AAEtC,IAAA,IAAA,CAAA,MAAW,IAAA,GAAO,IAAA,EAAM;AACtB,MAAA,QAAA,CAAS,GAAG,CAAA;AAAA,IACd;AACA,IAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,CAAA;AAAA,EACzB;AAAA,EAEA,OAAA,CAAA,EAAmB;A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Y;AACA;AE9QL;AACL,EAAA;AAAoB,IAAA;AAAmB,EAAA;AAEnC,EAAA;AACK,IAAA;AACT,EAAA;AAEA,EAAA;AASS,IAAA;AACT,EAAA;AACF;AFwQY;AACA;AI9RC;AACH,EAAA;AAER,EAAA;AACO,IAAA;AACP,EAAA;AAEM,EAAA;AACE,IAAA;AACC,IAAA;AACT,EAAA;AAEM,EAAA;AACE,IAAA;AACR,EAAA;AAEG,EAAA;AACM,IAAA;AACT,EAAA;AACA,EAAA;AACS,IAAA;AACT,EAAA;AAAA;AASM,EAAA;AAIE,IAAA;AAGA,IAAA;AAEF,IAAA;AACF,MAAA;AACF,IAAA;AACQ,MAAA;AACR,IAAA;AACF,EAAA;AACF;AJ+QY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","sourcesContent":[null,"export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import {\n Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n constructor(private pongoDb: PongoDb) {}\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions | undefined,\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 | undefined,\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 | undefined,\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 | undefined,\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 | undefined,\n ): Promise<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions | undefined,\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> | undefined,\n options?: DeleteOptions | undefined,\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> | undefined,\n options?: DeleteOptions | undefined,\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 | undefined,\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 | undefined): 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> | undefined,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document> | undefined,\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> | undefined,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document> | undefined,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document> | undefined,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ),\n ) as unknown as MongoFindCursor<T>;\n }\n options(_options?: OperationOptions | undefined): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n isCapped(_options?: OperationOptions | undefined): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n createIndex(\n _indexSpec: IndexSpecification,\n _options?: CreateIndexesOptions | undefined,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createIndexes(\n _indexSpecs: IndexDescription[],\n _options?: CreateIndexesOptions | undefined,\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropIndex(\n _indexName: string,\n _options?: CommandOperationOptions | undefined,\n ): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n dropIndexes(\n _options?: CommandOperationOptions | undefined,\n ): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n listIndexes(_options?: AbstractCursorOptions | undefined): ListIndexesCursor {\n throw new Error('Method not implemented.');\n }\n indexExists(\n _indexes: string | string[],\n _options?: AbstractCursorOptions | undefined,\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 | undefined,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T> | undefined,\n options?: CountDocumentsOptions | undefined,\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(\n options?: AbstractCursorOptions | undefined,\n ): 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 | undefined,\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 | undefined,\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[] | undefined,\n _options?: AggregateOptions | undefined,\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[] | undefined,\n _options?: ChangeStreamOptions | undefined,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions | undefined,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(\n _options?: BulkWriteOptions | undefined,\n ): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(\n filter?: Filter<T> | undefined,\n options?: CountOptions | undefined,\n ): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions | undefined,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions | undefined,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): import('mongodb').ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","../src/mongo/findCursor.ts","../src/mongo/mongoDb.ts","../src/mongo/mongoCollection.ts","../src/mongo/mongoClient.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLO,IAAM,WAAA,YAAN,MAAoB;AAAA,EACjB;AAAA,iBACA,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,UAA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AA;AACP,EAAA;AAEI,EAAA;AACK,IAAA;AACT,EAAA;AAEA,EAAA;AASS,IAAA;AACT,EAAA;AACF;AFsQY;AACA;AI/RC;AACH,EAAA;AAER,EAAA;AACO,IAAA;AACP,EAAA;AAEM,EAAA;AACE,IAAA;AACC,IAAA;AACT,EAAA;AAEM,EAAA;AACE,IAAA;AACR,EAAA;AAEG,EAAA;AACM,IAAA;AACT,EAAA;AACA,EAAA;AACS,IAAA;AACT,EAAA;AAAA;AASM,EAAA;AAIE,IAAA;AAGA,IAAA;AAEF,IAAA;AACF,MAAA;AACF,IAAA;AACQ,MAAA;AACR,IAAA;AACF,EAAA;AACF;AJgRY;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/Pongo/Pongo/src/packages/pongo/dist/shim.cjs","sourcesContent":[null,"export class FindCursor<T> {\n private findDocumentsPromise: Promise<T[]>;\n private documents: T[] | null = null;\n private index: number = 0;\n\n constructor(documents: Promise<T[]>) {\n this.findDocumentsPromise = documents;\n }\n\n async toArray(): Promise<T[]> {\n return this.findDocuments();\n }\n\n async forEach(callback: (doc: T) => void): Promise<void> {\n const docs = await this.findDocuments();\n\n for (const doc of docs) {\n callback(doc);\n }\n return Promise.resolve();\n }\n\n hasNext(): boolean {\n if (this.documents === null) throw Error('Error while fetching documents');\n return this.index < this.documents.length;\n }\n\n async next(): Promise<T | null> {\n const docs = await this.findDocuments();\n return this.hasNext() ? (docs[this.index++] ?? null) : null;\n }\n\n private async findDocuments(): Promise<T[]> {\n this.documents = await this.findDocumentsPromise;\n return this.documents;\n }\n}\n","import {\n Collection as MongoCollection,\n ObjectId,\n type Document,\n} from 'mongodb';\nimport type {\n DocumentHandler,\n HandleOptions,\n PongoDb,\n PongoHandleResult,\n} from '../core';\nimport { Collection } from './mongoCollection';\n\nexport class Db {\n private pongoDb: PongoDb;\n constructor(pongoDb: PongoDb) {\n this.pongoDb = pongoDb;\n }\n\n get databaseName(): string {\n return this.pongoDb.databaseName;\n }\n\n collection<T extends Document>(\n collectionName: string,\n ): MongoCollection<T> & {\n handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>>;\n } {\n return new Collection<T>(this.pongoDb.collection<T>(collectionName));\n }\n}\n","import type {\n AbstractCursorOptions,\n AggregateOptions,\n AggregationCursor,\n AnyBulkWriteOperation,\n BSONSerializeOptions,\n BulkWriteOptions,\n BulkWriteResult,\n ChangeStream,\n ChangeStreamDocument,\n ChangeStreamOptions,\n CommandOperationOptions,\n CountDocumentsOptions,\n CountOptions,\n CreateIndexesOptions,\n DeleteOptions,\n DeleteResult,\n Document,\n DropCollectionOptions,\n EnhancedOmit,\n EstimatedDocumentCountOptions,\n Filter,\n FindOneAndDeleteOptions,\n FindOneAndReplaceOptions,\n FindOneAndUpdateOptions,\n FindOptions,\n Flatten,\n Hint,\n IndexDescription,\n IndexDescriptionCompact,\n IndexDescriptionInfo,\n IndexInformationOptions,\n IndexSpecification,\n InferIdType,\n InsertManyResult,\n InsertOneOptions,\n InsertOneResult,\n ListIndexesCursor,\n ListSearchIndexesCursor,\n ListSearchIndexesOptions,\n ModifyResult,\n Collection as MongoCollection,\n FindCursor as MongoFindCursor,\n ObjectId,\n OperationOptions,\n OptionalUnlessRequiredId,\n OrderedBulkOperation,\n ReadConcern,\n ReadPreference,\n RenameOptions,\n ReplaceOptions,\n SearchIndexDescription,\n UnorderedBulkOperation,\n UpdateFilter,\n UpdateOptions,\n UpdateResult,\n WithId,\n WithoutId,\n WriteConcern,\n} from 'mongodb';\nimport type { Key } from 'readline';\nimport type {\n CollectionOperationOptions,\n DocumentHandler,\n HandleOptions,\n PongoCollection,\n PongoFilter,\n PongoHandleResult,\n OptionalUnlessRequiredId as PongoOptionalUnlessRequiredId,\n PongoSession,\n PongoUpdate,\n} from '../core';\nimport { FindCursor } from './findCursor';\n\nconst toCollectionOperationOptions = (\n options: OperationOptions | undefined,\n): CollectionOperationOptions | undefined =>\n options?.session\n ? { session: options.session as unknown as PongoSession }\n : undefined;\n\nexport class Collection<T extends Document> implements MongoCollection<T> {\n private collection: PongoCollection<T>;\n\n constructor(collection: PongoCollection<T>) {\n this.collection = collection;\n }\n get dbName(): string {\n return this.collection.dbName;\n }\n get collectionName(): string {\n return this.collection.collectionName;\n }\n get namespace(): string {\n return `${this.dbName}.${this.collectionName}`;\n }\n get readConcern(): ReadConcern | undefined {\n return undefined;\n }\n get readPreference(): ReadPreference | undefined {\n return undefined;\n }\n get bsonOptions(): BSONSerializeOptions {\n return {};\n }\n get writeConcern(): WriteConcern | undefined {\n return undefined;\n }\n get hint(): Hint | undefined {\n return undefined;\n }\n set hint(v: Hint | undefined) {\n throw new Error('Method not implemented.');\n }\n async insertOne(\n doc: OptionalUnlessRequiredId<T>,\n options?: InsertOneOptions,\n ): Promise<InsertOneResult<T>> {\n const result = await this.collection.insertOne(\n doc as unknown as PongoOptionalUnlessRequiredId<T>,\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedId: result.insertedId as unknown as InferIdType<T>,\n };\n }\n async insertMany(\n docs: OptionalUnlessRequiredId<T>[],\n options?: BulkWriteOptions,\n ): Promise<InsertManyResult<T>> {\n const result = await this.collection.insertMany(\n docs as unknown as PongoOptionalUnlessRequiredId<T>[],\n toCollectionOperationOptions(options),\n );\n return {\n acknowledged: result.acknowledged,\n insertedIds: result.insertedIds as unknown as InferIdType<T>[],\n insertedCount: result.insertedCount,\n };\n }\n bulkWrite(\n _operations: AnyBulkWriteOperation<T>[],\n _options?: BulkWriteOptions,\n ): Promise<BulkWriteResult> {\n throw new Error('Method not implemented.');\n }\n async updateOne(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateOne(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n replaceOne(\n filter: Filter<T>,\n document: WithoutId<T>,\n options?: ReplaceOptions,\n ): Promise<Document | UpdateResult<T>> {\n return this.collection.replaceOne(\n filter as unknown as PongoFilter<T>,\n document,\n toCollectionOperationOptions(options),\n );\n }\n async updateMany(\n filter: Filter<T>,\n update: Document[] | UpdateFilter<T>,\n options?: UpdateOptions,\n ): Promise<UpdateResult<T>> {\n const result = await this.collection.updateMany(\n filter as unknown as PongoFilter<T>,\n update as unknown as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n matchedCount: result.modifiedCount,\n modifiedCount: result.modifiedCount,\n upsertedCount: result.modifiedCount,\n upsertedId: null,\n };\n }\n async deleteOne(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async deleteMany(\n filter?: Filter<T>,\n options?: DeleteOptions,\n ): Promise<DeleteResult> {\n const result = await this.collection.deleteMany(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n\n return {\n acknowledged: result.acknowledged,\n deletedCount: result.deletedCount,\n };\n }\n async rename(\n newName: string,\n options?: RenameOptions,\n ): Promise<Collection<Document>> {\n await this.collection.rename(\n newName,\n toCollectionOperationOptions(options),\n );\n\n return this as unknown as Collection<Document>;\n }\n drop(options?: DropCollectionOptions): Promise<boolean> {\n return this.collection.drop(toCollectionOperationOptions(options));\n }\n findOne(): Promise<WithId<T> | null>;\n findOne(filter: Filter<T>): Promise<WithId<T> | null>;\n findOne(\n filter: Filter<T>,\n options: FindOptions<Document>,\n ): Promise<WithId<T> | null>;\n findOne<TS = T>(): Promise<TS | null>;\n findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;\n findOne<TS = T>(\n filter: Filter<TS>,\n options?: FindOptions<Document>,\n ): Promise<TS | null>;\n async findOne(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): Promise<import('mongodb').WithId<T> | T | null> {\n return (await this.collection.findOne(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n )) as T;\n }\n find(): MongoFindCursor<WithId<T>>;\n find(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>>;\n find<T extends Document>(\n filter: Filter<T>,\n options?: FindOptions<Document>,\n ): MongoFindCursor<T>;\n find(\n filter?: unknown,\n options?: FindOptions<Document>,\n ): MongoFindCursor<WithId<T>> | MongoFindCursor<T> {\n return new FindCursor(\n this.collection.find(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ),\n ) as unknown as MongoFindCursor<T>;\n }\n options(_options?: OperationOptions): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n isCapped(_options?: OperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n createIndex(\n _indexSpec: IndexSpecification,\n _options?: CreateIndexesOptions,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createIndexes(\n _indexSpecs: IndexDescription[],\n _options?: CreateIndexesOptions,\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropIndex(\n _indexName: string,\n _options?: CommandOperationOptions,\n ): Promise<Document> {\n throw new Error('Method not implemented.');\n }\n dropIndexes(_options?: CommandOperationOptions): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor {\n throw new Error('Method not implemented.');\n }\n indexExists(\n _indexes: string | string[],\n _options?: AbstractCursorOptions,\n ): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n indexInformation(\n options: IndexInformationOptions & { full: true },\n ): Promise<IndexDescriptionInfo[]>;\n indexInformation(\n options: IndexInformationOptions & { full?: false | undefined },\n ): Promise<IndexDescriptionCompact>;\n indexInformation(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexInformation(): Promise<IndexDescriptionCompact>;\n indexInformation(\n _options?: unknown,\n ):\n | Promise<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\n throw new Error('Method not implemented.');\n }\n estimatedDocumentCount(\n options?: EstimatedDocumentCountOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n {},\n toCollectionOperationOptions(options),\n );\n }\n countDocuments(\n filter?: Filter<T>,\n options?: CountDocumentsOptions,\n ): Promise<number> {\n return this.collection.countDocuments(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n );\n }\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(\n key: Key,\n filter: Filter<T>,\n options: CommandOperationOptions,\n ): Promise<Flatten<WithId<T>[Key]>[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string): Promise<any[]>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n distinct(key: string, filter: Filter<T>): Promise<any[]>;\n distinct(\n key: string,\n filter: Filter<T>,\n options: CommandOperationOptions, // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<any[]>;\n distinct(\n _key: unknown,\n _filter?: unknown,\n _options?: unknown,\n ): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Promise<any[]>\n | Promise<import('mongodb').Flatten<import('mongodb').WithId<T>[Key]>[]> {\n throw new Error('Method not implemented.');\n }\n indexes(\n options: IndexInformationOptions & { full?: true | undefined },\n ): Promise<IndexDescriptionInfo[]>;\n indexes(\n options: IndexInformationOptions & { full: false },\n ): Promise<IndexDescriptionCompact>;\n indexes(\n options: IndexInformationOptions,\n ): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;\n indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;\n indexes(\n _options?: unknown,\n ):\n | Promise<import('mongodb').IndexDescriptionInfo[]>\n | Promise<import('mongodb').IndexDescriptionCompact>\n | Promise<\n | import('mongodb').IndexDescriptionCompact\n | import('mongodb').IndexDescriptionInfo[]\n > {\n throw new Error('Method not implemented.');\n }\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: Filter<T>,\n options: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null>;\n findOneAndDelete(filter: Filter<T>): Promise<WithId<T> | null>;\n findOneAndDelete(\n filter: unknown,\n options?: FindOneAndDeleteOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndDelete(\n filter as PongoFilter<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n options: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: Filter<T>,\n replacement: WithoutId<T>,\n ): Promise<WithId<T> | null>;\n findOneAndReplace(\n filter: unknown,\n replacement: unknown,\n options?: FindOneAndReplaceOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndReplace(\n filter as PongoFilter<T>,\n replacement as WithoutId<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: true },\n ): Promise<ModifyResult<T>>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions & { includeResultMetadata: false },\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n options: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: Filter<T>,\n update: UpdateFilter<T>,\n ): Promise<WithId<T> | null>;\n findOneAndUpdate(\n filter: unknown,\n update: unknown,\n options?: FindOneAndUpdateOptions,\n ): Promise<WithId<T> | null | ModifyResult<T>> {\n return this.collection.findOneAndUpdate(\n filter as PongoFilter<T>,\n update as PongoUpdate<T>,\n toCollectionOperationOptions(options),\n ) as Promise<WithId<T> | null>;\n }\n aggregate<T extends Document = Document>(\n _pipeline?: Document[],\n _options?: AggregateOptions,\n ): AggregationCursor<T> {\n throw new Error('Method not implemented.');\n }\n watch<\n TLocal extends Document = T,\n TChange extends Document = ChangeStreamDocument<TLocal>,\n >(\n _pipeline?: Document[],\n _options?: ChangeStreamOptions,\n ): ChangeStream<TLocal, TChange> {\n throw new Error('Method not implemented.');\n }\n initializeUnorderedBulkOp(\n _options?: BulkWriteOptions,\n ): UnorderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation {\n throw new Error('Method not implemented.');\n }\n count(filter?: Filter<T>, options?: CountOptions): Promise<number> {\n return this.collection.countDocuments(\n (filter as PongoFilter<T>) ?? {},\n toCollectionOperationOptions(options),\n );\n }\n listSearchIndexes(\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n name: string,\n options?: ListSearchIndexesOptions,\n ): ListSearchIndexesCursor;\n listSearchIndexes(\n _name?: unknown,\n _options?: unknown,\n ): import('mongodb').ListSearchIndexesCursor {\n throw new Error('Method not implemented.');\n }\n createSearchIndex(_description: SearchIndexDescription): Promise<string> {\n throw new Error('Method not implemented.');\n }\n createSearchIndexes(\n _descriptions: SearchIndexDescription[],\n ): Promise<string[]> {\n throw new Error('Method not implemented.');\n }\n dropSearchIndex(_name: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n updateSearchIndex(_name: string, _definition: Document): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async createCollection(): Promise<void> {\n await this.collection.createCollection();\n }\n async handle(\n id: ObjectId,\n handle: DocumentHandler<T>,\n options?: HandleOptions,\n ): Promise<PongoHandleResult<T>> {\n return this.collection.handle(id.toString(), handle, options);\n }\n}\n","import type { ClientSessionOptions } from 'http2';\nimport type { ClientSession, WithSessionCallback } from 'mongodb';\nimport {\n pongoClient,\n pongoSession,\n type PongoClient,\n type PongoClientOptions,\n} from '../core';\nimport { Db } from './mongoDb';\n\nexport class MongoClient {\n private pongoClient: PongoClient;\n\n constructor(connectionString: string, options: PongoClientOptions = {}) {\n this.pongoClient = pongoClient(connectionString, options);\n }\n\n async connect() {\n await this.pongoClient.connect();\n return this;\n }\n\n async close() {\n await this.pongoClient.close();\n }\n\n db(dbName?: string): Db {\n return new Db(this.pongoClient.db(dbName));\n }\n startSession(_options?: ClientSessionOptions): ClientSession {\n return pongoSession() as unknown as ClientSession;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(_executor: WithSessionCallback<T>): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n withSession<T = any>(\n _options: ClientSessionOptions,\n _executor: WithSessionCallback<T>,\n ): Promise<T>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async withSession<T = any>(\n optionsOrExecutor: ClientSessionOptions | WithSessionCallback<T>,\n executor?: WithSessionCallback<T>,\n ): Promise<T> {\n const callback =\n typeof optionsOrExecutor === 'function' ? optionsOrExecutor : executor!;\n\n const session = pongoSession() as unknown as ClientSession;\n\n try {\n return await callback(session);\n } finally {\n await session.endSession();\n }\n }\n}\n"]}
package/dist/shim.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ClientSessionOptions } from 'http2';
2
2
  import { Document, Collection as Collection$1, ObjectId, ClientSession, WithSessionCallback, ReadConcern, ReadPreference, BSONSerializeOptions, WriteConcern, Hint, OptionalUnlessRequiredId, InsertOneOptions, InsertOneResult, BulkWriteOptions, InsertManyResult, AnyBulkWriteOperation, BulkWriteResult, Filter, UpdateFilter, UpdateOptions, UpdateResult, WithoutId, ReplaceOptions, DeleteOptions, DeleteResult, RenameOptions, DropCollectionOptions, WithId, FindOptions, FindCursor as FindCursor$1, OperationOptions, IndexSpecification, CreateIndexesOptions, IndexDescription, CommandOperationOptions, AbstractCursorOptions, ListIndexesCursor, IndexInformationOptions, IndexDescriptionInfo, IndexDescriptionCompact, EstimatedDocumentCountOptions, CountDocumentsOptions, EnhancedOmit, Flatten, FindOneAndDeleteOptions, ModifyResult, FindOneAndReplaceOptions, FindOneAndUpdateOptions, AggregateOptions, AggregationCursor, ChangeStreamDocument, ChangeStreamOptions, ChangeStream, UnorderedBulkOperation, OrderedBulkOperation, CountOptions, ListSearchIndexesOptions, ListSearchIndexesCursor, SearchIndexDescription } from 'mongodb';
3
- import { P as PongoDb, ax as DocumentHandler, K as HandleOptions, aw as PongoHandleResult, i as PongoClientOptions, b as PongoCollection } from './pongoClient-DA5r3RtN.cjs';
3
+ import { P as PongoDb, D as DocumentHandler, H as HandleOptions, a as PongoHandleResult, b as PongoClientOptions, c as PongoCollection } from './pongoClient-CJBLCrlZ.cjs';
4
4
  import '@event-driven-io/dumbo';
5
5
  import 'pg';
6
6
 
@@ -48,33 +48,33 @@ declare class Collection<T extends Document> implements Collection$1<T> {
48
48
  get writeConcern(): WriteConcern | undefined;
49
49
  get hint(): Hint | undefined;
50
50
  set hint(v: Hint | undefined);
51
- insertOne(doc: OptionalUnlessRequiredId<T>, options?: InsertOneOptions | undefined): Promise<InsertOneResult<T>>;
52
- insertMany(docs: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions | undefined): Promise<InsertManyResult<T>>;
53
- bulkWrite(_operations: AnyBulkWriteOperation<T>[], _options?: BulkWriteOptions | undefined): Promise<BulkWriteResult>;
54
- updateOne(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions | undefined): Promise<UpdateResult<T>>;
55
- replaceOne(filter: Filter<T>, document: WithoutId<T>, options?: ReplaceOptions | undefined): Promise<Document | UpdateResult<T>>;
56
- updateMany(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions | undefined): Promise<UpdateResult<T>>;
57
- deleteOne(filter?: Filter<T> | undefined, options?: DeleteOptions | undefined): Promise<DeleteResult>;
58
- deleteMany(filter?: Filter<T> | undefined, options?: DeleteOptions | undefined): Promise<DeleteResult>;
59
- rename(newName: string, options?: RenameOptions | undefined): Promise<Collection<Document>>;
60
- drop(options?: DropCollectionOptions | undefined): Promise<boolean>;
51
+ insertOne(doc: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<InsertOneResult<T>>;
52
+ insertMany(docs: OptionalUnlessRequiredId<T>[], options?: BulkWriteOptions): Promise<InsertManyResult<T>>;
53
+ bulkWrite(_operations: AnyBulkWriteOperation<T>[], _options?: BulkWriteOptions): Promise<BulkWriteResult>;
54
+ updateOne(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
55
+ replaceOne(filter: Filter<T>, document: WithoutId<T>, options?: ReplaceOptions): Promise<Document | UpdateResult<T>>;
56
+ updateMany(filter: Filter<T>, update: Document[] | UpdateFilter<T>, options?: UpdateOptions): Promise<UpdateResult<T>>;
57
+ deleteOne(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
58
+ deleteMany(filter?: Filter<T>, options?: DeleteOptions): Promise<DeleteResult>;
59
+ rename(newName: string, options?: RenameOptions): Promise<Collection<Document>>;
60
+ drop(options?: DropCollectionOptions): Promise<boolean>;
61
61
  findOne(): Promise<WithId<T> | null>;
62
62
  findOne(filter: Filter<T>): Promise<WithId<T> | null>;
63
63
  findOne(filter: Filter<T>, options: FindOptions<Document>): Promise<WithId<T> | null>;
64
64
  findOne<TS = T>(): Promise<TS | null>;
65
65
  findOne<TS = T>(filter: Filter<TS>): Promise<TS | null>;
66
- findOne<TS = T>(filter: Filter<TS>, options?: FindOptions<Document> | undefined): Promise<TS | null>;
66
+ findOne<TS = T>(filter: Filter<TS>, options?: FindOptions<Document>): Promise<TS | null>;
67
67
  find(): FindCursor$1<WithId<T>>;
68
- find(filter: Filter<T>, options?: FindOptions<Document> | undefined): FindCursor$1<WithId<T>>;
69
- find<T extends Document>(filter: Filter<T>, options?: FindOptions<Document> | undefined): FindCursor$1<T>;
70
- options(_options?: OperationOptions | undefined): Promise<Document>;
71
- isCapped(_options?: OperationOptions | undefined): Promise<boolean>;
72
- createIndex(_indexSpec: IndexSpecification, _options?: CreateIndexesOptions | undefined): Promise<string>;
73
- createIndexes(_indexSpecs: IndexDescription[], _options?: CreateIndexesOptions | undefined): Promise<string[]>;
74
- dropIndex(_indexName: string, _options?: CommandOperationOptions | undefined): Promise<Document>;
75
- dropIndexes(_options?: CommandOperationOptions | undefined): Promise<boolean>;
76
- listIndexes(_options?: AbstractCursorOptions | undefined): ListIndexesCursor;
77
- indexExists(_indexes: string | string[], _options?: AbstractCursorOptions | undefined): Promise<boolean>;
68
+ find(filter: Filter<T>, options?: FindOptions<Document>): FindCursor$1<WithId<T>>;
69
+ find<T extends Document>(filter: Filter<T>, options?: FindOptions<Document>): FindCursor$1<T>;
70
+ options(_options?: OperationOptions): Promise<Document>;
71
+ isCapped(_options?: OperationOptions): Promise<boolean>;
72
+ createIndex(_indexSpec: IndexSpecification, _options?: CreateIndexesOptions): Promise<string>;
73
+ createIndexes(_indexSpecs: IndexDescription[], _options?: CreateIndexesOptions): Promise<string[]>;
74
+ dropIndex(_indexName: string, _options?: CommandOperationOptions): Promise<Document>;
75
+ dropIndexes(_options?: CommandOperationOptions): Promise<boolean>;
76
+ listIndexes(_options?: AbstractCursorOptions): ListIndexesCursor;
77
+ indexExists(_indexes: string | string[], _options?: AbstractCursorOptions): Promise<boolean>;
78
78
  indexInformation(options: IndexInformationOptions & {
79
79
  full: true;
80
80
  }): Promise<IndexDescriptionInfo[]>;
@@ -83,8 +83,8 @@ declare class Collection<T extends Document> implements Collection$1<T> {
83
83
  }): Promise<IndexDescriptionCompact>;
84
84
  indexInformation(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
85
85
  indexInformation(): Promise<IndexDescriptionCompact>;
86
- estimatedDocumentCount(options?: EstimatedDocumentCountOptions | undefined): Promise<number>;
87
- countDocuments(filter?: Filter<T> | undefined, options?: CountDocumentsOptions | undefined): Promise<number>;
86
+ estimatedDocumentCount(options?: EstimatedDocumentCountOptions): Promise<number>;
87
+ countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<number>;
88
88
  distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key): Promise<Flatten<WithId<T>[Key]>[]>;
89
89
  distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>): Promise<Flatten<WithId<T>[Key]>[]>;
90
90
  distinct<Key extends '_id' | keyof EnhancedOmit<T, '_id'>>(key: Key, filter: Filter<T>, options: CommandOperationOptions): Promise<Flatten<WithId<T>[Key]>[]>;
@@ -98,7 +98,7 @@ declare class Collection<T extends Document> implements Collection$1<T> {
98
98
  full: false;
99
99
  }): Promise<IndexDescriptionCompact>;
100
100
  indexes(options: IndexInformationOptions): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>;
101
- indexes(options?: AbstractCursorOptions | undefined): Promise<IndexDescriptionInfo[]>;
101
+ indexes(options?: AbstractCursorOptions): Promise<IndexDescriptionInfo[]>;
102
102
  findOneAndDelete(filter: Filter<T>, options: FindOneAndDeleteOptions & {
103
103
  includeResultMetadata: true;
104
104
  }): Promise<ModifyResult<T>>;
@@ -123,13 +123,13 @@ declare class Collection<T extends Document> implements Collection$1<T> {
123
123
  }): Promise<WithId<T> | null>;
124
124
  findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>, options: FindOneAndUpdateOptions): Promise<WithId<T> | null>;
125
125
  findOneAndUpdate(filter: Filter<T>, update: UpdateFilter<T>): Promise<WithId<T> | null>;
126
- aggregate<T extends Document = Document>(_pipeline?: Document[] | undefined, _options?: AggregateOptions | undefined): AggregationCursor<T>;
127
- watch<TLocal extends Document = T, TChange extends Document = ChangeStreamDocument<TLocal>>(_pipeline?: Document[] | undefined, _options?: ChangeStreamOptions | undefined): ChangeStream<TLocal, TChange>;
128
- initializeUnorderedBulkOp(_options?: BulkWriteOptions | undefined): UnorderedBulkOperation;
129
- initializeOrderedBulkOp(_options?: BulkWriteOptions | undefined): OrderedBulkOperation;
130
- count(filter?: Filter<T> | undefined, options?: CountOptions | undefined): Promise<number>;
131
- listSearchIndexes(options?: ListSearchIndexesOptions | undefined): ListSearchIndexesCursor;
132
- listSearchIndexes(name: string, options?: ListSearchIndexesOptions | undefined): ListSearchIndexesCursor;
126
+ aggregate<T extends Document = Document>(_pipeline?: Document[], _options?: AggregateOptions): AggregationCursor<T>;
127
+ watch<TLocal extends Document = T, TChange extends Document = ChangeStreamDocument<TLocal>>(_pipeline?: Document[], _options?: ChangeStreamOptions): ChangeStream<TLocal, TChange>;
128
+ initializeUnorderedBulkOp(_options?: BulkWriteOptions): UnorderedBulkOperation;
129
+ initializeOrderedBulkOp(_options?: BulkWriteOptions): OrderedBulkOperation;
130
+ count(filter?: Filter<T>, options?: CountOptions): Promise<number>;
131
+ listSearchIndexes(options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
132
+ listSearchIndexes(name: string, options?: ListSearchIndexesOptions): ListSearchIndexesCursor;
133
133
  createSearchIndex(_description: SearchIndexDescription): Promise<string>;
134
134
  createSearchIndexes(_descriptions: SearchIndexDescription[]): Promise<string[]>;
135
135
  dropSearchIndex(_name: string): Promise<void>;