alepha 0.10.2 → 0.10.4

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/api/users.d.ts ADDED
@@ -0,0 +1,394 @@
1
+ import * as _alepha_core0 from "alepha";
2
+ import { Alepha, Static } from "alepha";
3
+ import * as _alepha_react_auth0 from "alepha/react/auth";
4
+ import { OAuth2Profile } from "alepha/react/auth";
5
+ import { DateTimeProvider } from "alepha/datetime";
6
+ import * as _alepha_postgres92 from "alepha/postgres";
7
+ import * as _alepha_security0 from "alepha/security";
8
+ import { CryptoProvider, RealmDescriptor, RealmDescriptorOptions, UserAccount } from "alepha/security";
9
+ import * as typebox131 from "typebox";
10
+ import * as _alepha_postgres_src_helpers_pgAttr_ts83 from "alepha/postgres/src/helpers/pgAttr.ts";
11
+ import * as _alepha_postgres_src_helpers_pgAttr0 from "alepha/postgres/src/helpers/pgAttr";
12
+
13
+ //#region src/descriptors/$authApple.d.ts
14
+ /**
15
+ * TODO: Implement Apple authentication
16
+ */
17
+ declare const $authApple: () => never;
18
+ //#endregion
19
+ //#region src/descriptors/$authGithub.d.ts
20
+ /**
21
+ * Already configured GitHub authentication descriptor.
22
+ *
23
+ * Uses OAuth2 to authenticate users via their GitHub accounts.
24
+ * Upon successful authentication, it links the GitHub account to a user session.
25
+ *
26
+ * Environment Variables:
27
+ * - `GITHUB_CLIENT_ID`: The client ID obtained from the GitHub Developer Settings.
28
+ * - `GITHUB_CLIENT_SECRET`: The client secret obtained from the GitHub Developer Settings.
29
+ */
30
+ declare const $authGithub: (realm: RealmDescriptor) => _alepha_react_auth0.AuthDescriptor;
31
+ //#endregion
32
+ //#region src/descriptors/$authGoogle.d.ts
33
+ /**
34
+ * Already configured Google authentication descriptor.
35
+ *
36
+ * Uses OpenID Connect (OIDC) to authenticate users via their Google accounts.
37
+ * Upon successful authentication, it links the Google account to a user session.
38
+ *
39
+ * Environment Variables:
40
+ * - `GOOGLE_CLIENT_ID`: The client ID obtained from the Google Developer Console.
41
+ * - `GOOGLE_CLIENT_SECRET`: The client secret obtained from the Google Developer Console.
42
+ */
43
+ declare const $authGoogle: (realm: RealmDescriptor) => _alepha_react_auth0.AuthDescriptor;
44
+ //#endregion
45
+ //#region src/descriptors/$realmUsers.d.ts
46
+ /**
47
+ * Already configured realm for user management.
48
+ *
49
+ * Realm contains two roles: `admin` and `user`.
50
+ *
51
+ * - `admin`: Has full access to all resources and permissions.
52
+ * - `user`: Has access to their own resources and permissions, but cannot access admin-level resources.
53
+ *
54
+ * Realm uses session management for handling user sessions.
55
+ *
56
+ * Environment Variables:
57
+ * - `APP_SECRET`: Secret key for signing tokens (if not provided in options).
58
+ */
59
+ declare const $realmUsers: (options?: {
60
+ secret?: string;
61
+ realm?: Partial<RealmDescriptorOptions>;
62
+ }) => _alepha_security0.RealmDescriptor;
63
+ //#endregion
64
+ //#region src/entities/identities.d.ts
65
+ declare const identities: _alepha_postgres92.PgTableWithColumnsAndSchema<_alepha_postgres92.PgTableConfig<"identities", typebox131.TObject<{
66
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
67
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
68
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
69
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
70
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
71
+ provider: typebox131.TString;
72
+ providerUserId: typebox131.TString;
73
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
74
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
75
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
76
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
77
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
78
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
79
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
80
+ provider: typebox131.TString;
81
+ providerUserId: typebox131.TString;
82
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
83
+ }>>>, typebox131.TObject<{
84
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
85
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
86
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
87
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
88
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
89
+ provider: typebox131.TString;
90
+ providerUserId: typebox131.TString;
91
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
92
+ }>>;
93
+ type IdentityEntity = Static<typeof identities.$schema>;
94
+ //#endregion
95
+ //#region src/entities/sessions.d.ts
96
+ declare const sessions: _alepha_postgres92.PgTableWithColumnsAndSchema<_alepha_postgres92.PgTableConfig<"sessions", typebox131.TObject<{
97
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
98
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
99
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
100
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
101
+ refreshToken: typebox131.TString;
102
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
103
+ expiresAt: typebox131.TString;
104
+ ip: typebox131.TOptional<typebox131.TString>;
105
+ userAgent: typebox131.TOptional<typebox131.TObject<{
106
+ os: typebox131.TString;
107
+ browser: typebox131.TString;
108
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
109
+ }>>;
110
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
111
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
112
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
113
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
114
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
115
+ refreshToken: typebox131.TString;
116
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
117
+ expiresAt: typebox131.TString;
118
+ ip: typebox131.TOptional<typebox131.TString>;
119
+ userAgent: typebox131.TOptional<typebox131.TObject<{
120
+ os: typebox131.TString;
121
+ browser: typebox131.TString;
122
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
123
+ }>>;
124
+ }>>>, typebox131.TObject<{
125
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
126
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
127
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
128
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
129
+ refreshToken: typebox131.TString;
130
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
131
+ expiresAt: typebox131.TString;
132
+ ip: typebox131.TOptional<typebox131.TString>;
133
+ userAgent: typebox131.TOptional<typebox131.TObject<{
134
+ os: typebox131.TString;
135
+ browser: typebox131.TString;
136
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
137
+ }>>;
138
+ }>>;
139
+ type SessionEntity = Static<typeof sessions.$schema>;
140
+ //#endregion
141
+ //#region src/entities/users.d.ts
142
+ declare const users: _alepha_postgres92.PgTableWithColumnsAndSchema<_alepha_postgres92.PgTableConfig<"users", typebox131.TObject<{
143
+ id: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
144
+ version: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
145
+ createdAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
146
+ updatedAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
147
+ email: typebox131.TString;
148
+ roles: typebox131.TArray<typebox131.TString>;
149
+ name: typebox131.TOptional<typebox131.TString>;
150
+ firstName: typebox131.TOptional<typebox131.TString>;
151
+ lastName: typebox131.TOptional<typebox131.TString>;
152
+ picture: typebox131.TOptional<typebox131.TString>;
153
+ enabled: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
154
+ emailVerified: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
155
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
156
+ id: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
157
+ version: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
158
+ createdAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
159
+ updatedAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
160
+ email: typebox131.TString;
161
+ roles: typebox131.TArray<typebox131.TString>;
162
+ name: typebox131.TOptional<typebox131.TString>;
163
+ firstName: typebox131.TOptional<typebox131.TString>;
164
+ lastName: typebox131.TOptional<typebox131.TString>;
165
+ picture: typebox131.TOptional<typebox131.TString>;
166
+ enabled: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
167
+ emailVerified: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
168
+ }>>>, typebox131.TObject<{
169
+ id: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
170
+ version: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
171
+ createdAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
172
+ updatedAt: _alepha_postgres_src_helpers_pgAttr0.PgAttr<_alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
173
+ email: typebox131.TString;
174
+ roles: typebox131.TArray<typebox131.TString>;
175
+ name: typebox131.TOptional<typebox131.TString>;
176
+ firstName: typebox131.TOptional<typebox131.TString>;
177
+ lastName: typebox131.TOptional<typebox131.TString>;
178
+ picture: typebox131.TOptional<typebox131.TString>;
179
+ enabled: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
180
+ emailVerified: _alepha_postgres_src_helpers_pgAttr0.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
181
+ }>>;
182
+ type UserEntity = Static<typeof users.$schema>;
183
+ //#endregion
184
+ //#region src/services/SessionService.d.ts
185
+ declare class SessionService {
186
+ protected readonly alepha: Alepha;
187
+ protected readonly dateTimeProvider: DateTimeProvider;
188
+ protected readonly cryptoProvider: CryptoProvider;
189
+ readonly users: _alepha_postgres92.RepositoryDescriptor<_alepha_postgres92.PgTableConfig<"users", typebox131.TObject<{
190
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
191
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
192
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
193
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
194
+ email: typebox131.TString;
195
+ roles: typebox131.TArray<typebox131.TString>;
196
+ name: typebox131.TOptional<typebox131.TString>;
197
+ firstName: typebox131.TOptional<typebox131.TString>;
198
+ lastName: typebox131.TOptional<typebox131.TString>;
199
+ picture: typebox131.TOptional<typebox131.TString>;
200
+ enabled: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
201
+ emailVerified: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
202
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
203
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
204
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
205
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
206
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
207
+ email: typebox131.TString;
208
+ roles: typebox131.TArray<typebox131.TString>;
209
+ name: typebox131.TOptional<typebox131.TString>;
210
+ firstName: typebox131.TOptional<typebox131.TString>;
211
+ lastName: typebox131.TOptional<typebox131.TString>;
212
+ picture: typebox131.TOptional<typebox131.TString>;
213
+ enabled: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
214
+ emailVerified: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
215
+ }>>>, typebox131.TObject<{
216
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
217
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
218
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
219
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
220
+ email: typebox131.TString;
221
+ roles: typebox131.TArray<typebox131.TString>;
222
+ name: typebox131.TOptional<typebox131.TString>;
223
+ firstName: typebox131.TOptional<typebox131.TString>;
224
+ lastName: typebox131.TOptional<typebox131.TString>;
225
+ picture: typebox131.TOptional<typebox131.TString>;
226
+ enabled: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
227
+ emailVerified: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TBoolean, typeof _alepha_postgres92.PG_DEFAULT>;
228
+ }>>;
229
+ readonly sessions: _alepha_postgres92.RepositoryDescriptor<_alepha_postgres92.PgTableConfig<"sessions", typebox131.TObject<{
230
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
231
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
232
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
233
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
234
+ refreshToken: typebox131.TString;
235
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
236
+ expiresAt: typebox131.TString;
237
+ ip: typebox131.TOptional<typebox131.TString>;
238
+ userAgent: typebox131.TOptional<typebox131.TObject<{
239
+ os: typebox131.TString;
240
+ browser: typebox131.TString;
241
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
242
+ }>>;
243
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
244
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
245
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
246
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
247
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
248
+ refreshToken: typebox131.TString;
249
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
250
+ expiresAt: typebox131.TString;
251
+ ip: typebox131.TOptional<typebox131.TString>;
252
+ userAgent: typebox131.TOptional<typebox131.TObject<{
253
+ os: typebox131.TString;
254
+ browser: typebox131.TString;
255
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
256
+ }>>;
257
+ }>>>, typebox131.TObject<{
258
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
259
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
260
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
261
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
262
+ refreshToken: typebox131.TString;
263
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
264
+ expiresAt: typebox131.TString;
265
+ ip: typebox131.TOptional<typebox131.TString>;
266
+ userAgent: typebox131.TOptional<typebox131.TObject<{
267
+ os: typebox131.TString;
268
+ browser: typebox131.TString;
269
+ device: typebox131.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
270
+ }>>;
271
+ }>>;
272
+ readonly identities: _alepha_postgres92.RepositoryDescriptor<_alepha_postgres92.PgTableConfig<"identities", typebox131.TObject<{
273
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
274
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
275
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
276
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
277
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
278
+ provider: typebox131.TString;
279
+ providerUserId: typebox131.TString;
280
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
281
+ }>, _alepha_postgres92.FromSchema<typebox131.TObject<{
282
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
283
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
284
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
285
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
286
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
287
+ provider: typebox131.TString;
288
+ providerUserId: typebox131.TString;
289
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
290
+ }>>>, typebox131.TObject<{
291
+ id: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_PRIMARY_KEY>, typeof _alepha_postgres92.PG_DEFAULT>;
292
+ version: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TInteger, typeof _alepha_postgres92.PG_VERSION>, typeof _alepha_postgres92.PG_DEFAULT>;
293
+ createdAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_CREATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
294
+ updatedAt: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<_alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_UPDATED_AT>, typeof _alepha_postgres92.PG_DEFAULT>;
295
+ userId: _alepha_postgres_src_helpers_pgAttr_ts83.PgAttr<typebox131.TString, typeof _alepha_postgres92.PG_REF>;
296
+ provider: typebox131.TString;
297
+ providerUserId: typebox131.TString;
298
+ providerData: typebox131.TOptional<typebox131.TRecord<string, typebox131.TAny>>;
299
+ }>>;
300
+ login(provider: string, username: string, password: string): Promise<{
301
+ name?: string | undefined;
302
+ firstName?: string | undefined;
303
+ lastName?: string | undefined;
304
+ picture?: string | undefined;
305
+ id: string;
306
+ version: number;
307
+ createdAt: string;
308
+ updatedAt: string;
309
+ email: string;
310
+ roles: string[];
311
+ enabled: boolean;
312
+ emailVerified: boolean;
313
+ }>;
314
+ createSession(user: UserAccount, expiresIn: number): Promise<{
315
+ refreshToken: string;
316
+ sessionId: string;
317
+ }>;
318
+ refreshSession(refreshToken: string): Promise<{
319
+ user: {
320
+ name?: string | undefined;
321
+ firstName?: string | undefined;
322
+ lastName?: string | undefined;
323
+ picture?: string | undefined;
324
+ id: string;
325
+ version: number;
326
+ createdAt: string;
327
+ updatedAt: string;
328
+ email: string;
329
+ roles: string[];
330
+ enabled: boolean;
331
+ emailVerified: boolean;
332
+ };
333
+ expiresIn: number;
334
+ sessionId: string;
335
+ }>;
336
+ deleteSession(refreshToken: string): Promise<void>;
337
+ link(provider: string, profile: OAuth2Profile): Promise<{
338
+ name?: string | undefined;
339
+ firstName?: string | undefined;
340
+ lastName?: string | undefined;
341
+ picture?: string | undefined;
342
+ id: string;
343
+ version: number;
344
+ createdAt: string;
345
+ updatedAt: string;
346
+ email: string;
347
+ roles: string[];
348
+ enabled: boolean;
349
+ emailVerified: boolean;
350
+ } | {
351
+ sub: string;
352
+ email?: string;
353
+ name?: string;
354
+ given_name?: string;
355
+ family_name?: string;
356
+ middle_name?: string;
357
+ nickname?: string;
358
+ preferred_username?: string;
359
+ profile?: string;
360
+ picture?: string;
361
+ website?: string;
362
+ email_verified?: boolean;
363
+ gender?: string;
364
+ birthdate?: string;
365
+ zoneinfo?: string;
366
+ locale?: string;
367
+ phone_number?: string;
368
+ phone_number_verified?: boolean;
369
+ address?: {
370
+ formatted?: string;
371
+ street_address?: string;
372
+ locality?: string;
373
+ region?: string;
374
+ postal_code?: string;
375
+ country?: string;
376
+ };
377
+ updated_at?: number;
378
+ id: string;
379
+ }>;
380
+ }
381
+ //#endregion
382
+ //#region src/index.d.ts
383
+ /**
384
+ * Provides user management API endpoints for Alepha applications.
385
+ *
386
+ * This module includes user CRUD operations, authentication endpoints,
387
+ * and user profile management capabilities.
388
+ *
389
+ * @module alepha.api.users
390
+ */
391
+ declare const AlephaApiUsers: _alepha_core0.Service<_alepha_core0.Module<{}>>;
392
+ //#endregion
393
+ export { $authApple, $authGithub, $authGoogle, $realmUsers, AlephaApiUsers, IdentityEntity, SessionEntity, SessionService, UserEntity, identities, sessions, users };
394
+ //# sourceMappingURL=index.d.ts.map
package/api/users.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@alepha/api-users'
package/batch.d.ts CHANGED
@@ -46,10 +46,10 @@ import * as typebox0 from "typebox";
46
46
  * class UserService {
47
47
  * userBatch = $batch({
48
48
  * schema: t.object({
49
- * id: t.string(),
50
- * name: t.string(),
51
- * email: t.string(),
52
- * createdAt: t.optional(t.string())
49
+ * id: t.text(),
50
+ * name: t.text(),
51
+ * email: t.text(),
52
+ * createdAt: t.optional(t.text())
53
53
  * }),
54
54
  * maxSize: 50, // Process up to 50 users at once
55
55
  * maxDuration: [5, "seconds"], // Or flush every 5 seconds
@@ -86,9 +86,9 @@ import * as typebox0 from "typebox";
86
86
  * class NotificationService {
87
87
  * notificationBatch = $batch({
88
88
  * schema: t.object({
89
- * userId: t.string(),
89
+ * userId: t.text(),
90
90
  * type: t.enum(["email", "sms", "push"]),
91
- * message: t.string(),
91
+ * message: t.text(),
92
92
  * priority: t.enum(["high", "normal", "low"])
93
93
  * }),
94
94
  * maxSize: 100,
@@ -146,9 +146,9 @@ import * as typebox0 from "typebox";
146
146
  * schema: t.object({
147
147
  * timestamp: t.number(),
148
148
  * level: t.enum(["info", "warn", "error"]),
149
- * message: t.string(),
150
- * metadata: t.optional(t.record(t.string(), t.any())),
151
- * source: t.string()
149
+ * message: t.text(),
150
+ * metadata: t.optional(t.record(t.text(), t.any())),
151
+ * source: t.text()
152
152
  * }),
153
153
  * maxSize: 1000, // Large batches for log efficiency
154
154
  * maxDuration: [30, "seconds"], // Longer duration for log aggregation
@@ -209,11 +209,11 @@ import * as typebox0 from "typebox";
209
209
  * class FileProcessingService {
210
210
  * fileProcessingBatch = $batch({
211
211
  * schema: t.object({
212
- * filePath: t.string(),
212
+ * filePath: t.text(),
213
213
  * fileType: t.enum(["image", "video", "document"]),
214
214
  * processingOptions: t.object({
215
215
  * quality: t.optional(t.enum(["low", "medium", "high"])),
216
- * format: t.optional(t.string()),
216
+ * format: t.optional(t.text()),
217
217
  * compress: t.optional(t.boolean())
218
218
  * }),
219
219
  * priority: t.enum(["urgent", "normal", "background"])
@@ -300,9 +300,9 @@ interface BatchDescriptorOptions<TItem extends TSchema, TResponse = any> {
300
300
  * @example
301
301
  * ```ts
302
302
  * t.object({
303
- * id: t.string(),
303
+ * id: t.text(),
304
304
  * operation: t.enum(["create", "update"]),
305
- * data: t.record(t.string(), t.any()),
305
+ * data: t.record(t.text(), t.any()),
306
306
  * timestamp: t.optional(t.number()),
307
307
  * priority: t.optional(t.enum(["high", "normal"]))
308
308
  * })
@@ -556,7 +556,7 @@ declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends De
556
556
  * class LoggingService {
557
557
  * // define the batch processor
558
558
  * logBatch = $batch({
559
- * schema: t.string(),
559
+ * schema: t.text(),
560
560
  * maxSize: 10,
561
561
  * maxDuration: [5, "seconds"],
562
562
  * handler: async (items) => {
package/cache/redis.d.ts CHANGED
@@ -23,6 +23,7 @@ declare class RedisCacheProvider implements CacheProvider {
23
23
  del(name: string, ...keys: string[]): Promise<void>;
24
24
  has(name: string, key: string): Promise<boolean>;
25
25
  keys(name: string, filter?: string): Promise<string[]>;
26
+ clear(): Promise<void>;
26
27
  protected prefix(...path: string[]): string;
27
28
  }
28
29
  //#endregion
package/cache.d.ts CHANGED
@@ -40,6 +40,10 @@ declare abstract class CacheProvider {
40
40
  abstract del(name: string, ...keys: string[]): Promise<void>;
41
41
  abstract has(name: string, key: string): Promise<boolean>;
42
42
  abstract keys(name: string, filter?: string): Promise<string[]>;
43
+ /**
44
+ * Remove all keys from all cache names.
45
+ */
46
+ abstract clear(): Promise<void>;
43
47
  }
44
48
  //#endregion
45
49
  //#region src/descriptors/$cache.d.ts
@@ -263,6 +267,7 @@ declare class MemoryCacheProvider implements CacheProvider {
263
267
  del(name: string, ...keys: string[]): Promise<void>;
264
268
  has(name: string, key: string): Promise<boolean>;
265
269
  keys(name: string, filter?: string): Promise<string[]>;
270
+ clear(): Promise<void>;
266
271
  }
267
272
  //#endregion
268
273
  //#region src/index.d.ts
package/command.d.ts CHANGED
@@ -12,7 +12,7 @@ interface AskOptions<T extends TSchema = TString> {
12
12
  * Response schema expected.
13
13
  *
14
14
  * Recommended schemas:
15
- * - t.string() - for free text input
15
+ * - t.text() - for free text input
16
16
  * - t.number() - for numeric input
17
17
  * - t.boolean() - for yes/no input (accepts "true", "false", "1", "0")
18
18
  * - t.enum(["option1", "option2"]) - for predefined options
@@ -21,7 +21,7 @@ interface AskOptions<T extends TSchema = TString> {
21
21
  *
22
22
  * @example
23
23
  * ```ts
24
- * ask("What is your name?", { schema: t.string({ default: "John Doe" }) })
24
+ * ask("What is your name?", { schema: t.text({ default: "John Doe" }) })
25
25
  * ```
26
26
  *
27
27
  * @default TString
@@ -126,16 +126,16 @@ interface CommandDescriptorOptions<T extends TObject, A extends TSchema> {
126
126
  * An optional TypeBox schema defining the arguments for the command.
127
127
  *
128
128
  * @example
129
- * args: t.string()
129
+ * args: t.text()
130
130
  * my-cli command <arg1: string>
131
131
  *
132
- * args: t.optional(t.string())
132
+ * args: t.optional(t.text())
133
133
  * my-cli command [arg1: string]
134
134
  *
135
- * args: t.tuple([t.string(), t.number()])
135
+ * args: t.tuple([t.text(), t.number()])
136
136
  * my-cli command <arg1: string> <arg2: number>
137
137
  *
138
- * args: t.tuple([t.string(), t.optional(t.number())])
138
+ * args: t.tuple([t.text(), t.optional(t.number())])
139
139
  * my-cli command <arg1: string> [arg2: number]
140
140
  */
141
141
  args?: A;