alepha 0.11.9 → 0.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +61 -17
  2. package/dist/index.cjs +17089 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +17088 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +42 -365
  9. package/src/assets/biomeJson.ts +33 -0
  10. package/src/assets/tsconfigJson.ts +18 -0
  11. package/src/assets/viteConfigTs.ts +14 -0
  12. package/src/commands/BiomeCommands.ts +41 -0
  13. package/src/commands/CoreCommands.ts +169 -0
  14. package/src/commands/DrizzleCommands.ts +228 -0
  15. package/src/commands/VerifyCommands.ts +44 -0
  16. package/src/commands/ViteCommands.ts +119 -0
  17. package/src/index.ts +35 -0
  18. package/src/services/ProcessRunner.ts +89 -0
  19. package/src/services/ProjectUtils.ts +508 -0
  20. package/src/version.ts +7 -0
  21. package/api/files.cjs +0 -8
  22. package/api/files.d.ts +0 -438
  23. package/api/files.js +0 -1
  24. package/api/jobs.cjs +0 -8
  25. package/api/jobs.d.ts +0 -327
  26. package/api/jobs.js +0 -1
  27. package/api/notifications.cjs +0 -8
  28. package/api/notifications.d.ts +0 -263
  29. package/api/notifications.js +0 -1
  30. package/api/users.cjs +0 -8
  31. package/api/users.d.ts +0 -923
  32. package/api/users.js +0 -1
  33. package/api/verifications.cjs +0 -8
  34. package/api/verifications.d.ts +0 -1
  35. package/api/verifications.js +0 -1
  36. package/batch.cjs +0 -8
  37. package/batch.d.ts +0 -154
  38. package/batch.js +0 -1
  39. package/bucket.cjs +0 -8
  40. package/bucket.d.ts +0 -520
  41. package/bucket.js +0 -1
  42. package/cache/redis.cjs +0 -8
  43. package/cache/redis.d.ts +0 -40
  44. package/cache/redis.js +0 -1
  45. package/cache.cjs +0 -8
  46. package/cache.d.ts +0 -288
  47. package/cache.js +0 -1
  48. package/command.cjs +0 -8
  49. package/command.d.ts +0 -269
  50. package/command.js +0 -1
  51. package/core.cjs +0 -8
  52. package/core.d.ts +0 -1904
  53. package/core.js +0 -1
  54. package/datetime.cjs +0 -8
  55. package/datetime.d.ts +0 -144
  56. package/datetime.js +0 -1
  57. package/devtools.cjs +0 -8
  58. package/devtools.d.ts +0 -252
  59. package/devtools.js +0 -1
  60. package/email.cjs +0 -8
  61. package/email.d.ts +0 -187
  62. package/email.js +0 -1
  63. package/fake.cjs +0 -8
  64. package/fake.d.ts +0 -73
  65. package/fake.js +0 -1
  66. package/file.cjs +0 -8
  67. package/file.d.ts +0 -528
  68. package/file.js +0 -1
  69. package/lock/redis.cjs +0 -8
  70. package/lock/redis.d.ts +0 -24
  71. package/lock/redis.js +0 -1
  72. package/lock.cjs +0 -8
  73. package/lock.d.ts +0 -552
  74. package/lock.js +0 -1
  75. package/logger.cjs +0 -8
  76. package/logger.d.ts +0 -287
  77. package/logger.js +0 -1
  78. package/postgres.cjs +0 -8
  79. package/postgres.d.ts +0 -2143
  80. package/postgres.js +0 -1
  81. package/queue/redis.cjs +0 -8
  82. package/queue/redis.d.ts +0 -29
  83. package/queue/redis.js +0 -1
  84. package/queue.cjs +0 -8
  85. package/queue.d.ts +0 -760
  86. package/queue.js +0 -1
  87. package/react/auth.cjs +0 -8
  88. package/react/auth.d.ts +0 -504
  89. package/react/auth.js +0 -1
  90. package/react/form.cjs +0 -8
  91. package/react/form.d.ts +0 -211
  92. package/react/form.js +0 -1
  93. package/react/head.cjs +0 -8
  94. package/react/head.d.ts +0 -120
  95. package/react/head.js +0 -1
  96. package/react/i18n.cjs +0 -8
  97. package/react/i18n.d.ts +0 -168
  98. package/react/i18n.js +0 -1
  99. package/react.cjs +0 -8
  100. package/react.d.ts +0 -1263
  101. package/react.js +0 -1
  102. package/redis.cjs +0 -8
  103. package/redis.d.ts +0 -82
  104. package/redis.js +0 -1
  105. package/retry.cjs +0 -8
  106. package/retry.d.ts +0 -162
  107. package/retry.js +0 -1
  108. package/router.cjs +0 -8
  109. package/router.d.ts +0 -45
  110. package/router.js +0 -1
  111. package/scheduler.cjs +0 -8
  112. package/scheduler.d.ts +0 -145
  113. package/scheduler.js +0 -1
  114. package/security.cjs +0 -8
  115. package/security.d.ts +0 -586
  116. package/security.js +0 -1
  117. package/server/cache.cjs +0 -8
  118. package/server/cache.d.ts +0 -163
  119. package/server/cache.js +0 -1
  120. package/server/compress.cjs +0 -8
  121. package/server/compress.d.ts +0 -38
  122. package/server/compress.js +0 -1
  123. package/server/cookies.cjs +0 -8
  124. package/server/cookies.d.ts +0 -144
  125. package/server/cookies.js +0 -1
  126. package/server/cors.cjs +0 -8
  127. package/server/cors.d.ts +0 -45
  128. package/server/cors.js +0 -1
  129. package/server/health.cjs +0 -8
  130. package/server/health.d.ts +0 -58
  131. package/server/health.js +0 -1
  132. package/server/helmet.cjs +0 -8
  133. package/server/helmet.d.ts +0 -98
  134. package/server/helmet.js +0 -1
  135. package/server/links.cjs +0 -8
  136. package/server/links.d.ts +0 -322
  137. package/server/links.js +0 -1
  138. package/server/metrics.cjs +0 -8
  139. package/server/metrics.d.ts +0 -35
  140. package/server/metrics.js +0 -1
  141. package/server/multipart.cjs +0 -8
  142. package/server/multipart.d.ts +0 -42
  143. package/server/multipart.js +0 -1
  144. package/server/proxy.cjs +0 -8
  145. package/server/proxy.d.ts +0 -234
  146. package/server/proxy.js +0 -1
  147. package/server/security.cjs +0 -8
  148. package/server/security.d.ts +0 -92
  149. package/server/security.js +0 -1
  150. package/server/static.cjs +0 -8
  151. package/server/static.d.ts +0 -119
  152. package/server/static.js +0 -1
  153. package/server/swagger.cjs +0 -8
  154. package/server/swagger.d.ts +0 -161
  155. package/server/swagger.js +0 -1
  156. package/server.cjs +0 -8
  157. package/server.d.ts +0 -849
  158. package/server.js +0 -1
  159. package/topic/redis.cjs +0 -8
  160. package/topic/redis.d.ts +0 -42
  161. package/topic/redis.js +0 -1
  162. package/topic.cjs +0 -8
  163. package/topic.d.ts +0 -819
  164. package/topic.js +0 -1
  165. package/vite.cjs +0 -8
  166. package/vite.d.ts +0 -186
  167. package/vite.js +0 -1
package/queue.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/queue'
package/react/auth.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/react-auth');
3
- Object.keys(m).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return m[k]; }
7
- });
8
- });
package/react/auth.d.ts DELETED
@@ -1,504 +0,0 @@
1
- import * as _alepha_core4 from "alepha";
2
- import { Alepha, AlephaError, Async, Descriptor, KIND, Static } from "alepha";
3
- import * as _alepha_server_cookies0 from "alepha/server/cookies";
4
- import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
5
- import { DateTimeProvider } from "alepha/datetime";
6
- import { AccessTokenResponse, RealmDescriptor, SecurityProvider, UserAccount, UserAccountToken } from "alepha/security";
7
- import * as _alepha_logger0 from "alepha/logger";
8
- import * as _alepha_server0 from "alepha/server";
9
- import { HttpClient } from "alepha/server";
10
- import { HttpVirtualClient, ServerLinksProvider } from "alepha/server/links";
11
- import { Configuration } from "openid-client";
12
- import * as typebox143 from "typebox";
13
-
14
- //#region src/schemas/tokensSchema.d.ts
15
- declare const tokensSchema: typebox143.TObject<{
16
- provider: typebox143.TString;
17
- access_token: typebox143.TString;
18
- issued_at: typebox143.TNumber;
19
- expires_in: typebox143.TOptional<typebox143.TNumber>;
20
- refresh_token: typebox143.TOptional<typebox143.TString>;
21
- refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
22
- refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
23
- id_token: typebox143.TOptional<typebox143.TString>;
24
- scope: typebox143.TOptional<typebox143.TString>;
25
- }>;
26
- type Tokens = Static<typeof tokensSchema>;
27
- //#endregion
28
- //#region src/services/ReactAuth.d.ts
29
- /**
30
- * Browser, SSR friendly, service to handle authentication.
31
- */
32
- declare class ReactAuth {
33
- protected readonly log: _alepha_logger0.Logger;
34
- protected readonly alepha: Alepha;
35
- protected readonly httpClient: HttpClient;
36
- static path: {
37
- login: string;
38
- callback: string;
39
- logout: string;
40
- token: string;
41
- refresh: string;
42
- userinfo: string;
43
- };
44
- protected readonly onBeginTransition: _alepha_core4.HookDescriptor<"react:transition:begin">;
45
- protected readonly onFetchRequest: _alepha_core4.HookDescriptor<"client:onRequest">;
46
- /**
47
- * Get the current authenticated user.
48
- *
49
- * Alias for `alepha.state.get("user")`
50
- */
51
- get user(): UserAccountToken | undefined;
52
- ping(): Promise<{
53
- name?: string | undefined;
54
- email?: string | undefined;
55
- username?: string | undefined;
56
- picture?: string | undefined;
57
- sessionId?: string | undefined;
58
- organizations?: string[] | undefined;
59
- roles?: string[] | undefined;
60
- id: string;
61
- } | undefined>;
62
- login(provider: string, options: {
63
- hostname?: string;
64
- username?: string;
65
- password?: string;
66
- redirect?: string;
67
- [extra: string]: any;
68
- }): Promise<Tokens>;
69
- logout(): void;
70
- }
71
- //#endregion
72
- //#region src/providers/ReactAuthProvider.d.ts
73
- declare class ReactAuthProvider {
74
- protected readonly log: _alepha_logger0.Logger;
75
- protected readonly alepha: Alepha;
76
- protected readonly serverCookiesProvider: ServerCookiesProvider;
77
- protected readonly dateTimeProvider: DateTimeProvider;
78
- protected readonly serverLinksProvider: ServerLinksProvider;
79
- protected readonly reactAuth: ReactAuth;
80
- protected readonly authorizationCode: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
81
- provider: typebox143.TString;
82
- codeVerifier: typebox143.TOptional<typebox143.TString>;
83
- redirectUri: typebox143.TOptional<typebox143.TString>;
84
- state: typebox143.TOptional<typebox143.TString>;
85
- nonce: typebox143.TOptional<typebox143.TString>;
86
- }>>;
87
- readonly tokens: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
88
- provider: typebox143.TString;
89
- access_token: typebox143.TString;
90
- issued_at: typebox143.TNumber;
91
- expires_in: typebox143.TOptional<typebox143.TNumber>;
92
- refresh_token: typebox143.TOptional<typebox143.TString>;
93
- refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
94
- refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
95
- id_token: typebox143.TOptional<typebox143.TString>;
96
- scope: typebox143.TOptional<typebox143.TString>;
97
- }>>;
98
- readonly onRender: _alepha_core4.HookDescriptor<"react:server:render:begin">;
99
- get identities(): Array<AuthDescriptor>;
100
- protected readonly configure: _alepha_core4.HookDescriptor<"configure">;
101
- protected getAccessTokens(tokens: Tokens): string | undefined;
102
- /**
103
- * Fill request headers with access token from cookies or fallback to provider's fallback function.
104
- */
105
- protected readonly onRequest: _alepha_core4.HookDescriptor<"server:onRequest">;
106
- /**
107
- * Convert cookies to tokens.
108
- * If the tokens are expired, try to refresh them using the refresh token.
109
- */
110
- protected cookiesToTokens(cookies: Cookies): Promise<Tokens | undefined>;
111
- protected refreshTokens(tokens: Tokens): Promise<Tokens | undefined>;
112
- /**
113
- * Get user information.
114
- */
115
- readonly userinfo: _alepha_server0.RouteDescriptor<{
116
- response: typebox143.TObject<{
117
- user: typebox143.TOptional<typebox143.TObject<{
118
- id: typebox143.TString;
119
- name: typebox143.TOptional<typebox143.TString>;
120
- email: typebox143.TOptional<typebox143.TString>;
121
- username: typebox143.TOptional<typebox143.TString>;
122
- picture: typebox143.TOptional<typebox143.TString>;
123
- sessionId: typebox143.TOptional<typebox143.TString>;
124
- organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
125
- roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
126
- }>>;
127
- api: typebox143.TObject<{
128
- prefix: typebox143.TOptional<typebox143.TString>;
129
- links: typebox143.TArray<typebox143.TObject<{
130
- name: typebox143.TString;
131
- group: typebox143.TOptional<typebox143.TString>;
132
- path: typebox143.TString;
133
- method: typebox143.TOptional<typebox143.TString>;
134
- requestBodyType: typebox143.TOptional<typebox143.TString>;
135
- service: typebox143.TOptional<typebox143.TString>;
136
- }>>;
137
- }>;
138
- }>;
139
- }>;
140
- /**
141
- * Refresh a token for internal providers.
142
- */
143
- readonly refresh: _alepha_server0.RouteDescriptor<{
144
- query: typebox143.TObject<{
145
- provider: typebox143.TString;
146
- }>;
147
- body: typebox143.TObject<{
148
- refresh_token: typebox143.TString;
149
- access_token: typebox143.TOptional<typebox143.TString>;
150
- }>;
151
- response: typebox143.TObject<{
152
- provider: typebox143.TString;
153
- access_token: typebox143.TString;
154
- issued_at: typebox143.TNumber;
155
- expires_in: typebox143.TOptional<typebox143.TNumber>;
156
- refresh_token: typebox143.TOptional<typebox143.TString>;
157
- refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
158
- refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
159
- id_token: typebox143.TOptional<typebox143.TString>;
160
- scope: typebox143.TOptional<typebox143.TString>;
161
- }>;
162
- }>;
163
- /**
164
- * Login for local password-based authentication.
165
- */
166
- readonly token: _alepha_server0.RouteDescriptor<{
167
- query: typebox143.TObject<{
168
- provider: typebox143.TString;
169
- }>;
170
- body: typebox143.TObject<{
171
- username: typebox143.TString;
172
- password: typebox143.TString;
173
- }>;
174
- response: typebox143.TObject<{
175
- provider: typebox143.TString;
176
- access_token: typebox143.TString;
177
- issued_at: typebox143.TNumber;
178
- expires_in: typebox143.TOptional<typebox143.TNumber>;
179
- refresh_token: typebox143.TOptional<typebox143.TString>;
180
- refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
181
- refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
182
- id_token: typebox143.TOptional<typebox143.TString>;
183
- scope: typebox143.TOptional<typebox143.TString>;
184
- user: typebox143.TObject<{
185
- id: typebox143.TString;
186
- name: typebox143.TOptional<typebox143.TString>;
187
- email: typebox143.TOptional<typebox143.TString>;
188
- username: typebox143.TOptional<typebox143.TString>;
189
- picture: typebox143.TOptional<typebox143.TString>;
190
- sessionId: typebox143.TOptional<typebox143.TString>;
191
- organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
192
- roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
193
- }>;
194
- api: typebox143.TObject<{
195
- prefix: typebox143.TOptional<typebox143.TString>;
196
- links: typebox143.TArray<typebox143.TObject<{
197
- name: typebox143.TString;
198
- group: typebox143.TOptional<typebox143.TString>;
199
- path: typebox143.TString;
200
- method: typebox143.TOptional<typebox143.TString>;
201
- requestBodyType: typebox143.TOptional<typebox143.TString>;
202
- service: typebox143.TOptional<typebox143.TString>;
203
- }>>;
204
- }>;
205
- }>;
206
- }>;
207
- /**
208
- * Oauth2/OIDC login route.
209
- */
210
- readonly login: _alepha_server0.RouteDescriptor<{
211
- query: typebox143.TObject<{
212
- provider: typebox143.TString;
213
- redirect_uri: typebox143.TOptional<typebox143.TString>;
214
- }>;
215
- }>;
216
- /**
217
- * Callback for OAuth2/OIDC providers.
218
- * It handles the authorization code flow and retrieves the access token.
219
- */
220
- readonly callback: _alepha_server0.RouteDescriptor<_alepha_server0.RequestConfigSchema>;
221
- /**
222
- * Logout route for OAuth2/OIDC providers.
223
- */
224
- readonly logout: _alepha_server0.RouteDescriptor<{
225
- query: typebox143.TObject<{
226
- post_logout_redirect_uri: typebox143.TOptional<typebox143.TString>;
227
- }>;
228
- }>;
229
- protected provider(opts: string | {
230
- provider: string;
231
- }): AuthDescriptor;
232
- protected setTokens(tokens: Tokens, cookies?: Cookies): void;
233
- }
234
- interface OAuth2Profile {
235
- sub: string;
236
- email?: string;
237
- name?: string;
238
- given_name?: string;
239
- family_name?: string;
240
- middle_name?: string;
241
- nickname?: string;
242
- preferred_username?: string;
243
- profile?: string;
244
- picture?: string;
245
- website?: string;
246
- email_verified?: boolean;
247
- gender?: string;
248
- birthdate?: string;
249
- zoneinfo?: string;
250
- locale?: string;
251
- phone_number?: string;
252
- phone_number_verified?: boolean;
253
- address?: {
254
- formatted?: string;
255
- street_address?: string;
256
- locality?: string;
257
- region?: string;
258
- postal_code?: string;
259
- country?: string;
260
- };
261
- updated_at?: number;
262
- [key: string]: unknown;
263
- }
264
- //#endregion
265
- //#region src/descriptors/$auth.d.ts
266
- declare const $auth: {
267
- (options: AuthDescriptorOptions): AuthDescriptor;
268
- [KIND]: typeof AuthDescriptor;
269
- };
270
- type AuthDescriptorOptions = {
271
- /**
272
- * Name of the identity provider.
273
- * If not provided, it will be derived from the property key.
274
- */
275
- name?: string;
276
- /**
277
- * If true, auth provider will be skipped.
278
- */
279
- disabled?: boolean;
280
- } & (AuthExternal | AuthInternal);
281
- /**
282
- * When you let an external service handle authentication. (e.g. Keycloak, Auth0, etc.)
283
- */
284
- type AuthExternal = {
285
- /**
286
- * Only OIDC is supported for external authentication.
287
- */
288
- oidc: OidcOptions;
289
- /**
290
- * For anonymous access, this will expect a service account access token.
291
- *
292
- * ```ts
293
- * class App {
294
- * anonymous = $serviceAccount(...);
295
- * auth = $auth({
296
- * // ... config ...
297
- * fallback: this.anonymous,
298
- * })
299
- * }
300
- * ```
301
- */
302
- fallback?: () => Async<AccessToken>;
303
- };
304
- /**
305
- * When using your own authentication system, e.g. using a database to store user accounts.
306
- * This is usually used with a custom login form.
307
- *
308
- * This relies on the `realm`, which is used to create/verify the access token.
309
- */
310
- type AuthInternal = {
311
- realm: RealmDescriptor;
312
- } & ({
313
- /**
314
- * The common username/password authentication.
315
- *
316
- * - It uses the OAuth2 Client Credentials flow to obtain an access token.
317
- *
318
- * This is usually used with a custom login form on your website or mobile app.
319
- */
320
- credentials: CredentialsOptions;
321
- } | {
322
- /**
323
- * OAuth2 authentication. Delegates authentication to an OAuth2 provider. (e.g. Google, GitHub, etc.)
324
- *
325
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
326
- *
327
- * This is usually used with a login button that redirects to the OAuth2 provider.
328
- */
329
- oauth: OAuth2Options;
330
- } | {
331
- /**
332
- * Like OAuth2, but uses OIDC (OpenID Connect) for authentication and user information retrieval.
333
- * OIDC is an identity layer on top of OAuth2, providing user authentication and profile information.
334
- *
335
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
336
- * - PCKE (Proof Key for Code Exchange) is recommended for security.
337
- *
338
- * This is usually used with a login button that redirects to the OIDC provider.
339
- */
340
- oidc: OidcOptions;
341
- });
342
- type CredentialsOptions = {
343
- account: (credentials: {
344
- username: string;
345
- password: string;
346
- }) => Async<UserAccount>;
347
- };
348
- interface OidcOptions {
349
- /**
350
- * URL of the OIDC issuer.
351
- */
352
- issuer: string;
353
- /**
354
- * Client ID for the OIDC client.
355
- */
356
- clientId: string;
357
- /**
358
- * Client secret for the OIDC client.
359
- * Optional if PKCE (Proof Key for Code Exchange) is used.
360
- */
361
- clientSecret?: string;
362
- /**
363
- * Redirect URI for the OIDC client.
364
- * This is where the user will be redirected after authentication.
365
- */
366
- redirectUri?: string;
367
- /**
368
- * For external auth providers only.
369
- * Take the ID token instead of the access token for validation.
370
- */
371
- useIdToken?: boolean;
372
- /**
373
- * URI to redirect the user after logout.
374
- */
375
- logoutUri?: string;
376
- /**
377
- * Optional scope for the OIDC client.
378
- * @default "openid profile email".
379
- */
380
- scope?: string;
381
- account?: (tokens: {
382
- access_token: string;
383
- user: OAuth2Profile;
384
- id_token?: string;
385
- expires_in?: number;
386
- scope?: string;
387
- }) => Async<UserAccount>;
388
- }
389
- interface OAuth2Options {
390
- /**
391
- * URL of the OAuth2 authorization endpoint.
392
- */
393
- clientId: string;
394
- /**
395
- * Client secret for the OAuth2 client.
396
- */
397
- clientSecret: string;
398
- /**
399
- * URL of the OAuth2 authorization endpoint.
400
- */
401
- authorization: string;
402
- /**
403
- * URL of the OAuth2 token endpoint.
404
- */
405
- token: string;
406
- /**
407
- * Function to retrieve user profile information from the OAuth2 tokens.
408
- */
409
- userinfo: (tokens: Tokens) => Async<OAuth2Profile>;
410
- account?: (tokens: {
411
- access_token: string;
412
- user: OAuth2Profile;
413
- id_token?: string;
414
- expires_in?: number;
415
- scope?: string;
416
- }) => Async<UserAccount>;
417
- /**
418
- * URL of the OAuth2 authorization endpoint.
419
- */
420
- redirectUri?: string;
421
- /**
422
- * URL of the OAuth2 authorization endpoint.
423
- */
424
- scope?: string;
425
- }
426
- declare class AuthDescriptor extends Descriptor<AuthDescriptorOptions> {
427
- protected readonly securityProvider: SecurityProvider;
428
- protected readonly dateTimeProvider: DateTimeProvider;
429
- oauth?: Configuration;
430
- get name(): string;
431
- get jwks_uri(): string;
432
- get scope(): string | undefined;
433
- get redirect_uri(): string | undefined;
434
- /**
435
- * Refreshes the access token using the refresh token.
436
- * Can be used on oauth2, oidc or credentials auth providers.
437
- */
438
- refresh(refreshToken: string, accessToken?: string): Promise<AccessTokenResponse>;
439
- /**
440
- * Extracts user information from the access token.
441
- * This is used to create a user account from the access token.
442
- */
443
- user(tokens: Tokens): Promise<UserAccount>;
444
- protected getUserFromIdToken(idToken: string): OAuth2Profile;
445
- prepare(): Promise<void>;
446
- }
447
- type AccessToken = string | {
448
- token: () => Async<string>;
449
- };
450
- //#endregion
451
- //#region src/errors/SessionExpiredError.d.ts
452
- declare class SessionExpiredError extends AlephaError {
453
- readonly name = "SessionExpiredError";
454
- readonly status = 401;
455
- }
456
- //#endregion
457
- //#region src/hooks/useAuth.d.ts
458
- declare const useAuth: <T extends object = any>() => {
459
- user: {
460
- name?: string | undefined;
461
- email?: string | undefined;
462
- username?: string | undefined;
463
- picture?: string | undefined;
464
- sessionId?: string | undefined;
465
- organizations?: string[] | undefined;
466
- roles?: string[] | undefined;
467
- id: string;
468
- } | undefined;
469
- logout: () => void;
470
- login: (provider: keyof T, options?: {
471
- username?: string;
472
- password?: string;
473
- redirect?: string;
474
- [extra: string]: any;
475
- }) => Promise<void>;
476
- can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
477
- };
478
- //#endregion
479
- //#region src/index.d.ts
480
- declare module "alepha" {
481
- interface State {
482
- /**
483
- * The authenticated user account attached to the server request state.
484
- *
485
- * @internal
486
- */
487
- "alepha.server.request.user"?: UserAccount;
488
- }
489
- }
490
- declare module "alepha/react" {
491
- interface ReactRouterState {
492
- user?: UserAccount;
493
- }
494
- }
495
- /**
496
- * The ReactAuthModule provides authentication services for React applications.
497
- *
498
- * @see {@link ReactAuthProvider}
499
- * @module alepha.react.auth
500
- */
501
- declare const AlephaReactAuth: _alepha_core4.Service<_alepha_core4.Module>;
502
- //#endregion
503
- export { $auth, AccessToken, AlephaReactAuth, AuthDescriptor, AuthDescriptorOptions, AuthExternal, AuthInternal, CredentialsOptions, OAuth2Options, OAuth2Profile, OidcOptions, ReactAuth, ReactAuthProvider, SessionExpiredError, useAuth };
504
- //# sourceMappingURL=index.d.ts.map
package/react/auth.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/react-auth'
package/react/form.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/react-form');
3
- Object.keys(m).forEach(function (k) {
4
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
- enumerable: true,
6
- get: function () { return m[k]; }
7
- });
8
- });