@jmruthers/pace-core 0.5.190 → 0.5.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-IVYljGJ6.d.ts → DataTable-Be6dH_dR.d.ts} +1 -1
- package/dist/{DataTable-ON3IXISJ.js → DataTable-WKRZD47S.js} +6 -6
- package/dist/{PublicPageProvider-C4uxosp6.d.ts → PublicPageProvider-ULXC_u6U.d.ts} +1 -1
- package/dist/{UnifiedAuthProvider-X5NXANVI.js → UnifiedAuthProvider-FTSG5XH7.js} +3 -3
- package/dist/{api-I6UCQ5S6.js → api-IHKALJZD.js} +2 -2
- package/dist/{chunk-J2XXC7R5.js → chunk-6LTQQAT6.js} +77 -111
- package/dist/chunk-6LTQQAT6.js.map +1 -0
- package/dist/{chunk-STYK4OH2.js → chunk-6TQDD426.js} +10 -10
- package/dist/chunk-6TQDD426.js.map +1 -0
- package/dist/{chunk-DZWK57KZ.js → chunk-G37KK66H.js} +1 -1
- package/dist/{chunk-DZWK57KZ.js.map → chunk-G37KK66H.js.map} +1 -1
- package/dist/{chunk-73HSNNOQ.js → chunk-LOMZXPSN.js} +13 -13
- package/dist/{chunk-Y4BUBBHD.js → chunk-OETXORNB.js} +3 -3
- package/dist/{chunk-RUYZKXOD.js → chunk-ROXMHMY2.js} +5 -3
- package/dist/chunk-ROXMHMY2.js.map +1 -0
- package/dist/{chunk-SDMHPX3X.js → chunk-ULHIJK66.js} +56 -21
- package/dist/{chunk-SDMHPX3X.js.map → chunk-ULHIJK66.js.map} +1 -1
- package/dist/{chunk-VVBAW5A5.js → chunk-VKB2CO4Z.js} +46 -35
- package/dist/chunk-VKB2CO4Z.js.map +1 -0
- package/dist/{chunk-HQVPB5MZ.js → chunk-VRGWKHDB.js} +6 -6
- package/dist/{chunk-NIU6J6OX.js → chunk-XNYQOL3Z.js} +16 -16
- package/dist/chunk-XNYQOL3Z.js.map +1 -0
- package/dist/{chunk-4QYC5L4K.js → chunk-XYXSXPUK.js} +22 -27
- package/dist/chunk-XYXSXPUK.js.map +1 -0
- package/dist/components.d.ts +3 -3
- package/dist/components.js +8 -8
- package/dist/{database.generated-DI89OQeI.d.ts → database.generated-CzIvgcPu.d.ts} +165 -201
- package/dist/hooks.d.ts +12 -12
- package/dist/hooks.js +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +18 -23
- package/dist/index.js.map +1 -1
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +1 -1
- package/dist/rbac/index.js +6 -6
- package/dist/{types-Bwgl--Xo.d.ts → types-CEpcvwwF.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/{usePublicRouteParams-DxIDS4bC.d.ts → usePublicRouteParams-TZe0gy-4.d.ts} +1 -1
- package/dist/utils.d.ts +8 -8
- package/dist/utils.js +2 -2
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/Logger.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +5 -5
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +1 -1
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AddressFieldProps.md +1 -1
- package/docs/api/interfaces/AddressFieldRef.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/AutocompleteOptions.md +1 -1
- package/docs/api/interfaces/AvatarProps.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/ComplianceResult.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/DatabaseComplianceResult.md +1 -1
- package/docs/api/interfaces/DatabaseIssue.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoggerConfig.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +2 -2
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/QuickFix.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +2 -2
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/RuntimeComplianceResult.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseFormDialogOptions.md +1 -1
- package/docs/api/interfaces/UseFormDialogReturn.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +16 -16
- package/docs/migration/README.md +18 -0
- package/docs/migration/database-changes-december-2025.md +767 -0
- package/docs/migration/person-scoped-profiles-migration-guide.md +472 -0
- package/package.json +1 -1
- package/src/__tests__/public-recipe-view.test.ts +10 -10
- package/src/__tests__/rls-policies.test.ts +13 -13
- package/src/components/AddressField/README.md +6 -6
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +35 -15
- package/src/components/Select/Select.test.tsx +4 -1
- package/src/components/Select/Select.tsx +60 -15
- package/src/hooks/__tests__/usePermissionCache.simple.test.ts +192 -0
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +741 -0
- package/src/hooks/__tests__/usePublicEvent.simple.test.ts +703 -0
- package/src/hooks/__tests__/usePublicEvent.unit.test.ts +581 -0
- package/src/hooks/__tests__/useSecureDataAccess.unit.test.tsx +9 -8
- package/src/hooks/public/usePublicEvent.ts +8 -8
- package/src/hooks/public/usePublicFileDisplay.ts +2 -2
- package/src/hooks/useFileDisplay.ts +8 -9
- package/src/hooks/useQueryCache.ts +6 -6
- package/src/hooks/useSecureDataAccess.test.ts +8 -8
- package/src/hooks/useSecureDataAccess.ts +15 -11
- package/src/providers/__tests__/OrganisationProvider.test.tsx +27 -21
- package/src/rbac/hooks/useRBAC.simple.test.ts +95 -0
- package/src/rbac/utils/__tests__/eventContext.test.ts +2 -2
- package/src/rbac/utils/__tests__/eventContext.unit.test.ts +490 -0
- package/src/rbac/utils/eventContext.ts +5 -2
- package/src/services/AuthService.ts +37 -8
- package/src/services/OrganisationService.ts +92 -139
- package/src/services/__tests__/OrganisationService.pagination.test.ts +34 -8
- package/src/services/__tests__/OrganisationService.test.ts +218 -86
- package/src/types/database.generated.ts +166 -201
- package/src/types/supabase.ts +2 -2
- package/src/utils/__tests__/secureDataAccess.unit.test.ts +3 -2
- package/src/utils/file-reference/index.ts +4 -4
- package/src/utils/google-places/googlePlacesUtils.ts +1 -1
- package/src/utils/google-places/types.ts +1 -1
- package/src/utils/request-deduplication.ts +4 -4
- package/src/utils/security/secureDataAccess.test.ts +1 -1
- package/src/utils/security/secureDataAccess.ts +7 -4
- package/src/utils/storage/README.md +1 -1
- package/dist/chunk-4QYC5L4K.js.map +0 -1
- package/dist/chunk-J2XXC7R5.js.map +0 -1
- package/dist/chunk-NIU6J6OX.js.map +0 -1
- package/dist/chunk-RUYZKXOD.js.map +0 -1
- package/dist/chunk-STYK4OH2.js.map +0 -1
- package/dist/chunk-VVBAW5A5.js.map +0 -1
- /package/dist/{DataTable-ON3IXISJ.js.map → DataTable-WKRZD47S.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-X5NXANVI.js.map → UnifiedAuthProvider-FTSG5XH7.js.map} +0 -0
- /package/dist/{api-I6UCQ5S6.js.map → api-IHKALJZD.js.map} +0 -0
- /package/dist/{chunk-73HSNNOQ.js.map → chunk-LOMZXPSN.js.map} +0 -0
- /package/dist/{chunk-Y4BUBBHD.js.map → chunk-OETXORNB.js.map} +0 -0
- /package/dist/{chunk-HQVPB5MZ.js.map → chunk-VRGWKHDB.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { d as DataRecord, D as DataTableColumn, e as DataTableRBACConfig, f as DataTableFeatureConfig, H as HierarchicalConfig, g as PerformanceConfig, S as ServerSideConfig, h as PaginationMode, C as ChunkingConfig, i as SearchIndexConfig, j as ExportOptions, G as GetRowId, E as EmptyStateConfig, c as AggregateConfig, a as DataTableAction } from './types-
|
|
2
|
+
import { d as DataRecord, D as DataTableColumn, e as DataTableRBACConfig, f as DataTableFeatureConfig, H as HierarchicalConfig, g as PerformanceConfig, S as ServerSideConfig, h as PaginationMode, C as ChunkingConfig, i as SearchIndexConfig, j as ExportOptions, G as GetRowId, E as EmptyStateConfig, c as AggregateConfig, a as DataTableAction } from './types-CEpcvwwF.js';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -60,8 +60,8 @@ import {
|
|
|
60
60
|
sum,
|
|
61
61
|
validateHierarchicalData,
|
|
62
62
|
validatePaginationConfig
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import "./chunk-
|
|
63
|
+
} from "./chunk-ULHIJK66.js";
|
|
64
|
+
import "./chunk-VRGWKHDB.js";
|
|
65
65
|
import {
|
|
66
66
|
CircuitBreaker,
|
|
67
67
|
DEFAULT_FALLBACK_CONFIG,
|
|
@@ -80,9 +80,9 @@ import {
|
|
|
80
80
|
throttle,
|
|
81
81
|
useDataTablePerformance
|
|
82
82
|
} from "./chunk-6C4YBBJM.js";
|
|
83
|
-
import "./chunk-
|
|
84
|
-
import "./chunk-
|
|
85
|
-
import "./chunk-
|
|
83
|
+
import "./chunk-OETXORNB.js";
|
|
84
|
+
import "./chunk-6LTQQAT6.js";
|
|
85
|
+
import "./chunk-ROXMHMY2.js";
|
|
86
86
|
import "./chunk-63FOKYGO.js";
|
|
87
87
|
import "./chunk-QXHPKYJV.js";
|
|
88
88
|
import "./chunk-R77UEZ4E.js";
|
|
@@ -169,4 +169,4 @@ export {
|
|
|
169
169
|
validateHierarchicalData,
|
|
170
170
|
validatePaginationConfig
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=DataTable-
|
|
172
|
+
//# sourceMappingURL=DataTable-WKRZD47S.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { Component, ReactNode } from 'react';
|
|
3
|
-
import { P as ParsedAddress, A as AutocompleteOptions } from './types-
|
|
3
|
+
import { P as ParsedAddress, A as AutocompleteOptions } from './types-CEpcvwwF.js';
|
|
4
4
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
5
5
|
import { F as FileCategory, e as FileUploadResult, U as UploadProgress, c as FileUploadOptions, a as FileReference } from './file-reference-BavO2eQj.js';
|
|
6
6
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
UnifiedAuthContext,
|
|
3
3
|
UnifiedAuthProvider,
|
|
4
4
|
useUnifiedAuth
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-6LTQQAT6.js";
|
|
6
|
+
import "./chunk-ROXMHMY2.js";
|
|
7
7
|
import "./chunk-63FOKYGO.js";
|
|
8
8
|
import "./chunk-QXHPKYJV.js";
|
|
9
9
|
import "./chunk-VBXEHIUJ.js";
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
UnifiedAuthProvider,
|
|
15
15
|
useUnifiedAuth
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=UnifiedAuthProvider-
|
|
17
|
+
//# sourceMappingURL=UnifiedAuthProvider-FTSG5XH7.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isSuperAdmin,
|
|
22
22
|
resolveAppContext,
|
|
23
23
|
setupRBAC
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ROXMHMY2.js";
|
|
25
25
|
import "./chunk-63FOKYGO.js";
|
|
26
26
|
import "./chunk-PWLANIRT.js";
|
|
27
27
|
import "./chunk-7D4SUZUM.js";
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
resolveAppContext,
|
|
50
50
|
setupRBAC
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=api-
|
|
52
|
+
//# sourceMappingURL=api-IHKALJZD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAppConfigByName,
|
|
3
3
|
isSuperAdmin
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ROXMHMY2.js";
|
|
5
5
|
import {
|
|
6
6
|
assertOrganisationId,
|
|
7
7
|
assertUserId
|
|
@@ -319,6 +319,8 @@ var AuthService = class extends BaseService {
|
|
|
319
319
|
// Lifecycle methods
|
|
320
320
|
async initialize() {
|
|
321
321
|
await super.initialize();
|
|
322
|
+
this.authLoading = true;
|
|
323
|
+
this.notify();
|
|
322
324
|
await this.setupAuthStateListener();
|
|
323
325
|
await this.restoreSession();
|
|
324
326
|
}
|
|
@@ -424,13 +426,15 @@ var AuthService = class extends BaseService {
|
|
|
424
426
|
const hasTimeoutError = this.sessionRestorationState.restorationError?.name === "SessionRestorationTimeoutError";
|
|
425
427
|
if (this.sessionRestorationState.isRestoring || this.sessionRestorationState.restorationError || hasTimeoutError && session) {
|
|
426
428
|
this.finishSessionRestoration();
|
|
427
|
-
|
|
429
|
+
}
|
|
430
|
+
} else {
|
|
431
|
+
if (this.sessionRestorationState.isRestoring) {
|
|
432
|
+
this.finishSessionRestoration();
|
|
428
433
|
}
|
|
429
434
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
435
|
+
this.authLoading = false;
|
|
436
|
+
this.notify();
|
|
437
|
+
return;
|
|
434
438
|
}
|
|
435
439
|
this.authLoading = false;
|
|
436
440
|
this.notify();
|
|
@@ -491,7 +495,12 @@ var AuthService = class extends BaseService {
|
|
|
491
495
|
this.user = null;
|
|
492
496
|
this.authError = null;
|
|
493
497
|
}
|
|
494
|
-
|
|
498
|
+
setTimeout(() => {
|
|
499
|
+
if (this.sessionRestorationState.isRestoring && !this.sessionRestorationState.restorationComplete) {
|
|
500
|
+
logger.debug("AuthService", "INITIAL_SESSION event did not fire, finishing restoration");
|
|
501
|
+
this.finishSessionRestoration();
|
|
502
|
+
}
|
|
503
|
+
}, 100);
|
|
495
504
|
} catch (error) {
|
|
496
505
|
const restorationError = error instanceof Error ? error : new Error("Unknown error during auth initialization");
|
|
497
506
|
logger.error("AuthService", "Error during auth initialization:", restorationError);
|
|
@@ -859,118 +868,80 @@ var OrganisationService = class extends BaseService {
|
|
|
859
868
|
this._error = null;
|
|
860
869
|
this.notify();
|
|
861
870
|
try {
|
|
862
|
-
let memberships, membershipError;
|
|
871
|
+
let memberships, membershipError, organisations = [];
|
|
863
872
|
try {
|
|
864
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
865
|
-
const timeoutId = setTimeout(() => reject(new Error("RPC call timeout after 10 seconds")), 1e4);
|
|
866
|
-
abortSignal.addEventListener("abort", () => {
|
|
867
|
-
clearTimeout(timeoutId);
|
|
868
|
-
reject(new Error("Request aborted"));
|
|
869
|
-
});
|
|
870
|
-
});
|
|
871
|
-
const rpcPromise = this.supabaseClient.rpc("data_user_organisation_roles_get", {
|
|
872
|
-
p_user_id: this.user.id,
|
|
873
|
-
p_organisation_id: null
|
|
874
|
-
});
|
|
875
873
|
if (abortSignal.aborted) {
|
|
876
874
|
throw new Error("Request aborted");
|
|
877
875
|
}
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
876
|
+
const { data: rolesData, error: rolesError } = await this.supabaseClient.from("rbac_organisation_roles").select(`
|
|
877
|
+
id,
|
|
878
|
+
user_id,
|
|
879
|
+
organisation_id,
|
|
880
|
+
role,
|
|
881
|
+
status,
|
|
882
|
+
granted_at,
|
|
883
|
+
granted_by,
|
|
884
|
+
revoked_at,
|
|
885
|
+
revoked_by,
|
|
886
|
+
notes,
|
|
887
|
+
created_at,
|
|
888
|
+
updated_at,
|
|
889
|
+
core_organisations!inner(
|
|
890
|
+
id,
|
|
891
|
+
name,
|
|
892
|
+
display_name,
|
|
893
|
+
subscription_tier,
|
|
894
|
+
settings,
|
|
895
|
+
is_active,
|
|
896
|
+
parent_id,
|
|
897
|
+
created_at,
|
|
898
|
+
updated_at
|
|
899
|
+
)
|
|
900
|
+
`).eq("user_id", this.user.id).eq("status", "active").is("revoked_at", null);
|
|
901
|
+
if (rolesError) {
|
|
902
|
+
logger.error("OrganisationService", "Error loading organisation roles:", rolesError);
|
|
903
|
+
throw rolesError;
|
|
904
|
+
}
|
|
905
|
+
memberships = rolesData?.map((m) => ({
|
|
882
906
|
...m,
|
|
883
907
|
user_id: assertUserId(m.user_id),
|
|
884
908
|
organisation_id: assertOrganisationId(m.organisation_id)
|
|
885
909
|
})) || [];
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
role,
|
|
902
|
-
status,
|
|
903
|
-
granted_at,
|
|
904
|
-
granted_by,
|
|
905
|
-
revoked_at,
|
|
906
|
-
revoked_by,
|
|
907
|
-
notes,
|
|
908
|
-
created_at,
|
|
909
|
-
updated_at,
|
|
910
|
-
organisations!inner(
|
|
911
|
-
id,
|
|
912
|
-
name,
|
|
913
|
-
display_name,
|
|
914
|
-
subscription_tier,
|
|
915
|
-
settings,
|
|
916
|
-
is_active,
|
|
917
|
-
parent_id,
|
|
918
|
-
created_at,
|
|
919
|
-
updated_at
|
|
920
|
-
)
|
|
921
|
-
`).eq("user_id", this.user.id).eq("status", "active").is("revoked_at", null).in("role", ["org_admin", "leader", "member", "supporter"]);
|
|
922
|
-
if (fallbackError) {
|
|
923
|
-
logger.error("OrganisationService", "Fallback query also failed:", fallbackError);
|
|
924
|
-
throw membershipError;
|
|
925
|
-
}
|
|
926
|
-
memberships = fallbackData?.map((m) => ({
|
|
927
|
-
...m,
|
|
928
|
-
user_id: assertUserId(m.user_id),
|
|
929
|
-
organisation_id: assertOrganisationId(m.organisation_id)
|
|
930
|
-
})) || [];
|
|
931
|
-
membershipError = null;
|
|
932
|
-
} catch (fallbackErr) {
|
|
933
|
-
logger.error("OrganisationService", "Fallback query failed:", fallbackErr);
|
|
934
|
-
throw membershipError;
|
|
910
|
+
const organisationsMap = /* @__PURE__ */ new Map();
|
|
911
|
+
rolesData?.forEach((role) => {
|
|
912
|
+
const orgData = role.core_organisations;
|
|
913
|
+
if (orgData && role.organisation_id && !organisationsMap.has(role.organisation_id)) {
|
|
914
|
+
organisationsMap.set(role.organisation_id, {
|
|
915
|
+
id: orgData.id,
|
|
916
|
+
name: orgData.name,
|
|
917
|
+
display_name: orgData.display_name,
|
|
918
|
+
subscription_tier: orgData.subscription_tier,
|
|
919
|
+
settings: orgData.settings,
|
|
920
|
+
is_active: orgData.is_active,
|
|
921
|
+
parent_id: orgData.parent_id,
|
|
922
|
+
created_at: orgData.created_at,
|
|
923
|
+
updated_at: orgData.updated_at
|
|
924
|
+
});
|
|
935
925
|
}
|
|
926
|
+
});
|
|
927
|
+
organisations = Array.from(organisationsMap.values());
|
|
928
|
+
} catch (queryError) {
|
|
929
|
+
if (queryError instanceof Error) {
|
|
930
|
+
membershipError = queryError;
|
|
931
|
+
} else if (queryError && typeof queryError === "object" && "message" in queryError) {
|
|
932
|
+
membershipError = new Error(String(queryError.message));
|
|
936
933
|
} else {
|
|
937
|
-
|
|
934
|
+
membershipError = new Error(String(queryError));
|
|
938
935
|
}
|
|
936
|
+
logger.error("OrganisationService", "Error loading organisation roles:", membershipError);
|
|
937
|
+
throw membershipError;
|
|
939
938
|
}
|
|
940
939
|
if (!memberships || memberships.length === 0) {
|
|
941
940
|
throw new Error("User has no active organisation memberships");
|
|
942
941
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
logger.warn("OrganisationService", "Invalid organisation ID (not string):", id);
|
|
946
|
-
return false;
|
|
947
|
-
}
|
|
948
|
-
const trimmedId = id.trim();
|
|
949
|
-
if (trimmedId === "") {
|
|
950
|
-
logger.warn("OrganisationService", "Empty organisation ID found");
|
|
951
|
-
return false;
|
|
952
|
-
}
|
|
953
|
-
const isValidUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(trimmedId);
|
|
954
|
-
if (!isValidUuid) {
|
|
955
|
-
logger.warn("OrganisationService", "Invalid UUID format:", trimmedId);
|
|
956
|
-
}
|
|
957
|
-
return isValidUuid;
|
|
958
|
-
});
|
|
959
|
-
if (organisationIds.length === 0) {
|
|
960
|
-
logger.warn("OrganisationService", "No valid organisation IDs found in memberships:", memberships);
|
|
961
|
-
throw new Error("No valid organisation IDs found in memberships");
|
|
962
|
-
}
|
|
963
|
-
if (abortSignal.aborted) {
|
|
964
|
-
throw new Error("Request aborted");
|
|
965
|
-
}
|
|
966
|
-
const { data: allOrganisations, error: orgError } = await this.supabaseClient.from("organisations").select("id, name, display_name, subscription_tier, settings, is_active, parent_id, created_at, updated_at");
|
|
967
|
-
if (orgError) {
|
|
968
|
-
logger.error("OrganisationService", "Error loading organisations:", orgError);
|
|
969
|
-
throw orgError;
|
|
942
|
+
if (!organisations || organisations.length === 0) {
|
|
943
|
+
throw new Error("No organisations found in role data");
|
|
970
944
|
}
|
|
971
|
-
const organisations = allOrganisations?.filter(
|
|
972
|
-
(org) => organisationIds.includes(org.id)
|
|
973
|
-
) || [];
|
|
974
945
|
const roleMap = /* @__PURE__ */ new Map();
|
|
975
946
|
memberships?.forEach((membership) => {
|
|
976
947
|
roleMap.set(membership.organisation_id, membership.role);
|
|
@@ -995,16 +966,13 @@ var OrganisationService = class extends BaseService {
|
|
|
995
966
|
initialOrg = validPersistedOrg;
|
|
996
967
|
selectionMethod = "persisted";
|
|
997
968
|
} else {
|
|
998
|
-
logger.warn("OrganisationService", "Persisted organisation not found in active orgs, clearing cache");
|
|
999
969
|
localStorage.removeItem("pace-core-selected-organisation");
|
|
1000
970
|
}
|
|
1001
971
|
} else {
|
|
1002
|
-
logger.warn("OrganisationService", "Invalid persisted organisation ID, clearing cache");
|
|
1003
972
|
localStorage.removeItem("pace-core-selected-organisation");
|
|
1004
973
|
}
|
|
1005
974
|
}
|
|
1006
975
|
} catch (storageError) {
|
|
1007
|
-
logger.warn("OrganisationService", "Failed to restore persisted organisation:", storageError);
|
|
1008
976
|
localStorage.removeItem("pace-core-selected-organisation");
|
|
1009
977
|
}
|
|
1010
978
|
if (!initialOrg) {
|
|
@@ -1039,9 +1007,7 @@ var OrganisationService = class extends BaseService {
|
|
|
1039
1007
|
this.hasFailedRef = false;
|
|
1040
1008
|
} catch (err) {
|
|
1041
1009
|
const error = err;
|
|
1042
|
-
if (error.message
|
|
1043
|
-
logger.warn("OrganisationService", "User has no active organisations (this is expected for users without organisation access):", error);
|
|
1044
|
-
} else {
|
|
1010
|
+
if (error.message !== "User has no access to active organisations") {
|
|
1045
1011
|
logger.error("OrganisationService", "Failed to load organisations:", err);
|
|
1046
1012
|
}
|
|
1047
1013
|
this._error = error;
|
|
@@ -2137,7 +2103,7 @@ function UnifiedAuthContextProvider({
|
|
|
2137
2103
|
resolvedUserIdRef.current = currentUserId;
|
|
2138
2104
|
const userId = currentUserId;
|
|
2139
2105
|
const appNameValue = appName;
|
|
2140
|
-
import("./api-
|
|
2106
|
+
import("./api-IHKALJZD.js").then(async ({ resolveAppContext, setupRBAC }) => {
|
|
2141
2107
|
try {
|
|
2142
2108
|
setupRBAC(supabase);
|
|
2143
2109
|
const result = await resolveAppContext({
|
|
@@ -2542,4 +2508,4 @@ export {
|
|
|
2542
2508
|
useUnifiedAuth,
|
|
2543
2509
|
UnifiedAuthProvider
|
|
2544
2510
|
};
|
|
2545
|
-
//# sourceMappingURL=chunk-
|
|
2511
|
+
//# sourceMappingURL=chunk-6LTQQAT6.js.map
|