alepha 0.11.5 → 0.11.7

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 (51) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -100
  3. package/api/files.d.ts +168 -169
  4. package/api/jobs.d.ts +263 -154
  5. package/api/notifications.d.ts +28 -29
  6. package/api/users.d.ts +476 -477
  7. package/batch.d.ts +59 -493
  8. package/bucket.d.ts +20 -11
  9. package/cache/redis.d.ts +1 -1
  10. package/cache.d.ts +1 -1
  11. package/command.d.ts +24 -7
  12. package/core.d.ts +299 -222
  13. package/datetime.d.ts +4 -29
  14. package/devtools.d.ts +166 -284
  15. package/email.d.ts +45 -2
  16. package/fake.d.ts +1 -1
  17. package/file.d.ts +1 -1
  18. package/lock/redis.d.ts +1 -1
  19. package/lock.d.ts +1 -1
  20. package/logger.d.ts +11 -9
  21. package/package.json +51 -51
  22. package/postgres.d.ts +480 -198
  23. package/queue/redis.d.ts +1 -1
  24. package/queue.d.ts +1 -1
  25. package/react/auth.d.ts +7 -2
  26. package/react/form.d.ts +39 -16
  27. package/react/head.d.ts +1 -1
  28. package/react/i18n.d.ts +2 -2
  29. package/react.d.ts +66 -41
  30. package/redis.d.ts +1 -1
  31. package/retry.d.ts +84 -21
  32. package/scheduler.d.ts +1 -1
  33. package/security.d.ts +29 -29
  34. package/server/cache.d.ts +1 -1
  35. package/server/compress.d.ts +9 -3
  36. package/server/cookies.d.ts +1 -1
  37. package/server/cors.d.ts +28 -10
  38. package/server/health.d.ts +18 -19
  39. package/server/helmet.d.ts +44 -15
  40. package/server/links.d.ts +37 -31
  41. package/server/metrics.d.ts +1 -1
  42. package/server/multipart.d.ts +1 -1
  43. package/server/proxy.d.ts +1 -1
  44. package/server/security.d.ts +8 -3
  45. package/server/static.d.ts +1 -1
  46. package/server/swagger.d.ts +19 -6
  47. package/server.d.ts +1 -1
  48. package/topic/redis.d.ts +1 -1
  49. package/topic.d.ts +1 -1
  50. package/ui.d.ts +142 -12
  51. package/vite.d.ts +2 -2
package/postgres.d.ts CHANGED
@@ -1,20 +1,21 @@
1
1
  import * as _alepha_core10 from "alepha";
2
- import { Alepha, AlephaError, Descriptor, DescriptorArgs, KIND, Page, Static, StaticEncode, TBigInt, TInteger, TNull, TNumber, TNumberOptions, TObject, TObjectOptions, TOptional, TPage, TSchema, TString, TStringOptions, TUnion, TUnsafe, pageSchema } 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
3
  import { DateTime, DateTimeProvider } from "alepha/datetime";
4
4
  import * as drizzle_orm0 from "drizzle-orm";
5
- import { BuildExtraConfigColumns, SQL, SQLWrapper, sql } from "drizzle-orm";
5
+ import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, sql } from "drizzle-orm";
6
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, PgTransactionConfig, UpdateDeleteAction } from "drizzle-orm/pg-core";
8
- import * as _alepha_logger0 from "alepha/logger";
7
+ import { LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSchema, PgSelectBase, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, UpdateDeleteAction } from "drizzle-orm/pg-core";
8
+ import * as _alepha_logger2 from "alepha/logger";
9
9
  import * as _alepha_lock0 from "alepha/lock";
10
10
  import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
11
11
  import postgres from "postgres";
12
+ import * as pg$1 from "drizzle-orm/sqlite-core";
13
+ import { SQLiteColumnBuilderBase } from "drizzle-orm/sqlite-core";
12
14
  import * as _alepha_retry0 from "alepha/retry";
13
- import * as typebox11 from "typebox";
14
- import { PgTransactionConfig as PgTransactionConfig$1 } from "drizzle-orm/pg-core/session";
15
+ import { DatabaseSync } from "node:sqlite";
16
+ import { PgTransactionConfig } from "drizzle-orm/pg-core/session";
17
+ import * as typebox7 from "typebox";
15
18
  import * as DrizzleKit from "drizzle-kit/api";
16
- import { MigrationConfig } from "drizzle-orm/migrator";
17
- import * as dayjs0 from "dayjs";
18
19
  import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
19
20
  export * from "drizzle-orm/pg-core";
20
21
 
@@ -260,8 +261,8 @@ interface PgRefOptions {
260
261
  };
261
262
  }
262
263
  //#endregion
263
- //#region src/errors/PgError.d.ts
264
- declare class PgError extends AlephaError {
264
+ //#region src/errors/DbError.d.ts
265
+ declare class DbError extends AlephaError {
265
266
  name: string;
266
267
  constructor(message: string, cause?: unknown);
267
268
  }
@@ -864,32 +865,103 @@ declare abstract class ModelBuilder {
864
865
  protected buildTableConfig<TConfig, TSelf>(entity: EntityDescriptor, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
865
866
  }
866
867
  //#endregion
868
+ //#region src/providers/DrizzleKitProvider.d.ts
869
+ declare class DrizzleKitProvider {
870
+ protected readonly log: _alepha_logger2.Logger;
871
+ protected readonly alepha: Alepha;
872
+ /**
873
+ * Synchronize database with current schema definitions.
874
+ *
875
+ * In development mode, it will generate and execute migrations based on the current state.
876
+ * In testing mode, it will generate migrations from scratch without applying them.
877
+ *
878
+ * Does nothing in production mode, you must handle migrations manually.
879
+ */
880
+ synchronize(provider: DatabaseProvider): Promise<void>;
881
+ /**
882
+ * Mostly used for testing purposes. You can generate SQL migration statements without executing them.
883
+ */
884
+ generateMigration(provider: DatabaseProvider, prevSnapshot?: any): Promise<{
885
+ statements: string[];
886
+ models: Record<string, unknown>;
887
+ snapshot?: any;
888
+ }>;
889
+ /**
890
+ * Load all tables, enums, sequences, etc. from the provider's repositories.
891
+ */
892
+ getModels(provider: DatabaseProvider): Record<string, unknown>;
893
+ /**
894
+ * Load the migration snapshot from the database.
895
+ */
896
+ protected loadDevMigrations(provider: DatabaseProvider): Promise<DevMigrations | undefined>;
897
+ protected saveDevMigrations(provider: DatabaseProvider, curr: Record<string, any>, devMigrations?: DevMigrations): Promise<void>;
898
+ protected executeStatements(statements: string[], provider: DatabaseProvider, catchErrors?: boolean): Promise<void>;
899
+ protected createSchemaIfNotExists(provider: DatabaseProvider, schemaName: string): Promise<void>;
900
+ /**
901
+ * Try to load the official Drizzle Kit API.
902
+ * If not available, fallback to the local kit import.
903
+ */
904
+ protected importDrizzleKit(): typeof DrizzleKit;
905
+ }
906
+ declare const devMigrationsSchema: typebox7.TObject<{
907
+ id: typebox7.TNumber;
908
+ name: typebox7.TString;
909
+ snapshot: typebox7.TString;
910
+ created_at: typebox7.TString;
911
+ }>;
912
+ type DevMigrations = Static<typeof devMigrationsSchema>;
913
+ //#endregion
867
914
  //#region src/providers/drivers/DatabaseProvider.d.ts
868
915
  type SQLLike = SQLWrapper | string;
869
916
  declare abstract class DatabaseProvider {
870
917
  protected readonly alepha: Alepha;
918
+ protected readonly log: _alepha_logger2.Logger;
871
919
  protected abstract readonly builder: ModelBuilder;
920
+ protected abstract readonly kit: DrizzleKitProvider;
872
921
  abstract readonly db: PgDatabase<any>;
873
- abstract readonly dialect: "postgres" | "sqlite";
922
+ abstract readonly dialect: "postgresql" | "sqlite";
923
+ abstract readonly url: string;
874
924
  readonly enums: Map<string, unknown>;
875
925
  readonly tables: Map<string, unknown>;
876
926
  readonly sequences: Map<string, unknown>;
877
- table<T extends TObject>(entity: EntityDescriptor<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
927
+ get name(): string;
878
928
  get schema(): string;
929
+ table<T extends TObject>(entity: EntityDescriptor<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
879
930
  registerEntity(entity: EntityDescriptor): void;
880
931
  registerSequence(sequence: SequenceDescriptor): void;
881
932
  abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
882
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>;
883
963
  }
884
964
  //#endregion
885
- //#region src/schemas/pageQuerySchema.d.ts
886
- declare const pageQuerySchema: typebox11.TObject<{
887
- page: typebox11.TOptional<typebox11.TInteger>;
888
- size: typebox11.TOptional<typebox11.TInteger>;
889
- sort: typebox11.TOptional<typebox11.TString>;
890
- }>;
891
- type PageQuery = Static<typeof pageQuerySchema>;
892
- //#endregion
893
965
  //#region src/services/PgJsonQueryManager.d.ts
894
966
  /**
895
967
  * Manages JSONB query generation for nested object and array queries in PostgreSQL.
@@ -908,17 +980,24 @@ declare class PgJsonQueryManager {
908
980
  * @param column The JSONB column
909
981
  * @param path The path to the nested property (e.g., ['profile', 'contact', 'email'])
910
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
911
985
  * @returns SQL condition
912
986
  */
913
- buildJsonbCondition(column: PgColumn, path: string[], operator: FilterOperators<any>): SQL | undefined;
987
+ buildJsonbCondition(column: PgColumn, path: string[], operator: FilterOperators<any>, dialect: "postgresql" | "sqlite", columnSchema?: any): SQL | undefined;
914
988
  /**
915
989
  * Build JSONB array query conditions.
916
990
  * Supports queries like: { addresses: { city: { eq: "Wonderland" } } }
917
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
918
995
  */
919
- buildJsonbArrayCondition(column: PgColumn, path: string[], arrayPath: string, operator: FilterOperators<any>): SQL | undefined;
996
+ buildJsonbArrayCondition(column: PgColumn, path: string[], arrayPath: string, operator: FilterOperators<any>, dialect: "postgresql" | "sqlite"): SQL | undefined;
920
997
  /**
921
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
922
1001
  */
923
1002
  private applyOperatorToJsonValue;
924
1003
  /**
@@ -941,14 +1020,23 @@ declare class PgJsonQueryManager {
941
1020
  * @returns true if the array contains primitives, false if it contains objects
942
1021
  */
943
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;
944
1032
  /**
945
1033
  * Check if a nested path points to an array property.
946
1034
  */
947
1035
  isArrayProperty(schema: TObject, path: string[]): boolean;
948
1036
  }
949
1037
  //#endregion
950
- //#region src/services/PgQueryManager.d.ts
951
- declare class PgQueryManager {
1038
+ //#region src/services/QueryManager.d.ts
1039
+ declare class QueryManager {
952
1040
  protected readonly jsonQueryManager: PgJsonQueryManager;
953
1041
  protected readonly alepha: Alepha;
954
1042
  /**
@@ -958,11 +1046,12 @@ declare class PgQueryManager {
958
1046
  schema: TObject;
959
1047
  col: (key: string) => PgColumn;
960
1048
  joins?: PgJoin[];
1049
+ dialect: "postgresql" | "sqlite";
961
1050
  }): SQL | undefined;
962
1051
  /**
963
1052
  * Build a JSONB query for nested object/array queries.
964
1053
  */
965
- protected buildJsonbQuery(column: PgColumn, nestedQuery: any, schema: TObject, columnName: string): SQL | undefined;
1054
+ protected buildJsonbQuery(column: PgColumn, nestedQuery: any, schema: TObject, columnName: string, dialect: "postgresql" | "sqlite"): SQL | undefined;
966
1055
  /**
967
1056
  * Check if an object has any filter operator properties.
968
1057
  */
@@ -1045,91 +1134,15 @@ declare class PgRelationManager {
1045
1134
  buildSchemaWithJoins(baseSchema: TObject, joins: PgJoin[], parentPath?: string): TObject;
1046
1135
  }
1047
1136
  //#endregion
1048
- //#region src/descriptors/$repository.d.ts
1049
- /**
1050
- * Creates a repository for database operations on a defined entity.
1051
- *
1052
- * This descriptor provides a comprehensive, type-safe interface for performing all
1053
- * database operations on entities defined with $entity. It offers a rich set of
1054
- * CRUD operations, advanced querying capabilities, pagination, transactions, and
1055
- * built-in support for audit trails and soft deletes.
1056
- */
1057
- declare const $repository: {
1058
- <T extends TObject>(optionsOrEntity: EntityDescriptor<T> | EntityDescriptorOptions<T> | RepositoryDescriptorOptions<T>): RepositoryDescriptor<T>;
1059
- [KIND]: typeof RepositoryDescriptor;
1060
- };
1061
- interface RepositoryDescriptorOptions<T extends TObject> {
1062
- /**
1063
- * The entity table definition created with $entity.
1064
- *
1065
- * This table:
1066
- * - Must be created using the $entity descriptor
1067
- * - Defines the schema, indexes, and constraints for the repository
1068
- * - Provides type information for all repository operations
1069
- * - Must include exactly one primary key field
1070
- *
1071
- * The repository will automatically:
1072
- * - Generate typed CRUD operations based on the entity schema
1073
- * - Handle audit fields like createdAt, updatedAt, deletedAt
1074
- * - Support optimistic locking if version field is present
1075
- * - Provide soft delete functionality if deletedAt field exists
1076
- *
1077
- * **Entity Requirements**:
1078
- * - Must have been created with $entity descriptor
1079
- * - Schema must include a primary key field marked with `pg.primaryKey()`
1080
- * - Corresponding database table must exist (created via migrations)
1081
- *
1082
- * @example
1083
- * ```ts
1084
- * const User = $entity({
1085
- * name: "users",
1086
- * schema: t.object({
1087
- * id: pg.primaryKey(t.uuid()),
1088
- * email: t.text({ format: "email" }),
1089
- * name: t.text()
1090
- * })
1091
- * });
1092
- *
1093
- * const userRepository = $repository({ table: User });
1094
- * ```
1095
- */
1096
- entity: EntityDescriptor<T>;
1097
- /**
1098
- * Override the default PostgreSQL database provider.
1099
- *
1100
- * By default, the repository will use the injected PostgresProvider from the
1101
- * dependency injection container. Use this option to:
1102
- * - Connect to a different database
1103
- * - Use a specific connection pool
1104
- * - Implement custom database behavior
1105
- * - Support multi-tenant architectures with database per tenant
1106
- *
1107
- * **Common Use Cases**:
1108
- * - Multi-database applications
1109
- * - Read replicas for query optimization
1110
- * - Different databases for different entity types
1111
- * - Testing with separate test databases
1112
- *
1113
- * @default Uses injected PostgresProvider
1114
- *
1115
- * @example ReadOnlyPostgresProvider
1116
- * @example TenantSpecificPostgresProvider
1117
- * @example TestDatabaseProvider
1118
- */
1119
- provider?: DatabaseProvider;
1120
- name?: string;
1121
- }
1122
- declare class RepositoryDescriptor<T extends TObject = TObject> extends Descriptor<RepositoryDescriptorOptions<T>> {
1137
+ //#region src/services/Repository.d.ts
1138
+ declare abstract class Repository<T extends TObject> {
1139
+ readonly entity: EntityDescriptor<T>;
1140
+ readonly provider: DatabaseProvider;
1123
1141
  protected readonly relationManager: PgRelationManager;
1124
- protected readonly queryManager: PgQueryManager;
1142
+ protected readonly queryManager: QueryManager;
1125
1143
  protected readonly dateTimeProvider: DateTimeProvider;
1126
1144
  protected readonly alepha: Alepha;
1127
- readonly provider: DatabaseProvider;
1128
- constructor(args: DescriptorArgs<RepositoryDescriptorOptions<T>>);
1129
- /**
1130
- * Get the entity descriptor associated with this repository.
1131
- */
1132
- get entity(): EntityDescriptor<T>;
1145
+ constructor(entity: EntityDescriptor<T>, provider?: typeof DatabaseProvider);
1133
1146
  /**
1134
1147
  * Represents the primary key of the table.
1135
1148
  * - Key is the name of the primary key column.
@@ -1233,9 +1246,9 @@ declare class RepositoryDescriptor<T extends TObject = TObject> extends Descript
1233
1246
  *
1234
1247
  * > Pagination CAN also do a count query to get the total number of elements.
1235
1248
  */
1236
- paginate<R extends PgRelationMap<T>>(pagination?: PageQuery, query?: PgQueryRelations<T, R>, opts?: StatementOptions & {
1249
+ paginate<R extends PgRelationMap<T>>(pagination?: PageQuery$1, query?: PgQueryRelations<T, R>, opts?: StatementOptions & {
1237
1250
  count?: boolean;
1238
- }): Promise<Page<PgStatic<T, R>>>;
1251
+ }): Promise<Page$1<PgStatic<T, R>>>;
1239
1252
  /**
1240
1253
  * Find an entity by ID.
1241
1254
  *
@@ -1289,7 +1302,6 @@ declare class RepositoryDescriptor<T extends TObject = TObject> extends Descript
1289
1302
  * - validate entity against schema
1290
1303
  * - undefined values will be set to null, not ignored!
1291
1304
  *
1292
- * @see {@link PostgresTypeProvider#version}
1293
1305
  * @see {@link PgVersionMismatchError}
1294
1306
  */
1295
1307
  save(entity: Static<T>, opts?: StatementOptions): Promise<void>;
@@ -1334,7 +1346,7 @@ declare class RepositoryDescriptor<T extends TObject = TObject> extends Descript
1334
1346
  */
1335
1347
  count(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<number>;
1336
1348
  protected conflictMessagePattern: string;
1337
- protected handleError(error: unknown, message: string): PgError;
1349
+ protected handleError(error: unknown, message: string): DbError;
1338
1350
  protected withDeletedAt(where: PgQueryWhereOrSQL<T>, opts?: {
1339
1351
  force?: boolean;
1340
1352
  }): PgQueryWhereOrSQL<T>;
@@ -1345,11 +1357,6 @@ declare class RepositoryDescriptor<T extends TObject = TObject> extends Descript
1345
1357
  protected cast(data: any, insert: boolean): PgInsertValue<PgTableWithColumns<SchemaToTableConfig<T>>>;
1346
1358
  /**
1347
1359
  * Transform a row from the database into a clean entity.
1348
- *
1349
- * - Validate against schema
1350
- * - Replace all null values by undefined
1351
- * - Fix date-time and date fields to ISO strings
1352
- * - Cast BigInt to string
1353
1360
  */
1354
1361
  protected clean<T extends TObject>(row: Record<string, unknown>, schema: T): Static<T>;
1355
1362
  /**
@@ -1375,7 +1382,6 @@ declare class RepositoryDescriptor<T extends TObject = TObject> extends Descript
1375
1382
  col: PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>;
1376
1383
  type: TSchema;
1377
1384
  };
1378
- protected $provider(): DatabaseProvider;
1379
1385
  }
1380
1386
  /**
1381
1387
  * The options for a statement.
@@ -1399,9 +1405,15 @@ interface StatementOptions {
1399
1405
  /**
1400
1406
  * Force the current time.
1401
1407
  */
1402
- now?: DateTime;
1408
+ now?: DateTime | string;
1403
1409
  }
1404
1410
  //#endregion
1411
+ //#region src/descriptors/$repository.d.ts
1412
+ /**
1413
+ * Get the repository for the given entity.
1414
+ */
1415
+ declare const $repository: <T extends TObject>(entity: EntityDescriptor<T>) => Repository<T>;
1416
+ //#endregion
1405
1417
  //#region src/descriptors/$transaction.d.ts
1406
1418
  /**
1407
1419
  * Creates a transaction descriptor for database operations requiring atomicity and consistency.
@@ -1519,25 +1531,25 @@ interface TransactionDescriptorOptions<T extends any[], R> {
1519
1531
  * }
1520
1532
  * ```
1521
1533
  */
1522
- config?: PgTransactionConfig$1;
1534
+ config?: PgTransactionConfig;
1523
1535
  }
1524
1536
  type TransactionContext = PgTransaction<any, any, any>;
1525
1537
  //#endregion
1526
1538
  //#region src/errors/PgConflictError.d.ts
1527
- declare class PgConflictError extends PgError {
1539
+ declare class PgConflictError extends DbError {
1528
1540
  readonly name = "PgConflictError";
1529
1541
  readonly status = 409;
1530
1542
  }
1531
1543
  //#endregion
1532
1544
  //#region src/errors/PgEntityNotFoundError.d.ts
1533
- declare class PgEntityNotFoundError extends PgError {
1545
+ declare class PgEntityNotFoundError extends DbError {
1534
1546
  readonly name = "EntityNotFoundError";
1535
1547
  readonly status = 404;
1536
1548
  constructor(entityName: string);
1537
1549
  }
1538
1550
  //#endregion
1539
1551
  //#region src/errors/PgMigrationError.d.ts
1540
- declare class PgMigrationError extends PgError {
1552
+ declare class PgMigrationError extends DbError {
1541
1553
  readonly name = "PgMigrationError";
1542
1554
  constructor(cause?: unknown);
1543
1555
  }
@@ -1548,56 +1560,69 @@ declare class PgMigrationError extends PgError {
1548
1560
  * It's thrown by {@link RepositoryDescriptor#save} when the updated entity version does not match the one in the database.
1549
1561
  * This is used for optimistic concurrency control.
1550
1562
  */
1551
- declare class PgVersionMismatchError extends PgError {
1563
+ declare class PgVersionMismatchError extends DbError {
1552
1564
  readonly name = "PgVersionMismatchError";
1553
1565
  constructor(table: string, id: any);
1554
1566
  }
1555
1567
  //#endregion
1556
- //#region src/providers/DrizzleKitProvider.d.ts
1557
- declare class DrizzleKitProvider {
1558
- protected readonly log: _alepha_logger0.Logger;
1559
- protected readonly alepha: Alepha;
1560
- /**
1561
- * Synchronize database with current schema definitions.
1562
- *
1563
- * In development mode, it will generate and execute migrations based on the current state.
1564
- * In testing mode, it will generate migrations from scratch without applying them.
1565
- *
1566
- * Does nothing in production mode, you must handle migrations manually.
1567
- */
1568
- synchronize(provider: DatabaseProvider): Promise<void>;
1569
- /**
1570
- * Mostly used for testing purposes. You can generate SQL migration statements without executing them.
1571
- */
1572
- generateMigration(provider: DatabaseProvider, prevSnapshot?: any): Promise<{
1573
- statements: string[];
1574
- models: Record<string, unknown>;
1575
- snapshot?: any;
1576
- }>;
1577
- /**
1578
- * Load all tables, enums, sequences, etc. from the provider's repositories.
1579
- */
1580
- getModels(provider: DatabaseProvider): Record<string, unknown>;
1581
- /**
1582
- * Load the migration snapshot from the database.
1583
- */
1584
- protected loadDevMigrations(provider: DatabaseProvider): Promise<DevMigrations | undefined>;
1585
- protected saveDevMigrations(provider: DatabaseProvider, curr: Record<string, any>, devMigrations?: DevMigrations): Promise<void>;
1586
- protected executeStatements(statements: string[], provider: DatabaseProvider, catchErrors?: boolean): Promise<void>;
1587
- protected createSchemaIfNotExists(provider: DatabaseProvider, schemaName: string): Promise<void>;
1588
- /**
1589
- * Try to load the official Drizzle Kit API.
1590
- * If not available, fallback to the local kit import.
1591
- */
1592
- protected importDrizzleKit(): typeof DrizzleKit;
1593
- }
1594
- declare const devMigrationsSchema: typebox11.TObject<{
1595
- id: typebox11.TNumber;
1596
- name: typebox11.TString;
1597
- snapshot: typebox11.TString;
1598
- created_at: typebox11.TString;
1599
- }>;
1600
- type DevMigrations = Static<typeof devMigrationsSchema>;
1568
+ //#region src/helpers/parseQueryString.d.ts
1569
+ /**
1570
+ * Parse a string query into a PgQueryWhere object.
1571
+ *
1572
+ * Supported syntax:
1573
+ * - Simple equality: "name=John"
1574
+ * - Operators: "age>18", "age>=18", "age<65", "age<=65", "status!=active"
1575
+ * - LIKE patterns: "name~John" (like), "name~*John" (ilike)
1576
+ * - NULL checks: "deletedAt=null", "email!=null"
1577
+ * - IN arrays: "status=[pending,active]"
1578
+ * - AND conditions: "name=John&age>18"
1579
+ * - OR conditions: "name=John|email=john@example.com"
1580
+ * - Nested AND/OR: "(name=John|name=Jane)&age>18"
1581
+ * - JSONB nested: "profile.city=Paris"
1582
+ *
1583
+ * @example
1584
+ * ```ts
1585
+ * // Simple equality
1586
+ * parseQueryString("name=John")
1587
+ * // => { name: { eq: "John" } }
1588
+ *
1589
+ * // Multiple conditions
1590
+ * parseQueryString("name=John&age>18")
1591
+ * // => { and: [{ name: { eq: "John" } }, { age: { gt: 18 } }] }
1592
+ *
1593
+ * // OR conditions
1594
+ * parseQueryString("status=active|status=pending")
1595
+ * // => { or: [{ status: { eq: "active" } }, { status: { eq: "pending" } }] }
1596
+ *
1597
+ * // Complex nested
1598
+ * parseQueryString("(name=John|name=Jane)&age>18&status!=archived")
1599
+ * // => { and: [
1600
+ * // { or: [{ name: { eq: "John" } }, { name: { eq: "Jane" } }] },
1601
+ * // { age: { gt: 18 } },
1602
+ * // { status: { ne: "archived" } }
1603
+ * // ] }
1604
+ *
1605
+ * // JSONB nested query
1606
+ * parseQueryString("profile.city=Paris&profile.age>25")
1607
+ * // => { profile: { city: { eq: "Paris" }, age: { gt: 25 } } }
1608
+ * ```
1609
+ */
1610
+ declare function parseQueryString<T extends TObject>(query: string): PgQueryWhere<T>;
1611
+ /**
1612
+ * Helper function to build query strings programmatically
1613
+ *
1614
+ * @example
1615
+ * ```ts
1616
+ * buildQueryString({
1617
+ * and: [
1618
+ * { name: "eq:John" },
1619
+ * { age: "gt:18" }
1620
+ * ]
1621
+ * })
1622
+ * // => "name=John&age>18"
1623
+ * ```
1624
+ */
1625
+ declare function buildQueryString(where: any): string;
1601
1626
  //#endregion
1602
1627
  //#region src/services/PostgresModelBuilder.d.ts
1603
1628
  declare class PostgresModelBuilder extends ModelBuilder {
@@ -1653,53 +1678,43 @@ declare const envSchema: _alepha_core10.TObject<{
1653
1678
  * It will monkey patch drizzle tables.
1654
1679
  */
1655
1680
  POSTGRES_SCHEMA: _alepha_core10.TOptional<_alepha_core10.TString>;
1656
- /**
1657
- * Synchronize the database schema with the models.
1658
- * It uses a custom implementation, it's not related to `drizzle-kit push` command.
1659
- * It will generate the migration script and save it to the DB.
1660
- *
1661
- * This is recommended for development and testing purposes only.
1662
- */
1663
- POSTGRES_SYNCHRONIZE: _alepha_core10.TOptional<_alepha_core10.TBoolean>;
1664
1681
  }>;
1665
- interface NodePostgresProviderOptions {
1666
- migrations: MigrationConfig;
1667
- connection: postgres.Options<any>;
1668
- }
1669
1682
  declare class NodePostgresProvider extends DatabaseProvider {
1670
1683
  static readonly SSL_MODES: readonly ["require", "allow", "prefer", "verify-full"];
1671
- readonly dialect = "postgres";
1672
- protected readonly log: _alepha_logger0.Logger;
1684
+ protected readonly log: _alepha_logger2.Logger;
1673
1685
  protected readonly env: {
1674
1686
  DATABASE_URL?: string | undefined;
1675
1687
  POSTGRES_SCHEMA?: string | undefined;
1676
- POSTGRES_SYNCHRONIZE?: boolean | undefined;
1677
1688
  };
1678
- protected readonly alepha: Alepha;
1679
1689
  protected readonly kit: DrizzleKitProvider;
1680
1690
  protected readonly builder: PostgresModelBuilder;
1681
1691
  protected client?: postgres.Sql;
1682
1692
  protected pg?: PostgresJsDatabase;
1683
- readonly options: NodePostgresProviderOptions;
1693
+ readonly dialect = "postgresql";
1694
+ get name(): string;
1684
1695
  /**
1685
1696
  * In testing mode, the schema name will be generated and deleted after the test.
1686
1697
  */
1687
1698
  protected schemaForTesting: string | undefined;
1699
+ get url(): string;
1700
+ /**
1701
+ * Execute a SQL statement.
1702
+ */
1688
1703
  execute(statement: SQLLike): Promise<Array<Record<string, unknown>>>;
1689
1704
  /**
1690
- * Get Postgres schema.
1705
+ * Get Postgres schema used by this provider.
1691
1706
  */
1692
1707
  get schema(): string;
1708
+ /**
1709
+ * Get the Drizzle Postgres database instance.
1710
+ */
1693
1711
  get db(): PostgresJsDatabase;
1712
+ protected executeMigrations(migrationsFolder: string): Promise<void>;
1694
1713
  protected readonly onStart: _alepha_core10.HookDescriptor<"start">;
1695
1714
  protected readonly onStop: _alepha_core10.HookDescriptor<"stop">;
1696
1715
  connect(): Promise<void>;
1697
1716
  close(): Promise<void>;
1698
1717
  protected migrate: _alepha_lock0.LockDescriptor<() => Promise<void>>;
1699
- /**
1700
- * Generate a minimal migration configuration.
1701
- */
1702
- protected getMigrationOptions(): MigrationConfig;
1703
1718
  /**
1704
1719
  * Map the DATABASE_URL to postgres client options.
1705
1720
  */
@@ -1713,6 +1728,199 @@ declare class NodePostgresProvider extends DatabaseProvider {
1713
1728
  protected generateTestSchemaName(): string;
1714
1729
  }
1715
1730
  //#endregion
1731
+ //#region src/services/SqliteModelBuilder.d.ts
1732
+ declare class SqliteModelBuilder extends ModelBuilder {
1733
+ buildTable(entity: EntityDescriptor<any>, options: {
1734
+ tables: Map<string, unknown>;
1735
+ enums: Map<string, unknown>;
1736
+ schema: string;
1737
+ }): void;
1738
+ buildSequence(sequence: SequenceDescriptor, options: {
1739
+ sequences: Map<string, unknown>;
1740
+ schema: string;
1741
+ }): void;
1742
+ /**
1743
+ * Get SQLite-specific config builder for the table.
1744
+ */
1745
+ protected getTableConfig(entity: EntityDescriptor, tables: Map<string, unknown>): ((self: BuildColumns<string, any, "sqlite">) => any) | undefined;
1746
+ schemaToSqliteColumns: <T extends TObject>(tableName: string, schema: T, enums: Map<string, unknown>, tables: Map<string, unknown>) => SchemaToSqliteBuilder<T>;
1747
+ 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<{
1748
+ name: string;
1749
+ dataType: "custom";
1750
+ columnType: "SQLiteCustomColumn";
1751
+ data: string;
1752
+ driverParam: string;
1753
+ enumValues: undefined;
1754
+ }>, string> | pg$1.SQLiteCustomColumnBuilder<{
1755
+ name: string;
1756
+ dataType: "custom";
1757
+ columnType: "SQLiteCustomColumn";
1758
+ data: string;
1759
+ driverParam: number;
1760
+ enumValues: undefined;
1761
+ }> | pg$1.SQLiteCustomColumnBuilder<{
1762
+ name: string;
1763
+ dataType: "custom";
1764
+ columnType: "SQLiteCustomColumn";
1765
+ data: boolean;
1766
+ driverParam: number;
1767
+ enumValues: undefined;
1768
+ }> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1769
+ name: string;
1770
+ dataType: "custom";
1771
+ columnType: "SQLiteCustomColumn";
1772
+ data: {
1773
+ [x: string]: unknown;
1774
+ [x: number]: unknown;
1775
+ [x: symbol]: unknown;
1776
+ };
1777
+ driverParam: string;
1778
+ enumValues: undefined;
1779
+ }>, {
1780
+ [x: string]: unknown;
1781
+ [x: number]: unknown;
1782
+ [x: symbol]: unknown;
1783
+ }> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1784
+ name: string;
1785
+ dataType: "custom";
1786
+ columnType: "SQLiteCustomColumn";
1787
+ data: Record<string, unknown>;
1788
+ driverParam: string;
1789
+ enumValues: undefined;
1790
+ }>, Record<string, unknown>> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1791
+ name: string;
1792
+ dataType: "custom";
1793
+ columnType: "SQLiteCustomColumn";
1794
+ data: any;
1795
+ driverParam: string;
1796
+ enumValues: undefined;
1797
+ }>, any> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1798
+ name: string;
1799
+ dataType: "custom";
1800
+ columnType: "SQLiteCustomColumn";
1801
+ data: unknown[];
1802
+ driverParam: string;
1803
+ enumValues: undefined;
1804
+ }>, unknown[]>;
1805
+ mapStringToSqliteColumn: (key: string, value: TString) => pg$1.SQLiteTextBuilderInitial<string, [string, ...string[]], number | undefined> | drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1806
+ name: string;
1807
+ dataType: "custom";
1808
+ columnType: "SQLiteCustomColumn";
1809
+ data: string;
1810
+ driverParam: string;
1811
+ enumValues: undefined;
1812
+ }>, string> | pg$1.SQLiteCustomColumnBuilder<{
1813
+ name: string;
1814
+ dataType: "custom";
1815
+ columnType: "SQLiteCustomColumn";
1816
+ data: string;
1817
+ driverParam: number;
1818
+ enumValues: undefined;
1819
+ }>;
1820
+ sqliteJson: <TDocument extends TSchema>(name: string, document: TDocument) => drizzle_orm0.$Type<pg$1.SQLiteCustomColumnBuilder<{
1821
+ name: string;
1822
+ dataType: "custom";
1823
+ columnType: "SQLiteCustomColumn";
1824
+ data: typebox7.StaticType<[], "Decode", {}, {}, TDocument>;
1825
+ driverParam: string;
1826
+ enumValues: undefined;
1827
+ }>, typebox7.StaticType<[], "Decode", {}, {}, TDocument>>;
1828
+ sqliteDateTime: {
1829
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1830
+ name: "";
1831
+ dataType: "custom";
1832
+ columnType: "SQLiteCustomColumn";
1833
+ data: string;
1834
+ driverParam: number;
1835
+ enumValues: undefined;
1836
+ }>;
1837
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1838
+ name: TName;
1839
+ dataType: "custom";
1840
+ columnType: "SQLiteCustomColumn";
1841
+ data: string;
1842
+ driverParam: number;
1843
+ enumValues: undefined;
1844
+ }>;
1845
+ };
1846
+ sqliteBool: {
1847
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1848
+ name: "";
1849
+ dataType: "custom";
1850
+ columnType: "SQLiteCustomColumn";
1851
+ data: boolean;
1852
+ driverParam: number;
1853
+ enumValues: undefined;
1854
+ }>;
1855
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1856
+ name: TName;
1857
+ dataType: "custom";
1858
+ columnType: "SQLiteCustomColumn";
1859
+ data: boolean;
1860
+ driverParam: number;
1861
+ enumValues: undefined;
1862
+ }>;
1863
+ };
1864
+ sqliteDate: {
1865
+ <TConfig extends Record<string, any>>(fieldConfig: TConfig): pg$1.SQLiteCustomColumnBuilder<{
1866
+ name: "";
1867
+ dataType: "custom";
1868
+ columnType: "SQLiteCustomColumn";
1869
+ data: string;
1870
+ driverParam: number;
1871
+ enumValues: undefined;
1872
+ }>;
1873
+ <TName extends string>(dbName: TName, fieldConfig: unknown): pg$1.SQLiteCustomColumnBuilder<{
1874
+ name: TName;
1875
+ dataType: "custom";
1876
+ columnType: "SQLiteCustomColumn";
1877
+ data: string;
1878
+ driverParam: number;
1879
+ enumValues: undefined;
1880
+ }>;
1881
+ };
1882
+ }
1883
+ type SchemaToSqliteBuilder<T extends TObject> = { [key in keyof T["properties"]]: SQLiteColumnBuilderBase };
1884
+ //#endregion
1885
+ //#region src/providers/drivers/NodeSqliteProvider.d.ts
1886
+ /**
1887
+ * Configuration options for the Node.js SQLite database provider.
1888
+ */
1889
+ declare const nodeSqliteOptions: _alepha_core10.Atom<typebox7.TObject<{
1890
+ path: typebox7.TOptional<typebox7.TString>;
1891
+ }>, "alepha.postgres.node-sqlite.options">;
1892
+ type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
1893
+ declare module "alepha" {
1894
+ interface State {
1895
+ [nodeSqliteOptions.key]: NodeSqliteProviderOptions;
1896
+ }
1897
+ }
1898
+ /**
1899
+ * Add a fake support for SQLite in Node.js based on Postgres interfaces.
1900
+ *
1901
+ * This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
1902
+ * This is NOT recommended for production use.
1903
+ */
1904
+ declare class NodeSqliteProvider extends DatabaseProvider {
1905
+ protected readonly kit: DrizzleKitProvider;
1906
+ protected readonly log: _alepha_logger2.Logger;
1907
+ protected readonly env: {
1908
+ DATABASE_URL?: string | undefined;
1909
+ };
1910
+ protected readonly builder: SqliteModelBuilder;
1911
+ protected readonly options: Readonly<{
1912
+ path?: string | undefined;
1913
+ }>;
1914
+ protected sqlite: DatabaseSync;
1915
+ get name(): string;
1916
+ readonly dialect = "sqlite";
1917
+ get url(): string;
1918
+ execute(query: SQLLike): Promise<Array<Record<string, unknown>>>;
1919
+ readonly db: PgDatabase<any>;
1920
+ protected readonly onStart: _alepha_core10.HookDescriptor<"start">;
1921
+ protected executeMigrations(migrationsFolder: string): Promise<void>;
1922
+ }
1923
+ //#endregion
1716
1924
  //#region src/providers/PostgresTypeProvider.d.ts
1717
1925
  declare class PostgresTypeProvider {
1718
1926
  readonly attr: <T extends TSchema, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
@@ -1758,17 +1966,17 @@ declare class PostgresTypeProvider {
1758
1966
  /**
1759
1967
  * Creates a column Created At. So just a datetime column with a default value of the current timestamp.
1760
1968
  */
1761
- readonly createdAt: (options?: TStringOptions) => PgAttr<PgAttr<typebox11.TCodec<TString, dayjs0.Dayjs>, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1969
+ readonly createdAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1762
1970
  /**
1763
1971
  * Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
1764
1972
  */
1765
- readonly updatedAt: (options?: TStringOptions) => PgAttr<PgAttr<typebox11.TCodec<TString, dayjs0.Dayjs>, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1973
+ readonly updatedAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1766
1974
  /**
1767
1975
  * Creates a column Deleted At for soft delete functionality.
1768
1976
  * This is used to mark rows as deleted without actually removing them from the database.
1769
1977
  * The column is nullable - NULL means not deleted, timestamp means deleted.
1770
1978
  */
1771
- readonly deletedAt: (options?: TStringOptions) => PgAttr<typebox11.TOptional<typebox11.TCodec<TString, dayjs0.Dayjs>>, typeof PG_DELETED_AT>;
1979
+ readonly deletedAt: (options?: TStringOptions) => PgAttr<typebox7.TOptional<TString>, typeof PG_DELETED_AT>;
1772
1980
  /**
1773
1981
  * Creates a Postgres ENUM type.
1774
1982
  *
@@ -1796,11 +2004,19 @@ declare class PostgresTypeProvider {
1796
2004
  }
1797
2005
  declare const pg: PostgresTypeProvider;
1798
2006
  //#endregion
2007
+ //#region src/providers/RepositoryProvider.d.ts
2008
+ declare class RepositoryProvider {
2009
+ protected readonly alepha: Alepha;
2010
+ protected readonly registry: Map<EntityDescriptor<any>, Service<Repository<any>>>;
2011
+ getRepositories(provider?: DatabaseProvider): Repository<TObject<typebox7.TProperties>>[];
2012
+ createClassRepository<T extends TObject>(entity: EntityDescriptor<T>): Service<Repository<T>>;
2013
+ }
2014
+ //#endregion
1799
2015
  //#region src/schemas/legacyIdSchema.d.ts
1800
2016
  /**
1801
2017
  * @deprecated Use `pg.primaryKey()` instead.
1802
2018
  */
1803
- declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<typebox11.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
2019
+ declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<typebox7.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1804
2020
  //#endregion
1805
2021
  //#region src/types/schema.d.ts
1806
2022
  /**
@@ -1810,12 +2026,78 @@ declare const schema: <TDocument extends TSchema>(name: string, document: TDocum
1810
2026
  name: string;
1811
2027
  dataType: "custom";
1812
2028
  columnType: "PgCustomColumn";
1813
- data: typebox11.StaticType<[], "Decode", {}, {}, TDocument>;
2029
+ data: typebox7.StaticType<[], "Decode", {}, {}, TDocument>;
1814
2030
  driverParam: string;
1815
2031
  enumValues: undefined;
1816
- }>, typebox11.StaticType<[], "Decode", {}, {}, TDocument>>;
2032
+ }>, typebox7.StaticType<[], "Decode", {}, {}, TDocument>>;
1817
2033
  //#endregion
1818
2034
  //#region src/index.d.ts
2035
+ declare module "alepha" {
2036
+ interface Hooks {
2037
+ /**
2038
+ * Fires before creating an entity in the repository.
2039
+ */
2040
+ "repository:create:before": {
2041
+ tableName: string;
2042
+ data: any;
2043
+ };
2044
+ /**
2045
+ * Fires after creating an entity in the repository.
2046
+ */
2047
+ "repository:create:after": {
2048
+ tableName: string;
2049
+ data: any;
2050
+ entity: any;
2051
+ };
2052
+ /**
2053
+ * Fires before updating entities in the repository.
2054
+ */
2055
+ "repository:update:before": {
2056
+ tableName: string;
2057
+ where: any;
2058
+ data: any;
2059
+ };
2060
+ /**
2061
+ * Fires after updating entities in the repository.
2062
+ */
2063
+ "repository:update:after": {
2064
+ tableName: string;
2065
+ where: any;
2066
+ data: any;
2067
+ entities: any[];
2068
+ };
2069
+ /**
2070
+ * Fires before deleting entities from the repository.
2071
+ */
2072
+ "repository:delete:before": {
2073
+ tableName: string;
2074
+ where: any;
2075
+ };
2076
+ /**
2077
+ * Fires after deleting entities from the repository.
2078
+ */
2079
+ "repository:delete:after": {
2080
+ tableName: string;
2081
+ where: any;
2082
+ ids: Array<string | number>;
2083
+ };
2084
+ /**
2085
+ * Fires before reading entities from the repository.
2086
+ */
2087
+ "repository:read:before": {
2088
+ tableName: string;
2089
+ query: any;
2090
+ };
2091
+ /**
2092
+ * Fires after reading entities from the repository.
2093
+ */
2094
+ "repository:read:after": {
2095
+ tableName: string;
2096
+ query: any;
2097
+ entities: any[];
2098
+ };
2099
+ }
2100
+ }
1819
2101
  /**
1820
2102
  * Postgres client based on Drizzle ORM, Alepha type-safe friendly.
1821
2103
  *
@@ -1855,7 +2137,7 @@ declare const schema: <TDocument extends TSchema>(name: string, document: TDocum
1855
2137
  * @see {@link $transaction}
1856
2138
  * @module alepha.postgres
1857
2139
  */
1858
- declare const AlephaPostgres: _alepha_core10.Service<_alepha_core10.Module<{}>>;
2140
+ declare const AlephaPostgres: _alepha_core10.Service<_alepha_core10.Module>;
1859
2141
  //#endregion
1860
- export { $entity, $repository, $sequence, $transaction, AlephaPostgres, DatabaseProvider, DrizzleKitProvider, EntityColumn, EntityColumns, EntityDescriptor, EntityDescriptorOptions, FilterOperators, FromSchema, NodePostgresProvider, NodePostgresProviderOptions, 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, PageQuery, PgAttr, PgAttrField, PgConflictError, PgDefault, PgEntityNotFoundError, PgEnumOptions, PgError, PgIdentityOptions, PgMigrationError, PgPrimaryKey, PgQuery, PgQueryRelations, PgQueryWhere, PgQueryWhereOrSQL, PgRef, PgRefOptions, PgRelation, PgRelationMap, PgStatic, PgSymbolKeys, PgSymbols, PgVersionMismatchError, PostgresTypeProvider, RepositoryDescriptor, RepositoryDescriptorOptions, SQLLike, SchemaToTableConfig, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TObjectInsert, TObjectUpdate, type TPage, TransactionContext, TransactionDescriptorOptions, drizzle_orm0 as drizzle, getAttrFields, insertSchema, legacyIdSchema, pageQuerySchema, pageSchema, pg, pgAttr, schema, sql, updateSchema };
2142
+ 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 };
1861
2143
  //# sourceMappingURL=index.d.ts.map