alepha 0.10.3 → 0.10.5

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,395 @@
1
+ import * as _alepha_core0 from "alepha";
2
+ import { Alepha, Static } from "alepha";
3
+ import * as _alepha_react_auth1 from "alepha/react/auth";
4
+ import { OAuth2Profile } from "alepha/react/auth";
5
+ import { DateTimeProvider } from "alepha/datetime";
6
+ import * as _alepha_postgres296 from "alepha/postgres";
7
+ import * as _alepha_security0 from "alepha/security";
8
+ import { CryptoProvider, RealmDescriptor, RealmDescriptorOptions, UserAccount } from "alepha/security";
9
+ import * as typebox230 from "typebox";
10
+
11
+ //#region src/descriptors/$authApple.d.ts
12
+ /**
13
+ * TODO: Implement Apple authentication
14
+ */
15
+ declare const $authApple: () => never;
16
+ //#endregion
17
+ //#region src/descriptors/$authCredentials.d.ts
18
+ declare const $authCredentials: (realm: RealmDescriptor) => _alepha_react_auth1.AuthDescriptor;
19
+ //#endregion
20
+ //#region src/descriptors/$authGithub.d.ts
21
+ /**
22
+ * Already configured GitHub authentication descriptor.
23
+ *
24
+ * Uses OAuth2 to authenticate users via their GitHub accounts.
25
+ * Upon successful authentication, it links the GitHub account to a user session.
26
+ *
27
+ * Environment Variables:
28
+ * - `GITHUB_CLIENT_ID`: The client ID obtained from the GitHub Developer Settings.
29
+ * - `GITHUB_CLIENT_SECRET`: The client secret obtained from the GitHub Developer Settings.
30
+ */
31
+ declare const $authGithub: (realm: RealmDescriptor) => _alepha_react_auth1.AuthDescriptor;
32
+ //#endregion
33
+ //#region src/descriptors/$authGoogle.d.ts
34
+ /**
35
+ * Already configured Google authentication descriptor.
36
+ *
37
+ * Uses OpenID Connect (OIDC) to authenticate users via their Google accounts.
38
+ * Upon successful authentication, it links the Google account to a user session.
39
+ *
40
+ * Environment Variables:
41
+ * - `GOOGLE_CLIENT_ID`: The client ID obtained from the Google Developer Console.
42
+ * - `GOOGLE_CLIENT_SECRET`: The client secret obtained from the Google Developer Console.
43
+ */
44
+ declare const $authGoogle: (realm: RealmDescriptor) => _alepha_react_auth1.AuthDescriptor;
45
+ //#endregion
46
+ //#region src/descriptors/$realmUsers.d.ts
47
+ /**
48
+ * Already configured realm for user management.
49
+ *
50
+ * Realm contains two roles: `admin` and `user`.
51
+ *
52
+ * - `admin`: Has full access to all resources and permissions.
53
+ * - `user`: Has access to their own resources and permissions, but cannot access admin-level resources.
54
+ *
55
+ * Realm uses session management for handling user sessions.
56
+ *
57
+ * Environment Variables:
58
+ * - `APP_SECRET`: Secret key for signing tokens (if not provided in options).
59
+ */
60
+ declare const $realmUsers: (options?: {
61
+ secret?: string;
62
+ realm?: Partial<RealmDescriptorOptions>;
63
+ }) => _alepha_security0.RealmDescriptor;
64
+ //#endregion
65
+ //#region src/entities/identities.d.ts
66
+ declare const identities: _alepha_postgres296.PgTableWithColumnsAndSchema<_alepha_postgres296.PgTableConfig<"identities", typebox230.TObject<{
67
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
68
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
69
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
70
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
71
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
72
+ provider: typebox230.TString;
73
+ providerUserId: typebox230.TString;
74
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
75
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
76
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
77
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
78
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
79
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
80
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
81
+ provider: typebox230.TString;
82
+ providerUserId: typebox230.TString;
83
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
84
+ }>>>, typebox230.TObject<{
85
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
86
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
87
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
88
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
89
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
90
+ provider: typebox230.TString;
91
+ providerUserId: typebox230.TString;
92
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
93
+ }>>;
94
+ type IdentityEntity = Static<typeof identities.$schema>;
95
+ //#endregion
96
+ //#region src/entities/sessions.d.ts
97
+ declare const sessions: _alepha_postgres296.PgTableWithColumnsAndSchema<_alepha_postgres296.PgTableConfig<"sessions", typebox230.TObject<{
98
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
99
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
100
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
101
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
102
+ refreshToken: typebox230.TString;
103
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
104
+ expiresAt: typebox230.TString;
105
+ ip: typebox230.TOptional<typebox230.TString>;
106
+ userAgent: typebox230.TOptional<typebox230.TObject<{
107
+ os: typebox230.TString;
108
+ browser: typebox230.TString;
109
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
110
+ }>>;
111
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
112
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
113
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
114
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
115
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
116
+ refreshToken: typebox230.TString;
117
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
118
+ expiresAt: typebox230.TString;
119
+ ip: typebox230.TOptional<typebox230.TString>;
120
+ userAgent: typebox230.TOptional<typebox230.TObject<{
121
+ os: typebox230.TString;
122
+ browser: typebox230.TString;
123
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
124
+ }>>;
125
+ }>>>, typebox230.TObject<{
126
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
127
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
128
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
129
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
130
+ refreshToken: typebox230.TString;
131
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
132
+ expiresAt: typebox230.TString;
133
+ ip: typebox230.TOptional<typebox230.TString>;
134
+ userAgent: typebox230.TOptional<typebox230.TObject<{
135
+ os: typebox230.TString;
136
+ browser: typebox230.TString;
137
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
138
+ }>>;
139
+ }>>;
140
+ type SessionEntity = Static<typeof sessions.$schema>;
141
+ //#endregion
142
+ //#region src/entities/users.d.ts
143
+ declare const users: _alepha_postgres296.PgTableWithColumnsAndSchema<_alepha_postgres296.PgTableConfig<"users", typebox230.TObject<{
144
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
145
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
146
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
147
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
148
+ email: typebox230.TString;
149
+ roles: typebox230.TArray<typebox230.TString>;
150
+ name: typebox230.TOptional<typebox230.TString>;
151
+ firstName: typebox230.TOptional<typebox230.TString>;
152
+ lastName: typebox230.TOptional<typebox230.TString>;
153
+ picture: typebox230.TOptional<typebox230.TString>;
154
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
155
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
156
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
157
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
158
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
159
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
160
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
161
+ email: typebox230.TString;
162
+ roles: typebox230.TArray<typebox230.TString>;
163
+ name: typebox230.TOptional<typebox230.TString>;
164
+ firstName: typebox230.TOptional<typebox230.TString>;
165
+ lastName: typebox230.TOptional<typebox230.TString>;
166
+ picture: typebox230.TOptional<typebox230.TString>;
167
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
168
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
169
+ }>>>, typebox230.TObject<{
170
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
171
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
172
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
173
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
174
+ email: typebox230.TString;
175
+ roles: typebox230.TArray<typebox230.TString>;
176
+ name: typebox230.TOptional<typebox230.TString>;
177
+ firstName: typebox230.TOptional<typebox230.TString>;
178
+ lastName: typebox230.TOptional<typebox230.TString>;
179
+ picture: typebox230.TOptional<typebox230.TString>;
180
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
181
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
182
+ }>>;
183
+ type UserEntity = Static<typeof users.$schema>;
184
+ //#endregion
185
+ //#region src/services/SessionService.d.ts
186
+ declare class SessionService {
187
+ protected readonly alepha: Alepha;
188
+ protected readonly dateTimeProvider: DateTimeProvider;
189
+ protected readonly cryptoProvider: CryptoProvider;
190
+ readonly users: _alepha_postgres296.RepositoryDescriptor<_alepha_postgres296.PgTableConfig<"users", typebox230.TObject<{
191
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
192
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
193
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
194
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
195
+ email: typebox230.TString;
196
+ roles: typebox230.TArray<typebox230.TString>;
197
+ name: typebox230.TOptional<typebox230.TString>;
198
+ firstName: typebox230.TOptional<typebox230.TString>;
199
+ lastName: typebox230.TOptional<typebox230.TString>;
200
+ picture: typebox230.TOptional<typebox230.TString>;
201
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
202
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
203
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
204
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
205
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
206
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
207
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
208
+ email: typebox230.TString;
209
+ roles: typebox230.TArray<typebox230.TString>;
210
+ name: typebox230.TOptional<typebox230.TString>;
211
+ firstName: typebox230.TOptional<typebox230.TString>;
212
+ lastName: typebox230.TOptional<typebox230.TString>;
213
+ picture: typebox230.TOptional<typebox230.TString>;
214
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
215
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
216
+ }>>>, typebox230.TObject<{
217
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
218
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
219
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
220
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
221
+ email: typebox230.TString;
222
+ roles: typebox230.TArray<typebox230.TString>;
223
+ name: typebox230.TOptional<typebox230.TString>;
224
+ firstName: typebox230.TOptional<typebox230.TString>;
225
+ lastName: typebox230.TOptional<typebox230.TString>;
226
+ picture: typebox230.TOptional<typebox230.TString>;
227
+ enabled: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
228
+ emailVerified: _alepha_postgres296.PgAttr<typebox230.TBoolean, typeof _alepha_postgres296.PG_DEFAULT>;
229
+ }>>;
230
+ readonly sessions: _alepha_postgres296.RepositoryDescriptor<_alepha_postgres296.PgTableConfig<"sessions", typebox230.TObject<{
231
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
232
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
233
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
234
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
235
+ refreshToken: typebox230.TString;
236
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
237
+ expiresAt: typebox230.TString;
238
+ ip: typebox230.TOptional<typebox230.TString>;
239
+ userAgent: typebox230.TOptional<typebox230.TObject<{
240
+ os: typebox230.TString;
241
+ browser: typebox230.TString;
242
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
243
+ }>>;
244
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
245
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
246
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
247
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
248
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
249
+ refreshToken: typebox230.TString;
250
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
251
+ expiresAt: typebox230.TString;
252
+ ip: typebox230.TOptional<typebox230.TString>;
253
+ userAgent: typebox230.TOptional<typebox230.TObject<{
254
+ os: typebox230.TString;
255
+ browser: typebox230.TString;
256
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
257
+ }>>;
258
+ }>>>, typebox230.TObject<{
259
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
260
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
261
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
262
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
263
+ refreshToken: typebox230.TString;
264
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
265
+ expiresAt: typebox230.TString;
266
+ ip: typebox230.TOptional<typebox230.TString>;
267
+ userAgent: typebox230.TOptional<typebox230.TObject<{
268
+ os: typebox230.TString;
269
+ browser: typebox230.TString;
270
+ device: typebox230.TUnsafe<"MOBILE" | "DESKTOP" | "TABLET">;
271
+ }>>;
272
+ }>>;
273
+ readonly identities: _alepha_postgres296.RepositoryDescriptor<_alepha_postgres296.PgTableConfig<"identities", typebox230.TObject<{
274
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
275
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
276
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
277
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
278
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
279
+ provider: typebox230.TString;
280
+ providerUserId: typebox230.TString;
281
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
282
+ }>, _alepha_postgres296.FromSchema<typebox230.TObject<{
283
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
284
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
285
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
286
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
287
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
288
+ provider: typebox230.TString;
289
+ providerUserId: typebox230.TString;
290
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
291
+ }>>>, typebox230.TObject<{
292
+ id: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_PRIMARY_KEY>, typeof _alepha_postgres296.PG_DEFAULT>;
293
+ version: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TInteger, typeof _alepha_postgres296.PG_VERSION>, typeof _alepha_postgres296.PG_DEFAULT>;
294
+ createdAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_CREATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
295
+ updatedAt: _alepha_postgres296.PgAttr<_alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_UPDATED_AT>, typeof _alepha_postgres296.PG_DEFAULT>;
296
+ userId: _alepha_postgres296.PgAttr<typebox230.TString, typeof _alepha_postgres296.PG_REF>;
297
+ provider: typebox230.TString;
298
+ providerUserId: typebox230.TString;
299
+ providerData: typebox230.TOptional<typebox230.TRecord<string, typebox230.TAny>>;
300
+ }>>;
301
+ login(provider: string, username: string, password: string): Promise<{
302
+ name?: string | undefined;
303
+ firstName?: string | undefined;
304
+ lastName?: string | undefined;
305
+ picture?: string | undefined;
306
+ id: string;
307
+ version: number;
308
+ createdAt: string;
309
+ updatedAt: string;
310
+ email: string;
311
+ roles: string[];
312
+ enabled: boolean;
313
+ emailVerified: boolean;
314
+ }>;
315
+ createSession(user: UserAccount, expiresIn: number): Promise<{
316
+ refreshToken: string;
317
+ sessionId: string;
318
+ }>;
319
+ refreshSession(refreshToken: string): Promise<{
320
+ user: {
321
+ name?: string | undefined;
322
+ firstName?: string | undefined;
323
+ lastName?: string | undefined;
324
+ picture?: string | undefined;
325
+ id: string;
326
+ version: number;
327
+ createdAt: string;
328
+ updatedAt: string;
329
+ email: string;
330
+ roles: string[];
331
+ enabled: boolean;
332
+ emailVerified: boolean;
333
+ };
334
+ expiresIn: number;
335
+ sessionId: string;
336
+ }>;
337
+ deleteSession(refreshToken: string): Promise<void>;
338
+ link(provider: string, profile: OAuth2Profile): Promise<{
339
+ name?: string | undefined;
340
+ firstName?: string | undefined;
341
+ lastName?: string | undefined;
342
+ picture?: string | undefined;
343
+ id: string;
344
+ version: number;
345
+ createdAt: string;
346
+ updatedAt: string;
347
+ email: string;
348
+ roles: string[];
349
+ enabled: boolean;
350
+ emailVerified: boolean;
351
+ } | {
352
+ sub: string;
353
+ email?: string;
354
+ name?: string;
355
+ given_name?: string;
356
+ family_name?: string;
357
+ middle_name?: string;
358
+ nickname?: string;
359
+ preferred_username?: string;
360
+ profile?: string;
361
+ picture?: string;
362
+ website?: string;
363
+ email_verified?: boolean;
364
+ gender?: string;
365
+ birthdate?: string;
366
+ zoneinfo?: string;
367
+ locale?: string;
368
+ phone_number?: string;
369
+ phone_number_verified?: boolean;
370
+ address?: {
371
+ formatted?: string;
372
+ street_address?: string;
373
+ locality?: string;
374
+ region?: string;
375
+ postal_code?: string;
376
+ country?: string;
377
+ };
378
+ updated_at?: number;
379
+ id: string;
380
+ }>;
381
+ }
382
+ //#endregion
383
+ //#region src/index.d.ts
384
+ /**
385
+ * Provides user management API endpoints for Alepha applications.
386
+ *
387
+ * This module includes user CRUD operations, authentication endpoints,
388
+ * and user profile management capabilities.
389
+ *
390
+ * @module alepha.api.users
391
+ */
392
+ declare const AlephaApiUsers: _alepha_core0.Service<_alepha_core0.Module<{}>>;
393
+ //#endregion
394
+ export { $authApple, $authCredentials, $authGithub, $authGoogle, $realmUsers, AlephaApiUsers, IdentityEntity, SessionEntity, SessionService, UserEntity, identities, sessions, users };
395
+ //# 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/bucket.d.ts CHANGED
@@ -561,11 +561,88 @@ declare class FileNotFoundError extends AlephaError {
561
561
  readonly status = 404;
562
562
  }
563
563
  //#endregion
564
+ //#region src/services/FileMetadataService.d.ts
565
+ interface FileMetadata {
566
+ name: string;
567
+ type: string;
568
+ }
569
+ /**
570
+ * Service for encoding/decoding file metadata in storage streams.
571
+ *
572
+ * The metadata is stored at the beginning of the file with the following structure:
573
+ * - 4-byte header: UInt32BE containing the metadata length
574
+ * - N-byte metadata: JSON object containing file metadata (name, type)
575
+ * - Remaining bytes: Actual file content
576
+ *
577
+ * @example
578
+ * ```typescript
579
+ * const service = new FileMetadataService();
580
+ *
581
+ * // Encode metadata and content for storage
582
+ * const { header, metadata } = service.encodeMetadata({
583
+ * name: "document.pdf",
584
+ * type: "application/pdf"
585
+ * });
586
+ *
587
+ * // Decode metadata from stored file
588
+ * const fileHandle = await open(filePath, 'r');
589
+ * const { metadata, contentStart } = await service.decodeMetadata(fileHandle);
590
+ * ```
591
+ */
592
+ declare class FileMetadataService {
593
+ /**
594
+ * Length of the header containing metadata size (4 bytes for UInt32BE)
595
+ */
596
+ static readonly METADATA_HEADER_LENGTH = 4;
597
+ /**
598
+ * Encodes file metadata into header and metadata buffers.
599
+ *
600
+ * @param file - The file or metadata to encode
601
+ * @returns Object containing the header buffer and metadata buffer
602
+ */
603
+ encodeMetadata(file: FileLike | FileMetadata): {
604
+ header: Buffer;
605
+ metadata: Buffer;
606
+ };
607
+ /**
608
+ * Decodes file metadata from a file handle.
609
+ *
610
+ * @param fileHandle - File handle opened for reading
611
+ * @returns Object containing the decoded metadata and content start position
612
+ */
613
+ decodeMetadata(fileHandle: {
614
+ read: (buffer: Buffer, offset: number, length: number, position: number) => Promise<{
615
+ bytesRead: number;
616
+ }>;
617
+ }): Promise<{
618
+ metadata: FileMetadata;
619
+ contentStart: number;
620
+ }>;
621
+ /**
622
+ * Decodes file metadata from a buffer.
623
+ *
624
+ * @param buffer - Buffer containing the file with metadata
625
+ * @returns Object containing the decoded metadata and content start position
626
+ */
627
+ decodeMetadataFromBuffer(buffer: Buffer): {
628
+ metadata: FileMetadata;
629
+ contentStart: number;
630
+ };
631
+ /**
632
+ * Creates a complete buffer with metadata header, metadata, and content.
633
+ *
634
+ * @param file - The file to encode
635
+ * @param content - The file content as a buffer
636
+ * @returns Complete buffer ready for storage
637
+ */
638
+ createFileBuffer(file: FileLike | FileMetadata, content: Buffer): Buffer;
639
+ }
640
+ //#endregion
564
641
  //#region src/providers/LocalFileStorageProvider.d.ts
565
642
  declare class LocalFileStorageProvider implements FileStorageProvider {
566
- static METADATA_HEADER_LENGTH: number;
567
643
  protected readonly alepha: Alepha;
568
644
  protected readonly log: _alepha_logger0.Logger;
645
+ protected readonly metadataService: FileMetadataService;
569
646
  options: {
570
647
  storagePath: string;
571
648
  };
@@ -574,9 +651,9 @@ declare class LocalFileStorageProvider implements FileStorageProvider {
574
651
  download(bucketName: string, fileId: string): Promise<FileLike>;
575
652
  exists(bucketName: string, fileId: string): Promise<boolean>;
576
653
  delete(bucketName: string, fileId: string): Promise<void>;
577
- protected stat(container: string, fileId: string): Promise<fs.Stats>;
654
+ protected stat(bucket: string, fileId: string): Promise<fs.Stats>;
578
655
  protected createId(): string;
579
- protected path(container: string, fileId?: string): string;
656
+ protected path(bucket: string, fileId?: string): string;
580
657
  protected isErrorNoEntry(error: unknown): boolean;
581
658
  }
582
659
  declare const fileMetadataSchema: typebox0.TObject<{
@@ -620,5 +697,5 @@ declare module "alepha" {
620
697
  */
621
698
  declare const AlephaBucket: _alepha_core1.Service<_alepha_core1.Module<{}>>;
622
699
  //#endregion
623
- export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, MemoryFileStorageProvider, fileMetadataSchema };
700
+ export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileMetadata, FileMetadataService, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, MemoryFileStorageProvider, fileMetadataSchema };
624
701
  //# sourceMappingURL=index.d.ts.map
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;