hightjs 0.3.5 → 0.5.0

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 (123) hide show
  1. package/README.md +48 -116
  2. package/dist/bin/hightjs.js +51 -23
  3. package/dist/builder.js +198 -8
  4. package/dist/client/DefaultNotFound.d.ts +1 -1
  5. package/dist/client/DefaultNotFound.js +72 -46
  6. package/dist/client/client.d.ts +3 -0
  7. package/dist/{client.js → client/client.js} +4 -4
  8. package/dist/client/entry.client.js +77 -9
  9. package/dist/global/global.d.ts +117 -0
  10. package/dist/{auth/types.js → global/global.js} +0 -1
  11. package/dist/helpers.js +80 -2
  12. package/dist/hotReload.js +84 -4
  13. package/dist/index.js +72 -61
  14. package/dist/loaders.d.ts +1 -0
  15. package/dist/loaders.js +46 -0
  16. package/dist/renderer.js +158 -4
  17. package/dist/types.d.ts +44 -0
  18. package/package.json +37 -30
  19. package/.idea/HightJS.iml +0 -9
  20. package/.idea/copilot.data.migration.agent.xml +0 -6
  21. package/.idea/copilot.data.migration.ask.xml +0 -6
  22. package/.idea/copilot.data.migration.ask2agent.xml +0 -6
  23. package/.idea/copilot.data.migration.edit.xml +0 -6
  24. package/.idea/copilotDiffState.xml +0 -67
  25. package/.idea/inspectionProfiles/Project_Default.xml +0 -13
  26. package/.idea/libraries/test_package.xml +0 -9
  27. package/.idea/libraries/ts_commonjs_default_export.xml +0 -9
  28. package/.idea/misc.xml +0 -7
  29. package/.idea/modules.xml +0 -8
  30. package/.idea/vcs.xml +0 -6
  31. package/dist/auth/client.d.ts +0 -24
  32. package/dist/auth/client.js +0 -146
  33. package/dist/auth/components.d.ts +0 -29
  34. package/dist/auth/components.js +0 -100
  35. package/dist/auth/core.d.ts +0 -55
  36. package/dist/auth/core.js +0 -189
  37. package/dist/auth/index.d.ts +0 -7
  38. package/dist/auth/index.js +0 -45
  39. package/dist/auth/jwt.d.ts +0 -41
  40. package/dist/auth/jwt.js +0 -185
  41. package/dist/auth/providers/credentials.d.ts +0 -60
  42. package/dist/auth/providers/credentials.js +0 -97
  43. package/dist/auth/providers/discord.d.ts +0 -63
  44. package/dist/auth/providers/discord.js +0 -190
  45. package/dist/auth/providers/google.d.ts +0 -63
  46. package/dist/auth/providers/google.js +0 -186
  47. package/dist/auth/providers/index.d.ts +0 -2
  48. package/dist/auth/providers/index.js +0 -35
  49. package/dist/auth/providers.d.ts +0 -3
  50. package/dist/auth/providers.js +0 -26
  51. package/dist/auth/react/index.d.ts +0 -6
  52. package/dist/auth/react/index.js +0 -48
  53. package/dist/auth/react.d.ts +0 -22
  54. package/dist/auth/react.js +0 -199
  55. package/dist/auth/routes.d.ts +0 -16
  56. package/dist/auth/routes.js +0 -152
  57. package/dist/auth/types.d.ts +0 -76
  58. package/dist/client.d.ts +0 -3
  59. package/docs/README.md +0 -58
  60. package/docs/arquivos-especiais.md +0 -10
  61. package/docs/autenticacao.md +0 -212
  62. package/docs/checklist.md +0 -9
  63. package/docs/cli.md +0 -72
  64. package/docs/config.md +0 -216
  65. package/docs/estrutura.md +0 -20
  66. package/docs/faq.md +0 -10
  67. package/docs/hot-reload.md +0 -5
  68. package/docs/integracoes.md +0 -240
  69. package/docs/middlewares.md +0 -73
  70. package/docs/rotas-backend.md +0 -45
  71. package/docs/rotas-frontend.md +0 -66
  72. package/docs/seguranca.md +0 -8
  73. package/docs/websocket.md +0 -45
  74. package/example/certs/cert.pem +0 -20
  75. package/example/certs/key.pem +0 -27
  76. package/example/hightjs.config.ts +0 -87
  77. package/example/package-lock.json +0 -1174
  78. package/example/package.json +0 -26
  79. package/example/postcss.config.js +0 -8
  80. package/example/src/auth.ts +0 -42
  81. package/example/src/web/backend/routes/auth.ts +0 -3
  82. package/example/src/web/backend/routes/version.ts +0 -13
  83. package/example/src/web/globals.css +0 -5
  84. package/example/src/web/layout.tsx +0 -100
  85. package/example/src/web/routes/index.tsx +0 -153
  86. package/example/src/web/routes/login.tsx +0 -175
  87. package/example/tailwind.config.js +0 -12
  88. package/example/tsconfig.json +0 -15
  89. package/src/adapters/express.ts +0 -87
  90. package/src/adapters/factory.ts +0 -112
  91. package/src/adapters/fastify.ts +0 -104
  92. package/src/adapters/native.ts +0 -234
  93. package/src/api/console.ts +0 -305
  94. package/src/api/http.ts +0 -535
  95. package/src/auth/client.ts +0 -171
  96. package/src/auth/components.tsx +0 -125
  97. package/src/auth/core.ts +0 -215
  98. package/src/auth/index.ts +0 -25
  99. package/src/auth/jwt.ts +0 -210
  100. package/src/auth/providers/credentials.ts +0 -139
  101. package/src/auth/providers/discord.ts +0 -239
  102. package/src/auth/providers/google.ts +0 -234
  103. package/src/auth/providers/index.ts +0 -20
  104. package/src/auth/providers.ts +0 -20
  105. package/src/auth/react/index.ts +0 -25
  106. package/src/auth/react.tsx +0 -234
  107. package/src/auth/routes.ts +0 -183
  108. package/src/auth/types.ts +0 -108
  109. package/src/bin/hightjs.js +0 -222
  110. package/src/builder.js +0 -411
  111. package/src/client/DefaultNotFound.tsx +0 -84
  112. package/src/client/clientRouter.ts +0 -153
  113. package/src/client/entry.client.tsx +0 -444
  114. package/src/client.ts +0 -24
  115. package/src/components/Link.tsx +0 -38
  116. package/src/helpers.ts +0 -542
  117. package/src/hotReload.ts +0 -489
  118. package/src/index.ts +0 -546
  119. package/src/renderer.tsx +0 -263
  120. package/src/router.ts +0 -730
  121. package/src/types/framework.ts +0 -58
  122. package/src/types.ts +0 -207
  123. package/tsconfig.json +0 -17
@@ -1,190 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DiscordProvider = void 0;
4
- const http_1 = require("../../api/http");
5
- /**
6
- * Provider para autenticação com Discord OAuth2
7
- *
8
- * Este provider permite autenticação usando Discord OAuth2.
9
- * Automaticamente gerencia o fluxo OAuth completo e rotas necessárias.
10
- *
11
- * Exemplo de uso:
12
- * ```typescript
13
- * new DiscordProvider({
14
- * clientId: process.env.DISCORD_CLIENT_ID!,
15
- * clientSecret: process.env.DISCORD_CLIENT_SECRET!,
16
- * callbackUrl: "http://localhost:3000/api/auth/callback/discord"
17
- * })
18
- * ```
19
- *
20
- * Fluxo de autenticação:
21
- * 1. GET /api/auth/signin/discord - Gera URL e redireciona para Discord
22
- * 2. Discord redireciona para /api/auth/callback/discord com código
23
- * 3. Provider troca código por token e busca dados do usuário
24
- * 4. Retorna objeto User com dados do Discord
25
- */
26
- class DiscordProvider {
27
- constructor(config) {
28
- this.type = 'discord';
29
- this.defaultScope = ['identify', 'email'];
30
- /**
31
- * Rotas adicionais específicas do Discord OAuth
32
- */
33
- this.additionalRoutes = [
34
- // Rota de callback do Discord
35
- {
36
- method: 'GET',
37
- path: '/api/auth/callback/discord',
38
- handler: async (req, params) => {
39
- const url = new URL(req.url || '', 'http://localhost');
40
- const code = url.searchParams.get('code');
41
- if (!code) {
42
- return http_1.HightJSResponse.json({ error: 'Authorization code not provided' }, { status: 400 });
43
- }
44
- try {
45
- // CORREÇÃO: O fluxo correto é delegar o 'code' para o endpoint de signin
46
- // principal, que processará o código uma única vez. A implementação anterior
47
- // usava o código duas vezes, causando o erro 'invalid_grant'.
48
- const authResponse = await fetch(`${req.headers.origin || 'http://localhost:3000'}/api/auth/signin`, {
49
- method: 'POST',
50
- headers: {
51
- 'Content-Type': 'application/json',
52
- },
53
- body: JSON.stringify({
54
- provider: this.id,
55
- code,
56
- })
57
- });
58
- if (authResponse.ok) {
59
- // Propaga o cookie de sessão retornado pelo endpoint de signin
60
- // e redireciona o usuário para a página de sucesso.
61
- const setCookieHeader = authResponse.headers.get('set-cookie');
62
- if (this.config.successUrl) {
63
- return http_1.HightJSResponse
64
- .redirect(this.config.successUrl)
65
- .header('Set-Cookie', setCookieHeader || '');
66
- }
67
- return http_1.HightJSResponse.json({ success: true })
68
- .header('Set-Cookie', setCookieHeader || '');
69
- }
70
- else {
71
- const errorText = await authResponse.text();
72
- console.error(`[${this.id} Provider] Session creation failed during callback. Status: ${authResponse.status}, Body: ${errorText}`);
73
- return http_1.HightJSResponse.json({ error: 'Session creation failed' }, { status: 500 });
74
- }
75
- }
76
- catch (error) {
77
- console.error(`[${this.id} Provider] Callback handler fetch error:`, error);
78
- return http_1.HightJSResponse.json({ error: 'Internal server error' }, { status: 500 });
79
- }
80
- }
81
- }
82
- ];
83
- this.config = config;
84
- this.id = config.id || 'discord';
85
- this.name = config.name || 'Discord';
86
- }
87
- /**
88
- * Método para gerar URL OAuth (usado pelo handleSignIn)
89
- */
90
- handleOauth(credentials = {}) {
91
- return this.getAuthorizationUrl();
92
- }
93
- /**
94
- * Método principal - agora redireciona para OAuth ou processa callback
95
- */
96
- async handleSignIn(credentials) {
97
- // Se tem código, é callback - processa autenticação
98
- if (credentials.code) {
99
- return await this.processOAuthCallback(credentials);
100
- }
101
- // Se não tem código, é início do OAuth - retorna URL
102
- return this.handleOauth(credentials);
103
- }
104
- /**
105
- * Processa o callback OAuth (código → usuário)
106
- */
107
- async processOAuthCallback(credentials) {
108
- try {
109
- const { code } = credentials;
110
- if (!code) {
111
- throw new Error('Authorization code not provided');
112
- }
113
- // Troca o código por access token
114
- const tokenResponse = await fetch('https://discord.com/api/oauth2/token', {
115
- method: 'POST',
116
- headers: {
117
- 'Content-Type': 'application/x-www-form-urlencoded',
118
- },
119
- body: new URLSearchParams({
120
- client_id: this.config.clientId,
121
- client_secret: this.config.clientSecret,
122
- grant_type: 'authorization_code',
123
- code,
124
- redirect_uri: this.config.callbackUrl || '',
125
- }),
126
- });
127
- if (!tokenResponse.ok) {
128
- const error = await tokenResponse.text();
129
- // O erro original "Invalid \"code\" in request." acontece aqui.
130
- throw new Error(`Failed to exchange code for token: ${error}`);
131
- }
132
- const tokens = await tokenResponse.json();
133
- // Busca dados do usuário
134
- const userResponse = await fetch('https://discord.com/api/users/@me', {
135
- headers: {
136
- 'Authorization': `Bearer ${tokens.access_token}`,
137
- },
138
- });
139
- if (!userResponse.ok) {
140
- throw new Error('Failed to fetch user data');
141
- }
142
- const discordUser = await userResponse.json();
143
- // Retorna objeto User padronizado
144
- return {
145
- id: discordUser.id,
146
- name: discordUser.global_name || discordUser.username,
147
- email: discordUser.email,
148
- image: discordUser.avatar
149
- ? `https://cdn.discordapp.com/avatars/${discordUser.id}/${discordUser.avatar}.png`
150
- : null,
151
- username: discordUser.username,
152
- discriminator: discordUser.discriminator,
153
- provider: this.id,
154
- providerId: discordUser.id,
155
- accessToken: tokens.access_token,
156
- refreshToken: tokens.refresh_token
157
- };
158
- }
159
- catch (error) {
160
- console.error(`[${this.id} Provider] Error during OAuth callback:`, error);
161
- return null;
162
- }
163
- }
164
- /**
165
- * Gera URL de autorização do Discord
166
- */
167
- getAuthorizationUrl() {
168
- const params = new URLSearchParams({
169
- client_id: this.config.clientId,
170
- redirect_uri: this.config.callbackUrl || '',
171
- response_type: 'code',
172
- scope: (this.config.scope || this.defaultScope).join(' ')
173
- });
174
- return `https://discord.com/api/oauth2/authorize?${params.toString()}`;
175
- }
176
- /**
177
- * Retorna configuração pública do provider
178
- */
179
- getConfig() {
180
- return {
181
- id: this.id,
182
- name: this.name,
183
- type: this.type,
184
- clientId: this.config.clientId, // Público
185
- scope: this.config.scope || this.defaultScope,
186
- callbackUrl: this.config.callbackUrl
187
- };
188
- }
189
- }
190
- exports.DiscordProvider = DiscordProvider;
@@ -1,63 +0,0 @@
1
- import type { AuthProviderClass, AuthRoute, User } from '../types';
2
- export interface GoogleConfig {
3
- id?: string;
4
- name?: string;
5
- clientId: string;
6
- clientSecret: string;
7
- callbackUrl?: string;
8
- successUrl?: string;
9
- scope?: string[];
10
- }
11
- /**
12
- * Provider para autenticação com Google OAuth2
13
- *
14
- * Este provider permite autenticação usando Google OAuth2.
15
- * Automaticamente gerencia o fluxo OAuth completo e rotas necessárias.
16
- *
17
- * Exemplo de uso:
18
- * ```typescript
19
- * new GoogleProvider({
20
- * clientId: process.env.GOOGLE_CLIENT_ID!,
21
- * clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
22
- * callbackUrl: "http://localhost:3000/api/auth/callback/google"
23
- * })
24
- * ```
25
- *
26
- * Fluxo de autenticação:
27
- * 1. GET /api/auth/signin/google - Gera URL e redireciona para Google
28
- * 2. Google redireciona para /api/auth/callback/google com código
29
- * 3. Provider troca código por token e busca dados do usuário
30
- * 4. Retorna objeto User com dados do Google
31
- */
32
- export declare class GoogleProvider implements AuthProviderClass {
33
- readonly id: string;
34
- readonly name: string;
35
- readonly type: string;
36
- private config;
37
- private readonly defaultScope;
38
- constructor(config: GoogleConfig);
39
- /**
40
- * Método para gerar URL OAuth (usado pelo handleSignIn)
41
- */
42
- handleOauth(credentials?: Record<string, string>): string;
43
- /**
44
- * Método principal - redireciona para OAuth ou processa o callback
45
- */
46
- handleSignIn(credentials: Record<string, string>): Promise<User | string | null>;
47
- /**
48
- * Processa o callback do OAuth (troca o código pelo usuário)
49
- */
50
- private processOAuthCallback;
51
- /**
52
- * Rotas adicionais específicas do Google OAuth
53
- */
54
- additionalRoutes: AuthRoute[];
55
- /**
56
- * Gera a URL de autorização do Google
57
- */
58
- getAuthorizationUrl(): string;
59
- /**
60
- * Retorna a configuração pública do provider
61
- */
62
- getConfig(): any;
63
- }
@@ -1,186 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleProvider = void 0;
4
- const http_1 = require("../../api/http");
5
- /**
6
- * Provider para autenticação com Google OAuth2
7
- *
8
- * Este provider permite autenticação usando Google OAuth2.
9
- * Automaticamente gerencia o fluxo OAuth completo e rotas necessárias.
10
- *
11
- * Exemplo de uso:
12
- * ```typescript
13
- * new GoogleProvider({
14
- * clientId: process.env.GOOGLE_CLIENT_ID!,
15
- * clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
16
- * callbackUrl: "http://localhost:3000/api/auth/callback/google"
17
- * })
18
- * ```
19
- *
20
- * Fluxo de autenticação:
21
- * 1. GET /api/auth/signin/google - Gera URL e redireciona para Google
22
- * 2. Google redireciona para /api/auth/callback/google com código
23
- * 3. Provider troca código por token e busca dados do usuário
24
- * 4. Retorna objeto User com dados do Google
25
- */
26
- class GoogleProvider {
27
- constructor(config) {
28
- this.type = 'google';
29
- this.defaultScope = [
30
- 'openid',
31
- 'https://www.googleapis.com/auth/userinfo.email',
32
- 'https://www.googleapis.com/auth/userinfo.profile'
33
- ];
34
- /**
35
- * Rotas adicionais específicas do Google OAuth
36
- */
37
- this.additionalRoutes = [
38
- // Rota de callback do Google
39
- {
40
- method: 'GET',
41
- path: '/api/auth/callback/google',
42
- handler: async (req, params) => {
43
- const url = new URL(req.url || '', 'http://localhost');
44
- const code = url.searchParams.get('code');
45
- if (!code) {
46
- return http_1.HightJSResponse.json({ error: 'Authorization code not provided' }, { status: 400 });
47
- }
48
- try {
49
- // Delega o 'code' para o endpoint de signin principal
50
- const authResponse = await fetch(`${req.headers.origin || 'http://localhost:3000'}/api/auth/signin`, {
51
- method: 'POST',
52
- headers: {
53
- 'Content-Type': 'application/json',
54
- },
55
- body: JSON.stringify({
56
- provider: this.id,
57
- code,
58
- })
59
- });
60
- if (authResponse.ok) {
61
- // Propaga o cookie de sessão e redireciona para a URL de sucesso
62
- const setCookieHeader = authResponse.headers.get('set-cookie');
63
- if (this.config.successUrl) {
64
- return http_1.HightJSResponse
65
- .redirect(this.config.successUrl)
66
- .header('Set-Cookie', setCookieHeader || '');
67
- }
68
- return http_1.HightJSResponse.json({ success: true })
69
- .header('Set-Cookie', setCookieHeader || '');
70
- }
71
- else {
72
- const errorText = await authResponse.text();
73
- console.error(`[${this.id} Provider] Session creation failed during callback. Status: ${authResponse.status}, Body: ${errorText}`);
74
- return http_1.HightJSResponse.json({ error: 'Session creation failed' }, { status: 500 });
75
- }
76
- }
77
- catch (error) {
78
- console.error(`[${this.id} Provider] Callback handler fetch error:`, error);
79
- return http_1.HightJSResponse.json({ error: 'Internal server error' }, { status: 500 });
80
- }
81
- }
82
- }
83
- ];
84
- this.config = config;
85
- this.id = config.id || 'google';
86
- this.name = config.name || 'Google';
87
- }
88
- /**
89
- * Método para gerar URL OAuth (usado pelo handleSignIn)
90
- */
91
- handleOauth(credentials = {}) {
92
- return this.getAuthorizationUrl();
93
- }
94
- /**
95
- * Método principal - redireciona para OAuth ou processa o callback
96
- */
97
- async handleSignIn(credentials) {
98
- // Se tem código, é o callback - processa a autenticação
99
- if (credentials.code) {
100
- return await this.processOAuthCallback(credentials);
101
- }
102
- // Se não tem código, é o início do OAuth - retorna a URL
103
- return this.handleOauth(credentials);
104
- }
105
- /**
106
- * Processa o callback do OAuth (troca o código pelo usuário)
107
- */
108
- async processOAuthCallback(credentials) {
109
- try {
110
- const { code } = credentials;
111
- if (!code) {
112
- throw new Error('Authorization code not provided');
113
- }
114
- // Troca o código por um access token
115
- const tokenResponse = await fetch('https://oauth2.googleapis.com/token', {
116
- method: 'POST',
117
- headers: {
118
- 'Content-Type': 'application/x-www-form-urlencoded',
119
- },
120
- body: new URLSearchParams({
121
- client_id: this.config.clientId,
122
- client_secret: this.config.clientSecret,
123
- grant_type: 'authorization_code',
124
- code,
125
- redirect_uri: this.config.callbackUrl || '',
126
- }),
127
- });
128
- if (!tokenResponse.ok) {
129
- const error = await tokenResponse.text();
130
- throw new Error(`Failed to exchange code for token: ${error}`);
131
- }
132
- const tokens = await tokenResponse.json();
133
- // Busca os dados do usuário com o access token
134
- const userResponse = await fetch('https://www.googleapis.com/oauth2/v2/userinfo', {
135
- headers: {
136
- 'Authorization': `Bearer ${tokens.access_token}`,
137
- },
138
- });
139
- if (!userResponse.ok) {
140
- throw new Error('Failed to fetch user data');
141
- }
142
- const googleUser = await userResponse.json();
143
- // Retorna o objeto User padronizado
144
- return {
145
- id: googleUser.id,
146
- name: googleUser.name,
147
- email: googleUser.email,
148
- image: googleUser.picture || null,
149
- provider: this.id,
150
- providerId: googleUser.id,
151
- accessToken: tokens.access_token,
152
- refreshToken: tokens.refresh_token
153
- };
154
- }
155
- catch (error) {
156
- console.error(`[${this.id} Provider] Error during OAuth callback:`, error);
157
- return null;
158
- }
159
- }
160
- /**
161
- * Gera a URL de autorização do Google
162
- */
163
- getAuthorizationUrl() {
164
- const params = new URLSearchParams({
165
- client_id: this.config.clientId,
166
- redirect_uri: this.config.callbackUrl || '',
167
- response_type: 'code',
168
- scope: (this.config.scope || this.defaultScope).join(' ')
169
- });
170
- return `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;
171
- }
172
- /**
173
- * Retorna a configuração pública do provider
174
- */
175
- getConfig() {
176
- return {
177
- id: this.id,
178
- name: this.name,
179
- type: this.type,
180
- clientId: this.config.clientId, // Público
181
- scope: this.config.scope || this.defaultScope,
182
- callbackUrl: this.config.callbackUrl
183
- };
184
- }
185
- }
186
- exports.GoogleProvider = GoogleProvider;
@@ -1,2 +0,0 @@
1
- export * from './credentials';
2
- export * from './discord';
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /*
18
- * This file is part of the HightJS Project.
19
- * Copyright (c) 2025 itsmuzin
20
- *
21
- * Licensed under the Apache License, Version 2.0 (the "License");
22
- * you may not use this file except in compliance with the License.
23
- * You may obtain a copy of the License at
24
- *
25
- * http://www.apache.org/licenses/LICENSE-2.0
26
- *
27
- * Unless required by applicable law or agreed to in writing, software
28
- * distributed under the License is distributed on an "AS IS" BASIS,
29
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
- * See the License for the specific language governing permissions and
31
- * limitations under the License.
32
- */
33
- // Exportações dos providers
34
- __exportStar(require("./credentials"), exports);
35
- __exportStar(require("./discord"), exports);
@@ -1,3 +0,0 @@
1
- export { CredentialsProvider } from './providers/credentials';
2
- export { DiscordProvider } from './providers/discord';
3
- export { GoogleProvider } from './providers/google';
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleProvider = exports.DiscordProvider = exports.CredentialsProvider = void 0;
4
- /*
5
- * This file is part of the HightJS Project.
6
- * Copyright (c) 2025 itsmuzin
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- */
20
- // Exportações dos providers
21
- var credentials_1 = require("./providers/credentials");
22
- Object.defineProperty(exports, "CredentialsProvider", { enumerable: true, get: function () { return credentials_1.CredentialsProvider; } });
23
- var discord_1 = require("./providers/discord");
24
- Object.defineProperty(exports, "DiscordProvider", { enumerable: true, get: function () { return discord_1.DiscordProvider; } });
25
- var google_1 = require("./providers/google");
26
- Object.defineProperty(exports, "GoogleProvider", { enumerable: true, get: function () { return google_1.GoogleProvider; } });
@@ -1,6 +0,0 @@
1
- export * from '../react';
2
- export * from '../client';
3
- export * from '../components';
4
- export { getSession } from '../client';
5
- export { useSession, useAuth, SessionProvider } from '../react';
6
- export { ProtectedRoute, AuthGuard, GuestOnly } from '../components';
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.GuestOnly = exports.AuthGuard = exports.ProtectedRoute = exports.SessionProvider = exports.useAuth = exports.useSession = exports.getSession = void 0;
18
- /*
19
- * This file is part of the HightJS Project.
20
- * Copyright (c) 2025 itsmuzin
21
- *
22
- * Licensed under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License.
24
- * You may obtain a copy of the License at
25
- *
26
- * http://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software
29
- * distributed under the License is distributed on an "AS IS" BASIS,
30
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
- * See the License for the specific language governing permissions and
32
- * limitations under the License.
33
- */
34
- // Exportações do frontend
35
- __exportStar(require("../react"), exports);
36
- __exportStar(require("../client"), exports);
37
- __exportStar(require("../components"), exports);
38
- // Re-exports das funções mais usadas para conveniência
39
- var client_1 = require("../client");
40
- Object.defineProperty(exports, "getSession", { enumerable: true, get: function () { return client_1.getSession; } });
41
- var react_1 = require("../react");
42
- Object.defineProperty(exports, "useSession", { enumerable: true, get: function () { return react_1.useSession; } });
43
- Object.defineProperty(exports, "useAuth", { enumerable: true, get: function () { return react_1.useAuth; } });
44
- Object.defineProperty(exports, "SessionProvider", { enumerable: true, get: function () { return react_1.SessionProvider; } });
45
- var components_1 = require("../components");
46
- Object.defineProperty(exports, "ProtectedRoute", { enumerable: true, get: function () { return components_1.ProtectedRoute; } });
47
- Object.defineProperty(exports, "AuthGuard", { enumerable: true, get: function () { return components_1.AuthGuard; } });
48
- Object.defineProperty(exports, "GuestOnly", { enumerable: true, get: function () { return components_1.GuestOnly; } });
@@ -1,22 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { SessionContextType, User } from './types';
3
- interface SessionProviderProps {
4
- children: ReactNode;
5
- basePath?: string;
6
- refetchInterval?: number;
7
- refetchOnWindowFocus?: boolean;
8
- }
9
- export declare function SessionProvider({ children, basePath, refetchInterval, refetchOnWindowFocus }: SessionProviderProps): import("react/jsx-runtime").JSX.Element;
10
- /**
11
- * Hook para acessar a sessão atual
12
- */
13
- export declare function useSession(): SessionContextType;
14
- /**
15
- * Hook para verificar se o usuário está autenticado
16
- */
17
- export declare function useAuth(): {
18
- user: User | null;
19
- isAuthenticated: boolean;
20
- isLoading: boolean;
21
- };
22
- export {};