@jmruthers/pace-core 0.5.186 → 0.5.187
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-Z9NLVJh0.d.ts → DataTable-IVYljGJ6.d.ts} +1 -1
- package/dist/{DataTable-IX2NBUTP.js → DataTable-K3RJRSOX.js} +7 -7
- package/dist/{PublicPageProvider-DIzEzwKl.d.ts → PublicPageProvider-DrLDztHt.d.ts} +211 -106
- package/dist/{UnifiedAuthProvider-A4BCQRJY.js → UnifiedAuthProvider-B76OWOAT.js} +2 -2
- package/dist/{api-BMFCXVQX.js → api-YP7XD5L6.js} +3 -3
- package/dist/{audit-WRS3KJKI.js → audit-B5P6FFIR.js} +2 -2
- package/dist/{chunk-445GEP27.js → chunk-3IC5WCMO.js} +33 -8
- package/dist/chunk-3IC5WCMO.js.map +1 -0
- package/dist/{chunk-OALXJH4Y.js → chunk-3NFNJOO7.js} +8 -8
- package/dist/chunk-3NFNJOO7.js.map +1 -0
- package/dist/{chunk-FSFQFJCU.js → chunk-63FOKYGO.js} +174 -6
- package/dist/chunk-63FOKYGO.js.map +1 -0
- package/dist/{chunk-TC7D3CR3.js → chunk-C4OYJOV4.js} +556 -101
- package/dist/chunk-C4OYJOV4.js.map +1 -0
- package/dist/{chunk-HGPQUCBC.js → chunk-FMTK4XNN.js} +3 -3
- package/dist/{chunk-U6WNSFX5.js → chunk-HEHYGYOX.js} +279 -44
- package/dist/chunk-HEHYGYOX.js.map +1 -0
- package/dist/{chunk-XAUHJD3L.js → chunk-K2JGDXGU.js} +2 -2
- package/dist/{chunk-HDCUMOOI.js → chunk-LBBUPSSC.js} +792 -559
- package/dist/chunk-LBBUPSSC.js.map +1 -0
- package/dist/{chunk-UQWSHFVX.js → chunk-SAUPYVLF.js} +1 -1
- package/dist/{chunk-UQWSHFVX.js.map → chunk-SAUPYVLF.js.map} +1 -1
- package/dist/{chunk-GRIQLQ52.js → chunk-T6ZJVI3A.js} +27 -23
- package/dist/chunk-T6ZJVI3A.js.map +1 -0
- package/dist/{chunk-DAGICKHT.js → chunk-ULX5FYEM.js} +3 -3
- package/dist/{chunk-FXFJRTKI.js → chunk-WK2Y6TGA.js} +3 -3
- package/dist/chunk-WK2Y6TGA.js.map +1 -0
- package/dist/chunk-YHCN776L.js +447 -0
- package/dist/chunk-YHCN776L.js.map +1 -0
- package/dist/components.d.ts +4 -4
- package/dist/components.js +12 -10
- package/dist/components.js.map +1 -1
- package/dist/{file-reference-PRTSLxKx.d.ts → file-reference-D037xOFK.d.ts} +0 -1
- package/dist/hooks.d.ts +221 -6
- package/dist/hooks.js +146 -49
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +24 -9
- package/dist/index.js +62 -28
- package/dist/index.js.map +1 -1
- package/dist/providers.js +1 -1
- package/dist/rbac/index.d.ts +124 -7
- package/dist/rbac/index.js +27 -7
- package/dist/{types-DUyCRSTj.d.ts → types-Bwgl--Xo.d.ts} +162 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/{usePublicRouteParams-D71QLlg4.d.ts → usePublicRouteParams-CTDELQ7H.d.ts} +2 -2
- package/dist/utils.d.ts +213 -3
- package/dist/utils.js +22 -2
- package/dist/utils.js.map +1 -1
- 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 +21 -17
- package/docs/api/classes/RBACCache.md +31 -23
- package/docs/api/classes/RBACEngine.md +5 -5
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- 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 +241 -0
- package/docs/api/interfaces/AddressFieldRef.md +94 -0
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/AutocompleteOptions.md +75 -0
- 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 +15 -15
- 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 +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/ParsedAddress.md +120 -0
- 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 +26 -3
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +5 -5
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPerformanceMetrics.md +138 -0
- 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 +1 -1
- 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 +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- 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 +318 -59
- package/docs/best-practices/performance.md +11 -0
- package/docs/implementation-guides/file-upload-storage.md +29 -0
- package/docs/rbac/README.md +2 -1
- package/docs/rbac/api-reference.md +11 -0
- package/docs/rbac/performance.md +320 -0
- package/docs/standards/01-architecture-standard.md +5 -0
- package/docs/standards/05-security-standard.md +12 -0
- package/package.json +1 -1
- package/src/components/AddressField/AddressField.test.tsx +411 -0
- package/src/components/AddressField/AddressField.tsx +323 -0
- package/src/components/AddressField/README.md +336 -0
- package/src/components/AddressField/index.ts +10 -0
- package/src/components/AddressField/types.ts +65 -0
- package/src/components/FileDisplay/FileDisplay.test.tsx +454 -0
- package/src/components/FileDisplay/FileDisplay.tsx +28 -1
- package/src/components/index.ts +2 -0
- package/src/hooks/__tests__/useFileDisplay.unit.test.ts +30 -5
- package/src/hooks/__tests__/useOrganisationSecurity.unit.test.tsx +11 -10
- package/src/hooks/__tests__/usePublicFileDisplay.test.ts +31 -6
- package/src/hooks/index.ts +6 -0
- package/src/hooks/public/usePublicFileDisplay.ts +8 -10
- package/src/hooks/useAddressAutocomplete.test.ts +318 -0
- package/src/hooks/useAddressAutocomplete.ts +268 -0
- package/src/hooks/useFileDisplay.ts +3 -15
- package/src/hooks/useFileReference.test.ts +20 -3
- package/src/hooks/useFileReference.ts +3 -24
- package/src/hooks/useFileUrlCache.ts +246 -0
- package/src/hooks/useInactivityTracker.ts +31 -20
- package/src/hooks/useOrganisationSecurity.test.ts +10 -7
- package/src/hooks/useOrganisationSecurity.ts +3 -3
- package/src/hooks/useQueryCache.ts +315 -0
- package/src/index.ts +2 -0
- package/src/providers/services/EventServiceProvider.tsx +4 -1
- package/src/rbac/api.test.ts +21 -6
- package/src/rbac/api.ts +32 -11
- package/src/rbac/audit-batched.ts +223 -0
- package/src/rbac/audit-enhanced.ts +2 -2
- package/src/rbac/audit.test.ts +6 -5
- package/src/rbac/audit.ts +34 -6
- package/src/rbac/cache-invalidation.ts +63 -12
- package/src/rbac/cache.test.ts +2 -2
- package/src/rbac/cache.ts +61 -14
- package/src/rbac/components/PagePermissionGuard.tsx +19 -10
- package/src/rbac/components/__tests__/PagePermissionGuard.performance.test.tsx +248 -0
- package/src/rbac/config.ts +9 -0
- package/src/rbac/engine.ts +2 -21
- package/src/rbac/hooks/usePermissions.ts +21 -5
- package/src/rbac/index.ts +19 -0
- package/src/rbac/performance.ts +210 -0
- package/src/rbac/request-deduplication.ts +87 -0
- package/src/rbac/utils/deep-equal.ts +93 -0
- package/src/types/file-reference.ts +0 -1
- package/src/utils/file-reference/__tests__/file-reference.test.ts +31 -4
- package/src/utils/file-reference/index.ts +44 -15
- package/src/utils/google-places/googlePlacesUtils.test.ts +403 -0
- package/src/utils/google-places/googlePlacesUtils.ts +475 -0
- package/src/utils/google-places/index.ts +26 -0
- package/src/utils/google-places/loadGoogleMapsScript.ts +207 -0
- package/src/utils/google-places/types.ts +94 -0
- package/src/utils/index.ts +23 -0
- package/src/utils/request-deduplication.ts +165 -0
- package/src/utils/storage/helpers.ts +143 -4
- package/dist/chunk-445GEP27.js.map +0 -1
- package/dist/chunk-FMUCXFII.js +0 -76
- package/dist/chunk-FMUCXFII.js.map +0 -1
- package/dist/chunk-FSFQFJCU.js.map +0 -1
- package/dist/chunk-FXFJRTKI.js.map +0 -1
- package/dist/chunk-GRIQLQ52.js.map +0 -1
- package/dist/chunk-HDCUMOOI.js.map +0 -1
- package/dist/chunk-OALXJH4Y.js.map +0 -1
- package/dist/chunk-TC7D3CR3.js.map +0 -1
- package/dist/chunk-U6WNSFX5.js.map +0 -1
- /package/dist/{DataTable-IX2NBUTP.js.map → DataTable-K3RJRSOX.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-A4BCQRJY.js.map → UnifiedAuthProvider-B76OWOAT.js.map} +0 -0
- /package/dist/{api-BMFCXVQX.js.map → api-YP7XD5L6.js.map} +0 -0
- /package/dist/{audit-WRS3KJKI.js.map → audit-B5P6FFIR.js.map} +0 -0
- /package/dist/{chunk-HGPQUCBC.js.map → chunk-FMTK4XNN.js.map} +0 -0
- /package/dist/{chunk-XAUHJD3L.js.map → chunk-K2JGDXGU.js.map} +0 -0
- /package/dist/{chunk-DAGICKHT.js.map → chunk-ULX5FYEM.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/file-reference.ts"],"sourcesContent":["// File Reference System Types\n// These types define the structure for the centralized file reference system\n\nimport type { AppId } from './core';\n\nexport interface FileReference {\n id: string;\n table_name: string;\n record_id: string;\n file_path: string;\n file_metadata: FileMetadata;\n organisation_id: string;\n app_id: AppId;\n is_public: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface FileMetadata {\n fileName: string;\n fileType: string;\n fileSize?: number;\n width?: number;\n height?: number;\n category: FileCategory;\n hash?: string;\n uploadedBy?: string;\n uploadedAt?: string;\n tags?: string[];\n customMetadata?: Record<string, unknown>;\n}\n\nexport enum FileCategory {\n PROFILE_PHOTOS = 'profile_photos',\n ID_DOCUMENTS = 'id_documents',\n QUALIFICATIONS = 'qualifications',\n MEDICAL_DOCUMENTS = 'medical_documents',\n DISH_IMAGES = 'dish_images',\n EVENT_LOGOS = 'event_logos',\n GENERAL_DOCUMENTS = 'general_documents',\n IMAGES = 'images',\n AUDIO = 'audio',\n VIDEO = 'video',\n ARCHIVES = 'archives',\n // CAKE-specific categories\n CAKE_DISH = 'cake_dish',\n // TRAC-specific categories\n TRAC_ACCOMMODATION = 'trac_accommodation',\n TRAC_ACTIVITY = 'trac_activity',\n TRAC_JOURNAL = 'trac_journal',\n TRAC_TRANSPORT = 'trac_transport'\n}\n\n/**\n * Options for uploading a file with a file reference\n * @property pageContext - The page context where the file upload occurs (e.g., 'configuration', 'forms', 'applications')\n * Used for context-aware permission checks. Required to check appropriate page-level permissions.\n * @property event_id - Optional event ID for event-scoped permission checks. Required for event-based apps.\n */\nexport interface FileUploadOptions {\n table_name: string;\n record_id: string;\n organisation_id: string;\n app_id: AppId;\n category: FileCategory;\n folder: string; // Folder name in storage bucket (e.g., 'profile_photos', 'documents')\n pageContext: string;\n event_id?: string;\n is_public?: boolean;\n custom_metadata?: Record<string, unknown>;\n}\n\n\nexport interface FileReferenceService {\n createFileReference(options: FileUploadOptions, file: File): Promise<FileReference>;\n getFileReference(table_name: string, record_id: string, organisation_id: string): Promise<FileReference | null>;\n getFileReferenceById(id: string, organisation_id: string): Promise<FileReference | null>;\n getFileUrl(table_name: string, record_id: string, organisation_id: string): Promise<string | null>;\n getSignedUrl(table_name: string, record_id: string, organisation_id: string, expires_in?: number): Promise<string | null>;\n updateFileReference(id: string, updates: Partial<FileReference>): Promise<FileReference>;\n deleteFileReference(table_name: string, record_id: string, organisation_id: string, delete_file?: boolean): Promise<boolean>;\n listFileReferences(table_name: string, record_id: string, organisation_id: string): Promise<FileReference[]>;\n getFilesByCategory(table_name: string, record_id: string, category: FileCategory, organisation_id: string): Promise<FileReference[]>;\n getFileCount(table_name: string, record_id: string, organisation_id: string): Promise<number>;\n uploadMultipleFiles(options: FileUploadOptions, files: File[]): Promise<BulkUploadResult>;\n}\n\nexport interface StorageUploadOptions {\n orgId: string;\n
|
|
1
|
+
{"version":3,"sources":["../src/types/file-reference.ts"],"sourcesContent":["// File Reference System Types\n// These types define the structure for the centralized file reference system\n\nimport type { AppId } from './core';\n\nexport interface FileReference {\n id: string;\n table_name: string;\n record_id: string;\n file_path: string;\n file_metadata: FileMetadata;\n organisation_id: string;\n app_id: AppId;\n is_public: boolean;\n created_at: string;\n updated_at: string;\n}\n\nexport interface FileMetadata {\n fileName: string;\n fileType: string;\n fileSize?: number;\n width?: number;\n height?: number;\n category: FileCategory;\n hash?: string;\n uploadedBy?: string;\n uploadedAt?: string;\n tags?: string[];\n customMetadata?: Record<string, unknown>;\n}\n\nexport enum FileCategory {\n PROFILE_PHOTOS = 'profile_photos',\n ID_DOCUMENTS = 'id_documents',\n QUALIFICATIONS = 'qualifications',\n MEDICAL_DOCUMENTS = 'medical_documents',\n DISH_IMAGES = 'dish_images',\n EVENT_LOGOS = 'event_logos',\n GENERAL_DOCUMENTS = 'general_documents',\n IMAGES = 'images',\n AUDIO = 'audio',\n VIDEO = 'video',\n ARCHIVES = 'archives',\n // CAKE-specific categories\n CAKE_DISH = 'cake_dish',\n // TRAC-specific categories\n TRAC_ACCOMMODATION = 'trac_accommodation',\n TRAC_ACTIVITY = 'trac_activity',\n TRAC_JOURNAL = 'trac_journal',\n TRAC_TRANSPORT = 'trac_transport'\n}\n\n/**\n * Options for uploading a file with a file reference\n * @property pageContext - The page context where the file upload occurs (e.g., 'configuration', 'forms', 'applications')\n * Used for context-aware permission checks. Required to check appropriate page-level permissions.\n * @property event_id - Optional event ID for event-scoped permission checks. Required for event-based apps.\n */\nexport interface FileUploadOptions {\n table_name: string;\n record_id: string;\n organisation_id: string;\n app_id: AppId;\n category: FileCategory;\n folder: string; // Folder name in storage bucket (e.g., 'profile_photos', 'documents')\n pageContext: string;\n event_id?: string;\n is_public?: boolean;\n custom_metadata?: Record<string, unknown>;\n}\n\n\nexport interface FileReferenceService {\n createFileReference(options: FileUploadOptions, file: File): Promise<FileReference>;\n getFileReference(table_name: string, record_id: string, organisation_id: string): Promise<FileReference | null>;\n getFileReferenceById(id: string, organisation_id: string): Promise<FileReference | null>;\n getFileUrl(table_name: string, record_id: string, organisation_id: string): Promise<string | null>;\n getSignedUrl(table_name: string, record_id: string, organisation_id: string, expires_in?: number): Promise<string | null>;\n updateFileReference(id: string, updates: Partial<FileReference>): Promise<FileReference>;\n deleteFileReference(table_name: string, record_id: string, organisation_id: string, delete_file?: boolean): Promise<boolean>;\n listFileReferences(table_name: string, record_id: string, organisation_id: string): Promise<FileReference[]>;\n getFilesByCategory(table_name: string, record_id: string, category: FileCategory, organisation_id: string): Promise<FileReference[]>;\n getFileCount(table_name: string, record_id: string, organisation_id: string): Promise<number>;\n uploadMultipleFiles(options: FileUploadOptions, files: File[]): Promise<BulkUploadResult>;\n}\n\nexport interface StorageUploadOptions {\n orgId: string;\n isPublic?: boolean;\n customPath?: string;\n}\n\nexport interface FileUploadResult {\n file_reference: FileReference;\n file_url: string;\n signed_url?: string;\n}\n\n/**\n * File reference with pre-fetched URL\n * Useful for display components that need both metadata and URL\n */\nexport interface FileReferenceWithUrl extends FileReference {\n url: string;\n isSignedUrl: boolean;\n expiresAt?: Date;\n}\n\n/**\n * Upload progress information\n */\nexport interface UploadProgress {\n loaded: number;\n total: number;\n percentage: number;\n fileName: string;\n status: 'idle' | 'uploading' | 'processing' | 'completed' | 'error';\n error?: string;\n}\n\n/**\n * Bulk upload result\n */\nexport interface BulkUploadResult {\n /** Successfully created file references */\n success: FileReference[];\n /** Per-file failures with associated errors */\n failed: { file: File; error: string }[];\n\n // Optional aggregate fields for consumers that need totals\n total?: number;\n successful?: number;\n results?: Array<{\n file: File;\n result: FileUploadResult | null;\n error?: string;\n }>;\n}\n\n/**\n * Bucket information for file storage\n */\nexport interface BucketInfo {\n name: 'files' | 'public-files';\n isPublic: boolean;\n description: string;\n}\n\n/**\n * File URL information (public or signed)\n */\nexport interface FileUrlInfo {\n url: string;\n isPublic: boolean;\n isSignedUrl: boolean;\n expiresAt?: Date;\n bucket: BucketInfo;\n}\n"],"mappings":";AAgCO,IAAK,eAAL,kBAAKA,kBAAL;AACL,EAAAA,cAAA,oBAAiB;AACjB,EAAAA,cAAA,kBAAe;AACf,EAAAA,cAAA,oBAAiB;AACjB,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,WAAQ;AACR,EAAAA,cAAA,cAAW;AAEX,EAAAA,cAAA,eAAY;AAEZ,EAAAA,cAAA,wBAAqB;AACrB,EAAAA,cAAA,mBAAgB;AAChB,EAAAA,cAAA,kBAAe;AACf,EAAAA,cAAA,oBAAiB;AAlBP,SAAAA;AAAA,GAAA;","names":["FileCategory"]}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createScopeFromEvent,
|
|
3
|
+
scopeEqual,
|
|
3
4
|
useAccessLevel,
|
|
4
5
|
useCan,
|
|
5
6
|
useMultiplePermissions
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3IC5WCMO.js";
|
|
7
8
|
import {
|
|
8
9
|
RBACCache,
|
|
9
10
|
RBACNotInitializedError,
|
|
10
11
|
getRBACConfig,
|
|
11
12
|
getRBACLogger,
|
|
12
13
|
rbacCache
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HEHYGYOX.js";
|
|
14
15
|
import {
|
|
15
16
|
useSecureDataAccess
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ULX5FYEM.js";
|
|
17
18
|
import {
|
|
18
19
|
useUnifiedAuth
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WK2Y6TGA.js";
|
|
20
21
|
import {
|
|
21
22
|
createLogger,
|
|
22
23
|
logger
|
|
@@ -157,7 +158,7 @@ function usePagePermissions() {
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
// src/rbac/components/PagePermissionGuard.tsx
|
|
160
|
-
import { useMemo as useMemo2, useEffect as useEffect2, useState as useState2, useRef } from "react";
|
|
161
|
+
import React2, { useMemo as useMemo2, useEffect as useEffect2, useState as useState2, useRef } from "react";
|
|
161
162
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
162
163
|
var PagePermissionGuardComponent = ({
|
|
163
164
|
pageName,
|
|
@@ -330,15 +331,18 @@ var PagePermissionGuardComponent = ({
|
|
|
330
331
|
const permission = useMemo2(() => {
|
|
331
332
|
return `${operation}:page.${pageName}`;
|
|
332
333
|
}, [operation, pageName]);
|
|
334
|
+
const prevScopeRef = useRef(null);
|
|
333
335
|
const stableScope = useMemo2(() => {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
336
|
+
const newScope = resolvedScope && resolvedScope.organisationId ? {
|
|
337
|
+
organisationId: resolvedScope.organisationId,
|
|
338
|
+
appId: resolvedScope.appId || void 0,
|
|
339
|
+
eventId: resolvedScope.eventId || void 0
|
|
340
|
+
} : { organisationId: void 0, appId: void 0, eventId: void 0 };
|
|
341
|
+
if (scopeEqual(prevScopeRef.current, newScope)) {
|
|
342
|
+
return prevScopeRef.current;
|
|
340
343
|
}
|
|
341
|
-
|
|
344
|
+
prevScopeRef.current = newScope;
|
|
345
|
+
return newScope;
|
|
342
346
|
}, [resolvedScope]);
|
|
343
347
|
const { can, isLoading: canIsLoading, error: canError } = useCan(
|
|
344
348
|
user?.id || "",
|
|
@@ -434,7 +438,7 @@ function DefaultLoading() {
|
|
|
434
438
|
/* @__PURE__ */ jsx2("span", { className: "text-sec-600", children: "Checking permissions..." })
|
|
435
439
|
] }) });
|
|
436
440
|
}
|
|
437
|
-
var PagePermissionGuard = PagePermissionGuardComponent;
|
|
441
|
+
var PagePermissionGuard = React2.memo(PagePermissionGuardComponent);
|
|
438
442
|
|
|
439
443
|
// src/rbac/components/SecureDataProvider.tsx
|
|
440
444
|
import { createContext as createContext2, useContext as useContext2, useState as useState3, useCallback as useCallback3, useMemo as useMemo3, useEffect as useEffect3 } from "react";
|
|
@@ -1428,7 +1432,7 @@ function withPermissionGuard(config, handler) {
|
|
|
1428
1432
|
if (!userId || !organisationId) {
|
|
1429
1433
|
throw new Error("User context required for permission check");
|
|
1430
1434
|
}
|
|
1431
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1435
|
+
const { isPermitted: isPermitted2 } = await import("./api-YP7XD5L6.js");
|
|
1432
1436
|
const hasPermission2 = await isPermitted2({
|
|
1433
1437
|
userId,
|
|
1434
1438
|
scope: { organisationId, eventId, appId },
|
|
@@ -1451,7 +1455,7 @@ function withAccessLevelGuard(minLevel, handler) {
|
|
|
1451
1455
|
if (!userId || !organisationId) {
|
|
1452
1456
|
throw new Error("User context required for access level check");
|
|
1453
1457
|
}
|
|
1454
|
-
const { getAccessLevel: getAccessLevel2 } = await import("./api-
|
|
1458
|
+
const { getAccessLevel: getAccessLevel2 } = await import("./api-YP7XD5L6.js");
|
|
1455
1459
|
const accessLevel = await getAccessLevel2({
|
|
1456
1460
|
userId,
|
|
1457
1461
|
scope: { organisationId, eventId, appId }
|
|
@@ -1476,11 +1480,11 @@ function withRoleGuard(config, handler) {
|
|
|
1476
1480
|
throw new Error("User context required for role check");
|
|
1477
1481
|
}
|
|
1478
1482
|
if (config.globalRoles && config.globalRoles.length > 0) {
|
|
1479
|
-
const { isSuperAdmin } = await import("./api-
|
|
1483
|
+
const { isSuperAdmin } = await import("./api-YP7XD5L6.js");
|
|
1480
1484
|
const isSuper = await isSuperAdmin(userId);
|
|
1481
1485
|
if (isSuper) {
|
|
1482
1486
|
if (organisationId) {
|
|
1483
|
-
const { emitAuditEvent: emitAuditEvent2 } = await import("./audit-
|
|
1487
|
+
const { emitAuditEvent: emitAuditEvent2 } = await import("./audit-B5P6FFIR.js");
|
|
1484
1488
|
await emitAuditEvent2({
|
|
1485
1489
|
type: "permission_check",
|
|
1486
1490
|
userId,
|
|
@@ -1502,21 +1506,21 @@ function withRoleGuard(config, handler) {
|
|
|
1502
1506
|
}
|
|
1503
1507
|
}
|
|
1504
1508
|
if (config.organisationRoles && config.organisationRoles.length > 0) {
|
|
1505
|
-
const { isOrganisationAdmin } = await import("./api-
|
|
1509
|
+
const { isOrganisationAdmin } = await import("./api-YP7XD5L6.js");
|
|
1506
1510
|
const isOrgAdmin = await isOrganisationAdmin(userId, organisationId);
|
|
1507
1511
|
if (!isOrgAdmin && config.requireAll !== false) {
|
|
1508
1512
|
throw new Error(`Organisation admin role required`);
|
|
1509
1513
|
}
|
|
1510
1514
|
}
|
|
1511
1515
|
if (config.eventAppRoles && config.eventAppRoles.length > 0 && eventId && appId) {
|
|
1512
|
-
const { isEventAdmin } = await import("./api-
|
|
1516
|
+
const { isEventAdmin } = await import("./api-YP7XD5L6.js");
|
|
1513
1517
|
const isEventAdminUser = await isEventAdmin(userId, { organisationId, eventId, appId });
|
|
1514
1518
|
if (!isEventAdminUser && config.requireAll !== false) {
|
|
1515
1519
|
throw new Error(`Event admin role required`);
|
|
1516
1520
|
}
|
|
1517
1521
|
}
|
|
1518
1522
|
if (organisationId) {
|
|
1519
|
-
const { emitAuditEvent: emitAuditEvent2 } = await import("./audit-
|
|
1523
|
+
const { emitAuditEvent: emitAuditEvent2 } = await import("./audit-B5P6FFIR.js");
|
|
1520
1524
|
await emitAuditEvent2({
|
|
1521
1525
|
type: "permission_check",
|
|
1522
1526
|
userId,
|
|
@@ -1549,7 +1553,7 @@ function createRBACMiddleware(config) {
|
|
|
1549
1553
|
);
|
|
1550
1554
|
if (protectedRoute) {
|
|
1551
1555
|
try {
|
|
1552
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1556
|
+
const { isPermitted: isPermitted2 } = await import("./api-YP7XD5L6.js");
|
|
1553
1557
|
const hasPermission2 = await isPermitted2({
|
|
1554
1558
|
userId,
|
|
1555
1559
|
scope: { organisationId },
|
|
@@ -1576,7 +1580,7 @@ function createRBACExpressMiddleware(config) {
|
|
|
1576
1580
|
return res.status(401).json({ error: "User context required" });
|
|
1577
1581
|
}
|
|
1578
1582
|
try {
|
|
1579
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1583
|
+
const { isPermitted: isPermitted2 } = await import("./api-YP7XD5L6.js");
|
|
1580
1584
|
const hasPermission2 = await isPermitted2({
|
|
1581
1585
|
userId,
|
|
1582
1586
|
scope: { organisationId, eventId, appId },
|
|
@@ -2105,4 +2109,4 @@ export {
|
|
|
2105
2109
|
getDirectSupabaseAuthFixes,
|
|
2106
2110
|
getQuickFixes
|
|
2107
2111
|
};
|
|
2108
|
-
//# sourceMappingURL=chunk-
|
|
2112
|
+
//# sourceMappingURL=chunk-T6ZJVI3A.js.map
|