@eminuckan/spine 0.2.0 → 0.2.2

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 (179) hide show
  1. package/README.md +2 -2
  2. package/dist/api-client/api-config.server.d.ts +40 -0
  3. package/dist/api-client/api-config.server.d.ts.map +1 -0
  4. package/dist/api-client/error-codes.d.ts +57 -0
  5. package/dist/api-client/error-codes.d.ts.map +1 -0
  6. package/dist/api-client/error-handler.d.ts +52 -0
  7. package/dist/api-client/error-handler.d.ts.map +1 -0
  8. package/dist/api-client/fetch-client.server.d.ts +29 -0
  9. package/dist/api-client/fetch-client.server.d.ts.map +1 -0
  10. package/dist/api-client/index.d.ts +11 -3
  11. package/dist/api-client/index.d.ts.map +1 -0
  12. package/dist/api-client/index.js +3 -2
  13. package/dist/api-client/retry-handler.d.ts +29 -0
  14. package/dist/api-client/retry-handler.d.ts.map +1 -0
  15. package/dist/api-client/server.d.ts +9 -4
  16. package/dist/api-client/server.d.ts.map +1 -0
  17. package/dist/api-client/server.js +4 -3
  18. package/dist/api-client/types.d.ts +121 -0
  19. package/dist/api-client/types.d.ts.map +1 -0
  20. package/dist/{api-client-Ftxqm3Ep.js → api-client-DsrxK05Z.js} +1 -1
  21. package/dist/{api-client-Ftxqm3Ep.js.map → api-client-DsrxK05Z.js.map} +1 -1
  22. package/dist/auth/auth.server.d.ts +124 -0
  23. package/dist/auth/auth.server.d.ts.map +1 -0
  24. package/dist/auth/index.d.ts +8 -2
  25. package/dist/auth/index.d.ts.map +1 -0
  26. package/dist/auth/redis-session-storage.server.d.ts +21 -0
  27. package/dist/auth/redis-session-storage.server.d.ts.map +1 -0
  28. package/dist/auth/route-protection.server.d.ts +107 -0
  29. package/dist/auth/route-protection.server.d.ts.map +1 -0
  30. package/dist/auth/server.d.ts +13 -3
  31. package/dist/auth/server.d.ts.map +1 -0
  32. package/dist/auth/server.js +3 -3
  33. package/dist/auth/token-refresh.server.d.ts +17 -0
  34. package/dist/auth/token-refresh.server.d.ts.map +1 -0
  35. package/dist/auth/types.d.ts +160 -0
  36. package/dist/auth/types.d.ts.map +1 -0
  37. package/dist/auth.server-BPiCtlJE.js +5 -0
  38. package/dist/{auth.server-C979TR6W.js → auth.server-Cx2h2qu3.js} +3 -3
  39. package/dist/{auth.server-C979TR6W.js.map → auth.server-Cx2h2qu3.js.map} +1 -1
  40. package/dist/http/response.d.ts +12 -0
  41. package/dist/http/response.d.ts.map +1 -0
  42. package/dist/identity/identity-context-provider.d.ts +19 -0
  43. package/dist/identity/identity-context-provider.d.ts.map +1 -0
  44. package/dist/identity/identity-context.server.d.ts +73 -0
  45. package/dist/identity/identity-context.server.d.ts.map +1 -0
  46. package/dist/identity/identity-store.d.ts +55 -0
  47. package/dist/identity/identity-store.d.ts.map +1 -0
  48. package/dist/identity/index.d.ts +9 -4
  49. package/dist/identity/index.d.ts.map +1 -0
  50. package/dist/identity/server.d.ts +6 -4
  51. package/dist/identity/server.d.ts.map +1 -0
  52. package/dist/identity/server.js +2 -1
  53. package/dist/identity/types.d.ts +91 -0
  54. package/dist/identity/types.d.ts.map +1 -0
  55. package/dist/index.d.ts +14 -12
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +6 -5
  58. package/dist/logging/config.d.ts +7 -0
  59. package/dist/logging/config.d.ts.map +1 -0
  60. package/dist/logging/index.d.ts +9 -3
  61. package/dist/logging/index.d.ts.map +1 -0
  62. package/dist/logging/logger.d.ts +22 -0
  63. package/dist/logging/logger.d.ts.map +1 -0
  64. package/dist/logging/types.d.ts +27 -0
  65. package/dist/logging/types.d.ts.map +1 -0
  66. package/dist/permissions/components.d.ts +48 -0
  67. package/dist/permissions/components.d.ts.map +1 -0
  68. package/dist/permissions/constants.d.ts +9 -0
  69. package/dist/permissions/constants.d.ts.map +1 -0
  70. package/dist/permissions/hooks.d.ts +47 -0
  71. package/dist/permissions/hooks.d.ts.map +1 -0
  72. package/dist/permissions/index.d.ts +28 -2
  73. package/dist/permissions/index.d.ts.map +1 -0
  74. package/dist/permissions/permission-initializer.d.ts +18 -0
  75. package/dist/permissions/permission-initializer.d.ts.map +1 -0
  76. package/dist/permissions/permission-service.d.ts +53 -0
  77. package/dist/permissions/permission-service.d.ts.map +1 -0
  78. package/dist/permissions/permission-store.d.ts +42 -0
  79. package/dist/permissions/permission-store.d.ts.map +1 -0
  80. package/dist/permissions/route-protection.server.d.ts +33 -0
  81. package/dist/permissions/route-protection.server.d.ts.map +1 -0
  82. package/dist/permissions/types.d.ts +44 -0
  83. package/dist/permissions/types.d.ts.map +1 -0
  84. package/dist/query-client/index.d.ts +8 -2
  85. package/dist/query-client/index.d.ts.map +1 -0
  86. package/dist/query-client/index.js +1 -1
  87. package/dist/query-client/query-config.d.ts +55 -0
  88. package/dist/query-client/query-config.d.ts.map +1 -0
  89. package/dist/query-client/types.d.ts +115 -0
  90. package/dist/query-client/types.d.ts.map +1 -0
  91. package/dist/{query-client-DRPQIKHX.js → query-client-Bpe08pk9.js} +1 -1
  92. package/dist/query-client-Bpe08pk9.js.map +1 -0
  93. package/dist/react-router/index.d.ts +9 -12
  94. package/dist/react-router/index.d.ts.map +1 -0
  95. package/dist/react-router/index.js +6 -5
  96. package/dist/react-router/server.d.ts +9 -18
  97. package/dist/react-router/server.d.ts.map +1 -0
  98. package/dist/react-router/server.js +13 -12
  99. package/dist/{redis-session-storage.server-DhufyPjd.js → redis-session-storage.server-BR_0y-QO.js} +2 -2
  100. package/dist/{redis-session-storage.server-DhufyPjd.js.map → redis-session-storage.server-BR_0y-QO.js.map} +1 -1
  101. package/dist/{server-CiSbg-9C.js → server-BHfKHKF_.js} +5 -5
  102. package/dist/{server-CiSbg-9C.js.map → server-BHfKHKF_.js.map} +1 -1
  103. package/dist/{server-C-DiVP9e.js → server-BxvRxjCK.js} +2 -2
  104. package/dist/{server-C-DiVP9e.js.map → server-BxvRxjCK.js.map} +1 -1
  105. package/dist/{server-iWm3oeCM.js → server-C3L8J7iE.js} +3 -2
  106. package/dist/server-C3L8J7iE.js.map +1 -0
  107. package/dist/{server-CNp6gjFE.js → server-CouYoZiw.js} +1 -1
  108. package/dist/{server-CNp6gjFE.js.map → server-CouYoZiw.js.map} +1 -1
  109. package/dist/server-DZmcd2Lr.js +422 -0
  110. package/dist/server-DZmcd2Lr.js.map +1 -0
  111. package/dist/server.d.ts +14 -18
  112. package/dist/server.d.ts.map +1 -0
  113. package/dist/server.js +13 -12
  114. package/dist/signalr/index.d.ts +8 -4
  115. package/dist/signalr/index.d.ts.map +1 -0
  116. package/dist/signalr/index.js +1 -1
  117. package/dist/signalr/signalr-client.d.ts +98 -0
  118. package/dist/signalr/signalr-client.d.ts.map +1 -0
  119. package/dist/signalr/types.d.ts +42 -0
  120. package/dist/signalr/types.d.ts.map +1 -0
  121. package/dist/{signalr-BJGcXc0m.js → signalr-SJ-1sIxw.js} +1 -1
  122. package/dist/{signalr-BJGcXc0m.js.map → signalr-SJ-1sIxw.js.map} +1 -1
  123. package/dist/tenant/index.d.ts +9 -3
  124. package/dist/tenant/index.d.ts.map +1 -0
  125. package/dist/tenant/server.d.ts +7 -3
  126. package/dist/tenant/server.d.ts.map +1 -0
  127. package/dist/tenant/server.js +2 -2
  128. package/dist/tenant/tenant-context.d.ts +45 -0
  129. package/dist/tenant/tenant-context.d.ts.map +1 -0
  130. package/dist/tenant/tenant-cookie.server.d.ts +35 -0
  131. package/dist/tenant/tenant-cookie.server.d.ts.map +1 -0
  132. package/dist/tenant/tenant-store.d.ts +58 -0
  133. package/dist/tenant/tenant-store.d.ts.map +1 -0
  134. package/dist/tenant/tenant.server.d.ts +49 -0
  135. package/dist/tenant/tenant.server.d.ts.map +1 -0
  136. package/dist/tenant/types.d.ts +51 -0
  137. package/dist/tenant/types.d.ts.map +1 -0
  138. package/dist/types-BnKaWdfe.js +8 -0
  139. package/dist/types-BnKaWdfe.js.map +1 -0
  140. package/package.json +2 -7
  141. package/dist/auth.server-DU-x2LPA.js +0 -5
  142. package/dist/index-BIJOC8Fb.d.ts +0 -272
  143. package/dist/index-BIJOC8Fb.d.ts.map +0 -1
  144. package/dist/index-Bt9XE6gj.d.ts +0 -104
  145. package/dist/index-Bt9XE6gj.d.ts.map +0 -1
  146. package/dist/index-C2hGpzGr.d.ts +0 -74
  147. package/dist/index-C2hGpzGr.d.ts.map +0 -1
  148. package/dist/index-CfQsb3l_.d.ts +0 -170
  149. package/dist/index-CfQsb3l_.d.ts.map +0 -1
  150. package/dist/index-D6RK_5vm.d.ts +0 -199
  151. package/dist/index-D6RK_5vm.d.ts.map +0 -1
  152. package/dist/index-DrttYPAj.d.ts +0 -30
  153. package/dist/index-DrttYPAj.d.ts.map +0 -1
  154. package/dist/index-geY2ynnN.d.ts +0 -141
  155. package/dist/index-geY2ynnN.d.ts.map +0 -1
  156. package/dist/index-kr8Wk7v5.d.ts +0 -1
  157. package/dist/query-client-DRPQIKHX.js.map +0 -1
  158. package/dist/server-BoeUiXSh.d.ts +0 -40
  159. package/dist/server-BoeUiXSh.d.ts.map +0 -1
  160. package/dist/server-CLbksnvg.d.ts +0 -144
  161. package/dist/server-CLbksnvg.d.ts.map +0 -1
  162. package/dist/server-CXGaRaiS.d.ts +0 -256
  163. package/dist/server-CXGaRaiS.d.ts.map +0 -1
  164. package/dist/server-DLgH3FRR.js +0 -312
  165. package/dist/server-DLgH3FRR.js.map +0 -1
  166. package/dist/server-DazqdM63.d.ts +0 -93
  167. package/dist/server-DazqdM63.d.ts.map +0 -1
  168. package/dist/server-iWm3oeCM.js.map +0 -1
  169. package/dist/server-zEKMDpP7.d.ts +0 -80
  170. package/dist/server-zEKMDpP7.d.ts.map +0 -1
  171. package/dist/types-BTjFzIhv.d.ts +0 -31
  172. package/dist/types-BTjFzIhv.d.ts.map +0 -1
  173. package/dist/types-DoIfDhl6.d.ts +0 -55
  174. package/dist/types-DoIfDhl6.d.ts.map +0 -1
  175. package/dist/types-DufLRY7A.d.ts +0 -164
  176. package/dist/types-DufLRY7A.d.ts.map +0 -1
  177. package/dist/types-uDrDMkCq.d.ts +0 -93
  178. package/dist/types-uDrDMkCq.d.ts.map +0 -1
  179. /package/dist/{src-D7mh9MKA.js → src-CJ2RLi94.js} +0 -0
package/dist/server.d.ts CHANGED
@@ -1,18 +1,14 @@
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 };
1
+ /**
2
+ * Spine - Server Exports
3
+ *
4
+ * Framework-agnostic server-side exports.
5
+ */
6
+ export * from './index';
7
+ export * from './auth/server';
8
+ export * from './tenant/server';
9
+ export * from './identity/server';
10
+ export * from './permissions/route-protection.server';
11
+ export * from './api-client/server';
12
+ export type { TokenRefreshResult as ApiTokenRefreshResult, TokenRefreshFn, } from './api-client/types';
13
+ export type { TokenRefreshResult as AuthTokenRefreshResult, } from './auth/types';
14
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,eAAe,CAAC;AAG9B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,uCAAuC,CAAC;AAGtD,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EACV,kBAAkB,IAAI,qBAAqB,EAC3C,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,IAAI,sBAAsB,GAC7C,MAAM,cAAc,CAAC"}
package/dist/server.js CHANGED
@@ -2,16 +2,17 @@ import { LOG_LEVEL_PRIORITY, LogLevel, Logger, createLogger, defaultLoggerConfig
2
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
3
  import { TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher } from "./tenant-C6KPaSCX.js";
4
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";
5
+ import { isApiClientError } from "./types-BnKaWdfe.js";
6
+ import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "./api-client-DsrxK05Z.js";
7
+ import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "./signalr-SJ-1sIxw.js";
8
+ import { cachePresets, createQueryClient, createQueryKeyFactory, invalidationHelpers } from "./query-client-Bpe08pk9.js";
9
+ import "./src-CJ2RLi94.js";
10
+ import { AUTH_ERROR_COOKIE_PREFIX, cleanupExpiredOAuthStates, closeRedisConnection, createAuthSession, createOAuthState, deleteOAuthState, destroyAuthSession, getAuthSession, getOAuthState, isSessionValid, requireAuthSession, updateAuthSession } from "./redis-session-storage.server-BR_0y-QO.js";
11
+ import { clearAuthErrorHeaders, clearAuthServerCache, configureAuthClaimMapping, extractUserInfo, getAccessToken, getAuthError, getUser, handleCallback, hasAuthError, login, logout, refreshTokens, requireAuth, resetAuthClaimMapping } from "./auth.server-Cx2h2qu3.js";
12
+ import { attemptTokenRefresh, authRoute, configureRouteProtection, isTokenExpiredResponse, onboardingRoute, protectRoute, publicRoute, resetRouteProtectionConfig, shouldAttemptTokenRefresh, shouldRefreshToken, subscriptionRoute } from "./server-BHfKHKF_.js";
13
+ import { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant } from "./server-BxvRxjCK.js";
14
+ import { clearIdentityContextCache, configureIdentityAPIFetcher, configurePermissionFetcher, contextToUserInfo, fetchIdentityContext, fetchUserPermissions, getIdentityContext, hasContextVersionChanged, updateContextVersion } from "./server-C3L8J7iE.js";
15
+ import { checkPermission, configurePermissionRouteProtection, requirePermission, resetPermissionRouteProtection, withPermission } from "./server-CouYoZiw.js";
16
+ import { createAPIConfigFactory, createApiClient, createFetchMiddleware } from "./server-DZmcd2Lr.js";
16
17
 
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 };
18
+ 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, createApiClient, createAuthSession, createFetchMiddleware, 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, isApiClientError, isRetryableError, isSessionValid, isTokenExpiredResponse, logger, login, logout, onboardingRoute, protectRoute, publicRoute, refreshTokens, requireAuth, requireAuthSession, requirePermission, resetAuthClaimMapping, resetIdentityStoreConfig, resetPermissionRouteProtection, resetRouteProtectionConfig, resetTenantCookieConfig, setActiveTenant, setCurrentTenant, 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 };
@@ -1,4 +1,8 @@
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 };
1
+ /**
2
+ * SignalR Module
3
+ *
4
+ * Real-time communication via SignalR.
5
+ */
6
+ export type { IdentityContextChangedEvent, IdentityContextChangeHandler, SignalREventHandler, SignalRConnectionState, SignalRClientConfig, } from './types';
7
+ export { SignalRClient, IdentitySignalRClient, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR, cleanupSignalR, } from './signalr-client';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signalr/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -1,3 +1,3 @@
1
- import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "../signalr-BJGcXc0m.js";
1
+ import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "../signalr-SJ-1sIxw.js";
2
2
 
3
3
  export { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR };
@@ -0,0 +1,98 @@
1
+ /**
2
+ * SignalR Client for Real-time Updates
3
+ *
4
+ * This client connects to SignalR hub and listens for real-time events.
5
+ * Supports identity context changes, permissions updates, etc.
6
+ */
7
+ import type { SignalRClientConfig, SignalRConnectionState, SignalREventHandler, IdentityContextChangeHandler } from './types';
8
+ /**
9
+ * SignalR Client Class
10
+ *
11
+ * Generic SignalR client that can be used for any hub connection.
12
+ */
13
+ export declare class SignalRClient {
14
+ private connection;
15
+ private accessToken;
16
+ private isConnecting;
17
+ private reconnectAttempts;
18
+ private config;
19
+ private eventHandlers;
20
+ private visibilityHandler;
21
+ constructor(config: SignalRClientConfig);
22
+ /**
23
+ * Connect to SignalR hub
24
+ */
25
+ connect(accessToken: string | null): Promise<void>;
26
+ /**
27
+ * Build hub URL
28
+ */
29
+ private buildHubUrl;
30
+ /**
31
+ * Setup connection lifecycle handlers
32
+ */
33
+ private setupConnectionHandlers;
34
+ /**
35
+ * Disconnect from SignalR hub
36
+ */
37
+ disconnect(): Promise<void>;
38
+ /**
39
+ * Register event handler
40
+ */
41
+ on<T = unknown>(eventName: string, handler: SignalREventHandler<T>): () => void;
42
+ /**
43
+ * Invoke hub method
44
+ */
45
+ invoke<T = void>(methodName: string, ...args: unknown[]): Promise<T>;
46
+ /**
47
+ * Get current connection state
48
+ */
49
+ get connectionState(): SignalRConnectionState;
50
+ /**
51
+ * Check if connected
52
+ */
53
+ get isConnected(): boolean;
54
+ /**
55
+ * Get connection ID
56
+ */
57
+ get connectionId(): string | null;
58
+ /**
59
+ * Cleanup resources
60
+ */
61
+ dispose(): void;
62
+ /**
63
+ * Log message
64
+ */
65
+ private log;
66
+ }
67
+ /**
68
+ * Create Identity SignalR Client
69
+ *
70
+ * Factory function to create a SignalR client for identity hub.
71
+ */
72
+ export declare function createIdentitySignalRClient(options?: Omit<SignalRClientConfig, 'hubPath'>): SignalRClient;
73
+ /**
74
+ * Identity SignalR Client
75
+ *
76
+ * Specialized client for identity context changes.
77
+ */
78
+ export declare class IdentitySignalRClient extends SignalRClient {
79
+ private identityHandlers;
80
+ constructor(options?: Omit<SignalRClientConfig, 'hubPath'>);
81
+ /**
82
+ * Add handler for identity context changes
83
+ */
84
+ onIdentityContextChanged(handler: IdentityContextChangeHandler): () => void;
85
+ }
86
+ /**
87
+ * Get or create singleton identity SignalR client
88
+ */
89
+ export declare function getIdentitySignalRClient(options?: Omit<SignalRClientConfig, 'hubPath'>): IdentitySignalRClient;
90
+ /**
91
+ * Initialize SignalR with access token
92
+ */
93
+ export declare function initializeSignalR(accessToken: string | null, options?: Omit<SignalRClientConfig, 'hubPath'>): Promise<IdentitySignalRClient>;
94
+ /**
95
+ * Cleanup SignalR connection
96
+ */
97
+ export declare function cleanupSignalR(): Promise<void>;
98
+ //# sourceMappingURL=signalr-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signalr-client.d.ts","sourceRoot":"","sources":["../../src/signalr/signalr-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EAEnB,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAYjB;;;;GAIG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,MAAM,CAAwE;IACtF,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,iBAAiB,CAA6B;gBAE1C,MAAM,EAAE,mBAAmB;IAkBvC;;OAEG;IACG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA0ExD;;OAEG;IACH,OAAO,CAAC,WAAW;IAcnB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAqC/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CA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+ * SignalR Types
3
+ */
4
+ export type { IdentityContextChangedEvent, IdentityContextChangeHandler } from '../identity/types';
5
+ /**
6
+ * Generic SignalR event handler
7
+ */
8
+ export type SignalREventHandler<T = unknown> = (event: T) => void;
9
+ /**
10
+ * SignalR connection state
11
+ */
12
+ export type SignalRConnectionState = 'Connecting' | 'Connected' | 'Reconnecting' | 'Disconnected';
13
+ /**
14
+ * SignalR client configuration
15
+ */
16
+ export interface SignalRClientConfig {
17
+ /**
18
+ * Base URL for SignalR hub (defaults to API base URL)
19
+ */
20
+ baseUrl?: string;
21
+ /**
22
+ * Hub path (e.g., '/hubs/identity')
23
+ */
24
+ hubPath: string;
25
+ /**
26
+ * Maximum reconnect attempts
27
+ */
28
+ maxReconnectAttempts?: number;
29
+ /**
30
+ * Initial reconnect delay in ms
31
+ */
32
+ reconnectDelay?: number;
33
+ /**
34
+ * Whether to enable verbose logging
35
+ */
36
+ verbose?: boolean;
37
+ /**
38
+ * Whether to auto-reconnect on page visibility change
39
+ */
40
+ autoReconnectOnVisibility?: boolean;
41
+ }
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/signalr/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC9B,YAAY,GACZ,WAAW,GACX,cAAc,GACd,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC"}
@@ -271,4 +271,4 @@ async function cleanupSignalR() {
271
271
 
272
272
  //#endregion
273
273
  export { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR };
274
- //# sourceMappingURL=signalr-BJGcXc0m.js.map
274
+ //# sourceMappingURL=signalr-SJ-1sIxw.js.map
@@ -1 +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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alr-SJ-1sIxw.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;AACvF,UAAK,IAAI,qDAAqD;AAC9D,UAAK,QAAQ,KAAK,YAAY;IAC/B;GACF;AACD,YAAS,iBAAiB,oBAAoB,KAAK,kBAAkB;EACtE;CACF;;;;CAKD,MAAM,QAAQC,aAA2C;AACvD,OAAK,aAAa;AAChB,QAAK,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AgC,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"}
@@ -1,3 +1,9 @@
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 };
1
+ /**
2
+ * Tenant Module - Client-side exports
3
+ *
4
+ * Multi-tenancy support with React context and hooks.
5
+ */
6
+ export * from './types';
7
+ export * from './tenant-store';
8
+ export * from './tenant-context';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenant/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
@@ -1,3 +1,7 @@
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 };
1
+ /**
2
+ * Tenant Module - Server-side exports
3
+ */
4
+ export * from './tenant.server';
5
+ export * from './tenant-cookie.server';
6
+ export * from './types';
7
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/tenant/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
@@ -1,5 +1,5 @@
1
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";
2
+ import "../redis-session-storage.server-BR_0y-QO.js";
3
+ import { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant } from "../server-BxvRxjCK.js";
4
4
 
5
5
  export { clearActiveTenant, clearCurrentTenant, configureIdentityContextFetcher, configureTenantCookie, getActiveTenant, getAvailableTenants, getCurrentTenant, getTenantFromIdentityContext, initializeTenant, resetTenantCookieConfig, setActiveTenant, setCurrentTenant };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Tenant Context Provider
3
+ *
4
+ * React context for tenant management.
5
+ */
6
+ import { type ReactNode } from 'react';
7
+ import type { OrganizationData, TenantContextType, TenantMembership } from './types';
8
+ interface TenantProviderProps {
9
+ children: ReactNode;
10
+ initialTenant?: string | null;
11
+ initialTenants?: string[];
12
+ initialMemberships?: TenantMembership[];
13
+ onTenantChange?: () => void;
14
+ }
15
+ export declare function TenantProvider({ children, initialTenant, initialTenants, initialMemberships, onTenantChange, }: TenantProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * Hook for using tenant context
18
+ */
19
+ export declare function useTenant(): TenantContextType;
20
+ /**
21
+ * Hook for current tenant only
22
+ */
23
+ export declare function useCurrentTenant(): string | null;
24
+ /**
25
+ * Hook for tenant switching
26
+ */
27
+ export declare function useTenantSwitcher(): {
28
+ switchTenant: (tenantId: string) => void;
29
+ isLoading: boolean;
30
+ availableTenants: string[];
31
+ };
32
+ /**
33
+ * Hook for current organization
34
+ */
35
+ export declare function useCurrentOrganization(): OrganizationData | null;
36
+ /**
37
+ * Hook for organization operations
38
+ */
39
+ export declare function useOrganization(): {
40
+ organization: OrganizationData | null;
41
+ refreshOrganization: () => void;
42
+ isLoading: boolean;
43
+ };
44
+ export {};
45
+ //# sourceMappingURL=tenant-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-context.d.ts","sourceRoot":"","sources":["../../src/tenant/tenant-context.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIrF,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,aAAoB,EACpB,cAAmB,EACnB,kBAAuB,EACvB,cAAc,GACf,EAAE,mBAAmB,2CA+GrB;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,iBAAiB,CAQ7C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAGhD;AAED;;GAEG;AACH,wBAAgB,iBAAiB;;;;EAGhC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,GAAG,IAAI,CAGhE;AAED;;GAEG;AACH,wBAAgB,eAAe;;;;EAQ9B"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Tenant Cookie Server Module
3
+ *
4
+ * Cookie-based tenant storage.
5
+ */
6
+ export type TenantCookieSameSite = 'Strict' | 'Lax' | 'None';
7
+ export interface TenantCookieConfig {
8
+ name?: string;
9
+ maxAge?: number;
10
+ path?: string;
11
+ secure?: boolean;
12
+ httpOnly?: boolean;
13
+ sameSite?: TenantCookieSameSite;
14
+ }
15
+ /**
16
+ * Get active tenant from cookie
17
+ */
18
+ export declare function getActiveTenant(request: Request): Promise<string | null>;
19
+ /**
20
+ * Set active tenant cookie value
21
+ */
22
+ export declare function setActiveTenant(tenantId: string): Promise<string>;
23
+ /**
24
+ * Clear active tenant cookie value
25
+ */
26
+ export declare function clearActiveTenant(): Promise<string>;
27
+ /**
28
+ * Configure tenant cookie name
29
+ */
30
+ export declare function configureTenantCookie(config: TenantCookieConfig): void;
31
+ /**
32
+ * Reset tenant cookie config back to defaults.
33
+ */
34
+ export declare function resetTenantCookieConfig(): void;
35
+ //# sourceMappingURL=tenant-cookie.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-cookie.server.d.ts","sourceRoot":"","sources":["../../src/tenant/tenant-cookie.server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC;AAmBD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAS9E;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKvE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAKtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAI9C"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Tenant Store (Zustand)
3
+ *
4
+ * Client-side state management for tenant and organization data.
5
+ */
6
+ import type { OrganizationData, TenantMembership } from './types';
7
+ interface TenantState {
8
+ currentTenant: string | null;
9
+ availableTenants: string[];
10
+ memberships: Map<string, TenantMembership>;
11
+ organizations: Map<string, OrganizationData>;
12
+ isLoading: boolean;
13
+ isSwitching: boolean;
14
+ setCurrentTenant: (tenantId: string | null) => void;
15
+ setAvailableTenants: (tenants: string[]) => void;
16
+ setMemberships: (memberships: TenantMembership[]) => void;
17
+ setOrganization: (tenantId: string, data: OrganizationData) => void;
18
+ addOrganization: (tenantId: string, data: OrganizationData) => void;
19
+ setLoading: (loading: boolean) => void;
20
+ setSwitching: (switching: boolean) => void;
21
+ fetchOrganization: (tenantId: string) => Promise<void>;
22
+ switchTenant: (tenantId: string) => Promise<void>;
23
+ getMembership: (tenantId: string) => TenantMembership | null;
24
+ getCurrentMembership: () => TenantMembership | null;
25
+ getTenantName: (tenantId: string) => string;
26
+ getOrganization: (tenantId: string) => OrganizationData | null;
27
+ getCurrentOrganization: () => OrganizationData | null;
28
+ }
29
+ /**
30
+ * Configure tenant store endpoints
31
+ */
32
+ export declare function configureTenantEndpoints(config: {
33
+ organizationEndpoint?: string;
34
+ tenantSwitchEndpoint?: string;
35
+ }): void;
36
+ export declare const useTenantStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TenantState>, "setState" | "devtools"> & {
37
+ setState(partial: TenantState | Partial<TenantState> | ((state: TenantState) => TenantState | Partial<TenantState>), replace?: false | undefined, action?: (string | {
38
+ [x: string]: unknown;
39
+ [x: number]: unknown;
40
+ [x: symbol]: unknown;
41
+ type: string;
42
+ }) | undefined): void;
43
+ setState(state: TenantState | ((state: TenantState) => TenantState), replace: true, action?: (string | {
44
+ [x: string]: unknown;
45
+ [x: number]: unknown;
46
+ [x: symbol]: unknown;
47
+ type: string;
48
+ }) | undefined): void;
49
+ devtools: {
50
+ cleanup: () => void;
51
+ };
52
+ }>;
53
+ /**
54
+ * Initialize store with server data
55
+ */
56
+ export declare function initializeTenantStore(currentTenant: string | null, availableTenants: string[], memberships?: TenantMembership[]): void;
57
+ export {};
58
+ //# sourceMappingURL=tenant-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant-store.d.ts","sourceRoot":"","sources":["../../src/tenant/tenant-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElE,UAAU,WAAW;IAEnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IAGrB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpD,mBAAmB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACjD,cAAc,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IAC1D,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CA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