alepha 0.11.4 → 0.11.6

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.
Files changed (49) hide show
  1. package/api/files.d.ts +439 -1
  2. package/api/jobs.d.ts +290 -1
  3. package/api/notifications.d.ts +264 -1
  4. package/api/users.d.ts +924 -1
  5. package/batch.d.ts +154 -1
  6. package/bucket.d.ts +520 -1
  7. package/cache/redis.d.ts +40 -1
  8. package/cache.d.ts +288 -1
  9. package/command.d.ts +269 -1
  10. package/core.d.ts +1877 -1
  11. package/datetime.d.ts +1 -1
  12. package/devtools.d.ts +408 -1
  13. package/email.d.ts +187 -1
  14. package/fake.d.ts +73 -1
  15. package/file.d.ts +528 -1
  16. package/lock/redis.d.ts +24 -1
  17. package/lock.d.ts +552 -1
  18. package/logger.d.ts +288 -1
  19. package/package.json +51 -51
  20. package/postgres.d.ts +2146 -1
  21. package/queue/redis.d.ts +29 -1
  22. package/queue.d.ts +760 -1
  23. package/react/auth.d.ts +504 -1
  24. package/react/form.d.ts +208 -1
  25. package/react/head.d.ts +120 -1
  26. package/react/i18n.d.ts +168 -1
  27. package/react.d.ts +1261 -1
  28. package/redis.d.ts +82 -1
  29. package/retry.d.ts +84 -21
  30. package/scheduler.d.ts +145 -1
  31. package/security.d.ts +586 -1
  32. package/server/cache.d.ts +163 -1
  33. package/server/compress.d.ts +38 -1
  34. package/server/cookies.d.ts +144 -1
  35. package/server/cors.d.ts +45 -1
  36. package/server/health.d.ts +59 -1
  37. package/server/helmet.d.ts +98 -1
  38. package/server/links.d.ts +322 -1
  39. package/server/metrics.d.ts +35 -1
  40. package/server/multipart.d.ts +42 -1
  41. package/server/proxy.d.ts +234 -1
  42. package/server/security.d.ts +92 -1
  43. package/server/static.d.ts +119 -1
  44. package/server/swagger.d.ts +161 -1
  45. package/server.d.ts +849 -1
  46. package/topic/redis.d.ts +42 -1
  47. package/topic.d.ts +819 -1
  48. package/ui.d.ts +786 -1
  49. package/vite.d.ts +186 -1
package/postgres.d.ts CHANGED
@@ -1 +1,2146 @@
1
- export * from '@alepha/postgres';
1
+ import * as _alepha_core10 from "alepha";
2
+ import { Alepha, AlephaError, Descriptor, KIND, Page, Page as Page$1, PageQuery, PageQuery as PageQuery$1, Service, Static, StaticEncode, TBigInt, TInteger, TNull, TNumber, TNumberOptions, TObject, TObjectOptions, TOptional, TPage, TSchema, TString, TStringOptions, TUnion, TUnsafe, pageQuerySchema, pageSchema } from "alepha";
3
+ import { DateTime, DateTimeProvider } from "alepha/datetime";
4
+ import * as drizzle_orm0 from "drizzle-orm";
5
+ import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, sql } from "drizzle-orm";
6
+ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
7
+ import { LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSchema, PgSelectBase, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, UpdateDeleteAction } from "drizzle-orm/pg-core";
8
+ import * as _alepha_logger0 from "alepha/logger";
9
+ import * as _alepha_lock0 from "alepha/lock";
10
+ import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
11
+ import postgres from "postgres";
12
+ import * as pg$1 from "drizzle-orm/sqlite-core";
13
+ import { SQLiteColumnBuilderBase } from "drizzle-orm/sqlite-core";
14
+ import * as _alepha_retry0 from "alepha/retry";
15
+ import { DatabaseSync } from "node:sqlite";
16
+ import { PgTransactionConfig } from "drizzle-orm/pg-core/session";
17
+ import * as typebox1 from "typebox";
18
+ import * as DrizzleKit from "drizzle-kit/api";
19
+ import * as dayjs0 from "dayjs";
20
+ import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
21
+ export * from "drizzle-orm/pg-core";
22
+
23
+ //#region src/schemas/insertSchema.d.ts
24
+ /**
25
+ * Transforms a TObject schema for insert operations.
26
+ * All default properties at the root level are made optional.
27
+ *
28
+ * @example
29
+ * Before: { name: string; age: number(default=0); }
30
+ * After: { name: string; age?: number; }
31
+ */
32
+ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends {
33
+ [PG_DEFAULT]: any;
34
+ } | {
35
+ "~optional": true;
36
+ } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
37
+ declare const insertSchema: <T extends TObject>(obj: T) => TObjectInsert<T>;
38
+ //#endregion
39
+ //#region src/schemas/updateSchema.d.ts
40
+ /**
41
+ * Transforms a TObject schema for update operations.
42
+ * All optional properties at the root level are made nullable (i.e., `T | null`).
43
+ * This allows an API endpoint to explicitly accept `null` to clear an optional field in the database.
44
+ *
45
+ * @example
46
+ * Before: { name?: string; age: number; }
47
+ * After: { name?: string | null; age: number; }
48
+ */
49
+ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
50
+ declare const updateSchema: <T extends TObject>(schema: T) => TObjectUpdate<T>;
51
+ //#endregion
52
+ //#region src/descriptors/$entity.d.ts
53
+ /**
54
+ * Creates a database entity descriptor that defines table structure using TypeBox schemas.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * import { t } from "alepha";
59
+ * import { $entity } from "alepha/postgres";
60
+ *
61
+ * const userEntity = $entity({
62
+ * name: "users",
63
+ * schema: t.object({
64
+ * id: pg.primaryKey(),
65
+ * name: t.text(),
66
+ * email: t.email(),
67
+ * }),
68
+ * });
69
+ * ```
70
+ */
71
+ declare const $entity: {
72
+ <TSchema$1 extends TObject>(options: EntityDescriptorOptions<TSchema$1>): EntityDescriptor<TSchema$1>;
73
+ [KIND]: typeof EntityDescriptor;
74
+ };
75
+ interface EntityDescriptorOptions<T extends TObject, Keys = keyof Static<T>> {
76
+ /**
77
+ * The database table name that will be created for this entity.
78
+ * If not provided, name will be inferred from the $repository variable name.
79
+ */
80
+ name: string;
81
+ /**
82
+ * TypeBox schema defining the table structure and column types.
83
+ */
84
+ schema: T;
85
+ /**
86
+ * Database indexes to create for query optimization.
87
+ */
88
+ indexes?: (Keys | {
89
+ /**
90
+ * Single column to index.
91
+ */
92
+ column: Keys;
93
+ /**
94
+ * Whether this should be a unique index (enforces uniqueness constraint).
95
+ */
96
+ unique?: boolean;
97
+ /**
98
+ * Custom name for the index. If not provided, generates name automatically.
99
+ */
100
+ name?: string;
101
+ } | {
102
+ /**
103
+ * Multiple columns for composite index (order matters for query optimization).
104
+ */
105
+ columns: Keys[];
106
+ /**
107
+ * Whether this should be a unique index (enforces uniqueness constraint).
108
+ */
109
+ unique?: boolean;
110
+ /**
111
+ * Custom name for the index. If not provided, generates name automatically.
112
+ */
113
+ name?: string;
114
+ })[];
115
+ /**
116
+ * Foreign key constraints to maintain referential integrity.
117
+ */
118
+ foreignKeys?: Array<{
119
+ /**
120
+ * Optional name for the foreign key constraint.
121
+ */
122
+ name?: string;
123
+ /**
124
+ * Local columns that reference the foreign table.
125
+ */
126
+ columns: Array<keyof Static<T>>;
127
+ /**
128
+ * Referenced columns in the foreign table.
129
+ * Must be EntityColumn references from other entities.
130
+ */
131
+ foreignColumns: Array<() => EntityColumn<any>>;
132
+ }>;
133
+ /**
134
+ * Additional table constraints for data validation.
135
+ *
136
+ * Constraints enforce business rules at the database level, providing
137
+ * an additional layer of data integrity beyond application validation.
138
+ *
139
+ * **Constraint Types**:
140
+ * - **Unique constraints**: Prevent duplicate values across columns
141
+ * - **Check constraints**: Enforce custom validation rules with SQL expressions
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * constraints: [
146
+ * {
147
+ * name: "unique_user_email",
148
+ * columns: ["email"],
149
+ * unique: true
150
+ * },
151
+ * {
152
+ * name: "valid_age_range",
153
+ * columns: ["age"],
154
+ * check: sql`age >= 0 AND age <= 150`
155
+ * },
156
+ * {
157
+ * name: "unique_user_username_per_tenant",
158
+ * columns: ["tenantId", "username"],
159
+ * unique: true
160
+ * }
161
+ * ]
162
+ * ```
163
+ */
164
+ constraints?: Array<{
165
+ /**
166
+ * Columns involved in this constraint.
167
+ */
168
+ columns: Array<keyof Static<T>>;
169
+ /**
170
+ * Optional name for the constraint.
171
+ */
172
+ name?: string;
173
+ /**
174
+ * Whether this is a unique constraint.
175
+ */
176
+ unique?: boolean | {};
177
+ /**
178
+ * SQL expression for check constraint validation.
179
+ */
180
+ check?: SQL;
181
+ }>;
182
+ /**
183
+ * Advanced Drizzle ORM configuration for complex table setups.
184
+ */
185
+ config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
186
+ }
187
+ declare class EntityDescriptor<T extends TObject = TObject> {
188
+ readonly options: EntityDescriptorOptions<T>;
189
+ constructor(options: EntityDescriptorOptions<T>);
190
+ alias(alias: string): this;
191
+ get cols(): EntityColumns<T>;
192
+ get name(): string;
193
+ get schema(): T;
194
+ get insertSchema(): TObjectInsert<T>;
195
+ get updateSchema(): TObjectUpdate<T>;
196
+ }
197
+ /**
198
+ * Convert a schema to columns.
199
+ */
200
+ type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
201
+ type SchemaToTableConfig<T extends TObject> = {
202
+ name: string;
203
+ schema: string | undefined;
204
+ columns: { [key in keyof T["properties"]]: PgColumn };
205
+ dialect: string;
206
+ };
207
+ type EntityColumn<T extends TObject> = {
208
+ name: string;
209
+ entity: EntityDescriptor<T>;
210
+ };
211
+ type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
212
+ //#endregion
213
+ //#region src/constants/PG_SYMBOLS.d.ts
214
+ declare const PG_DEFAULT: unique symbol;
215
+ declare const PG_PRIMARY_KEY: unique symbol;
216
+ declare const PG_CREATED_AT: unique symbol;
217
+ declare const PG_UPDATED_AT: unique symbol;
218
+ declare const PG_DELETED_AT: unique symbol;
219
+ declare const PG_VERSION: unique symbol;
220
+ declare const PG_IDENTITY: unique symbol;
221
+ declare const PG_ENUM: unique symbol;
222
+ declare const PG_REF: unique symbol;
223
+ /**
224
+ * @deprecated Use `PG_IDENTITY` instead.
225
+ */
226
+ declare const PG_SERIAL: unique symbol;
227
+ type PgDefault = typeof PG_DEFAULT;
228
+ type PgRef = typeof PG_REF;
229
+ type PgPrimaryKey = typeof PG_PRIMARY_KEY;
230
+ type PgSymbols = {
231
+ [PG_DEFAULT]: {};
232
+ [PG_PRIMARY_KEY]: {};
233
+ [PG_CREATED_AT]: {};
234
+ [PG_UPDATED_AT]: {};
235
+ [PG_DELETED_AT]: {};
236
+ [PG_VERSION]: {};
237
+ [PG_IDENTITY]: PgIdentityOptions;
238
+ [PG_REF]: PgRefOptions;
239
+ [PG_ENUM]: PgEnumOptions;
240
+ /**
241
+ * @deprecated Use `PG_IDENTITY` instead.
242
+ */
243
+ [PG_SERIAL]: {};
244
+ };
245
+ type PgSymbolKeys = keyof PgSymbols;
246
+ type PgIdentityOptions = {
247
+ mode: "always" | "byDefault";
248
+ } & PgSequenceOptions & {
249
+ name?: string;
250
+ };
251
+ interface PgEnumOptions {
252
+ name?: string;
253
+ }
254
+ interface PgRefOptions {
255
+ ref: () => {
256
+ name: string;
257
+ entity: EntityDescriptor;
258
+ };
259
+ actions?: {
260
+ onUpdate?: UpdateDeleteAction;
261
+ onDelete?: UpdateDeleteAction;
262
+ };
263
+ }
264
+ //#endregion
265
+ //#region src/errors/DbError.d.ts
266
+ declare class DbError extends AlephaError {
267
+ name: string;
268
+ constructor(message: string, cause?: unknown);
269
+ }
270
+ //#endregion
271
+ //#region src/helpers/pgAttr.d.ts
272
+ /**
273
+ * Decorates a typebox schema with a Postgres attribute.
274
+ *
275
+ * > It's just a fancy way to add Symbols to a field.
276
+ *
277
+ * @example
278
+ * ```ts
279
+ * import { t } from "alepha";
280
+ * import { PG_UPDATED_AT } from "../constants/PG_SYMBOLS";
281
+ *
282
+ * export const updatedAtSchema = pgAttr(
283
+ * t.datetime(), PG_UPDATED_AT,
284
+ * );
285
+ * ```
286
+ */
287
+ declare const pgAttr: <T extends TSchema, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
288
+ /**
289
+ * Retrieves the fields of a schema that have a specific attribute.
290
+ */
291
+ declare const getAttrFields: (schema: TObject, name: PgSymbolKeys) => PgAttrField[];
292
+ /**
293
+ * Type representation.
294
+ */
295
+ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
296
+ interface PgAttrField {
297
+ key: string;
298
+ type: TSchema;
299
+ data: any;
300
+ nested?: any[];
301
+ one?: boolean;
302
+ }
303
+ //#endregion
304
+ //#region src/interfaces/FilterOperators.d.ts
305
+ interface FilterOperators<TValue> {
306
+ /**
307
+ * Test that two values are equal.
308
+ *
309
+ * Remember that the SQL standard dictates that
310
+ * two NULL values are not equal, so if you want to test
311
+ * whether a value is null, you may want to use
312
+ * `isNull` instead.
313
+ *
314
+ * ## Examples
315
+ *
316
+ * ```ts
317
+ * // Select cars made by Ford
318
+ * db.select().from(cars)
319
+ * .where(eq(cars.make, 'Ford'))
320
+ * ```
321
+ *
322
+ * @see isNull for a way to test equality to NULL.
323
+ */
324
+ eq?: TValue;
325
+ /**
326
+ * Test that two values are not equal.
327
+ *
328
+ * Remember that the SQL standard dictates that
329
+ * two NULL values are not equal, so if you want to test
330
+ * whether a value is not null, you may want to use
331
+ * `isNotNull` instead.
332
+ *
333
+ * ## Examples
334
+ *
335
+ * ```ts
336
+ * // Select cars not made by Ford
337
+ * db.select().from(cars)
338
+ * .where(ne(cars.make, 'Ford'))
339
+ * ```
340
+ *
341
+ * @see isNotNull for a way to test whether a value is not null.
342
+ */
343
+ ne?: TValue;
344
+ /**
345
+ * Test that the first expression passed is greater than
346
+ * the second expression.
347
+ *
348
+ * ## Examples
349
+ *
350
+ * ```ts
351
+ * // Select cars made after 2000.
352
+ * db.select().from(cars)
353
+ * .where(gt(cars.year, 2000))
354
+ * ```
355
+ *
356
+ * @see gte for greater-than-or-equal
357
+ */
358
+ gt?: TValue;
359
+ /**
360
+ * Test that the first expression passed is greater than
361
+ * or equal to the second expression. Use `gt` to
362
+ * test whether an expression is strictly greater
363
+ * than another.
364
+ *
365
+ * ## Examples
366
+ *
367
+ * ```ts
368
+ * // Select cars made on or after 2000.
369
+ * db.select().from(cars)
370
+ * .where(gte(cars.year, 2000))
371
+ * ```
372
+ *
373
+ * @see gt for a strictly greater-than condition
374
+ */
375
+ gte?: TValue;
376
+ /**
377
+ * Test that the first expression passed is less than
378
+ * the second expression.
379
+ *
380
+ * ## Examples
381
+ *
382
+ * ```ts
383
+ * // Select cars made before 2000.
384
+ * db.select().from(cars)
385
+ * .where(lt(cars.year, 2000))
386
+ * ```
387
+ *
388
+ * @see lte for greater-than-or-equal
389
+ */
390
+ lt?: TValue;
391
+ /**
392
+ * Test that the first expression passed is less than
393
+ * or equal to the second expression.
394
+ *
395
+ * ## Examples
396
+ *
397
+ * ```ts
398
+ * // Select cars made before 2000.
399
+ * db.select().from(cars)
400
+ * .where(lte(cars.year, 2000))
401
+ * ```
402
+ *
403
+ * @see lt for a strictly less-than condition
404
+ */
405
+ lte?: TValue;
406
+ /**
407
+ * Test whether the first parameter, a column or expression,
408
+ * has a value from a list passed as the second argument.
409
+ *
410
+ * ## Throws
411
+ *
412
+ * The argument passed in the second array can't be empty:
413
+ * if an empty is provided, this method will throw.
414
+ *
415
+ * ## Examples
416
+ *
417
+ * ```ts
418
+ * // Select cars made by Ford or GM.
419
+ * db.select().from(cars)
420
+ * .where(inArray(cars.make, ['Ford', 'GM']))
421
+ * ```
422
+ *
423
+ * @see notInArray for the inverse of this test
424
+ */
425
+ inArray?: TValue[];
426
+ /**
427
+ * Test whether the first parameter, a column or expression,
428
+ * has a value that is not present in a list passed as the
429
+ * second argument.
430
+ *
431
+ * ## Throws
432
+ *
433
+ * The argument passed in the second array can't be empty:
434
+ * if an empty is provided, this method will throw.
435
+ *
436
+ * ## Examples
437
+ *
438
+ * ```ts
439
+ * // Select cars made by any company except Ford or GM.
440
+ * db.select().from(cars)
441
+ * .where(notInArray(cars.make, ['Ford', 'GM']))
442
+ * ```
443
+ *
444
+ * @see inArray for the inverse of this test
445
+ */
446
+ notInArray?: TValue[];
447
+ /**
448
+ * Test whether an expression is not NULL. By the SQL standard,
449
+ * NULL is neither equal nor not equal to itself, so
450
+ * it's recommended to use `isNull` and `notIsNull` for
451
+ * comparisons to NULL.
452
+ *
453
+ * ## Examples
454
+ *
455
+ * ```ts
456
+ * // Select cars that have been discontinued.
457
+ * db.select().from(cars)
458
+ * .where(isNotNull(cars.discontinuedAt))
459
+ * ```
460
+ *
461
+ * @see isNull for the inverse of this test
462
+ */
463
+ isNotNull?: true;
464
+ /**
465
+ * Test whether an expression is NULL. By the SQL standard,
466
+ * NULL is neither equal nor not equal to itself, so
467
+ * it's recommended to use `isNull` and `notIsNull` for
468
+ * comparisons to NULL.
469
+ *
470
+ * ## Examples
471
+ *
472
+ * ```ts
473
+ * // Select cars that have no discontinuedAt date.
474
+ * db.select().from(cars)
475
+ * .where(isNull(cars.discontinuedAt))
476
+ * ```
477
+ *
478
+ * @see isNotNull for the inverse of this test
479
+ */
480
+ isNull?: true;
481
+ /**
482
+ * Test whether an expression is between two values. This
483
+ * is an easier way to express range tests, which would be
484
+ * expressed mathematically as `x <= a <= y` but in SQL
485
+ * would have to be like `a >= x AND a <= y`.
486
+ *
487
+ * Between is inclusive of the endpoints: if `column`
488
+ * is equal to `min` or `max`, it will be TRUE.
489
+ *
490
+ * ## Examples
491
+ *
492
+ * ```ts
493
+ * // Select cars made between 1990 and 2000
494
+ * db.select().from(cars)
495
+ * .where(between(cars.year, 1990, 2000))
496
+ * ```
497
+ *
498
+ * @see notBetween for the inverse of this test
499
+ */
500
+ between?: [number, number];
501
+ /**
502
+ * Test whether an expression is not between two values.
503
+ *
504
+ * This, like `between`, includes its endpoints, so if
505
+ * the `column` is equal to `min` or `max`, in this case
506
+ * it will evaluate to FALSE.
507
+ *
508
+ * ## Examples
509
+ *
510
+ * ```ts
511
+ * // Exclude cars made in the 1970s
512
+ * db.select().from(cars)
513
+ * .where(notBetween(cars.year, 1970, 1979))
514
+ * ```
515
+ *
516
+ * @see between for the inverse of this test
517
+ */
518
+ notBetween?: [number, number];
519
+ /**
520
+ * Compare a column to a pattern, which can include `%` and `_`
521
+ * characters to match multiple variations. Including `%`
522
+ * in the pattern matches zero or more characters, and including
523
+ * `_` will match a single character.
524
+ *
525
+ * ## Examples
526
+ *
527
+ * ```ts
528
+ * // Select all cars with 'Turbo' in their names.
529
+ * db.select().from(cars)
530
+ * .where(like(cars.name, '%Turbo%'))
531
+ * ```
532
+ *
533
+ * @see ilike for a case-insensitive version of this condition
534
+ */
535
+ like?: string;
536
+ /**
537
+ * The inverse of like - this tests that a given column
538
+ * does not match a pattern, which can include `%` and `_`
539
+ * characters to match multiple variations. Including `%`
540
+ * in the pattern matches zero or more characters, and including
541
+ * `_` will match a single character.
542
+ *
543
+ * ## Examples
544
+ *
545
+ * ```ts
546
+ * // Select all cars that don't have "ROver" in their name.
547
+ * db.select().from(cars)
548
+ * .where(notLike(cars.name, '%Rover%'))
549
+ * ```
550
+ *
551
+ * @see like for the inverse condition
552
+ * @see notIlike for a case-insensitive version of this condition
553
+ */
554
+ notLike?: string;
555
+ /**
556
+ * Case-insensitively compare a column to a pattern,
557
+ * which can include `%` and `_`
558
+ * characters to match multiple variations. Including `%`
559
+ * in the pattern matches zero or more characters, and including
560
+ * `_` will match a single character.
561
+ *
562
+ * Unlike like, this performs a case-insensitive comparison.
563
+ *
564
+ * ## Examples
565
+ *
566
+ * ```ts
567
+ * // Select all cars with 'Turbo' in their names.
568
+ * db.select().from(cars)
569
+ * .where(ilike(cars.name, '%Turbo%'))
570
+ * ```
571
+ *
572
+ * @see like for a case-sensitive version of this condition
573
+ */
574
+ ilike?: string;
575
+ /**
576
+ * The inverse of ilike - this case-insensitively tests that a given column
577
+ * does not match a pattern, which can include `%` and `_`
578
+ * characters to match multiple variations. Including `%`
579
+ * in the pattern matches zero or more characters, and including
580
+ * `_` will match a single character.
581
+ *
582
+ * ## Examples
583
+ *
584
+ * ```ts
585
+ * // Select all cars that don't have "Rover" in their name.
586
+ * db.select().from(cars)
587
+ * .where(notLike(cars.name, '%Rover%'))
588
+ * ```
589
+ *
590
+ * @see ilike for the inverse condition
591
+ * @see notLike for a case-sensitive version of this condition
592
+ */
593
+ notIlike?: string;
594
+ /**
595
+ * Test that a column or expression contains all elements of
596
+ * the list passed as the second argument.
597
+ *
598
+ * ## Throws
599
+ *
600
+ * The argument passed in the second array can't be empty:
601
+ * if an empty is provided, this method will throw.
602
+ *
603
+ * ## Examples
604
+ *
605
+ * ```ts
606
+ * // Select posts where its tags contain "Typescript" and "ORM".
607
+ * db.select().from(posts)
608
+ * .where(arrayContains(posts.tags, ['Typescript', 'ORM']))
609
+ * ```
610
+ *
611
+ * @see arrayContained to find if an array contains all elements of a column or expression
612
+ * @see arrayOverlaps to find if a column or expression contains any elements of an array
613
+ */
614
+ arrayContains?: TValue;
615
+ /**
616
+ * Test that the list passed as the second argument contains
617
+ * all elements of a column or expression.
618
+ *
619
+ * ## Throws
620
+ *
621
+ * The argument passed in the second array can't be empty:
622
+ * if an empty is provided, this method will throw.
623
+ *
624
+ * ## Examples
625
+ *
626
+ * ```ts
627
+ * // Select posts where its tags contain "Typescript", "ORM" or both,
628
+ * // but filtering posts that have additional tags.
629
+ * db.select().from(posts)
630
+ * .where(arrayContained(posts.tags, ['Typescript', 'ORM']))
631
+ * ```
632
+ *
633
+ * @see arrayContains to find if a column or expression contains all elements of an array
634
+ * @see arrayOverlaps to find if a column or expression contains any elements of an array
635
+ */
636
+ arrayContained?: TValue;
637
+ /**
638
+ * Test that a column or expression contains any elements of
639
+ * the list passed as the second argument.
640
+ *
641
+ * ## Throws
642
+ *
643
+ * The argument passed in the second array can't be empty:
644
+ * if an empty is provided, this method will throw.
645
+ *
646
+ * ## Examples
647
+ *
648
+ * ```ts
649
+ * // Select posts where its tags contain "Typescript", "ORM" or both.
650
+ * db.select().from(posts)
651
+ * .where(arrayOverlaps(posts.tags, ['Typescript', 'ORM']))
652
+ * ```
653
+ *
654
+ * @see arrayContains to find if a column or expression contains all elements of an array
655
+ * @see arrayContained to find if an array contains all elements of a column or expression
656
+ */
657
+ arrayOverlaps?: TValue;
658
+ }
659
+ //#endregion
660
+ //#region src/interfaces/PgQueryWhere.d.ts
661
+ type PgQueryWhere<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = (PgQueryWhereOperators<T> & PgQueryWhereConditions<T>) | (PgQueryWhereRelations<Relations> & PgQueryWhereOperators<T> & PgQueryWhereConditions<T, Relations>);
662
+ type PgQueryWhereOrSQL<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = SQLWrapper | PgQueryWhere<T, Relations>;
663
+ type PgQueryWhereOperators<T extends TObject> = { [Key in keyof Static<T>]?: FilterOperators<Static<T>[Key]> | Static<T>[Key] | (Static<T>[Key] extends object ? NestedJsonbQuery<Static<T>[Key]> : never) };
664
+ type PgQueryWhereConditions<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = {
665
+ /**
666
+ * Combine a list of conditions with the `and` operator. Conditions
667
+ * that are equal `undefined` are automatically ignored.
668
+ *
669
+ * ## Examples
670
+ *
671
+ * ```ts
672
+ * db.select().from(cars)
673
+ * .where(
674
+ * and(
675
+ * eq(cars.make, 'Volvo'),
676
+ * eq(cars.year, 1950),
677
+ * )
678
+ * )
679
+ * ```
680
+ */
681
+ and?: Array<PgQueryWhereOrSQL<T, Relations>>;
682
+ /**
683
+ * Combine a list of conditions with the `or` operator. Conditions
684
+ * that are equal `undefined` are automatically ignored.
685
+ *
686
+ * ## Examples
687
+ *
688
+ * ```ts
689
+ * db.select().from(cars)
690
+ * .where(
691
+ * or(
692
+ * eq(cars.make, 'GM'),
693
+ * eq(cars.make, 'Ford'),
694
+ * )
695
+ * )
696
+ * ```
697
+ */
698
+ or?: Array<PgQueryWhereOrSQL<T, Relations>>;
699
+ /**
700
+ * Negate the meaning of an expression using the `not` keyword.
701
+ *
702
+ * ## Examples
703
+ *
704
+ * ```ts
705
+ * // Select cars _not_ made by GM or Ford.
706
+ * db.select().from(cars)
707
+ * .where(not(inArray(cars.make, ['GM', 'Ford'])))
708
+ * ```
709
+ */
710
+ not?: PgQueryWhereOrSQL<T, Relations>;
711
+ /**
712
+ * Test whether a subquery evaluates to have any rows.
713
+ *
714
+ * ## Examples
715
+ *
716
+ * ```ts
717
+ * // Users whose `homeCity` column has a match in a cities
718
+ * // table.
719
+ * db
720
+ * .select()
721
+ * .from(users)
722
+ * .where(
723
+ * exists(db.select()
724
+ * .from(cities)
725
+ * .where(eq(users.homeCity, cities.id))),
726
+ * );
727
+ * ```
728
+ *
729
+ * @see notExists for the inverse of this test
730
+ */
731
+ exists?: SQLWrapper;
732
+ };
733
+ type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined = undefined> = Relations extends PgRelationMap<TObject> ? { [K in keyof Relations]?: PgQueryWhere<Relations[K]["join"]["schema"], Relations[K]["with"]> } : {};
734
+ /**
735
+ * Recursively allow nested queries for JSONB object/array types
736
+ */
737
+ type NestedJsonbQuery<T> = T extends object ? T extends Array<infer U> ? U extends object ? { [K in keyof U]?: FilterOperators<U[K]> | U[K] } : FilterOperators<U> | U : { [K in keyof T]?: FilterOperators<T[K]> | T[K] | (T[K] extends object ? NestedJsonbQuery<T[K]> : never) } : FilterOperators<T> | T;
738
+ //#endregion
739
+ //#region src/interfaces/PgQuery.d.ts
740
+ /**
741
+ * Order direction for sorting
742
+ */
743
+ type OrderDirection = "asc" | "desc";
744
+ /**
745
+ * Single order by clause with column and direction
746
+ */
747
+ interface OrderByClause<T> {
748
+ column: keyof T;
749
+ direction?: OrderDirection;
750
+ }
751
+ /**
752
+ * Order by parameter - supports 3 modes:
753
+ * 1. String: orderBy: "name" (defaults to ASC)
754
+ * 2. Single object: orderBy: { column: "name", direction: "desc" }
755
+ * 3. Array: orderBy: [{ column: "name", direction: "asc" }, { column: "age", direction: "desc" }]
756
+ */
757
+ type OrderBy<T> = keyof T | OrderByClause<T> | Array<OrderByClause<T>>;
758
+ /**
759
+ * Generic query interface for PostgreSQL entities
760
+ */
761
+ interface PgQuery<T extends TObject = TObject> {
762
+ distinct?: (keyof Static<T>)[];
763
+ columns?: (keyof Static<T>)[];
764
+ where?: PgQueryWhereOrSQL<T>;
765
+ limit?: number;
766
+ offset?: number;
767
+ orderBy?: OrderBy<Static<T>>;
768
+ groupBy?: (keyof Static<T>)[];
769
+ }
770
+ type PgStatic<T extends TObject, Relations extends PgRelationMap<T>> = Static<T> & { [K in keyof Relations]: Static<Relations[K]["join"]["schema"]> & (Relations[K]["with"] extends PgRelationMap<TObject> ? PgStatic<Relations[K]["join"]["schema"], Relations[K]["with"]> : {}) };
771
+ interface PgQueryRelations<T extends TObject = TObject, Relations extends PgRelationMap<T> | undefined = undefined> extends PgQuery<T> {
772
+ with?: Relations;
773
+ where?: PgQueryWhereOrSQL<T, Relations>;
774
+ }
775
+ type PgRelationMap<Base extends TObject> = Record<string, PgRelation<Base>>;
776
+ type PgRelation<Base extends TObject> = {
777
+ type?: "left" | "inner" | "right";
778
+ join: {
779
+ schema: TObject;
780
+ name: string;
781
+ };
782
+ on: SQLWrapper | [keyof Static<Base>, {
783
+ name: string;
784
+ }];
785
+ with?: PgRelationMap<TObject>;
786
+ };
787
+ //#endregion
788
+ //#region src/descriptors/$sequence.d.ts
789
+ /**
790
+ * Creates a PostgreSQL sequence descriptor for generating unique numeric values.
791
+ */
792
+ declare const $sequence: {
793
+ (options?: SequenceDescriptorOptions): SequenceDescriptor;
794
+ [KIND]: typeof SequenceDescriptor;
795
+ };
796
+ interface SequenceDescriptorOptions extends PgSequenceOptions {
797
+ /**
798
+ * The name of the sequence. If not provided, the property key will be used.
799
+ */
800
+ name?: string;
801
+ provider?: DatabaseProvider;
802
+ }
803
+ declare class SequenceDescriptor extends Descriptor<SequenceDescriptorOptions> {
804
+ readonly provider: DatabaseProvider;
805
+ onInit(): void;
806
+ get name(): string;
807
+ next(): Promise<number>;
808
+ current(): Promise<number>;
809
+ protected $provider(): DatabaseProvider;
810
+ }
811
+ //#endregion
812
+ //#region src/services/ModelBuilder.d.ts
813
+ /**
814
+ * Database-specific table configuration functions
815
+ */
816
+ interface TableConfigBuilders<TConfig> {
817
+ index: (name: string) => {
818
+ on: (...columns: any[]) => TConfig;
819
+ };
820
+ uniqueIndex: (name: string) => {
821
+ on: (...columns: any[]) => TConfig;
822
+ };
823
+ unique: (name: string) => {
824
+ on: (...columns: any[]) => TConfig;
825
+ };
826
+ check: (name: string, sql: SQL) => TConfig;
827
+ foreignKey: (config: {
828
+ name: string;
829
+ columns: any[];
830
+ foreignColumns: any[];
831
+ }) => TConfig;
832
+ }
833
+ /**
834
+ * Abstract base class for transforming Alepha Descriptors (Entity, Sequence, etc...)
835
+ * into drizzle models (tables, enums, sequences, etc...).
836
+ */
837
+ declare abstract class ModelBuilder {
838
+ /**
839
+ * Build a table from an entity descriptor.
840
+ */
841
+ abstract buildTable(entity: EntityDescriptor, options: {
842
+ tables: Map<string, unknown>;
843
+ enums: Map<string, unknown>;
844
+ schema: string;
845
+ }): void;
846
+ /**
847
+ * Build a sequence from a sequence descriptor.
848
+ */
849
+ abstract buildSequence(sequence: SequenceDescriptor, options: {
850
+ sequences: Map<string, unknown>;
851
+ schema: string;
852
+ }): void;
853
+ /**
854
+ * Convert camelCase to snake_case for column names.
855
+ */
856
+ protected toColumnName(str: string): string;
857
+ /**
858
+ * Build the table configuration function for any database.
859
+ * This includes indexes, foreign keys, constraints, and custom config.
860
+ *
861
+ * @param entity - The entity descriptor
862
+ * @param builders - Database-specific builder functions
863
+ * @param tableResolver - Function to resolve entity references to table columns
864
+ * @param customConfigHandler - Optional handler for custom config
865
+ */
866
+ protected buildTableConfig<TConfig, TSelf>(entity: EntityDescriptor, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
867
+ }
868
+ //#endregion
869
+ //#region src/providers/DrizzleKitProvider.d.ts
870
+ declare class DrizzleKitProvider {
871
+ protected readonly log: _alepha_logger0.Logger;
872
+ protected readonly alepha: Alepha;
873
+ /**
874
+ * Synchronize database with current schema definitions.
875
+ *
876
+ * In development mode, it will generate and execute migrations based on the current state.
877
+ * In testing mode, it will generate migrations from scratch without applying them.
878
+ *
879
+ * Does nothing in production mode, you must handle migrations manually.
880
+ */
881
+ synchronize(provider: DatabaseProvider): Promise<void>;
882
+ /**
883
+ * Mostly used for testing purposes. You can generate SQL migration statements without executing them.
884
+ */
885
+ generateMigration(provider: DatabaseProvider, prevSnapshot?: any): Promise<{
886
+ statements: string[];
887
+ models: Record<string, unknown>;
888
+ snapshot?: any;
889
+ }>;
890
+ /**
891
+ * Load all tables, enums, sequences, etc. from the provider's repositories.
892
+ */
893
+ getModels(provider: DatabaseProvider): Record<string, unknown>;
894
+ /**
895
+ * Load the migration snapshot from the database.
896
+ */
897
+ protected loadDevMigrations(provider: DatabaseProvider): Promise<DevMigrations | undefined>;
898
+ protected saveDevMigrations(provider: DatabaseProvider, curr: Record<string, any>, devMigrations?: DevMigrations): Promise<void>;
899
+ protected executeStatements(statements: string[], provider: DatabaseProvider, catchErrors?: boolean): Promise<void>;
900
+ protected createSchemaIfNotExists(provider: DatabaseProvider, schemaName: string): Promise<void>;
901
+ /**
902
+ * Try to load the official Drizzle Kit API.
903
+ * If not available, fallback to the local kit import.
904
+ */
905
+ protected importDrizzleKit(): typeof DrizzleKit;
906
+ }
907
+ declare const devMigrationsSchema: typebox1.TObject<{
908
+ id: typebox1.TNumber;
909
+ name: typebox1.TString;
910
+ snapshot: typebox1.TString;
911
+ created_at: typebox1.TString;
912
+ }>;
913
+ type DevMigrations = Static<typeof devMigrationsSchema>;
914
+ //#endregion
915
+ //#region src/providers/drivers/DatabaseProvider.d.ts
916
+ type SQLLike = SQLWrapper | string;
917
+ declare abstract class DatabaseProvider {
918
+ protected readonly alepha: Alepha;
919
+ protected readonly log: _alepha_logger0.Logger;
920
+ protected abstract readonly builder: ModelBuilder;
921
+ protected abstract readonly kit: DrizzleKitProvider;
922
+ abstract readonly db: PgDatabase<any>;
923
+ abstract readonly dialect: "postgresql" | "sqlite";
924
+ readonly enums: Map<string, unknown>;
925
+ readonly tables: Map<string, unknown>;
926
+ readonly sequences: Map<string, unknown>;
927
+ get name(): string;
928
+ get schema(): string;
929
+ table<T extends TObject>(entity: EntityDescriptor<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
930
+ registerEntity(entity: EntityDescriptor): void;
931
+ registerSequence(sequence: SequenceDescriptor): void;
932
+ abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
933
+ run<T extends TObject>(statement: SQLLike, schema: T): Promise<Array<Static<T>>>;
934
+ /**
935
+ * Get migrations folder path - can be overridden
936
+ */
937
+ protected getMigrationsFolder(): string;
938
+ /**
939
+ * Base migration orchestration - handles environment logic
940
+ */
941
+ protected migrateDatabase(): Promise<void>;
942
+ /**
943
+ * Production: run migrations from folder
944
+ */
945
+ protected runProductionMigration(migrationsFolder: string): Promise<void>;
946
+ /**
947
+ * Test: always synchronize
948
+ */
949
+ protected runTestMigration(): Promise<void>;
950
+ /**
951
+ * Development: default to synchronize (can be overridden)
952
+ */
953
+ protected runDevelopmentMigration(migrationsFolder: string): Promise<void>;
954
+ /**
955
+ * Common synchronization with error handling
956
+ */
957
+ protected synchronizeSchema(): Promise<void>;
958
+ /**
959
+ * Provider-specific migration execution
960
+ * MUST be implemented by each provider
961
+ */
962
+ protected abstract executeMigrations(migrationsFolder: string): Promise<void>;
963
+ }
964
+ //#endregion
965
+ //#region src/services/PgJsonQueryManager.d.ts
966
+ /**
967
+ * Manages JSONB query generation for nested object and array queries in PostgreSQL.
968
+ * This class handles complex nested queries using PostgreSQL's JSONB operators.
969
+ */
970
+ declare class PgJsonQueryManager {
971
+ /**
972
+ * Check if a query contains nested JSONB queries.
973
+ * A nested query is when the value is an object with operator keys.
974
+ */
975
+ hasNestedQuery(where: PgQueryWhere<TObject>): boolean;
976
+ /**
977
+ * Build a JSONB query condition for nested object queries.
978
+ * Supports deep nesting like: { profile: { contact: { email: { eq: "test@example.com" } } } }
979
+ *
980
+ * @param column The JSONB column
981
+ * @param path The path to the nested property (e.g., ['profile', 'contact', 'email'])
982
+ * @param operator The filter operator (e.g., { eq: "test@example.com" })
983
+ * @param dialect Database dialect (postgresql or sqlite)
984
+ * @param columnSchema Optional schema of the JSON column for type inference
985
+ * @returns SQL condition
986
+ */
987
+ buildJsonbCondition(column: PgColumn, path: string[], operator: FilterOperators<any>, dialect: "postgresql" | "sqlite", columnSchema?: any): SQL | undefined;
988
+ /**
989
+ * Build JSONB array query conditions.
990
+ * Supports queries like: { addresses: { city: { eq: "Wonderland" } } }
991
+ * which translates to: EXISTS (SELECT 1 FROM jsonb_array_elements(addresses) elem WHERE elem->>'city' = 'Wonderland')
992
+ *
993
+ * @param dialect Database dialect (postgresql or sqlite)
994
+ * Note: SQLite array queries are not yet supported
995
+ */
996
+ buildJsonbArrayCondition(column: PgColumn, path: string[], arrayPath: string, operator: FilterOperators<any>, dialect: "postgresql" | "sqlite"): SQL | undefined;
997
+ /**
998
+ * Apply a filter operator to a JSONB value.
999
+ * @param dialect Database dialect for appropriate casting syntax
1000
+ * @param fieldType Optional field type from schema for smart casting
1001
+ */
1002
+ private applyOperatorToJsonValue;
1003
+ /**
1004
+ * Parse a nested query object and extract the path and operator.
1005
+ * For example: { profile: { contact: { email: { eq: "test@example.com" } } } }
1006
+ * Returns: { path: ['profile', 'contact', 'email'], operator: { eq: "test@example.com" } }
1007
+ */
1008
+ parseNestedQuery(nestedQuery: any, currentPath?: string[]): Array<{
1009
+ path: string[];
1010
+ operator: FilterOperators<any>;
1011
+ }>;
1012
+ /**
1013
+ * Determine if a property is a JSONB column based on the schema.
1014
+ * A column is JSONB if it's defined as an object or array in the TypeBox schema.
1015
+ */
1016
+ isJsonbColumn(schema: TObject, columnName: string): boolean;
1017
+ /**
1018
+ * Check if an array property contains primitive types (string, number, boolean, etc.)
1019
+ * rather than objects. Primitive arrays should use native Drizzle operators.
1020
+ * @returns true if the array contains primitives, false if it contains objects
1021
+ */
1022
+ isPrimitiveArray(schema: TObject, columnName: string): boolean;
1023
+ /**
1024
+ * Get the type of a field by navigating through a schema path.
1025
+ * Used for smart type casting in SQL queries.
1026
+ *
1027
+ * @param columnSchema The schema of the JSON column (e.g., t.object({ age: t.int() }))
1028
+ * @param path The path to navigate (e.g., ['contact', 'email'])
1029
+ * @returns The type string (e.g., 'integer', 'number', 'string') or undefined if not found
1030
+ */
1031
+ private getFieldType;
1032
+ /**
1033
+ * Check if a nested path points to an array property.
1034
+ */
1035
+ isArrayProperty(schema: TObject, path: string[]): boolean;
1036
+ }
1037
+ //#endregion
1038
+ //#region src/services/QueryManager.d.ts
1039
+ declare class QueryManager {
1040
+ protected readonly jsonQueryManager: PgJsonQueryManager;
1041
+ protected readonly alepha: Alepha;
1042
+ /**
1043
+ * Convert a query object to a SQL query.
1044
+ */
1045
+ toSQL(query: PgQueryWhereOrSQL<TObject>, options: {
1046
+ schema: TObject;
1047
+ col: (key: string) => PgColumn;
1048
+ joins?: PgJoin[];
1049
+ dialect: "postgresql" | "sqlite";
1050
+ }): SQL | undefined;
1051
+ /**
1052
+ * Build a JSONB query for nested object/array queries.
1053
+ */
1054
+ protected buildJsonbQuery(column: PgColumn, nestedQuery: any, schema: TObject, columnName: string, dialect: "postgresql" | "sqlite"): SQL | undefined;
1055
+ /**
1056
+ * Check if an object has any filter operator properties.
1057
+ */
1058
+ protected hasFilterOperatorProperties(obj: any): boolean;
1059
+ /**
1060
+ * Map a filter operator to a SQL query.
1061
+ */
1062
+ mapOperatorToSql(operator: FilterOperators<any> | any, column: PgColumn, columnSchema?: TObject, columnName?: string): SQL | undefined;
1063
+ /**
1064
+ * Parse pagination sort string to orderBy format.
1065
+ * Format: "firstName,-lastName" -> [{ column: "firstName", direction: "asc" }, { column: "lastName", direction: "desc" }]
1066
+ * - Columns separated by comma
1067
+ * - Prefix with '-' for DESC direction
1068
+ *
1069
+ * @param sort Pagination sort string
1070
+ * @returns OrderBy array or single object
1071
+ */
1072
+ parsePaginationSort(sort: string): Array<{
1073
+ column: string;
1074
+ direction: "asc" | "desc";
1075
+ }> | {
1076
+ column: string;
1077
+ direction: "asc" | "desc";
1078
+ };
1079
+ /**
1080
+ * Normalize orderBy parameter to array format.
1081
+ * Supports 3 modes:
1082
+ * 1. String: "name" -> [{ column: "name", direction: "asc" }]
1083
+ * 2. Object: { column: "name", direction: "desc" } -> [{ column: "name", direction: "desc" }]
1084
+ * 3. Array: [{ column: "name" }, { column: "age", direction: "desc" }] -> normalized array
1085
+ *
1086
+ * @param orderBy The orderBy parameter
1087
+ * @returns Normalized array of order by clauses
1088
+ */
1089
+ normalizeOrderBy(orderBy: any): Array<{
1090
+ column: string;
1091
+ direction: "asc" | "desc";
1092
+ }>;
1093
+ /**
1094
+ * Create a pagination object.
1095
+ *
1096
+ * @deprecated Use `createPagination` from @alepha/core instead.
1097
+ * This method now delegates to the framework-level helper.
1098
+ *
1099
+ * @param entities The entities to paginate.
1100
+ * @param limit The limit of the pagination.
1101
+ * @param offset The offset of the pagination.
1102
+ * @param sort Optional sort metadata to include in response.
1103
+ */
1104
+ createPagination<T>(entities: T[], limit?: number, offset?: number, sort?: Array<{
1105
+ column: string;
1106
+ direction: "asc" | "desc";
1107
+ }>): _alepha_core10.Page<T>;
1108
+ }
1109
+ interface PgJoin {
1110
+ table: string;
1111
+ schema: TObject;
1112
+ key: string;
1113
+ col: (key: string) => PgColumn;
1114
+ parent?: string;
1115
+ }
1116
+ //#endregion
1117
+ //#region src/services/PgRelationManager.d.ts
1118
+ declare class PgRelationManager {
1119
+ /**
1120
+ * Recursively build joins for the query builder based on the relations map
1121
+ */
1122
+ buildJoins(provider: DatabaseProvider, builder: PgSelectBase<any, any, any>, joins: Array<PgJoin>, withRelations: PgRelationMap<TObject>, table: PgTableWithColumns<any>, parentKey?: string): void;
1123
+ /**
1124
+ * Map a row with its joined relations based on the joins definition
1125
+ */
1126
+ mapRowWithJoins(record: Record<string, unknown>, row: Record<string, unknown>, schema: TObject, joins: PgJoin[], parentKey?: string): Record<string, unknown>;
1127
+ /**
1128
+ * Check if all values in an object are null (indicates a left join with no match)
1129
+ */
1130
+ private isAllNull;
1131
+ /**
1132
+ * Build a schema that includes all join properties recursively
1133
+ */
1134
+ buildSchemaWithJoins(baseSchema: TObject, joins: PgJoin[], parentPath?: string): TObject;
1135
+ }
1136
+ //#endregion
1137
+ //#region src/services/Repository.d.ts
1138
+ declare abstract class Repository<T extends TObject> {
1139
+ readonly entity: EntityDescriptor<T>;
1140
+ readonly provider: DatabaseProvider;
1141
+ protected readonly relationManager: PgRelationManager;
1142
+ protected readonly queryManager: QueryManager;
1143
+ protected readonly dateTimeProvider: DateTimeProvider;
1144
+ protected readonly alepha: Alepha;
1145
+ constructor(entity: EntityDescriptor<T>, provider?: typeof DatabaseProvider);
1146
+ /**
1147
+ * Represents the primary key of the table.
1148
+ * - Key is the name of the primary key column.
1149
+ * - Type is the type (TypeBox) of the primary key column.
1150
+ *
1151
+ * ID is mandatory. If the table does not have a primary key, it will throw an error.
1152
+ */
1153
+ get id(): {
1154
+ type: TSchema;
1155
+ key: keyof T["properties"];
1156
+ col: PgColumn;
1157
+ };
1158
+ /**
1159
+ * Get Drizzle table object.
1160
+ */
1161
+ get table(): PgTableWithColumns<SchemaToTableConfig<T>>;
1162
+ /**
1163
+ * Get SQL table name. (from Drizzle table object)
1164
+ */
1165
+ get tableName(): string;
1166
+ /**
1167
+ * Getter for the database connection from the database provider.
1168
+ */
1169
+ protected get db(): PgDatabase<any>;
1170
+ /**
1171
+ * Execute a SQL query.
1172
+ *
1173
+ * This method allows executing raw SQL queries against the database.
1174
+ * This is by far the easiest way to run custom queries that are not covered by the repository's built-in methods!
1175
+ *
1176
+ * You must use the `sql` tagged template function from Drizzle ORM to create the query. https://orm.drizzle.team/docs/sql
1177
+ *
1178
+ * @example
1179
+ * ```ts
1180
+ * class App {
1181
+ * repository = $repository({ ... });
1182
+ * async getAdults() {
1183
+ * const users = repository.table; // Drizzle table object
1184
+ * await repository.query(sql`SELECT * FROM ${users} WHERE ${users.age} > ${18}`);
1185
+ * // or better
1186
+ * await repository.query((users) => sql`SELECT * FROM ${users} WHERE ${users.age} > ${18}`);
1187
+ * }
1188
+ * }
1189
+ * ```
1190
+ */
1191
+ query<R extends TObject = T>(query: SQLLike | ((table: PgTableWithColumns<SchemaToTableConfig<T>>, db: PgDatabase<any>) => SQLLike), schema?: R): Promise<Static<R>[]>;
1192
+ /**
1193
+ * Map raw database fields to entity fields. (handles column name differences)
1194
+ */
1195
+ protected mapRawFieldsToEntity(row: Record<string, unknown>): any;
1196
+ /**
1197
+ * Get a Drizzle column from the table by his name.
1198
+ */
1199
+ protected col(name: keyof StaticEncode<T>): PgColumn;
1200
+ /**
1201
+ * Run a transaction.
1202
+ */
1203
+ transaction<T>(transaction: (tx: PgTransaction<any, Record<string, any>, any>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
1204
+ /**
1205
+ * Start a SELECT query on the table.
1206
+ */
1207
+ protected select(opts?: StatementOptions): drizzle_orm_pg_core0.PgSelectBase<string, Record<string, PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
1208
+ [x: string]: unknown;
1209
+ }[], {
1210
+ [x: string]: PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>;
1211
+ }>;
1212
+ /**
1213
+ * Start a SELECT DISTINCT query on the table.
1214
+ */
1215
+ protected selectDistinct(opts?: StatementOptions, columns?: (keyof Static<T>)[]): drizzle_orm_pg_core0.PgSelectBase<string, Record<string, any>, "partial", Record<string, "not-null">, false, never, {
1216
+ [x: string]: any;
1217
+ }[], {
1218
+ [x: string]: any;
1219
+ }>;
1220
+ /**
1221
+ * Start an INSERT query on the table.
1222
+ */
1223
+ protected insert(opts?: StatementOptions): drizzle_orm_pg_core0.PgInsertBuilder<PgTableWithColumns<SchemaToTableConfig<T>>, any, false>;
1224
+ /**
1225
+ * Start an UPDATE query on the table.
1226
+ */
1227
+ protected update(opts?: StatementOptions): drizzle_orm_pg_core0.PgUpdateBuilder<PgTableWithColumns<SchemaToTableConfig<T>>, any>;
1228
+ /**
1229
+ * Start a DELETE query on the table.
1230
+ */
1231
+ protected delete(opts?: StatementOptions): drizzle_orm_pg_core0.PgDeleteBase<PgTableWithColumns<SchemaToTableConfig<T>>, any, undefined, undefined, false, never>;
1232
+ /**
1233
+ * Create a Drizzle `select` query based on a JSON query object.
1234
+ *
1235
+ * > This method is the base for `find`, `findOne`, `findById`, and `paginate`.
1236
+ */
1237
+ find<R extends PgRelationMap<T>>(query?: PgQueryRelations<T, R>, opts?: StatementOptions): Promise<PgStatic<T, R>[]>;
1238
+ /**
1239
+ * Find a single entity.
1240
+ */
1241
+ findOne<R extends PgRelationMap<T>>(query: Pick<PgQueryRelations<T, R>, "with" | "where">, opts?: StatementOptions): Promise<PgStatic<T, R>>;
1242
+ /**
1243
+ * Find entities with pagination.
1244
+ *
1245
+ * It uses the same parameters as `find()`, but adds pagination metadata to the response.
1246
+ *
1247
+ * > Pagination CAN also do a count query to get the total number of elements.
1248
+ */
1249
+ paginate<R extends PgRelationMap<T>>(pagination?: PageQuery$1, query?: PgQueryRelations<T, R>, opts?: StatementOptions & {
1250
+ count?: boolean;
1251
+ }): Promise<Page$1<PgStatic<T, R>>>;
1252
+ /**
1253
+ * Find an entity by ID.
1254
+ *
1255
+ * This is a convenience method for `findOne` with a where clause on the primary key.
1256
+ * If you need more complex queries, use `findOne` instead.
1257
+ */
1258
+ findById(id: string | number, opts?: StatementOptions): Promise<Static<T>>;
1259
+ /**
1260
+ * Helper to create a type-safe query object.
1261
+ */
1262
+ createQuery(): PgQuery<T>;
1263
+ /**
1264
+ * Helper to create a type-safe where clause.
1265
+ */
1266
+ createQueryWhere(): PgQueryWhere<T>;
1267
+ /**
1268
+ * Create an entity.
1269
+ *
1270
+ * @param data The entity to create.
1271
+ * @param opts The options for creating the entity.
1272
+ * @returns The ID of the created entity.
1273
+ */
1274
+ create(data: Static<TObjectInsert<T>>, opts?: StatementOptions): Promise<Static<T>>;
1275
+ /**
1276
+ * Create many entities.
1277
+ *
1278
+ * @param values The entities to create.
1279
+ * @param opts The statement options.
1280
+ * @returns The created entities.
1281
+ */
1282
+ createMany(values: Array<Static<TObjectInsert<T>>>, opts?: StatementOptions): Promise<Static<T>[]>;
1283
+ /**
1284
+ * Find an entity and update it.
1285
+ */
1286
+ updateOne(where: PgQueryWhereOrSQL<T>, data: Partial<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Static<T>>;
1287
+ /**
1288
+ * Save a given entity.
1289
+ *
1290
+ * @example
1291
+ * ```ts
1292
+ * const entity = await repository.findById(1);
1293
+ * entity.name = "New Name"; // update a field
1294
+ * delete entity.description; // delete a field
1295
+ * await repository.save(entity);
1296
+ * ```
1297
+ *
1298
+ * Difference with `updateById/updateOne`:
1299
+ *
1300
+ * - requires the entity to be fetched first (whole object is expected)
1301
+ * - check pg.version() if present -> optimistic locking
1302
+ * - validate entity against schema
1303
+ * - undefined values will be set to null, not ignored!
1304
+ *
1305
+ * @see {@link PostgresTypeProvider#version}
1306
+ * @see {@link PgVersionMismatchError}
1307
+ */
1308
+ save(entity: Static<T>, opts?: StatementOptions): Promise<void>;
1309
+ /**
1310
+ * Find an entity by ID and update it.
1311
+ */
1312
+ updateById(id: string | number, data: Partial<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Static<T>>;
1313
+ /**
1314
+ * Find many entities and update all of them.
1315
+ */
1316
+ updateMany(where: PgQueryWhereOrSQL<T>, data: Partial<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Array<number | string>>;
1317
+ /**
1318
+ * Find many and delete all of them.
1319
+ * @returns Array of deleted entity IDs
1320
+ */
1321
+ deleteMany(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<Array<number | string>>;
1322
+ /**
1323
+ * Delete all entities.
1324
+ * @returns Array of deleted entity IDs
1325
+ */
1326
+ clear(opts?: StatementOptions): Promise<Array<number | string>>;
1327
+ /**
1328
+ * Delete the given entity.
1329
+ *
1330
+ * You must fetch the entity first in order to delete it.
1331
+ * @returns Array containing the deleted entity ID
1332
+ */
1333
+ destroy(entity: Static<T>, opts?: StatementOptions): Promise<Array<number | string>>;
1334
+ /**
1335
+ * Find an entity and delete it.
1336
+ * @returns Array of deleted entity IDs (should contain at most one ID)
1337
+ */
1338
+ deleteOne(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<Array<number | string>>;
1339
+ /**
1340
+ * Find an entity by ID and delete it.
1341
+ * @returns Array containing the deleted entity ID
1342
+ * @throws PgEntityNotFoundError if the entity is not found
1343
+ */
1344
+ deleteById(id: string | number, opts?: StatementOptions): Promise<Array<number | string>>;
1345
+ /**
1346
+ * Count entities.
1347
+ */
1348
+ count(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<number>;
1349
+ protected conflictMessagePattern: string;
1350
+ protected handleError(error: unknown, message: string): DbError;
1351
+ protected withDeletedAt(where: PgQueryWhereOrSQL<T>, opts?: {
1352
+ force?: boolean;
1353
+ }): PgQueryWhereOrSQL<T>;
1354
+ protected deletedAt(): PgAttrField | undefined;
1355
+ /**
1356
+ * Convert something to valid Pg Insert Value.
1357
+ */
1358
+ protected cast(data: any, insert: boolean): PgInsertValue<PgTableWithColumns<SchemaToTableConfig<T>>>;
1359
+ /**
1360
+ * Transform a row from the database into a clean entity.
1361
+ *
1362
+ * - Validate against schema
1363
+ * - Replace all null values by undefined
1364
+ * - Fix date-time and date fields to ISO strings
1365
+ * - Cast BigInt to string
1366
+ */
1367
+ protected clean<T extends TObject>(row: Record<string, unknown>, schema: T): Static<T>;
1368
+ /**
1369
+ * Clean a row with joins recursively
1370
+ */
1371
+ protected cleanWithJoins<T extends TObject>(row: Record<string, unknown>, schema: T, joins: PgJoin[], parentPath?: string): Static<T>;
1372
+ /**
1373
+ * Convert a where clause to SQL.
1374
+ */
1375
+ protected toSQL(where: PgQueryWhereOrSQL<T>, joins?: PgJoin[]): SQL | undefined;
1376
+ /**
1377
+ * Get the where clause for an ID.
1378
+ *
1379
+ * @param id The ID to get the where clause for.
1380
+ * @returns The where clause for the ID.
1381
+ */
1382
+ protected getWhereId(id: string | number): PgQueryWhere<T>;
1383
+ /**
1384
+ * Find a primary key in the schema.
1385
+ */
1386
+ protected getPrimaryKey(schema: TObject): {
1387
+ key: string;
1388
+ col: PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>;
1389
+ type: TSchema;
1390
+ };
1391
+ }
1392
+ /**
1393
+ * The options for a statement.
1394
+ */
1395
+ interface StatementOptions {
1396
+ /**
1397
+ * Transaction to use.
1398
+ */
1399
+ tx?: PgTransaction<any, Record<string, any>>;
1400
+ /**
1401
+ * Lock strength.
1402
+ */
1403
+ for?: LockStrength | {
1404
+ config: LockConfig;
1405
+ strength: LockStrength;
1406
+ };
1407
+ /**
1408
+ * If true, ignore soft delete.
1409
+ */
1410
+ force?: boolean;
1411
+ /**
1412
+ * Force the current time.
1413
+ */
1414
+ now?: DateTime;
1415
+ }
1416
+ //#endregion
1417
+ //#region src/descriptors/$repository.d.ts
1418
+ /**
1419
+ * Get the repository for the given entity.
1420
+ */
1421
+ declare const $repository: <T extends TObject>(entity: EntityDescriptor<T>) => Repository<T>;
1422
+ //#endregion
1423
+ //#region src/descriptors/$transaction.d.ts
1424
+ /**
1425
+ * Creates a transaction descriptor for database operations requiring atomicity and consistency.
1426
+ *
1427
+ * This descriptor provides a convenient way to wrap database operations in PostgreSQL
1428
+ * transactions, ensuring ACID properties and automatic retry logic for version conflicts.
1429
+ * It integrates seamlessly with the repository pattern and provides built-in handling
1430
+ * for optimistic locking scenarios with automatic retry on version mismatches.
1431
+ *
1432
+ * **Important Notes**:
1433
+ * - All operations within the transaction handler are atomic
1434
+ * - Automatic retry on `PgVersionMismatchError` for optimistic locking
1435
+ * - Pass `{ tx }` option to all repository operations within the transaction
1436
+ * - Transactions are automatically rolled back on any unhandled error
1437
+ * - Use appropriate isolation levels based on your consistency requirements
1438
+ */
1439
+ declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry0.RetryDescriptorFn<(...args: T) => Promise<R>>;
1440
+ interface TransactionDescriptorOptions<T extends any[], R> {
1441
+ /**
1442
+ * Transaction handler function that contains all database operations to be executed atomically.
1443
+ *
1444
+ * This function:
1445
+ * - Receives a transaction object as the first parameter
1446
+ * - Should pass the transaction to all repository operations via `{ tx }` option
1447
+ * - All operations within are automatically rolled back if any error occurs
1448
+ * - Has access to the full Alepha dependency injection container
1449
+ * - Will be automatically retried if a `PgVersionMismatchError` occurs
1450
+ *
1451
+ * **Transaction Guidelines**:
1452
+ * - Keep transactions as short as possible to minimize lock contention
1453
+ * - Always pass the `tx` parameter to repository operations
1454
+ * - Handle expected business errors gracefully
1455
+ * - Log important operations for debugging and audit trails
1456
+ * - Consider the impact of long-running transactions on performance
1457
+ *
1458
+ * **Error Handling**:
1459
+ * - Throwing any error will automatically roll back the transaction
1460
+ * - `PgVersionMismatchError` triggers automatic retry logic
1461
+ * - Other database errors will be propagated after rollback
1462
+ * - Use try-catch within the handler for business-specific error handling
1463
+ *
1464
+ * @param tx - The PostgreSQL transaction object to use for all database operations
1465
+ * @param ...args - Additional arguments passed to the transaction function
1466
+ * @returns Promise resolving to the transaction result
1467
+ *
1468
+ * @example
1469
+ * ```ts
1470
+ * handler: async (tx, orderId: string, newStatus: string) => {
1471
+ * // Get the current order (with transaction)
1472
+ * const order = await this.orders.findById(orderId, { tx });
1473
+ *
1474
+ * // Validate business rules
1475
+ * if (!this.isValidStatusTransition(order.status, newStatus)) {
1476
+ * throw new Error(`Invalid status transition: ${order.status} -> ${newStatus}`);
1477
+ * }
1478
+ *
1479
+ * // Update order status (with transaction)
1480
+ * const updatedOrder = await this.orders.updateById(
1481
+ * orderId,
1482
+ * { status: newStatus },
1483
+ * { tx }
1484
+ * );
1485
+ *
1486
+ * // Create audit log (with transaction)
1487
+ * await this.auditLogs.create({
1488
+ * id: generateUUID(),
1489
+ * entityId: orderId,
1490
+ * action: 'status_change',
1491
+ * oldValue: order.status,
1492
+ * newValue: newStatus,
1493
+ * timestamp: new Date().toISOString()
1494
+ * }, { tx });
1495
+ *
1496
+ * return updatedOrder;
1497
+ * }
1498
+ * ```
1499
+ */
1500
+ handler: (tx: PgTransaction<any, any, any>, ...args: T) => Promise<R>;
1501
+ /**
1502
+ * PostgreSQL transaction configuration options.
1503
+ *
1504
+ * This allows you to customize transaction behavior including:
1505
+ * - **Isolation Level**: Controls visibility of concurrent transaction changes
1506
+ * - **Access Mode**: Whether the transaction is read-only or read-write
1507
+ * - **Deferrable**: For serializable transactions, allows deferring to avoid conflicts
1508
+ *
1509
+ * **Isolation Levels**:
1510
+ * - **read_uncommitted**: Lowest isolation, allows dirty reads (rarely used)
1511
+ * - **read_committed**: Default level, prevents dirty reads
1512
+ * - **repeatable_read**: Prevents dirty and non-repeatable reads
1513
+ * - **serializable**: Highest isolation, full ACID compliance
1514
+ *
1515
+ * **Access Modes**:
1516
+ * - **read_write**: Default, allows both read and write operations
1517
+ * - **read_only**: Only allows read operations, can provide performance benefits
1518
+ *
1519
+ * **When to Use Different Isolation Levels**:
1520
+ * - **read_committed**: Most common operations, good balance of consistency and performance
1521
+ * - **repeatable_read**: When you need consistent reads throughout the transaction
1522
+ * - **serializable**: Critical financial operations, when absolute consistency is required
1523
+ *
1524
+ * @example
1525
+ * ```ts
1526
+ * config: {
1527
+ * isolationLevel: 'serializable', // Highest consistency for financial operations
1528
+ * accessMode: 'read_write'
1529
+ * }
1530
+ * ```
1531
+ *
1532
+ * @example
1533
+ * ```ts
1534
+ * config: {
1535
+ * isolationLevel: 'read_committed', // Default level for most operations
1536
+ * accessMode: 'read_only' // Performance optimization for read-only operations
1537
+ * }
1538
+ * ```
1539
+ */
1540
+ config?: PgTransactionConfig;
1541
+ }
1542
+ type TransactionContext = PgTransaction<any, any, any>;
1543
+ //#endregion
1544
+ //#region src/errors/PgConflictError.d.ts
1545
+ declare class PgConflictError extends DbError {
1546
+ readonly name = "PgConflictError";
1547
+ readonly status = 409;
1548
+ }
1549
+ //#endregion
1550
+ //#region src/errors/PgEntityNotFoundError.d.ts
1551
+ declare class PgEntityNotFoundError extends DbError {
1552
+ readonly name = "EntityNotFoundError";
1553
+ readonly status = 404;
1554
+ constructor(entityName: string);
1555
+ }
1556
+ //#endregion
1557
+ //#region src/errors/PgMigrationError.d.ts
1558
+ declare class PgMigrationError extends DbError {
1559
+ readonly name = "PgMigrationError";
1560
+ constructor(cause?: unknown);
1561
+ }
1562
+ //#endregion
1563
+ //#region src/errors/PgVersionMismatchError.d.ts
1564
+ /**
1565
+ * Error thrown when there is a version mismatch.
1566
+ * It's thrown by {@link RepositoryDescriptor#save} when the updated entity version does not match the one in the database.
1567
+ * This is used for optimistic concurrency control.
1568
+ */
1569
+ declare class PgVersionMismatchError extends DbError {
1570
+ readonly name = "PgVersionMismatchError";
1571
+ constructor(table: string, id: any);
1572
+ }
1573
+ //#endregion
1574
+ //#region src/helpers/parseQueryString.d.ts
1575
+ /**
1576
+ * Parse a string query into a PgQueryWhere object.
1577
+ *
1578
+ * Supported syntax:
1579
+ * - Simple equality: "name=John"
1580
+ * - Operators: "age>18", "age>=18", "age<65", "age<=65", "status!=active"
1581
+ * - LIKE patterns: "name~John" (like), "name~*John" (ilike)
1582
+ * - NULL checks: "deletedAt=null", "email!=null"
1583
+ * - IN arrays: "status=[pending,active]"
1584
+ * - AND conditions: "name=John&age>18"
1585
+ * - OR conditions: "name=John|email=john@example.com"
1586
+ * - Nested AND/OR: "(name=John|name=Jane)&age>18"
1587
+ * - JSONB nested: "profile.city=Paris"
1588
+ *
1589
+ * @example
1590
+ * ```ts
1591
+ * // Simple equality
1592
+ * parseQueryString("name=John")
1593
+ * // => { name: { eq: "John" } }
1594
+ *
1595
+ * // Multiple conditions
1596
+ * parseQueryString("name=John&age>18")
1597
+ * // => { and: [{ name: { eq: "John" } }, { age: { gt: 18 } }] }
1598
+ *
1599
+ * // OR conditions
1600
+ * parseQueryString("status=active|status=pending")
1601
+ * // => { or: [{ status: { eq: "active" } }, { status: { eq: "pending" } }] }
1602
+ *
1603
+ * // Complex nested
1604
+ * parseQueryString("(name=John|name=Jane)&age>18&status!=archived")
1605
+ * // => { and: [
1606
+ * // { or: [{ name: { eq: "John" } }, { name: { eq: "Jane" } }] },
1607
+ * // { age: { gt: 18 } },
1608
+ * // { status: { ne: "archived" } }
1609
+ * // ] }
1610
+ *
1611
+ * // JSONB nested query
1612
+ * parseQueryString("profile.city=Paris&profile.age>25")
1613
+ * // => { profile: { city: { eq: "Paris" }, age: { gt: 25 } } }
1614
+ * ```
1615
+ */
1616
+ declare function parseQueryString<T extends TObject>(query: string): PgQueryWhere<T>;
1617
+ /**
1618
+ * Helper function to build query strings programmatically
1619
+ *
1620
+ * @example
1621
+ * ```ts
1622
+ * buildQueryString({
1623
+ * and: [
1624
+ * { name: "eq:John" },
1625
+ * { age: "gt:18" }
1626
+ * ]
1627
+ * })
1628
+ * // => "name=John&age>18"
1629
+ * ```
1630
+ */
1631
+ declare function buildQueryString(where: any): string;
1632
+ //#endregion
1633
+ //#region src/services/PostgresModelBuilder.d.ts
1634
+ declare class PostgresModelBuilder extends ModelBuilder {
1635
+ protected schemas: Map<string, drizzle_orm_pg_core0.PgSchema<string>>;
1636
+ protected getPgSchema(name: string): any;
1637
+ buildTable(entity: EntityDescriptor<any>, options: {
1638
+ tables: Map<string, unknown>;
1639
+ enums: Map<string, unknown>;
1640
+ schema: string;
1641
+ }): void;
1642
+ buildSequence(sequence: SequenceDescriptor, options: {
1643
+ sequences: Map<string, unknown>;
1644
+ schema: string;
1645
+ }): void;
1646
+ /**
1647
+ * Get PostgreSQL-specific config builder for the table.
1648
+ */
1649
+ protected getTableConfig(entity: EntityDescriptor, tables: Map<string, unknown>): ((self: BuildExtraConfigColumns<string, any, "pg">) => PgTableExtraConfigValue[]) | undefined;
1650
+ schemaToPgColumns: <T extends TObject>(tableName: string, schema: T, nsp: PgSchema, enums: Map<string, unknown>, tables: Map<string, unknown>) => FromSchema<T>;
1651
+ mapFieldToColumn: (tableName: string, fieldName: string, value: TSchema, nsp: PgSchema, enums: Map<string, any>) => any;
1652
+ /**
1653
+ * Map a string to a PG column.
1654
+ *
1655
+ * @param key The key of the field.
1656
+ * @param value The value of the field.
1657
+ */
1658
+ mapStringToColumn: (key: string, value: TSchema) => drizzle_orm_pg_core0.PgUUIDBuilderInitial<string> | drizzle_orm_pg_core0.PgCustomColumnBuilder<{
1659
+ name: string;
1660
+ dataType: "custom";
1661
+ columnType: "PgCustomColumn";
1662
+ data: Buffer<ArrayBufferLike>;
1663
+ driverParam: unknown;
1664
+ enumValues: undefined;
1665
+ }> | drizzle_orm_pg_core0.PgTimestampStringBuilderInitial<string> | drizzle_orm_pg_core0.PgDateStringBuilderInitial<string> | drizzle_orm_pg_core0.PgTextBuilderInitial<string, [string, ...string[]]>;
1666
+ }
1667
+ //#endregion
1668
+ //#region src/providers/drivers/NodePostgresProvider.d.ts
1669
+ declare module "alepha" {
1670
+ interface Env extends Partial<Static<typeof envSchema>> {}
1671
+ }
1672
+ declare const envSchema: _alepha_core10.TObject<{
1673
+ /**
1674
+ * Main configuration for database connection.
1675
+ * Accept a string in the format of a Postgres connection URL.
1676
+ * Example: postgres://user:password@localhost:5432/database
1677
+ * or
1678
+ * Example: postgres://user:password@localhost:5432/database?sslmode=require
1679
+ */
1680
+ DATABASE_URL: _alepha_core10.TOptional<_alepha_core10.TString>;
1681
+ /**
1682
+ * In addition to the DATABASE_URL, you can specify the postgres schema name.
1683
+ *
1684
+ * It will monkey patch drizzle tables.
1685
+ */
1686
+ POSTGRES_SCHEMA: _alepha_core10.TOptional<_alepha_core10.TString>;
1687
+ }>;
1688
+ declare class NodePostgresProvider extends DatabaseProvider {
1689
+ static readonly SSL_MODES: readonly ["require", "allow", "prefer", "verify-full"];
1690
+ protected readonly log: _alepha_logger0.Logger;
1691
+ protected readonly env: {
1692
+ DATABASE_URL?: string | undefined;
1693
+ POSTGRES_SCHEMA?: string | undefined;
1694
+ };
1695
+ protected readonly kit: DrizzleKitProvider;
1696
+ protected readonly builder: PostgresModelBuilder;
1697
+ protected client?: postgres.Sql;
1698
+ protected pg?: PostgresJsDatabase;
1699
+ readonly dialect = "postgresql";
1700
+ /**
1701
+ * In testing mode, the schema name will be generated and deleted after the test.
1702
+ */
1703
+ protected schemaForTesting: string | undefined;
1704
+ /**
1705
+ * Execute a SQL statement.
1706
+ */
1707
+ execute(statement: SQLLike): Promise<Array<Record<string, unknown>>>;
1708
+ /**
1709
+ * Get Postgres schema used by this provider.
1710
+ */
1711
+ get schema(): string;
1712
+ /**
1713
+ * Get the Drizzle Postgres database instance.
1714
+ */
1715
+ get db(): PostgresJsDatabase;
1716
+ protected executeMigrations(migrationsFolder: string): Promise<void>;
1717
+ protected readonly onStart: _alepha_core10.HookDescriptor<"start">;
1718
+ protected readonly onStop: _alepha_core10.HookDescriptor<"stop">;
1719
+ connect(): Promise<void>;
1720
+ close(): Promise<void>;
1721
+ protected migrate: _alepha_lock0.LockDescriptor<() => Promise<void>>;
1722
+ /**
1723
+ * Map the DATABASE_URL to postgres client options.
1724
+ */
1725
+ protected getClientOptions(): postgres.Options<any>;
1726
+ protected ssl(url: URL): "require" | "allow" | "prefer" | "verify-full" | undefined;
1727
+ /**
1728
+ * For testing purposes, generate a unique schema name.
1729
+ * The schema name will be generated based on the current date and time.
1730
+ * It will be in the format of `test_YYYYMMDD_HHMMSS_randomSuffix`.
1731
+ */
1732
+ protected generateTestSchemaName(): string;
1733
+ }
1734
+ //#endregion
1735
+ //#region src/services/SqliteModelBuilder.d.ts
1736
+ declare class SqliteModelBuilder extends ModelBuilder {
1737
+ buildTable(entity: EntityDescriptor<any>, options: {
1738
+ tables: Map<string, unknown>;
1739
+ enums: Map<string, unknown>;
1740
+ schema: string;
1741
+ }): void;
1742
+ buildSequence(sequence: SequenceDescriptor, options: {
1743
+ sequences: Map<string, unknown>;
1744
+ schema: string;
1745
+ }): void;
1746
+ /**
1747
+ * Get SQLite-specific config builder for the table.
1748
+ */
1749
+ protected getTableConfig(entity: EntityDescriptor, tables: Map<string, unknown>): ((self: BuildColumns<string, any, "sqlite">) => any) | undefined;
1750
+ schemaToSqliteColumns: <T extends TObject>(tableName: string, schema: T, enums: Map<string, unknown>, tables: Map<string, unknown>) => SchemaToSqliteBuilder<T>;
1751
+ mapFieldToSqliteColumn: (tableName: string, fieldName: string, value: TSchema, enums: Map<string, any>) => pg$1.SQLiteIntegerBuilderInitial<string> | pg$1.SQLiteNumericBuilderInitial<string> | pg$1.SQLiteTextBuilderInitial<string, [string, ...string[]], number | undefined> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1752
+ name: string;
1753
+ dataType: "custom";
1754
+ columnType: "SQLiteCustomColumn";
1755
+ data: string;
1756
+ driverParam: string;
1757
+ enumValues: undefined;
1758
+ }>, string> | pg$1.SQLiteCustomColumnBuilder<{
1759
+ name: string;
1760
+ dataType: "custom";
1761
+ columnType: "SQLiteCustomColumn";
1762
+ data: string;
1763
+ driverParam: number;
1764
+ enumValues: undefined;
1765
+ }> | pg$1.SQLiteCustomColumnBuilder<{
1766
+ name: string;
1767
+ dataType: "custom";
1768
+ columnType: "SQLiteCustomColumn";
1769
+ data: boolean;
1770
+ driverParam: number;
1771
+ enumValues: undefined;
1772
+ }> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1773
+ name: string;
1774
+ dataType: "custom";
1775
+ columnType: "SQLiteCustomColumn";
1776
+ data: {
1777
+ [x: string]: unknown;
1778
+ [x: number]: unknown;
1779
+ [x: symbol]: unknown;
1780
+ };
1781
+ driverParam: string;
1782
+ enumValues: undefined;
1783
+ }>, {
1784
+ [x: string]: unknown;
1785
+ [x: number]: unknown;
1786
+ [x: symbol]: unknown;
1787
+ }> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1788
+ name: string;
1789
+ dataType: "custom";
1790
+ columnType: "SQLiteCustomColumn";
1791
+ data: Record<string, unknown>;
1792
+ driverParam: string;
1793
+ enumValues: undefined;
1794
+ }>, Record<string, unknown>> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1795
+ name: string;
1796
+ dataType: "custom";
1797
+ columnType: "SQLiteCustomColumn";
1798
+ data: any;
1799
+ driverParam: string;
1800
+ enumValues: undefined;
1801
+ }>, any> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1802
+ name: string;
1803
+ dataType: "custom";
1804
+ columnType: "SQLiteCustomColumn";
1805
+ data: unknown[];
1806
+ driverParam: string;
1807
+ enumValues: undefined;
1808
+ }>, unknown[]>;
1809
+ mapStringToSqliteColumn: (key: string, value: TString) => pg$1.SQLiteTextBuilderInitial<string, [string, ...string[]], number | undefined> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1810
+ name: string;
1811
+ dataType: "custom";
1812
+ columnType: "SQLiteCustomColumn";
1813
+ data: string;
1814
+ driverParam: string;
1815
+ enumValues: undefined;
1816
+ }>, string> | pg$1.SQLiteCustomColumnBuilder<{
1817
+ name: string;
1818
+ dataType: "custom";
1819
+ columnType: "SQLiteCustomColumn";
1820
+ data: string;
1821
+ driverParam: number;
1822
+ enumValues: undefined;
1823
+ }>;
1824
+ sqliteJson: <TDocument extends TSchema>(name: string, document: TDocument) => drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1825
+ name: string;
1826
+ dataType: "custom";
1827
+ columnType: "SQLiteCustomColumn";
1828
+ data: typebox1.StaticType<[], "Decode", {}, {}, TDocument>;
1829
+ driverParam: string;
1830
+ enumValues: undefined;
1831
+ }>, typebox1.StaticType<[], "Decode", {}, {}, TDocument>>;
1832
+ sqliteDateTime: {
1833
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1834
+ name: "";
1835
+ dataType: "custom";
1836
+ columnType: "SQLiteCustomColumn";
1837
+ data: string;
1838
+ driverParam: number;
1839
+ enumValues: undefined;
1840
+ }>;
1841
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1842
+ name: TName;
1843
+ dataType: "custom";
1844
+ columnType: "SQLiteCustomColumn";
1845
+ data: string;
1846
+ driverParam: number;
1847
+ enumValues: undefined;
1848
+ }>;
1849
+ };
1850
+ sqliteBool: {
1851
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1852
+ name: "";
1853
+ dataType: "custom";
1854
+ columnType: "SQLiteCustomColumn";
1855
+ data: boolean;
1856
+ driverParam: number;
1857
+ enumValues: undefined;
1858
+ }>;
1859
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1860
+ name: TName;
1861
+ dataType: "custom";
1862
+ columnType: "SQLiteCustomColumn";
1863
+ data: boolean;
1864
+ driverParam: number;
1865
+ enumValues: undefined;
1866
+ }>;
1867
+ };
1868
+ sqliteDate: {
1869
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1870
+ name: "";
1871
+ dataType: "custom";
1872
+ columnType: "SQLiteCustomColumn";
1873
+ data: string;
1874
+ driverParam: number;
1875
+ enumValues: undefined;
1876
+ }>;
1877
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1878
+ name: TName;
1879
+ dataType: "custom";
1880
+ columnType: "SQLiteCustomColumn";
1881
+ data: string;
1882
+ driverParam: number;
1883
+ enumValues: undefined;
1884
+ }>;
1885
+ };
1886
+ }
1887
+ type SchemaToSqliteBuilder<T extends TObject> = { [key in keyof T["properties"]]: SQLiteColumnBuilderBase };
1888
+ //#endregion
1889
+ //#region src/providers/drivers/NodeSqliteProvider.d.ts
1890
+ /**
1891
+ * Configuration options for the Node.js SQLite database provider.
1892
+ */
1893
+ declare const nodeSqliteOptions: _alepha_core10.Atom<typebox1.TObject<{
1894
+ path: typebox1.TOptional<typebox1.TString>;
1895
+ }>, "alepha.postgres.node-sqlite.options">;
1896
+ type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
1897
+ declare module "alepha" {
1898
+ interface State {
1899
+ [nodeSqliteOptions.key]: NodeSqliteProviderOptions;
1900
+ }
1901
+ }
1902
+ /**
1903
+ * Add a fake support for SQLite in Node.js based on Postgres interfaces.
1904
+ *
1905
+ * This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
1906
+ * This is NOT recommended for production use.
1907
+ */
1908
+ declare class NodeSqliteProvider extends DatabaseProvider {
1909
+ protected readonly kit: DrizzleKitProvider;
1910
+ protected readonly log: _alepha_logger0.Logger;
1911
+ protected readonly env: {
1912
+ DATABASE_URL?: string | undefined;
1913
+ };
1914
+ protected readonly builder: SqliteModelBuilder;
1915
+ protected readonly options: Readonly<{
1916
+ path?: string | undefined;
1917
+ }>;
1918
+ protected sqlite: DatabaseSync;
1919
+ readonly dialect = "sqlite";
1920
+ get path(): string;
1921
+ execute(query: SQLLike): Promise<Array<Record<string, unknown>>>;
1922
+ readonly db: PgDatabase<any>;
1923
+ protected readonly onStart: _alepha_core10.HookDescriptor<"start">;
1924
+ protected executeMigrations(migrationsFolder: string): Promise<void>;
1925
+ }
1926
+ //#endregion
1927
+ //#region src/providers/PostgresTypeProvider.d.ts
1928
+ declare class PostgresTypeProvider {
1929
+ readonly attr: <T extends TSchema, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
1930
+ /**
1931
+ * Creates a primary key with an identity column.
1932
+ */
1933
+ readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1934
+ /**
1935
+ * Creates a primary key with a big identity column. (default)
1936
+ */
1937
+ readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1938
+ /**
1939
+ * Creates a primary key with a UUID column.
1940
+ */
1941
+ readonly uuidPrimaryKey: () => PgAttr<PgAttr<TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1942
+ /**
1943
+ * Creates a primary key for a given type. Supports:
1944
+ * - `t.int()` -> PG INT (default)
1945
+ * - `t.bigint()` -> PG BIGINT
1946
+ * - `t.uuid()` -> PG UUID
1947
+ */
1948
+ primaryKey(): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
1949
+ primaryKey(type: TString, options?: TStringOptions): PgAttr<PgAttr<TString, PgPrimaryKey>, PgDefault>;
1950
+ primaryKey(type: TInteger, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
1951
+ primaryKey(type: TNumber, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TNumber, PgPrimaryKey>, PgDefault>;
1952
+ primaryKey(type: TBigInt, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TBigInt, PgPrimaryKey>, PgDefault>;
1953
+ /**
1954
+ * Wrap a schema with "default" attribute.
1955
+ * This is used to set a default value for a column in the database.
1956
+ */
1957
+ readonly default: <T extends TSchema>(type: T, value?: Static<T>) => PgAttr<T, PgDefault>;
1958
+ /**
1959
+ * Creates a column 'version'.
1960
+ *
1961
+ * This is used to track the version of a row in the database.
1962
+ *
1963
+ * You can use it for optimistic concurrency control (OCC) with {@link RepositoryDescriptor#save}.
1964
+ *
1965
+ * @see {@link RepositoryDescriptor#save}
1966
+ * @see {@link PgVersionMismatchError}
1967
+ */
1968
+ readonly version: (options?: TNumberOptions) => PgAttr<PgAttr<TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
1969
+ /**
1970
+ * Creates a column Created At. So just a datetime column with a default value of the current timestamp.
1971
+ */
1972
+ readonly createdAt: (options?: TStringOptions) => PgAttr<PgAttr<typebox1.TCodec<TString, dayjs0.Dayjs>, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1973
+ /**
1974
+ * Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
1975
+ */
1976
+ readonly updatedAt: (options?: TStringOptions) => PgAttr<PgAttr<typebox1.TCodec<TString, dayjs0.Dayjs>, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1977
+ /**
1978
+ * Creates a column Deleted At for soft delete functionality.
1979
+ * This is used to mark rows as deleted without actually removing them from the database.
1980
+ * The column is nullable - NULL means not deleted, timestamp means deleted.
1981
+ */
1982
+ readonly deletedAt: (options?: TStringOptions) => PgAttr<typebox1.TOptional<typebox1.TCodec<TString, dayjs0.Dayjs>>, typeof PG_DELETED_AT>;
1983
+ /**
1984
+ * Creates a Postgres ENUM type.
1985
+ *
1986
+ * > By default, `t.enum()` is mapped to a TEXT column in Postgres.
1987
+ * > Using this method, you can create a real ENUM type in the database.
1988
+ *
1989
+ * @example
1990
+ * ```ts
1991
+ * const statusEnum = pg.enum(["pending", "active", "archived"], { name: "status_enum" });
1992
+ * ```
1993
+ */
1994
+ readonly enum: <T extends string[]>(values: [...T], pgEnumOptions?: PgEnumOptions, typeOptions?: TStringOptions) => PgAttr<TUnsafe<T[number]>, typeof PG_ENUM>;
1995
+ /**
1996
+ * Creates a reference to another table or schema. Basically a foreign key.
1997
+ */
1998
+ readonly ref: <T extends TSchema>(type: T, ref: () => any, actions?: {
1999
+ onUpdate?: UpdateDeleteAction$1;
2000
+ onDelete?: UpdateDeleteAction$1;
2001
+ }) => PgAttr<T, PgRef>;
2002
+ /**
2003
+ * Creates a page schema for a given object schema.
2004
+ * It's used by {@link RepositoryDescriptor#paginate} method.
2005
+ */
2006
+ readonly page: <T extends TObject>(resource: T, options?: TObjectOptions) => TPage<T>;
2007
+ }
2008
+ declare const pg: PostgresTypeProvider;
2009
+ //#endregion
2010
+ //#region src/providers/RepositoryProvider.d.ts
2011
+ declare class RepositoryProvider {
2012
+ protected readonly alepha: Alepha;
2013
+ protected readonly registry: Map<EntityDescriptor<any>, Service<Repository<any>>>;
2014
+ getRepositories(provider?: DatabaseProvider): Repository<TObject<typebox1.TProperties>>[];
2015
+ createClassRepository<T extends TObject>(entity: EntityDescriptor<T>): Service<Repository<T>>;
2016
+ }
2017
+ //#endregion
2018
+ //#region src/schemas/legacyIdSchema.d.ts
2019
+ /**
2020
+ * @deprecated Use `pg.primaryKey()` instead.
2021
+ */
2022
+ declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<typebox1.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
2023
+ //#endregion
2024
+ //#region src/types/schema.d.ts
2025
+ /**
2026
+ * Postgres schema type.
2027
+ */
2028
+ declare const schema: <TDocument extends TSchema>(name: string, document: TDocument) => drizzle_orm0.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
2029
+ name: string;
2030
+ dataType: "custom";
2031
+ columnType: "PgCustomColumn";
2032
+ data: typebox1.StaticType<[], "Decode", {}, {}, TDocument>;
2033
+ driverParam: string;
2034
+ enumValues: undefined;
2035
+ }>, typebox1.StaticType<[], "Decode", {}, {}, TDocument>>;
2036
+ //#endregion
2037
+ //#region src/index.d.ts
2038
+ declare module "alepha" {
2039
+ interface Hooks {
2040
+ /**
2041
+ * Fires before creating an entity in the repository.
2042
+ */
2043
+ "repository:create:before": {
2044
+ tableName: string;
2045
+ data: any;
2046
+ };
2047
+ /**
2048
+ * Fires after creating an entity in the repository.
2049
+ */
2050
+ "repository:create:after": {
2051
+ tableName: string;
2052
+ data: any;
2053
+ entity: any;
2054
+ };
2055
+ /**
2056
+ * Fires before updating entities in the repository.
2057
+ */
2058
+ "repository:update:before": {
2059
+ tableName: string;
2060
+ where: any;
2061
+ data: any;
2062
+ };
2063
+ /**
2064
+ * Fires after updating entities in the repository.
2065
+ */
2066
+ "repository:update:after": {
2067
+ tableName: string;
2068
+ where: any;
2069
+ data: any;
2070
+ entities: any[];
2071
+ };
2072
+ /**
2073
+ * Fires before deleting entities from the repository.
2074
+ */
2075
+ "repository:delete:before": {
2076
+ tableName: string;
2077
+ where: any;
2078
+ };
2079
+ /**
2080
+ * Fires after deleting entities from the repository.
2081
+ */
2082
+ "repository:delete:after": {
2083
+ tableName: string;
2084
+ where: any;
2085
+ ids: Array<string | number>;
2086
+ };
2087
+ /**
2088
+ * Fires before reading entities from the repository.
2089
+ */
2090
+ "repository:read:before": {
2091
+ tableName: string;
2092
+ query: any;
2093
+ };
2094
+ /**
2095
+ * Fires after reading entities from the repository.
2096
+ */
2097
+ "repository:read:after": {
2098
+ tableName: string;
2099
+ query: any;
2100
+ entities: any[];
2101
+ };
2102
+ }
2103
+ }
2104
+ /**
2105
+ * Postgres client based on Drizzle ORM, Alepha type-safe friendly.
2106
+ *
2107
+ * ```ts
2108
+ * const users = $entity({
2109
+ * name: "users",
2110
+ * schema: t.object({
2111
+ * id: pg.primaryKey(),
2112
+ * name: t.text(),
2113
+ * email: t.text(),
2114
+ * }),
2115
+ * });
2116
+ *
2117
+ * class Db {
2118
+ * users = $repository(users);
2119
+ * }
2120
+ *
2121
+ * const db = alepha.inject(Db);
2122
+ * const user = await db.users.one({ name: { eq: "John Doe" } });
2123
+ * ```
2124
+ *
2125
+ * This is not a full ORM, but rather a set of tools to work with Postgres databases in a type-safe way.
2126
+ *
2127
+ * It provides:
2128
+ * - A type-safe way to define entities and repositories. (via `$entity` and `$repository`)
2129
+ * - Custom query builders and filters.
2130
+ * - Built-in special columns like `createdAt`, `updatedAt`, `deletedAt`, `version`.
2131
+ * - Automatic JSONB support.
2132
+ * - Automatic synchronization of entities with the database schema (for testing and development).
2133
+ * - Fallback to raw SQL via Drizzle ORM `sql` function.
2134
+ *
2135
+ * Migrations are supported via Drizzle ORM, you need to use the `drizzle-kit` CLI tool to generate and run migrations.
2136
+ *
2137
+ * @see {@link $entity}
2138
+ * @see {@link $sequence}
2139
+ * @see {@link $repository}
2140
+ * @see {@link $transaction}
2141
+ * @module alepha.postgres
2142
+ */
2143
+ declare const AlephaPostgres: _alepha_core10.Service<_alepha_core10.Module>;
2144
+ //#endregion
2145
+ export { $entity, $repository, $sequence, $transaction, AlephaPostgres, DatabaseProvider, DbError, DrizzleKitProvider, EntityColumn, EntityColumns, EntityDescriptor, EntityDescriptorOptions, FilterOperators, FromSchema, NodePostgresProvider, NodeSqliteProvider, NodeSqliteProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_ENUM, PG_IDENTITY, PG_PRIMARY_KEY, PG_REF, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, type Page, type PageQuery, PgAttr, PgAttrField, PgConflictError, PgDefault, PgEntityNotFoundError, PgEnumOptions, PgIdentityOptions, PgMigrationError, PgPrimaryKey, PgQuery, PgQueryRelations, PgQueryWhere, PgQueryWhereOrSQL, PgRef, PgRefOptions, PgRelation, PgRelationMap, PgStatic, PgSymbolKeys, PgSymbols, PgVersionMismatchError, PostgresTypeProvider, Repository, RepositoryProvider, SQLLike, SchemaToTableConfig, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TObjectInsert, TObjectUpdate, TransactionContext, TransactionDescriptorOptions, buildQueryString, drizzle_orm0 as drizzle, getAttrFields, insertSchema, legacyIdSchema, nodeSqliteOptions, pageQuerySchema, pageSchema, parseQueryString, pg, pgAttr, schema, sql, updateSchema };
2146
+ //# sourceMappingURL=index.d.ts.map