@jmruthers/pace-core 0.5.183 → 0.5.185
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/CHANGELOG.md +38 -0
- package/README.md +60 -1
- package/core-usage-manifest.json +312 -0
- package/dist/{DataTable-QAB34V6K.js → DataTable-IX2NBUTP.js} +6 -6
- package/dist/{DataTable-Bz8ffqyA.d.ts → DataTable-Z9NLVJh0.d.ts} +1 -1
- package/dist/{index-Bl--n7-T.d.ts → PublicPageProvider-BABf6JCh.d.ts} +21 -10
- package/dist/{UnifiedAuthProvider-7F6T4B6K.js → UnifiedAuthProvider-A4BCQRJY.js} +4 -2
- package/dist/{UnifiedAuthProvider-F86d7dSi.d.ts → UnifiedAuthProvider-BG0AL5eE.d.ts} +2 -1
- package/dist/{api-ROMBCNKU.js → api-BMFCXVQX.js} +2 -2
- package/dist/{chunk-RA3JUFMW.js → chunk-445GEP27.js} +154 -4
- package/dist/{chunk-RA3JUFMW.js.map → chunk-445GEP27.js.map} +1 -1
- package/dist/{chunk-CSOFYHAG.js → chunk-AISXLWGZ.js} +374 -60
- package/dist/chunk-AISXLWGZ.js.map +1 -0
- package/dist/{chunk-FUEYYMX5.js → chunk-FXFJRTKI.js} +24 -3
- package/dist/chunk-FXFJRTKI.js.map +1 -0
- package/dist/{chunk-QETLRQI6.js → chunk-HC67NW5K.js} +380 -360
- package/dist/chunk-HC67NW5K.js.map +1 -0
- package/dist/chunk-HESYZWZW.js +388 -0
- package/dist/chunk-HESYZWZW.js.map +1 -0
- package/dist/{chunk-QUVSNGIP.js → chunk-HGPQUCBC.js} +34 -9
- package/dist/{chunk-QUVSNGIP.js.map → chunk-HGPQUCBC.js.map} +1 -1
- package/dist/{chunk-UHNYIBXL.js → chunk-IXSNYUCT.js} +1 -1
- package/dist/chunk-IXSNYUCT.js.map +1 -0
- package/dist/{chunk-MI7HBHN3.js → chunk-MX3EIJGQ.js} +4 -3
- package/dist/{chunk-MI7HBHN3.js.map → chunk-MX3EIJGQ.js.map} +1 -1
- package/dist/{chunk-PWAHJW4G.js → chunk-OKI34GZD.js} +86 -33
- package/dist/chunk-OKI34GZD.js.map +1 -0
- package/dist/{chunk-W22JP75J.js → chunk-STTZQK2I.js} +3 -3
- package/dist/chunk-THRPYOFK.js +215 -0
- package/dist/chunk-THRPYOFK.js.map +1 -0
- package/dist/{chunk-M7W4CP3M.js → chunk-U6WNSFX5.js} +2 -1
- package/dist/chunk-U6WNSFX5.js.map +1 -0
- package/dist/{chunk-QCDXODCA.js → chunk-XAUHJD3L.js} +2 -2
- package/dist/components.d.ts +182 -6
- package/dist/components.js +157 -11
- package/dist/components.js.map +1 -1
- package/dist/eslint-rules/pace-core-compliance.cjs +406 -0
- package/dist/{file-reference-D06mEEWW.d.ts → file-reference-BjR39ktt.d.ts} +7 -1
- package/dist/hooks.d.ts +7 -14
- package/dist/hooks.js +10 -22
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +79 -16
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +3 -1
- package/dist/rbac/index.d.ts +205 -14
- package/dist/rbac/index.js +28 -6
- package/dist/timezone-_pgH8qrY.d.ts +530 -0
- package/dist/{types-_x1f4QBF.d.ts → types-DUyCRSTj.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/{usePublicRouteParams-JJczomYq.d.ts → usePublicRouteParams-CvnC3d-e.d.ts} +113 -2
- package/dist/utils.d.ts +109 -151
- package/dist/utils.js +128 -138
- package/dist/utils.js.map +1 -1
- package/docs/api/README.md +60 -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 +178 -0
- 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 +54 -0
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AggregateConfig.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 +18 -2
- 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 +30 -0
- 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 +85 -0
- package/docs/api/interfaces/DatabaseIssue.md +41 -0
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +6 -6
- 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 +24 -8
- package/docs/api/interfaces/FileUploadProps.md +24 -13
- 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 +9 -9
- 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 +62 -0
- 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 +36 -23
- 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/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 +52 -0
- 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 +4 -4
- 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/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 +7 -7
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +5 -5
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/RuntimeComplianceResult.md +55 -0
- 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 +41 -0
- 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 +62 -0
- package/docs/api/interfaces/UseFormDialogReturn.md +117 -0
- 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 +738 -42
- package/docs/api-reference/hooks.md +111 -0
- package/docs/api-reference/rpc-functions.md +1 -1
- package/docs/api-reference/utilities.md +184 -0
- package/docs/getting-started/installation-guide.md +75 -16
- package/docs/getting-started/quick-start.md +61 -11
- package/docs/implementation-guides/authentication.md +88 -12
- package/docs/implementation-guides/file-reference-system.md +2 -1
- package/docs/implementation-guides/file-upload-storage.md +21 -0
- package/docs/rbac/README.md +1 -0
- package/docs/rbac/compliance/compliance-guide.md +544 -0
- package/docs/rbac/getting-started.md +158 -33
- package/docs/standards/pace-core-compliance.md +432 -0
- package/eslint-config-pace-core.cjs +93 -0
- package/package.json +15 -3
- package/scripts/analyze-bundle.js +232 -0
- package/scripts/build-css.js +56 -0
- package/scripts/build-docs-incremental.js +1015 -0
- package/scripts/check-pace-core-compliance.cjs +2353 -0
- package/scripts/generate-docs.js +157 -0
- package/scripts/setup-build-cache.js +73 -0
- package/scripts/utils/command-runner.js +131 -0
- package/scripts/utils/env.js +33 -0
- package/scripts/utils/index.js +10 -0
- package/scripts/utils/logger.js +88 -0
- package/scripts/utils/path-helpers.js +37 -0
- package/scripts/validate-formats.js +133 -0
- package/scripts/validate-master.js +155 -0
- package/scripts/validate-pre-publish.js +140 -0
- package/scripts/validate-theme.js +142 -0
- package/src/components/Calendar/Calendar.tsx +8 -1
- package/src/components/Card/Card.tsx +47 -8
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +314 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +126 -0
- package/src/components/DatePickerWithTimezone/README.md +135 -0
- package/src/components/DatePickerWithTimezone/index.ts +10 -0
- package/src/components/DateTimeField/DateTimeField.test.tsx +358 -0
- package/src/components/DateTimeField/DateTimeField.tsx +232 -0
- package/src/components/DateTimeField/README.md +148 -0
- package/src/components/DateTimeField/index.ts +10 -0
- package/src/components/FileUpload/FileUpload.tsx +3 -0
- package/src/components/Header/Header.test.tsx +47 -18
- package/src/components/Header/Header.tsx +24 -6
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +29 -20
- package/src/components/PaceAppLayout/README.md +9 -0
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -1
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +37 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +12 -4
- package/src/components/index.ts +8 -0
- package/src/eslint-rules/pace-core-compliance.cjs +406 -0
- package/src/eslint-rules/pace-core-compliance.js +640 -0
- package/src/hooks/__tests__/useFormDialog.test.ts +478 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFileReference.test.ts +1 -0
- package/src/hooks/useFormDialog.ts +147 -0
- package/src/index.ts +27 -0
- package/src/providers/services/OrganisationServiceProvider.tsx +6 -5
- package/src/providers/services/UnifiedAuthProvider.tsx +24 -3
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +3 -0
- package/src/rbac/compliance/database-validator.ts +165 -0
- package/src/rbac/compliance/index.ts +38 -0
- package/src/rbac/compliance/quick-fix-suggestions.ts +209 -0
- package/src/rbac/compliance/runtime-compliance.ts +77 -0
- package/src/rbac/compliance/setup-validator.ts +131 -0
- package/src/rbac/components/PagePermissionGuard.tsx +8 -64
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +35 -21
- package/src/rbac/docs/event-based-apps.md +285 -0
- package/src/rbac/errors.ts +11 -0
- package/src/rbac/hooks/useRoleManagement.ts +292 -12
- package/src/rbac/index.ts +30 -0
- package/src/services/OrganisationService.ts +4 -0
- package/src/types/file-reference.ts +6 -0
- package/src/utils/__tests__/timezone.test.ts +345 -0
- package/src/utils/file-reference/__tests__/file-reference.test.ts +2 -0
- package/src/utils/file-reference/index.ts +1 -0
- package/src/utils/formatting/formatDateTimeTimezone.test.ts +167 -0
- package/src/utils/formatting/formatting.ts +179 -0
- package/src/utils/index.ts +27 -1
- package/src/utils/location/index.ts +16 -0
- package/src/utils/location/location.test.ts +286 -0
- package/src/utils/location/location.ts +175 -0
- package/src/utils/timezone/index.ts +17 -0
- package/src/utils/timezone/timezone.test.ts +349 -0
- package/src/utils/timezone/timezone.ts +281 -0
- package/dist/chunk-CSOFYHAG.js.map +0 -1
- package/dist/chunk-FUEYYMX5.js.map +0 -1
- package/dist/chunk-HKIT6O7W.js +0 -198
- package/dist/chunk-HKIT6O7W.js.map +0 -1
- package/dist/chunk-KUEN3HFB.js +0 -94
- package/dist/chunk-KUEN3HFB.js.map +0 -1
- package/dist/chunk-M7W4CP3M.js.map +0 -1
- package/dist/chunk-PWAHJW4G.js.map +0 -1
- package/dist/chunk-QETLRQI6.js.map +0 -1
- package/dist/chunk-UHNYIBXL.js.map +0 -1
- package/dist/formatting-5wETwiGF.d.ts +0 -162
- /package/dist/{DataTable-QAB34V6K.js.map → DataTable-IX2NBUTP.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-7F6T4B6K.js.map → UnifiedAuthProvider-A4BCQRJY.js.map} +0 -0
- /package/dist/{api-ROMBCNKU.js.map → api-BMFCXVQX.js.map} +0 -0
- /package/dist/{chunk-W22JP75J.js.map → chunk-STTZQK2I.js.map} +0 -0
- /package/dist/{chunk-QCDXODCA.js.map → chunk-XAUHJD3L.js.map} +0 -0
|
@@ -3,21 +3,20 @@ import {
|
|
|
3
3
|
useAccessLevel,
|
|
4
4
|
useCan,
|
|
5
5
|
useMultiplePermissions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-445GEP27.js";
|
|
7
7
|
import {
|
|
8
8
|
RBACCache,
|
|
9
|
+
RBACNotInitializedError,
|
|
10
|
+
getRBACConfig,
|
|
9
11
|
getRBACLogger,
|
|
10
12
|
rbacCache
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U6WNSFX5.js";
|
|
12
14
|
import {
|
|
13
15
|
useSecureDataAccess
|
|
14
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-STTZQK2I.js";
|
|
15
17
|
import {
|
|
16
18
|
useUnifiedAuth
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
getCurrentAppName
|
|
20
|
-
} from "./chunk-F2IMUDXZ.js";
|
|
19
|
+
} from "./chunk-FXFJRTKI.js";
|
|
21
20
|
import {
|
|
22
21
|
createLogger,
|
|
23
22
|
logger
|
|
@@ -172,10 +171,10 @@ var PagePermissionGuardComponent = ({
|
|
|
172
171
|
onDenied,
|
|
173
172
|
loading = /* @__PURE__ */ jsx2(DefaultLoading, {})
|
|
174
173
|
}) => {
|
|
175
|
-
const instanceId = useMemo2(() => Math.random().toString(36).substr(2, 9), []);
|
|
176
174
|
const renderCountRef = useRef(0);
|
|
177
175
|
renderCountRef.current += 1;
|
|
178
|
-
const
|
|
176
|
+
const instanceId = useMemo2(() => Math.random().toString(36).substr(2, 9), []);
|
|
177
|
+
const { user, selectedOrganisation, selectedEvent, supabase, appId: contextAppId } = useUnifiedAuth();
|
|
179
178
|
const [hasChecked, setHasChecked] = useState2(false);
|
|
180
179
|
const [checkError, setCheckError] = useState2(null);
|
|
181
180
|
const [resolvedScope, setResolvedScope] = useState2(null);
|
|
@@ -206,48 +205,7 @@ var PagePermissionGuardComponent = ({
|
|
|
206
205
|
safeSetCheckError(null);
|
|
207
206
|
return;
|
|
208
207
|
}
|
|
209
|
-
|
|
210
|
-
if (supabaseRef.current) {
|
|
211
|
-
const appName = getCurrentAppName();
|
|
212
|
-
if (appName) {
|
|
213
|
-
try {
|
|
214
|
-
const { data: app, error: error2 } = await supabaseRef.current.from("rbac_apps").select("id, name, is_active").eq("name", appName).eq("is_active", true).single();
|
|
215
|
-
if (signal.aborted) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (error2) {
|
|
219
|
-
const logger3 = getRBACLogger();
|
|
220
|
-
logger3.error("Database error resolving app ID:", error2);
|
|
221
|
-
if (signal.aborted) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const { data: inactiveApp } = await supabaseRef.current.from("rbac_apps").select("id, name, is_active").eq("name", appName).single();
|
|
225
|
-
if (signal.aborted) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
if (inactiveApp) {
|
|
229
|
-
logger3.error(`App "${appName}" exists but is inactive (is_active: ${inactiveApp.is_active})`);
|
|
230
|
-
} else {
|
|
231
|
-
logger3.error(`App "${appName}" not found in rbac_apps table`);
|
|
232
|
-
}
|
|
233
|
-
} else if (app) {
|
|
234
|
-
appId = app.id;
|
|
235
|
-
} else {
|
|
236
|
-
const logger3 = getRBACLogger();
|
|
237
|
-
logger3.error("No app data returned for:", appName);
|
|
238
|
-
}
|
|
239
|
-
} catch (error2) {
|
|
240
|
-
if (signal.aborted) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const logger3 = getRBACLogger();
|
|
244
|
-
logger3.error("Unexpected error resolving app ID:", error2);
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
const logger3 = getRBACLogger();
|
|
248
|
-
logger3.error("No app name found. Make sure to call setRBACAppName() in your app setup.");
|
|
249
|
-
}
|
|
250
|
-
}
|
|
208
|
+
const appId = contextAppId;
|
|
251
209
|
if (signal.aborted) {
|
|
252
210
|
return;
|
|
253
211
|
}
|
|
@@ -1470,7 +1428,7 @@ function withPermissionGuard(config, handler) {
|
|
|
1470
1428
|
if (!userId || !organisationId) {
|
|
1471
1429
|
throw new Error("User context required for permission check");
|
|
1472
1430
|
}
|
|
1473
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1431
|
+
const { isPermitted: isPermitted2 } = await import("./api-BMFCXVQX.js");
|
|
1474
1432
|
const hasPermission2 = await isPermitted2({
|
|
1475
1433
|
userId,
|
|
1476
1434
|
scope: { organisationId, eventId, appId },
|
|
@@ -1493,7 +1451,7 @@ function withAccessLevelGuard(minLevel, handler) {
|
|
|
1493
1451
|
if (!userId || !organisationId) {
|
|
1494
1452
|
throw new Error("User context required for access level check");
|
|
1495
1453
|
}
|
|
1496
|
-
const { getAccessLevel: getAccessLevel2 } = await import("./api-
|
|
1454
|
+
const { getAccessLevel: getAccessLevel2 } = await import("./api-BMFCXVQX.js");
|
|
1497
1455
|
const accessLevel = await getAccessLevel2({
|
|
1498
1456
|
userId,
|
|
1499
1457
|
scope: { organisationId, eventId, appId }
|
|
@@ -1518,7 +1476,7 @@ function withRoleGuard(config, handler) {
|
|
|
1518
1476
|
throw new Error("User context required for role check");
|
|
1519
1477
|
}
|
|
1520
1478
|
if (config.globalRoles && config.globalRoles.length > 0) {
|
|
1521
|
-
const { isSuperAdmin } = await import("./api-
|
|
1479
|
+
const { isSuperAdmin } = await import("./api-BMFCXVQX.js");
|
|
1522
1480
|
const isSuper = await isSuperAdmin(userId);
|
|
1523
1481
|
if (isSuper) {
|
|
1524
1482
|
if (organisationId) {
|
|
@@ -1544,14 +1502,14 @@ function withRoleGuard(config, handler) {
|
|
|
1544
1502
|
}
|
|
1545
1503
|
}
|
|
1546
1504
|
if (config.organisationRoles && config.organisationRoles.length > 0) {
|
|
1547
|
-
const { isOrganisationAdmin } = await import("./api-
|
|
1505
|
+
const { isOrganisationAdmin } = await import("./api-BMFCXVQX.js");
|
|
1548
1506
|
const isOrgAdmin = await isOrganisationAdmin(userId, organisationId);
|
|
1549
1507
|
if (!isOrgAdmin && config.requireAll !== false) {
|
|
1550
1508
|
throw new Error(`Organisation admin role required`);
|
|
1551
1509
|
}
|
|
1552
1510
|
}
|
|
1553
1511
|
if (config.eventAppRoles && config.eventAppRoles.length > 0 && eventId && appId) {
|
|
1554
|
-
const { isEventAdmin } = await import("./api-
|
|
1512
|
+
const { isEventAdmin } = await import("./api-BMFCXVQX.js");
|
|
1555
1513
|
const isEventAdminUser = await isEventAdmin(userId, { organisationId, eventId, appId });
|
|
1556
1514
|
if (!isEventAdminUser && config.requireAll !== false) {
|
|
1557
1515
|
throw new Error(`Event admin role required`);
|
|
@@ -1591,7 +1549,7 @@ function createRBACMiddleware(config) {
|
|
|
1591
1549
|
);
|
|
1592
1550
|
if (protectedRoute) {
|
|
1593
1551
|
try {
|
|
1594
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1552
|
+
const { isPermitted: isPermitted2 } = await import("./api-BMFCXVQX.js");
|
|
1595
1553
|
const hasPermission2 = await isPermitted2({
|
|
1596
1554
|
userId,
|
|
1597
1555
|
scope: { organisationId },
|
|
@@ -1618,7 +1576,7 @@ function createRBACExpressMiddleware(config) {
|
|
|
1618
1576
|
return res.status(401).json({ error: "User context required" });
|
|
1619
1577
|
}
|
|
1620
1578
|
try {
|
|
1621
|
-
const { isPermitted: isPermitted2 } = await import("./api-
|
|
1579
|
+
const { isPermitted: isPermitted2 } = await import("./api-BMFCXVQX.js");
|
|
1622
1580
|
const hasPermission2 = await isPermitted2({
|
|
1623
1581
|
userId,
|
|
1624
1582
|
scope: { organisationId, eventId, appId },
|
|
@@ -1759,6 +1717,351 @@ var ALL_PERMISSIONS = {
|
|
|
1759
1717
|
...PAGE_PERMISSIONS
|
|
1760
1718
|
};
|
|
1761
1719
|
|
|
1720
|
+
// src/rbac/compliance/setup-validator.ts
|
|
1721
|
+
function isRBACInitialized() {
|
|
1722
|
+
try {
|
|
1723
|
+
const config = getRBACConfig();
|
|
1724
|
+
return config !== null && config.supabase !== null;
|
|
1725
|
+
} catch (error) {
|
|
1726
|
+
if (error instanceof RBACNotInitializedError) {
|
|
1727
|
+
return false;
|
|
1728
|
+
}
|
|
1729
|
+
throw error;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
function getSetupIssues() {
|
|
1733
|
+
const issues = [];
|
|
1734
|
+
const config = getRBACConfig();
|
|
1735
|
+
if (!config) {
|
|
1736
|
+
issues.push({
|
|
1737
|
+
type: "not-initialized",
|
|
1738
|
+
message: "RBAC system has not been initialized. setupRBAC() has not been called.",
|
|
1739
|
+
recommendation: "Call setupRBAC(supabase) before using any RBAC features. This should be done in your main entry point (main.tsx or App.tsx) before rendering the app."
|
|
1740
|
+
});
|
|
1741
|
+
return issues;
|
|
1742
|
+
}
|
|
1743
|
+
if (!config.supabase) {
|
|
1744
|
+
issues.push({
|
|
1745
|
+
type: "missing-config",
|
|
1746
|
+
message: "RBAC configuration is missing Supabase client.",
|
|
1747
|
+
recommendation: "Ensure setupRBAC() is called with a valid Supabase client instance."
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
return issues;
|
|
1751
|
+
}
|
|
1752
|
+
function getProviderContextIssues() {
|
|
1753
|
+
const issues = [];
|
|
1754
|
+
if (!isRBACInitialized()) {
|
|
1755
|
+
issues.push({
|
|
1756
|
+
type: "not-initialized",
|
|
1757
|
+
message: "RBAC system must be initialized before provider context can be used.",
|
|
1758
|
+
recommendation: "Call setupRBAC(supabase) before rendering UnifiedAuthProvider."
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
return issues;
|
|
1762
|
+
}
|
|
1763
|
+
function validateRBACSetup() {
|
|
1764
|
+
const issues = getSetupIssues();
|
|
1765
|
+
const providerIssues = getProviderContextIssues();
|
|
1766
|
+
return {
|
|
1767
|
+
isCompliant: issues.length === 0 && providerIssues.length === 0,
|
|
1768
|
+
issues: [...issues, ...providerIssues]
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// src/rbac/compliance/runtime-compliance.ts
|
|
1773
|
+
function checkRuntimeCompliance() {
|
|
1774
|
+
const logger2 = getRBACLogger();
|
|
1775
|
+
const setupValidation = validateRBACSetup();
|
|
1776
|
+
const warnings = [];
|
|
1777
|
+
if (!setupValidation.isCompliant) {
|
|
1778
|
+
setupValidation.issues.forEach((issue) => {
|
|
1779
|
+
const warning = `[RBAC Compliance] ${issue.message}
|
|
1780
|
+
Recommendation: ${issue.recommendation}`;
|
|
1781
|
+
warnings.push(warning);
|
|
1782
|
+
logger2.warn(warning);
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
const providerContextIssues = setupValidation.issues.filter(
|
|
1786
|
+
(issue) => issue.type === "missing-provider-context" || issue.type === "not-initialized"
|
|
1787
|
+
);
|
|
1788
|
+
const providerContext = providerContextIssues.length > 0 ? {
|
|
1789
|
+
available: false,
|
|
1790
|
+
message: "UnifiedAuthProvider context may not be available. Ensure your app is wrapped with UnifiedAuthProvider from @jmruthers/pace-core."
|
|
1791
|
+
} : {
|
|
1792
|
+
available: true
|
|
1793
|
+
};
|
|
1794
|
+
return {
|
|
1795
|
+
setup: setupValidation,
|
|
1796
|
+
warnings,
|
|
1797
|
+
providerContext
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
function validateAndWarn() {
|
|
1801
|
+
if (import.meta.env.MODE === "development" || import.meta.env.DEV) {
|
|
1802
|
+
checkRuntimeCompliance();
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// src/rbac/compliance/database-validator.ts
|
|
1807
|
+
async function validateDatabaseConfiguration(supabase, appName) {
|
|
1808
|
+
const issues = [];
|
|
1809
|
+
const recommendations = [];
|
|
1810
|
+
let appConfigured = false;
|
|
1811
|
+
let pagesConfigured = false;
|
|
1812
|
+
let permissionsConfigured = false;
|
|
1813
|
+
let rlsPoliciesActive = false;
|
|
1814
|
+
let rolesConfigured = false;
|
|
1815
|
+
try {
|
|
1816
|
+
const { data: app, error: appError } = await supabase.from("rbac_apps").select("id, name").eq("name", appName).single();
|
|
1817
|
+
if (appError || !app) {
|
|
1818
|
+
issues.push({
|
|
1819
|
+
type: "app-not-configured",
|
|
1820
|
+
message: `App '${appName}' not found in rbac_apps table.`,
|
|
1821
|
+
recommendation: `Register your app in the rbac_apps table with name '${appName}' (case-sensitive).`
|
|
1822
|
+
});
|
|
1823
|
+
} else {
|
|
1824
|
+
appConfigured = true;
|
|
1825
|
+
if (app.name !== appName) {
|
|
1826
|
+
issues.push({
|
|
1827
|
+
type: "app-name-mismatch",
|
|
1828
|
+
message: `App name mismatch. Database has '${app.name}', but environment variable has '${appName}'.`,
|
|
1829
|
+
recommendation: `Ensure VITE_APP_NAME (or NEXT_PUBLIC_APP_NAME) matches the app name in rbac_apps table exactly (case-sensitive).`
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
const { data: pages, error: pagesError } = await supabase.from("rbac_app_pages").select("id").eq("app_id", app.id).limit(1);
|
|
1833
|
+
if (pagesError || !pages || pages.length === 0) {
|
|
1834
|
+
issues.push({
|
|
1835
|
+
type: "pages-not-configured",
|
|
1836
|
+
message: `No pages found for app '${appName}' in rbac_app_pages table.`,
|
|
1837
|
+
recommendation: "Register your app pages in the rbac_app_pages table. Each route/page should have an entry."
|
|
1838
|
+
});
|
|
1839
|
+
} else {
|
|
1840
|
+
pagesConfigured = true;
|
|
1841
|
+
const { data: permissions, error: permissionsError } = await supabase.from("rbac_page_permissions").select("id").in("page_id", pages.map((p) => p.id)).limit(1);
|
|
1842
|
+
if (permissionsError || !permissions || permissions.length === 0) {
|
|
1843
|
+
issues.push({
|
|
1844
|
+
type: "permissions-not-configured",
|
|
1845
|
+
message: `No permissions found for app '${appName}' pages in rbac_page_permissions table.`,
|
|
1846
|
+
recommendation: "Configure permissions for your app pages in the rbac_page_permissions table. Each page should have permissions for different operations (read, create, update, delete)."
|
|
1847
|
+
});
|
|
1848
|
+
} else {
|
|
1849
|
+
permissionsConfigured = true;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
try {
|
|
1854
|
+
const { data: rbacTables, error: rlsError } = await supabase.rpc("rbac_check_rls_status");
|
|
1855
|
+
if (rlsError) {
|
|
1856
|
+
rlsPoliciesActive = true;
|
|
1857
|
+
recommendations.push("Consider adding an RLS status check function to validate RLS policies are active.");
|
|
1858
|
+
} else {
|
|
1859
|
+
rlsPoliciesActive = true;
|
|
1860
|
+
}
|
|
1861
|
+
} catch (error) {
|
|
1862
|
+
rlsPoliciesActive = true;
|
|
1863
|
+
recommendations.push("Consider adding an RLS status check function to validate RLS policies are active.");
|
|
1864
|
+
}
|
|
1865
|
+
const { data: orgRoles, error: rolesError } = await supabase.from("rbac_organisation_roles").select("id").limit(1);
|
|
1866
|
+
if (rolesError) {
|
|
1867
|
+
issues.push({
|
|
1868
|
+
type: "roles-not-configured",
|
|
1869
|
+
message: "Unable to query rbac_organisation_roles table. RLS might be blocking access or table might not exist.",
|
|
1870
|
+
recommendation: "Ensure rbac_organisation_roles table exists and RLS policies allow read access for authenticated users."
|
|
1871
|
+
});
|
|
1872
|
+
} else {
|
|
1873
|
+
rolesConfigured = true;
|
|
1874
|
+
}
|
|
1875
|
+
} catch (error) {
|
|
1876
|
+
issues.push({
|
|
1877
|
+
type: "app-not-configured",
|
|
1878
|
+
message: `Error validating database configuration: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
1879
|
+
recommendation: "Check your Supabase connection and ensure you have the necessary permissions to query RBAC tables."
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
return {
|
|
1883
|
+
appConfigured,
|
|
1884
|
+
pagesConfigured,
|
|
1885
|
+
permissionsConfigured,
|
|
1886
|
+
rlsPoliciesActive,
|
|
1887
|
+
rolesConfigured,
|
|
1888
|
+
issues,
|
|
1889
|
+
recommendations
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
// src/rbac/compliance/quick-fix-suggestions.ts
|
|
1894
|
+
function getCustomAuthCodeFixes(customCodeName, type) {
|
|
1895
|
+
const fixes = {
|
|
1896
|
+
"useAuth": {
|
|
1897
|
+
issue: `Custom ${type} '${customCodeName}' detected`,
|
|
1898
|
+
suggestion: `Replace with useUnifiedAuth from pace-core`,
|
|
1899
|
+
codeExample: `// Before
|
|
1900
|
+
import { useAuth } from './hooks/useAuth';
|
|
1901
|
+
|
|
1902
|
+
// After
|
|
1903
|
+
import { useUnifiedAuth } from '@jmruthers/pace-core';`,
|
|
1904
|
+
migrationSteps: [
|
|
1905
|
+
"Remove custom useAuth hook",
|
|
1906
|
+
"Import useUnifiedAuth from @jmruthers/pace-core",
|
|
1907
|
+
"Update all usages to use useUnifiedAuth",
|
|
1908
|
+
"Ensure UnifiedAuthProvider wraps your app"
|
|
1909
|
+
]
|
|
1910
|
+
},
|
|
1911
|
+
"usePermissions": {
|
|
1912
|
+
issue: `Custom ${type} '${customCodeName}' detected`,
|
|
1913
|
+
suggestion: `Replace with usePermissions from pace-core`,
|
|
1914
|
+
codeExample: `// Before
|
|
1915
|
+
import { usePermissions } from './hooks/usePermissions';
|
|
1916
|
+
|
|
1917
|
+
// After
|
|
1918
|
+
import { usePermissions } from '@jmruthers/pace-core/rbac';`,
|
|
1919
|
+
migrationSteps: [
|
|
1920
|
+
"Remove custom usePermissions hook",
|
|
1921
|
+
"Import usePermissions from @jmruthers/pace-core/rbac",
|
|
1922
|
+
"Update all usages - ensure setupRBAC() has been called",
|
|
1923
|
+
"Verify provider hierarchy is correct"
|
|
1924
|
+
]
|
|
1925
|
+
},
|
|
1926
|
+
"PermissionGuard": {
|
|
1927
|
+
issue: `Custom ${type} '${customCodeName}' detected`,
|
|
1928
|
+
suggestion: `Replace with PagePermissionGuard from pace-core`,
|
|
1929
|
+
codeExample: `// Before
|
|
1930
|
+
import { PermissionGuard } from './components/PermissionGuard';
|
|
1931
|
+
|
|
1932
|
+
// After
|
|
1933
|
+
import { PagePermissionGuard } from '@jmruthers/pace-core/rbac';`,
|
|
1934
|
+
migrationSteps: [
|
|
1935
|
+
"Remove custom PermissionGuard component",
|
|
1936
|
+
"Import PagePermissionGuard from @jmruthers/pace-core/rbac",
|
|
1937
|
+
"Wrap pages with PagePermissionGuard",
|
|
1938
|
+
"Use pageName and operation props instead of custom permission strings"
|
|
1939
|
+
]
|
|
1940
|
+
},
|
|
1941
|
+
"checkPermission": {
|
|
1942
|
+
issue: `Custom ${type} '${customCodeName}' detected`,
|
|
1943
|
+
suggestion: `Replace with isPermitted from pace-core`,
|
|
1944
|
+
codeExample: `// Before
|
|
1945
|
+
import { checkPermission } from './utils/permissions';
|
|
1946
|
+
|
|
1947
|
+
// After
|
|
1948
|
+
import { isPermitted } from '@jmruthers/pace-core/rbac';`,
|
|
1949
|
+
migrationSteps: [
|
|
1950
|
+
"Remove custom checkPermission utility",
|
|
1951
|
+
"Import isPermitted from @jmruthers/pace-core/rbac",
|
|
1952
|
+
"Update all usages to use isPermitted with proper scope",
|
|
1953
|
+
"Ensure setupRBAC() has been called"
|
|
1954
|
+
]
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
return fixes[customCodeName] || {
|
|
1958
|
+
issue: `Custom ${type} '${customCodeName}' detected`,
|
|
1959
|
+
suggestion: `Use pace-core's equivalent instead. Check @jmruthers/pace-core documentation for the correct import.`,
|
|
1960
|
+
migrationSteps: [
|
|
1961
|
+
`Remove custom ${customCodeName} ${type}`,
|
|
1962
|
+
"Find equivalent in pace-core",
|
|
1963
|
+
"Import from @jmruthers/pace-core or @jmruthers/pace-core/rbac",
|
|
1964
|
+
"Update all usages"
|
|
1965
|
+
]
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
function getDuplicateConfigFixes() {
|
|
1969
|
+
return {
|
|
1970
|
+
issue: "Multiple Supabase client instantiations found",
|
|
1971
|
+
suggestion: "Consolidate to a single Supabase client configuration",
|
|
1972
|
+
codeExample: `// Before - Multiple createClient calls
|
|
1973
|
+
// src/lib/supabase.ts
|
|
1974
|
+
export const supabase = createClient(url, key);
|
|
1975
|
+
|
|
1976
|
+
// src/utils/api.ts
|
|
1977
|
+
export const supabase = createClient(url, key);
|
|
1978
|
+
|
|
1979
|
+
// After - Single configuration
|
|
1980
|
+
// src/lib/supabase.ts
|
|
1981
|
+
export const supabase = createClient(
|
|
1982
|
+
import.meta.env.VITE_SUPABASE_URL,
|
|
1983
|
+
import.meta.env.VITE_SUPABASE_ANON_KEY
|
|
1984
|
+
);
|
|
1985
|
+
|
|
1986
|
+
// src/utils/api.ts
|
|
1987
|
+
import { supabase } from '../lib/supabase';`,
|
|
1988
|
+
migrationSteps: [
|
|
1989
|
+
"Create a single supabase.ts file in a shared location (e.g., src/lib/supabase.ts)",
|
|
1990
|
+
"Move all Supabase client creation to this file",
|
|
1991
|
+
"Export the client instance",
|
|
1992
|
+
"Update all files to import from the shared location",
|
|
1993
|
+
"Remove duplicate createClient calls"
|
|
1994
|
+
]
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
function getUnprotectedPageFixes() {
|
|
1998
|
+
return {
|
|
1999
|
+
issue: "Route/page found without PagePermissionGuard",
|
|
2000
|
+
suggestion: "Wrap all routes with PagePermissionGuard",
|
|
2001
|
+
codeExample: `// Before
|
|
2002
|
+
<Route path="/dashboard" element={<Dashboard />} />
|
|
2003
|
+
|
|
2004
|
+
// After
|
|
2005
|
+
<Route
|
|
2006
|
+
path="/dashboard"
|
|
2007
|
+
element={
|
|
2008
|
+
<PagePermissionGuard pageName="dashboard" operation="read">
|
|
2009
|
+
<Dashboard />
|
|
2010
|
+
</PagePermissionGuard>
|
|
2011
|
+
}
|
|
2012
|
+
/>`,
|
|
2013
|
+
migrationSteps: [
|
|
2014
|
+
"Import PagePermissionGuard from @jmruthers/pace-core/rbac",
|
|
2015
|
+
"Wrap each route/page component with PagePermissionGuard",
|
|
2016
|
+
"Set pageName prop to match your page name in rbac_app_pages table",
|
|
2017
|
+
"Set operation prop (read, create, update, or delete)",
|
|
2018
|
+
"Ensure setupRBAC() has been called and providers are set up correctly"
|
|
2019
|
+
]
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
function getDirectSupabaseAuthFixes() {
|
|
2023
|
+
return {
|
|
2024
|
+
issue: "Direct Supabase auth usage detected",
|
|
2025
|
+
suggestion: "Use UnifiedAuthProvider and useUnifiedAuth from pace-core",
|
|
2026
|
+
codeExample: `// Before
|
|
2027
|
+
import { createClient } from '@supabase/supabase-js';
|
|
2028
|
+
const supabase = createClient(url, key);
|
|
2029
|
+
await supabase.auth.signInWithPassword({ email, password });
|
|
2030
|
+
|
|
2031
|
+
// After
|
|
2032
|
+
import { useUnifiedAuth } from '@jmruthers/pace-core';
|
|
2033
|
+
const { signIn } = useUnifiedAuth();
|
|
2034
|
+
await signIn({ email, password });`,
|
|
2035
|
+
migrationSteps: [
|
|
2036
|
+
"Remove direct Supabase auth calls",
|
|
2037
|
+
"Import useUnifiedAuth from @jmruthers/pace-core",
|
|
2038
|
+
"Use the auth methods from useUnifiedAuth hook",
|
|
2039
|
+
"Ensure UnifiedAuthProvider wraps your app",
|
|
2040
|
+
"Update all auth-related code to use pace-core hooks"
|
|
2041
|
+
]
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
function getQuickFixes(issueType, details) {
|
|
2045
|
+
const fixes = [];
|
|
2046
|
+
switch (issueType) {
|
|
2047
|
+
case "custom-auth-code":
|
|
2048
|
+
if (details?.name && details?.type) {
|
|
2049
|
+
fixes.push(getCustomAuthCodeFixes(details.name, details.type));
|
|
2050
|
+
}
|
|
2051
|
+
break;
|
|
2052
|
+
case "duplicate-config":
|
|
2053
|
+
fixes.push(getDuplicateConfigFixes());
|
|
2054
|
+
break;
|
|
2055
|
+
case "unprotected-pages":
|
|
2056
|
+
fixes.push(getUnprotectedPageFixes());
|
|
2057
|
+
break;
|
|
2058
|
+
case "direct-supabase-auth":
|
|
2059
|
+
fixes.push(getDirectSupabaseAuthFixes());
|
|
2060
|
+
break;
|
|
2061
|
+
}
|
|
2062
|
+
return fixes;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
1762
2065
|
export {
|
|
1763
2066
|
RPCFunction,
|
|
1764
2067
|
RBACErrorCode,
|
|
@@ -1789,6 +2092,17 @@ export {
|
|
|
1789
2092
|
PAGE_PERMISSIONS,
|
|
1790
2093
|
isValidPermission,
|
|
1791
2094
|
getPermissionsForRole,
|
|
1792
|
-
ALL_PERMISSIONS
|
|
2095
|
+
ALL_PERMISSIONS,
|
|
2096
|
+
isRBACInitialized,
|
|
2097
|
+
getSetupIssues,
|
|
2098
|
+
validateRBACSetup,
|
|
2099
|
+
checkRuntimeCompliance,
|
|
2100
|
+
validateAndWarn,
|
|
2101
|
+
validateDatabaseConfiguration,
|
|
2102
|
+
getCustomAuthCodeFixes,
|
|
2103
|
+
getDuplicateConfigFixes,
|
|
2104
|
+
getUnprotectedPageFixes,
|
|
2105
|
+
getDirectSupabaseAuthFixes,
|
|
2106
|
+
getQuickFixes
|
|
1793
2107
|
};
|
|
1794
|
-
//# sourceMappingURL=chunk-
|
|
2108
|
+
//# sourceMappingURL=chunk-AISXLWGZ.js.map
|