@event-driven-io/pongo 0.17.0-beta.44 → 0.17.0-beta.46

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/pg.d.cts CHANGED
@@ -1,437 +1,9 @@
1
+ import { In as PongoCollectionSQLBuilder, _t as PongoDb, in as PongoDriverOptions, rn as PongoDriver } from "./index-C3pnS1S_.cjs";
1
2
  import * as _$_event_driven_io_dumbo0 from "@event-driven-io/dumbo";
2
- import { AnyConnection, DatabaseDriverType, DatabaseTransaction, JSONSerializationOptions, JSONSerializer, MigrationStyle, QueryResult, QueryResultRow, RunSQLMigrationsResult, SQL, SQLCommandOptions, SQLExecutor, SQLQueryOptions, SchemaComponent, SchemaComponentOptions, WithDatabaseTransactionFactory } from "@event-driven-io/dumbo";
3
- import { LRUCache } from "lru-cache";
3
+ import { JSONSerializer } from "@event-driven-io/dumbo";
4
4
  import { PgConnection, PgDriverType } from "@event-driven-io/dumbo/pg";
5
5
  import pg from "pg";
6
6
 
7
- //#region src/core/collection/handle.d.ts
8
- type DocumentCommandHandlerInput = {
9
- _id: string;
10
- expectedVersion?: ExpectedDocumentVersion;
11
- };
12
- //#endregion
13
- //#region src/core/collection/pongoCollectionSchema.d.ts
14
- type PongoCollectionSQLBuilder = {
15
- createCollection: () => SQL;
16
- insertOne: <T>(document: OptionalUnlessRequiredIdAndVersion<T>) => SQL;
17
- insertMany: <T>(documents: OptionalUnlessRequiredIdAndVersion<T>[]) => SQL;
18
- insertOrReplace: <T>(documents: Array<WithId<T>>) => SQL;
19
- updateOne: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions) => SQL;
20
- replaceOne: <T>(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions) => SQL;
21
- updateMany: <T>(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL) => SQL;
22
- deleteOne: <T>(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions) => SQL;
23
- deleteMany: <T>(filter: PongoFilter<T> | SQL) => SQL;
24
- replaceMany: <T>(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>) => SQL;
25
- deleteManyByIds: (ids: Array<{
26
- _id: string;
27
- _version?: bigint;
28
- }>) => SQL;
29
- findOne: <T>(filter: PongoFilter<T> | SQL) => SQL;
30
- find: <T>(filter: PongoFilter<T> | SQL, options?: FindOptions) => SQL;
31
- countDocuments: <T>(filter: PongoFilter<T> | SQL) => SQL;
32
- rename: (newName: string) => SQL;
33
- drop: () => SQL;
34
- };
35
- //#endregion
36
- //#region src/core/collection/pongoCollectionSchemaComponent.d.ts
37
- type PongoCollectionURNType = 'sc:pongo:collection';
38
- type PongoCollectionURN = `${PongoCollectionURNType}:${string}`;
39
- type PongoCollectionSchemaComponent = SchemaComponent<PongoCollectionURN> & {
40
- collectionName: string;
41
- definition: PongoCollectionSchema;
42
- sqlBuilder: PongoCollectionSQLBuilder;
43
- };
44
- type PongoCollectionSchemaComponentOptions<DriverType extends DatabaseDriverType = DatabaseDriverType> = Readonly<{
45
- driverType: DriverType;
46
- definition: PongoCollectionSchema;
47
- migrationsOrSchemaComponents: SchemaComponentOptions;
48
- sqlBuilder: PongoCollectionSQLBuilder;
49
- }>;
50
- declare const PongoCollectionSchemaComponent: <DriverType extends DatabaseDriverType = DatabaseDriverType>({
51
- definition,
52
- migrationsOrSchemaComponents,
53
- sqlBuilder
54
- }: PongoCollectionSchemaComponentOptions<DriverType>) => PongoCollectionSchemaComponent;
55
- //#endregion
56
- //#region src/core/schema/index.d.ts
57
- interface PongoCollectionSchema<T extends PongoDocument = PongoDocument> {
58
- name: string;
59
- }
60
- interface PongoDbSchema<T extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>> {
61
- name?: string;
62
- collections: T;
63
- }
64
- //#endregion
65
- //#region src/core/database/pongoDatabaseSchemaComponent.d.ts
66
- type PongoDatabaseURNType = 'sc:dumbo:database';
67
- type PongoDatabaseURN = `${PongoDatabaseURNType}:${string}`;
68
- type PongoDatabaseSchemaComponent<DriverType extends DatabaseDriverType = DatabaseDriverType, T extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>> = SchemaComponent<PongoDatabaseURN> & {
69
- definition: PongoDbSchema<T>;
70
- collections: ReadonlyArray<PongoCollectionSchemaComponent>;
71
- collection: <T extends PongoDocument = PongoDocument>(schema: PongoCollectionSchema<T>) => PongoCollectionSchemaComponent;
72
- };
73
- type PongoDatabaseSchemaComponentOptions<DriverType extends DatabaseDriverType = DatabaseDriverType, T extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>> = Readonly<{
74
- driverType: DriverType;
75
- definition: PongoDbSchema<T>;
76
- collectionFactory: <T extends PongoDocument = PongoDocument>(schema: PongoCollectionSchema<T>) => PongoCollectionSchemaComponent;
77
- }>;
78
- declare const PongoDatabaseSchemaComponent: <DriverType extends DatabaseDriverType = DatabaseDriverType>({
79
- definition,
80
- collectionFactory
81
- }: PongoDatabaseSchemaComponentOptions<DriverType>) => PongoDatabaseSchemaComponent;
82
- //#endregion
83
- //#region src/core/drivers/databaseDriver.d.ts
84
- type PongoDriverOptions<ConnectionOptions = unknown> = {
85
- connectionOptions?: ConnectionOptions | undefined;
86
- } & JSONSerializationOptions;
87
- type AnyPongoDriverOptions = PongoDriverOptions<any>;
88
- type PongoDatabaseFactoryOptions<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>, DriverOptions extends AnyPongoDriverOptions = AnyPongoDriverOptions> = {
89
- databaseName?: string | undefined;
90
- schema?: {
91
- autoMigration?: MigrationStyle;
92
- definition?: PongoDbSchema<CollectionsSchema>;
93
- } | undefined;
94
- serializer: JSONSerializer;
95
- errors?: {
96
- throwOnOperationFailures?: boolean;
97
- } | undefined;
98
- cache?: CacheConfig | 'disabled' | PongoCache | undefined;
99
- } & DriverOptions;
100
- interface PongoDriver<Database extends AnyPongoDb = AnyPongoDb, DriverOptions extends AnyPongoDriverOptions = AnyPongoDriverOptions> {
101
- driverType: Database['driverType'];
102
- databaseFactory<CollectionsSchema extends Record<string, PongoCollectionSchema> = Record<string, PongoCollectionSchema>>(options: PongoDatabaseFactoryOptions<CollectionsSchema, DriverOptions>): Database & PongoDb<Database['driverType']>;
103
- }
104
- type AnyPongoDriver = PongoDriver<AnyPongoDb, AnyPongoDriverOptions>;
105
- declare const PongoDriverRegistry: () => {
106
- register: <Database extends AnyPongoDb = AnyPongoDb>(driverType: Database["driverType"], driver: PongoDriver<Database> | (() => Promise<PongoDriver<Database>>)) => void;
107
- tryResolve: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Promise<Driver | null>;
108
- tryGet: <Driver extends AnyPongoDriver = AnyPongoDriver>(driverType: Driver["driverType"]) => Driver | null;
109
- has: (driverType: DatabaseDriverType) => boolean;
110
- readonly databaseDriverTypes: DatabaseDriverType[];
111
- };
112
- declare global {
113
- var pongoDriverRegistry: ReturnType<typeof PongoDriverRegistry>;
114
- }
115
- //#endregion
116
- //#region src/core/typing/operations.d.ts
117
- declare interface PongoTransactionOptions {
118
- get snapshotEnabled(): boolean;
119
- maxCommitTimeMS?: number;
120
- }
121
- interface PongoDbTransaction<DriverType extends DatabaseDriverType = DatabaseDriverType, Database extends PongoDb<DriverType> = PongoDb<DriverType>> {
122
- get databaseName(): string | null;
123
- options: PongoTransactionOptions;
124
- enlistDatabase: (database: Database) => Promise<DatabaseTransaction<AnyConnection>>;
125
- commit: () => Promise<void>;
126
- rollback: (error?: unknown) => Promise<void>;
127
- get cache(): PongoTransactionCache | null;
128
- get sqlExecutor(): SQLExecutor;
129
- get isStarting(): boolean;
130
- get isActive(): boolean;
131
- get isCommitted(): boolean;
132
- }
133
- interface PongoSession<DriverType extends DatabaseDriverType = DatabaseDriverType> {
134
- hasEnded: boolean;
135
- explicit: boolean;
136
- defaultTransactionOptions: PongoTransactionOptions;
137
- transaction: PongoDbTransaction<DriverType> | null;
138
- get snapshotEnabled(): boolean;
139
- endSession(): Promise<void>;
140
- incrementTransactionNumber(): void;
141
- inTransaction(): boolean;
142
- startTransaction(options?: PongoTransactionOptions): void;
143
- commitTransaction(): Promise<void>;
144
- abortTransaction(): Promise<void>;
145
- withTransaction<T = unknown>(fn: (session: PongoSession<DriverType>) => Promise<T>, options?: PongoTransactionOptions): Promise<T>;
146
- }
147
- type PongoDBCollectionOptions<T extends PongoDocument, Payload extends PongoDocument = T> = {
148
- schema?: {
149
- versioning?: {
150
- upcast?: (document: Payload) => T;
151
- downcast?: (document: T) => Payload;
152
- };
153
- };
154
- errors?: {
155
- throwOnOperationFailures?: boolean;
156
- };
157
- cache?: CacheConfig | 'disabled' | PongoCache;
158
- };
159
- interface PongoDb<DriverType extends DatabaseDriverType = DatabaseDriverType> extends WithDatabaseTransactionFactory<AnyConnection> {
160
- driverType: DriverType;
161
- databaseName: string;
162
- connect(): Promise<void>;
163
- close(): Promise<void>;
164
- collection<T extends PongoDocument, Payload extends PongoDocument = T>(name: string, options?: PongoDBCollectionOptions<T, Payload>): PongoCollection<T>;
165
- collections(): ReadonlyArray<PongoCollection<PongoDocument>>;
166
- readonly schema: Readonly<{
167
- component: PongoDatabaseSchemaComponent<DriverType>;
168
- migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
169
- }>;
170
- sql: {
171
- query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions & SQLQueryOptions): Promise<Result[]>;
172
- command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions & SQLCommandOptions): Promise<QueryResult<Result>>;
173
- };
174
- }
175
- type AnyPongoDb = PongoDb<DatabaseDriverType>;
176
- type PongoMigrationOptions = {
177
- dryRun?: boolean | undefined;
178
- ignoreMigrationHashMismatch?: boolean | undefined;
179
- migrationTimeoutMs?: number | undefined;
180
- };
181
- type CollectionOperationOptions = {
182
- session?: PongoSession;
183
- skipCache?: boolean;
184
- };
185
- type InsertOneOptions = {
186
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
187
- upsert?: boolean;
188
- } & CollectionOperationOptions;
189
- type InsertManyOptions = {
190
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK'>;
191
- upsert?: boolean;
192
- } & CollectionOperationOptions;
193
- type UpdateOneOptions = {
194
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
195
- } & CollectionOperationOptions;
196
- type UpdateManyOptions = {
197
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
198
- } & CollectionOperationOptions;
199
- type HandleOptions = CollectionOperationOptions;
200
- type BatchHandleOptions = {
201
- parallel?: boolean;
202
- } & CollectionOperationOptions;
203
- type ReplaceOneOptions = {
204
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
205
- upsert?: boolean;
206
- } & CollectionOperationOptions;
207
- type DeleteOneOptions = {
208
- expectedVersion?: Exclude<ExpectedDocumentVersion, 'DOCUMENT_DOES_NOT_EXIST'>;
209
- } & CollectionOperationOptions;
210
- type ReplaceManyOptions = {
211
- upsert?: boolean;
212
- } & CollectionOperationOptions;
213
- type DeleteManyOptions = {
214
- expectedVersion?: Extract<ExpectedDocumentVersion, 'DOCUMENT_EXISTS' | 'NO_CONCURRENCY_CHECK'>;
215
- } & CollectionOperationOptions;
216
- type FindOptions = {
217
- limit?: number;
218
- skip?: number;
219
- sort?: {
220
- [field: string]: 1 | -1;
221
- };
222
- } & CollectionOperationOptions;
223
- interface PongoCollection<T extends PongoDocument> {
224
- readonly dbName: string;
225
- readonly collectionName: string;
226
- createCollection(options?: CollectionOperationOptions): Promise<void>;
227
- insertOne(document: OptionalUnlessRequiredId<T>, options?: InsertOneOptions): Promise<PongoInsertOneResult>;
228
- insertMany(documents: OptionalUnlessRequiredId<T>[], options?: InsertManyOptions): Promise<PongoInsertManyResult>;
229
- updateOne(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions): Promise<PongoUpdateResult>;
230
- replaceOne(filter: PongoFilter<T> | SQL, document: WithoutId<T>, options?: ReplaceOneOptions): Promise<PongoUpdateResult>;
231
- updateMany(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateManyOptions): Promise<PongoUpdateManyResult>;
232
- deleteOne(filter?: PongoFilter<T> | SQL, options?: DeleteOneOptions): Promise<PongoDeleteResult>;
233
- deleteMany(filter?: PongoFilter<T> | SQL, options?: DeleteManyOptions): Promise<PongoDeleteResult>;
234
- findOne(filter?: PongoFilter<T> | SQL, options?: CollectionOperationOptions): Promise<WithIdAndVersion<T> | null>;
235
- find(filter?: PongoFilter<T> | SQL, options?: FindOptions): Promise<WithIdAndVersion<T>[]>;
236
- findOneAndDelete(filter: PongoFilter<T> | SQL, options?: DeleteOneOptions): Promise<WithIdAndVersion<T> | null>;
237
- findOneAndReplace(filter: PongoFilter<T> | SQL, replacement: WithoutId<T>, options?: ReplaceOneOptions): Promise<WithIdAndVersion<T> | null>;
238
- findOneAndUpdate(filter: PongoFilter<T> | SQL, update: PongoUpdate<T> | SQL, options?: UpdateOneOptions): Promise<WithIdAndVersion<T> | null>;
239
- countDocuments(filter?: PongoFilter<T> | SQL, options?: CollectionOperationOptions): Promise<number>;
240
- drop(options?: CollectionOperationOptions): Promise<boolean>;
241
- rename(newName: string, options?: CollectionOperationOptions): Promise<PongoCollection<T>>;
242
- handle(id: string | DocumentCommandHandlerInput, handle: DocumentHandler<T>, options?: HandleOptions): Promise<PongoHandleResult<T>>;
243
- handle(id: string[] | DocumentCommandHandlerInput[], handle: DocumentHandler<T>, options?: BatchHandleOptions): Promise<PongoHandleResult<T>[]>;
244
- replaceMany(documents: Array<WithIdAndVersion<T>> | Array<WithId<T>>, options?: ReplaceManyOptions): Promise<PongoReplaceManyResult>;
245
- readonly schema: Readonly<{
246
- component: PongoCollectionSchemaComponent;
247
- migrate(options?: PongoMigrationOptions): Promise<RunSQLMigrationsResult>;
248
- }>;
249
- close: () => MaybePromise<void>;
250
- sql: {
251
- query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions): Promise<Result[]>;
252
- command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: CollectionOperationOptions): Promise<QueryResult<Result>>;
253
- };
254
- }
255
- type ObjectId = string & {
256
- __brandId: 'ObjectId';
257
- };
258
- declare const ObjectId: (value?: string) => string;
259
- type HasId = {
260
- _id: string;
261
- };
262
- /** TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions @public */
263
- declare type EnhancedOmit<TRecordOrUnion, KeyUnion> = string extends keyof TRecordOrUnion ? TRecordOrUnion : TRecordOrUnion extends any ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>> : never;
264
- declare type OptionalUnlessRequiredId<TSchema> = TSchema extends {
265
- _id: string | ObjectId;
266
- } ? TSchema : OptionalId<TSchema>;
267
- declare type OptionalUnlessRequiredVersion<TSchema> = TSchema extends {
268
- _version: bigint;
269
- } ? TSchema : OptionalVersion<TSchema>;
270
- declare type OptionalUnlessRequiredIdAndVersion<TSchema> = OptionalUnlessRequiredId<TSchema> & OptionalUnlessRequiredVersion<TSchema>;
271
- declare type WithId<TSchema> = TSchema & {
272
- _id: string | ObjectId;
273
- };
274
- type WithoutId<T> = Omit<T, '_id'>;
275
- declare type WithVersion<TSchema> = TSchema & {
276
- _version: bigint;
277
- };
278
- type WithIdAndVersion<T> = WithId<T> & WithVersion<T>;
279
- /** @public */
280
- declare type RegExpOrString<T> = T extends string ? RegExp | T : T;
281
- declare interface Document {
282
- [key: string]: any;
283
- }
284
- declare type OptionalId<TSchema> = EnhancedOmit<TSchema, '_id'> & {
285
- _id?: string | ObjectId;
286
- };
287
- declare type OptionalVersion<TSchema> = EnhancedOmit<TSchema, '_version'> & {
288
- _version?: bigint;
289
- };
290
- declare interface ObjectIdLike {
291
- __id?: string | ObjectId;
292
- }
293
- declare type NonObjectIdLikeDocument = { [key in keyof ObjectIdLike]?: never } & Document;
294
- declare type AlternativeType<T> = T extends ReadonlyArray<infer U> ? T | RegExpOrString<U> : RegExpOrString<T>;
295
- declare type Condition<T> = AlternativeType<T> | PongoFilterOperator<AlternativeType<T>>;
296
- declare interface RootFilterOperators<TSchema> extends Document {
297
- $and?: PongoFilter<TSchema>[];
298
- $nor?: PongoFilter<TSchema>[];
299
- $or?: PongoFilter<TSchema>[];
300
- $text?: {
301
- $search: string;
302
- $language?: string;
303
- $caseSensitive?: boolean;
304
- $diacriticSensitive?: boolean;
305
- };
306
- $where?: string | ((this: TSchema) => boolean);
307
- $comment?: string | Document;
308
- }
309
- declare type PongoFilter<TSchema> = ({ [P in keyof WithId<TSchema>]?: Condition<WithId<TSchema>[P]> } & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>) | (HasId & Pick<RootFilterOperators<WithId<TSchema>>, '$and' | '$nor' | '$or'>);
310
- declare interface PongoFilterOperator<TValue> extends NonObjectIdLikeDocument {
311
- $eq?: TValue;
312
- $gt?: TValue;
313
- $gte?: TValue;
314
- $lt?: TValue;
315
- $lte?: TValue;
316
- $ne?: TValue;
317
- $in?: TValue[];
318
- $nin?: TValue[];
319
- }
320
- type $unset<T> = { [P in keyof T]?: '' };
321
- type $inc<T> = { [P in keyof T]?: number | bigint };
322
- type $push<T> = { [P in keyof T]?: T[P] };
323
- type ExpectedDocumentVersionGeneral = 'DOCUMENT_EXISTS' | 'DOCUMENT_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK';
324
- type ExpectedDocumentVersion = (bigint & {
325
- __brand: 'sql';
326
- }) | bigint | ExpectedDocumentVersionGeneral;
327
- type PongoUpdate<T> = {
328
- $set?: Partial<T>;
329
- $unset?: $unset<T>;
330
- $inc?: $inc<T>;
331
- $push?: $push<T>;
332
- };
333
- type OperationResult = {
334
- acknowledged: boolean;
335
- successful: boolean;
336
- assertSuccessful: (errorMessage?: string) => void;
337
- };
338
- interface PongoInsertOneResult extends OperationResult {
339
- insertedId: string | null;
340
- nextExpectedVersion: bigint;
341
- }
342
- interface PongoInsertManyResult extends OperationResult {
343
- insertedIds: string[];
344
- insertedCount: number;
345
- }
346
- interface PongoUpdateResult extends OperationResult {
347
- matchedCount: number;
348
- modifiedCount: number;
349
- upsertedId: string | null;
350
- upsertedCount: number;
351
- nextExpectedVersion: bigint;
352
- }
353
- interface PongoUpdateManyResult extends OperationResult {
354
- matchedCount: number;
355
- modifiedCount: number;
356
- }
357
- interface PongoDeleteResult extends OperationResult {
358
- matchedCount: number;
359
- deletedCount: number;
360
- }
361
- interface PongoReplaceManyResult extends OperationResult {
362
- modifiedCount: number;
363
- matchedCount: number;
364
- modifiedIds: string[];
365
- conflictIds: string[];
366
- nextExpectedVersions: Map<string, bigint>;
367
- }
368
- type PongoHandleResult<T> = (PongoInsertOneResult & {
369
- document: T;
370
- }) | (PongoUpdateResult & {
371
- document: T;
372
- }) | (PongoDeleteResult & {
373
- document: null;
374
- }) | (OperationResult & {
375
- document: null;
376
- });
377
- type PongoDocument = Record<string, unknown>;
378
- type DocumentHandler<T extends PongoDocument> = ((document: T | null, id: string) => T | null) | ((document: T | null, id: string) => Promise<T | null>);
379
- //#endregion
380
- //#region src/core/typing/index.d.ts
381
- type MaybePromise<T> = T | PromiseLike<T>;
382
- //#endregion
383
- //#region src/core/cache/providers/lruCache.d.ts
384
- type LRUCacheOptions = Omit<LRUCache.Options<string, {
385
- doc: PongoDocument | null;
386
- }, unknown>, 'max'> & {
387
- max?: number;
388
- };
389
- //#endregion
390
- //#region src/core/cache/pongoCache.d.ts
391
- type PongoDocumentCacheKey = `${string}:${string}:${string}`;
392
- type PongoCacheSetEntry<Doc extends PongoDocument = PongoDocument> = {
393
- key: PongoDocumentCacheKey;
394
- value: Doc | null;
395
- };
396
- type PongoCacheType<T extends string = string> = `pongo:cache:${T}`;
397
- interface PongoCache<T extends string = string> {
398
- cacheType: PongoCacheType<T>;
399
- get<Doc extends PongoDocument = PongoDocument>(key: PongoDocumentCacheKey): MaybePromise<Doc | null | undefined>;
400
- getMany<Doc extends PongoDocument = PongoDocument>(keys: PongoDocumentCacheKey[]): MaybePromise<(Doc | null | undefined)[]>;
401
- set<Doc extends PongoDocument = PongoDocument>(key: PongoDocumentCacheKey, value: Doc | null): MaybePromise<void>;
402
- setMany(entries: PongoCacheSetEntry[]): MaybePromise<void>;
403
- update<Doc extends PongoDocument = PongoDocument>(key: PongoDocumentCacheKey, updater: PongoUpdate<Doc>): MaybePromise<void>;
404
- updateMany<Doc extends PongoDocument = PongoDocument>(keys: PongoDocumentCacheKey[], updater: PongoUpdate<Doc>): MaybePromise<void>;
405
- delete(key: PongoDocumentCacheKey): MaybePromise<void>;
406
- deleteMany(keys: PongoDocumentCacheKey[]): MaybePromise<void>;
407
- clear(): MaybePromise<void>;
408
- close(): MaybePromise<void>;
409
- }
410
- type CacheSettings = ({
411
- type: 'in-memory';
412
- } & LRUCacheOptions) | {
413
- type: 'identity-map';
414
- };
415
- type CacheConfig = CacheSettings | 'disabled';
416
- //#endregion
417
- //#region src/core/cache/transactions/pongoTransactionCache.d.ts
418
- type PongoTransactionCacheOperationOptions = {
419
- mainCache: PongoCache;
420
- };
421
- interface PongoTransactionCache<T extends string = string> {
422
- type: PongoCacheType<T>;
423
- get<Doc extends PongoDocument = PongoDocument>(key: PongoDocumentCacheKey): MaybePromise<Doc | null | undefined>;
424
- set(key: PongoDocumentCacheKey, value: PongoDocument | null, options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
425
- update<Doc extends PongoDocument = PongoDocument>(key: PongoDocumentCacheKey, updater: PongoUpdate<Doc>, options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
426
- delete(key: PongoDocumentCacheKey, options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
427
- getMany<Doc extends PongoDocument = PongoDocument>(keys: PongoDocumentCacheKey[]): MaybePromise<(Doc | null | undefined)[]>;
428
- setMany(entries: PongoCacheSetEntry[], options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
429
- updateMany<Doc extends PongoDocument = PongoDocument>(keys: PongoDocumentCacheKey[], updater: PongoUpdate<Doc>, options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
430
- deleteMany(keys: PongoDocumentCacheKey[], options: PongoTransactionCacheOperationOptions): MaybePromise<void>;
431
- clear(): MaybePromise<void>;
432
- commit(): Promise<void>;
433
- }
434
- //#endregion
435
7
  //#region src/storage/postgresql/core/sqlBuilder/index.d.ts
436
8
  declare const pongoCollectionPostgreSQLMigrations: (collectionName: string) => _$_event_driven_io_dumbo0.SQLMigration[];
437
9
  declare const postgresSQLBuilder: (collectionName: string, serializer: JSONSerializer) => PongoCollectionSQLBuilder;
@@ -464,5 +36,4 @@ type PgDatabaseDriverOptions = PongoDriverOptions<PgPongoClientOptions> & {
464
36
  declare const pgPongoDriver: PongoDriver<PongoDb<PgDriverType>, PgDatabaseDriverOptions>;
465
37
  declare const usePgPongoDriver: () => void;
466
38
  //#endregion
467
- export { NotPooledPongoOptions, PgPongoClientOptions, PooledPongoClientOptions, pgPongoDriver as pgDriver, pgPongoDriver as pongoDriver, pongoCollectionPostgreSQLMigrations, postgresSQLBuilder, usePgPongoDriver };
468
- //# sourceMappingURL=pg.d.cts.map
39
+ export { NotPooledPongoOptions, PgPongoClientOptions, PooledPongoClientOptions, pgPongoDriver as pgDriver, pgPongoDriver as pongoDriver, pongoCollectionPostgreSQLMigrations, postgresSQLBuilder, usePgPongoDriver };