@jmruthers/pace-core 0.5.57 → 0.5.59
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-GABLO6H5.js → DataTable-BKUUSZC5.js} +5 -5
- package/dist/{chunk-77TYN5B4.js → chunk-5MLDIGHB.js} +3 -3
- package/dist/{chunk-YI25YXER.js → chunk-CGSYCF2W.js} +30 -14
- package/dist/chunk-CGSYCF2W.js.map +1 -0
- package/dist/{chunk-CACNKQ3B.js → chunk-E4FPK232.js} +3 -3
- package/dist/{chunk-CACNKQ3B.js.map → chunk-E4FPK232.js.map} +1 -1
- package/dist/{chunk-DH7VDOQQ.js → chunk-HSK6AJKC.js} +3 -3
- package/dist/{chunk-D3X2CGAG.js → chunk-ITPVFKDH.js} +2 -2
- package/dist/{chunk-S3MPG3BA.js → chunk-OJK7SV4M.js} +5 -5
- package/dist/{chunk-S3MPG3BA.js.map → chunk-OJK7SV4M.js.map} +1 -1
- package/dist/{chunk-E3ITLZBM.js → chunk-PHWA52IO.js} +3 -3
- package/dist/{chunk-VY3DOGPU.js → chunk-QWS45MLA.js} +4 -4
- package/dist/{chunk-JO3Y2BOW.js → chunk-STLY4XWV.js} +5 -5
- package/dist/{chunk-TCX7STCC.js → chunk-W7PPXKTZ.js} +2 -2
- package/dist/components.js +7 -7
- package/dist/hooks.js +4 -4
- package/dist/index.js +10 -10
- package/dist/providers.js +3 -3
- package/dist/rbac/index.js +5 -5
- package/dist/types.d.ts +7 -1
- package/dist/utils.js +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.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/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- 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/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.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/DataAccessRecord.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/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.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/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/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.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/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.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/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/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/UsePublicRouteParamsReturn.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 +2 -2
- package/docs/getting-started/quick-start.md +21 -3
- package/docs/rbac/getting-started.md +43 -0
- package/docs/troubleshooting/common-issues.md +116 -1516
- package/package.json +1 -1
- package/src/__tests__/TESTING_GUIDELINES.md +1 -1
- package/src/hooks/__tests__/useRBAC.unit.test.ts +8 -8
- package/src/providers/EventProvider.tsx +32 -17
- package/src/providers/OrganisationProvider.tsx +2 -2
- package/src/rbac/hooks/useRBAC.ts +2 -2
- package/src/types/supabase.ts +17 -0
- package/dist/chunk-YI25YXER.js.map +0 -1
- /package/dist/{DataTable-GABLO6H5.js.map → DataTable-BKUUSZC5.js.map} +0 -0
- /package/dist/{chunk-77TYN5B4.js.map → chunk-5MLDIGHB.js.map} +0 -0
- /package/dist/{chunk-DH7VDOQQ.js.map → chunk-HSK6AJKC.js.map} +0 -0
- /package/dist/{chunk-D3X2CGAG.js.map → chunk-ITPVFKDH.js.map} +0 -0
- /package/dist/{chunk-E3ITLZBM.js.map → chunk-PHWA52IO.js.map} +0 -0
- /package/dist/{chunk-VY3DOGPU.js.map → chunk-QWS45MLA.js.map} +0 -0
- /package/dist/{chunk-JO3Y2BOW.js.map → chunk-STLY4XWV.js.map} +0 -0
- /package/dist/{chunk-TCX7STCC.js.map → chunk-W7PPXKTZ.js.map} +0 -0
package/docs/api/modules.md
CHANGED
|
@@ -95,8 +95,13 @@ export default defineConfig({
|
|
|
95
95
|
Create `.env.local`:
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
|
+
# Supabase Configuration
|
|
98
99
|
REACT_APP_SUPABASE_URL=https://your-project.supabase.co
|
|
99
100
|
REACT_APP_SUPABASE_ANON_KEY=your-anon-key-here
|
|
101
|
+
|
|
102
|
+
# ⚠️ CRITICAL: Use anon key, NOT service role key
|
|
103
|
+
# The anon key starts with: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
|
|
104
|
+
# The service role key has different permissions and can cause RPC timeouts
|
|
100
105
|
```
|
|
101
106
|
|
|
102
107
|
### 5. Create Supabase Client
|
|
@@ -108,18 +113,23 @@ import { createClient } from '@supabase/supabase-js'
|
|
|
108
113
|
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL!
|
|
109
114
|
const supabaseAnonKey = process.env.REACT_APP_SUPABASE_ANON_KEY!
|
|
110
115
|
|
|
116
|
+
if (!supabaseUrl || !supabaseAnonKey) {
|
|
117
|
+
throw new Error('Missing Supabase environment variables')
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
|
112
121
|
```
|
|
113
122
|
|
|
114
|
-
### 6. Set Up
|
|
123
|
+
### 6. Set Up RBAC System
|
|
115
124
|
|
|
116
|
-
**CRITICAL**:
|
|
125
|
+
**CRITICAL**: Setup RBAC before using any RBAC features:
|
|
117
126
|
|
|
118
127
|
```tsx
|
|
119
128
|
// src/main.tsx
|
|
120
129
|
import React from 'react'
|
|
121
130
|
import ReactDOM from 'react-dom/client'
|
|
122
131
|
import { BrowserRouter } from 'react-router-dom'
|
|
132
|
+
import { setupRBAC } from '@jmruthers/pace-core/rbac'
|
|
123
133
|
import {
|
|
124
134
|
UnifiedAuthProvider,
|
|
125
135
|
OrganisationProvider,
|
|
@@ -131,10 +141,18 @@ import App from './App.tsx'
|
|
|
131
141
|
// CRITICAL: Import the CSS system - includes everything you need
|
|
132
142
|
import '@jmruthers/pace-core/styles/core.css'
|
|
133
143
|
|
|
144
|
+
// ⚠️ CRITICAL: Setup RBAC before using any RBAC features
|
|
145
|
+
setupRBAC(supabase)
|
|
146
|
+
|
|
134
147
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
135
148
|
<React.StrictMode>
|
|
136
149
|
<BrowserRouter>
|
|
137
|
-
<UnifiedAuthProvider
|
|
150
|
+
<UnifiedAuthProvider
|
|
151
|
+
supabaseClient={supabase}
|
|
152
|
+
appName="meal-manager"
|
|
153
|
+
enableRBAC={true}
|
|
154
|
+
requireOrganisationContext={true}
|
|
155
|
+
>
|
|
138
156
|
<OrganisationProvider>
|
|
139
157
|
<EventProvider>
|
|
140
158
|
<App />
|
|
@@ -373,6 +373,49 @@ function Navigation({ userId, organisationId }) {
|
|
|
373
373
|
|
|
374
374
|
## 🚨 **Troubleshooting Common Errors**
|
|
375
375
|
|
|
376
|
+
### Error: "RPC call timeout after 10 seconds" / "Loading organisation context..." hangs
|
|
377
|
+
|
|
378
|
+
**Symptoms:**
|
|
379
|
+
- App hangs on "Loading organisation context..."
|
|
380
|
+
- Console shows "RPC call timeout after 10 seconds"
|
|
381
|
+
- No error messages, just infinite loading
|
|
382
|
+
|
|
383
|
+
**Root Cause:** Wrong API key or missing RBAC setup
|
|
384
|
+
|
|
385
|
+
**Solution:**
|
|
386
|
+
1. **Verify API Key Type** - Ensure you're using the **anon key**, not service role key
|
|
387
|
+
```typescript
|
|
388
|
+
// Check your environment variables
|
|
389
|
+
console.log('API Key check:', {
|
|
390
|
+
hasAnonKey: !!process.env.REACT_APP_SUPABASE_ANON_KEY,
|
|
391
|
+
keyLength: process.env.REACT_APP_SUPABASE_ANON_KEY?.length,
|
|
392
|
+
startsWithEyJ: process.env.REACT_APP_SUPABASE_ANON_KEY?.startsWith('eyJ')
|
|
393
|
+
})
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
2. **Ensure RBAC Setup** - Call `setupRBAC` before using RBAC features
|
|
397
|
+
```typescript
|
|
398
|
+
// src/main.tsx - MUST be called before rendering
|
|
399
|
+
import { setupRBAC } from '@jmruthers/pace-core/rbac'
|
|
400
|
+
setupRBAC(supabase)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
3. **Check Provider Configuration** - Verify correct provider hierarchy
|
|
404
|
+
```tsx
|
|
405
|
+
<UnifiedAuthProvider
|
|
406
|
+
supabaseClient={supabase}
|
|
407
|
+
appName="your-app"
|
|
408
|
+
enableRBAC={true}
|
|
409
|
+
requireOrganisationContext={true}
|
|
410
|
+
>
|
|
411
|
+
<OrganisationProvider>
|
|
412
|
+
<EventProvider>
|
|
413
|
+
<YourApp />
|
|
414
|
+
</EventProvider>
|
|
415
|
+
</OrganisationProvider>
|
|
416
|
+
</UnifiedAuthProvider>
|
|
417
|
+
```
|
|
418
|
+
|
|
376
419
|
### Error: "can't access property 'organisationId', scope is undefined"
|
|
377
420
|
|
|
378
421
|
**Cause**: Missing organisation context or incorrect provider setup
|