@alepha/react 0.13.6 → 0.13.8

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 (37) hide show
  1. package/dist/auth/index.browser.js +5 -5
  2. package/dist/auth/index.browser.js.map +1 -1
  3. package/dist/auth/index.d.ts +105 -103
  4. package/dist/auth/index.js +5 -5
  5. package/dist/auth/index.js.map +1 -1
  6. package/dist/core/index.browser.js +407 -142
  7. package/dist/core/index.browser.js.map +1 -1
  8. package/dist/core/index.d.ts +144 -116
  9. package/dist/core/index.js +409 -145
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/core/index.native.js +24 -2
  12. package/dist/core/index.native.js.map +1 -1
  13. package/dist/form/index.d.ts +14 -6
  14. package/dist/form/index.js +32 -12
  15. package/dist/form/index.js.map +1 -1
  16. package/dist/head/index.d.ts +18 -18
  17. package/dist/head/index.js +5 -1
  18. package/dist/head/index.js.map +1 -1
  19. package/dist/i18n/index.d.ts +25 -25
  20. package/dist/i18n/index.js +4 -3
  21. package/dist/i18n/index.js.map +1 -1
  22. package/dist/websocket/index.d.ts +1 -1
  23. package/package.json +22 -23
  24. package/src/auth/hooks/useAuth.ts +1 -0
  25. package/src/auth/services/ReactAuth.ts +6 -4
  26. package/src/core/components/ErrorViewer.tsx +378 -130
  27. package/src/core/components/NestedView.tsx +16 -11
  28. package/src/core/contexts/AlephaProvider.tsx +41 -0
  29. package/src/core/contexts/RouterLayerContext.ts +2 -0
  30. package/src/core/hooks/useAction.ts +4 -1
  31. package/src/core/index.shared.ts +1 -0
  32. package/src/core/primitives/$page.ts +15 -2
  33. package/src/core/providers/ReactPageProvider.ts +6 -7
  34. package/src/core/providers/ReactServerProvider.ts +2 -6
  35. package/src/form/services/FormModel.ts +81 -26
  36. package/src/head/index.ts +2 -1
  37. package/src/i18n/providers/I18nProvider.ts +4 -2
@@ -45,13 +45,13 @@ var ReactAuth = class {
45
45
  return this.linkProvider.can(action);
46
46
  }
47
47
  async login(provider, options) {
48
+ const realmParam = options.realm ? `&realm=${encodeURIComponent(options.realm)}` : "";
48
49
  if (options.username || options.password) {
49
- const { data } = await this.httpClient.fetch(`${options.hostname || ""}${alephaServerAuthRoutes.token}?provider=${provider}`, {
50
+ const { data } = await this.httpClient.fetch(`${options.hostname || ""}${alephaServerAuthRoutes.token}?provider=${provider}${realmParam}`, {
50
51
  method: "POST",
51
52
  body: JSON.stringify({
52
53
  username: options.username,
53
- password: options.password,
54
- ...options
54
+ password: options.password
55
55
  }),
56
56
  schema: { response: tokenResponseSchema }
57
57
  });
@@ -62,14 +62,14 @@ var ReactAuth = class {
62
62
  if (this.alepha.isBrowser()) {
63
63
  const browser = this.alepha.inject(ReactBrowserProvider);
64
64
  const redirect = options.redirect || (browser.transitioning ? window.location.origin + browser.transitioning.to : window.location.href);
65
- const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${encodeURIComponent(redirect)}`;
65
+ const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${encodeURIComponent(redirect)}`;
66
66
  if (browser.transitioning) throw new Redirection(href);
67
67
  else {
68
68
  window.location.href = href;
69
69
  return {};
70
70
  }
71
71
  }
72
- throw new Redirection(`${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${options.redirect || "/"}`);
72
+ throw new Redirection(`${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${options.redirect || "/"}`);
73
73
  }
74
74
  logout() {
75
75
  window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.js","names":[],"sources":["../../src/auth/services/ReactAuth.ts","../../src/auth/hooks/useAuth.ts","../../src/auth/index.browser.ts"],"sourcesContent":["import { ReactBrowserProvider, Redirection } from \"@alepha/react\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport type { UserAccountToken } from \"alepha/security\";\nimport { HttpClient } from \"alepha/server\";\nimport { alephaServerAuthRoutes, tokenResponseSchema, type Tokens, userinfoResponseSchema } from \"alepha/server/auth\";\nimport { LinkProvider } from \"alepha/server/links\";\n\n/**\n * Browser, SSR friendly, service to handle authentication.\n */\nexport class ReactAuth {\n protected readonly log = $logger();\n protected readonly alepha = $inject(Alepha);\n protected readonly httpClient = $inject(HttpClient);\n protected readonly linkProvider = $inject(LinkProvider);\n\n protected readonly onBeginTransition = $hook({\n on: \"react:transition:begin\",\n handler: async (event) => {\n if (this.alepha.isBrowser()) {\n Object.defineProperty(event.state, \"user\", {\n get: () => this.user,\n });\n }\n },\n });\n\n protected readonly onFetchRequest = $hook({\n on: \"client:onRequest\",\n handler: async ({ request }) => {\n if (this.alepha.isBrowser() && this.user) {\n // ensure cookies are sent with requests and refresh-able\n request.credentials ??= \"include\";\n }\n },\n });\n\n /**\n * Get the current authenticated user.\n *\n * Alias for `alepha.state.get(\"user\")`\n */\n public get user(): UserAccountToken | undefined {\n return this.alepha.store.get(\"alepha.server.request.user\");\n }\n\n public async ping() {\n const { data } = await this.httpClient.fetch(alephaServerAuthRoutes.userinfo, {\n schema: { response: userinfoResponseSchema },\n });\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data.user;\n }\n\n public can(action: string): boolean {\n if (!this.user) {\n return false;\n }\n\n return this.linkProvider.can(action);\n }\n\n public async login(\n provider: string,\n options: {\n hostname?: string;\n username?: string;\n password?: string;\n redirect?: string;\n [extra: string]: any;\n },\n ): Promise<Tokens> {\n if (options.username || options.password) {\n const { data } = await this.httpClient.fetch(\n `${options.hostname || \"\"}${alephaServerAuthRoutes.token}?provider=${provider}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n username: options.username,\n password: options.password,\n ...options,\n }),\n schema: { response: tokenResponseSchema },\n },\n );\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data;\n }\n\n if (this.alepha.isBrowser()) {\n const browser = this.alepha.inject(ReactBrowserProvider);\n const redirect =\n options.redirect ||\n (browser.transitioning\n ? window.location.origin + browser.transitioning.to\n : window.location.href);\n\n const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${encodeURIComponent(redirect)}`;\n\n if (browser.transitioning) {\n throw new Redirection(href);\n } else {\n window.location.href = href;\n return {} as Tokens;\n }\n }\n\n throw new Redirection(\n `${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${options.redirect || \"/\"}`,\n );\n }\n\n public logout() {\n window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;\n }\n}\n","import { useAlepha, useStore } from \"@alepha/react\";\nimport { type HttpVirtualClient, LinkProvider } from \"alepha/server/links\";\nimport { ReactAuth } from \"../services/ReactAuth.ts\";\n\nexport const useAuth = <T extends object = any>() => {\n const alepha = useAlepha();\n const [user] = useStore(\"alepha.server.request.user\");\n\n return {\n user,\n logout: () => {\n alepha.inject(ReactAuth).logout();\n },\n login: async (\n provider: keyof T,\n options: {\n username?: string;\n password?: string;\n redirect?: string;\n [extra: string]: any;\n } = {},\n ) => {\n await alepha.inject(ReactAuth).login(provider as string, options);\n },\n can: <Api extends object = any>(\n name: keyof HttpVirtualClient<Api>,\n ): boolean => {\n return alepha.inject(LinkProvider).can(name as string);\n },\n };\n};\n","import { $module } from \"alepha\";\nimport { ReactAuth } from \"./services/ReactAuth.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./index.shared.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const AlephaReactAuth = $module({\n name: \"alepha.react.auth\",\n services: [ReactAuth],\n});\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,YAAb,MAAuB;CACrB,AAAmB,MAAM,SAAS;CAClC,AAAmB,SAAS,QAAQ,OAAO;CA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O;;AAGT,MAAI,KAAK,OAAO,WAAW,EAAE;GAC3B,MAAM,UAAU,KAAK,OAAO,OAAO,qBAAqB;GACxD,MAAM,WACJ,QAAQ,aACP,QAAQ,gBACL,OAAO,SAAS,SAAS,QAAQ,cAAc,KAC/C,OAAO,SAAS;GAEtB,MAAM,OAAO,GAAG,OAAO,SAAS,SAAS,uBAAuB,MAAM,YAAY,SAAS,gBAAgB,mBAAmB,SAAS;AAEvI,OAAI,QAAQ,cACV,OAAM,IAAI,YAAY,KAAK;QACtB;AACL,WAAO,SAAS,OAAO;AACvB,WAAO,EAAE;;;AAIb,QAAM,IAAI,YACR,GAAG,uBAAuB,MAAM,YAAY,SAAS,gBAAgB,QAAQ,YAAY,MAC1F;;CAGH,AAAO,SAAS;AACd,SAAO,SAAS,OAAO,GAAG,uBAAuB,OAAO,4BAA4B,mBAAmB,OAAO,SAAS,OAAO;;;;;;ACpHlI,MAAa,gBAAwC;CACnD,MAAM,SAAS,WAAW;CAC1B,MAAM,CAAC,QAAQ,SAAS,6BAA6B;AAErD,QAAO;EACL;EACA,cAAc;AACZ,UAAO,OAAO,UAAU,CAAC,QAAQ;;EAEnC,OAAO,OACL,UACA,UAKI,EAAE,KACH;AACH,SAAM,OAAO,OAAO,UAAU,CAAC,MAAM,UAAoB,QAAQ;;EAEnE,MACE,SACY;AACZ,UAAO,OAAO,OAAO,aAAa,CAAC,IAAI,KAAe;;EAEzD;;;;;ACpBH,MAAa,kBAAkB,QAAQ;CACrC,MAAM;CACN,UAAU,CAAC,UAAU;CACtB,CAAC"}
1
+ {"version":3,"file":"index.browser.js","names":[],"sources":["../../src/auth/services/ReactAuth.ts","../../src/auth/hooks/useAuth.ts","../../src/auth/index.browser.ts"],"sourcesContent":["import { ReactBrowserProvider, Redirection } from \"@alepha/react\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport type { UserAccountToken } from \"alepha/security\";\nimport { HttpClient } from \"alepha/server\";\nimport { alephaServerAuthRoutes, tokenResponseSchema, type Tokens, userinfoResponseSchema } from \"alepha/server/auth\";\nimport { LinkProvider } from \"alepha/server/links\";\n\n/**\n * Browser, SSR friendly, service to handle authentication.\n */\nexport class ReactAuth {\n protected readonly log = $logger();\n protected readonly alepha = $inject(Alepha);\n protected readonly httpClient = $inject(HttpClient);\n protected readonly linkProvider = $inject(LinkProvider);\n\n protected readonly onBeginTransition = $hook({\n on: \"react:transition:begin\",\n handler: async (event) => {\n if (this.alepha.isBrowser()) {\n Object.defineProperty(event.state, \"user\", {\n get: () => this.user,\n });\n }\n },\n });\n\n protected readonly onFetchRequest = $hook({\n on: \"client:onRequest\",\n handler: async ({ request }) => {\n if (this.alepha.isBrowser() && this.user) {\n // ensure cookies are sent with requests and refresh-able\n request.credentials ??= \"include\";\n }\n },\n });\n\n /**\n * Get the current authenticated user.\n *\n * Alias for `alepha.state.get(\"user\")`\n */\n public get user(): UserAccountToken | undefined {\n return this.alepha.store.get(\"alepha.server.request.user\");\n }\n\n public async ping() {\n const { data } = await this.httpClient.fetch(alephaServerAuthRoutes.userinfo, {\n schema: { response: userinfoResponseSchema },\n });\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data.user;\n }\n\n public can(action: string): boolean {\n if (!this.user) {\n return false;\n }\n\n return this.linkProvider.can(action);\n }\n\n public async login(\n provider: string,\n options: {\n hostname?: string;\n username?: string;\n password?: string;\n redirect?: string;\n realm?: string;\n [extra: string]: any;\n },\n ): Promise<Tokens> {\n const realmParam = options.realm ? `&realm=${encodeURIComponent(options.realm)}` : \"\";\n\n if (options.username || options.password) {\n const { data } = await this.httpClient.fetch(\n `${options.hostname || \"\"}${alephaServerAuthRoutes.token}?provider=${provider}${realmParam}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n username: options.username,\n password: options.password,\n }),\n schema: { response: tokenResponseSchema },\n },\n );\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data;\n }\n\n if (this.alepha.isBrowser()) {\n const browser = this.alepha.inject(ReactBrowserProvider);\n const redirect =\n options.redirect ||\n (browser.transitioning\n ? window.location.origin + browser.transitioning.to\n : window.location.href);\n\n const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${encodeURIComponent(redirect)}`;\n\n if (browser.transitioning) {\n throw new Redirection(href);\n } else {\n window.location.href = href;\n return {} as Tokens;\n }\n }\n\n throw new Redirection(\n `${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${options.redirect || \"/\"}`,\n );\n }\n\n public logout() {\n window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;\n }\n}\n","import { useAlepha, useStore } from \"@alepha/react\";\nimport { type HttpVirtualClient, LinkProvider } from \"alepha/server/links\";\nimport { ReactAuth } from \"../services/ReactAuth.ts\";\n\nexport const useAuth = <T extends object = any>() => {\n const alepha = useAlepha();\n const [user] = useStore(\"alepha.server.request.user\");\n\n return {\n user,\n logout: () => {\n alepha.inject(ReactAuth).logout();\n },\n login: async (\n provider: keyof T,\n options: {\n username?: string;\n password?: string;\n redirect?: string;\n realm?: string;\n [extra: string]: any;\n } = {},\n ) => {\n await alepha.inject(ReactAuth).login(provider as string, options);\n },\n can: <Api extends object = any>(\n name: keyof HttpVirtualClient<Api>,\n ): boolean => {\n return alepha.inject(LinkProvider).can(name as string);\n },\n };\n};\n","import { $module } from \"alepha\";\nimport { ReactAuth } from \"./services/ReactAuth.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./index.shared.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const AlephaReactAuth = $module({\n name: \"alepha.react.auth\",\n services: [ReactAuth],\n});\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,YAAb,MAAuB;CACrB,AAAmB,MAAM,SAAS;CACl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AAM,IAAI,kCAAkC,KAAK,IAAI;AACjE,QAAK,OAAO,MAAM,IAAI,8BAA8B,KAAK,KAAK;AAE9D,UAAO;;AAGT,MAAI,KAAK,OAAO,WAAW,EAAE;GAC3B,MAAM,UAAU,KAAK,OAAO,OAAO,qBAAqB;GACxD,MAAM,WACJ,QAAQ,aACP,QAAQ,gBACL,OAAO,SAAS,SAAS,QAAQ,cAAc,KAC/C,OAAO,SAAS;GAEtB,MAAM,OAAO,GAAG,OAAO,SAAS,SAAS,uBAAuB,MAAM,YAAY,WAAW,WAAW,gBAAgB,mBAAmB,SAAS;AAEpJ,OAAI,QAAQ,cACV,OAAM,IAAI,YAAY,KAAK;QACtB;AACL,WAAO,SAAS,OAAO;AACvB,WAAO,EAAE;;;AAIb,QAAM,IAAI,YACR,GAAG,uBAAuB,MAAM,YAAY,WAAW,WAAW,gBAAgB,QAAQ,YAAY,MACvG;;CAGH,AAAO,SAAS;AACd,SAAO,SAAS,OAAO,GAAG,uBAAuB,OAAO,4BAA4B,mBAAmB,OAAO,SAAS,OAAO;;;;;;ACtHlI,MAAa,gBAAwC;CACnD,MAAM,SAAS,WAAW;CAC1B,MAAM,CAAC,QAAQ,SAAS,6BAA6B;AAErD,QAAO;EACL;EACA,cAAc;AACZ,UAAO,OAAO,UAAU,CAAC,QAAQ;;EAEnC,OAAO,OACL,UACA,UAMI,EAAE,KACH;AACH,SAAM,OAAO,OAAO,UAAU,CAAC,MAAM,UAAoB,QAAQ;;EAEnE,MACE,SACY;AACZ,UAAO,OAAO,OAAO,aAAa,CAAC,IAAI,KAAe;;EAEzD;;;;;ACrBH,MAAa,kBAAkB,QAAQ;CACrC,MAAM;CACN,UAAU,CAAC,UAAU;CACtB,CAAC"}
@@ -1,4 +1,4 @@
1
- import * as alepha20 from "alepha";
1
+ import * as alepha18 from "alepha";
2
2
  import { Alepha, AlephaError, Async, FileLike, InstantiableClass, LogLevel, LoggerInterface, Primitive, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
3
3
  import { IncomingMessage, Server, ServerResponse } from "node:http";
4
4
  import { Readable } from "node:stream";
@@ -7,33 +7,33 @@ import dayjsDuration from "dayjs/plugin/duration.js";
7
7
  import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
8
8
 
9
9
  //#region ../../../alepha/src/security/schemas/userAccountInfoSchema.d.ts
10
- declare const userAccountInfoSchema: alepha20.TObject<{
11
- id: alepha20.TString;
12
- name: alepha20.TOptional<alepha20.TString>;
13
- email: alepha20.TOptional<alepha20.TString>;
14
- username: alepha20.TOptional<alepha20.TString>;
15
- picture: alepha20.TOptional<alepha20.TString>;
16
- sessionId: alepha20.TOptional<alepha20.TString>;
17
- organizations: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
18
- roles: alepha20.TOptional<alepha20.TArray<alepha20.TString>>;
10
+ declare const userAccountInfoSchema: alepha18.TObject<{
11
+ id: alepha18.TString;
12
+ name: alepha18.TOptional<alepha18.TString>;
13
+ email: alepha18.TOptional<alepha18.TString>;
14
+ username: alepha18.TOptional<alepha18.TString>;
15
+ picture: alepha18.TOptional<alepha18.TString>;
16
+ sessionId: alepha18.TOptional<alepha18.TString>;
17
+ organizations: alepha18.TOptional<alepha18.TArray<alepha18.TString>>;
18
+ roles: alepha18.TOptional<alepha18.TArray<alepha18.TString>>;
19
19
  }>;
20
20
  type UserAccount = Static<typeof userAccountInfoSchema>;
21
21
  //#endregion
22
- //#region ../../../alepha/src/server/schemas/errorSchema.d.ts
23
- declare const errorSchema: alepha20.TObject<{
24
- error: alepha20.TString;
25
- status: alepha20.TInteger;
26
- message: alepha20.TString;
27
- details: alepha20.TOptional<alepha20.TString>;
28
- requestId: alepha20.TOptional<alepha20.TString>;
29
- cause: alepha20.TOptional<alepha20.TObject<{
30
- name: alepha20.TString;
31
- message: alepha20.TString;
22
+ //#region ../../../alepha/src/server/core/schemas/errorSchema.d.ts
23
+ declare const errorSchema: alepha18.TObject<{
24
+ error: alepha18.TString;
25
+ status: alepha18.TInteger;
26
+ message: alepha18.TString;
27
+ details: alepha18.TOptional<alepha18.TString>;
28
+ requestId: alepha18.TOptional<alepha18.TString>;
29
+ cause: alepha18.TOptional<alepha18.TObject<{
30
+ name: alepha18.TString;
31
+ message: alepha18.TString;
32
32
  }>>;
33
33
  }>;
34
34
  type ErrorSchema = Static<typeof errorSchema>;
35
35
  //#endregion
36
- //#region ../../../alepha/src/server/errors/HttpError.d.ts
36
+ //#region ../../../alepha/src/server/core/errors/HttpError.d.ts
37
37
  declare class HttpError extends AlephaError {
38
38
  name: string;
39
39
  static is: (error: unknown, status?: number) => error is HttpErrorLike;
@@ -96,11 +96,11 @@ interface Tree<T extends Route> {
96
96
  };
97
97
  }
98
98
  //#endregion
99
- //#region ../../../alepha/src/server/constants/routeMethods.d.ts
99
+ //#region ../../../alepha/src/server/core/constants/routeMethods.d.ts
100
100
  declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
101
101
  type RouteMethod = (typeof routeMethods)[number];
102
102
  //#endregion
103
- //#region ../../../alepha/src/server/helpers/ServerReply.d.ts
103
+ //#region ../../../alepha/src/server/core/helpers/ServerReply.d.ts
104
104
  /**
105
105
  * Helper for building server replies.
106
106
  */
@@ -128,7 +128,7 @@ declare class ServerReply {
128
128
  setBody(body: any): this;
129
129
  }
130
130
  //#endregion
131
- //#region ../../../alepha/src/server/services/UserAgentParser.d.ts
131
+ //#region ../../../alepha/src/server/core/services/UserAgentParser.d.ts
132
132
  interface UserAgentInfo {
133
133
  os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
134
134
  browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
@@ -144,7 +144,7 @@ declare class UserAgentParser {
144
144
  parse(userAgent?: string): UserAgentInfo;
145
145
  }
146
146
  //#endregion
147
- //#region ../../../alepha/src/server/interfaces/ServerRequest.d.ts
147
+ //#region ../../../alepha/src/server/core/interfaces/ServerRequest.d.ts
148
148
  type TRequestBody = TObject | TString | TArray | TRecord | TStream;
149
149
  type TResponseBody = TObject | TString | TRecord | TFile | TArray | TStream | TVoid;
150
150
  interface RequestConfigSchema {
@@ -267,15 +267,15 @@ interface WebRequestEvent {
267
267
  }
268
268
  //#endregion
269
269
  //#region ../../../alepha/src/logger/schemas/logEntrySchema.d.ts
270
- declare const logEntrySchema: alepha20.TObject<{
271
- level: alepha20.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
272
- message: alepha20.TString;
273
- service: alepha20.TString;
274
- module: alepha20.TString;
275
- context: alepha20.TOptional<alepha20.TString>;
276
- app: alepha20.TOptional<alepha20.TString>;
277
- data: alepha20.TOptional<alepha20.TAny>;
278
- timestamp: alepha20.TNumber;
270
+ declare const logEntrySchema: alepha18.TObject<{
271
+ level: alepha18.TUnsafe<"SILENT" | "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR">;
272
+ message: alepha18.TString;
273
+ service: alepha18.TString;
274
+ module: alepha18.TString;
275
+ context: alepha18.TOptional<alepha18.TString>;
276
+ app: alepha18.TOptional<alepha18.TString>;
277
+ data: alepha18.TOptional<alepha18.TAny>;
278
+ timestamp: alepha18.TNumber;
279
279
  }>;
280
280
  type LogEntry = Static<typeof logEntrySchema>;
281
281
  //#endregion
@@ -290,8 +290,8 @@ declare class DateTimeProvider {
290
290
  protected readonly timeouts: Timeout[];
291
291
  protected readonly intervals: Interval[];
292
292
  constructor();
293
- protected readonly onStart: alepha20.HookPrimitive<"start">;
294
- protected readonly onStop: alepha20.HookPrimitive<"stop">;
293
+ protected readonly onStart: alepha18.HookPrimitive<"start">;
294
+ protected readonly onStop: alepha18.HookPrimitive<"stop">;
295
295
  setLocale(locale: string): void;
296
296
  isDateTime(value: unknown): value is DateTime;
297
297
  /**
@@ -423,7 +423,7 @@ declare class Logger implements LoggerInterface {
423
423
  }
424
424
  //#endregion
425
425
  //#region ../../../alepha/src/logger/index.d.ts
426
- declare const envSchema$3: alepha20.TObject<{
426
+ declare const envSchema$3: alepha18.TObject<{
427
427
  /**
428
428
  * Default log level for the application.
429
429
  *
@@ -440,14 +440,14 @@ declare const envSchema$3: alepha20.TObject<{
440
440
  * LOG_LEVEL=my.module.name:debug,info # Set debug level for my.module.name and info for all other modules
441
441
  * LOG_LEVEL=alepha:trace, info # Set trace level for all alepha modules and info for all other modules
442
442
  */
443
- LOG_LEVEL: alepha20.TOptional<alepha20.TString>;
443
+ LOG_LEVEL: alepha18.TOptional<alepha18.TString>;
444
444
  /**
445
445
  * Built-in log formats.
446
446
  * - "json" - JSON format, useful for structured logging and log aggregation. {@link JsonFormatterProvider}
447
- * - "pretty" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
447
+ * - "pretty" - Simple text format, human-readable, with colors. {@link PrettyFormatterProvider}
448
448
  * - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
449
449
  */
450
- LOG_FORMAT: alepha20.TOptional<alepha20.TUnsafe<"json" | "pretty" | "raw">>;
450
+ LOG_FORMAT: alepha18.TOptional<alepha18.TUnsafe<"json" | "pretty" | "raw">>;
451
451
  }>;
452
452
  declare module "alepha" {
453
453
  interface Env extends Partial<Static<typeof envSchema$3>> {}
@@ -465,7 +465,7 @@ declare module "alepha" {
465
465
  }
466
466
  }
467
467
  //#endregion
468
- //#region ../../../alepha/src/server/services/ServerRequestParser.d.ts
468
+ //#region ../../../alepha/src/server/core/services/ServerRequestParser.d.ts
469
469
  declare class ServerRequestParser {
470
470
  protected readonly alepha: Alepha;
471
471
  protected readonly userAgentParser: UserAgentParser;
@@ -475,7 +475,7 @@ declare class ServerRequestParser {
475
475
  getRequestIp(request: ServerRequestData): string | undefined;
476
476
  }
477
477
  //#endregion
478
- //#region ../../../alepha/src/server/providers/ServerTimingProvider.d.ts
478
+ //#region ../../../alepha/src/server/core/providers/ServerTimingProvider.d.ts
479
479
  type TimingMap = Record<string, [number, number]>;
480
480
  declare class ServerTimingProvider {
481
481
  protected readonly log: Logger;
@@ -484,15 +484,15 @@ declare class ServerTimingProvider {
484
484
  prefix: string;
485
485
  disabled: boolean;
486
486
  };
487
- readonly onRequest: alepha20.HookPrimitive<"server:onRequest">;
488
- readonly onResponse: alepha20.HookPrimitive<"server:onResponse">;
487
+ readonly onRequest: alepha18.HookPrimitive<"server:onRequest">;
488
+ readonly onResponse: alepha18.HookPrimitive<"server:onResponse">;
489
489
  protected get handlerName(): string;
490
490
  beginTiming(name: string): void;
491
491
  endTiming(name: string): void;
492
492
  protected setDuration(name: string, timing: TimingMap): void;
493
493
  }
494
494
  //#endregion
495
- //#region ../../../alepha/src/server/providers/ServerRouterProvider.d.ts
495
+ //#region ../../../alepha/src/server/core/providers/ServerRouterProvider.d.ts
496
496
  /**
497
497
  * Main router for all routes on the server side.
498
498
  *
@@ -531,7 +531,7 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
531
531
  }, request: ServerRequestConfig): void;
532
532
  }
533
533
  //#endregion
534
- //#region ../../../alepha/src/server/providers/ServerProvider.d.ts
534
+ //#region ../../../alepha/src/server/core/providers/ServerProvider.d.ts
535
535
  /**
536
536
  * Base server provider to handle incoming requests and route them.
537
537
  *
@@ -549,11 +549,11 @@ declare class ServerProvider {
549
549
  /**
550
550
  * When a Node.js HTTP request is received from outside. (Vercel, AWS Lambda, etc.)
551
551
  */
552
- protected readonly onNodeRequest: alepha20.HookPrimitive<"node:request">;
552
+ protected readonly onNodeRequest: alepha18.HookPrimitive<"node:request">;
553
553
  /**
554
554
  * When a Web (Fetch API) request is received from outside. (Netlify, Cloudflare Workers, etc.)
555
555
  */
556
- protected readonly onWebRequest: alepha20.HookPrimitive<"web:request">;
556
+ protected readonly onWebRequest: alepha18.HookPrimitive<"web:request">;
557
557
  /**
558
558
  * Handle Node.js HTTP request event.
559
559
  *
@@ -570,7 +570,7 @@ declare class ServerProvider {
570
570
  protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
571
571
  }
572
572
  //#endregion
573
- //#region ../../../alepha/src/cache/providers/CacheProvider.d.ts
573
+ //#region ../../../alepha/src/cache/core/providers/CacheProvider.d.ts
574
574
  /**
575
575
  * Cache provider interface.
576
576
  *
@@ -613,7 +613,7 @@ declare abstract class CacheProvider {
613
613
  abstract clear(): Promise<void>;
614
614
  }
615
615
  //#endregion
616
- //#region ../../../alepha/src/cache/primitives/$cache.d.ts
616
+ //#region ../../../alepha/src/cache/core/primitives/$cache.d.ts
617
617
  interface CachePrimitiveOptions<TReturn = any, TParameter extends any[] = any[]> {
618
618
  /**
619
619
  * The cache name. This is useful for invalidating multiple caches at once.
@@ -680,7 +680,7 @@ interface CachePrimitiveFn<TReturn = any, TParameter extends any[] = any[]> exte
680
680
  (...args: TParameter): Promise<TReturn>;
681
681
  }
682
682
  //#endregion
683
- //#region ../../../alepha/src/server/services/HttpClient.d.ts
683
+ //#region ../../../alepha/src/server/core/services/HttpClient.d.ts
684
684
  declare class HttpClient {
685
685
  protected readonly log: Logger;
686
686
  protected readonly alepha: Alepha;
@@ -752,7 +752,7 @@ interface HttpAction {
752
752
  };
753
753
  }
754
754
  //#endregion
755
- //#region ../../../alepha/src/server/primitives/$action.d.ts
755
+ //#region ../../../alepha/src/server/core/primitives/$action.d.ts
756
756
  interface ActionPrimitiveOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
757
757
  /**
758
758
  * Name of the action.
@@ -887,25 +887,25 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
887
887
  */
888
888
  interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
889
889
  //#endregion
890
- //#region ../../../alepha/src/server/providers/BunHttpServerProvider.d.ts
891
- declare const envSchema$2: alepha20.TObject<{
892
- SERVER_PORT: alepha20.TInteger;
893
- SERVER_HOST: alepha20.TString;
890
+ //#region ../../../alepha/src/server/core/providers/BunHttpServerProvider.d.ts
891
+ declare const envSchema$2: alepha18.TObject<{
892
+ SERVER_PORT: alepha18.TInteger;
893
+ SERVER_HOST: alepha18.TString;
894
894
  }>;
895
895
  declare module "alepha" {
896
896
  interface Env extends Partial<Static<typeof envSchema$2>> {}
897
897
  }
898
898
  //#endregion
899
- //#region ../../../alepha/src/server/providers/NodeHttpServerProvider.d.ts
900
- declare const envSchema$1: alepha20.TObject<{
901
- SERVER_PORT: alepha20.TInteger;
902
- SERVER_HOST: alepha20.TString;
899
+ //#region ../../../alepha/src/server/core/providers/NodeHttpServerProvider.d.ts
900
+ declare const envSchema$1: alepha18.TObject<{
901
+ SERVER_PORT: alepha18.TInteger;
902
+ SERVER_HOST: alepha18.TString;
903
903
  }>;
904
904
  declare module "alepha" {
905
905
  interface Env extends Partial<Static<typeof envSchema$1>> {}
906
906
  }
907
907
  //#endregion
908
- //#region ../../../alepha/src/server/index.d.ts
908
+ //#region ../../../alepha/src/server/core/index.d.ts
909
909
  declare module "alepha" {
910
910
  interface State {
911
911
  "alepha.node.server"?: Server;
@@ -983,8 +983,8 @@ interface UserAccountToken extends UserAccount {
983
983
  }
984
984
  //#endregion
985
985
  //#region ../../../alepha/src/security/providers/SecurityProvider.d.ts
986
- declare const envSchema: alepha20.TObject<{
987
- APP_SECRET: alepha20.TString;
986
+ declare const envSchema: alepha18.TObject<{
987
+ APP_SECRET: alepha18.TString;
988
988
  }>;
989
989
  declare module "alepha" {
990
990
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -1012,19 +1012,19 @@ declare module "alepha" {
1012
1012
  * @module alepha.security
1013
1013
  */
1014
1014
  //#endregion
1015
- //#region ../../../alepha/src/server-security/providers/ServerBasicAuthProvider.d.ts
1015
+ //#region ../../../alepha/src/server/security/providers/ServerBasicAuthProvider.d.ts
1016
1016
  interface BasicAuthOptions {
1017
1017
  username: string;
1018
1018
  password: string;
1019
1019
  }
1020
1020
  //#endregion
1021
- //#region ../../../alepha/src/server-security/providers/ServerSecurityProvider.d.ts
1021
+ //#region ../../../alepha/src/server/security/providers/ServerSecurityProvider.d.ts
1022
1022
  type ServerRouteSecure = {
1023
1023
  realm?: string;
1024
1024
  basic?: BasicAuthOptions;
1025
1025
  };
1026
1026
  //#endregion
1027
- //#region ../../../alepha/src/server-security/index.d.ts
1027
+ //#region ../../../alepha/src/server/security/index.d.ts
1028
1028
  declare module "alepha" {
1029
1029
  interface State {
1030
1030
  /**
@@ -1076,30 +1076,30 @@ declare module "alepha/server" {
1076
1076
  * @module alepha.server.security
1077
1077
  */
1078
1078
  //#endregion
1079
- //#region ../../../alepha/src/server-links/schemas/apiLinksResponseSchema.d.ts
1080
- declare const apiLinkSchema: alepha20.TObject<{
1081
- name: alepha20.TString;
1082
- group: alepha20.TOptional<alepha20.TString>;
1083
- path: alepha20.TString;
1084
- method: alepha20.TOptional<alepha20.TString>;
1085
- requestBodyType: alepha20.TOptional<alepha20.TString>;
1086
- service: alepha20.TOptional<alepha20.TString>;
1079
+ //#region ../../../alepha/src/server/links/schemas/apiLinksResponseSchema.d.ts
1080
+ declare const apiLinkSchema: alepha18.TObject<{
1081
+ name: alepha18.TString;
1082
+ group: alepha18.TOptional<alepha18.TString>;
1083
+ path: alepha18.TString;
1084
+ method: alepha18.TOptional<alepha18.TString>;
1085
+ requestBodyType: alepha18.TOptional<alepha18.TString>;
1086
+ service: alepha18.TOptional<alepha18.TString>;
1087
1087
  }>;
1088
- declare const apiLinksResponseSchema: alepha20.TObject<{
1089
- prefix: alepha20.TOptional<alepha20.TString>;
1090
- links: alepha20.TArray<alepha20.TObject<{
1091
- name: alepha20.TString;
1092
- group: alepha20.TOptional<alepha20.TString>;
1093
- path: alepha20.TString;
1094
- method: alepha20.TOptional<alepha20.TString>;
1095
- requestBodyType: alepha20.TOptional<alepha20.TString>;
1096
- service: alepha20.TOptional<alepha20.TString>;
1088
+ declare const apiLinksResponseSchema: alepha18.TObject<{
1089
+ prefix: alepha18.TOptional<alepha18.TString>;
1090
+ links: alepha18.TArray<alepha18.TObject<{
1091
+ name: alepha18.TString;
1092
+ group: alepha18.TOptional<alepha18.TString>;
1093
+ path: alepha18.TString;
1094
+ method: alepha18.TOptional<alepha18.TString>;
1095
+ requestBodyType: alepha18.TOptional<alepha18.TString>;
1096
+ service: alepha18.TOptional<alepha18.TString>;
1097
1097
  }>>;
1098
1098
  }>;
1099
1099
  type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
1100
1100
  type ApiLink = Static<typeof apiLinkSchema>;
1101
1101
  //#endregion
1102
- //#region ../../../alepha/src/server-links/providers/LinkProvider.d.ts
1102
+ //#region ../../../alepha/src/server/links/providers/LinkProvider.d.ts
1103
1103
  /**
1104
1104
  * Browser, SSR friendly, service to handle links.
1105
1105
  */
@@ -1166,7 +1166,7 @@ interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionPrimit
1166
1166
  can: () => boolean;
1167
1167
  }
1168
1168
  //#endregion
1169
- //#region ../../../alepha/src/server-links/index.d.ts
1169
+ //#region ../../../alepha/src/server/links/index.d.ts
1170
1170
  declare module "alepha" {
1171
1171
  interface State {
1172
1172
  /**
@@ -1207,26 +1207,27 @@ declare const useAuth: <T extends object = any>() => {
1207
1207
  username?: string;
1208
1208
  password?: string;
1209
1209
  redirect?: string;
1210
+ realm?: string;
1210
1211
  [extra: string]: any;
1211
1212
  }) => Promise<void>;
1212
1213
  can: <Api extends object = any>(name: keyof HttpVirtualClient<Api>) => boolean;
1213
1214
  };
1214
1215
  //#endregion
1215
- //#region ../../../alepha/src/server-auth/schemas/tokensSchema.d.ts
1216
- declare const tokensSchema: alepha20.TObject<{
1217
- provider: alepha20.TString;
1218
- access_token: alepha20.TString;
1219
- issued_at: alepha20.TNumber;
1220
- expires_in: alepha20.TOptional<alepha20.TNumber>;
1221
- refresh_token: alepha20.TOptional<alepha20.TString>;
1222
- refresh_token_expires_in: alepha20.TOptional<alepha20.TNumber>;
1223
- refresh_expires_in: alepha20.TOptional<alepha20.TNumber>;
1224
- id_token: alepha20.TOptional<alepha20.TString>;
1225
- scope: alepha20.TOptional<alepha20.TString>;
1216
+ //#region ../../../alepha/src/server/auth/schemas/tokensSchema.d.ts
1217
+ declare const tokensSchema: alepha18.TObject<{
1218
+ provider: alepha18.TString;
1219
+ access_token: alepha18.TString;
1220
+ issued_at: alepha18.TNumber;
1221
+ expires_in: alepha18.TOptional<alepha18.TNumber>;
1222
+ refresh_token: alepha18.TOptional<alepha18.TString>;
1223
+ refresh_token_expires_in: alepha18.TOptional<alepha18.TNumber>;
1224
+ refresh_expires_in: alepha18.TOptional<alepha18.TNumber>;
1225
+ id_token: alepha18.TOptional<alepha18.TString>;
1226
+ scope: alepha18.TOptional<alepha18.TString>;
1226
1227
  }>;
1227
1228
  type Tokens = Static<typeof tokensSchema>;
1228
1229
  //#endregion
1229
- //#region ../../../alepha/src/server-cookies/primitives/$cookie.d.ts
1230
+ //#region ../../../alepha/src/server/cookies/primitives/$cookie.d.ts
1230
1231
  interface Cookies {
1231
1232
  req: Record<string, string>;
1232
1233
  res: Record<string, Cookie | null>;
@@ -1241,7 +1242,7 @@ interface Cookie {
1241
1242
  domain?: string;
1242
1243
  }
1243
1244
  //#endregion
1244
- //#region ../../../alepha/src/server-cookies/index.d.ts
1245
+ //#region ../../../alepha/src/server/cookies/index.d.ts
1245
1246
  declare module "alepha/server" {
1246
1247
  interface ServerRequest {
1247
1248
  cookies: Cookies;
@@ -1258,7 +1259,7 @@ declare module "alepha/server" {
1258
1259
  * @module alepha.server.cookies
1259
1260
  */
1260
1261
  //#endregion
1261
- //#region ../../../alepha/src/server-auth/index.d.ts
1262
+ //#region ../../../alepha/src/server/auth/index.d.ts
1262
1263
  declare module "alepha" {
1263
1264
  interface State {
1264
1265
  /**
@@ -1292,8 +1293,8 @@ declare class ReactAuth {
1292
1293
  protected readonly alepha: Alepha;
1293
1294
  protected readonly httpClient: HttpClient;
1294
1295
  protected readonly linkProvider: LinkProvider;
1295
- protected readonly onBeginTransition: alepha20.HookPrimitive<"react:transition:begin">;
1296
- protected readonly onFetchRequest: alepha20.HookPrimitive<"client:onRequest">;
1296
+ protected readonly onBeginTransition: alepha18.HookPrimitive<"react:transition:begin">;
1297
+ protected readonly onFetchRequest: alepha18.HookPrimitive<"client:onRequest">;
1297
1298
  /**
1298
1299
  * Get the current authenticated user.
1299
1300
  *
@@ -1316,6 +1317,7 @@ declare class ReactAuth {
1316
1317
  username?: string;
1317
1318
  password?: string;
1318
1319
  redirect?: string;
1320
+ realm?: string;
1319
1321
  [extra: string]: any;
1320
1322
  }): Promise<Tokens>;
1321
1323
  logout(): void;
@@ -1324,7 +1326,7 @@ declare class ReactAuth {
1324
1326
  //#region ../../src/auth/providers/ReactAuthProvider.d.ts
1325
1327
  declare class ReactAuthProvider {
1326
1328
  protected readonly alepha: Alepha;
1327
- readonly onRender: alepha20.HookPrimitive<"react:server:render:begin">;
1329
+ readonly onRender: alepha18.HookPrimitive<"react:server:render:begin">;
1328
1330
  }
1329
1331
  //#endregion
1330
1332
  //#region ../../src/auth/index.d.ts
@@ -1339,7 +1341,7 @@ declare module "@alepha/react" {
1339
1341
  * @see {@link ReactAuthProvider}
1340
1342
  * @module alepha.react.auth
1341
1343
  */
1342
- declare const AlephaReactAuth: alepha20.Service<alepha20.Module>;
1344
+ declare const AlephaReactAuth: alepha18.Service<alepha18.Module>;
1343
1345
  //#endregion
1344
1346
  export { AlephaReactAuth, ReactAuth, ReactAuthProvider, useAuth };
1345
1347
  //# sourceMappingURL=index.d.ts.map
@@ -61,13 +61,13 @@ var ReactAuth = class {
61
61
  return this.linkProvider.can(action);
62
62
  }
63
63
  async login(provider, options) {
64
+ const realmParam = options.realm ? `&realm=${encodeURIComponent(options.realm)}` : "";
64
65
  if (options.username || options.password) {
65
- const { data } = await this.httpClient.fetch(`${options.hostname || ""}${alephaServerAuthRoutes.token}?provider=${provider}`, {
66
+ const { data } = await this.httpClient.fetch(`${options.hostname || ""}${alephaServerAuthRoutes.token}?provider=${provider}${realmParam}`, {
66
67
  method: "POST",
67
68
  body: JSON.stringify({
68
69
  username: options.username,
69
- password: options.password,
70
- ...options
70
+ password: options.password
71
71
  }),
72
72
  schema: { response: tokenResponseSchema }
73
73
  });
@@ -78,14 +78,14 @@ var ReactAuth = class {
78
78
  if (this.alepha.isBrowser()) {
79
79
  const browser = this.alepha.inject(ReactBrowserProvider);
80
80
  const redirect = options.redirect || (browser.transitioning ? window.location.origin + browser.transitioning.to : window.location.href);
81
- const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${encodeURIComponent(redirect)}`;
81
+ const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${encodeURIComponent(redirect)}`;
82
82
  if (browser.transitioning) throw new Redirection(href);
83
83
  else {
84
84
  window.location.href = href;
85
85
  return {};
86
86
  }
87
87
  }
88
- throw new Redirection(`${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${options.redirect || "/"}`);
88
+ throw new Redirection(`${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${options.redirect || "/"}`);
89
89
  }
90
90
  logout() {
91
91
  window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/auth/providers/ReactAuthProvider.ts","../../src/auth/services/ReactAuth.ts","../../src/auth/hooks/useAuth.ts","../../src/auth/index.ts"],"sourcesContent":["import { $hook, $inject, Alepha } from \"alepha\";\n\nexport class ReactAuthProvider {\n protected readonly alepha = $inject(Alepha);\n\n public readonly onRender = $hook({\n on: \"react:server:render:begin\",\n handler: async ({ request, state }) => {\n if (request?.user) {\n const { token, realm, ...user } = request.user; // do not send token and realm to the client\n this.alepha.store.set(\"alepha.server.request.user\", user); // for hydration, browser, etc...\n state.user = user;\n }\n },\n });\n}\n","import { ReactBrowserProvider, Redirection } from \"@alepha/react\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport type { UserAccountToken } from \"alepha/security\";\nimport { HttpClient } from \"alepha/server\";\nimport { alephaServerAuthRoutes, tokenResponseSchema, type Tokens, userinfoResponseSchema } from \"alepha/server/auth\";\nimport { LinkProvider } from \"alepha/server/links\";\n\n/**\n * Browser, SSR friendly, service to handle authentication.\n */\nexport class ReactAuth {\n protected readonly log = $logger();\n protected readonly alepha = $inject(Alepha);\n protected readonly httpClient = $inject(HttpClient);\n protected readonly linkProvider = $inject(LinkProvider);\n\n protected readonly onBeginTransition = $hook({\n on: \"react:transition:begin\",\n handler: async (event) => {\n if (this.alepha.isBrowser()) {\n Object.defineProperty(event.state, \"user\", {\n get: () => this.user,\n });\n }\n },\n });\n\n protected readonly onFetchRequest = $hook({\n on: \"client:onRequest\",\n handler: async ({ request }) => {\n if (this.alepha.isBrowser() && this.user) {\n // ensure cookies are sent with requests and refresh-able\n request.credentials ??= \"include\";\n }\n },\n });\n\n /**\n * Get the current authenticated user.\n *\n * Alias for `alepha.state.get(\"user\")`\n */\n public get user(): UserAccountToken | undefined {\n return this.alepha.store.get(\"alepha.server.request.user\");\n }\n\n public async ping() {\n const { data } = await this.httpClient.fetch(alephaServerAuthRoutes.userinfo, {\n schema: { response: userinfoResponseSchema },\n });\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data.user;\n }\n\n public can(action: string): boolean {\n if (!this.user) {\n return false;\n }\n\n return this.linkProvider.can(action);\n }\n\n public async login(\n provider: string,\n options: {\n hostname?: string;\n username?: string;\n password?: string;\n redirect?: string;\n [extra: string]: any;\n },\n ): Promise<Tokens> {\n if (options.username || options.password) {\n const { data } = await this.httpClient.fetch(\n `${options.hostname || \"\"}${alephaServerAuthRoutes.token}?provider=${provider}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n username: options.username,\n password: options.password,\n ...options,\n }),\n schema: { response: tokenResponseSchema },\n },\n );\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data;\n }\n\n if (this.alepha.isBrowser()) {\n const browser = this.alepha.inject(ReactBrowserProvider);\n const redirect =\n options.redirect ||\n (browser.transitioning\n ? window.location.origin + browser.transitioning.to\n : window.location.href);\n\n const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${encodeURIComponent(redirect)}`;\n\n if (browser.transitioning) {\n throw new Redirection(href);\n } else {\n window.location.href = href;\n return {} as Tokens;\n }\n }\n\n throw new Redirection(\n `${alephaServerAuthRoutes.login}?provider=${provider}&redirect_uri=${options.redirect || \"/\"}`,\n );\n }\n\n public logout() {\n window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;\n }\n}\n","import { useAlepha, useStore } from \"@alepha/react\";\nimport { type HttpVirtualClient, LinkProvider } from \"alepha/server/links\";\nimport { ReactAuth } from \"../services/ReactAuth.ts\";\n\nexport const useAuth = <T extends object = any>() => {\n const alepha = useAlepha();\n const [user] = useStore(\"alepha.server.request.user\");\n\n return {\n user,\n logout: () => {\n alepha.inject(ReactAuth).logout();\n },\n login: async (\n provider: keyof T,\n options: {\n username?: string;\n password?: string;\n redirect?: string;\n [extra: string]: any;\n } = {},\n ) => {\n await alepha.inject(ReactAuth).login(provider as string, options);\n },\n can: <Api extends object = any>(\n name: keyof HttpVirtualClient<Api>,\n ): boolean => {\n return alepha.inject(LinkProvider).can(name as string);\n },\n };\n};\n","import { AlephaReact } from \"@alepha/react\";\nimport { $module } from \"alepha\";\nimport type { UserAccount } from \"alepha/security\";\nimport { ReactAuthProvider } from \"./providers/ReactAuthProvider.ts\";\nimport { ReactAuth } from \"./services/ReactAuth.ts\";\nimport { $auth, AlephaServerAuth } from \"alepha/server/auth\";\nimport { AlephaServerLinks } from \"alepha/server/links\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./index.shared.ts\";\nexport * from \"./providers/ReactAuthProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"@alepha/react\" {\n interface ReactRouterState {\n user?: UserAccount;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * The ReactAuthModule provides authentication services for React applications.\n *\n * @see {@link ReactAuthProvider}\n * @module alepha.react.auth\n */\nexport const AlephaReactAuth = $module({\n name: \"alepha.react.auth\",\n primitives: [$auth],\n services: [AlephaReact, AlephaServerLinks, AlephaServerAuth, ReactAuthProvider, ReactAuth],\n});\n"],"mappings":";;;;;;;;AAEA,IAAa,oBAAb,MAA+B;CAC7B,AAAmB,SAAS,QAAQ,OAAO;CAE3C,AAAgB,WAAW,MAAM;EAC/B,IAAI;EACJ,SAAS,OAAO,EAAE,SAAS,YAAY;AACrC,OAAI,SAAS,MAAM;IACjB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS,QAAQ;AAC1C,SAAK,OAAO,MAAM,IAAI,8BAA8B,KAAK;AACzD,UAAM,OAAO;;;EAGlB,CAAC;;;;;;;;ACHJ,IAAa,YAAb,MAAuB;CACrB,AAAmB,MAAM,SAAS;CAClC,AAAmB,SAAS,QAAQ,OAAO;CAC3C,AAAmB,aAAa,QAAQ,WAAW;CACnD,AAAmB,eAAe,QAAQ,aAAa;CAEvD,AAAmB,oBAAoB,MAAM;EAC3C,IAAI;EACJ,SAAS,OAAO,UAAU;AACxB,OAAI,KAAK,OAAO,WAAW,CACzB,QAAO,eAAe,MAAM,OAAO,QAAQ,EACzC,WAAW,KAAK,MACjB,CAAC;;EAGP,CAAC;CAEF,AAAmB,iBAAiB,MAAM;EACxC,IAAI;EACJ,SAAS,OAAO,EAAE,cAAc;AAC9B,OAAI,KAAK,OAAO,WAAW,IAAI,KAAK,KAElC,SAAQ,gBAAgB;;EAG7B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IAAI,YACR,GAAG,uBAAuB,MAAM,YAAY,SAAS,gBAAgB,QAAQ,YAAY,MAC1F;;CAGH,AAAO,SAAS;AACd,SAAO,SAAS,OAAO,GAAG,uBAAuB,OAAO,4BAA4B,mBAAmB,OAAO,SAAS,OAAO;;;;;;ACpHlI,MAAa,gBAAwC;CACnD,MAAM,SAAS,WAAW;CAC1B,MAAM,CAAC,QAAQ,SAAS,6BAA6B;AAErD,QAAO;EACL;EACA,cAAc;AACZ,UAAO,OAAO,UAAU,CAAC,QAAQ;;EAEnC,OAAO,OACL,UACA,UAKI,EAAE,KACH;AACH,SAAM,OAAO,OAAO,UAAU,CAAC,MAAM,UAAoB,QAAQ;;EAEnE,MACE,SACY;AACZ,UAAO,OAAO,OAAO,aAAa,CAAC,IAAI,KAAe;;EAEzD;;;;;;;;;;;ACAH,MAAa,kBAAkB,QAAQ;CACrC,MAAM;CACN,YAAY,CAAC,MAAM;CACnB,UAAU;EAAC;EAAa;EAAmB;EAAkB;EAAmB;EAAU;CAC3F,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/auth/providers/ReactAuthProvider.ts","../../src/auth/services/ReactAuth.ts","../../src/auth/hooks/useAuth.ts","../../src/auth/index.ts"],"sourcesContent":["import { $hook, $inject, Alepha } from \"alepha\";\n\nexport class ReactAuthProvider {\n protected readonly alepha = $inject(Alepha);\n\n public readonly onRender = $hook({\n on: \"react:server:render:begin\",\n handler: async ({ request, state }) => {\n if (request?.user) {\n const { token, realm, ...user } = request.user; // do not send token and realm to the client\n this.alepha.store.set(\"alepha.server.request.user\", user); // for hydration, browser, etc...\n state.user = user;\n }\n },\n });\n}\n","import { ReactBrowserProvider, Redirection } from \"@alepha/react\";\nimport { $hook, $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport type { UserAccountToken } from \"alepha/security\";\nimport { HttpClient } from \"alepha/server\";\nimport { alephaServerAuthRoutes, tokenResponseSchema, type Tokens, userinfoResponseSchema } from \"alepha/server/auth\";\nimport { LinkProvider } from \"alepha/server/links\";\n\n/**\n * Browser, SSR friendly, service to handle authentication.\n */\nexport class ReactAuth {\n protected readonly log = $logger();\n protected readonly alepha = $inject(Alepha);\n protected readonly httpClient = $inject(HttpClient);\n protected readonly linkProvider = $inject(LinkProvider);\n\n protected readonly onBeginTransition = $hook({\n on: \"react:transition:begin\",\n handler: async (event) => {\n if (this.alepha.isBrowser()) {\n Object.defineProperty(event.state, \"user\", {\n get: () => this.user,\n });\n }\n },\n });\n\n protected readonly onFetchRequest = $hook({\n on: \"client:onRequest\",\n handler: async ({ request }) => {\n if (this.alepha.isBrowser() && this.user) {\n // ensure cookies are sent with requests and refresh-able\n request.credentials ??= \"include\";\n }\n },\n });\n\n /**\n * Get the current authenticated user.\n *\n * Alias for `alepha.state.get(\"user\")`\n */\n public get user(): UserAccountToken | undefined {\n return this.alepha.store.get(\"alepha.server.request.user\");\n }\n\n public async ping() {\n const { data } = await this.httpClient.fetch(alephaServerAuthRoutes.userinfo, {\n schema: { response: userinfoResponseSchema },\n });\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data.user;\n }\n\n public can(action: string): boolean {\n if (!this.user) {\n return false;\n }\n\n return this.linkProvider.can(action);\n }\n\n public async login(\n provider: string,\n options: {\n hostname?: string;\n username?: string;\n password?: string;\n redirect?: string;\n realm?: string;\n [extra: string]: any;\n },\n ): Promise<Tokens> {\n const realmParam = options.realm ? `&realm=${encodeURIComponent(options.realm)}` : \"\";\n\n if (options.username || options.password) {\n const { data } = await this.httpClient.fetch(\n `${options.hostname || \"\"}${alephaServerAuthRoutes.token}?provider=${provider}${realmParam}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n username: options.username,\n password: options.password,\n }),\n schema: { response: tokenResponseSchema },\n },\n );\n\n this.alepha.store.set(\"alepha.server.request.apiLinks\", data.api);\n this.alepha.store.set(\"alepha.server.request.user\", data.user);\n\n return data;\n }\n\n if (this.alepha.isBrowser()) {\n const browser = this.alepha.inject(ReactBrowserProvider);\n const redirect =\n options.redirect ||\n (browser.transitioning\n ? window.location.origin + browser.transitioning.to\n : window.location.href);\n\n const href = `${window.location.origin}${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${encodeURIComponent(redirect)}`;\n\n if (browser.transitioning) {\n throw new Redirection(href);\n } else {\n window.location.href = href;\n return {} as Tokens;\n }\n }\n\n throw new Redirection(\n `${alephaServerAuthRoutes.login}?provider=${provider}${realmParam}&redirect_uri=${options.redirect || \"/\"}`,\n );\n }\n\n public logout() {\n window.location.href = `${alephaServerAuthRoutes.logout}?post_logout_redirect_uri=${encodeURIComponent(window.location.origin)}`;\n }\n}\n","import { useAlepha, useStore } from \"@alepha/react\";\nimport { type HttpVirtualClient, LinkProvider } from \"alepha/server/links\";\nimport { ReactAuth } from \"../services/ReactAuth.ts\";\n\nexport const useAuth = <T extends object = any>() => {\n const alepha = useAlepha();\n const [user] = useStore(\"alepha.server.request.user\");\n\n return {\n user,\n logout: () => {\n alepha.inject(ReactAuth).logout();\n },\n login: async (\n provider: keyof T,\n options: {\n username?: string;\n password?: string;\n redirect?: string;\n realm?: string;\n [extra: string]: any;\n } = {},\n ) => {\n await alepha.inject(ReactAuth).login(provider as string, options);\n },\n can: <Api extends object = any>(\n name: keyof HttpVirtualClient<Api>,\n ): boolean => {\n return alepha.inject(LinkProvider).can(name as string);\n },\n };\n};\n","import { AlephaReact } from \"@alepha/react\";\nimport { $module } from \"alepha\";\nimport type { UserAccount } from \"alepha/security\";\nimport { ReactAuthProvider } from \"./providers/ReactAuthProvider.ts\";\nimport { ReactAuth } from \"./services/ReactAuth.ts\";\nimport { $auth, AlephaServerAuth } from \"alepha/server/auth\";\nimport { AlephaServerLinks } from \"alepha/server/links\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./index.shared.ts\";\nexport * from \"./providers/ReactAuthProvider.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\ndeclare module \"@alepha/react\" {\n interface ReactRouterState {\n user?: UserAccount;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * The ReactAuthModule provides authentication services for React applications.\n *\n * @see {@link ReactAuthProvider}\n * @module alepha.react.auth\n */\nexport const AlephaReactAuth = $module({\n name: \"alepha.react.auth\",\n primitives: [$auth],\n services: [AlephaReact, AlephaServerLinks, AlephaServerAuth, ReactAuthProvider, ReactAuth],\n});\n"],"mappings":";;;;;;;;AAEA,IAAa,oBAAb,MAA+B;CAC7B,AAAmB,SAAS,QAAQ,OAAO;CAE3C,AAAgB,WAAW,MAAM;EAC/B,IAAI;EACJ,SAAS,OAAO,EAAE,SAAS,YAAY;AACrC,OAAI,SAAS,MAAM;IACjB,MAAM,EAAE,OAAO,OAAO,GAAG,SAAS,QAAQ;AAC1C,SAAK,OAAO,MAAM,IAAI,8BAA8B,KAAK;AACzD,UAAM,OAAO;;;EAGlB,CAAC;;;;;;;;ACHJ,IAAa,YAAb,MAAuB;CACrB,AAAmB,MAAM,SAAS;CAClC,AAAmB,SAAS,QAAQ,OAAO;CAC3C,AAAmB,aAAa,QAAQ,WAAW;CACnD,AAAmB,eAAe,QAAQ,aAAa;CAEvD,AAAmB,oBAAoB,MAAM;EAC3C,IAAI;EACJ,SAAS,OAAO,UAAU;AACxB,OAAI,KAAK,OAAO,WAAW,CACzB,QAAO,eAAe,MAAM,OAAO,QAAQ,EACzC,WAAW,KAAK,MACjB,CAAC;;EAGP,CAAC;CAEF,AAAmB,iBAAiB,MAAM;EACxC,IAAI;EACJ,SAAS,OAAO,EAAE,cAAc;AAC9B,OAAI,KAAK,OAAO,WAAW,IAAI,KAAK,KAElC,SAAQ,gBAAgB;;EAG7B,CAAC;;;;;;CAOF,IAAW,OAAqC;AAC9C,SAAO,KAAK,OAAO,MAAM,IAAI,6BAA6B;;CAG5D,MAAa,OAAO;EAClB,MAAM,EAAE,SAAS,MAAM,KAAK,WAAW,MAAM,uBA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