alepha 0.7.6 → 0.8.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 (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +44 -44
  3. package/batch.cjs +8 -0
  4. package/batch.d.ts +114 -0
  5. package/batch.js +1 -0
  6. package/cache/redis.d.ts +15 -18
  7. package/cache.d.ts +115 -119
  8. package/command.cjs +8 -0
  9. package/command.d.ts +154 -0
  10. package/command.js +1 -0
  11. package/core.d.ts +800 -795
  12. package/datetime.d.ts +76 -76
  13. package/lock/redis.d.ts +12 -12
  14. package/lock.d.ts +70 -75
  15. package/package.json +102 -29
  16. package/postgres.d.ts +385 -278
  17. package/queue/redis.d.ts +15 -13
  18. package/queue.d.ts +16 -13
  19. package/react/auth.d.ts +16 -16
  20. package/react/head.cjs +8 -0
  21. package/react/head.d.ts +92 -0
  22. package/react/head.js +1 -0
  23. package/react.d.ts +90 -116
  24. package/redis.d.ts +20 -27
  25. package/retry.d.ts +74 -54
  26. package/scheduler.d.ts +14 -13
  27. package/security.d.ts +38 -41
  28. package/server/cache.d.ts +9 -7
  29. package/server/compress.cjs +8 -0
  30. package/server/compress.d.ts +26 -0
  31. package/server/compress.js +1 -0
  32. package/server/cookies.d.ts +71 -14
  33. package/server/cors.cjs +8 -0
  34. package/server/cors.d.ts +29 -0
  35. package/server/cors.js +1 -0
  36. package/server/health.cjs +8 -0
  37. package/server/health.d.ts +42 -0
  38. package/server/health.js +1 -0
  39. package/server/helmet.cjs +8 -0
  40. package/server/helmet.d.ts +72 -0
  41. package/server/helmet.js +1 -0
  42. package/server/links.cjs +8 -0
  43. package/server/links.d.ts +179 -0
  44. package/server/links.js +1 -0
  45. package/server/metrics.cjs +8 -0
  46. package/server/metrics.d.ts +37 -0
  47. package/server/metrics.js +1 -0
  48. package/server/multipart.cjs +8 -0
  49. package/server/multipart.d.ts +48 -0
  50. package/server/multipart.js +1 -0
  51. package/server/proxy.cjs +8 -0
  52. package/server/proxy.d.ts +41 -0
  53. package/server/proxy.js +1 -0
  54. package/server/static.d.ts +63 -51
  55. package/server/swagger.d.ts +50 -50
  56. package/server.d.ts +220 -437
  57. package/topic/redis.d.ts +24 -23
  58. package/topic.d.ts +9 -19
  59. package/vite.d.ts +8 -1
package/postgres.d.ts CHANGED
@@ -1,38 +1,33 @@
1
- import * as _alepha_core40 from "@alepha/core";
2
- import * as _alepha_core3 from "@alepha/core";
3
- import * as _alepha_core25 from "@alepha/core";
4
- import { Alepha, KIND, Module, OPTIONS, Static, TObject } from "@alepha/core";
5
- import * as _alepha_lock29 from "@alepha/lock";
6
- import * as drizzle_orm67 from "drizzle-orm";
7
- import * as drizzle_orm1 from "drizzle-orm";
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";
8
+ import * as drizzle from "drizzle-orm";
8
9
  import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, TableConfig, sql } from "drizzle-orm";
10
+ import * as _alepha_lock45 from "alepha/lock";
9
11
  import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
10
12
  import postgres from "postgres";
11
- import * as drizzle_orm_pg_core72 from "drizzle-orm/pg-core";
12
- import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
13
- import { AnyPgColumn, AnyPgTable, LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSelectJoinFn, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, PgTransactionConfig, TableConfig as TableConfig$1, UpdateDeleteAction } from "drizzle-orm/pg-core";
14
- import * as _alepha_retry2 from "@alepha/retry";
15
- import * as _sinclair_typebox59 from "@sinclair/typebox";
16
- import * as _sinclair_typebox5 from "@sinclair/typebox";
17
- import * as _sinclair_typebox81 from "@sinclair/typebox";
18
- import * as _sinclair_typebox84 from "@sinclair/typebox";
19
- import * as _sinclair_typebox78 from "@sinclair/typebox";
20
- import * as _sinclair_typebox42 from "@sinclair/typebox";
21
- import * as _sinclair_typebox33 from "@sinclair/typebox";
22
- 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$1 } from "@sinclair/typebox";
23
- import { BuildExtraConfigColumns as BuildExtraConfigColumns$1 } from "drizzle-orm/column-builder";
13
+ 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";
16
+ 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";
24
+ 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";
24
25
  import { PgTransactionConfig as PgTransactionConfig$1 } from "drizzle-orm/pg-core/session";
25
26
  import * as DrizzleKit from "drizzle-kit/api";
26
27
  import { MigrationConfig } from "drizzle-orm/migrator";
27
28
  import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
28
29
  export * from "drizzle-orm/pg-core";
29
30
 
30
- //#region src/constants/PG_SCHEMA.d.ts
31
- /**
32
- *
33
- */
34
- declare const PG_SCHEMA: unique symbol;
35
- //#endregion
36
31
  //#region src/constants/PG_SYMBOLS.d.ts
37
32
  declare const PG_DEFAULT: unique symbol;
38
33
  declare const PG_PRIMARY_KEY: unique symbol;
@@ -84,14 +79,13 @@ interface PgRefOptions {
84
79
  onDelete?: UpdateDeleteAction;
85
80
  };
86
81
  }
82
+ //# sourceMappingURL=PG_SYMBOLS.d.ts.map
87
83
  //#endregion
88
84
  //#region src/interfaces/TInsertObject.d.ts
89
85
  /**
90
86
  * Fork of the original typebox schema "TObject".
91
- *
92
- * Expect some breaking changes in the future...
93
87
  */
94
- interface TInsertObject<T extends TObject$1> extends TSchema$1, ObjectOptions {
88
+ interface TInsertObject<T extends TObject$1> extends TSchema$2, ObjectOptions {
95
89
  [Kind]: "Object";
96
90
  static: ObjectStatic<{ [K in keyof T["properties"] as T["properties"][K] extends {
97
91
  [PG_DEFAULT]: any;
@@ -103,27 +97,171 @@ interface TInsertObject<T extends TObject$1> extends TSchema$1, ObjectOptions {
103
97
  [PG_DEFAULT]: any;
104
98
  } ? never : K]: T["properties"][K] };
105
99
  }
106
- type ReadonlyOptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$1> ? T[K] extends TOptional<T[K]> ? K : never : never }[keyof T];
107
- type ReadonlyPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$1> ? T[K] extends TOptional<T[K]> ? never : K : never }[keyof T];
108
- type OptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TOptional<TSchema$1> ? T[K] extends TReadonly<T[K]> ? never : K : never }[keyof T];
100
+ type ReadonlyOptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$2> ? T[K] extends TOptional<T[K]> ? K : never : never }[keyof T];
101
+ type ReadonlyPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$2> ? T[K] extends TOptional<T[K]> ? never : K : never }[keyof T];
102
+ type OptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TOptional<TSchema$2> ? T[K] extends TReadonly<T[K]> ? never : K : never }[keyof T];
109
103
  type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>>;
110
104
  type ObjectStaticProperties<T extends TProperties, R extends Record<keyof any, unknown>> = Evaluate<Readonly<Partial<Pick<R, ReadonlyOptionalPropertyKeys<T>>>> & Readonly<Pick<R, ReadonlyPropertyKeys<T>>> & Partial<Pick<R, OptionalPropertyKeys<T>>> & Required<Pick<R, RequiredPropertyKeys<T>>>>;
111
105
  type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProperties<T, { [K in keyof T]: Static$1<T[K], P> }>;
112
106
  //#endregion
113
- //#region src/helpers/schemaToColumns.d.ts
107
+ //#region src/helpers/schemaToPgColumns.d.ts
114
108
  /**
115
- * Convert a schema to columns.
109
+ * Convert a Typebox Schema to Drizzle ORM Postgres columns (yes)
110
+ */
111
+ declare const schemaToPgColumns: <T extends TObject>(schema: T) => FromSchema<T>;
112
+ /**
113
+ * Map a Typebox field to a PG column.
116
114
  *
117
- * @param schema
115
+ * @param name The key of the field.
116
+ * @param value The value of the field.
117
+ * @returns The PG column.
118
118
  */
119
- declare const schemaToColumns: <T extends TObject>(schema: T) => FromSchema<T>;
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<{
120
+ name: string;
121
+ dataType: "custom";
122
+ columnType: "PgCustomColumn";
123
+ data: Buffer<ArrayBufferLike>;
124
+ driverParam: unknown;
125
+ 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<{
127
+ name: string;
128
+ dataType: "custom";
129
+ columnType: "PgCustomColumn";
130
+ data: {
131
+ [x: string]: unknown;
132
+ [x: number]: unknown;
133
+ };
134
+ driverParam: string;
135
+ enumValues: undefined;
136
+ }>, {
137
+ [x: string]: unknown;
138
+ [x: number]: unknown;
139
+ }> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
140
+ name: string;
141
+ dataType: "custom";
142
+ columnType: "PgCustomColumn";
143
+ data: {};
144
+ driverParam: string;
145
+ enumValues: undefined;
146
+ }>, {}> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
147
+ name: string;
148
+ dataType: "custom";
149
+ columnType: "PgCustomColumn";
150
+ data: unknown[];
151
+ driverParam: string;
152
+ enumValues: undefined;
153
+ }>, unknown[]> | pg$1.PgArrayBuilder<{
154
+ name: string;
155
+ dataType: "array";
156
+ columnType: "PgArray";
157
+ data: string[];
158
+ driverParam: string | string[];
159
+ enumValues: [string, ...string[]];
160
+ size: undefined;
161
+ baseBuilder: {
162
+ name: string;
163
+ dataType: "string";
164
+ columnType: "PgText";
165
+ data: string;
166
+ enumValues: [string, ...string[]];
167
+ driverParam: string;
168
+ };
169
+ }, {
170
+ name: string;
171
+ dataType: "string";
172
+ columnType: "PgText";
173
+ data: string;
174
+ enumValues: [string, ...string[]];
175
+ driverParam: string;
176
+ }> | pg$1.PgArrayBuilder<{
177
+ name: string;
178
+ dataType: "array";
179
+ columnType: "PgArray";
180
+ data: number[];
181
+ driverParam: string | (string | number)[];
182
+ enumValues: undefined;
183
+ size: undefined;
184
+ baseBuilder: {
185
+ name: string;
186
+ dataType: "number";
187
+ columnType: "PgInteger";
188
+ data: number;
189
+ driverParam: number | string;
190
+ enumValues: undefined;
191
+ };
192
+ }, {
193
+ name: string;
194
+ dataType: "number";
195
+ columnType: "PgInteger";
196
+ data: number;
197
+ driverParam: number | string;
198
+ enumValues: undefined;
199
+ }> | pg$1.PgArrayBuilder<{
200
+ name: string;
201
+ dataType: "array";
202
+ columnType: "PgArray";
203
+ data: string[];
204
+ driverParam: string | string[];
205
+ enumValues: undefined;
206
+ size: undefined;
207
+ baseBuilder: {
208
+ name: string;
209
+ dataType: "string";
210
+ columnType: "PgNumeric";
211
+ data: string;
212
+ driverParam: string;
213
+ enumValues: undefined;
214
+ };
215
+ }, {
216
+ name: string;
217
+ dataType: "string";
218
+ columnType: "PgNumeric";
219
+ data: string;
220
+ driverParam: string;
221
+ enumValues: undefined;
222
+ }> | pg$1.PgArrayBuilder<{
223
+ name: string;
224
+ dataType: "array";
225
+ columnType: "PgArray";
226
+ data: boolean[];
227
+ driverParam: string | boolean[];
228
+ enumValues: undefined;
229
+ size: undefined;
230
+ baseBuilder: {
231
+ name: string;
232
+ dataType: "boolean";
233
+ columnType: "PgBoolean";
234
+ data: boolean;
235
+ driverParam: boolean;
236
+ enumValues: undefined;
237
+ };
238
+ }, {
239
+ name: string;
240
+ dataType: "boolean";
241
+ columnType: "PgBoolean";
242
+ data: boolean;
243
+ driverParam: boolean;
244
+ enumValues: undefined;
245
+ }>;
120
246
  /**
121
- * Convert a schema to columns.
247
+ * Map a string to a PG column.
248
+ *
249
+ * @param key The key of the field.
250
+ * @param value The value of the field.
122
251
  */
123
- type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
252
+ declare const mapStringToColumn: (key: string, value: TSchema$1) => pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
253
+ name: string;
254
+ dataType: "custom";
255
+ columnType: "PgCustomColumn";
256
+ data: Buffer<ArrayBufferLike>;
257
+ driverParam: unknown;
258
+ enumValues: undefined;
259
+ }> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]>;
260
+ declare const camelToSnakeCase: (str: string) => string;
124
261
  /**
125
- * The symbol for the schema.
262
+ * Convert a schema to columns.
126
263
  */
264
+ type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
127
265
  /**
128
266
  * A table with columns and schema.
129
267
  */
@@ -132,87 +270,10 @@ type PgTableWithColumnsAndSchema<T extends TableConfig, R extends TObject> = PgT
132
270
  get $schema(): R;
133
271
  get $insertSchema(): TInsertObject<R>;
134
272
  };
135
- //#endregion
136
- //#region src/helpers/pgTableSchema.d.ts
137
- /**
138
- * Create a table with a json schema.
139
- *
140
- * @param name The name of the table.
141
- * @param schema The json schema of the table.
142
- * @param extraConfig Extra configuration for the table.
143
- */
144
- declare const pgTableSchema: <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(name: TTableName, schema: TSchema, extraConfig?: (self: BuildExtraConfigColumns$1<TTableName, TColumnsMap, "pg">) => PgTableExtraConfigValue[]) => PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
145
- type PgTableConfig<TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>> = {
146
- name: TTableName;
147
- schema: any;
148
- columns: BuildColumns<TTableName, TColumnsMap, "pg">;
149
- dialect: "pg";
150
- };
151
- //#endregion
152
- //#region src/descriptors/$entity.d.ts
153
- interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1, Keys = keyof Static$1<T>> {
154
- /**
155
- * The name of the table. This is the name that will be used in the database.
156
- * @example
157
- * name: "user"
158
- */
159
- name: TTableName;
160
- /**
161
- * The schema of the table. This is a TypeBox schema that describes the columns and their types.
162
- * @example
163
- * schema: t.object({
164
- * id: t.uuid(),
165
- * name: t.string(),
166
- * email: t.string(),
167
- * phoneNumber: t.string(),
168
- * })
169
- */
170
- schema: T;
171
- /**
172
- * The indexes to create for the table. This can be a string or an object with the column name and options.
173
- * @example
174
- * indexes: ["name", { column: "email", unique: true }]
175
- */
176
- indexes?: (Keys | {
177
- column: Keys;
178
- unique?: boolean;
179
- name?: string;
180
- } | {
181
- columns: Keys[];
182
- unique?: boolean;
183
- name?: string;
184
- })[];
185
- relations?: Record<string, {
186
- type: "one" | "many";
187
- table: () => any;
188
- foreignColumn?: keyof Static$1<T>;
189
- }>;
190
- /**
191
- * Extra configuration for the table. See drizzle-orm documentation for more details.
192
- *
193
- * @param self The table descriptor.
194
- * @returns The extra configuration for the table.
195
- */
196
- config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
197
- }
198
- /**
199
- * Creates a table descriptor for drizzle-orm.
200
- */
201
- declare const $entity: <TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>>(options: EntityDescriptorOptions<TTableName, TSchema>) => PgTableWithColumnsAndSchema<PgTableConfig<TTableName, TSchema, TColumnsMap>, TSchema>;
202
- type Entity<T extends TObject$1> = PgTableWithColumnsAndSchema<PgTableConfig<string, T, FromSchema<T>>, T>;
203
- //#endregion
204
- //#region src/providers/drivers/PostgresProvider.d.ts
205
- type SQLLike = SQLWrapper | string;
206
- declare class PostgresProvider {
207
- constructor();
208
- /**
209
- * Get the database instance
210
- */
211
- get db(): PgDatabase<any>;
212
- get schema(): string;
213
- get dialect(): string;
214
- execute(_query: SQLLike): Promise<any[]>;
273
+ interface TableLike<T extends TObject = TObject> {
274
+ $schema: T;
215
275
  }
276
+ //# sourceMappingURL=schemaToPgColumns.d.ts.map
216
277
  //#endregion
217
278
  //#region src/helpers/nullToUndefined.d.ts
218
279
  /**
@@ -226,10 +287,8 @@ declare const nullToUndefined: <T extends object>(value: T) => NullToUndefined<T
226
287
  * Replaces all null values in an object with undefined.
227
288
  */
228
289
  type NullToUndefined<T> = T extends null ? undefined : T extends null | undefined | string | number | boolean | symbol | bigint | Function | Date | RegExp ? T : T extends Array<infer U> ? Array<NullToUndefined<U>> : T extends Map<infer K, infer V> ? Map<K, NullToUndefined<V>> : T extends Set<infer U> ? Set<NullToUndefined<U>> : T extends object ? { [K in keyof T]: NullToUndefined<T[K]> } : unknown;
229
- /**
230
- *
231
- */
232
290
  type NullifyIfOptional<T> = { [K in keyof T]: undefined extends T[K] ? T[K] | null : T[K] };
291
+ //# sourceMappingURL=nullToUndefined.d.ts.map
233
292
  //#endregion
234
293
  //#region src/interfaces/FilterOperators.d.ts
235
294
  interface FilterOperators<TValue> {
@@ -586,8 +645,12 @@ interface FilterOperators<TValue> {
586
645
  */
587
646
  arrayOverlaps?: TValue;
588
647
  }
648
+ //# sourceMappingURL=FilterOperators.d.ts.map
589
649
  //#endregion
590
650
  //#region src/interfaces/InferInsert.d.ts
651
+ /**
652
+ * Enhance Typebox with a support of "Default" (PG_DEFAULT).
653
+ */
591
654
  type InferInsert<T extends TObject$1> = StaticEntry<T> & StaticDefaultEntry<T>;
592
655
  type StaticDefaultEntry<T extends TObject$1> = { [K in keyof T["properties"] as T["properties"][K] extends {
593
656
  [PG_DEFAULT]: any;
@@ -599,6 +662,7 @@ type StaticEntry<T extends TObject$1> = { [K in keyof T["properties"] as T["prop
599
662
  } | {
600
663
  [OptionalKind]: "Optional";
601
664
  } ? never : K]: Static$1<T["properties"][K]> };
665
+ //# sourceMappingURL=InferInsert.d.ts.map
602
666
  //#endregion
603
667
  //#region src/interfaces/PgQueryWhere.d.ts
604
668
  type PgQueryWhere<T extends object> = { [Key in keyof T]?: FilterOperators<T[Key]> } & {
@@ -670,6 +734,7 @@ type PgQueryWhere<T extends object> = { [Key in keyof T]?: FilterOperators<T[Key
670
734
  */
671
735
  exists?: SQLWrapper;
672
736
  };
737
+ //# sourceMappingURL=PgQueryWhere.d.ts.map
673
738
  //#endregion
674
739
  //#region src/interfaces/PgQuery.d.ts
675
740
  interface PgQuery<T extends TObject$1, Select extends (keyof Static$1<T>)[] = []> {
@@ -698,14 +763,28 @@ type PgQueryWith<T extends TObject$1 | TArray> = true | {
698
763
  [key: string]: PgQueryWith<T>;
699
764
  };
700
765
  };
766
+ //# sourceMappingURL=PgQuery.d.ts.map
767
+ //#endregion
768
+ //#region src/providers/drivers/PostgresProvider.d.ts
769
+ type SQLLike = SQLWrapper | string;
770
+ declare abstract class PostgresProvider {
771
+ protected readonly alepha: Alepha;
772
+ abstract get db(): PgDatabase<any>;
773
+ abstract get schema(): string;
774
+ abstract get dialect(): string;
775
+ abstract execute<T extends TObject$1 = any>(query: SQLLike, schema?: T): Promise<Array<T extends TObject$1 ? Static$1<T> : any>>;
776
+ mapResult<T extends TObject$1 = any>(result: Array<any>, schema?: T): Array<T extends TObject$1 ? Static$1<T> : any>;
777
+ }
778
+ //# sourceMappingURL=PostgresProvider.d.ts.map
701
779
  //#endregion
702
780
  //#region src/schemas/pageQuerySchema.d.ts
703
- declare const pageQuerySchema: _sinclair_typebox59.TObject<{
704
- page: _sinclair_typebox59.TOptional<_sinclair_typebox59.TNumber>;
705
- size: _sinclair_typebox59.TOptional<_sinclair_typebox59.TNumber>;
706
- sort: _sinclair_typebox59.TOptional<_sinclair_typebox59.TString>;
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>;
707
785
  }>;
708
786
  type PageQuery = Static<typeof pageQuerySchema>;
787
+ //# sourceMappingURL=pageQuerySchema.d.ts.map
709
788
  //#endregion
710
789
  //#region src/schemas/pageSchema.d.ts
711
790
  /**
@@ -715,9 +794,6 @@ type PageQuery = Static<typeof pageQuerySchema>;
715
794
  * @param options
716
795
  */
717
796
  declare const pageSchema: <T extends TObject$1 | TIntersect | TRecord>(objectSchema: T, options?: ObjectOptions) => TPage<T>;
718
- /**
719
- *
720
- */
721
797
  type TPage<T extends TObject$1 | TIntersect | TRecord> = TObject$1<{
722
798
  content: TArray<T>;
723
799
  can: TObject$1<{
@@ -732,9 +808,6 @@ type TPage<T extends TObject$1 | TIntersect | TRecord> = TObject$1<{
732
808
  countDuration: TOptionalWithFlag<TInteger, true>;
733
809
  }>;
734
810
  }>;
735
- /**
736
- *
737
- */
738
811
  type Page<T> = {
739
812
  content: T[];
740
813
  can: {
@@ -749,18 +822,16 @@ type Page<T> = {
749
822
  countDuration?: number;
750
823
  };
751
824
  };
825
+ //# sourceMappingURL=pageSchema.d.ts.map
752
826
  //#endregion
753
827
  //#region src/services/Repository.d.ts
754
- /**
755
- *
756
- */
757
828
  declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTableSchema extends TObject$1> {
758
829
  readonly provider: PostgresProvider;
759
830
  protected readonly alepha: Alepha;
760
831
  protected readonly env: {
761
832
  POSTGRES_PAGINATION_COUNT_ENABLED: boolean;
762
833
  };
763
- static of: <TEntity extends TableConfig$1, TSchema extends TObject$1>(opts: PgTableWithColumnsAndSchema<TEntity, TSchema$1>) => (new () => Repository<PgTableWithColumns<TEntity>, TSchema$1>);
834
+ static of: <TEntity extends TableConfig$1, TTableSchema_1 extends TObject$1>(opts: PgTableWithColumnsAndSchema<TEntity, TTableSchema_1>) => (new () => Repository<PgTableWithColumns<TEntity>, TTableSchema_1>);
764
835
  /**
765
836
  * Register Repository as a valid descriptor.
766
837
  * - Required for $repository to work.
@@ -774,7 +845,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
774
845
  * ID is mandatory. If the table does not have a primary key, it will throw an error.
775
846
  */
776
847
  readonly id: {
777
- type: TSchema$1;
848
+ type: TSchema$2;
778
849
  key: keyof TTableSchema["properties"];
779
850
  col: PgColumn;
780
851
  };
@@ -809,11 +880,8 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
809
880
  /**
810
881
  * Getter for the database connection from the database provider.
811
882
  */
812
- get db(): PgDatabase<any, Record<string, never>, drizzle_orm67.ExtractTablesWithRelations<Record<string, never>>>;
813
- /**
814
- *
815
- */
816
- organization(): PgColumn;
883
+ protected get db(): PgDatabase<any, Record<string, never>, drizzle_orm8.ExtractTablesWithRelations<Record<string, never>>>;
884
+ protected organization(): PgColumn;
817
885
  /**
818
886
  * Execute a SQL query.
819
887
  *
@@ -840,29 +908,29 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
840
908
  *
841
909
  * @returns The SELECT query builder.
842
910
  */
843
- protected select(opts?: StatementOptions): drizzle_orm_pg_core72.PgSelectBase<string, Record<string, PgColumn<drizzle_orm67.ColumnBaseConfig<drizzle_orm67.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
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, {
844
912
  [x: string]: unknown;
845
913
  }[], {
846
- [x: string]: PgColumn<drizzle_orm67.ColumnBaseConfig<drizzle_orm67.ColumnDataType, string>, {}, {}>;
914
+ [x: string]: PgColumn<drizzle_orm8.ColumnBaseConfig<drizzle_orm8.ColumnDataType, string>, {}, {}>;
847
915
  }>;
848
916
  /**
849
917
  * Start an INSERT query on the table.
850
918
  *
851
919
  * @returns The INSERT query builder.
852
920
  */
853
- protected insert(opts?: StatementOptions): drizzle_orm_pg_core72.PgInsertBuilder<TTable, any, false>;
921
+ protected insert(opts?: StatementOptions): drizzle_orm_pg_core13.PgInsertBuilder<TTable, any, false>;
854
922
  /**
855
923
  * Start an UPDATE query on the table.
856
924
  *
857
925
  * @returns The UPDATE query builder.
858
926
  */
859
- protected update(opts?: StatementOptions): drizzle_orm_pg_core72.PgUpdateBuilder<TTable, any>;
927
+ protected update(opts?: StatementOptions): drizzle_orm_pg_core13.PgUpdateBuilder<TTable, any>;
860
928
  /**
861
929
  * Start a DELETE query on the table.
862
930
  *
863
931
  * @returns The DELETE query builder.
864
932
  */
865
- protected delete(opts?: StatementOptions): drizzle_orm_pg_core72.PgDeleteBase<TTable, any, undefined, undefined, false, never>;
933
+ protected delete(opts?: StatementOptions): drizzle_orm_pg_core13.PgDeleteBase<TTable, any, undefined, undefined, false, never>;
866
934
  /**
867
935
  * Find entities.
868
936
  *
@@ -895,13 +963,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
895
963
  * @returns The paginated entities.
896
964
  */
897
965
  paginate(pageQuery?: PageQuery, findQuery?: PgQuery<TTableSchema>, opts?: StatementOptions): Promise<Page<Static$1<TTableSchema>>>;
898
- /**
899
- *
900
- */
901
966
  createQuery(query?: PgQuery<TTableSchema>): PgQuery<TTableSchema>;
902
- /**
903
- *
904
- */
905
967
  createQueryWhere(where?: PgQueryWhere<Static$1<TTableSchema>>): PgQueryWhere<Static$1<TTableSchema>>;
906
968
  /**
907
969
  * Create an entity.
@@ -982,7 +1044,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
982
1044
  * @param schema The schema to use.
983
1045
  * @param col The column to use.
984
1046
  */
985
- jsonQueryToSql(query: PgQueryWhere<Static$1<TTableSchema>>, schema?: TObject$1, col?: (key: string) => PgColumn): SQL | undefined;
1047
+ protected jsonQueryToSql(query: PgQueryWhere<Static$1<TTableSchema>>, schema?: TObject$1, col?: (key: string) => PgColumn): SQL | undefined;
986
1048
  /**
987
1049
  * Map a filter operator to a SQL query.
988
1050
  *
@@ -1018,14 +1080,6 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1018
1080
  * @returns The where clause for the ID.
1019
1081
  */
1020
1082
  protected getWhereId(id: string | number): PgQueryWhere<Static$1<TTableSchema>>;
1021
- /**
1022
- * Get all fields with a specific attribute.
1023
- *
1024
- * @param schema
1025
- * @param name
1026
- * @protected
1027
- */
1028
- protected getAttrFields(schema: TObject$1, name: PgSymbolKeys): PgAttrField[];
1029
1083
  /**
1030
1084
  * Find a primary key in the schema.
1031
1085
  *
@@ -1034,31 +1088,9 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
1034
1088
  */
1035
1089
  protected getPrimaryKey(schema: TObject$1): {
1036
1090
  key: string;
1037
- col: PgColumn<drizzle_orm67.ColumnBaseConfig<drizzle_orm67.ColumnDataType, string>, {}, {}>;
1038
- type: TSchema$1;
1091
+ col: PgColumn<drizzle_orm8.ColumnBaseConfig<drizzle_orm8.ColumnDataType, string>, {}, {}>;
1092
+ type: TSchema$2;
1039
1093
  };
1040
- /**
1041
- * Try to aggregate the rows after a select JOIN.
1042
- *
1043
- * @param rows
1044
- * @param pgManyFields
1045
- * @param query
1046
- * @protected
1047
- */
1048
- protected aggregateRows(rows: any[], pgManyFields: PgAttrField[], query: PgQuery<any>): any[];
1049
- /**
1050
- * Populate the JOINs in the query.
1051
- *
1052
- * @param builder
1053
- * @param query
1054
- * @param schema
1055
- * @param id
1056
- * @protected
1057
- */
1058
- protected withJoins(builder: {
1059
- leftJoin: PgSelectJoinFn<any, any, "left", true>;
1060
- innerJoin: PgSelectJoinFn<any, any, "inner", true>;
1061
- }, query: PgQuery<any>, schema: TObject$1, id: PgColumn): PgAttrField[];
1062
1094
  }
1063
1095
  /**
1064
1096
  * The options for a statement.
@@ -1086,10 +1118,108 @@ interface StatementOptions {
1086
1118
  }
1087
1119
  interface PgAttrField {
1088
1120
  key: string;
1089
- type: TSchema$1;
1121
+ type: TSchema$2;
1090
1122
  data: any;
1091
1123
  nested?: any[];
1092
1124
  }
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
1093
1223
  //#endregion
1094
1224
  //#region src/descriptors/$repository.d.ts
1095
1225
  interface RepositoryDescriptorOptions<TEntity extends TableConfig, TSchema extends TObject> {
@@ -1109,55 +1239,25 @@ declare const $repository: {
1109
1239
  <TEntity extends TableConfig, TSchema extends TObject>(optionsOrTable: RepositoryDescriptorOptions<TEntity, TSchema> | PgTableWithColumnsAndSchema<TEntity, TSchema>): Repository<PgTableWithColumnsAndSchema<TEntity, TSchema>, TSchema>;
1110
1240
  [KIND]: string;
1111
1241
  };
1242
+ //# sourceMappingURL=$repository.d.ts.map
1112
1243
  //#endregion
1113
1244
  //#region src/descriptors/$sequence.d.ts
1114
1245
  declare const KEY = "SEQUENCE";
1115
1246
  interface SequenceDescriptorOptions {
1116
- /**
1117
- *
1118
- */
1119
1247
  name?: string;
1120
- /**
1121
- *
1122
- */
1123
1248
  start?: number;
1124
- /**
1125
- *
1126
- */
1127
1249
  increment?: number;
1128
- /**
1129
- *
1130
- */
1131
1250
  min?: number;
1132
- /**
1133
- *
1134
- */
1135
1251
  max?: number;
1136
- /**
1137
- *
1138
- */
1139
1252
  cycle?: boolean;
1140
1253
  }
1141
1254
  interface SequenceDescriptor {
1142
1255
  [KIND]: typeof KEY;
1143
1256
  [OPTIONS]: SequenceDescriptorOptions;
1144
- /**
1145
- *
1146
- */
1147
1257
  (): Promise<number>;
1148
- /**
1149
- *
1150
- */
1151
1258
  next(): Promise<number>;
1152
- /**
1153
- *
1154
- */
1155
1259
  current(): Promise<number>;
1156
1260
  }
1157
- /**
1158
- *
1159
- * @param options
1160
- */
1161
1261
  declare const $sequence: {
1162
1262
  (options?: SequenceDescriptorOptions): SequenceDescriptor;
1163
1263
  [KIND]: string;
@@ -1165,22 +1265,12 @@ declare const $sequence: {
1165
1265
  //#endregion
1166
1266
  //#region src/descriptors/$transaction.d.ts
1167
1267
  interface TransactionDescriptorOptions<T extends any[], R> {
1168
- /**
1169
- *
1170
- * @param tx
1171
- * @param args
1172
- */
1173
1268
  handler: (tx: PgTransaction<any, any, any>, ...args: T) => Promise<R>;
1174
- /**
1175
- *
1176
- */
1177
1269
  config?: PgTransactionConfig$1;
1178
1270
  }
1179
1271
  type TransactionContext = PgTransaction<any, any, any>;
1180
- /**
1181
- * Creates a transaction descriptor.
1182
- */
1183
- declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry2.RetryDescriptor<(...args: T) => Promise<R>>;
1272
+ declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry19.RetryDescriptor<(...args: T) => Promise<R>>;
1273
+ //# sourceMappingURL=$transaction.d.ts.map
1184
1274
  //#endregion
1185
1275
  //#region src/errors/EntityNotFoundError.d.ts
1186
1276
  declare class EntityNotFoundError extends Error {
@@ -1188,15 +1278,16 @@ declare class EntityNotFoundError extends Error {
1188
1278
  readonly status = 404;
1189
1279
  constructor(entityName: string);
1190
1280
  }
1281
+ //# sourceMappingURL=EntityNotFoundError.d.ts.map
1191
1282
  //#endregion
1192
1283
  //#region src/providers/RepositoryDescriptorProvider.d.ts
1193
1284
  declare class RepositoryDescriptorProvider {
1194
- protected readonly log: _alepha_core40.Logger;
1285
+ protected readonly log: _alepha_core56.Logger;
1195
1286
  protected readonly alepha: Alepha;
1196
1287
  protected readonly repositories: Array<Repository<any, TObject$1>>;
1197
1288
  constructor();
1198
1289
  clearRepositories(): Promise<void>;
1199
- protected readonly configure: _alepha_core40.HookDescriptor<"configure">;
1290
+ protected readonly configure: _alepha_core56.HookDescriptor<"configure">;
1200
1291
  /**
1201
1292
  * Get all repositories.
1202
1293
  *
@@ -1226,10 +1317,11 @@ declare class RepositoryDescriptorProvider {
1226
1317
  */
1227
1318
  protected processRepositoryDescriptors(): Promise<void>;
1228
1319
  }
1320
+ //# sourceMappingURL=RepositoryDescriptorProvider.d.ts.map
1229
1321
  //#endregion
1230
1322
  //#region src/providers/DrizzleKitProvider.d.ts
1231
1323
  declare class DrizzleKitProvider {
1232
- protected readonly log: _alepha_core3.Logger;
1324
+ protected readonly log: _alepha_core20.Logger;
1233
1325
  protected readonly alepha: Alepha;
1234
1326
  protected readonly repositoryProvider: RepositoryDescriptorProvider;
1235
1327
  push(provider: PostgresProvider, schema?: string): Promise<void>;
@@ -1246,6 +1338,7 @@ declare class DrizzleKitProvider {
1246
1338
  * @returns A promise that resolves once the migrations have been executed.
1247
1339
  */
1248
1340
  synchronize(provider: PostgresProvider, schema?: string): Promise<void>;
1341
+ synchronizeSqlite(provider: PostgresProvider): Promise<void>;
1249
1342
  protected getTables(provider: PostgresProvider, schema?: string): Promise<Record<string, any>>;
1250
1343
  protected loadMigrationSnapshot(provider: PostgresProvider): Promise<any>;
1251
1344
  protected saveMigrationSnapshot(provider: PostgresProvider, curr: Record<string, any>, entry?: {
@@ -1260,58 +1353,59 @@ declare class DrizzleKitProvider {
1260
1353
  */
1261
1354
  protected importDrizzleKit(): Promise<typeof DrizzleKit>;
1262
1355
  }
1356
+ //# sourceMappingURL=DrizzleKitProvider.d.ts.map
1263
1357
  //#endregion
1264
1358
  //#region src/providers/drivers/NodePostgresProvider.d.ts
1265
1359
  declare module "alepha" {
1266
1360
  interface Env extends Partial<Static<typeof envSchema>> {}
1267
1361
  }
1268
- declare const envSchema: _alepha_core25.TObject<{
1269
- PG_HOST: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1270
- PG_USERNAME: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1271
- PG_DATABASE: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1272
- PG_PASSWORD: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1273
- PG_PORT: _sinclair_typebox5.TOptional<_sinclair_typebox5.TNumber>;
1274
- DATABASE_URL: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1275
- DATABASE_MIGRATIONS_FOLDER: _sinclair_typebox5.TString;
1362
+ 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;
1276
1370
  /**
1277
1371
  * The schema to use.
1278
1372
  * Accept a string.
1279
1373
  */
1280
- POSTGRES_SCHEMA: _sinclair_typebox5.TOptional<_sinclair_typebox5.TString>;
1374
+ POSTGRES_SCHEMA: _alepha_core22.TOptional<_alepha_core22.TString>;
1281
1375
  /**
1282
1376
  * Synchronize the database schema with the models.
1283
1377
  * Accept a boolean or a postgres schema name.
1284
1378
  *
1285
1379
  * @default false
1286
1380
  */
1287
- POSTGRES_SYNCHRONIZE: _sinclair_typebox5.TOptional<_sinclair_typebox5.TBoolean>;
1381
+ POSTGRES_SYNCHRONIZE: _alepha_core22.TOptional<_alepha_core22.TBoolean>;
1288
1382
  /**
1289
1383
  * Push the schema to the database.
1290
1384
  *
1291
1385
  * @default false
1292
1386
  */
1293
- POSTGRES_PUSH_SCHEMA: _sinclair_typebox5.TOptional<_sinclair_typebox5.TBoolean>;
1387
+ POSTGRES_PUSH_SCHEMA: _alepha_core22.TOptional<_alepha_core22.TBoolean>;
1294
1388
  /**
1295
1389
  * Reject unauthorized SSL connections.
1296
1390
  *
1297
1391
  * @default false
1298
1392
  */
1299
- POSTGRES_REJECT_UNAUTHORIZED: _sinclair_typebox5.TBoolean;
1393
+ POSTGRES_REJECT_UNAUTHORIZED: _alepha_core22.TBoolean;
1300
1394
  }>;
1301
1395
  interface NodePostgresProviderState {
1302
1396
  client: postgres.Sql;
1303
1397
  db: PostgresJsDatabase;
1304
1398
  }
1305
- declare class NodePostgresProvider implements PostgresProvider {
1399
+ declare class NodePostgresProvider extends PostgresProvider {
1306
1400
  readonly dialect = "postgres";
1307
- protected readonly log: _alepha_core25.Logger;
1401
+ protected readonly log: _alepha_core22.Logger;
1308
1402
  protected readonly env: {
1403
+ DATABASE_URL?: string | undefined;
1309
1404
  PG_HOST?: string | undefined;
1310
1405
  PG_USERNAME?: string | undefined;
1311
1406
  PG_DATABASE?: string | undefined;
1312
1407
  PG_PASSWORD?: string | undefined;
1313
1408
  PG_PORT?: number | undefined;
1314
- DATABASE_URL?: string | undefined;
1315
1409
  POSTGRES_SCHEMA?: string | undefined;
1316
1410
  POSTGRES_SYNCHRONIZE?: boolean | undefined;
1317
1411
  POSTGRES_PUSH_SCHEMA?: boolean | undefined;
@@ -1326,16 +1420,16 @@ declare class NodePostgresProvider implements PostgresProvider {
1326
1420
  */
1327
1421
  protected testingSchemaName?: string;
1328
1422
  get db(): PostgresJsDatabase;
1329
- protected readonly configure: _alepha_core25.HookDescriptor<"start">;
1330
- protected readonly stop: _alepha_core25.HookDescriptor<"stop">;
1423
+ protected readonly configure: _alepha_core22.HookDescriptor<"start">;
1424
+ protected readonly stop: _alepha_core22.HookDescriptor<"stop">;
1331
1425
  /**
1332
1426
  * Get Postgres schema.
1333
1427
  */
1334
1428
  get schema(): string;
1335
- execute(query: SQLLike): Promise<any[]>;
1429
+ execute<T extends TObject$1 = any>(query: SQLLike, schema?: T): Promise<Array<T extends TObject$1 ? Static<T> : any>>;
1336
1430
  connect(): Promise<void>;
1337
1431
  close(): Promise<void>;
1338
- protected migrate: _alepha_lock29.LockDescriptor<() => Promise<void>>;
1432
+ protected migrate: _alepha_lock45.LockDescriptor<() => Promise<void>>;
1339
1433
  protected createClient(): NodePostgresProviderState;
1340
1434
  protected getMigrationOptions(): MigrationConfig;
1341
1435
  protected getClientOptions(): postgres.Options<any>;
@@ -1343,26 +1437,28 @@ declare class NodePostgresProvider implements PostgresProvider {
1343
1437
  protected ssl(url: URL | undefined): "require" | "allow" | "prefer" | "verify-full" | undefined;
1344
1438
  }
1345
1439
  //#endregion
1346
- //#region src/schemas/pgAttr.d.ts
1440
+ //#region src/helpers/pgAttr.d.ts
1347
1441
  /**
1348
1442
  * Type representation.
1349
1443
  */
1350
1444
  type PgAttr<T extends TSchema$1, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
1351
1445
  //#endregion
1352
1446
  //#region src/schemas/createdAtSchema.d.ts
1353
- declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox81.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1447
+ declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox85.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1448
+ //# sourceMappingURL=createdAtSchema.d.ts.map
1449
+
1354
1450
  //#endregion
1355
1451
  //#region src/schemas/legacyIdSchema.d.ts
1356
1452
  /**
1357
1453
  * @deprecated Use `pg.primaryKey()` instead.
1358
1454
  */
1359
- declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<_sinclair_typebox84.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1455
+ declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<_sinclair_typebox88.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1456
+ //# sourceMappingURL=legacyIdSchema.d.ts.map
1360
1457
  //#endregion
1361
1458
  //#region src/schemas/updatedAtSchema.d.ts
1362
- /**
1363
- *
1364
- */
1365
- declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox78.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1459
+ declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox82.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1460
+ //# sourceMappingURL=updatedAtSchema.d.ts.map
1461
+
1366
1462
  //#endregion
1367
1463
  //#region src/schemas/entitySchema.d.ts
1368
1464
  /**
@@ -1371,9 +1467,9 @@ declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox78.TString, typeof
1371
1467
  * Add some common SQL properties to an object.
1372
1468
  */
1373
1469
  declare const entitySchema: TObject$1<{
1374
- id: PgAttr<PgAttr<PgAttr<_sinclair_typebox42.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
1375
- createdAt: PgAttr<PgAttr<_sinclair_typebox42.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1376
- updatedAt: PgAttr<PgAttr<_sinclair_typebox42.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
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>;
1377
1473
  }>;
1378
1474
  /**
1379
1475
  * TypeBox Entity Type.
@@ -1395,51 +1491,51 @@ type BaseEntityKeys = keyof BaseEntity;
1395
1491
  * The keys of the base entity.
1396
1492
  */
1397
1493
  declare const entityKeys: readonly ["id", "createdAt", "updatedAt"];
1494
+ //# sourceMappingURL=entitySchema.d.ts.map
1398
1495
  //#endregion
1399
1496
  //#region src/providers/PostgresTypeProvider.d.ts
1400
- declare module "alepha/core" {
1497
+ declare module "alepha" {
1401
1498
  interface TypeProvider {
1402
1499
  pg: PostgresTypeProvider;
1403
1500
  }
1404
1501
  }
1405
1502
  declare class PostgresTypeProvider {
1406
- readonly attr: <T extends TSchema$1, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
1503
+ readonly attr: <T extends TSchema$2, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
1407
1504
  /**
1408
1505
  * Creates a primary key with an identity column.
1409
1506
  */
1410
- readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox33.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1507
+ readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1411
1508
  /**
1412
1509
  * Creates a primary key with a big identity column. (default)
1413
1510
  */
1414
- readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox33.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1511
+ readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1415
1512
  /**
1416
1513
  * Creates a primary key with a UUID column.
1417
1514
  */
1418
- readonly uuidPrimaryKey: () => PgAttr<PgAttr<_sinclair_typebox33.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1515
+ readonly uuidPrimaryKey: () => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1419
1516
  /**
1420
- *
1421
1517
  * @alias bigIdentityPrimaryKey
1422
1518
  */
1423
- readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox33.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1519
+ readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox49.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
1424
1520
  /**
1425
1521
  * Wrap a schema with "default" attribute.
1426
1522
  * This is used to set a default value for a column in the database.
1427
1523
  */
1428
- readonly default: <T extends TSchema$1>(type: T, value?: Static$1<T>) => PgAttr<T, PgDefault>;
1524
+ readonly default: <T extends TSchema$2>(type: T, value?: Static$1<T>) => PgAttr<T, PgDefault>;
1429
1525
  /**
1430
1526
  * Creates a column version.
1431
1527
  * This is used to track the version of a row in the database.
1432
1528
  * You can use it for optimistic concurrency control.
1433
1529
  */
1434
- readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<_sinclair_typebox33.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
1530
+ readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<_sinclair_typebox49.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
1435
1531
  /**
1436
1532
  * Creates a column Created At. So just a datetime column with a default value of the current timestamp.
1437
1533
  */
1438
- readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox33.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1534
+ readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1439
1535
  /**
1440
1536
  * Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
1441
1537
  */
1442
- readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox33.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1538
+ readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox49.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
1443
1539
  /**
1444
1540
  * @deprecated Build your own entity schema.
1445
1541
  */
@@ -1460,14 +1556,14 @@ declare class PostgresTypeProvider {
1460
1556
  /**
1461
1557
  * Creates a reference to another table or schema.
1462
1558
  */
1463
- readonly ref: <T extends TSchema$1>(type: T, ref: () => any, actions?: {
1559
+ readonly ref: <T extends TSchema$2>(type: T, ref: () => any, actions?: {
1464
1560
  onUpdate?: UpdateDeleteAction$1;
1465
1561
  onDelete?: UpdateDeleteAction$1;
1466
1562
  }) => PgAttr<T, PgRef>;
1467
1563
  /**
1468
1564
  * @alias ref
1469
1565
  */
1470
- references: <T extends TSchema$1>(type: T, ref: () => any, actions?: {
1566
+ references: <T extends TSchema$2>(type: T, ref: () => any, actions?: {
1471
1567
  onUpdate?: UpdateDeleteAction$1;
1472
1568
  onDelete?: UpdateDeleteAction$1;
1473
1569
  }) => PgAttr<T, PgRef>;
@@ -1479,12 +1575,13 @@ declare class PostgresTypeProvider {
1479
1575
  readonly many: <T extends TObject$1, Config extends TableConfig$1>(table: PgTableWithColumnsAndSchema<Config, T>, foreignKey: keyof T["properties"]) => TOptionalWithFlag<PgAttr<PgAttr<TArray<T>, PgMany>, PgDefault>, true>;
1480
1576
  }
1481
1577
  declare const pg: PostgresTypeProvider;
1578
+ //# sourceMappingURL=PostgresTypeProvider.d.ts.map
1482
1579
  //#endregion
1483
1580
  //#region src/types/schema.d.ts
1484
1581
  /**
1485
1582
  * Postgres schema type.
1486
1583
  */
1487
- declare const schema: <TDocument extends TSchema$1>(name: string, document: TDocument) => drizzle_orm1.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
1584
+ declare const schema: <TDocument extends TSchema$2>(name: string, document: TDocument) => drizzle_orm2.$Type<drizzle_orm_pg_core1.PgCustomColumnBuilder<{
1488
1585
  name: string;
1489
1586
  dataType: "custom";
1490
1587
  columnType: "PgCustomColumn";
@@ -1496,12 +1593,22 @@ declare const schema: <TDocument extends TSchema$1>(name: string, document: TDoc
1496
1593
  }>, (TDocument & {
1497
1594
  params: [];
1498
1595
  })["static"]>;
1596
+ //# sourceMappingURL=schema.d.ts.map
1597
+
1499
1598
  //#endregion
1500
1599
  //#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
+ }
1501
1603
  declare class AlephaPostgres implements Module {
1502
1604
  readonly name = "alepha.postgres";
1503
- readonly $services: (alepha: Alepha) => Alepha;
1605
+ readonly env: {
1606
+ DATABASE_URL: string;
1607
+ };
1608
+ readonly $services: (alepha: Alepha) => void;
1504
1609
  }
1610
+ //# sourceMappingURL=index.d.ts.map
1611
+
1505
1612
  //#endregion
1506
- 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, Repository, RepositoryDescriptorOptions, RepositoryDescriptorProvider, SQLLike, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TEntity$1 as TEntity, TInsertObject, TPage, TransactionContext, TransactionDescriptorOptions, entityKeys, entitySchema, nullToUndefined, pageQuerySchema, pageSchema, pg, pgTableSchema, schema, schemaToColumns, sql };
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 };
1507
1614
  //# sourceMappingURL=index.d.ts.map