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