bdsa-react-components 0.1.21 → 0.1.25

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 (74) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/CURSOR_INTEGRATION.md +25 -3
  3. package/INTEGRATION.md +0 -0
  4. package/README.md +0 -0
  5. package/dist/auth/DsaAuthProvider.d.ts +92 -0
  6. package/dist/auth/DsaAuthProvider.d.ts.map +1 -0
  7. package/dist/auth/DsaAuthStore.d.ts +5 -0
  8. package/dist/auth/DsaAuthStore.d.ts.map +1 -1
  9. package/dist/auth/index.d.ts +3 -1
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/types.d.ts +43 -0
  12. package/dist/auth/types.d.ts.map +1 -1
  13. package/dist/bdsa-schema.json +896 -0
  14. package/dist/components/DsaAuthManager/DsaAuthManager.d.ts +49 -4
  15. package/dist/components/DsaAuthManager/DsaAuthManager.d.ts.map +1 -1
  16. package/dist/components/DsaErrorBoundary/DsaErrorBoundary.d.ts +73 -0
  17. package/dist/components/DsaErrorBoundary/DsaErrorBoundary.d.ts.map +1 -0
  18. package/dist/components/DsaErrorBoundary/index.d.ts +3 -0
  19. package/dist/components/DsaErrorBoundary/index.d.ts.map +1 -0
  20. package/dist/components/FolderBrowser/FolderBrowser.d.ts.map +1 -1
  21. package/dist/components/FolderBrowser/FolderBrowser.types.d.ts +139 -2
  22. package/dist/components/FolderBrowser/FolderBrowser.types.d.ts.map +1 -1
  23. package/dist/components/FolderBrowser/useFolderBrowserDataFetching.d.ts +2 -0
  24. package/dist/components/FolderBrowser/useFolderBrowserDataFetching.d.ts.map +1 -1
  25. package/dist/components/FolderThumbnailBrowser/FolderThumbnailBrowser.d.ts +30 -0
  26. package/dist/components/FolderThumbnailBrowser/FolderThumbnailBrowser.d.ts.map +1 -1
  27. package/dist/components/ProtocolManager/ProtocolCard.d.ts +8 -0
  28. package/dist/components/ProtocolManager/ProtocolCard.d.ts.map +1 -0
  29. package/dist/components/ProtocolManager/ProtocolContext.d.ts +46 -0
  30. package/dist/components/ProtocolManager/ProtocolContext.d.ts.map +1 -0
  31. package/dist/components/ProtocolManager/ProtocolList.d.ts +8 -0
  32. package/dist/components/ProtocolManager/ProtocolList.d.ts.map +1 -0
  33. package/dist/components/ProtocolManager/ProtocolManager.d.ts +38 -0
  34. package/dist/components/ProtocolManager/ProtocolManager.d.ts.map +1 -0
  35. package/dist/components/ProtocolManager/ProtocolManager.types.d.ts +139 -0
  36. package/dist/components/ProtocolManager/ProtocolManager.types.d.ts.map +1 -0
  37. package/dist/components/ProtocolManager/ProtocolModal.d.ts +10 -0
  38. package/dist/components/ProtocolManager/ProtocolModal.d.ts.map +1 -0
  39. package/dist/components/ProtocolManager/ProtocolsTab.d.ts +10 -0
  40. package/dist/components/ProtocolManager/ProtocolsTab.d.ts.map +1 -0
  41. package/dist/components/ProtocolManager/adapters/DsaSyncAdapter.d.ts +76 -0
  42. package/dist/components/ProtocolManager/adapters/DsaSyncAdapter.d.ts.map +1 -0
  43. package/dist/components/ProtocolManager/storage/protocolStorage.d.ts +39 -0
  44. package/dist/components/ProtocolManager/storage/protocolStorage.d.ts.map +1 -0
  45. package/dist/components/ProtocolManager/testData.d.ts +23 -0
  46. package/dist/components/ProtocolManager/testData.d.ts.map +1 -0
  47. package/dist/components/ProtocolManager/utils/schemaValidator.d.ts +99 -0
  48. package/dist/components/ProtocolManager/utils/schemaValidator.d.ts.map +1 -0
  49. package/dist/components/SlideViewer/SlideViewer.d.ts +1 -1
  50. package/dist/components/SlideViewer/SlideViewer.d.ts.map +1 -1
  51. package/dist/components/SlideViewer/SlideViewer.types.d.ts +254 -21
  52. package/dist/components/SlideViewer/SlideViewer.types.d.ts.map +1 -1
  53. package/dist/components/SlideViewer/hooks/index.d.ts +2 -0
  54. package/dist/components/SlideViewer/hooks/index.d.ts.map +1 -1
  55. package/dist/components/SlideViewer/hooks/useAnnotationFetching.d.ts +2 -1
  56. package/dist/components/SlideViewer/hooks/useAnnotationFetching.d.ts.map +1 -1
  57. package/dist/components/SlideViewer/hooks/useOverlayTileSources.d.ts +9 -0
  58. package/dist/components/SlideViewer/hooks/useOverlayTileSources.d.ts.map +1 -0
  59. package/dist/components/SlideViewer/hooks/useViewportChange.d.ts +14 -0
  60. package/dist/components/SlideViewer/hooks/useViewportChange.d.ts.map +1 -0
  61. package/dist/components/ThumbnailGrid/ThumbnailGrid.d.ts +30 -0
  62. package/dist/components/ThumbnailGrid/ThumbnailGrid.d.ts.map +1 -1
  63. package/dist/index.cjs +55 -41
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.ts +15 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +19916 -17906
  68. package/dist/index.js.map +1 -1
  69. package/dist/style.css +1 -1
  70. package/dist/utils/apiErrorHandling.d.ts +44 -0
  71. package/dist/utils/apiErrorHandling.d.ts.map +1 -0
  72. package/dist/utils/patchOsdPaperjs.d.ts.map +1 -1
  73. package/package.json +3 -3
  74. package/patches/osd-paperjs-annotation+0.4.14.patch +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.23] - 2026-01-10
9
+
10
+ ### Fixed
11
+
12
+ #### SlideViewer: Overlay Tile Source Positioning
13
+ - **Fixed overlay positioning issues** - Overlays now correctly position at specified coordinates
14
+ - Improved base bounds calculation to use `getBounds()` for accurate world coordinates
15
+ - Added explicit position setting after image loads using `OpenSeadragon.Point`
16
+ - Added fallback positioning in case success callback doesn't fire
17
+ - Fixed issue where SimpleImage tile sources (base64 images) weren't respecting initial x/y coordinates
18
+
19
+ #### Paper.js Patch Application
20
+ - **Fixed "Paper.js View not found" warning** - Patch application now retries when Paper.js loads asynchronously
21
+ - Added retry mechanism (up to 10 attempts with 100ms intervals) to handle async Paper.js loading
22
+ - Patches now apply correctly even when Paper.js is loaded after the component module
23
+
24
+ #### OpenSeadragon TiledImage Configuration
25
+ - **Fixed width/height warning** - Only sets one dimension (prefers width) to avoid OpenSeadragon warning
26
+ - OpenSeadragon doesn't support specifying both width and height simultaneously
27
+ - When both are provided, only width is used and aspect ratio is maintained
28
+
29
+ #### Canvas Performance Warning
30
+ - Added `willReadFrequently: true` to canvas context creation in stories
31
+ - Reduces performance warnings for frequent `getImageData` operations
32
+
33
+ ### Technical Details
34
+ - Updated `useOverlayTileSources.ts` with improved coordinate calculation and positioning logic
35
+ - Enhanced `patchOsdPaperjs.ts` with retry mechanism for async Paper.js loading
36
+ - Improved base bounds calculation to prioritize `getBounds()` over `getContentSize()`
37
+ - Added explicit position setting in both success callback and setTimeout fallback
38
+
8
39
  ## [0.1.20] - 2025-11-12
9
40
 
10
41
  ### Added - Debug Mode for Clean Console Output 🔇
@@ -1,6 +1,6 @@
1
1
  # bdsa-react-components - CURSOR Integration Guide
2
2
 
3
- **Version:** 0.1.21 | **Generated:** 2025-11-13T23:09:03.628Z
3
+ **Version:** 0.1.25 | **Generated:** 2026-01-10T22:31:44.133Z
4
4
 
5
5
  > This document provides everything Cursor needs to integrate and use the bdsa-react-components library.
6
6
  > Copy this entire document into your project's .cursorrules or docs folder.
@@ -42,7 +42,7 @@ npm run build
42
42
  ### Import
43
43
 
44
44
  ```tsx
45
- import { AnnotationManager, Button, Card, DsaAuthManager, FolderBrowser, FolderThumbnailBrowser, SlideViewer, ThumbnailGrid, ThumbnailViewer } from 'bdsa-react-components'
45
+ import { AnnotationManager, Button, Card, DsaAuthManager, DsaErrorBoundary, FolderBrowser, FolderThumbnailBrowser, ProtocolManager, SlideViewer, ThumbnailGrid, ThumbnailViewer } from 'bdsa-react-components'
46
46
  import 'bdsa-react-components/styles.css'
47
47
  ```
48
48
 
@@ -100,7 +100,11 @@ A flexible card component for the BDSA project
100
100
 
101
101
  ### DsaAuthManager
102
102
 
103
- Callback when authentication status changes
103
+ DsaAuthManager component
104
+
105
+ ### DsaErrorBoundary
106
+
107
+ DsaErrorBoundary component
104
108
 
105
109
  ### FolderBrowser
106
110
 
@@ -154,6 +158,10 @@ Size presets for thumbnails
154
158
  - `GET /item/{id}/tiles/dzi.dzi` - DZI descriptor for thumbnail
155
159
  - `GET /annotation?itemId={id}` - Fetch annotations for item
156
160
 
161
+ ### ProtocolManager
162
+
163
+ ProtocolManager component
164
+
157
165
  ### SlideViewer
158
166
 
159
167
  A slide viewer component that integrates OpenSeadragon with Paper.js annotations for viewing Digital Slide Archive images with annotation overlays.
@@ -234,6 +242,20 @@ import type {
234
242
  FolderThumbnailBrowserProps,
235
243
  ThumbnailViewerProps,
236
244
  ThumbnailGridProps,
245
+ Protocol,
246
+ ProtocolType,
247
+ ProtocolStorage,
248
+ DsaSyncAdapter as DsaSyncAdapterType,
249
+ SchemaValidator as SchemaValidatorType,
250
+ ProtocolContextValue,
251
+ ProtocolProviderProps,
252
+ ProtocolCardProps,
253
+ ProtocolListProps,
254
+ ProtocolModalProps,
255
+ ProtocolsTabProps,
256
+ ApiError,
257
+ ApiErrorContext,
258
+ ApiErrorHandler,
237
259
  } from 'bdsa-react-components'
238
260
  ```
239
261
 
package/INTEGRATION.md CHANGED
File without changes
package/README.md CHANGED
File without changes
@@ -0,0 +1,92 @@
1
+ import { default as React } from 'react';
2
+ import { DsaAuthStatus, DsaUserInfo } from './types';
3
+
4
+ export interface DsaAuthContextValue {
5
+ /** Current authentication status */
6
+ authStatus: DsaAuthStatus;
7
+ /** Current authentication token (null if not authenticated) */
8
+ token: string | null;
9
+ /** Whether authentication is currently loading */
10
+ isLoading: boolean;
11
+ /** Error message if authentication failed */
12
+ error: string | null;
13
+ /** User information (null if not authenticated) */
14
+ user: DsaUserInfo | null;
15
+ /** Whether user is authenticated */
16
+ isAuthenticated: boolean;
17
+ /** Manually refresh the token */
18
+ refreshToken: () => Promise<void>;
19
+ /** Get authentication headers for API requests */
20
+ getAuthHeaders: () => Record<string, string>;
21
+ }
22
+ export interface DsaAuthProviderProps {
23
+ /** Base URL for DSA API (e.g., 'http://bdsa.pathology.emory.edu:8080/api/v1') */
24
+ apiBaseUrl: string;
25
+ /**
26
+ * Backend endpoint that returns { dsaToken: string }.
27
+ * Your backend should keep the API key secure and exchange it for a DSA token.
28
+ * This is the recommended pattern (Option A).
29
+ *
30
+ * @example '/api/config'
31
+ */
32
+ tokenEndpoint?: string;
33
+ /**
34
+ * API key to exchange for a DSA token directly.
35
+ * Only use this if you cannot use the backend endpoint pattern.
36
+ * This is less secure as the API key will be in the frontend (Option B).
37
+ */
38
+ apiKey?: string;
39
+ /** Callback when token is obtained or changes */
40
+ onTokenChange?: (token: string | null) => void;
41
+ /** Callback when authentication fails */
42
+ onAuthError?: (error: Error) => void;
43
+ /** Callback when API errors occur */
44
+ onApiError?: (error: Error, retry: () => void) => void;
45
+ /** Whether to automatically refresh token before expiry (default: true) */
46
+ autoRefresh?: boolean;
47
+ /** Refresh token when it's this many milliseconds from expiring (default: 5 minutes) */
48
+ refreshThreshold?: number;
49
+ /** Child components */
50
+ children: React.ReactNode;
51
+ }
52
+ /**
53
+ * DSA Authentication Provider Component
54
+ *
55
+ * Manages authentication state and provides token to child components via context.
56
+ * Supports both backend endpoint and direct API key patterns for token acquisition.
57
+ */
58
+ export declare const DsaAuthProvider: React.FC<DsaAuthProviderProps>;
59
+ /**
60
+ * Hook to access DSA authentication context
61
+ *
62
+ * @throws Error if used outside of DsaAuthProvider
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * function MyComponent() {
67
+ * const { token, isAuthenticated, user } = useDsaAuth()
68
+ *
69
+ * if (!isAuthenticated) {
70
+ * return <div>Not authenticated</div>
71
+ * }
72
+ *
73
+ * return <div>Welcome, {user?.name}!</div>
74
+ * }
75
+ * ```
76
+ */
77
+ export declare function useDsaAuth(): DsaAuthContextValue;
78
+ /**
79
+ * Hook to get just the DSA token from context
80
+ *
81
+ * @throws Error if used outside of DsaAuthProvider
82
+ *
83
+ * @example
84
+ * ```tsx
85
+ * function MyComponent() {
86
+ * const token = useDsaToken()
87
+ * // Use token for API requests
88
+ * }
89
+ * ```
90
+ */
91
+ export declare function useDsaToken(): string | null;
92
+ //# sourceMappingURL=DsaAuthProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DsaAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/DsaAuthProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAA8E,MAAM,OAAO,CAAA;AAElG,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,MAAM,WAAW,mBAAmB;IAChC,oCAAoC;IACpC,UAAU,EAAE,aAAa,CAAA;IACzB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,mDAAmD;IACnD,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACxB,oCAAoC;IACpC,eAAe,EAAE,OAAO,CAAA;IACxB,iCAAiC;IACjC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,kDAAkD;IAClD,cAAc,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/C;AAID,MAAM,WAAW,oBAAoB;IACjC,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC9C,yCAAyC;IACzC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACpC,qCAAqC;IACrC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;IACtD,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wFAAwF;IACxF,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uBAAuB;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmN1D,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,IAAI,mBAAmB,CAMhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAG3C"}
@@ -38,6 +38,11 @@ declare class DsaAuthStore {
38
38
  getStatus(): DsaAuthStatus;
39
39
  getConfig(): DsaAuthConfig;
40
40
  getToken(): string;
41
+ /**
42
+ * Set token directly (used for API key → token exchange or backend-provided tokens)
43
+ * This bypasses the normal login flow and sets the token directly.
44
+ */
45
+ setToken(token: string, userInfo?: DsaUserInfo, expiryDays?: number): void;
41
46
  testConnection(): Promise<{
42
47
  success: boolean;
43
48
  version?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"DsaAuthStore.d.ts","sourceRoot":"","sources":["../../src/auth/DsaAuthStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAUzF,cAAM,YAAY;IAChB,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAAa;I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E,MAAM,CAAC;IAUxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAOnC,YAAY,IAAI,OAAO;IAIvB,WAAW,IAAI,OAAO;IAItB,SAAS,IAAI,aAAa;IAe1B,SAAS,IAAI,aAAa;IAI1B,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,UAAU,GAAE,MAAW,GAAG,IAAI;IAqBxE,cAAc,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CA2BtF;AAGD,eAAO,MAAM,YAAY,cAAqB,CAAA;AAE9C,eAAe,YAAY,CAAA"}
@@ -3,6 +3,8 @@
3
3
  * Exports authentication utilities, hooks, and types
4
4
  */
5
5
  export { dsaAuthStore } from './DsaAuthStore';
6
- export { useDsaAuth } from './useDsaAuth';
6
+ export { useDsaAuth as useDsaAuthHook } from './useDsaAuth';
7
+ export { DsaAuthProvider, useDsaAuth, useDsaToken } from './DsaAuthProvider';
7
8
  export type { DsaAuthConfig, DsaUserInfo, DsaAuthStatus, DsaAuthResponse, DsaAuthListener } from './types';
9
+ export type { DsaAuthContextValue, DsaAuthProviderProps } from './DsaAuthProvider';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5E,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC1G,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,38 +1,81 @@
1
1
  /**
2
2
  * Types for DSA Authentication
3
3
  */
4
+ /**
5
+ * Configuration for DSA authentication and API access.
6
+ * Used to configure the DSA server URL and optional resource restrictions.
7
+ */
4
8
  export interface DsaAuthConfig {
9
+ /** Base URL of the DSA server (e.g., 'http://bdsa.pathology.emory.edu:8080') */
5
10
  baseUrl: string;
11
+ /** Optional resource ID to restrict access to a specific folder or collection */
6
12
  resourceId?: string;
13
+ /** Type of resource if resourceId is provided */
7
14
  resourceType?: 'folder' | 'collection';
15
+ /** Strategy for fetching paginated resources */
8
16
  fetchStrategy?: 'unlimited' | 'paginate';
17
+ /** Page size for paginated fetching */
9
18
  pageSize?: number;
19
+ /** Target folder for metadata synchronization */
10
20
  metadataSyncTargetFolder?: string;
11
21
  }
22
+ /**
23
+ * User information returned from DSA authentication.
24
+ */
12
25
  export interface DsaUserInfo {
26
+ /** Unique user identifier */
13
27
  id: string;
28
+ /** User's display name */
14
29
  name: string;
30
+ /** User's email address (optional) */
15
31
  email?: string;
32
+ /** User's login username (optional) */
16
33
  login?: string;
17
34
  }
35
+ /**
36
+ * Current authentication status for DSA.
37
+ * Provides information about whether the user is authenticated, configured, and has a valid token.
38
+ */
18
39
  export interface DsaAuthStatus {
40
+ /** Whether the user is currently authenticated */
19
41
  isAuthenticated: boolean;
42
+ /** Whether DSA server configuration has been set */
20
43
  isConfigured: boolean;
44
+ /** Whether a valid authentication token exists */
21
45
  hasToken: boolean;
46
+ /** Whether configuration exists */
22
47
  hasConfig: boolean;
48
+ /** Current user information (null if not authenticated) */
23
49
  user: DsaUserInfo | null;
50
+ /** URL of the configured DSA server */
24
51
  serverUrl: string;
52
+ /** Optional resource ID restriction */
25
53
  resourceId?: string;
54
+ /** Type of resource restriction */
26
55
  resourceType?: 'folder' | 'collection';
56
+ /** Timestamp of last successful login */
27
57
  lastLogin?: Date | null;
58
+ /** Timestamp when the current token expires */
28
59
  tokenExpiry?: Date | null;
29
60
  }
61
+ /**
62
+ * Response from DSA authentication operations (login, token refresh, etc.)
63
+ */
30
64
  export interface DsaAuthResponse {
65
+ /** Whether the authentication operation was successful */
31
66
  success: boolean;
67
+ /** Authentication token (if successful) */
32
68
  token?: string;
69
+ /** User information (if successful) */
33
70
  user?: DsaUserInfo;
71
+ /** Error message (if unsuccessful) */
34
72
  error?: string;
73
+ /** Additional message from the server */
35
74
  message?: string;
36
75
  }
76
+ /**
77
+ * Listener function type for authentication state changes.
78
+ * Called whenever authentication status changes (login, logout, token refresh, etc.)
79
+ */
37
80
  export type DsaAuthListener = () => void;
38
81
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAA;IACtC,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,K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