@eminuckan/spine 0.2.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 (99) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +425 -0
  4. package/dist/api-client/index.d.ts +3 -0
  5. package/dist/api-client/index.js +4 -0
  6. package/dist/api-client/server.d.ts +4 -0
  7. package/dist/api-client/server.js +5 -0
  8. package/dist/api-client-Ftxqm3Ep.js +212 -0
  9. package/dist/api-client-Ftxqm3Ep.js.map +1 -0
  10. package/dist/auth/index.d.ts +2 -0
  11. package/dist/auth/index.js +0 -0
  12. package/dist/auth/server.d.ts +3 -0
  13. package/dist/auth/server.js +6 -0
  14. package/dist/auth.server-C979TR6W.js +724 -0
  15. package/dist/auth.server-C979TR6W.js.map +1 -0
  16. package/dist/auth.server-DU-x2LPA.js +5 -0
  17. package/dist/identity/index.d.ts +4 -0
  18. package/dist/identity/index.js +3 -0
  19. package/dist/identity/server.d.ts +4 -0
  20. package/dist/identity/server.js +4 -0
  21. package/dist/identity-CFa1txoj.js +235 -0
  22. package/dist/identity-CFa1txoj.js.map +1 -0
  23. package/dist/index-BIJOC8Fb.d.ts +272 -0
  24. package/dist/index-BIJOC8Fb.d.ts.map +1 -0
  25. package/dist/index-Bt9XE6gj.d.ts +104 -0
  26. package/dist/index-Bt9XE6gj.d.ts.map +1 -0
  27. package/dist/index-C2hGpzGr.d.ts +74 -0
  28. package/dist/index-C2hGpzGr.d.ts.map +1 -0
  29. package/dist/index-CfQsb3l_.d.ts +170 -0
  30. package/dist/index-CfQsb3l_.d.ts.map +1 -0
  31. package/dist/index-D6RK_5vm.d.ts +199 -0
  32. package/dist/index-D6RK_5vm.d.ts.map +1 -0
  33. package/dist/index-DrttYPAj.d.ts +30 -0
  34. package/dist/index-DrttYPAj.d.ts.map +1 -0
  35. package/dist/index-geY2ynnN.d.ts +141 -0
  36. package/dist/index-geY2ynnN.d.ts.map +1 -0
  37. package/dist/index-kr8Wk7v5.d.ts +1 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.js +10 -0
  40. package/dist/logging/index.d.ts +3 -0
  41. package/dist/logging/index.js +3 -0
  42. package/dist/logging-_h2mi3L9.js +118 -0
  43. package/dist/logging-_h2mi3L9.js.map +1 -0
  44. package/dist/permissions/index.d.ts +2 -0
  45. package/dist/permissions/index.js +3 -0
  46. package/dist/permissions-D5ScGGnd.js +281 -0
  47. package/dist/permissions-D5ScGGnd.js.map +1 -0
  48. package/dist/query-client/index.d.ts +2 -0
  49. package/dist/query-client/index.js +3 -0
  50. package/dist/query-client-DRPQIKHX.js +174 -0
  51. package/dist/query-client-DRPQIKHX.js.map +1 -0
  52. package/dist/react-router/index.d.ts +12 -0
  53. package/dist/react-router/index.js +10 -0
  54. package/dist/react-router/server.d.ts +18 -0
  55. package/dist/react-router/server.js +17 -0
  56. package/dist/redis-session-storage.server-DhufyPjd.js +250 -0
  57. package/dist/redis-session-storage.server-DhufyPjd.js.map +1 -0
  58. package/dist/server-BoeUiXSh.d.ts +40 -0
  59. package/dist/server-BoeUiXSh.d.ts.map +1 -0
  60. package/dist/server-C-DiVP9e.js +185 -0
  61. package/dist/server-C-DiVP9e.js.map +1 -0
  62. package/dist/server-CLbksnvg.d.ts +144 -0
  63. package/dist/server-CLbksnvg.d.ts.map +1 -0
  64. package/dist/server-CNp6gjFE.js +78 -0
  65. package/dist/server-CNp6gjFE.js.map +1 -0
  66. package/dist/server-CXGaRaiS.d.ts +256 -0
  67. package/dist/server-CXGaRaiS.d.ts.map +1 -0
  68. package/dist/server-CiSbg-9C.js +352 -0
  69. package/dist/server-CiSbg-9C.js.map +1 -0
  70. package/dist/server-DLgH3FRR.js +312 -0
  71. package/dist/server-DLgH3FRR.js.map +1 -0
  72. package/dist/server-DazqdM63.d.ts +93 -0
  73. package/dist/server-DazqdM63.d.ts.map +1 -0
  74. package/dist/server-iWm3oeCM.js +145 -0
  75. package/dist/server-iWm3oeCM.js.map +1 -0
  76. package/dist/server-zEKMDpP7.d.ts +80 -0
  77. package/dist/server-zEKMDpP7.d.ts.map +1 -0
  78. package/dist/server.d.ts +18 -0
  79. package/dist/server.js +17 -0
  80. package/dist/signalr/index.d.ts +4 -0
  81. package/dist/signalr/index.js +3 -0
  82. package/dist/signalr-BJGcXc0m.js +274 -0
  83. package/dist/signalr-BJGcXc0m.js.map +1 -0
  84. package/dist/src-D7mh9MKA.js +0 -0
  85. package/dist/tenant/index.d.ts +3 -0
  86. package/dist/tenant/index.js +3 -0
  87. package/dist/tenant/server.d.ts +3 -0
  88. package/dist/tenant/server.js +5 -0
  89. package/dist/tenant-C6KPaSCX.js +256 -0
  90. package/dist/tenant-C6KPaSCX.js.map +1 -0
  91. package/dist/types-BTjFzIhv.d.ts +31 -0
  92. package/dist/types-BTjFzIhv.d.ts.map +1 -0
  93. package/dist/types-DoIfDhl6.d.ts +55 -0
  94. package/dist/types-DoIfDhl6.d.ts.map +1 -0
  95. package/dist/types-DufLRY7A.d.ts +164 -0
  96. package/dist/types-DufLRY7A.d.ts.map +1 -0
  97. package/dist/types-uDrDMkCq.d.ts +93 -0
  98. package/dist/types-uDrDMkCq.d.ts.map +1 -0
  99. package/package.json +147 -0
@@ -0,0 +1,80 @@
1
+ import { TenantMembership } from "./types-DoIfDhl6.js";
2
+ import { AddressData, IdentityContextData } from "./types-uDrDMkCq.js";
3
+
4
+ //#region src/identity/identity-context.server.d.ts
5
+ /**
6
+ * Identity API fetcher type (to avoid coupling with specific API client)
7
+ */
8
+
9
+ /**
10
+ * Identity API fetcher type (to avoid coupling with specific API client)
11
+ */
12
+ type IdentityAPIFetcher = (request: Request) => Promise<IdentityContextData>;
13
+ /**
14
+ * Configure identity API fetcher
15
+ */
16
+ declare function configureIdentityAPIFetcher(fetcher: IdentityAPIFetcher): void;
17
+ /**
18
+ * Fetch identity context from backend
19
+ */
20
+ declare function fetchIdentityContext(request: Request): Promise<IdentityContextData>;
21
+ /**
22
+ * Get cached identity context or fetch fresh if needed
23
+ */
24
+ declare function getIdentityContext(request: Request, userId: string, forceRefresh?: boolean): Promise<IdentityContextData>;
25
+ /**
26
+ * Clear identity context cache for user
27
+ */
28
+ declare function clearIdentityContextCache(userId?: string): void;
29
+ /**
30
+ * Permission fetcher type
31
+ */
32
+ type PermissionFetcher = (request: Request, tenantId: string) => Promise<string[]>;
33
+ /**
34
+ * Configure permission fetcher
35
+ */
36
+ declare function configurePermissionFetcher(fetcher: PermissionFetcher): void;
37
+ /**
38
+ * Fetch user permissions for a specific tenant
39
+ */
40
+ declare function fetchUserPermissions(request: Request, tenantId: string): Promise<string[]>;
41
+ interface UserContextInfo {
42
+ tenants: string[];
43
+ memberships: TenantMembership[];
44
+ currentTenant?: string;
45
+ isOnboarded: boolean;
46
+ permissions: string[];
47
+ hasSubscription: boolean;
48
+ userId?: string;
49
+ email?: string;
50
+ firstName?: string | null;
51
+ lastName?: string | null;
52
+ displayName?: string | null;
53
+ profileImageUrl?: string | null;
54
+ phoneNumber?: string | null;
55
+ timeZone?: string;
56
+ addresses?: AddressData[];
57
+ hasOwnerMembership: boolean;
58
+ }
59
+ interface ContextToUserInfoOptions {
60
+ currentTenant?: string | null;
61
+ request?: Request;
62
+ }
63
+ /**
64
+ * Convert raw identity context into a tenant-aware user info shape.
65
+ */
66
+ declare function contextToUserInfo(context: IdentityContextData, options?: ContextToUserInfoOptions): Promise<UserContextInfo>;
67
+ /**
68
+ * Check if a cached context version differs from the latest version.
69
+ */
70
+ declare function hasContextVersionChanged(userId: string, newVersion: number): boolean;
71
+ /**
72
+ * Mark a cached identity context as stale after a version change.
73
+ */
74
+ declare function updateContextVersion(userId: string, newVersion: number): void;
75
+
76
+ //#endregion
77
+ //# sourceMappingURL=identity-context.server.d.ts.map
78
+
79
+ export { ContextToUserInfoOptions, IdentityAPIFetcher, PermissionFetcher, UserContextInfo, clearIdentityContextCache as clearIdentityContextCache$1, configureIdentityAPIFetcher as configureIdentityAPIFetcher$1, configurePermissionFetcher as configurePermissionFetcher$1, contextToUserInfo as contextToUserInfo$1, fetchIdentityContext as fetchIdentityContext$1, fetchUserPermissions as fetchUserPermissions$1, getIdentityContext as getIdentityContext$1, hasContextVersionChanged as hasContextVersionChanged$1, updateContextVersion as updateContextVersion$1 };
80
+ //# sourceMappingURL=server-zEKMDpP7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-zEKMDpP7.d.ts","names":[],"sources":["../src/identity/identity-context.server.ts"],"sourcesContent":null,"mappings":";;;;;;;;;AAYA;;AAA2C,KAA/B,kBAAA,GAA+B,CAAA,OAAA,EAAA,OAAA,EAAA,GAAY,OAAZ,CAAoB,mBAApB,CAAA;;;AAAmB;iBAO9C,2BAAA,UAAqC;;;AAArD;iBAmBsB,oBAAA,UAA8B,UAAU,QAAQ;;;AAAtE;AAA0C,iBAyCpB,kBAAA,CAzCoB,OAAA,EA0C/B,OA1C+B,EAAA,MAAA,EAAA,MAAA,EAAA,YAAA,CAAA,EAAA,OAAA,CAAA,EA6CvC,OA7CuC,CA6C/B,mBA7C+B,CAAA;;;;AAA2B,iBAyErD,yBAAA,CAzEqD,MAAA,CAAA,EAAA,MAAA,CAAA,EAAA,IAAA;;;;AAyC/C,KA6CV,iBAAA,GA7C4B,CAAA,OAAA,EA6CE,OA7CF,EAAA,QAAA,EAAA,MAAA,EAAA,GA6CgC,OA7ChC,CAAA,MAAA,EAAA,CAAA;;;;AAIrC,iBAgDa,0BAAA,CAhDb,OAAA,EAgDiD,iBAhDjD,CAAA,EAAA,IAAA;AAAO;;;iBAuDY,oBAAA,UAA8B,4BAA4B;AA3BhE,UA6CC,eAAA,CA7CwB;;eA+C1B;;EAlCH,WAAA,EAAA,OAAiB;EAAA,WAAA,EAAA,MAAA,EAAA;EAAA,eAAa,EAAA,OAAA;EAAO,MAAuB,CAAA,EAAA,MAAA;EAAO,KAAA,CAAA,EAAA,MAAA;;;;EAO/D,eAAA,CAAA,EAAA,MAAA,GAAA,IAA0B;;;cAwC5B;EAjCQ,kBAAA,EAAA,OAAoB;;AAAU,UAqCnC,wBAAA,CArCmC;EAAO,aAAqB,CAAA,EAAA,MAAA,GAAA,IAAA;EAAO,OAAA,CAAA,EAuC3E,OAvC2E;AAkBvF;;;;AAeyB,iBAYH,iBAAA,CAZG,OAAA,EAad,mBAbc,EAAA,OAAA,CAAA,EAcd,wBAdc,CAAA,EAetB,OAfsB,CAed,eAfc,CAAA;AAIzB;;;iBA+CgB,wBAAA;AAvChB;;;AAEW,iBA6CK,oBAAA,CA7CL,MAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,CAAA,EAAA,IAAA"}
@@ -0,0 +1,18 @@
1
+ import { LogContext, LogEntry, LogLevel$1 as LogLevel, LoggerConfig } from "./types-BTjFzIhv.js";
2
+ import { APIConfig, APILogger, ApiError$1 as ApiError, CreateAPIConfigOptions, ErrorCodes$1 as ErrorCodes, ErrorHandler$1 as ErrorHandler, GetAccessTokenFn, GetCurrentTenantFn, ProblemDetails, RetryConfig, TokenRefreshFn, TokenRefreshResult, ValidationError, calculateBackoffDelay$1 as calculateBackoffDelay, createRetryFetch$1 as createRetryFetch, fetchWithTimeout$1 as fetchWithTimeout, handleApiError$1 as handleApiError, isRetryableError$1 as isRetryableError, withRetry$1 as withRetry } from "./index-D6RK_5vm.js";
3
+ import { APIConfigFactory, APIConfigFactoryOptions, AxiosSetupOptions, CreateEnhancedClientOptions, createAPIConfigFactory$1 as createAPIConfigFactory, createEnhancedClient$1 as createEnhancedClient, setupAxiosInterceptors$1 as setupAxiosInterceptors } from "./server-CLbksnvg.js";
4
+ import { ApplicationType, AuthClaimMapping, AuthConfig, AuthError, LoginOptions, OAuthState, ProtectedLoaderFn, ProtectionLevel, SessionData, SessionFlashData, TokenRefreshResult$1, UserInfo } from "./types-DufLRY7A.js";
5
+ import { AUTH_ERROR_COOKIE_PREFIX, AutomaticLogoutRequestContext, DefaultRouteIdentityContext, IdentityContextChecker, LoginReturnUrlContext, RouteProtectionConfig, RouteProtectionErrorHandlerContext, RouteProtectionRedirect, RouteProtectionResolverContext, SubscriptionChecker, TenantChecker, attemptTokenRefresh$1 as attemptTokenRefresh, authRoute$1 as authRoute, cleanupExpiredOAuthStates, clearAuthErrorHeaders, clearAuthServerCache, closeRedisConnection, configureAuthClaimMapping, configureRouteProtection$1 as configureRouteProtection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, extractUserInfo, getAccessToken, getAuthError, getAuthSession, getOAuthState, getUser, handleCallback, hasAuthError, isSessionValid, isTokenExpiredResponse$1 as isTokenExpiredResponse, login, logout, onboardingRoute$1 as onboardingRoute, protectRoute$1 as protectRoute, publicRoute$1 as publicRoute, refreshTokens, requireAuth, requireAuthSession, resetAuthClaimMapping, resetRouteProtectionConfig$1 as resetRouteProtectionConfig, shouldAttemptTokenRefresh$1 as shouldAttemptTokenRefresh, shouldRefreshToken$1 as shouldRefreshToken, subscriptionRoute$1 as subscriptionRoute, updateAuthSession } from "./server-CXGaRaiS.js";
6
+ import { OrganizationBranding, OrganizationData, TenantContextType, TenantInfo, TenantMembership } from "./types-DoIfDhl6.js";
7
+ import { AddressData, IdentityContextChangeHandler, IdentityContextChangedEvent, IdentityContextData } from "./types-uDrDMkCq.js";
8
+ import { IdentityContextProvider$1 as IdentityContextProvider, IdentityStoreConfig, IdentityUnauthorizedDetails, configureIdentityEndpoints$1 as configureIdentityEndpoints, configureIdentityStore$1 as configureIdentityStore, resetIdentityStoreConfig$1 as resetIdentityStoreConfig, useHasSubscription$1 as useHasSubscription, useIdentityContext$1 as useIdentityContext, useIdentityStore$1 as useIdentityStore, useIsOnboarded$1 as useIsOnboarded, useUserPermissions$1 as useUserPermissions, useUserTenants$1 as useUserTenants } from "./index-C2hGpzGr.js";
9
+ import { ContextToUserInfoOptions, IdentityAPIFetcher, PermissionFetcher, UserContextInfo, clearIdentityContextCache$1 as clearIdentityContextCache, configureIdentityAPIFetcher$1 as configureIdentityAPIFetcher, configurePermissionFetcher$1 as configurePermissionFetcher, contextToUserInfo$1 as contextToUserInfo, fetchIdentityContext$1 as fetchIdentityContext, fetchUserPermissions$1 as fetchUserPermissions, getIdentityContext$1 as getIdentityContext, hasContextVersionChanged$1 as hasContextVersionChanged, updateContextVersion$1 as updateContextVersion } from "./server-zEKMDpP7.js";
10
+ import { LOG_LEVEL_PRIORITY$1 as LOG_LEVEL_PRIORITY, Logger$1 as Logger, createLogger$1 as createLogger, defaultLoggerConfig$1 as defaultLoggerConfig, logger$1 as logger } from "./index-DrttYPAj.js";
11
+ import { FieldPermissionResult, PERMISSION_MODULES$1 as PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker$1 as PermissionChecker, PermissionCode, PermissionInitializer$1 as PermissionInitializer, PermissionModule, ProtectedAction$1 as ProtectedAction, ProtectedButton$1 as ProtectedButton, ProtectedLink$1 as ProtectedLink, ProtectedSection$1 as ProtectedSection, getPermissionChecker$1 as getPermissionChecker, getPermissions$1 as getPermissions, initializePermissions$1 as initializePermissions, useAllPermissions$1 as useAllPermissions, useHasModulePermission$1 as useHasModulePermission, useHasPermission$1 as useHasPermission, useHasPermissions$1 as useHasPermissions, useModulePermission$1 as useModulePermission, usePermission$1 as usePermission, usePermissionChecker$1 as usePermissionChecker, usePermissionStore$1 as usePermissionStore, usePermissions$1 as usePermissions } from "./index-BIJOC8Fb.js";
12
+ import { TenantProvider$1 as TenantProvider, configureTenantEndpoints$1 as configureTenantEndpoints, initializeTenantStore$1 as initializeTenantStore, useCurrentOrganization$1 as useCurrentOrganization, useCurrentTenant$1 as useCurrentTenant, useOrganization$1 as useOrganization, useTenant$1 as useTenant, useTenantStore$1 as useTenantStore, useTenantSwitcher$1 as useTenantSwitcher } from "./index-Bt9XE6gj.js";
13
+ import { IdentitySignalRClient$1 as IdentitySignalRClient, SignalRClient$1 as SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, cleanupSignalR$1 as cleanupSignalR, createIdentitySignalRClient$1 as createIdentitySignalRClient, getIdentitySignalRClient$1 as getIdentitySignalRClient, initializeSignalR$1 as initializeSignalR } from "./index-geY2ynnN.js";
14
+ import { CachePreset, CachePresets, InvalidationHelpers, LogoutHandler, QueryClientConfig, QueryLogger, cachePresets$1 as cachePresets, createQueryClient$1 as createQueryClient, createQueryKeyFactory$1 as createQueryKeyFactory, invalidationHelpers$1 as invalidationHelpers } from "./index-CfQsb3l_.js";
15
+ import "./index-kr8Wk7v5.js";
16
+ import { IdentityContextFetcher, TenantCookieConfig, TenantCookieSameSite, clearActiveTenant$1 as clearActiveTenant, clearCurrentTenant$1 as clearCurrentTenant, configureIdentityContextFetcher$1 as configureIdentityContextFetcher, configureTenantCookie$1 as configureTenantCookie, getActiveTenant$1 as getActiveTenant, getAvailableTenants$1 as getAvailableTenants, getCurrentTenant$1 as getCurrentTenant, getTenantFromIdentityContext$1 as getTenantFromIdentityContext, initializeTenant$1 as initializeTenant, resetTenantCookieConfig$1 as resetTenantCookieConfig, setActiveTenant$1 as setActiveTenant, setCurrentTenant$1 as setCurrentTenant } from "./server-DazqdM63.js";
17
+ import { ForbiddenPermissionDetails, PermissionRouteContext, PermissionRouteProtectionConfig, PermissionRouteSession, checkPermission$1 as checkPermission, configurePermissionRouteProtection$1 as configurePermissionRouteProtection, requirePermission$1 as requirePermission, resetPermissionRouteProtection$1 as resetPermissionRouteProtection, withPermission$1 as withPermission } from "./server-BoeUiXSh.js";
18
+ export { APIConfig, APIConfigFactory, APIConfigFactoryOptions, APILogger, AUTH_ERROR_COOKIE_PREFIX, AddressData, ApiError, TokenRefreshResult as ApiTokenRefreshResult, ApplicationType, AuthClaimMapping, AuthConfig, AuthError, TokenRefreshResult$1 as AuthTokenRefreshResult, AutomaticLogoutRequestContext, AxiosSetupOptions, CachePreset, CachePresets, ContextToUserInfoOptions, CreateAPIConfigOptions, CreateEnhancedClientOptions, DefaultRouteIdentityContext, ErrorCodes, ErrorHandler, FieldPermissionResult, ForbiddenPermissionDetails, GetAccessTokenFn, GetCurrentTenantFn, IdentityAPIFetcher, IdentityContextChangeHandler, IdentityContextChangedEvent, IdentityContextChecker, IdentityContextData, IdentityContextFetcher, IdentityContextProvider, IdentitySignalRClient, IdentityStoreConfig, IdentityUnauthorizedDetails, InvalidationHelpers, LOG_LEVEL_PRIORITY, LogContext, LogEntry, LogLevel, Logger, LoggerConfig, LoginOptions, LoginReturnUrlContext, LogoutHandler, OAuthState, OrganizationBranding, OrganizationData, PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker, PermissionCode, PermissionFetcher, PermissionInitializer, PermissionModule, PermissionRouteContext, PermissionRouteProtectionConfig, PermissionRouteSession, ProblemDetails, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedLoaderFn, ProtectedSection, ProtectionLevel, QueryClientConfig, QueryLogger, RetryConfig, RouteProtectionConfig, RouteProtectionErrorHandlerContext, RouteProtectionRedirect, RouteProtectionResolverContext, SessionData, SessionFlashData, SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, SubscriptionChecker, TenantChecker, TenantContextType, TenantCookieConfig, TenantCookieSameSite, TenantInfo, TenantMembership, TenantProvider, TokenRefreshFn, TokenRefreshResult, UserContextInfo, UserInfo, ValidationError, attemptTokenRefresh, authRoute, cachePresets, calculateBackoffDelay, checkPermission, cleanupExpiredOAuthStates, cleanupSignalR, clearActiveTenant, clearAuthErrorHeaders, clearAuthServerCache, clearCurrentTenant, clearIdentityContextCache, closeRedisConnection, configureAuthClaimMapping, configureIdentityAPIFetcher, configureIdentityContextFetcher, configureIdentityEndpoints, configureIdentityStore, configurePermissionFetcher, configurePermissionRouteProtection, configureRouteProtection, configureTenantCookie, configureTenantEndpoints, contextToUserInfo, createAPIConfigFactory, createAuthSession, createEnhancedClient, createIdentitySignalRClient, createLogger, createOAuthState, createQueryClient, createQueryKeyFactory, createRetryFetch, defaultLoggerConfig, deleteOAuthState, destroyAuthSession, extractUserInfo, fetchIdentityContext, fetchUserPermissions, fetchWithTimeout, getAccessToken, getActiveTenant, getAuthError, getAuthSession, getAvailableTenants, getCurrentTenant, getIdentityContext, getIdentitySignalRClient, getOAuthState, getPermissionChecker, getPermissions, getTenantFromIdentityContext, getUser, handleApiError, handleCallback, hasAuthError, hasContextVersionChanged, initializePermissions, initializeSignalR, initializeTenant, initializeTenantStore, invalidationHelpers, isRetryableError, isSessionValid, isTokenExpiredResponse, logger, login, logout, onboardingRoute, protectRoute, publicRoute, refreshTokens, requireAuth, requireAuthSession, requirePermission, resetAuthClaimMapping, resetIdentityStoreConfig, resetPermissionRouteProtection, resetRouteProtectionConfig, resetTenantCookieConfig, setActiveTenant, setCurrentTenant, setupAxiosInterceptors, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute, updateAuthSession, updateContextVersion, useAllPermissions, useCurrentOrganization, useCurrentTenant, useHasModulePermission, useHasPermission, useHasPermissions, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useModulePermission, useOrganization, usePermission, usePermissionChecker, usePermissionStore, usePermissions, useTenant, useTenantStore, useTenantSwitcher, useUserPermissions, useUserTenants, withPermission, withRetry };
package/dist/server.js ADDED
@@ -0,0 +1,17 @@
1
+ import { LOG_LEVEL_PRIORITY, LogLevel, Logger, createLogger, defaultLoggerConfig, logger } from "./logging-_h2mi3L9.js";
2
+ import { PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, getPermissionChecker, getPermissions, initializePermissions, useAllPermissions, useHasModulePermission, useHasPermission, useHasPermissions, useModulePermission, usePermission, usePermissionChecker, usePermissionStore, usePermissions } from "./permissions-D5ScGGnd.js";
3
+ import { TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher } from "./tenant-C6KPaSCX.js";
4
+ import { IdentityContextProvider, configureIdentityEndpoints, configureIdentityStore, resetIdentityStoreConfig, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useUserPermissions, useUserTenants } from "./identity-CFa1txoj.js";
5
+ import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "./api-client-Ftxqm3Ep.js";
6
+ import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "./signalr-BJGcXc0m.js";
7
+ import { cachePresets, createQueryClient, createQueryKeyFactory, invalidationHelpers } from "./query-client-DRPQIKHX.js";
8
+ import "./src-D7mh9MKA.js";
9
+ import { AUTH_ERROR_COOKIE_PREFIX$1 as AUTH_ERROR_COOKIE_PREFIX, cleanupExpiredOAuthStates$1 as cleanupExpiredOAuthStates, closeRedisConnection$1 as closeRedisConnection, createAuthSession$1 as createAuthSession, createOAuthState$1 as createOAuthState, deleteOAuthState$1 as deleteOAuthState, destroyAuthSession$1 as destroyAuthSession, getAuthSession$1 as getAuthSession, getOAuthState$1 as getOAuthState, isSessionValid$1 as isSessionValid, requireAuthSession$1 as requireAuthSession, updateAuthSession$1 as updateAuthSession } from "./redis-session-storage.server-DhufyPjd.js";
10
+ import { clearAuthErrorHeaders$1 as clearAuthErrorHeaders, clearAuthServerCache$1 as clearAuthServerCache, configureAuthClaimMapping$1 as configureAuthClaimMapping, extractUserInfo$1 as extractUserInfo, getAccessToken$1 as getAccessToken, getAuthError$1 as getAuthError, getUser$1 as getUser, handleCallback$1 as handleCallback, hasAuthError$1 as hasAuthError, login$1 as login, logout$1 as logout, refreshTokens$1 as refreshTokens, requireAuth$1 as requireAuth, resetAuthClaimMapping$1 as resetAuthClaimMapping } from "./auth.server-C979TR6W.js";
11
+ import { attemptTokenRefresh, authRoute, configureRouteProtection, isTokenExpiredResponse, onboardingRoute, protectRoute, publicRoute, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute } from "./server-CiSbg-9C.js";
12
+ import { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant } from "./server-C-DiVP9e.js";
13
+ import { clearIdentityContextCache, configureIdentityAPIFetcher, configurePermissionFetcher, contextToUserInfo, fetchIdentityContext, fetchUserPermissions, getIdentityContext, hasContextVersionChanged, updateContextVersion } from "./server-iWm3oeCM.js";
14
+ import { checkPermission, configurePermissionRouteProtection, requirePermission, resetPermissionRouteProtection, withPermission } from "./server-CNp6gjFE.js";
15
+ import { createAPIConfigFactory, createEnhancedClient, setupAxiosInterceptors } from "./server-DLgH3FRR.js";
16
+
17
+ export { AUTH_ERROR_COOKIE_PREFIX, ApiError, ErrorCodes, ErrorHandler, IdentityContextProvider, IdentitySignalRClient, LOG_LEVEL_PRIORITY, LogLevel, Logger, PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, SignalRClient, TenantProvider, attemptTokenRefresh, authRoute, cachePresets, calculateBackoffDelay, checkPermission, cleanupExpiredOAuthStates, cleanupSignalR, clearActiveTenant, clearAuthErrorHeaders, clearAuthServerCache, clearCurrentTenant, clearIdentityContextCache, closeRedisConnection, configureAuthClaimMapping, configureIdentityAPIFetcher, configureIdentityContextFetcher, configureIdentityEndpoints, configureIdentityStore, configurePermissionFetcher, configurePermissionRouteProtection, configureRouteProtection, configureTenantCookie, configureTenantEndpoints, contextToUserInfo, createAPIConfigFactory, createAuthSession, createEnhancedClient, createIdentitySignalRClient, createLogger, createOAuthState, createQueryClient, createQueryKeyFactory, createRetryFetch, defaultLoggerConfig, deleteOAuthState, destroyAuthSession, extractUserInfo, fetchIdentityContext, fetchUserPermissions, fetchWithTimeout, getAccessToken, getActiveTenant, getAuthError, getAuthSession, getAvailableTenants, getCurrentTenant, getIdentityContext, getIdentitySignalRClient, getOAuthState, getPermissionChecker, getPermissions, getTenantFromIdentityContext, getUser, handleApiError, handleCallback, hasAuthError, hasContextVersionChanged, initializePermissions, initializeSignalR, initializeTenant, initializeTenantStore, invalidationHelpers, isRetryableError, isSessionValid, isTokenExpiredResponse, logger, login, logout, onboardingRoute, protectRoute, publicRoute, refreshTokens, requireAuth, requireAuthSession, requirePermission, resetAuthClaimMapping, resetIdentityStoreConfig, resetPermissionRouteProtection, resetRouteProtectionConfig, resetTenantCookieConfig, setActiveTenant, setCurrentTenant, setupAxiosInterceptors, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute, updateAuthSession, updateContextVersion, useAllPermissions, useCurrentOrganization, useCurrentTenant, useHasModulePermission, useHasPermission, useHasPermissions, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useModulePermission, useOrganization, usePermission, usePermissionChecker, usePermissionStore, usePermissions, useTenant, useTenantStore, useTenantSwitcher, useUserPermissions, useUserTenants, withPermission, withRetry };
@@ -0,0 +1,4 @@
1
+ import "../types-DoIfDhl6.js";
2
+ import { IdentityContextChangeHandler, IdentityContextChangedEvent } from "../types-uDrDMkCq.js";
3
+ import { IdentitySignalRClient$1 as IdentitySignalRClient, SignalRClient$1 as SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, cleanupSignalR$1 as cleanupSignalR, createIdentitySignalRClient$1 as createIdentitySignalRClient, getIdentitySignalRClient$1 as getIdentitySignalRClient, initializeSignalR$1 as initializeSignalR } from "../index-geY2ynnN.js";
4
+ export { IdentityContextChangeHandler, IdentityContextChangedEvent, IdentitySignalRClient, SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR };
@@ -0,0 +1,3 @@
1
+ import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "../signalr-BJGcXc0m.js";
2
+
3
+ export { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR };
@@ -0,0 +1,274 @@
1
+ import { HubConnectionBuilder, LogLevel } from "@microsoft/signalr";
2
+
3
+ //#region src/signalr/signalr-client.ts
4
+ /**
5
+ * Default configuration
6
+ */
7
+ const DEFAULT_CONFIG = {
8
+ maxReconnectAttempts: 5,
9
+ reconnectDelay: 1e3,
10
+ verbose: false,
11
+ autoReconnectOnVisibility: true
12
+ };
13
+ /**
14
+ * SignalR Client Class
15
+ *
16
+ * Generic SignalR client that can be used for any hub connection.
17
+ */
18
+ var SignalRClient = class {
19
+ connection = null;
20
+ accessToken = null;
21
+ isConnecting = false;
22
+ reconnectAttempts = 0;
23
+ config;
24
+ eventHandlers = new Map();
25
+ visibilityHandler = null;
26
+ constructor(config) {
27
+ this.config = {
28
+ ...DEFAULT_CONFIG,
29
+ ...config
30
+ };
31
+ if (typeof document !== "undefined" && this.config.autoReconnectOnVisibility) {
32
+ this.visibilityHandler = () => {
33
+ if (document.visibilityState === "visible" && this.connection?.state === "Disconnected") {
34
+ this.log("🔄 Page became visible, attempting reconnection...");
35
+ this.connect(this.accessToken);
36
+ }
37
+ };
38
+ document.addEventListener("visibilitychange", this.visibilityHandler);
39
+ }
40
+ }
41
+ /**
42
+ * Connect to SignalR hub
43
+ */
44
+ async connect(accessToken) {
45
+ if (!accessToken) {
46
+ this.log("⚠️ No access token provided for SignalR connection", "warn");
47
+ return;
48
+ }
49
+ if (this.isConnecting) {
50
+ this.log("🔄 Connection already in progress...");
51
+ return;
52
+ }
53
+ if (this.connection?.state === "Connected") {
54
+ this.log("✅ Already connected");
55
+ return;
56
+ }
57
+ this.accessToken = accessToken;
58
+ this.isConnecting = true;
59
+ try {
60
+ const hubUrl = this.buildHubUrl();
61
+ this.connection = new HubConnectionBuilder().withUrl(hubUrl, { accessTokenFactory: () => accessToken }).withAutomaticReconnect({ nextRetryDelayInMilliseconds: (retryContext) => {
62
+ const delay = Math.min(this.config.reconnectDelay * Math.pow(2, retryContext.previousRetryCount), 16e3);
63
+ this.log(`🔄 Reconnect attempt ${retryContext.previousRetryCount + 1} in ${delay}ms`);
64
+ return delay;
65
+ } }).configureLogging(this.config.verbose ? LogLevel.Information : LogLevel.Warning).build();
66
+ this.setupConnectionHandlers();
67
+ this.log(`🔄 Connecting to SignalR hub: ${hubUrl}`);
68
+ await this.connection.start();
69
+ this.log(`✅ Connected successfully (ID: ${this.connection.connectionId})`);
70
+ this.reconnectAttempts = 0;
71
+ } catch (error) {
72
+ this.log(`❌ Connection failed: ${error}`, "error");
73
+ this.reconnectAttempts++;
74
+ if (this.reconnectAttempts <= this.config.maxReconnectAttempts) {
75
+ const delay = Math.min(this.config.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1), 3e4);
76
+ this.log(`🔄 Retrying in ${delay}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
77
+ setTimeout(() => {
78
+ this.connect(accessToken);
79
+ }, delay);
80
+ } else this.log("❌ Max reconnection attempts reached", "error");
81
+ } finally {
82
+ this.isConnecting = false;
83
+ }
84
+ }
85
+ /**
86
+ * Build hub URL
87
+ */
88
+ buildHubUrl() {
89
+ let baseUrl = this.config.baseUrl;
90
+ if (!baseUrl && typeof window !== "undefined") baseUrl = window.location.hostname === "localhost" ? "https://localhost:5001" : window.location.origin;
91
+ return `${baseUrl}${this.config.hubPath}`;
92
+ }
93
+ /**
94
+ * Setup connection lifecycle handlers
95
+ */
96
+ setupConnectionHandlers() {
97
+ if (!this.connection) return;
98
+ this.connection.onreconnecting((error) => {
99
+ this.log(`🔄 Reconnecting... ${error?.message || ""}`);
100
+ });
101
+ this.connection.onreconnected((connectionId) => {
102
+ this.log(`✅ Reconnected (ID: ${connectionId})`);
103
+ this.reconnectAttempts = 0;
104
+ });
105
+ this.connection.onclose((error) => {
106
+ this.log(`🔌 Connection closed: ${error?.message || "No error"}`);
107
+ if (this.accessToken && error) setTimeout(() => {
108
+ this.connect(this.accessToken);
109
+ }, 5e3);
110
+ });
111
+ this.eventHandlers.forEach((handlers, eventName) => {
112
+ this.connection.on(eventName, (event) => {
113
+ handlers.forEach((handler) => {
114
+ try {
115
+ handler(event);
116
+ } catch (err) {
117
+ this.log(`❌ Error in ${eventName} handler: ${err}`, "error");
118
+ }
119
+ });
120
+ });
121
+ });
122
+ }
123
+ /**
124
+ * Disconnect from SignalR hub
125
+ */
126
+ async disconnect() {
127
+ if (this.connection) {
128
+ this.log("🔌 Disconnecting...");
129
+ await this.connection.stop();
130
+ this.connection = null;
131
+ this.accessToken = null;
132
+ this.reconnectAttempts = 0;
133
+ }
134
+ }
135
+ /**
136
+ * Register event handler
137
+ */
138
+ on(eventName, handler) {
139
+ if (!this.eventHandlers.has(eventName)) this.eventHandlers.set(eventName, new Set());
140
+ this.eventHandlers.get(eventName).add(handler);
141
+ if (this.connection) this.connection.on(eventName, handler);
142
+ return () => {
143
+ this.eventHandlers.get(eventName)?.delete(handler);
144
+ this.connection?.off(eventName, handler);
145
+ };
146
+ }
147
+ /**
148
+ * Invoke hub method
149
+ */
150
+ async invoke(methodName, ...args) {
151
+ if (!this.connection || this.connection.state !== "Connected") throw new Error("SignalR not connected");
152
+ return this.connection.invoke(methodName, ...args);
153
+ }
154
+ /**
155
+ * Get current connection state
156
+ */
157
+ get connectionState() {
158
+ return this.connection?.state || "Disconnected";
159
+ }
160
+ /**
161
+ * Check if connected
162
+ */
163
+ get isConnected() {
164
+ return this.connection?.state === "Connected";
165
+ }
166
+ /**
167
+ * Get connection ID
168
+ */
169
+ get connectionId() {
170
+ return this.connection?.connectionId || null;
171
+ }
172
+ /**
173
+ * Cleanup resources
174
+ */
175
+ dispose() {
176
+ if (this.visibilityHandler && typeof document !== "undefined") document.removeEventListener("visibilitychange", this.visibilityHandler);
177
+ this.disconnect();
178
+ this.eventHandlers.clear();
179
+ }
180
+ /**
181
+ * Log message
182
+ */
183
+ log(message, level = "info") {
184
+ if (!this.config.verbose && level === "info") return;
185
+ const prefix = "[SignalR]";
186
+ switch (level) {
187
+ case "warn":
188
+ console.warn(prefix, message);
189
+ break;
190
+ case "error":
191
+ console.error(prefix, message);
192
+ break;
193
+ default: console.log(prefix, message);
194
+ }
195
+ }
196
+ };
197
+ /**
198
+ * Create Identity SignalR Client
199
+ *
200
+ * Factory function to create a SignalR client for identity hub.
201
+ */
202
+ function createIdentitySignalRClient(options = {}) {
203
+ return new SignalRClient({
204
+ ...options,
205
+ hubPath: "/hubs/identity"
206
+ });
207
+ }
208
+ /**
209
+ * Identity SignalR Client
210
+ *
211
+ * Specialized client for identity context changes.
212
+ */
213
+ var IdentitySignalRClient = class extends SignalRClient {
214
+ identityHandlers = [];
215
+ constructor(options = {}) {
216
+ super({
217
+ ...options,
218
+ hubPath: "/hubs/identity"
219
+ });
220
+ this.on("IdentityContextChanged", (event) => {
221
+ this.identityHandlers.forEach((handler) => {
222
+ try {
223
+ handler(event);
224
+ } catch (error) {
225
+ console.error("Error in identity context change handler:", error);
226
+ }
227
+ });
228
+ });
229
+ }
230
+ /**
231
+ * Add handler for identity context changes
232
+ */
233
+ onIdentityContextChanged(handler) {
234
+ this.identityHandlers.push(handler);
235
+ return () => {
236
+ const index = this.identityHandlers.indexOf(handler);
237
+ if (index > -1) this.identityHandlers.splice(index, 1);
238
+ };
239
+ }
240
+ };
241
+ /**
242
+ * Singleton identity client instance
243
+ */
244
+ let identityClientInstance = null;
245
+ /**
246
+ * Get or create singleton identity SignalR client
247
+ */
248
+ function getIdentitySignalRClient(options = {}) {
249
+ if (!identityClientInstance) identityClientInstance = new IdentitySignalRClient(options);
250
+ return identityClientInstance;
251
+ }
252
+ /**
253
+ * Initialize SignalR with access token
254
+ */
255
+ async function initializeSignalR(accessToken, options = {}) {
256
+ if (typeof window === "undefined") throw new Error("SignalR can only be initialized on the client");
257
+ const client = getIdentitySignalRClient(options);
258
+ await client.connect(accessToken);
259
+ return client;
260
+ }
261
+ /**
262
+ * Cleanup SignalR connection
263
+ */
264
+ async function cleanupSignalR() {
265
+ if (identityClientInstance) {
266
+ await identityClientInstance.disconnect();
267
+ identityClientInstance.dispose();
268
+ identityClientInstance = null;
269
+ }
270
+ }
271
+
272
+ //#endregion
273
+ export { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR };
274
+ //# sourceMappingURL=signalr-BJGcXc0m.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signalr-BJGcXc0m.js","names":["DEFAULT_CONFIG: Required<Omit<SignalRClientConfig, 'hubPath' | 'baseUrl'>>","config: SignalRClientConfig","accessToken: string | null","event: unknown","eventName: string","handler: SignalREventHandler<T>","methodName: string","message: string","level: 'info' | 'warn' | 'error'","options: Omit<SignalRClientConfig, 'hubPath'>","handler: IdentityContextChangeHandler","identityClientInstance: IdentitySignalRClient | null"],"sources":["../src/signalr/signalr-client.ts"],"sourcesContent":["/**\n * SignalR Client for Real-time Updates\n * \n * This client connects to SignalR hub and listens for real-time events.\n * Supports identity context changes, permissions updates, etc.\n */\n\nimport { HubConnection, HubConnectionBuilder, LogLevel } from '@microsoft/signalr';\nimport type {\n SignalRClientConfig,\n SignalRConnectionState,\n SignalREventHandler,\n IdentityContextChangedEvent,\n IdentityContextChangeHandler,\n} from './types';\n\n/**\n * Default configuration\n */\nconst DEFAULT_CONFIG: Required<Omit<SignalRClientConfig, 'hubPath' | 'baseUrl'>> = {\n maxReconnectAttempts: 5,\n reconnectDelay: 1000,\n verbose: false,\n autoReconnectOnVisibility: true,\n};\n\n/**\n * SignalR Client Class\n * \n * Generic SignalR client that can be used for any hub connection.\n */\nexport class SignalRClient {\n private connection: HubConnection | null = null;\n private accessToken: string | null = null;\n private isConnecting = false;\n private reconnectAttempts = 0;\n private config: Required<Omit<SignalRClientConfig, 'baseUrl'>> & { baseUrl?: string };\n private eventHandlers: Map<string, Set<SignalREventHandler>> = new Map();\n private visibilityHandler: (() => void) | null = null;\n\n constructor(config: SignalRClientConfig) {\n this.config = {\n ...DEFAULT_CONFIG,\n ...config,\n };\n\n // Auto-reconnect on page visibility change\n if (typeof document !== 'undefined' && this.config.autoReconnectOnVisibility) {\n this.visibilityHandler = () => {\n if (document.visibilityState === 'visible' && this.connection?.state === 'Disconnected') {\n this.log('🔄 Page became visible, attempting reconnection...');\n this.connect(this.accessToken);\n }\n };\n document.addEventListener('visibilitychange', this.visibilityHandler);\n }\n }\n\n /**\n * Connect to SignalR hub\n */\n async connect(accessToken: string | null): Promise<void> {\n if (!accessToken) {\n this.log('⚠️ No access token provided for SignalR connection', 'warn');\n return;\n }\n\n if (this.isConnecting) {\n this.log('🔄 Connection already in progress...');\n return;\n }\n\n if (this.connection?.state === 'Connected') {\n this.log('✅ Already connected');\n return;\n }\n\n this.accessToken = accessToken;\n this.isConnecting = true;\n\n try {\n const hubUrl = this.buildHubUrl();\n\n this.connection = new HubConnectionBuilder()\n .withUrl(hubUrl, {\n accessTokenFactory: () => accessToken,\n })\n .withAutomaticReconnect({\n nextRetryDelayInMilliseconds: (retryContext) => {\n // Exponential backoff: 1s, 2s, 4s, 8s, 16s\n const delay = Math.min(\n this.config.reconnectDelay * Math.pow(2, retryContext.previousRetryCount),\n 16000\n );\n this.log(`🔄 Reconnect attempt ${retryContext.previousRetryCount + 1} in ${delay}ms`);\n return delay;\n },\n })\n .configureLogging(this.config.verbose ? LogLevel.Information : LogLevel.Warning)\n .build();\n\n // Setup event handlers\n this.setupConnectionHandlers();\n\n // Connect\n this.log(`🔄 Connecting to SignalR hub: ${hubUrl}`);\n await this.connection.start();\n\n this.log(`✅ Connected successfully (ID: ${this.connection.connectionId})`);\n this.reconnectAttempts = 0;\n } catch (error) {\n this.log(`❌ Connection failed: ${error}`, 'error');\n this.reconnectAttempts++;\n\n // Retry with exponential backoff\n if (this.reconnectAttempts <= this.config.maxReconnectAttempts) {\n const delay = Math.min(\n this.config.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1),\n 30000\n );\n this.log(\n `🔄 Retrying in ${delay}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`\n );\n\n setTimeout(() => {\n this.connect(accessToken);\n }, delay);\n } else {\n this.log('❌ Max reconnection attempts reached', 'error');\n }\n } finally {\n this.isConnecting = false;\n }\n }\n\n /**\n * Build hub URL\n */\n private buildHubUrl(): string {\n let baseUrl = this.config.baseUrl;\n\n // Auto-detect base URL if not provided\n if (!baseUrl && typeof window !== 'undefined') {\n baseUrl =\n window.location.hostname === 'localhost'\n ? 'https://localhost:5001' // Development\n : window.location.origin; // Production\n }\n\n return `${baseUrl}${this.config.hubPath}`;\n }\n\n /**\n * Setup connection lifecycle handlers\n */\n private setupConnectionHandlers(): void {\n if (!this.connection) return;\n\n this.connection.onreconnecting((error) => {\n this.log(`🔄 Reconnecting... ${error?.message || ''}`);\n });\n\n this.connection.onreconnected((connectionId) => {\n this.log(`✅ Reconnected (ID: ${connectionId})`);\n this.reconnectAttempts = 0;\n });\n\n this.connection.onclose((error) => {\n this.log(`🔌 Connection closed: ${error?.message || 'No error'}`);\n\n // Auto-reconnect if we have a token and it wasn't a manual disconnect\n if (this.accessToken && error) {\n setTimeout(() => {\n this.connect(this.accessToken);\n }, 5000);\n }\n });\n\n // Re-register all event handlers\n this.eventHandlers.forEach((handlers, eventName) => {\n this.connection!.on(eventName, (event: unknown) => {\n handlers.forEach((handler) => {\n try {\n handler(event);\n } catch (err) {\n this.log(`❌ Error in ${eventName} handler: ${err}`, 'error');\n }\n });\n });\n });\n }\n\n /**\n * Disconnect from SignalR hub\n */\n async disconnect(): Promise<void> {\n if (this.connection) {\n this.log('🔌 Disconnecting...');\n await this.connection.stop();\n this.connection = null;\n this.accessToken = null;\n this.reconnectAttempts = 0;\n }\n }\n\n /**\n * Register event handler\n */\n on<T = unknown>(eventName: string, handler: SignalREventHandler<T>): () => void {\n // Add to handlers map\n if (!this.eventHandlers.has(eventName)) {\n this.eventHandlers.set(eventName, new Set());\n }\n this.eventHandlers.get(eventName)!.add(handler as SignalREventHandler);\n\n // If already connected, register immediately\n if (this.connection) {\n this.connection.on(eventName, handler);\n }\n\n // Return unsubscribe function\n return () => {\n this.eventHandlers.get(eventName)?.delete(handler as SignalREventHandler);\n this.connection?.off(eventName, handler);\n };\n }\n\n /**\n * Invoke hub method\n */\n async invoke<T = void>(methodName: string, ...args: unknown[]): Promise<T> {\n if (!this.connection || this.connection.state !== 'Connected') {\n throw new Error('SignalR not connected');\n }\n return this.connection.invoke<T>(methodName, ...args);\n }\n\n /**\n * Get current connection state\n */\n get connectionState(): SignalRConnectionState {\n return (this.connection?.state as SignalRConnectionState) || 'Disconnected';\n }\n\n /**\n * Check if connected\n */\n get isConnected(): boolean {\n return this.connection?.state === 'Connected';\n }\n\n /**\n * Get connection ID\n */\n get connectionId(): string | null {\n return this.connection?.connectionId || null;\n }\n\n /**\n * Cleanup resources\n */\n dispose(): void {\n if (this.visibilityHandler && typeof document !== 'undefined') {\n document.removeEventListener('visibilitychange', this.visibilityHandler);\n }\n this.disconnect();\n this.eventHandlers.clear();\n }\n\n /**\n * Log message\n */\n private log(message: string, level: 'info' | 'warn' | 'error' = 'info'): void {\n if (!this.config.verbose && level === 'info') return;\n\n const prefix = '[SignalR]';\n switch (level) {\n case 'warn':\n console.warn(prefix, message);\n break;\n case 'error':\n console.error(prefix, message);\n break;\n default:\n console.log(prefix, message);\n }\n }\n}\n\n/**\n * Create Identity SignalR Client\n * \n * Factory function to create a SignalR client for identity hub.\n */\nexport function createIdentitySignalRClient(\n options: Omit<SignalRClientConfig, 'hubPath'> = {}\n): SignalRClient {\n return new SignalRClient({\n ...options,\n hubPath: '/hubs/identity',\n });\n}\n\n/**\n * Identity SignalR Client\n * \n * Specialized client for identity context changes.\n */\nexport class IdentitySignalRClient extends SignalRClient {\n private identityHandlers: IdentityContextChangeHandler[] = [];\n\n constructor(options: Omit<SignalRClientConfig, 'hubPath'> = {}) {\n super({\n ...options,\n hubPath: '/hubs/identity',\n });\n\n // Register identity context change handler\n this.on<IdentityContextChangedEvent>('IdentityContextChanged', (event) => {\n this.identityHandlers.forEach((handler) => {\n try {\n handler(event);\n } catch (error) {\n console.error('Error in identity context change handler:', error);\n }\n });\n });\n }\n\n /**\n * Add handler for identity context changes\n */\n onIdentityContextChanged(handler: IdentityContextChangeHandler): () => void {\n this.identityHandlers.push(handler);\n\n return () => {\n const index = this.identityHandlers.indexOf(handler);\n if (index > -1) {\n this.identityHandlers.splice(index, 1);\n }\n };\n }\n}\n\n/**\n * Singleton identity client instance\n */\nlet identityClientInstance: IdentitySignalRClient | null = null;\n\n/**\n * Get or create singleton identity SignalR client\n */\nexport function getIdentitySignalRClient(\n options: Omit<SignalRClientConfig, 'hubPath'> = {}\n): IdentitySignalRClient {\n if (!identityClientInstance) {\n identityClientInstance = new IdentitySignalRClient(options);\n }\n return identityClientInstance;\n}\n\n/**\n * Initialize SignalR with access token\n */\nexport async function initializeSignalR(\n accessToken: string | null,\n options: Omit<SignalRClientConfig, 'hubPath'> = {}\n): Promise<IdentitySignalRClient> {\n if (typeof window === 'undefined') {\n throw new Error('SignalR can only be initialized on the client');\n }\n\n const client = getIdentitySignalRClient(options);\n await client.connect(accessToken);\n return client;\n}\n\n/**\n * Cleanup SignalR connection\n */\nexport async function cleanupSignalR(): Promise<void> {\n if (identityClientInstance) {\n await identityClientInstance.disconnect();\n identityClientInstance.dispose();\n identityClientInstance = null;\n }\n}\n"],"mappings":";;;;;;AAmBA,MAAMA,iBAA6E;CACjF,sBAAsB;CACtB,gBAAgB;CAChB,SAAS;CACT,2BAA2B;AAC5B;;;;;;AAOD,IAAa,gBAAb,MAA2B;CACzB,AAAQ,aAAmC;CAC3C,AAAQ,cAA6B;CACrC,AAAQ,eAAe;CACvB,AAAQ,oBAAoB;CAC5B,AAAQ;CACR,AAAQ,gBAAuD,IAAI;CACnE,AAAQ,oBAAyC;CAEjD,YAAYC,QAA6B;AACvC,OAAK,SAAS;GACZ,GAAG;GACH,GAAG;EACJ;AAGD,aAAW,aAAa,eAAe,KAAK,OAAO,2BAA2B;AAC5E,QAAK,oBAAoB,MAAM;AAC7B,QAAI,SAAS,oBAAoB,aAAa,KAAK,YAAY,UAAU,gBAAgB;AAC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EACH,SAAS;CACV;AACF;;;;;;AAOD,IAAa,wBAAb,cAA2C,cAAc;CACvD,AAAQ,mBAAmD,CAAE;CAE7D,YAAYA,UAAgD,CAAE,GAAE;AAC9D,QAAM;GACJ,GAAG;GACH,SAAS;EACV,EAAC;AAGF,OAAK,GAAgC,0BAA0B,CAAC,UAAU;AACxE,QAAK,iBAAiB,QAAQ,CAAC,YAAY;AACzC,QAAI;AACF,aAAQ,MAAM;IACf,SAAQ,OAAO;AACd,aAAQ,MAAM,6CAA6C,MAAM;IAClE;GACF,EAAC;EACH,EAAC;CACH;;;;CAKD,yBAAyBC,SAAmD;AAC1E,OAAK,iBAAiB,KAAK,QAAQ;AAEnC,SAAO,MAAM;GACX,MAAM,QAAQ,KAAK,iBAAiB,QAAQ,QAAQ;AACpD,OAAI,QAAQ,GACV,MAAK,iBAAiB,OAAO,OAAO,EAAE;EAEzC;CACF;AACF;;;;AAKD,IAAIC,yBAAuD;;;;AAK3D,SAAgB,yBACdF,UAAgD,CAAE,GAC3B;AACvB,MAAK,uBACH,0BAAyB,IAAI,sBAAsB;AAErD,QAAO;AACR;;;;AAKD,eAAsB,kBACpBP,aACAO,UAAgD,CAAE,GAClB;AAChC,YAAW,WAAW,YACpB,OAAM,IAAI,MAAM;CAGlB,MAAM,SAAS,yBAAyB,QAAQ;AAChD,OAAM,OAAO,QAAQ,YAAY;AACjC,QAAO;AACR;;;;AAKD,eAAsB,iBAAgC;AACpD,KAAI,wBAAwB;AAC1B,QAAM,uBAAuB,YAAY;AACzC,yBAAuB,SAAS;AAChC,2BAAyB;CAC1B;AACF"}
File without changes
@@ -0,0 +1,3 @@
1
+ import { OrganizationBranding, OrganizationData, TenantContextType, TenantInfo, TenantMembership } from "../types-DoIfDhl6.js";
2
+ import { TenantProvider$1 as TenantProvider, configureTenantEndpoints$1 as configureTenantEndpoints, initializeTenantStore$1 as initializeTenantStore, useCurrentOrganization$1 as useCurrentOrganization, useCurrentTenant$1 as useCurrentTenant, useOrganization$1 as useOrganization, useTenant$1 as useTenant, useTenantStore$1 as useTenantStore, useTenantSwitcher$1 as useTenantSwitcher } from "../index-Bt9XE6gj.js";
3
+ export { OrganizationBranding, OrganizationData, TenantContextType, TenantInfo, TenantMembership, TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher };
@@ -0,0 +1,3 @@
1
+ import { TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher } from "../tenant-C6KPaSCX.js";
2
+
3
+ export { TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher };
@@ -0,0 +1,3 @@
1
+ import { OrganizationBranding, OrganizationData, TenantContextType, TenantInfo, TenantMembership } from "../types-DoIfDhl6.js";
2
+ import { IdentityContextFetcher, TenantCookieConfig, TenantCookieSameSite, clearActiveTenant$1 as clearActiveTenant, clearCurrentTenant$1 as clearCurrentTenant, configureIdentityContextFetcher$1 as configureIdentityContextFetcher, configureTenantCookie$1 as configureTenantCookie, getActiveTenant$1 as getActiveTenant, getAvailableTenants$1 as getAvailableTenants, getCurrentTenant$1 as getCurrentTenant, getTenantFromIdentityContext$1 as getTenantFromIdentityContext, initializeTenant$1 as initializeTenant, resetTenantCookieConfig$1 as resetTenantCookieConfig, setActiveTenant$1 as setActiveTenant, setCurrentTenant$1 as setCurrentTenant } from "../server-DazqdM63.js";
3
+ export { IdentityContextFetcher, OrganizationBranding, OrganizationData, TenantContextType, TenantCookieConfig, TenantCookieSameSite, TenantInfo, TenantMembership, clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant };
@@ -0,0 +1,5 @@
1
+ import "../logging-_h2mi3L9.js";
2
+ import "../redis-session-storage.server-DhufyPjd.js";
3
+ import { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant } from "../server-C-DiVP9e.js";
4
+
5
+ export { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant };