alepha 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +44 -44
- package/core.d.ts +2 -1
- package/datetime.d.ts +4 -4
- package/package.json +60 -25
- package/postgres.d.ts +262 -201
- package/react/auth.d.ts +4 -9
- package/react/head.cjs +8 -0
- package/react/head.d.ts +86 -0
- package/react/head.js +1 -0
- package/react.d.ts +54 -103
- package/scheduler.d.ts +0 -1
- package/security.d.ts +9 -22
- package/server/cache.d.ts +2 -2
- package/server/cookies.d.ts +5 -2
- package/server/cors.cjs +8 -0
- package/server/cors.d.ts +25 -0
- package/server/cors.js +1 -0
- package/server/health.cjs +8 -0
- package/server/health.d.ts +42 -0
- package/server/health.js +1 -0
- package/server/links.cjs +8 -0
- package/server/links.d.ts +188 -0
- package/server/links.js +1 -0
- package/server/proxy.cjs +8 -0
- package/server/proxy.d.ts +41 -0
- package/server/proxy.js +1 -0
- package/server.d.ts +207 -421
- package/topic.d.ts +0 -16
package/postgres.d.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { Alepha, KIND, Module, OPTIONS, Static, TObject } from "@alepha/core";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
1
|
+
import * as _alepha_core17 from "@alepha/core";
|
|
2
|
+
import * as _alepha_core36 from "@alepha/core";
|
|
3
|
+
import * as _alepha_core58 from "@alepha/core";
|
|
4
|
+
import { Alepha, KIND, Module, OPTIONS, Static, TObject, TSchema as TSchema$1 } from "@alepha/core";
|
|
5
|
+
import * as drizzle_orm3 from "drizzle-orm";
|
|
6
|
+
import * as drizzle_orm71 from "drizzle-orm";
|
|
7
7
|
import * as drizzle_orm1 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_lock62 from "@alepha/lock";
|
|
9
11
|
import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
10
12
|
import postgres from "postgres";
|
|
11
|
-
import * as
|
|
13
|
+
import * as pg$1 from "drizzle-orm/pg-core";
|
|
14
|
+
import * as drizzle_orm_pg_core76 from "drizzle-orm/pg-core";
|
|
12
15
|
import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
|
|
13
|
-
import { AnyPgColumn, AnyPgTable, LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue,
|
|
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";
|
|
14
17
|
import * as _alepha_retry2 from "@alepha/retry";
|
|
15
|
-
import * as
|
|
16
|
-
import * as
|
|
17
|
-
import * as
|
|
18
|
-
import * as
|
|
19
|
-
import * as
|
|
20
|
-
import * as
|
|
21
|
-
import * as
|
|
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$
|
|
23
|
-
import { BuildExtraConfigColumns as BuildExtraConfigColumns$1 } from "drizzle-orm/column-builder";
|
|
18
|
+
import * as _sinclair_typebox63 from "@sinclair/typebox";
|
|
19
|
+
import * as _sinclair_typebox38 from "@sinclair/typebox";
|
|
20
|
+
import * as _sinclair_typebox85 from "@sinclair/typebox";
|
|
21
|
+
import * as _sinclair_typebox88 from "@sinclair/typebox";
|
|
22
|
+
import * as _sinclair_typebox82 from "@sinclair/typebox";
|
|
23
|
+
import * as _sinclair_typebox19 from "@sinclair/typebox";
|
|
24
|
+
import * as _sinclair_typebox10 from "@sinclair/typebox";
|
|
25
|
+
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
26
|
import { PgTransactionConfig as PgTransactionConfig$1 } from "drizzle-orm/pg-core/session";
|
|
25
27
|
import * as DrizzleKit from "drizzle-kit/api";
|
|
26
28
|
import { MigrationConfig } from "drizzle-orm/migrator";
|
|
@@ -28,9 +30,6 @@ import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/
|
|
|
28
30
|
export * from "drizzle-orm/pg-core";
|
|
29
31
|
|
|
30
32
|
//#region src/constants/PG_SCHEMA.d.ts
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
33
|
declare const PG_SCHEMA: unique symbol;
|
|
35
34
|
//#endregion
|
|
36
35
|
//#region src/constants/PG_SYMBOLS.d.ts
|
|
@@ -88,10 +87,8 @@ interface PgRefOptions {
|
|
|
88
87
|
//#region src/interfaces/TInsertObject.d.ts
|
|
89
88
|
/**
|
|
90
89
|
* Fork of the original typebox schema "TObject".
|
|
91
|
-
*
|
|
92
|
-
* Expect some breaking changes in the future...
|
|
93
90
|
*/
|
|
94
|
-
interface TInsertObject<T extends TObject$1> extends TSchema$
|
|
91
|
+
interface TInsertObject<T extends TObject$1> extends TSchema$2, ObjectOptions {
|
|
95
92
|
[Kind]: "Object";
|
|
96
93
|
static: ObjectStatic<{ [K in keyof T["properties"] as T["properties"][K] extends {
|
|
97
94
|
[PG_DEFAULT]: any;
|
|
@@ -103,27 +100,171 @@ interface TInsertObject<T extends TObject$1> extends TSchema$1, ObjectOptions {
|
|
|
103
100
|
[PG_DEFAULT]: any;
|
|
104
101
|
} ? never : K]: T["properties"][K] };
|
|
105
102
|
}
|
|
106
|
-
type ReadonlyOptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$
|
|
107
|
-
type ReadonlyPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TReadonly<TSchema$
|
|
108
|
-
type OptionalPropertyKeys<T extends TProperties> = { [K in keyof T]: T[K] extends TOptional<TSchema$
|
|
103
|
+
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];
|
|
104
|
+
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];
|
|
105
|
+
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
106
|
type RequiredPropertyKeys<T extends TProperties> = keyof Omit<T, ReadonlyOptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | OptionalPropertyKeys<T>>;
|
|
110
107
|
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
108
|
type ObjectStatic<T extends TProperties, P extends unknown[]> = ObjectStaticProperties<T, { [K in keyof T]: Static$1<T[K], P> }>;
|
|
112
109
|
//#endregion
|
|
113
|
-
//#region src/helpers/
|
|
110
|
+
//#region src/helpers/schemaToPgColumns.d.ts
|
|
114
111
|
/**
|
|
115
|
-
* Convert a
|
|
112
|
+
* Convert a Typebox Schema to Drizzle ORM Postgres columns (yes)
|
|
113
|
+
*/
|
|
114
|
+
declare const schemaToPgColumns: <T extends TObject>(schema: T) => FromSchema<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Map a Typebox field to a PG column.
|
|
116
117
|
*
|
|
117
|
-
* @param
|
|
118
|
+
* @param name The key of the field.
|
|
119
|
+
* @param value The value of the field.
|
|
120
|
+
* @returns The PG column.
|
|
118
121
|
*/
|
|
119
|
-
declare const
|
|
122
|
+
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<{
|
|
123
|
+
name: string;
|
|
124
|
+
dataType: "custom";
|
|
125
|
+
columnType: "PgCustomColumn";
|
|
126
|
+
data: Buffer<ArrayBufferLike>;
|
|
127
|
+
driverParam: unknown;
|
|
128
|
+
enumValues: undefined;
|
|
129
|
+
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]> | pg$1.PgBooleanBuilderInitial<string> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
|
|
130
|
+
name: string;
|
|
131
|
+
dataType: "custom";
|
|
132
|
+
columnType: "PgCustomColumn";
|
|
133
|
+
data: {
|
|
134
|
+
[x: string]: unknown;
|
|
135
|
+
[x: number]: unknown;
|
|
136
|
+
};
|
|
137
|
+
driverParam: string;
|
|
138
|
+
enumValues: undefined;
|
|
139
|
+
}>, {
|
|
140
|
+
[x: string]: unknown;
|
|
141
|
+
[x: number]: unknown;
|
|
142
|
+
}> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
|
|
143
|
+
name: string;
|
|
144
|
+
dataType: "custom";
|
|
145
|
+
columnType: "PgCustomColumn";
|
|
146
|
+
data: {};
|
|
147
|
+
driverParam: string;
|
|
148
|
+
enumValues: undefined;
|
|
149
|
+
}>, {}> | drizzle_orm3.$Type<pg$1.PgCustomColumnBuilder<{
|
|
150
|
+
name: string;
|
|
151
|
+
dataType: "custom";
|
|
152
|
+
columnType: "PgCustomColumn";
|
|
153
|
+
data: unknown[];
|
|
154
|
+
driverParam: string;
|
|
155
|
+
enumValues: undefined;
|
|
156
|
+
}>, unknown[]> | pg$1.PgArrayBuilder<{
|
|
157
|
+
name: string;
|
|
158
|
+
dataType: "array";
|
|
159
|
+
columnType: "PgArray";
|
|
160
|
+
data: string[];
|
|
161
|
+
driverParam: string | string[];
|
|
162
|
+
enumValues: [string, ...string[]];
|
|
163
|
+
size: undefined;
|
|
164
|
+
baseBuilder: {
|
|
165
|
+
name: string;
|
|
166
|
+
dataType: "string";
|
|
167
|
+
columnType: "PgText";
|
|
168
|
+
data: string;
|
|
169
|
+
enumValues: [string, ...string[]];
|
|
170
|
+
driverParam: string;
|
|
171
|
+
};
|
|
172
|
+
}, {
|
|
173
|
+
name: string;
|
|
174
|
+
dataType: "string";
|
|
175
|
+
columnType: "PgText";
|
|
176
|
+
data: string;
|
|
177
|
+
enumValues: [string, ...string[]];
|
|
178
|
+
driverParam: string;
|
|
179
|
+
}> | pg$1.PgArrayBuilder<{
|
|
180
|
+
name: string;
|
|
181
|
+
dataType: "array";
|
|
182
|
+
columnType: "PgArray";
|
|
183
|
+
data: number[];
|
|
184
|
+
driverParam: string | (string | number)[];
|
|
185
|
+
enumValues: undefined;
|
|
186
|
+
size: undefined;
|
|
187
|
+
baseBuilder: {
|
|
188
|
+
name: string;
|
|
189
|
+
dataType: "number";
|
|
190
|
+
columnType: "PgInteger";
|
|
191
|
+
data: number;
|
|
192
|
+
driverParam: number | string;
|
|
193
|
+
enumValues: undefined;
|
|
194
|
+
};
|
|
195
|
+
}, {
|
|
196
|
+
name: string;
|
|
197
|
+
dataType: "number";
|
|
198
|
+
columnType: "PgInteger";
|
|
199
|
+
data: number;
|
|
200
|
+
driverParam: number | string;
|
|
201
|
+
enumValues: undefined;
|
|
202
|
+
}> | pg$1.PgArrayBuilder<{
|
|
203
|
+
name: string;
|
|
204
|
+
dataType: "array";
|
|
205
|
+
columnType: "PgArray";
|
|
206
|
+
data: string[];
|
|
207
|
+
driverParam: string | string[];
|
|
208
|
+
enumValues: undefined;
|
|
209
|
+
size: undefined;
|
|
210
|
+
baseBuilder: {
|
|
211
|
+
name: string;
|
|
212
|
+
dataType: "string";
|
|
213
|
+
columnType: "PgNumeric";
|
|
214
|
+
data: string;
|
|
215
|
+
driverParam: string;
|
|
216
|
+
enumValues: undefined;
|
|
217
|
+
};
|
|
218
|
+
}, {
|
|
219
|
+
name: string;
|
|
220
|
+
dataType: "string";
|
|
221
|
+
columnType: "PgNumeric";
|
|
222
|
+
data: string;
|
|
223
|
+
driverParam: string;
|
|
224
|
+
enumValues: undefined;
|
|
225
|
+
}> | pg$1.PgArrayBuilder<{
|
|
226
|
+
name: string;
|
|
227
|
+
dataType: "array";
|
|
228
|
+
columnType: "PgArray";
|
|
229
|
+
data: boolean[];
|
|
230
|
+
driverParam: string | boolean[];
|
|
231
|
+
enumValues: undefined;
|
|
232
|
+
size: undefined;
|
|
233
|
+
baseBuilder: {
|
|
234
|
+
name: string;
|
|
235
|
+
dataType: "boolean";
|
|
236
|
+
columnType: "PgBoolean";
|
|
237
|
+
data: boolean;
|
|
238
|
+
driverParam: boolean;
|
|
239
|
+
enumValues: undefined;
|
|
240
|
+
};
|
|
241
|
+
}, {
|
|
242
|
+
name: string;
|
|
243
|
+
dataType: "boolean";
|
|
244
|
+
columnType: "PgBoolean";
|
|
245
|
+
data: boolean;
|
|
246
|
+
driverParam: boolean;
|
|
247
|
+
enumValues: undefined;
|
|
248
|
+
}>;
|
|
120
249
|
/**
|
|
121
|
-
*
|
|
250
|
+
* Map a string to a PG column.
|
|
251
|
+
*
|
|
252
|
+
* @param key The key of the field.
|
|
253
|
+
* @param value The value of the field.
|
|
122
254
|
*/
|
|
123
|
-
|
|
255
|
+
declare const mapStringToColumn: (key: string, value: TSchema$1) => pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
|
|
256
|
+
name: string;
|
|
257
|
+
dataType: "custom";
|
|
258
|
+
columnType: "PgCustomColumn";
|
|
259
|
+
data: Buffer<ArrayBufferLike>;
|
|
260
|
+
driverParam: unknown;
|
|
261
|
+
enumValues: undefined;
|
|
262
|
+
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]>;
|
|
263
|
+
declare const camelToSnakeCase: (str: string) => string;
|
|
124
264
|
/**
|
|
125
|
-
*
|
|
265
|
+
* Convert a schema to columns.
|
|
126
266
|
*/
|
|
267
|
+
type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
|
|
127
268
|
/**
|
|
128
269
|
* A table with columns and schema.
|
|
129
270
|
*/
|
|
@@ -133,22 +274,6 @@ type PgTableWithColumnsAndSchema<T extends TableConfig, R extends TObject> = PgT
|
|
|
133
274
|
get $insertSchema(): TInsertObject<R>;
|
|
134
275
|
};
|
|
135
276
|
//#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
277
|
//#region src/descriptors/$entity.d.ts
|
|
153
278
|
interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1, Keys = keyof Static$1<T>> {
|
|
154
279
|
/**
|
|
@@ -187,6 +312,17 @@ interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1
|
|
|
187
312
|
table: () => any;
|
|
188
313
|
foreignColumn?: keyof Static$1<T>;
|
|
189
314
|
}>;
|
|
315
|
+
foreignKeys?: Array<{
|
|
316
|
+
name?: string;
|
|
317
|
+
columns: Array<keyof Static$1<T>>;
|
|
318
|
+
foreignColumns: Array<AnyPgColumn>;
|
|
319
|
+
}>;
|
|
320
|
+
constraints?: Array<{
|
|
321
|
+
columns: Array<keyof Static$1<T>>;
|
|
322
|
+
name?: string;
|
|
323
|
+
unique?: boolean | {};
|
|
324
|
+
check?: SQL;
|
|
325
|
+
}>;
|
|
190
326
|
/**
|
|
191
327
|
* Extra configuration for the table. See drizzle-orm documentation for more details.
|
|
192
328
|
*
|
|
@@ -200,6 +336,20 @@ interface EntityDescriptorOptions<TTableName extends string, T extends TObject$1
|
|
|
200
336
|
*/
|
|
201
337
|
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
338
|
type Entity<T extends TObject$1> = PgTableWithColumnsAndSchema<PgTableConfig<string, T, FromSchema<T>>, T>;
|
|
339
|
+
/**
|
|
340
|
+
* Create a table with a json schema.
|
|
341
|
+
*
|
|
342
|
+
* @param name The name of the table.
|
|
343
|
+
* @param schema The json schema of the table.
|
|
344
|
+
* @param extraConfig Extra configuration for the table.
|
|
345
|
+
*/
|
|
346
|
+
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>;
|
|
347
|
+
type PgTableConfig<TTableName extends string, TSchema extends TObject$1, TColumnsMap extends FromSchema<TSchema>> = {
|
|
348
|
+
name: TTableName;
|
|
349
|
+
schema: any;
|
|
350
|
+
columns: BuildColumns<TTableName, TColumnsMap, "pg">;
|
|
351
|
+
dialect: "pg";
|
|
352
|
+
};
|
|
203
353
|
//#endregion
|
|
204
354
|
//#region src/providers/drivers/PostgresProvider.d.ts
|
|
205
355
|
type SQLLike = SQLWrapper | string;
|
|
@@ -226,9 +376,6 @@ declare const nullToUndefined: <T extends object>(value: T) => NullToUndefined<T
|
|
|
226
376
|
* Replaces all null values in an object with undefined.
|
|
227
377
|
*/
|
|
228
378
|
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
379
|
type NullifyIfOptional<T> = { [K in keyof T]: undefined extends T[K] ? T[K] | null : T[K] };
|
|
233
380
|
//#endregion
|
|
234
381
|
//#region src/interfaces/FilterOperators.d.ts
|
|
@@ -588,6 +735,9 @@ interface FilterOperators<TValue> {
|
|
|
588
735
|
}
|
|
589
736
|
//#endregion
|
|
590
737
|
//#region src/interfaces/InferInsert.d.ts
|
|
738
|
+
/**
|
|
739
|
+
* Enhance Typebox with a support of "Default" (PG_DEFAULT).
|
|
740
|
+
*/
|
|
591
741
|
type InferInsert<T extends TObject$1> = StaticEntry<T> & StaticDefaultEntry<T>;
|
|
592
742
|
type StaticDefaultEntry<T extends TObject$1> = { [K in keyof T["properties"] as T["properties"][K] extends {
|
|
593
743
|
[PG_DEFAULT]: any;
|
|
@@ -700,10 +850,10 @@ type PgQueryWith<T extends TObject$1 | TArray> = true | {
|
|
|
700
850
|
};
|
|
701
851
|
//#endregion
|
|
702
852
|
//#region src/schemas/pageQuerySchema.d.ts
|
|
703
|
-
declare const pageQuerySchema:
|
|
704
|
-
page:
|
|
705
|
-
size:
|
|
706
|
-
sort:
|
|
853
|
+
declare const pageQuerySchema: _sinclair_typebox63.TObject<{
|
|
854
|
+
page: _sinclair_typebox63.TOptional<_sinclair_typebox63.TNumber>;
|
|
855
|
+
size: _sinclair_typebox63.TOptional<_sinclair_typebox63.TNumber>;
|
|
856
|
+
sort: _sinclair_typebox63.TOptional<_sinclair_typebox63.TString>;
|
|
707
857
|
}>;
|
|
708
858
|
type PageQuery = Static<typeof pageQuerySchema>;
|
|
709
859
|
//#endregion
|
|
@@ -715,9 +865,6 @@ type PageQuery = Static<typeof pageQuerySchema>;
|
|
|
715
865
|
* @param options
|
|
716
866
|
*/
|
|
717
867
|
declare const pageSchema: <T extends TObject$1 | TIntersect | TRecord>(objectSchema: T, options?: ObjectOptions) => TPage<T>;
|
|
718
|
-
/**
|
|
719
|
-
*
|
|
720
|
-
*/
|
|
721
868
|
type TPage<T extends TObject$1 | TIntersect | TRecord> = TObject$1<{
|
|
722
869
|
content: TArray<T>;
|
|
723
870
|
can: TObject$1<{
|
|
@@ -732,9 +879,6 @@ type TPage<T extends TObject$1 | TIntersect | TRecord> = TObject$1<{
|
|
|
732
879
|
countDuration: TOptionalWithFlag<TInteger, true>;
|
|
733
880
|
}>;
|
|
734
881
|
}>;
|
|
735
|
-
/**
|
|
736
|
-
*
|
|
737
|
-
*/
|
|
738
882
|
type Page<T> = {
|
|
739
883
|
content: T[];
|
|
740
884
|
can: {
|
|
@@ -751,16 +895,13 @@ type Page<T> = {
|
|
|
751
895
|
};
|
|
752
896
|
//#endregion
|
|
753
897
|
//#region src/services/Repository.d.ts
|
|
754
|
-
/**
|
|
755
|
-
*
|
|
756
|
-
*/
|
|
757
898
|
declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTableSchema extends TObject$1> {
|
|
758
899
|
readonly provider: PostgresProvider;
|
|
759
900
|
protected readonly alepha: Alepha;
|
|
760
901
|
protected readonly env: {
|
|
761
902
|
POSTGRES_PAGINATION_COUNT_ENABLED: boolean;
|
|
762
903
|
};
|
|
763
|
-
static of: <TEntity extends TableConfig$1, TSchema extends TObject$1>(opts: PgTableWithColumnsAndSchema<TEntity, TSchema$
|
|
904
|
+
static of: <TEntity extends TableConfig$1, TSchema extends TObject$1>(opts: PgTableWithColumnsAndSchema<TEntity, TSchema$2>) => (new () => Repository<PgTableWithColumns<TEntity>, TSchema$2>);
|
|
764
905
|
/**
|
|
765
906
|
* Register Repository as a valid descriptor.
|
|
766
907
|
* - Required for $repository to work.
|
|
@@ -774,7 +915,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
774
915
|
* ID is mandatory. If the table does not have a primary key, it will throw an error.
|
|
775
916
|
*/
|
|
776
917
|
readonly id: {
|
|
777
|
-
type: TSchema$
|
|
918
|
+
type: TSchema$2;
|
|
778
919
|
key: keyof TTableSchema["properties"];
|
|
779
920
|
col: PgColumn;
|
|
780
921
|
};
|
|
@@ -809,10 +950,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
809
950
|
/**
|
|
810
951
|
* Getter for the database connection from the database provider.
|
|
811
952
|
*/
|
|
812
|
-
get db(): PgDatabase<any, Record<string, never>,
|
|
813
|
-
/**
|
|
814
|
-
*
|
|
815
|
-
*/
|
|
953
|
+
get db(): PgDatabase<any, Record<string, never>, drizzle_orm71.ExtractTablesWithRelations<Record<string, never>>>;
|
|
816
954
|
organization(): PgColumn;
|
|
817
955
|
/**
|
|
818
956
|
* Execute a SQL query.
|
|
@@ -840,29 +978,29 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
840
978
|
*
|
|
841
979
|
* @returns The SELECT query builder.
|
|
842
980
|
*/
|
|
843
|
-
protected select(opts?: StatementOptions):
|
|
981
|
+
protected select(opts?: StatementOptions): drizzle_orm_pg_core76.PgSelectBase<string, Record<string, PgColumn<drizzle_orm71.ColumnBaseConfig<drizzle_orm71.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
|
|
844
982
|
[x: string]: unknown;
|
|
845
983
|
}[], {
|
|
846
|
-
[x: string]: PgColumn<
|
|
984
|
+
[x: string]: PgColumn<drizzle_orm71.ColumnBaseConfig<drizzle_orm71.ColumnDataType, string>, {}, {}>;
|
|
847
985
|
}>;
|
|
848
986
|
/**
|
|
849
987
|
* Start an INSERT query on the table.
|
|
850
988
|
*
|
|
851
989
|
* @returns The INSERT query builder.
|
|
852
990
|
*/
|
|
853
|
-
protected insert(opts?: StatementOptions):
|
|
991
|
+
protected insert(opts?: StatementOptions): drizzle_orm_pg_core76.PgInsertBuilder<TTable, any, false>;
|
|
854
992
|
/**
|
|
855
993
|
* Start an UPDATE query on the table.
|
|
856
994
|
*
|
|
857
995
|
* @returns The UPDATE query builder.
|
|
858
996
|
*/
|
|
859
|
-
protected update(opts?: StatementOptions):
|
|
997
|
+
protected update(opts?: StatementOptions): drizzle_orm_pg_core76.PgUpdateBuilder<TTable, any>;
|
|
860
998
|
/**
|
|
861
999
|
* Start a DELETE query on the table.
|
|
862
1000
|
*
|
|
863
1001
|
* @returns The DELETE query builder.
|
|
864
1002
|
*/
|
|
865
|
-
protected delete(opts?: StatementOptions):
|
|
1003
|
+
protected delete(opts?: StatementOptions): drizzle_orm_pg_core76.PgDeleteBase<TTable, any, undefined, undefined, false, never>;
|
|
866
1004
|
/**
|
|
867
1005
|
* Find entities.
|
|
868
1006
|
*
|
|
@@ -895,13 +1033,7 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
895
1033
|
* @returns The paginated entities.
|
|
896
1034
|
*/
|
|
897
1035
|
paginate(pageQuery?: PageQuery, findQuery?: PgQuery<TTableSchema>, opts?: StatementOptions): Promise<Page<Static$1<TTableSchema>>>;
|
|
898
|
-
/**
|
|
899
|
-
*
|
|
900
|
-
*/
|
|
901
1036
|
createQuery(query?: PgQuery<TTableSchema>): PgQuery<TTableSchema>;
|
|
902
|
-
/**
|
|
903
|
-
*
|
|
904
|
-
*/
|
|
905
1037
|
createQueryWhere(where?: PgQueryWhere<Static$1<TTableSchema>>): PgQueryWhere<Static$1<TTableSchema>>;
|
|
906
1038
|
/**
|
|
907
1039
|
* Create an entity.
|
|
@@ -1018,14 +1150,6 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
1018
1150
|
* @returns The where clause for the ID.
|
|
1019
1151
|
*/
|
|
1020
1152
|
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
1153
|
/**
|
|
1030
1154
|
* Find a primary key in the schema.
|
|
1031
1155
|
*
|
|
@@ -1034,31 +1158,9 @@ declare class Repository<TTable extends PgTableWithColumns<TableConfig$1>, TTabl
|
|
|
1034
1158
|
*/
|
|
1035
1159
|
protected getPrimaryKey(schema: TObject$1): {
|
|
1036
1160
|
key: string;
|
|
1037
|
-
col: PgColumn<
|
|
1038
|
-
type: TSchema$
|
|
1161
|
+
col: PgColumn<drizzle_orm71.ColumnBaseConfig<drizzle_orm71.ColumnDataType, string>, {}, {}>;
|
|
1162
|
+
type: TSchema$2;
|
|
1039
1163
|
};
|
|
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
1164
|
}
|
|
1063
1165
|
/**
|
|
1064
1166
|
* The options for a statement.
|
|
@@ -1086,7 +1188,7 @@ interface StatementOptions {
|
|
|
1086
1188
|
}
|
|
1087
1189
|
interface PgAttrField {
|
|
1088
1190
|
key: string;
|
|
1089
|
-
type: TSchema$
|
|
1191
|
+
type: TSchema$2;
|
|
1090
1192
|
data: any;
|
|
1091
1193
|
nested?: any[];
|
|
1092
1194
|
}
|
|
@@ -1113,51 +1215,20 @@ declare const $repository: {
|
|
|
1113
1215
|
//#region src/descriptors/$sequence.d.ts
|
|
1114
1216
|
declare const KEY = "SEQUENCE";
|
|
1115
1217
|
interface SequenceDescriptorOptions {
|
|
1116
|
-
/**
|
|
1117
|
-
*
|
|
1118
|
-
*/
|
|
1119
1218
|
name?: string;
|
|
1120
|
-
/**
|
|
1121
|
-
*
|
|
1122
|
-
*/
|
|
1123
1219
|
start?: number;
|
|
1124
|
-
/**
|
|
1125
|
-
*
|
|
1126
|
-
*/
|
|
1127
1220
|
increment?: number;
|
|
1128
|
-
/**
|
|
1129
|
-
*
|
|
1130
|
-
*/
|
|
1131
1221
|
min?: number;
|
|
1132
|
-
/**
|
|
1133
|
-
*
|
|
1134
|
-
*/
|
|
1135
1222
|
max?: number;
|
|
1136
|
-
/**
|
|
1137
|
-
*
|
|
1138
|
-
*/
|
|
1139
1223
|
cycle?: boolean;
|
|
1140
1224
|
}
|
|
1141
1225
|
interface SequenceDescriptor {
|
|
1142
1226
|
[KIND]: typeof KEY;
|
|
1143
1227
|
[OPTIONS]: SequenceDescriptorOptions;
|
|
1144
|
-
/**
|
|
1145
|
-
*
|
|
1146
|
-
*/
|
|
1147
1228
|
(): Promise<number>;
|
|
1148
|
-
/**
|
|
1149
|
-
*
|
|
1150
|
-
*/
|
|
1151
1229
|
next(): Promise<number>;
|
|
1152
|
-
/**
|
|
1153
|
-
*
|
|
1154
|
-
*/
|
|
1155
1230
|
current(): Promise<number>;
|
|
1156
1231
|
}
|
|
1157
|
-
/**
|
|
1158
|
-
*
|
|
1159
|
-
* @param options
|
|
1160
|
-
*/
|
|
1161
1232
|
declare const $sequence: {
|
|
1162
1233
|
(options?: SequenceDescriptorOptions): SequenceDescriptor;
|
|
1163
1234
|
[KIND]: string;
|
|
@@ -1165,21 +1236,10 @@ declare const $sequence: {
|
|
|
1165
1236
|
//#endregion
|
|
1166
1237
|
//#region src/descriptors/$transaction.d.ts
|
|
1167
1238
|
interface TransactionDescriptorOptions<T extends any[], R> {
|
|
1168
|
-
/**
|
|
1169
|
-
*
|
|
1170
|
-
* @param tx
|
|
1171
|
-
* @param args
|
|
1172
|
-
*/
|
|
1173
1239
|
handler: (tx: PgTransaction<any, any, any>, ...args: T) => Promise<R>;
|
|
1174
|
-
/**
|
|
1175
|
-
*
|
|
1176
|
-
*/
|
|
1177
1240
|
config?: PgTransactionConfig$1;
|
|
1178
1241
|
}
|
|
1179
1242
|
type TransactionContext = PgTransaction<any, any, any>;
|
|
1180
|
-
/**
|
|
1181
|
-
* Creates a transaction descriptor.
|
|
1182
|
-
*/
|
|
1183
1243
|
declare const $transaction: <T extends any[], R>(opts: TransactionDescriptorOptions<T, R>) => _alepha_retry2.RetryDescriptor<(...args: T) => Promise<R>>;
|
|
1184
1244
|
//#endregion
|
|
1185
1245
|
//#region src/errors/EntityNotFoundError.d.ts
|
|
@@ -1191,12 +1251,12 @@ declare class EntityNotFoundError extends Error {
|
|
|
1191
1251
|
//#endregion
|
|
1192
1252
|
//#region src/providers/RepositoryDescriptorProvider.d.ts
|
|
1193
1253
|
declare class RepositoryDescriptorProvider {
|
|
1194
|
-
protected readonly log:
|
|
1254
|
+
protected readonly log: _alepha_core17.Logger;
|
|
1195
1255
|
protected readonly alepha: Alepha;
|
|
1196
1256
|
protected readonly repositories: Array<Repository<any, TObject$1>>;
|
|
1197
1257
|
constructor();
|
|
1198
1258
|
clearRepositories(): Promise<void>;
|
|
1199
|
-
protected readonly configure:
|
|
1259
|
+
protected readonly configure: _alepha_core17.HookDescriptor<"configure">;
|
|
1200
1260
|
/**
|
|
1201
1261
|
* Get all repositories.
|
|
1202
1262
|
*
|
|
@@ -1229,7 +1289,7 @@ declare class RepositoryDescriptorProvider {
|
|
|
1229
1289
|
//#endregion
|
|
1230
1290
|
//#region src/providers/DrizzleKitProvider.d.ts
|
|
1231
1291
|
declare class DrizzleKitProvider {
|
|
1232
|
-
protected readonly log:
|
|
1292
|
+
protected readonly log: _alepha_core36.Logger;
|
|
1233
1293
|
protected readonly alepha: Alepha;
|
|
1234
1294
|
protected readonly repositoryProvider: RepositoryDescriptorProvider;
|
|
1235
1295
|
push(provider: PostgresProvider, schema?: string): Promise<void>;
|
|
@@ -1246,6 +1306,7 @@ declare class DrizzleKitProvider {
|
|
|
1246
1306
|
* @returns A promise that resolves once the migrations have been executed.
|
|
1247
1307
|
*/
|
|
1248
1308
|
synchronize(provider: PostgresProvider, schema?: string): Promise<void>;
|
|
1309
|
+
synchronizeSqlite(provider: PostgresProvider): Promise<void>;
|
|
1249
1310
|
protected getTables(provider: PostgresProvider, schema?: string): Promise<Record<string, any>>;
|
|
1250
1311
|
protected loadMigrationSnapshot(provider: PostgresProvider): Promise<any>;
|
|
1251
1312
|
protected saveMigrationSnapshot(provider: PostgresProvider, curr: Record<string, any>, entry?: {
|
|
@@ -1265,38 +1326,38 @@ declare class DrizzleKitProvider {
|
|
|
1265
1326
|
declare module "alepha" {
|
|
1266
1327
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
1267
1328
|
}
|
|
1268
|
-
declare const envSchema:
|
|
1269
|
-
PG_HOST:
|
|
1270
|
-
PG_USERNAME:
|
|
1271
|
-
PG_DATABASE:
|
|
1272
|
-
PG_PASSWORD:
|
|
1273
|
-
PG_PORT:
|
|
1274
|
-
DATABASE_URL:
|
|
1275
|
-
DATABASE_MIGRATIONS_FOLDER:
|
|
1329
|
+
declare const envSchema: _alepha_core58.TObject<{
|
|
1330
|
+
PG_HOST: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1331
|
+
PG_USERNAME: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1332
|
+
PG_DATABASE: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1333
|
+
PG_PASSWORD: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1334
|
+
PG_PORT: _sinclair_typebox38.TOptional<_sinclair_typebox38.TNumber>;
|
|
1335
|
+
DATABASE_URL: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1336
|
+
DATABASE_MIGRATIONS_FOLDER: _sinclair_typebox38.TString;
|
|
1276
1337
|
/**
|
|
1277
1338
|
* The schema to use.
|
|
1278
1339
|
* Accept a string.
|
|
1279
1340
|
*/
|
|
1280
|
-
POSTGRES_SCHEMA:
|
|
1341
|
+
POSTGRES_SCHEMA: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
1281
1342
|
/**
|
|
1282
1343
|
* Synchronize the database schema with the models.
|
|
1283
1344
|
* Accept a boolean or a postgres schema name.
|
|
1284
1345
|
*
|
|
1285
1346
|
* @default false
|
|
1286
1347
|
*/
|
|
1287
|
-
POSTGRES_SYNCHRONIZE:
|
|
1348
|
+
POSTGRES_SYNCHRONIZE: _sinclair_typebox38.TOptional<_sinclair_typebox38.TBoolean>;
|
|
1288
1349
|
/**
|
|
1289
1350
|
* Push the schema to the database.
|
|
1290
1351
|
*
|
|
1291
1352
|
* @default false
|
|
1292
1353
|
*/
|
|
1293
|
-
POSTGRES_PUSH_SCHEMA:
|
|
1354
|
+
POSTGRES_PUSH_SCHEMA: _sinclair_typebox38.TOptional<_sinclair_typebox38.TBoolean>;
|
|
1294
1355
|
/**
|
|
1295
1356
|
* Reject unauthorized SSL connections.
|
|
1296
1357
|
*
|
|
1297
1358
|
* @default false
|
|
1298
1359
|
*/
|
|
1299
|
-
POSTGRES_REJECT_UNAUTHORIZED:
|
|
1360
|
+
POSTGRES_REJECT_UNAUTHORIZED: _sinclair_typebox38.TBoolean;
|
|
1300
1361
|
}>;
|
|
1301
1362
|
interface NodePostgresProviderState {
|
|
1302
1363
|
client: postgres.Sql;
|
|
@@ -1304,14 +1365,14 @@ interface NodePostgresProviderState {
|
|
|
1304
1365
|
}
|
|
1305
1366
|
declare class NodePostgresProvider implements PostgresProvider {
|
|
1306
1367
|
readonly dialect = "postgres";
|
|
1307
|
-
protected readonly log:
|
|
1368
|
+
protected readonly log: _alepha_core58.Logger;
|
|
1308
1369
|
protected readonly env: {
|
|
1370
|
+
DATABASE_URL?: string | undefined;
|
|
1309
1371
|
PG_HOST?: string | undefined;
|
|
1310
1372
|
PG_USERNAME?: string | undefined;
|
|
1311
1373
|
PG_DATABASE?: string | undefined;
|
|
1312
1374
|
PG_PASSWORD?: string | undefined;
|
|
1313
1375
|
PG_PORT?: number | undefined;
|
|
1314
|
-
DATABASE_URL?: string | undefined;
|
|
1315
1376
|
POSTGRES_SCHEMA?: string | undefined;
|
|
1316
1377
|
POSTGRES_SYNCHRONIZE?: boolean | undefined;
|
|
1317
1378
|
POSTGRES_PUSH_SCHEMA?: boolean | undefined;
|
|
@@ -1326,8 +1387,8 @@ declare class NodePostgresProvider implements PostgresProvider {
|
|
|
1326
1387
|
*/
|
|
1327
1388
|
protected testingSchemaName?: string;
|
|
1328
1389
|
get db(): PostgresJsDatabase;
|
|
1329
|
-
protected readonly configure:
|
|
1330
|
-
protected readonly stop:
|
|
1390
|
+
protected readonly configure: _alepha_core58.HookDescriptor<"start">;
|
|
1391
|
+
protected readonly stop: _alepha_core58.HookDescriptor<"stop">;
|
|
1331
1392
|
/**
|
|
1332
1393
|
* Get Postgres schema.
|
|
1333
1394
|
*/
|
|
@@ -1335,7 +1396,7 @@ declare class NodePostgresProvider implements PostgresProvider {
|
|
|
1335
1396
|
execute(query: SQLLike): Promise<any[]>;
|
|
1336
1397
|
connect(): Promise<void>;
|
|
1337
1398
|
close(): Promise<void>;
|
|
1338
|
-
protected migrate:
|
|
1399
|
+
protected migrate: _alepha_lock62.LockDescriptor<() => Promise<void>>;
|
|
1339
1400
|
protected createClient(): NodePostgresProviderState;
|
|
1340
1401
|
protected getMigrationOptions(): MigrationConfig;
|
|
1341
1402
|
protected getClientOptions(): postgres.Options<any>;
|
|
@@ -1343,26 +1404,23 @@ declare class NodePostgresProvider implements PostgresProvider {
|
|
|
1343
1404
|
protected ssl(url: URL | undefined): "require" | "allow" | "prefer" | "verify-full" | undefined;
|
|
1344
1405
|
}
|
|
1345
1406
|
//#endregion
|
|
1346
|
-
//#region src/
|
|
1407
|
+
//#region src/helpers/pgAttr.d.ts
|
|
1347
1408
|
/**
|
|
1348
1409
|
* Type representation.
|
|
1349
1410
|
*/
|
|
1350
1411
|
type PgAttr<T extends TSchema$1, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
1351
1412
|
//#endregion
|
|
1352
1413
|
//#region src/schemas/createdAtSchema.d.ts
|
|
1353
|
-
declare const createdAtSchema: PgAttr<PgAttr<
|
|
1414
|
+
declare const createdAtSchema: PgAttr<PgAttr<_sinclair_typebox85.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
1354
1415
|
//#endregion
|
|
1355
1416
|
//#region src/schemas/legacyIdSchema.d.ts
|
|
1356
1417
|
/**
|
|
1357
1418
|
* @deprecated Use `pg.primaryKey()` instead.
|
|
1358
1419
|
*/
|
|
1359
|
-
declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<
|
|
1420
|
+
declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<_sinclair_typebox88.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
|
|
1360
1421
|
//#endregion
|
|
1361
1422
|
//#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>;
|
|
1423
|
+
declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox82.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
1366
1424
|
//#endregion
|
|
1367
1425
|
//#region src/schemas/entitySchema.d.ts
|
|
1368
1426
|
/**
|
|
@@ -1371,9 +1429,9 @@ declare const updatedAtSchema: PgAttr<PgAttr<_sinclair_typebox78.TString, typeof
|
|
|
1371
1429
|
* Add some common SQL properties to an object.
|
|
1372
1430
|
*/
|
|
1373
1431
|
declare const entitySchema: TObject$1<{
|
|
1374
|
-
id: PgAttr<PgAttr<PgAttr<
|
|
1375
|
-
createdAt: PgAttr<PgAttr<
|
|
1376
|
-
updatedAt: PgAttr<PgAttr<
|
|
1432
|
+
id: PgAttr<PgAttr<PgAttr<_sinclair_typebox19.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
|
|
1433
|
+
createdAt: PgAttr<PgAttr<_sinclair_typebox19.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
1434
|
+
updatedAt: PgAttr<PgAttr<_sinclair_typebox19.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
1377
1435
|
}>;
|
|
1378
1436
|
/**
|
|
1379
1437
|
* TypeBox Entity Type.
|
|
@@ -1403,43 +1461,43 @@ declare module "alepha/core" {
|
|
|
1403
1461
|
}
|
|
1404
1462
|
}
|
|
1405
1463
|
declare class PostgresTypeProvider {
|
|
1406
|
-
readonly attr: <T extends TSchema$
|
|
1464
|
+
readonly attr: <T extends TSchema$2, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
|
|
1407
1465
|
/**
|
|
1408
1466
|
* Creates a primary key with an identity column.
|
|
1409
1467
|
*/
|
|
1410
|
-
readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<
|
|
1468
|
+
readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: IntegerOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox10.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
1411
1469
|
/**
|
|
1412
1470
|
* Creates a primary key with a big identity column. (default)
|
|
1413
1471
|
*/
|
|
1414
|
-
readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<
|
|
1472
|
+
readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox10.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
1415
1473
|
/**
|
|
1416
1474
|
* Creates a primary key with a UUID column.
|
|
1417
1475
|
*/
|
|
1418
|
-
readonly uuidPrimaryKey: () => PgAttr<PgAttr<
|
|
1476
|
+
readonly uuidPrimaryKey: () => PgAttr<PgAttr<_sinclair_typebox10.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
1419
1477
|
/**
|
|
1420
1478
|
*
|
|
1421
1479
|
* @alias bigIdentityPrimaryKey
|
|
1422
1480
|
*/
|
|
1423
|
-
readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<
|
|
1481
|
+
readonly primaryKey: (identity?: PgIdentityOptions, options?: NumberOptions) => PgAttr<PgAttr<PgAttr<_sinclair_typebox10.TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
1424
1482
|
/**
|
|
1425
1483
|
* Wrap a schema with "default" attribute.
|
|
1426
1484
|
* This is used to set a default value for a column in the database.
|
|
1427
1485
|
*/
|
|
1428
|
-
readonly default: <T extends TSchema$
|
|
1486
|
+
readonly default: <T extends TSchema$2>(type: T, value?: Static$1<T>) => PgAttr<T, PgDefault>;
|
|
1429
1487
|
/**
|
|
1430
1488
|
* Creates a column version.
|
|
1431
1489
|
* This is used to track the version of a row in the database.
|
|
1432
1490
|
* You can use it for optimistic concurrency control.
|
|
1433
1491
|
*/
|
|
1434
|
-
readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<
|
|
1492
|
+
readonly version: (options?: IntegerOptions) => PgAttr<PgAttr<_sinclair_typebox10.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
1435
1493
|
/**
|
|
1436
1494
|
* Creates a column Created At. So just a datetime column with a default value of the current timestamp.
|
|
1437
1495
|
*/
|
|
1438
|
-
readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<
|
|
1496
|
+
readonly createdAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox10.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
1439
1497
|
/**
|
|
1440
1498
|
* Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
|
|
1441
1499
|
*/
|
|
1442
|
-
readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<
|
|
1500
|
+
readonly updatedAt: (options?: StringOptions) => PgAttr<PgAttr<_sinclair_typebox10.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
1443
1501
|
/**
|
|
1444
1502
|
* @deprecated Build your own entity schema.
|
|
1445
1503
|
*/
|
|
@@ -1460,14 +1518,14 @@ declare class PostgresTypeProvider {
|
|
|
1460
1518
|
/**
|
|
1461
1519
|
* Creates a reference to another table or schema.
|
|
1462
1520
|
*/
|
|
1463
|
-
readonly ref: <T extends TSchema$
|
|
1521
|
+
readonly ref: <T extends TSchema$2>(type: T, ref: () => any, actions?: {
|
|
1464
1522
|
onUpdate?: UpdateDeleteAction$1;
|
|
1465
1523
|
onDelete?: UpdateDeleteAction$1;
|
|
1466
1524
|
}) => PgAttr<T, PgRef>;
|
|
1467
1525
|
/**
|
|
1468
1526
|
* @alias ref
|
|
1469
1527
|
*/
|
|
1470
|
-
references: <T extends TSchema$
|
|
1528
|
+
references: <T extends TSchema$2>(type: T, ref: () => any, actions?: {
|
|
1471
1529
|
onUpdate?: UpdateDeleteAction$1;
|
|
1472
1530
|
onDelete?: UpdateDeleteAction$1;
|
|
1473
1531
|
}) => PgAttr<T, PgRef>;
|
|
@@ -1484,7 +1542,7 @@ declare const pg: PostgresTypeProvider;
|
|
|
1484
1542
|
/**
|
|
1485
1543
|
* Postgres schema type.
|
|
1486
1544
|
*/
|
|
1487
|
-
declare const schema: <TDocument extends TSchema$
|
|
1545
|
+
declare const schema: <TDocument extends TSchema$2>(name: string, document: TDocument) => drizzle_orm1.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
|
|
1488
1546
|
name: string;
|
|
1489
1547
|
dataType: "custom";
|
|
1490
1548
|
columnType: "PgCustomColumn";
|
|
@@ -1500,8 +1558,11 @@ declare const schema: <TDocument extends TSchema$1>(name: string, document: TDoc
|
|
|
1500
1558
|
//#region src/index.d.ts
|
|
1501
1559
|
declare class AlephaPostgres implements Module {
|
|
1502
1560
|
readonly name = "alepha.postgres";
|
|
1503
|
-
readonly
|
|
1561
|
+
readonly env: {
|
|
1562
|
+
DATABASE_URL: string;
|
|
1563
|
+
};
|
|
1564
|
+
readonly $services: (alepha: Alepha) => void;
|
|
1504
1565
|
}
|
|
1505
1566
|
//#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,
|
|
1567
|
+
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, camelToSnakeCase, drizzle, entityKeys, entitySchema, mapFieldToColumn, mapStringToColumn, nullToUndefined, pageQuerySchema, pageSchema, pg, pgTableSchema, schema, schemaToPgColumns, sql };
|
|
1507
1568
|
//# sourceMappingURL=index.d.ts.map
|