alepha 0.8.0 → 0.9.0

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/LICENSE +21 -21
  2. package/README.md +47 -44
  3. package/batch.d.ts +87 -88
  4. package/bucket.cjs +8 -0
  5. package/bucket.d.ts +194 -0
  6. package/bucket.js +1 -0
  7. package/cache/redis.d.ts +14 -16
  8. package/cache.d.ts +101 -170
  9. package/command.d.ts +70 -77
  10. package/core.d.ts +1043 -887
  11. package/datetime.d.ts +91 -117
  12. package/file.cjs +8 -0
  13. package/file.d.ts +56 -0
  14. package/file.js +1 -0
  15. package/lock/redis.d.ts +11 -13
  16. package/lock.d.ts +125 -117
  17. package/package.json +66 -38
  18. package/postgres.d.ts +232 -275
  19. package/queue/redis.d.ts +13 -15
  20. package/queue.d.ts +88 -116
  21. package/react/auth.d.ts +50 -55
  22. package/react/head.d.ts +5 -8
  23. package/react.d.ts +71 -73
  24. package/redis.d.ts +32 -14
  25. package/retry.d.ts +70 -58
  26. package/router.cjs +8 -0
  27. package/router.d.ts +45 -0
  28. package/router.js +1 -0
  29. package/scheduler.d.ts +54 -96
  30. package/security.d.ts +117 -119
  31. package/server/cache.d.ts +22 -31
  32. package/server/compress.d.ts +16 -7
  33. package/server/cookies.d.ts +70 -61
  34. package/server/cors.d.ts +15 -13
  35. package/server/health.d.ts +23 -26
  36. package/server/helmet.d.ts +17 -20
  37. package/server/links.d.ts +113 -90
  38. package/server/metrics.d.ts +25 -23
  39. package/server/multipart.d.ts +12 -16
  40. package/server/proxy.d.ts +25 -20
  41. package/server/security.cjs +8 -0
  42. package/server/security.d.ts +90 -0
  43. package/server/security.js +1 -0
  44. package/server/static.d.ts +67 -68
  45. package/server/swagger.d.ts +77 -65
  46. package/server.d.ts +265 -308
  47. package/topic/redis.d.ts +25 -26
  48. package/topic.d.ts +76 -122
  49. package/vite.d.ts +52 -36
package/postgres.d.ts CHANGED
@@ -1,26 +1,28 @@
1
- import * as _alepha_core56 from "alepha";
2
- import * as _alepha_core20 from "alepha";
3
- import * as _alepha_core22 from "alepha";
4
- import { Alepha, KIND, Module, OPTIONS, Static, TObject, TSchema as TSchema$1 } from "alepha";
5
- import * as drizzle_orm3 from "drizzle-orm";
6
- import * as drizzle_orm8 from "drizzle-orm";
7
- import * as drizzle_orm2 from "drizzle-orm";
1
+ import * as _alepha_core24 from "alepha";
2
+ import * as _alepha_core0$1 from "alepha";
3
+ import * as _alepha_core1 from "alepha";
4
+ import * as _alepha_core0 from "alepha";
5
+ import { Alepha, Descriptor, KIND, Service, Static, TObject, TSchema as TSchema$1 } from "alepha";
6
+ import * as drizzle_orm7 from "drizzle-orm";
7
+ import * as drizzle_orm0$1 from "drizzle-orm";
8
+ import * as drizzle_orm0 from "drizzle-orm";
8
9
  import * as drizzle from "drizzle-orm";
9
10
  import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, TableConfig, sql } from "drizzle-orm";
10
- import * as _alepha_lock45 from "alepha/lock";
11
- import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
12
- import postgres from "postgres";
13
11
  import * as pg$1 from "drizzle-orm/pg-core";
14
- import * as drizzle_orm_pg_core13 from "drizzle-orm/pg-core";
15
- import * as drizzle_orm_pg_core1 from "drizzle-orm/pg-core";
12
+ import * as drizzle_orm_pg_core0$1 from "drizzle-orm/pg-core";
13
+ import * as drizzle_orm_pg_core4 from "drizzle-orm/pg-core";
14
+ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
16
15
  import { AnyPgColumn, AnyPgTable, LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, PgTransactionConfig, TableConfig as TableConfig$1, UpdateDeleteAction } from "drizzle-orm/pg-core";
17
- import * as _alepha_retry19 from "alepha/retry";
18
- import * as _sinclair_typebox75 from "@sinclair/typebox";
19
- import * as _sinclair_typebox85 from "@sinclair/typebox";
20
- import * as _sinclair_typebox88 from "@sinclair/typebox";
21
- import * as _sinclair_typebox82 from "@sinclair/typebox";
22
- import * as _sinclair_typebox58 from "@sinclair/typebox";
23
- import * as _sinclair_typebox49 from "@sinclair/typebox";
16
+ import * as _alepha_lock0 from "alepha/lock";
17
+ import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
18
+ import postgres from "postgres";
19
+ import * as _alepha_retry0 from "alepha/retry";
20
+ import * as _sinclair_typebox9 from "@sinclair/typebox";
21
+ import * as _sinclair_typebox17 from "@sinclair/typebox";
22
+ import * as _sinclair_typebox18 from "@sinclair/typebox";
23
+ import * as _sinclair_typebox16 from "@sinclair/typebox";
24
+ import * as _sinclair_typebox6 from "@sinclair/typebox";
25
+ import * as _sinclair_typebox0 from "@sinclair/typebox";
24
26
  import { Evaluate, IntegerOptions, Kind, NumberOptions, ObjectOptions, OptionalKind, Static as Static$1, StringOptions, TAdditionalProperties, TArray, TBoolean, TInteger, TIntersect, TObject as TObject$1, TOptional, TOptionalWithFlag, TPick, TProperties, TReadonly, TRecord, TSchema as TSchema$2 } from "@sinclair/typebox";
25
27
  import { PgTransactionConfig as PgTransactionConfig$1 } from "drizzle-orm/pg-core/session";
26
28
  import * as DrizzleKit from "drizzle-kit/api";
@@ -28,6 +30,10 @@ import { MigrationConfig } from "drizzle-orm/migrator";
28
30
  import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
29
31
  export * from "drizzle-orm/pg-core";
30
32
 
33
+ //#region src/constants/PG_SCHEMA.d.ts
34
+ declare const PG_SCHEMA: unique symbol;
35
+ //# sourceMappingURL=PG_SCHEMA.d.ts.map
36
+ //#endregion
31
37
  //#region src/constants/PG_SYMBOLS.d.ts
32
38
  declare const PG_DEFAULT: unique symbol;
33
39
  declare const PG_PRIMARY_KEY: unique symbol;
@@ -116,14 +122,14 @@ declare const schemaToPgColumns: <T extends TObject>(schema: T) => FromSchema<T>
116
122
  * @param value The value of the field.
117
123
  * @returns The PG column.
118
124
  */
119
- declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSerialBuilderInitial<string> | pg$1.PgIntegerBuilderInitial<string> | drizzle_orm3.IsIdentity<pg$1.PgBigInt53BuilderInitial<"">, "always"> | pg$1.PgNumericBuilderInitial<string> | pg$1.PgTimestampBuilderInitial<string> | pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
125
+ declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSerialBuilderInitial<string> | pg$1.PgIntegerBuilderInitial<string> | drizzle_orm7.IsIdentity<pg$1.PgBigInt53BuilderInitial<"">, "always"> | pg$1.PgNumericBuilderInitial<string> | pg$1.PgTimestampBuilderInitial<string> | pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
120
126
  name: string;
121
127
  dataType: "custom";
122
128
  columnType: "PgCustomColumn";
123
129
  data: Buffer<ArrayBufferLike>;
124
130
  driverParam: unknown;
125
131
  enumValues: undefined;
126
- }> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]> | pg$1.PgBooleanBuilderInitial<string> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
132
+ }> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]> | pg$1.PgBooleanBuilderInitial<string> | drizzle_orm7.$Type<pg$1.PgCustomColumnBuilder<{
127
133
  name: string;
128
134
  dataType: "custom";
129
135
  columnType: "PgCustomColumn";
@@ -136,14 +142,14 @@ declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSeria
136
142
  }>, {
137
143
  [x: string]: unknown;
138
144
  [x: number]: unknown;
139
- }> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
145
+ }> | drizzle_orm7.$Type<pg$1.PgCustomColumnBuilder<{
140
146
  name: string;
141
147
  dataType: "custom";
142
148
  columnType: "PgCustomColumn";
143
149
  data: {};
144
150
  driverParam: string;
145
151
  enumValues: undefined;
146
- }>, {}> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
152
+ }>, {}> | drizzle_orm7.$Type<pg$1.PgCustomColumnBuilder<{
147
153
  name: string;
148
154
  dataType: "custom";
149
155
  columnType: "PgCustomColumn";
@@ -275,6 +281,87 @@ interface TableLike<T extends TObject = TObject> {
275
281
  }
276
282
  //# sourceMappingURL=schemaToPgColumns.d.ts.map
277
283
  //#endregion
284
+ //#region src/descriptors/$entity.d.ts
285
+ /**
286
+ * Creates a table descriptor for drizzle-orm.
287
+ */
288
+ declare const $entity: {
289
+ <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(options: EntityDescriptorOptions<TTableName, TSchema>): PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
290
+ [KIND]: string;
291
+ };
292
+ interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1, Keys = keyof Static$1<T>> {
293
+ /**
294
+ * The name of the table. This is the name that will be used in the database.
295
+ * @example
296
+ * name: "user"
297
+ */
298
+ name: TTableName;
299
+ /**
300
+ * The schema of the table. This is a TypeBox schema that describes the columns and their types.
301
+ * @example
302
+ * schema: t.object({
303
+ * id: t.uuid(),
304
+ * name: t.string(),
305
+ * email: t.string(),
306
+ * phoneNumber: t.string(),
307
+ * })
308
+ */
309
+ schema: T;
310
+ /**
311
+ * The indexes to create for the table. This can be a string or an object with the column name and options.
312
+ * @example
313
+ * indexes: ["name", { column: "email", unique: true }]
314
+ */
315
+ indexes?: (Keys | {
316
+ column: Keys;
317
+ unique?: boolean;
318
+ name?: string;
319
+ } | {
320
+ columns: Keys[];
321
+ unique?: boolean;
322
+ name?: string;
323
+ })[];
324
+ relations?: Record<string, {
325
+ type: "one" | "many";
326
+ table: () => any;
327
+ foreignColumn?: keyof Static$1<T>;
328
+ }>;
329
+ foreignKeys?: Array<{
330
+ name?: string;
331
+ columns: Array<keyof Static$1<T>>;
332
+ foreignColumns: Array<AnyPgColumn>;
333
+ }>;
334
+ constraints?: Array<{
335
+ columns: Array<keyof Static$1<T>>;
336
+ name?: string;
337
+ unique?: boolean | {};
338
+ check?: SQL;
339
+ }>;
340
+ /**
341
+ * Extra configuration for the table. See drizzle-orm documentation for more details.
342
+ *
343
+ * @param self The table descriptor.
344
+ * @returns The extra configuration for the table.
345
+ */
346
+ config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
347
+ }
348
+ type Entity<T extends TObject$1> = PgTableWithColumnsAndSchema<PgTableConfig<string, T, FromSchema<T>>, T>;
349
+ /**
350
+ * Create a table with a json schema.
351
+ *
352
+ * @param name The name of the table.
353
+ * @param schema The json schema of the table.
354
+ * @param extraConfig Extra configuration for the table.
355
+ */
356
+ declare const pgTableSchema: <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(name: TTableName, schema: TSchema, extraConfig?: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, "pg">) => PgTableExtraConfigValue[]) => PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
357
+ type PgTableConfig<TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>> = {
358
+ name: TTableName;
359
+ schema: any;
360
+ columns: BuildColumns<TTableName, TColumnsMap, "pg">;
361
+ dialect: "pg";
362
+ };
363
+ //# sourceMappingURL=$entity.d.ts.map
364
+ //#endregion
278
365
  //#region src/helpers/nullToUndefined.d.ts
279
366
  /**
280
367
  * Replaces all null values in an object with undefined.
@@ -778,10 +865,10 @@ declare abstract class PostgresProvider {
778
865
  //# sourceMappingURL=PostgresProvider.d.ts.map
779
866
  //#endregion
780
867
  //#region src/schemas/pageQuerySchema.d.ts
781
- declare const pageQuerySchema: _sinclair_typebox75.TObject<{
782
- page: _sinclair_typebox75.TOptional<_sinclair_typebox75.TNumber>;
783
- size: _sinclair_typebox75.TOptional<_sinclair_typebox75.TNumber>;
784
- sort: _sinclair_typebox75.TOptional<_sinclair_typebox75.TString>;
868
+ declare const pageQuerySchema: _sinclair_typebox9.TObject<{
869
+ page: _sinclair_typebox9.TOptional<_sinclair_typebox9.TNumber>;
870
+ size: _sinclair_typebox9.TOptional<_sinclair_typebox9.TNumber>;
871
+ sort: _sinclair_typebox9.TOptional<_sinclair_typebox9.TString>;
785
872
  }>;
786
873
  type PageQuery = Static<typeof pageQuerySchema>;
787
874
  //# sourceMappingURL=pageQuerySchema.d.ts.map
@@ -824,19 +911,32 @@ type Page<T> = {
824
911
  };
825
912
  //# sourceMappingURL=pageSchema.d.ts.map
826
913
  //#endregion
827
- //#region src/services/Repository.d.ts
828
- declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTableSchema extends TObject$1> {
914
+ //#region src/descriptors/$repository.d.ts
915
+ /**
916
+ *
917
+ */
918
+ declare const $repository: {
919
+ <EntityTableConfig extends TableConfig, EntitySchema extends TObject$1>(optionsOrTable: RepositoryDescriptorOptions<EntityTableConfig, EntitySchema> | PgTableWithColumnsAndSchema<EntityTableConfig, EntitySchema>): RepositoryDescriptor<EntityTableConfig, EntitySchema>;
920
+ [KIND]: typeof RepositoryDescriptor;
921
+ };
922
+ interface RepositoryDescriptorOptions<EntityTableConfig extends TableConfig, EntitySchema extends TObject$1> {
923
+ /**
924
+ * The table to create the repository for.
925
+ */
926
+ table: PgTableWithColumnsAndSchema<EntityTableConfig, EntitySchema>;
927
+ /**
928
+ * Override default provider.
929
+ */
930
+ provider?: Service<PostgresProvider>;
931
+ }
932
+ declare class RepositoryDescriptor<EntityTableConfig extends TableConfig, EntitySchema extends TObject$1> extends Descriptor<RepositoryDescriptorOptions<EntityTableConfig, EntitySchema>> {
829
933
  readonly provider: PostgresProvider;
830
934
  protected readonly alepha: Alepha;
935
+ readonly schema: EntitySchema;
936
+ readonly insertSchema: TInsertObject<EntitySchema>;
831
937
  protected readonly env: {
832
938
  POSTGRES_PAGINATION_COUNT_ENABLED: boolean;
833
939
  };
834
- static of: <TEntity extends TableConfig$1, TTableSchema_1 extends TObject$1>(opts: PgTableWithColumnsAndSchema<TEntity, TTableSchema_1>) => (new () => Repository<PgTableWithColumns<TEntity>, TTableSchema_1>);
835
- /**
836
- * Register Repository as a valid descriptor.
837
- * - Required for $repository to work.
838
- */
839
- [KIND]: string;
840
940
  /**
841
941
  * Represents the primary key of the table.
842
942
  * - Key is the name of the primary key column.
@@ -846,33 +946,13 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
846
946
  */
847
947
  readonly id: {
848
948
  type: TSchema$2;
849
- key: keyof TTableSchema["properties"];
949
+ key: keyof EntitySchema["properties"];
850
950
  col: PgColumn;
851
951
  };
852
- [OPTIONS]: {
853
- table: TTable;
854
- schema: TTableSchema;
855
- };
856
- readonly options: {
857
- table: TTable;
858
- schema: TTableSchema;
859
- };
860
- constructor(options: {
861
- table: TTable;
862
- schema: TTableSchema;
863
- });
864
- /**
865
- * Get the table schema.
866
- */
867
- get schema(): TTableSchema;
868
- /**
869
- * Get the insert schema.
870
- */
871
- get insertSchema(): TInsertObject<TTableSchema>;
872
952
  /**
873
953
  * Get Drizzle table object.
874
954
  */
875
- get table(): TTable;
955
+ get table(): PgTableWithColumns<EntityTableConfig>;
876
956
  /**
877
957
  * Get SQL table name. (from Drizzle table object)
878
958
  */
@@ -880,7 +960,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
880
960
  /**
881
961
  * Getter for the database connection from the database provider.
882
962
  */
883
- protected get db(): PgDatabase<any, Record<string, never>, drizzle_orm8.ExtractTablesWithRelations<Record<string, never>>>;
963
+ protected get db(): PgDatabase<any, Record<string, never>, drizzle_orm0$1.ExtractTablesWithRelations<Record<string, never>>>;
884
964
  protected organization(): PgColumn;
885
965
  /**
886
966
  * Execute a SQL query.
@@ -888,14 +968,14 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
888
968
  * @param query
889
969
  * @param schema
890
970
  */
891
- execute<T extends TObject$1 = TTableSchema>(query: SQLLike | ((table: TTable, db: PgDatabase<any>) => SQLLike), schema?: T): Promise<Static$1<T>[]>;
971
+ execute<T extends TObject$1 = EntitySchema>(query: SQLLike | ((table: PgTableWithColumns<EntityTableConfig>, db: PgDatabase<any>) => SQLLike), schema?: T): Promise<Static$1<T>[]>;
892
972
  /**
893
973
  * Get a Drizzle column from the table by his name.
894
974
  *
895
975
  * @param name - The name of the column to get.
896
976
  * @returns The column from the table.
897
977
  */
898
- protected col(name: keyof TTable["_"]["columns"]): PgColumn;
978
+ protected col(name: keyof PgTableWithColumns<EntityTableConfig>["_"]["columns"]): PgColumn;
899
979
  /**
900
980
  * Run a transaction.
901
981
  *
@@ -908,29 +988,29 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
908
988
  *
909
989
  * @returns The SELECT query builder.
910
990
  */
911
- protected select(opts?: StatementOptions): drizzle_orm_pg_core13.PgSelectBase<string, Record<string, PgColumn<drizzle_orm8.ColumnBaseConfig<drizzle_orm8.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
991
+ protected select(opts?: StatementOptions): drizzle_orm_pg_core0$1.PgSelectBase<string, Record<string, PgColumn<drizzle_orm0$1.ColumnBaseConfig<drizzle_orm0$1.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
912
992
  [x: string]: unknown;
913
993
  }[], {
914
- [x: string]: PgColumn<drizzle_orm8.ColumnBaseConfig<drizzle_orm8.ColumnDataType, string>, {}, {}>;
994
+ [x: string]: PgColumn<drizzle_orm0$1.ColumnBaseConfig<drizzle_orm0$1.ColumnDataType, string>, {}, {}>;
915
995
  }>;
916
996
  /**
917
997
  * Start an INSERT query on the table.
918
998
  *
919
999
  * @returns The INSERT query builder.
920
1000
  */
921
- protected insert(opts?: StatementOptions): drizzle_orm_pg_core13.PgInsertBuilder<TTable, any, false>;
1001
+ protected insert(opts?: StatementOptions): drizzle_orm_pg_core0$1.PgInsertBuilder<PgTableWithColumns<EntityTableConfig>, any, false>;
922
1002
  /**
923
1003
  * Start an UPDATE query on the table.
924
1004
  *
925
1005
  * @returns The UPDATE query builder.
926
1006
  */
927
- protected update(opts?: StatementOptions): drizzle_orm_pg_core13.PgUpdateBuilder<TTable, any>;
1007
+ protected update(opts?: StatementOptions): drizzle_orm_pg_core0$1.PgUpdateBuilder<PgTableWithColumns<EntityTableConfig>, any>;
928
1008
  /**
929
1009
  * Start a DELETE query on the table.
930
1010
  *
931
1011
  * @returns The DELETE query builder.
932
1012
  */
933
- protected delete(opts?: StatementOptions): drizzle_orm_pg_core13.PgDeleteBase<TTable, any, undefined, undefined, false, never>;
1013
+ protected delete(opts?: StatementOptions): drizzle_orm_pg_core0$1.PgDeleteBase<PgTableWithColumns<EntityTableConfig>, any, undefined, undefined, false, never>;
934
1014
  /**
935
1015
  * Find entities.
936
1016
  *
@@ -938,7 +1018,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
938
1018
  * @param opts The statement options.
939
1019
  * @returns The found entities.
940
1020
  */
941
- find<Select extends (keyof Static$1<TTableSchema>)[]>(query?: PgQuery<TTableSchema, Select>, opts?: StatementOptions): Promise<Static$1<PgQueryResult<TTableSchema, Select>>[]>;
1021
+ find<Select extends (keyof Static$1<EntitySchema>)[]>(query?: PgQuery<EntitySchema, Select>, opts?: StatementOptions): Promise<Static$1<PgQueryResult<EntitySchema, Select>>[]>;
942
1022
  /**
943
1023
  * Find a single entity.
944
1024
  *
@@ -946,14 +1026,14 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
946
1026
  * @param opts The statement options.
947
1027
  * @returns The found entity.
948
1028
  */
949
- findOne<T extends Static$1<TTableSchema> = Static$1<TTableSchema>>(where: PgQueryWhere<T>, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
1029
+ findOne<T extends Static$1<EntitySchema> = Static$1<EntitySchema>>(where: PgQueryWhere<T>, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
950
1030
  /**
951
1031
  * Find an entity by ID.
952
1032
  *
953
1033
  * @param id
954
1034
  * @param opts
955
1035
  */
956
- findById(id: string | number, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
1036
+ findById(id: string | number, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
957
1037
  /**
958
1038
  * Paginate entities.
959
1039
  *
@@ -962,9 +1042,9 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
962
1042
  * @param opts The statement options.
963
1043
  * @returns The paginated entities.
964
1044
  */
965
- paginate(pageQuery?: PageQuery, findQuery?: PgQuery<TTableSchema>, opts?: StatementOptions): Promise<Page<Static$1<TTableSchema>>>;
966
- createQuery(query?: PgQuery<TTableSchema>): PgQuery<TTableSchema>;
967
- createQueryWhere(where?: PgQueryWhere<Static$1<TTableSchema>>): PgQueryWhere<Static$1<TTableSchema>>;
1045
+ paginate(pageQuery?: PageQuery, findQuery?: PgQuery<EntitySchema>, opts?: StatementOptions): Promise<Page<Static$1<EntitySchema>>>;
1046
+ createQuery(query?: PgQuery<EntitySchema>): PgQuery<EntitySchema>;
1047
+ createQueryWhere(where?: PgQueryWhere<Static$1<EntitySchema>>): PgQueryWhere<Static$1<EntitySchema>>;
968
1048
  /**
969
1049
  * Create an entity.
970
1050
  *
@@ -972,7 +1052,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
972
1052
  * @param opts The options for creating the entity.
973
1053
  * @returns The ID of the created entity.
974
1054
  */
975
- create(data: InferInsert<TTableSchema>, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
1055
+ create(data: InferInsert<EntitySchema>, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
976
1056
  /**
977
1057
  * Create many entities.
978
1058
  *
@@ -980,7 +1060,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
980
1060
  * @param opts The statement options.
981
1061
  * @returns The created entities.
982
1062
  */
983
- createMany(values: Array<InferInsert<TTableSchema>>, opts?: StatementOptions): Promise<Static$1<TTableSchema>[]>;
1063
+ createMany(values: Array<InferInsert<EntitySchema>>, opts?: StatementOptions): Promise<Static$1<EntitySchema>[]>;
984
1064
  /**
985
1065
  * Update an entity.
986
1066
  *
@@ -989,10 +1069,10 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
989
1069
  * @param opts The statement options.
990
1070
  * @returns The updated entity.
991
1071
  */
992
- updateOne(query: PgQueryWhere<Static$1<TTableSchema>>, data: Partial<NullifyIfOptional<Static$1<TTableSchema>>> | {
993
- $append: Partial<NullifyIfOptional<Static$1<TTableSchema>>>;
994
- }, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
995
- save(data: InferInsert<TTableSchema>, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
1072
+ updateOne(query: PgQueryWhere<Static$1<EntitySchema>>, data: Partial<NullifyIfOptional<Static$1<EntitySchema>>> | {
1073
+ $append: Partial<NullifyIfOptional<Static$1<EntitySchema>>>;
1074
+ }, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
1075
+ save(data: InferInsert<EntitySchema>, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
996
1076
  /**
997
1077
  * Update an entity by ID.
998
1078
  *
@@ -1000,7 +1080,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1000
1080
  * @param data
1001
1081
  * @param opts
1002
1082
  */
1003
- updateById(id: string | number, data: Partial<NullifyIfOptional<Static$1<TTableSchema>>>, opts?: StatementOptions): Promise<Static$1<TTableSchema>>;
1083
+ updateById(id: string | number, data: Partial<NullifyIfOptional<Static$1<EntitySchema>>>, opts?: StatementOptions): Promise<Static$1<EntitySchema>>;
1004
1084
  /**
1005
1085
  * Update entities.
1006
1086
  *
@@ -1009,14 +1089,14 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1009
1089
  * @param opts The statement options.
1010
1090
  * @returns The updated entities.
1011
1091
  */
1012
- updateMany(where: PgQueryWhere<Static$1<TTableSchema>>, data: Partial<NullifyIfOptional<Static$1<TTableSchema>>>, opts?: StatementOptions): Promise<Static$1<TTableSchema>[]>;
1092
+ updateMany(where: PgQueryWhere<Static$1<EntitySchema>>, data: Partial<NullifyIfOptional<Static$1<EntitySchema>>>, opts?: StatementOptions): Promise<Static$1<EntitySchema>[]>;
1013
1093
  /**
1014
1094
  * Delete entities.
1015
1095
  *
1016
1096
  * @param where Query.
1017
1097
  * @param opts The statement options.
1018
1098
  */
1019
- deleteMany(where?: PgQueryWhere<Static$1<TTableSchema>>, opts?: StatementOptions): Promise<void>;
1099
+ deleteMany(where?: PgQueryWhere<Static$1<EntitySchema>>, opts?: StatementOptions): Promise<void>;
1020
1100
  /**
1021
1101
  * Delete all entities.
1022
1102
  * @param opts
@@ -1036,7 +1116,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1036
1116
  * @param opts The statement options.
1037
1117
  * @returns The count of entities.
1038
1118
  */
1039
- count(where?: PgQueryWhere<Static$1<TTableSchema>>, opts?: StatementOptions): Promise<number>;
1119
+ count(where?: PgQueryWhere<Static$1<EntitySchema>>, opts?: StatementOptions): Promise<number>;
1040
1120
  /**
1041
1121
  * Convert a query object to a SQL query.
1042
1122
  *
@@ -1044,7 +1124,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1044
1124
  * @param schema The schema to use.
1045
1125
  * @param col The column to use.
1046
1126
  */
1047
- protected jsonQueryToSql(query: PgQueryWhere<Static$1<TTableSchema>>, schema?: TObject$1, col?: (key: string) => PgColumn): SQL | undefined;
1127
+ protected jsonQueryToSql(query: PgQueryWhere<Static$1<EntitySchema>>, schema?: TObject$1, col?: (key: string) => PgColumn): SQL | undefined;
1048
1128
  /**
1049
1129
  * Map a filter operator to a SQL query.
1050
1130
  *
@@ -1060,11 +1140,11 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1060
1140
  * @param limit The limit of the pagination.
1061
1141
  * @param offset The offset of the pagination.
1062
1142
  */
1063
- protected createPagination(entities: Static$1<TTableSchema>[], limit?: number, offset?: number): Page<Static$1<TTableSchema>>;
1143
+ protected createPagination(entities: Static$1<EntitySchema>[], limit?: number, offset?: number): Page<Static$1<EntitySchema>>;
1064
1144
  /**
1065
1145
  * Convert something to valid Pg Insert Value.
1066
1146
  */
1067
- protected cast(data: any, insert: boolean): PgInsertValue<TTable>;
1147
+ protected cast(data: any, insert: boolean): PgInsertValue<PgTableWithColumns<EntityTableConfig>>;
1068
1148
  /**
1069
1149
  * Clean a row. Remove all null values.
1070
1150
  *
@@ -1072,14 +1152,14 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1072
1152
  * @param schema The schema to use.
1073
1153
  * @returns The cleaned row.
1074
1154
  */
1075
- protected clean<T extends TObject$1 = TTableSchema>(row: any, schema?: T): Static$1<T>;
1155
+ protected clean<T extends TObject$1 = EntitySchema>(row: any, schema?: T): Static$1<T>;
1076
1156
  /**
1077
1157
  * Get the where clause for an ID.
1078
1158
  *
1079
1159
  * @param id The ID to get the where clause for.
1080
1160
  * @returns The where clause for the ID.
1081
1161
  */
1082
- protected getWhereId(id: string | number): PgQueryWhere<Static$1<TTableSchema>>;
1162
+ protected getWhereId(id: string | number): PgQueryWhere<Static$1<EntitySchema>>;
1083
1163
  /**
1084
1164
  * Find a primary key in the schema.
1085
1165
  *
@@ -1088,7 +1168,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1088
1168
  */
1089
1169
  protected getPrimaryKey(schema: TObject$1): {
1090
1170
  key: string;
1091
- col: PgColumn<drizzle_orm8.ColumnBaseConfig<drizzle_orm8.ColumnDataType, string>, {}, {}>;
1171
+ col: PgColumn<drizzle_orm0$1.ColumnBaseConfig<drizzle_orm0$1.ColumnDataType, string>, {}, {}>;
1092
1172
  type: TSchema$2;
1093
1173
  };
1094
1174
  }
@@ -1122,127 +1202,13 @@ interface PgAttrField {
1122
1202
  data: any;
1123
1203
  nested?: any[];
1124
1204
  }
1125
- //# sourceMappingURL=Repository.d.ts.map
1126
- //#endregion
1127
- //#region src/constants/PG_SCHEMA.d.ts
1128
- declare const PG_SCHEMA: unique symbol;
1129
- //# sourceMappingURL=PG_SCHEMA.d.ts.map
1130
-
1131
- //#endregion
1132
- //#region src/descriptors/$db.d.ts
1133
- type DbDescriptorOptions<T extends {
1134
- [key: string]: TableLike;
1135
- }> = {
1136
- entities?: T;
1137
- };
1138
- type DbDescriptor<T extends {
1139
- [key: string]: TableLike;
1140
- }> = { [key in keyof T]: Repository<any, T[key]["$schema"]> } & Pick<PostgresProvider, "execute">;
1141
- declare const $db: <T extends {
1142
- [key: string]: TableLike;
1143
- }>(options?: DbDescriptorOptions<T>) => DbDescriptor<T>;
1144
- //# sourceMappingURL=$db.d.ts.map
1145
- //#endregion
1146
- //#region src/descriptors/$entity.d.ts
1147
- interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1, Keys = keyof Static$1<T>> {
1148
- /**
1149
- * The name of the table. This is the name that will be used in the database.
1150
- * @example
1151
- * name: "user"
1152
- */
1153
- name: TTableName;
1154
- /**
1155
- * The schema of the table. This is a TypeBox schema that describes the columns and their types.
1156
- * @example
1157
- * schema: t.object({
1158
- * id: t.uuid(),
1159
- * name: t.string(),
1160
- * email: t.string(),
1161
- * phoneNumber: t.string(),
1162
- * })
1163
- */
1164
- schema: T;
1165
- /**
1166
- * The indexes to create for the table. This can be a string or an object with the column name and options.
1167
- * @example
1168
- * indexes: ["name", { column: "email", unique: true }]
1169
- */
1170
- indexes?: (Keys | {
1171
- column: Keys;
1172
- unique?: boolean;
1173
- name?: string;
1174
- } | {
1175
- columns: Keys[];
1176
- unique?: boolean;
1177
- name?: string;
1178
- })[];
1179
- relations?: Record<string, {
1180
- type: "one" | "many";
1181
- table: () => any;
1182
- foreignColumn?: keyof Static$1<T>;
1183
- }>;
1184
- foreignKeys?: Array<{
1185
- name?: string;
1186
- columns: Array<keyof Static$1<T>>;
1187
- foreignColumns: Array<AnyPgColumn>;
1188
- }>;
1189
- constraints?: Array<{
1190
- columns: Array<keyof Static$1<T>>;
1191
- name?: string;
1192
- unique?: boolean | {};
1193
- check?: SQL;
1194
- }>;
1195
- /**
1196
- * Extra configuration for the table. See drizzle-orm documentation for more details.
1197
- *
1198
- * @param self The table descriptor.
1199
- * @returns The extra configuration for the table.
1200
- */
1201
- config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
1202
- }
1203
- /**
1204
- * Creates a table descriptor for drizzle-orm.
1205
- */
1206
- declare const $entity: <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(options: EntityDescriptorOptions<TTableName, TSchema>) => PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
1207
- type Entity<T extends TObject$1> = PgTableWithColumnsAndSchema<PgTableConfig<string, T, FromSchema<T>>, T>;
1208
- /**
1209
- * Create a table with a json schema.
1210
- *
1211
- * @param name The name of the table.
1212
- * @param schema The json schema of the table.
1213
- * @param extraConfig Extra configuration for the table.
1214
- */
1215
- declare const pgTableSchema: <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(name: TTableName, schema: TSchema, extraConfig?: (self: BuildExtraConfigColumns<TTableName, TColumnsMap, "pg">) => PgTableExtraConfigValue[]) => PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
1216
- type PgTableConfig<TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>> = {
1217
- name: TTableName;
1218
- schema: any;
1219
- columns: BuildColumns<TTableName, TColumnsMap, "pg">;
1220
- dialect: "pg";
1221
- };
1222
- //# sourceMappingURL=$entity.d.ts.map
1223
- //#endregion
1224
- //#region src/descriptors/$repository.d.ts
1225
- interface RepositoryDescriptorOptions<TEntity extends TableConfig, TSchema extends TObject> {
1226
- /**
1227
- * The table to create the repository for.
1228
- */
1229
- table: PgTableWithColumnsAndSchema<TEntity, TSchema>;
1230
- /**
1231
- * Override default provider.
1232
- */
1233
- provider?: () => PostgresProvider;
1234
- }
1235
- /**
1236
- * @param optionsOrTable
1237
- */
1238
- declare const $repository: {
1239
- <TEntity extends TableConfig, TSchema extends TObject>(optionsOrTable: RepositoryDescriptorOptions<TEntity, TSchema> | PgTableWithColumnsAndSchema<TEntity, TSchema>): Repository<PgTableWithColumnsAndSchema<TEntity, TSchema>, TSchema>;
1240
- [KIND]: string;
1241
- };
1242
1205
  //# sourceMappingURL=$repository.d.ts.map
1243
1206
  //#endregion
1244
1207
  //#region src/descriptors/$sequence.d.ts
1245
- declare const KEY = "SEQUENCE";
1208
+ declare const $sequence: {
1209
+ (options?: SequenceDescriptorOptions): SequenceDescriptor;
1210
+ [KIND]: typeof SequenceDescriptor;
1211
+ };
1246
1212
  interface SequenceDescriptorOptions {
1247
1213
  name?: string;
1248
1214
  start?: number;
@@ -1251,25 +1217,26 @@ interface SequenceDescriptorOptions {
1251
1217
  max?: number;
1252
1218
  cycle?: boolean;
1253
1219
  }
1254
- interface SequenceDescriptor {
1255
- [KIND]: typeof KEY;
1256
- [OPTIONS]: SequenceDescriptorOptions;
1257
- (): Promise<number>;
1220
+ declare class SequenceDescriptor extends Descriptor<SequenceDescriptorOptions> {
1221
+ protected readonly provider: PostgresProvider;
1222
+ protected created: boolean;
1223
+ get name(): string;
1224
+ protected create(): Promise<void>;
1258
1225
  next(): Promise<number>;
1259
1226
  current(): Promise<number>;
1260
1227
  }
1261
- declare const $sequence: {
1262
- (options?: SequenceDescriptorOptions): SequenceDescriptor;
1263
- [KIND]: string;
1264
- };
1228
+ //# sourceMappingURL=$sequence.d.ts.map
1265
1229
  //#endregion
1266
1230
  //#region src/descriptors/$transaction.d.ts
1231
+ /**
1232
+ *
1233
+ */
1234
+ declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry0.RetryDescriptorFn<(...args: T) => Promise<R>>;
1267
1235
  interface TransactionDescriptorOptions<T extends any[], R> {
1268
1236
  handler: (tx: PgTransaction<any, any, any>, ...args: T) => Promise<R>;
1269
1237
  config?: PgTransactionConfig$1;
1270
1238
  }
1271
1239
  type TransactionContext = PgTransaction<any, any, any>;
1272
- declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry19.RetryDescriptor<(...args: T) => Promise<R>>;
1273
1240
  //# sourceMappingURL=$transaction.d.ts.map
1274
1241
  //#endregion
1275
1242
  //#region src/errors/EntityNotFoundError.d.ts
@@ -1282,46 +1249,33 @@ declare class EntityNotFoundError extends Error {
1282
1249
  //#endregion
1283
1250
  //#region src/providers/RepositoryDescriptorProvider.d.ts
1284
1251
  declare class RepositoryDescriptorProvider {
1285
- protected readonly log: _alepha_core56.Logger;
1252
+ protected readonly log: _alepha_core24.Logger;
1286
1253
  protected readonly alepha: Alepha;
1287
- protected readonly repositories: Array<Repository<any, TObject$1>>;
1254
+ get repositories(): RepositoryDescriptor<TableConfig$1, TObject$1>[];
1288
1255
  constructor();
1289
1256
  clearRepositories(): Promise<void>;
1290
- protected readonly configure: _alepha_core56.HookDescriptor<"configure">;
1291
1257
  /**
1292
1258
  * Get all repositories.
1293
1259
  *
1294
1260
  * @param provider - Filter by provider.
1295
1261
  */
1296
- getRepositories(provider?: PostgresProvider): Repository<PgTableWithColumns<TableConfig$1>, TObject$1>[];
1262
+ getRepositories(provider?: PostgresProvider): RepositoryDescriptor<TableConfig$1, TObject$1>[];
1297
1263
  /**
1298
1264
  * Get all tables from the repositories.
1299
1265
  *
1300
1266
  * @param provider
1301
1267
  */
1302
- getTables(provider?: PostgresProvider): PgTableWithColumns<TableConfig$1>[];
1268
+ getTables(provider?: PostgresProvider): drizzle_orm_pg_core4.PgTableWithColumns<TableConfig$1>[];
1303
1269
  /**
1304
1270
  * Get all providers from the repositories.
1305
1271
  */
1306
1272
  getProviders(): PostgresProvider[];
1307
- /**
1308
- * Process all descriptors.
1309
- *
1310
- * @protected
1311
- */
1312
- protected processDescriptors(): Promise<void>;
1313
- /**
1314
- * Get all models from the repository descriptors.
1315
- *
1316
- * By models, we mean the tables.
1317
- */
1318
- protected processRepositoryDescriptors(): Promise<void>;
1319
1273
  }
1320
1274
  //# sourceMappingURL=RepositoryDescriptorProvider.d.ts.map
1321
1275
  //#endregion
1322
1276
  //#region src/providers/DrizzleKitProvider.d.ts
1323
1277
  declare class DrizzleKitProvider {
1324
- protected readonly log: _alepha_core20.Logger;
1278
+ protected readonly log: _alepha_core0$1.Logger;
1325
1279
  protected readonly alepha: Alepha;
1326
1280
  protected readonly repositoryProvider: RepositoryDescriptorProvider;
1327
1281
  push(provider: PostgresProvider, schema?: string): Promise<void>;
@@ -1360,37 +1314,37 @@ declare module "alepha" {
1360
1314
  interface Env extends Partial<Static<typeof envSchema>> {}
1361
1315
  }
1362
1316
  declare const envSchema: TObject$1<{
1363
- PG_HOST: _alepha_core22.TOptional<_alepha_core22.TString>;
1364
- PG_USERNAME: _alepha_core22.TOptional<_alepha_core22.TString>;
1365
- PG_DATABASE: _alepha_core22.TOptional<_alepha_core22.TString>;
1366
- PG_PASSWORD: _alepha_core22.TOptional<_alepha_core22.TString>;
1367
- PG_PORT: _alepha_core22.TOptional<_alepha_core22.TNumber>;
1368
- DATABASE_URL: _alepha_core22.TOptional<_alepha_core22.TString>;
1369
- DATABASE_MIGRATIONS_FOLDER: _alepha_core22.TString;
1317
+ PG_HOST: _alepha_core1.TOptional<_alepha_core1.TString>;
1318
+ PG_USERNAME: _alepha_core1.TOptional<_alepha_core1.TString>;
1319
+ PG_DATABASE: _alepha_core1.TOptional<_alepha_core1.TString>;
1320
+ PG_PASSWORD: _alepha_core1.TOptional<_alepha_core1.TString>;
1321
+ PG_PORT: _alepha_core1.TOptional<_alepha_core1.TNumber>;
1322
+ DATABASE_URL: _alepha_core1.TOptional<_alepha_core1.TString>;
1323
+ DATABASE_MIGRATIONS_FOLDER: _alepha_core1.TString;
1370
1324
  /**
1371
1325
  * The schema to use.
1372
1326
  * Accept a string.
1373
1327
  */
1374
- POSTGRES_SCHEMA: _alepha_core22.TOptional<_alepha_core22.TString>;
1328
+ POSTGRES_SCHEMA: _alepha_core1.TOptional<_alepha_core1.TString>;
1375
1329
  /**
1376
1330
  * Synchronize the database schema with the models.
1377
1331
  * Accept a boolean or a postgres schema name.
1378
1332
  *
1379
1333
  * @default false
1380
1334
  */
1381
- POSTGRES_SYNCHRONIZE: _alepha_core22.TOptional<_alepha_core22.TBoolean>;
1335
+ POSTGRES_SYNCHRONIZE: _alepha_core1.TOptional<_alepha_core1.TBoolean>;
1382
1336
  /**
1383
1337
  * Push the schema to the database.
1384
1338
  *
1385
1339
  * @default false
1386
1340
  */
1387
- POSTGRES_PUSH_SCHEMA: _alepha_core22.TOptional<_alepha_core22.TBoolean>;
1341
+ POSTGRES_PUSH_SCHEMA: _alepha_core1.TOptional<_alepha_core1.TBoolean>;
1388
1342
  /**
1389
1343
  * Reject unauthorized SSL connections.
1390
1344
  *
1391
1345
  * @default false
1392
1346
  */
1393
- POSTGRES_REJECT_UNAUTHORIZED: _alepha_core22.TBoolean;
1347
+ POSTGRES_REJECT_UNAUTHORIZED: _alepha_core1.TBoolean;
1394
1348
  }>;
1395
1349
  interface NodePostgresProviderState {
1396
1350
  client: postgres.Sql;
@@ -1398,14 +1352,14 @@ interface NodePostgresProviderState {
1398
1352
  }
1399
1353
  declare class NodePostgresProvider extends PostgresProvider {
1400
1354
  readonly dialect = "postgres";
1401
- protected readonly log: _alepha_core22.Logger;
1355
+ protected readonly log: _alepha_core1.Logger;
1402
1356
  protected readonly env: {
1403
- DATABASE_URL?: string | undefined;
1404
1357
  PG_HOST?: string | undefined;
1405
1358
  PG_USERNAME?: string | undefined;
1406
1359
  PG_DATABASE?: string | undefined;
1407
1360
  PG_PASSWORD?: string | undefined;
1408
1361
  PG_PORT?: number | undefined;
1362
+ DATABASE_URL?: string | undefined;
1409
1363
  POSTGRES_SCHEMA?: string | undefined;
1410
1364
  POSTGRES_SYNCHRONIZE?: boolean | undefined;
1411
1365
  POSTGRES_PUSH_SCHEMA?: boolean | undefined;
@@ -1420,8 +1374,8 @@ declare class NodePostgresProvider extends PostgresProvider {
1420
1374
  */
1421
1375
  protected testingSchemaName?: string;
1422
1376
  get db(): PostgresJsDatabase;
1423
- protected readonly configure: _alepha_core22.HookDescriptor<"start">;
1424
- protected readonly stop: _alepha_core22.HookDescriptor<"stop">;
1377
+ protected readonly configure: _alepha_core1.HookDescriptor<"start">;
1378
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
1425
1379
  /**
1426
1380
  * Get Postgres schema.
1427
1381
  */
@@ -1429,7 +1383,7 @@ declare class NodePostgresProvider extends PostgresProvider {
1429
1383
  execute<T extends TObject$1 = any>(query: SQLLike, schema?: T): Promise<Array<T extends TObject$1 ? Static<T> : any>>;
1430
1384
  connect(): Promise<void>;
1431
1385
  close(): Promise<void>;
1432
- protected migrate: _alepha_lock45.LockDescriptor<() => Promise<void>>;
1386
+ protected migrate: _alepha_lock0.LockDescriptor<() => Promise<void>>;
1433
1387
  protected createClient(): NodePostgresProviderState;
1434
1388
  protected getMigrationOptions(): MigrationConfig;
1435
1389
  protected getClientOptions(): postgres.Options<any>;
@@ -1444,7 +1398,7 @@ declare class NodePostgresProvider extends PostgresProvider {
1444
1398
  type PgAttr<T extends TSchema$1, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
1445
1399
  //#endregion
1446
1400
  //#region src/schemas/createdAtSchema.d.ts
1447
- declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox85.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1401
+ declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox17.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1448
1402
  //# sourceMappingURL=createdAtSchema.d.ts.map
1449
1403
 
1450
1404
  //#endregion
@@ -1452,11 +1406,11 @@ declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox85.TString, typeof
1452
1406
  /**
1453
1407
  * @deprecated Use `pg.primaryKey()` instead.
1454
1408
  */
1455
- declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<_sinclair_typebox88.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1409
+ declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<_sinclair_typebox18.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1456
1410
  //# sourceMappingURL=legacyIdSchema.d.ts.map
1457
1411
  //#endregion
1458
1412
  //#region src/schemas/updatedAtSchema.d.ts
1459
- declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox82.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1413
+ declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox16.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1460
1414
  //# sourceMappingURL=updatedAtSchema.d.ts.map
1461
1415
 
1462
1416
  //#endregion
@@ -1467,14 +1421,14 @@ declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox82.TString, typeof
1467
1421
  * Add some common SQL properties to an object.
1468
1422
  */
1469
1423
  declare const entitySchema: TObject$1<{
1470
- id: PgAttr<PgAttr<PgAttr<_sinclair_typebox58.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1471
- createdAt: PgAttr<PgAttr<_sinclair_typebox58.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1472
- updatedAt: PgAttr<PgAttr<_sinclair_typebox58.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1424
+ id: PgAttr<PgAttr<PgAttr<_sinclair_typebox6.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1425
+ createdAt: PgAttr<PgAttr<_sinclair_typebox6.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1426
+ updatedAt: PgAttr<PgAttr<_sinclair_typebox6.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1473
1427
  }>;
1474
1428
  /**
1475
1429
  * TypeBox Entity Type.
1476
1430
  */
1477
- type TEntity$1<T extends TProperties> = TObject$1<T & {
1431
+ type TEntity<T extends TProperties> = TObject$1<T & {
1478
1432
  id: typeof legacyIdSchema;
1479
1433
  createdAt: typeof createdAtSchema;
1480
1434
  updatedAt: typeof updatedAtSchema;
@@ -1504,19 +1458,19 @@ declare class PostgresTypeProvider {
1504
1458
  /**
1505
1459
  * Creates a primary key with an identity column.
1506
1460
  */
1507
- readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1461
+ readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox0.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1508
1462
  /**
1509
1463
  * Creates a primary key with a big identity column. (default)
1510
1464
  */
1511
- readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1465
+ readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox0.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1512
1466
  /**
1513
1467
  * Creates a primary key with a UUID column.
1514
1468
  */
1515
- readonly uuidPrimaryKey: () => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1469
+ readonly uuidPrimaryKey: () => PgAttr<PgAttr<_sinclair_typebox0.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1516
1470
  /**
1517
1471
  * @alias bigIdentityPrimaryKey
1518
1472
  */
1519
- readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1473
+ readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox0.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1520
1474
  /**
1521
1475
  * Wrap a schema with "default" attribute.
1522
1476
  * This is used to set a default value for a column in the database.
@@ -1527,19 +1481,19 @@ declare class PostgresTypeProvider {
1527
1481
  * This is used to track the version of a row in the database.
1528
1482
  * You can use it for optimistic concurrency control.
1529
1483
  */
1530
- readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<_sinclair_typebox49.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
1484
+ readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<_sinclair_typebox0.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
1531
1485
  /**
1532
1486
  * Creates a column Created At. So just a datetime column with a default value of the current timestamp.
1533
1487
  */
1534
- readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1488
+ readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox0.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1535
1489
  /**
1536
1490
  * Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
1537
1491
  */
1538
- readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1492
+ readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox0.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1539
1493
  /**
1540
1494
  * @deprecated Build your own entity schema.
1541
1495
  */
1542
- readonly entity: <T extends TProperties>(properties: T, options?: ObjectOptions) => TEntity$1<T>;
1496
+ readonly entity: <T extends TProperties>(properties: T, options?: ObjectOptions) => TEntity<T>;
1543
1497
  /**
1544
1498
  * Creates an insert schema for a given object schema.
1545
1499
  * - pg.default will be optional
@@ -1581,7 +1535,7 @@ declare const pg: PostgresTypeProvider;
1581
1535
  /**
1582
1536
  * Postgres schema type.
1583
1537
  */
1584
- declare const schema: <TDocument extends TSchema$2>(name: string, document: TDocument) => drizzle_orm2.$Type<drizzle_orm_pg_core1.PgCustomColumnBuilder<{
1538
+ declare const schema: <TDocument extends TSchema$2>(name: string, document: TDocument) => drizzle_orm0.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
1585
1539
  name: string;
1586
1540
  dataType: "custom";
1587
1541
  columnType: "PgCustomColumn";
@@ -1597,18 +1551,21 @@ declare const schema: <TDocument extends TSchema$2>(name: string, document: TDoc
1597
1551
 
1598
1552
  //#endregion
1599
1553
  //#region src/index.d.ts
1600
- declare module "alepha" {
1601
- function $inject<T extends TableConfig, R extends TObject>(type: PgTableWithColumnsAndSchema<T, R>): Repository<PgTableWithColumnsAndSchema<T, R>, R>;
1602
- }
1603
- declare class AlephaPostgres implements Module {
1604
- readonly name = "alepha.postgres";
1605
- readonly env: {
1606
- DATABASE_URL: string;
1607
- };
1608
- readonly $services: (alepha: Alepha) => void;
1609
- }
1554
+ /**
1555
+ * Provides PostgreSQL (and SQLite!) database integration with type-safe ORM capabilities through Drizzle.
1556
+ *
1557
+ * The postgres module enables declarative database operations using descriptors like `$entity`, `$repository`.
1558
+ * It offers automatic schema generation, type-safe queries, transactions,
1559
+ * and database migrations with support for PostgreSQLs.
1560
+ *
1561
+ * @see {@link $entity}
1562
+ * @see {@link $repository}
1563
+ * @see {@link $transaction}
1564
+ * @module alepha.postgres
1565
+ */
1566
+ declare const AlephaPostgres: _alepha_core0.ModuleDescriptor;
1610
1567
  //# sourceMappingURL=index.d.ts.map
1611
1568
 
1612
1569
  //#endregion
1613
- export { $db, $entity, $repository, $sequence, $transaction, AlephaPostgres, BaseEntity, BaseEntityKeys, DbDescriptor, DbDescriptorOptions, DrizzleKitProvider, Entity, EntityDescriptorOptions, EntityNotFoundError, ExtractManyRelations, FilterOperators, FromSchema, NodePostgresProvider, NodePostgresProviderState, NullToUndefined, NullifyIfOptional, PG_CREATED_AT, PG_DEFAULT, PG_IDENTITY, PG_MANY, PG_ONE, PG_PRIMARY_KEY, PG_REF, PG_SCHEMA, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, Page, PageQuery, PgAttrField, PgDefault, PgIdentityOptions, PgMany, PgManyOptions, PgPrimaryKey, PgQuery, PgQueryResult, PgQueryWhere, PgQueryWhereWithMany, PgQueryWith, PgQueryWithMap, PgRef, PgRefOptions, PgSymbolKeys, PgSymbols, PgTableConfig, PgTableWithColumnsAndSchema, PostgresProvider, PostgresTypeProvider, RemoveManyRelations, Repository, RepositoryDescriptorOptions, RepositoryDescriptorProvider, SQLLike, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TEntity$1 as TEntity, TInsertObject, TPage, TableLike, TransactionContext, TransactionDescriptorOptions, camelToSnakeCase, drizzle, entityKeys, entitySchema, mapFieldToColumn, mapStringToColumn, nullToUndefined, pageQuerySchema, pageSchema, pg, pgTableSchema, schema, schemaToPgColumns, sql };
1570
+ export { $entity, $repository, $sequence, $transaction, AlephaPostgres, BaseEntity, BaseEntityKeys, DrizzleKitProvider, Entity, EntityDescriptorOptions, EntityNotFoundError, ExtractManyRelations, FilterOperators, FromSchema, NodePostgresProvider, NodePostgresProviderState, NullToUndefined, NullifyIfOptional, PG_CREATED_AT, PG_DEFAULT, PG_IDENTITY, PG_MANY, PG_ONE, PG_PRIMARY_KEY, PG_REF, PG_SCHEMA, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, Page, PageQuery, PgAttrField, PgDefault, PgIdentityOptions, PgMany, PgManyOptions, PgPrimaryKey, PgQuery, PgQueryResult, PgQueryWhere, PgQueryWhereWithMany, PgQueryWith, PgQueryWithMap, PgRef, PgRefOptions, PgSymbolKeys, PgSymbols, PgTableConfig, PgTableWithColumnsAndSchema, PostgresProvider, PostgresTypeProvider, RemoveManyRelations, RepositoryDescriptor, RepositoryDescriptorOptions, RepositoryDescriptorProvider, SQLLike, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TEntity, TInsertObject, TPage, TableLike, TransactionContext, TransactionDescriptorOptions, camelToSnakeCase, drizzle, entityKeys, entitySchema, mapFieldToColumn, mapStringToColumn, nullToUndefined, pageQuerySchema, pageSchema, pg, pgTableSchema, schema, schemaToPgColumns, sql };
1614
1571
  //# sourceMappingURL=index.d.ts.map