@robosystems/core 0.3.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.
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/actions/entity-actions.d.ts +8 -0
- package/actions/entity-actions.js +16 -0
- package/actions/graph-actions.d.ts +3 -0
- package/actions/graph-actions.js +13 -0
- package/auth-components/AppSwitcher.d.ts +6 -0
- package/auth-components/AppSwitcher.js +28 -0
- package/auth-components/AuthGuard.d.ts +7 -0
- package/auth-components/AuthGuard.js +31 -0
- package/auth-components/AuthProvider.d.ts +9 -0
- package/auth-components/AuthProvider.js +565 -0
- package/auth-components/SessionWarningDialog.d.ts +1 -0
- package/auth-components/SessionWarningDialog.js +51 -0
- package/auth-components/SignInForm.d.ts +20 -0
- package/auth-components/SignInForm.js +139 -0
- package/auth-components/SignUpForm.d.ts +15 -0
- package/auth-components/SignUpForm.js +167 -0
- package/auth-components/TurnstileWidget.d.ts +99 -0
- package/auth-components/TurnstileWidget.js +224 -0
- package/auth-components/index.d.ts +6 -0
- package/auth-components/index.js +6 -0
- package/auth-core/cleanup.d.ts +44 -0
- package/auth-core/cleanup.js +157 -0
- package/auth-core/client.d.ts +121 -0
- package/auth-core/client.js +767 -0
- package/auth-core/config.d.ts +19 -0
- package/auth-core/config.js +56 -0
- package/auth-core/hooks.d.ts +19 -0
- package/auth-core/hooks.js +63 -0
- package/auth-core/index.d.ts +6 -0
- package/auth-core/index.js +6 -0
- package/auth-core/sso.d.ts +42 -0
- package/auth-core/sso.js +281 -0
- package/auth-core/token-storage.d.ts +58 -0
- package/auth-core/token-storage.js +177 -0
- package/auth-core/types.d.ts +145 -0
- package/auth-core/types.js +1 -0
- package/components/EntitySelector.d.ts +44 -0
- package/components/EntitySelector.js +64 -0
- package/components/EntitySelectorCore.d.ts +45 -0
- package/components/EntitySelectorCore.js +67 -0
- package/components/GraphSelectorCore.d.ts +21 -0
- package/components/GraphSelectorCore.js +39 -0
- package/components/PageLayout.d.ts +8 -0
- package/components/PageLayout.js +5 -0
- package/components/RepositoryGuard.d.ts +68 -0
- package/components/RepositoryGuard.js +91 -0
- package/components/console/ConsoleContent.d.ts +4 -0
- package/components/console/ConsoleContent.js +612 -0
- package/components/console/ConsoleMarkdown.d.ts +11 -0
- package/components/console/ConsoleMarkdown.js +49 -0
- package/components/console/ProgressiveText.d.ts +6 -0
- package/components/console/ProgressiveText.js +21 -0
- package/components/console/graphAwareConfig.d.ts +70 -0
- package/components/console/graphAwareConfig.js +411 -0
- package/components/console/index.d.ts +6 -0
- package/components/console/index.js +4 -0
- package/components/console/types.d.ts +84 -0
- package/components/console/types.js +1 -0
- package/components/graph-filters.d.ts +75 -0
- package/components/graph-filters.js +111 -0
- package/components/index.d.ts +10 -0
- package/components/index.js +9 -0
- package/components/repositories/ActiveSubscriptions.d.ts +26 -0
- package/components/repositories/ActiveSubscriptions.js +103 -0
- package/components/repositories/BrowseRepositories.d.ts +11 -0
- package/components/repositories/BrowseRepositories.js +184 -0
- package/components/repositories/index.d.ts +2 -0
- package/components/repositories/index.js +2 -0
- package/components/search/SearchContent.d.ts +4 -0
- package/components/search/SearchContent.js +168 -0
- package/components/search/index.d.ts +2 -0
- package/components/search/index.js +1 -0
- package/components/search/types.d.ts +15 -0
- package/components/search/types.js +1 -0
- package/contexts/entity-context.d.ts +28 -0
- package/contexts/entity-context.js +89 -0
- package/contexts/graph-context.d.ts +27 -0
- package/contexts/graph-context.js +128 -0
- package/contexts/index.d.ts +5 -0
- package/contexts/index.js +5 -0
- package/contexts/org-context.d.ts +25 -0
- package/contexts/org-context.js +64 -0
- package/contexts/service-offerings-context.d.ts +45 -0
- package/contexts/service-offerings-context.js +98 -0
- package/contexts/sidebar-context.d.ts +18 -0
- package/contexts/sidebar-context.js +44 -0
- package/hooks/index.d.ts +6 -0
- package/hooks/index.js +6 -0
- package/hooks/use-api-error.d.ts +3 -0
- package/hooks/use-api-error.js +24 -0
- package/hooks/use-media-query.d.ts +1 -0
- package/hooks/use-media-query.js +21 -0
- package/hooks/use-streaming-query.d.ts +22 -0
- package/hooks/use-streaming-query.js +142 -0
- package/hooks/use-toast.d.ts +37 -0
- package/hooks/use-toast.js +117 -0
- package/hooks/use-user-limits.d.ts +12 -0
- package/hooks/use-user-limits.js +73 -0
- package/hooks/use-user.d.ts +11 -0
- package/hooks/use-user.js +39 -0
- package/index.d.ts +29 -0
- package/index.js +77 -0
- package/lib/entity-cookie.d.ts +10 -0
- package/lib/entity-cookie.js +38 -0
- package/lib/graph-cookie.d.ts +11 -0
- package/lib/graph-cookie.js +62 -0
- package/lib/graph-tiers.d.ts +41 -0
- package/lib/graph-tiers.js +107 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/sidebar-cookie.d.ts +11 -0
- package/lib/sidebar-cookie.js +42 -0
- package/library/colors.d.ts +4 -0
- package/library/colors.js +41 -0
- package/library/components/ClassificationPicker.d.ts +8 -0
- package/library/components/ClassificationPicker.js +55 -0
- package/library/components/ElementBrowser.d.ts +11 -0
- package/library/components/ElementBrowser.js +106 -0
- package/library/components/ElementDetail.d.ts +7 -0
- package/library/components/ElementDetail.js +97 -0
- package/library/components/LibraryHierarchy.d.ts +13 -0
- package/library/components/LibraryHierarchy.js +380 -0
- package/library/components/TaxonomySidebar.d.ts +6 -0
- package/library/components/TaxonomySidebar.js +45 -0
- package/library/index.d.ts +8 -0
- package/library/index.js +7 -0
- package/package.json +37 -0
- package/research/CoverageCard.d.ts +12 -0
- package/research/CoverageCard.js +15 -0
- package/research/CoverageGrid.d.ts +6 -0
- package/research/CoverageGrid.js +9 -0
- package/research/CoverageHistory.d.ts +5 -0
- package/research/CoverageHistory.js +7 -0
- package/research/ResearchArticle.d.ts +15 -0
- package/research/ResearchArticle.js +26 -0
- package/research/catalog.d.ts +14 -0
- package/research/catalog.js +42 -0
- package/research/index.d.ts +6 -0
- package/research/index.js +9 -0
- package/research/types.d.ts +38 -0
- package/research/types.js +4 -0
- package/task-monitoring/hooks.d.ts +26 -0
- package/task-monitoring/hooks.js +126 -0
- package/task-monitoring/index.d.ts +5 -0
- package/task-monitoring/index.js +7 -0
- package/task-monitoring/operationErrors.d.ts +82 -0
- package/task-monitoring/operationErrors.js +251 -0
- package/task-monitoring/operationHooks.d.ts +117 -0
- package/task-monitoring/operationHooks.js +536 -0
- package/task-monitoring/operationMonitor.d.ts +78 -0
- package/task-monitoring/operationMonitor.js +200 -0
- package/task-monitoring/operationTypes.d.ts +236 -0
- package/task-monitoring/operationTypes.js +60 -0
- package/task-monitoring/taskMonitor.d.ts +14 -0
- package/task-monitoring/taskMonitor.js +132 -0
- package/task-monitoring/types.d.ts +31 -0
- package/task-monitoring/types.js +1 -0
- package/theme/flowbite-theme.d.ts +758 -0
- package/theme/flowbite-theme.js +765 -0
- package/theme/index.d.ts +1 -0
- package/theme/index.js +1 -0
- package/types/entity.d.ts +19 -0
- package/types/index.d.ts +2 -0
- package/types/index.js +1 -0
- package/types/user.d.ts +6 -0
- package/ui-components/ConfirmModal.d.ts +41 -0
- package/ui-components/ConfirmModal.js +19 -0
- package/ui-components/EmptyState.d.ts +22 -0
- package/ui-components/EmptyState.js +10 -0
- package/ui-components/LoadingState.d.ts +27 -0
- package/ui-components/LoadingState.js +12 -0
- package/ui-components/Logo.d.ts +28 -0
- package/ui-components/Logo.js +95 -0
- package/ui-components/Spinner.d.ts +37 -0
- package/ui-components/Spinner.js +48 -0
- package/ui-components/StatCard.d.ts +21 -0
- package/ui-components/StatCard.js +10 -0
- package/ui-components/api-keys/ApiKeyDisplay.d.ts +13 -0
- package/ui-components/api-keys/ApiKeyDisplay.js +7 -0
- package/ui-components/api-keys/ApiKeyTable.d.ts +9 -0
- package/ui-components/api-keys/ApiKeyTable.js +17 -0
- package/ui-components/api-keys/ApiKeysCard.d.ts +6 -0
- package/ui-components/api-keys/ApiKeysCard.js +97 -0
- package/ui-components/api-keys/CreateApiKeyModal.d.ts +11 -0
- package/ui-components/api-keys/CreateApiKeyModal.js +47 -0
- package/ui-components/api-keys/SecureApiKeyField.d.ts +13 -0
- package/ui-components/api-keys/SecureApiKeyField.js +64 -0
- package/ui-components/api-keys/index.d.ts +5 -0
- package/ui-components/api-keys/index.js +5 -0
- package/ui-components/chat/ChatHeader.d.ts +12 -0
- package/ui-components/chat/ChatHeader.js +5 -0
- package/ui-components/chat/ChatInputArea.d.ts +16 -0
- package/ui-components/chat/ChatInputArea.js +9 -0
- package/ui-components/chat/ChatMessage.d.ts +7 -0
- package/ui-components/chat/ChatMessage.js +24 -0
- package/ui-components/chat/DeepResearchToggle.d.ts +8 -0
- package/ui-components/chat/DeepResearchToggle.js +13 -0
- package/ui-components/chat/index.d.ts +9 -0
- package/ui-components/chat/index.js +8 -0
- package/ui-components/chat/types.d.ts +23 -0
- package/ui-components/chat/types.js +51 -0
- package/ui-components/forms/PasswordRequirements.d.ts +10 -0
- package/ui-components/forms/PasswordRequirements.js +15 -0
- package/ui-components/forms/SettingsCard.d.ts +11 -0
- package/ui-components/forms/SettingsCard.js +5 -0
- package/ui-components/forms/SettingsFormField.d.ts +18 -0
- package/ui-components/forms/SettingsFormField.js +17 -0
- package/ui-components/forms/StatusAlert.d.ts +8 -0
- package/ui-components/forms/StatusAlert.js +7 -0
- package/ui-components/forms/index.d.ts +4 -0
- package/ui-components/forms/index.js +4 -0
- package/ui-components/index.d.ts +13 -0
- package/ui-components/index.js +18 -0
- package/ui-components/layout/CoreNavbar.d.ts +14 -0
- package/ui-components/layout/CoreNavbar.js +53 -0
- package/ui-components/layout/CoreSidebar.d.ts +28 -0
- package/ui-components/layout/CoreSidebar.js +62 -0
- package/ui-components/layout/LandingFooter.d.ts +28 -0
- package/ui-components/layout/LandingFooter.js +34 -0
- package/ui-components/layout/PageContainer.d.ts +8 -0
- package/ui-components/layout/PageContainer.js +17 -0
- package/ui-components/layout/PageHeader.d.ts +23 -0
- package/ui-components/layout/PageHeader.js +12 -0
- package/ui-components/layout/SettingsContainer.d.ts +10 -0
- package/ui-components/layout/SettingsContainer.js +9 -0
- package/ui-components/layout/ThemeToggle.d.ts +4 -0
- package/ui-components/layout/ThemeToggle.js +6 -0
- package/ui-components/layout/index.d.ts +7 -0
- package/ui-components/layout/index.js +7 -0
- package/ui-components/settings/GeneralInformationCard.d.ts +12 -0
- package/ui-components/settings/GeneralInformationCard.js +72 -0
- package/ui-components/settings/PasswordInformationCard.d.ts +10 -0
- package/ui-components/settings/PasswordInformationCard.js +167 -0
- package/ui-components/settings/SettingsPageHeader.d.ts +7 -0
- package/ui-components/settings/SettingsPageHeader.js +6 -0
- package/ui-components/settings/index.d.ts +3 -0
- package/ui-components/settings/index.js +3 -0
- package/ui-components/support/SupportModal.d.ts +15 -0
- package/ui-components/support/SupportModal.js +74 -0
- package/ui-components/support/index.d.ts +2 -0
- package/ui-components/support/index.js +1 -0
- package/ui-components/types/index.d.ts +39 -0
- package/ui-components/types/index.js +1 -0
- package/utils/index.d.ts +31 -0
- package/utils/index.js +38 -0
- package/utils/turnstile-config.d.ts +11 -0
- package/utils/turnstile-config.js +19 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AppSwitcher } from './AppSwitcher';
|
|
2
|
+
export { AuthGuard } from './AuthGuard';
|
|
3
|
+
export { AuthProvider, useAuth } from './AuthProvider';
|
|
4
|
+
export { SignInForm } from './SignInForm';
|
|
5
|
+
export { SignUpForm } from './SignUpForm';
|
|
6
|
+
export { TurnstileWidget, useTurnstile } from './TurnstileWidget';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logout cleanup utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive cleanup of user-specific data on logout
|
|
5
|
+
* including cookies, localStorage, and sessionStorage.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Clear all user-specific cookies on logout
|
|
9
|
+
*/
|
|
10
|
+
export declare function clearUserCookies(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Clear user-specific localStorage items
|
|
13
|
+
*/
|
|
14
|
+
export declare function clearUserLocalStorage(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Clear user-specific sessionStorage items
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearUserSessionStorage(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Comprehensive logout cleanup
|
|
21
|
+
*
|
|
22
|
+
* Clears all user-specific data from the browser including:
|
|
23
|
+
* - User-specific cookies (graph selection, preferences, etc.)
|
|
24
|
+
* - User-specific localStorage items (saved queries, etc.)
|
|
25
|
+
* - User-specific sessionStorage items (auth cache, etc.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function performLogoutCleanup(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reset UI state that should not persist between users
|
|
30
|
+
*
|
|
31
|
+
* This can be called to reset UI state that might confuse
|
|
32
|
+
* users when switching accounts (like showing graph tabs
|
|
33
|
+
* for a user who doesn't have any graphs).
|
|
34
|
+
*/
|
|
35
|
+
export declare function resetUIState(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Diagnostic function to list all cookies and storage items
|
|
38
|
+
* Useful for development and debugging
|
|
39
|
+
*/
|
|
40
|
+
export declare function listUserData(): {
|
|
41
|
+
cookies: string[];
|
|
42
|
+
localStorage: string[];
|
|
43
|
+
sessionStorage: string[];
|
|
44
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logout cleanup utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive cleanup of user-specific data on logout
|
|
5
|
+
* including cookies, localStorage, and sessionStorage.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Clear all user-specific cookies on logout
|
|
9
|
+
*/
|
|
10
|
+
export function clearUserCookies() {
|
|
11
|
+
if (typeof document === 'undefined')
|
|
12
|
+
return;
|
|
13
|
+
// List of user-specific cookies to clear
|
|
14
|
+
const userCookies = [
|
|
15
|
+
'selected-graph', // Graph selection state
|
|
16
|
+
'selected-entity', // Entity selection state
|
|
17
|
+
'credit-visibility', // UI preferences
|
|
18
|
+
// Note: auth-token is cleared by the backend
|
|
19
|
+
// Note: sidebar-collapsed is kept as it's a UI preference that can persist
|
|
20
|
+
];
|
|
21
|
+
userCookies.forEach((cookieName) => {
|
|
22
|
+
// Set cookie to expired date to delete it
|
|
23
|
+
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`;
|
|
24
|
+
// Also try without domain for localhost/development
|
|
25
|
+
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Clear user-specific localStorage items
|
|
30
|
+
*/
|
|
31
|
+
export function clearUserLocalStorage() {
|
|
32
|
+
if (typeof localStorage === 'undefined')
|
|
33
|
+
return;
|
|
34
|
+
try {
|
|
35
|
+
// Get all localStorage keys
|
|
36
|
+
const keys = Object.keys(localStorage);
|
|
37
|
+
// Patterns of user-specific localStorage items to clear
|
|
38
|
+
const userDataPatterns = [
|
|
39
|
+
/^saved_queries_/, // Saved queries per graph: saved_queries_${graphId}
|
|
40
|
+
/^query_history_/, // Query history per graph: query_history_${graphId}
|
|
41
|
+
/^graph_/, // Any graph-specific data
|
|
42
|
+
/^user_/, // Any user-specific data
|
|
43
|
+
/^auth_/, // Auth-related data (though we handle auth_user_cache separately)
|
|
44
|
+
];
|
|
45
|
+
// Clear matching items
|
|
46
|
+
keys.forEach((key) => {
|
|
47
|
+
if (userDataPatterns.some((pattern) => pattern.test(key))) {
|
|
48
|
+
try {
|
|
49
|
+
localStorage.removeItem(key);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.warn(`Failed to remove localStorage item: ${key}`, error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.warn('Failed to access localStorage for cleanup', error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Clear user-specific sessionStorage items
|
|
63
|
+
*/
|
|
64
|
+
export function clearUserSessionStorage() {
|
|
65
|
+
if (typeof sessionStorage === 'undefined')
|
|
66
|
+
return;
|
|
67
|
+
try {
|
|
68
|
+
// Get all sessionStorage keys
|
|
69
|
+
const keys = Object.keys(sessionStorage);
|
|
70
|
+
// Patterns of user-specific sessionStorage items to clear
|
|
71
|
+
const userDataPatterns = [
|
|
72
|
+
/^auth_/, // Auth cache and related data
|
|
73
|
+
/^user_/, // User-specific session data
|
|
74
|
+
/^graph_/, // Graph-specific session data
|
|
75
|
+
/^temp_/, // Temporary user data
|
|
76
|
+
];
|
|
77
|
+
// Clear matching items
|
|
78
|
+
keys.forEach((key) => {
|
|
79
|
+
if (userDataPatterns.some((pattern) => pattern.test(key))) {
|
|
80
|
+
try {
|
|
81
|
+
sessionStorage.removeItem(key);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.warn(`Failed to remove sessionStorage item: ${key}`, error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.warn('Failed to access sessionStorage for cleanup', error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Comprehensive logout cleanup
|
|
95
|
+
*
|
|
96
|
+
* Clears all user-specific data from the browser including:
|
|
97
|
+
* - User-specific cookies (graph selection, preferences, etc.)
|
|
98
|
+
* - User-specific localStorage items (saved queries, etc.)
|
|
99
|
+
* - User-specific sessionStorage items (auth cache, etc.)
|
|
100
|
+
*/
|
|
101
|
+
export function performLogoutCleanup() {
|
|
102
|
+
clearUserCookies();
|
|
103
|
+
clearUserLocalStorage();
|
|
104
|
+
clearUserSessionStorage();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Reset UI state that should not persist between users
|
|
108
|
+
*
|
|
109
|
+
* This can be called to reset UI state that might confuse
|
|
110
|
+
* users when switching accounts (like showing graph tabs
|
|
111
|
+
* for a user who doesn't have any graphs).
|
|
112
|
+
*/
|
|
113
|
+
export function resetUIState() {
|
|
114
|
+
if (typeof document === 'undefined')
|
|
115
|
+
return;
|
|
116
|
+
// Clear selected graph cookie specifically
|
|
117
|
+
document.cookie = `selected-graph=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
|
|
118
|
+
// You could also reset other UI state here, but be careful
|
|
119
|
+
// not to clear preferences that should persist (like theme, language, etc.)
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Diagnostic function to list all cookies and storage items
|
|
123
|
+
* Useful for development and debugging
|
|
124
|
+
*/
|
|
125
|
+
export function listUserData() {
|
|
126
|
+
const result = {
|
|
127
|
+
cookies: [],
|
|
128
|
+
localStorage: [],
|
|
129
|
+
sessionStorage: [],
|
|
130
|
+
};
|
|
131
|
+
// List cookies
|
|
132
|
+
if (typeof document !== 'undefined') {
|
|
133
|
+
result.cookies = document.cookie
|
|
134
|
+
.split(';')
|
|
135
|
+
.map((c) => c.trim().split('=')[0])
|
|
136
|
+
.filter(Boolean);
|
|
137
|
+
}
|
|
138
|
+
// List localStorage
|
|
139
|
+
if (typeof localStorage !== 'undefined') {
|
|
140
|
+
try {
|
|
141
|
+
result.localStorage = Object.keys(localStorage);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.warn('Failed to access localStorage', error);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// List sessionStorage
|
|
148
|
+
if (typeof sessionStorage !== 'undefined') {
|
|
149
|
+
try {
|
|
150
|
+
result.sessionStorage = Object.keys(sessionStorage);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
console.warn('Failed to access sessionStorage', error);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { APIKey, AuthResponse, AuthUser, CreateAPIKeyRequest, SSOTokenResponse } from './types';
|
|
2
|
+
export declare class TokenExpiredError extends Error {
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class RoboSystemsAuthClient {
|
|
6
|
+
private client;
|
|
7
|
+
private authCheckPromise;
|
|
8
|
+
private lastAuthCheck;
|
|
9
|
+
private lastError;
|
|
10
|
+
private refreshRetryCount;
|
|
11
|
+
private readonly MAX_REFRESH_RETRIES;
|
|
12
|
+
private readonly INITIAL_RETRY_DELAY;
|
|
13
|
+
constructor(baseUrl: string);
|
|
14
|
+
/**
|
|
15
|
+
* Configure the client with JWT authentication for all requests
|
|
16
|
+
*/
|
|
17
|
+
private configureClientWithAuth;
|
|
18
|
+
/**
|
|
19
|
+
* Push the latest auth token into the SDK extensions global config.
|
|
20
|
+
*
|
|
21
|
+
* Called from every auth success path (`login` / `register` / SSO
|
|
22
|
+
* token exchange / verify-email) so the SDK extensions singleton
|
|
23
|
+
* stays in sync with the current credential.
|
|
24
|
+
*
|
|
25
|
+
* The GraphQL read path already has refresh via `tokenProvider`
|
|
26
|
+
* (wired in `configureClientWithAuth`) and does not depend on this
|
|
27
|
+
* static field. But the SDK's React hooks (`useQuery`, `useOperation`,
|
|
28
|
+
* `useStreamingQuery`, …) still read `getSDKClientConfig().token`
|
|
29
|
+
* via `extractTokenFromSDKClient` to seed their inner `QueryClient`
|
|
30
|
+
* / `OperationClient` instances. Keeping the static field updated
|
|
31
|
+
* after every auth success keeps those hook-owned clients
|
|
32
|
+
* authenticated across login/register/SSO transitions.
|
|
33
|
+
*
|
|
34
|
+
* No-op when the SDK extensions module isn't installed.
|
|
35
|
+
*/
|
|
36
|
+
private syncClientConfigToken;
|
|
37
|
+
login(email: string, password: string): Promise<AuthResponse>;
|
|
38
|
+
register(email: string, password: string, name?: string, captchaToken?: string): Promise<AuthResponse>;
|
|
39
|
+
logout(): Promise<void>;
|
|
40
|
+
getCurrentUser(): Promise<AuthUser>;
|
|
41
|
+
private performAuthCheck;
|
|
42
|
+
refreshSession(): Promise<AuthResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Refresh session with exponential backoff retry logic
|
|
45
|
+
*/
|
|
46
|
+
private refreshSessionWithRetry;
|
|
47
|
+
createAPIKey(request: CreateAPIKeyRequest): Promise<APIKey>;
|
|
48
|
+
getAPIKeys(): Promise<APIKey[]>;
|
|
49
|
+
revokeAPIKey(keyId: string): Promise<void>;
|
|
50
|
+
generateSSOToken(): Promise<SSOTokenResponse>;
|
|
51
|
+
ssoExchange(token: string, targetApp: string): Promise<{
|
|
52
|
+
session_id: string;
|
|
53
|
+
}>;
|
|
54
|
+
ssoComplete(sessionId: string): Promise<AuthResponse>;
|
|
55
|
+
checkAuthentication(): Promise<AuthUser | null>;
|
|
56
|
+
clearAuthCache(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Send password reset email
|
|
59
|
+
*/
|
|
60
|
+
forgotPassword(email: string): Promise<{
|
|
61
|
+
success: boolean;
|
|
62
|
+
message?: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Reset password using token
|
|
66
|
+
*/
|
|
67
|
+
resetPassword(token: string, newPassword: string): Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
message?: string;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Validate password reset token
|
|
73
|
+
*/
|
|
74
|
+
validateResetToken(token: string): Promise<{
|
|
75
|
+
valid: boolean;
|
|
76
|
+
email?: string;
|
|
77
|
+
message?: string;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Verify email with token
|
|
81
|
+
*/
|
|
82
|
+
verifyEmail(token: string): Promise<{
|
|
83
|
+
success: boolean;
|
|
84
|
+
message?: string;
|
|
85
|
+
user?: AuthUser;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Resend verification email
|
|
89
|
+
*/
|
|
90
|
+
resendVerificationEmail(email: string): Promise<{
|
|
91
|
+
success: boolean;
|
|
92
|
+
message?: string;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Get password policy requirements
|
|
96
|
+
*/
|
|
97
|
+
getPasswordPolicy(): Promise<{
|
|
98
|
+
minLength: number;
|
|
99
|
+
requireUppercase: boolean;
|
|
100
|
+
requireLowercase: boolean;
|
|
101
|
+
requireNumbers: boolean;
|
|
102
|
+
requireSpecial: boolean;
|
|
103
|
+
specialCharacters: string;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Check password strength
|
|
107
|
+
*/
|
|
108
|
+
checkPasswordStrength(password: string, email?: string): Promise<{
|
|
109
|
+
score: number;
|
|
110
|
+
strength: 'very-weak' | 'weak' | 'fair' | 'good' | 'strong';
|
|
111
|
+
errors: string[];
|
|
112
|
+
suggestions: string[];
|
|
113
|
+
is_valid: boolean;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Validate and safely cast SDK response data
|
|
117
|
+
*/
|
|
118
|
+
private normalizeUser;
|
|
119
|
+
private validateSDKAuthResponse;
|
|
120
|
+
private validateSDKCurrentUserResponse;
|
|
121
|
+
}
|