@jmruthers/pace-core 0.5.136 → 0.5.137
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-CYOHOX3O.js → DataTable-6M4L6BI2.js} +10 -9
- package/dist/{EventLogo-801uofbR.d.ts → EventLogo-rFL_kRjk.d.ts} +73 -1
- package/dist/{UnifiedAuthProvider-5E5TUNMS.js → UnifiedAuthProvider-XIQQ7LVU.js} +4 -5
- package/dist/{chunk-YLKIDTUK.js → chunk-22WKWKRX.js} +4 -4
- package/dist/{chunk-TVYPTYOY.js → chunk-4C7EXCAR.js} +60 -24
- package/dist/chunk-4C7EXCAR.js.map +1 -0
- package/dist/{chunk-2TWNJ46Y.js → chunk-6LAAY47Q.js} +2 -2
- package/dist/{chunk-444EZN6N.js → chunk-7QCC6MCP.js} +88 -1
- package/dist/chunk-7QCC6MCP.js.map +1 -0
- package/dist/{chunk-FHWWBIHA.js → chunk-BCIBECNB.js} +5 -5
- package/dist/chunk-BJPBT3CU.js +21 -0
- package/dist/chunk-BJPBT3CU.js.map +1 -0
- package/dist/{chunk-L6PGMCMD.js → chunk-BLCXZEYF.js} +3 -3
- package/dist/{chunk-HJGGOMQ6.js → chunk-HAWZXGR2.js} +147 -103
- package/dist/chunk-HAWZXGR2.js.map +1 -0
- package/dist/{chunk-XARJS7CD.js → chunk-INQLMHPF.js} +2 -2
- package/dist/chunk-JISYG63F.js +70 -0
- package/dist/chunk-JISYG63F.js.map +1 -0
- package/dist/{chunk-NOHEVYVX.js → chunk-KYRHUBIU.js} +417 -319
- package/dist/chunk-KYRHUBIU.js.map +1 -0
- package/dist/{chunk-SL2YQDR6.js → chunk-MA6EPSGZ.js} +2 -2
- package/dist/{chunk-5DPZ5EAT.js → chunk-OWAG3GSU.js} +1 -3
- package/dist/{chunk-LTV3XIJJ.js → chunk-T6JN6LH6.js} +4 -4
- package/dist/{chunk-4MT5BGGL.js → chunk-YCWDTTUK.js} +4 -6
- package/dist/{chunk-4MT5BGGL.js.map → chunk-YCWDTTUK.js.map} +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +12 -11
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +8 -9
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/providers.js +3 -4
- package/dist/rbac/index.js +8 -9
- package/dist/schema-DTDZQe2u.d.ts +28 -0
- package/dist/types.d.ts +152 -3
- package/dist/types.js +51 -16
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +89 -4
- package/dist/utils.js +214 -96
- package/dist/utils.js.map +1 -1
- package/dist/validation.d.ts +1 -343
- package/dist/validation.js +3 -100
- 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/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/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +27 -0
- 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/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/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.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/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/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/ProtectedRouteProps.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/RBACLogger.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/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.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/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/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/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 +79 -10
- package/docs/architecture/README.md +0 -1
- package/docs/styles/README.md +0 -2
- package/examples/RBAC/CompleteRBACExample.tsx +324 -0
- package/examples/RBAC/EventBasedApp.tsx +239 -0
- package/examples/RBAC/PermissionExample.tsx +151 -0
- package/examples/RBAC/index.ts +13 -0
- package/examples/public-pages/CorrectPublicPageImplementation.tsx +301 -0
- package/examples/public-pages/PublicEventPage.tsx +274 -0
- package/examples/public-pages/PublicPageApp.tsx +308 -0
- package/examples/public-pages/PublicPageUsageExample.tsx +216 -0
- package/examples/public-pages/index.ts +14 -0
- package/package.json +1 -10
- package/src/__tests__/TEST_STANDARD.md +92 -0
- package/src/components/Badge/Badge.test.tsx +314 -0
- package/src/components/Badge/Badge.tsx +304 -0
- package/src/components/Badge/index.ts +3 -0
- package/src/components/DataTable/__tests__/DataTableCore.test-setup.ts +217 -0
- package/src/components/DataTable/__tests__/styles.test.ts +1 -1
- package/src/components/DataTable/components/ColumnFilter.tsx +8 -4
- package/src/components/DataTable/components/DataTableBody.tsx +461 -0
- package/src/components/DataTable/components/DraggableColumnHeader.tsx +144 -0
- package/src/components/DataTable/components/FilterRow.tsx +9 -3
- package/src/components/DataTable/components/PaginationControls.tsx +1 -0
- package/src/components/DataTable/components/VirtualizedDataTable.tsx +513 -0
- package/src/components/DataTable/components/__tests__/AccessDeniedPage.test.tsx +14 -68
- package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +62 -0
- package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +43 -0
- package/src/components/DataTable/core/ActionManager.ts +235 -0
- package/src/components/DataTable/core/ColumnManager.ts +205 -0
- package/src/components/DataTable/core/DataManager.ts +188 -0
- package/src/components/DataTable/core/DataTableContext.tsx +181 -0
- package/src/components/DataTable/core/LocalDataAdapter.ts +273 -0
- package/src/components/DataTable/core/PluginRegistry.ts +229 -0
- package/src/components/DataTable/core/StateManager.ts +311 -0
- package/src/components/DataTable/core/interfaces.ts +338 -0
- package/src/components/DataTable/styles.ts +27 -6
- package/src/components/DataTable/utils/__tests__/columnUtils.test.ts +94 -0
- package/src/components/DataTable/utils/columnUtils.ts +40 -0
- package/src/components/DataTable/utils/debugTools.ts +609 -0
- package/src/components/DataTable/utils/index.ts +1 -0
- package/src/components/Dialog/README.md +804 -0
- package/src/components/Dialog/utils/__tests__/safeHtml.unit.test.ts +611 -0
- package/src/components/Dialog/utils/safeHtml.ts +185 -0
- package/src/components/Footer/Footer.test.tsx +1 -1
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/FormErrorSummary.tsx +113 -0
- package/src/components/Form/FormFieldset.tsx +127 -0
- package/src/components/Form/FormLiveRegion.tsx +198 -0
- package/src/components/LoginForm/LoginForm.test.tsx +1 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.performance.test.tsx +76 -10
- package/src/components/PaceLoginPage/PaceLoginPage.tsx +1 -1
- package/src/components/PasswordReset/PasswordResetForm.test.tsx +597 -0
- package/src/components/PasswordReset/PasswordResetForm.tsx +201 -0
- package/src/components/PublicLayout/PublicPageDebugger.tsx +104 -0
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +162 -0
- package/src/components/PublicLayout/__tests__/PublicPageFooter.test.tsx +1 -1
- package/src/components/Select/Select.test.tsx +1 -1
- package/src/components/Select/Select.tsx +20 -8
- package/src/components/Table/__tests__/Table.test.tsx +1 -1
- package/src/components/index.ts +3 -0
- package/src/hooks/__tests__/useFileUrl.unit.test.ts +83 -85
- package/src/index.ts +4 -0
- package/src/styles/core.css +3 -0
- package/src/utils/appConfig.ts +47 -0
- package/src/utils/appIdResolver.test.ts +499 -0
- package/src/utils/appIdResolver.ts +130 -0
- package/src/utils/appNameResolver.simple.test.ts +212 -0
- package/src/utils/appNameResolver.test.ts +121 -0
- package/src/utils/appNameResolver.ts +191 -0
- package/src/utils/audit.ts +127 -0
- package/src/utils/auth-utils.ts +96 -0
- package/src/utils/bundleAnalysis.ts +129 -0
- package/src/utils/cn.ts +7 -0
- package/src/utils/debugLogger.ts +67 -0
- package/src/utils/deviceFingerprint.ts +215 -0
- package/src/utils/dynamicUtils.ts +105 -0
- package/src/utils/file-reference.test.ts +788 -0
- package/src/utils/file-reference.ts +519 -0
- package/src/utils/formatDate.test.ts +237 -0
- package/src/utils/formatting.ts +133 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/lazyLoad.tsx +44 -0
- package/src/utils/logger.ts +179 -0
- package/src/utils/organisationContext.test.ts +322 -0
- package/src/utils/organisationContext.ts +153 -0
- package/src/utils/performanceBenchmark.ts +64 -0
- package/src/utils/performanceBudgets.ts +110 -0
- package/src/utils/permissionTypes.ts +37 -0
- package/src/utils/permissionUtils.test.ts +393 -0
- package/src/utils/permissionUtils.ts +34 -0
- package/src/utils/sanitization.ts +264 -0
- package/src/utils/schemaUtils.ts +37 -0
- package/src/utils/secureDataAccess.test.ts +711 -0
- package/src/utils/secureDataAccess.ts +377 -0
- package/src/utils/secureErrors.ts +79 -0
- package/src/utils/secureStorage.ts +244 -0
- package/src/utils/security.ts +156 -0
- package/src/utils/securityMonitor.ts +45 -0
- package/src/utils/sessionTracking.ts +126 -0
- package/src/utils/validation.ts +111 -0
- package/src/utils/validationUtils.ts +120 -0
- package/src/validation/index.ts +2 -2
- package/dist/chunk-444EZN6N.js.map +0 -1
- package/dist/chunk-APIBCTL2.js +0 -670
- package/dist/chunk-APIBCTL2.js.map +0 -1
- package/dist/chunk-HJGGOMQ6.js.map +0 -1
- package/dist/chunk-K2WWTH7O.js +0 -94
- package/dist/chunk-K2WWTH7O.js.map +0 -1
- package/dist/chunk-LMC26NLJ.js +0 -84
- package/dist/chunk-LMC26NLJ.js.map +0 -1
- package/dist/chunk-NOHEVYVX.js.map +0 -1
- package/dist/chunk-TVYPTYOY.js.map +0 -1
- package/dist/validation-8npbysjg.d.ts +0 -177
- /package/dist/{DataTable-CYOHOX3O.js.map → DataTable-6M4L6BI2.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-5E5TUNMS.js.map → UnifiedAuthProvider-XIQQ7LVU.js.map} +0 -0
- /package/dist/{chunk-YLKIDTUK.js.map → chunk-22WKWKRX.js.map} +0 -0
- /package/dist/{chunk-2TWNJ46Y.js.map → chunk-6LAAY47Q.js.map} +0 -0
- /package/dist/{chunk-FHWWBIHA.js.map → chunk-BCIBECNB.js.map} +0 -0
- /package/dist/{chunk-L6PGMCMD.js.map → chunk-BLCXZEYF.js.map} +0 -0
- /package/dist/{chunk-XARJS7CD.js.map → chunk-INQLMHPF.js.map} +0 -0
- /package/dist/{chunk-SL2YQDR6.js.map → chunk-MA6EPSGZ.js.map} +0 -0
- /package/dist/{chunk-5DPZ5EAT.js.map → chunk-OWAG3GSU.js.map} +0 -0
- /package/dist/{chunk-LTV3XIJJ.js.map → chunk-T6JN6LH6.js.map} +0 -0
- /package/examples/{components → components 2}/DataTable/HierarchicalActionsExample.tsx +0 -0
- /package/examples/{components → components 2}/DataTable/HierarchicalExample.tsx +0 -0
- /package/examples/{components → components 2}/DataTable/InitialPageSizeExample.tsx +0 -0
- /package/examples/{components → components 2}/DataTable/PerformanceExample.tsx +0 -0
- /package/examples/{components → components 2}/DataTable/index.ts +0 -0
- /package/examples/{components → components 2}/Dialog/BasicHtmlTest.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/DebugHtmlExample.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/HtmlDialogExample.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/ScrollableDialogExample.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/SimpleHtmlTest.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/SmartDialogExample.tsx +0 -0
- /package/examples/{components → components 2}/Dialog/index.ts +0 -0
- /package/examples/{components → components 2}/index.ts +0 -0
package/dist/chunk-K2WWTH7O.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createLogger,
|
|
3
|
-
init_logger
|
|
4
|
-
} from "./chunk-XDNLUEXI.js";
|
|
5
|
-
import {
|
|
6
|
-
__esm
|
|
7
|
-
} from "./chunk-PLDDJCW6.js";
|
|
8
|
-
|
|
9
|
-
// src/utils/context/organisationContext.ts
|
|
10
|
-
async function setOrganisationContext(supabase, organisationId) {
|
|
11
|
-
if (!supabase || !organisationId) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
16
|
-
setTimeout(() => reject(new Error("RPC timeout after 3 seconds")), 3e3);
|
|
17
|
-
});
|
|
18
|
-
const rpcPromise = supabase.rpc("set_organisation_context", {
|
|
19
|
-
org_id: organisationId
|
|
20
|
-
});
|
|
21
|
-
const { error } = await Promise.race([rpcPromise, timeoutPromise]);
|
|
22
|
-
if (error) {
|
|
23
|
-
log.debug("RPC function not available or failed, continuing without database context");
|
|
24
|
-
} else {
|
|
25
|
-
log.debug("Organisation context set in database successfully");
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
log.debug("Failed to set database context, continuing without it:", error);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async function clearOrganisationContext(supabase) {
|
|
32
|
-
if (!supabase) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const { error } = await supabase.rpc("rbac_audit_log", {
|
|
37
|
-
p_event_type: "organisation_switched",
|
|
38
|
-
p_metadata: { action: "clear_context" }
|
|
39
|
-
});
|
|
40
|
-
if (error) {
|
|
41
|
-
} else {
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
async function getOrganisationContext(supabase) {
|
|
47
|
-
if (!supabase) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const data = null;
|
|
52
|
-
const error = null;
|
|
53
|
-
if (error) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
if (typeof data === "string") {
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function isOrganisationContextAvailable(supabase) {
|
|
65
|
-
if (!supabase) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const { error } = await supabase.rpc("get_organisation_context");
|
|
70
|
-
if (error) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
var log;
|
|
79
|
-
var init_organisationContext = __esm({
|
|
80
|
-
"src/utils/context/organisationContext.ts"() {
|
|
81
|
-
"use strict";
|
|
82
|
-
init_logger();
|
|
83
|
-
log = createLogger("organisationContext");
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
setOrganisationContext,
|
|
89
|
-
clearOrganisationContext,
|
|
90
|
-
getOrganisationContext,
|
|
91
|
-
isOrganisationContextAvailable,
|
|
92
|
-
init_organisationContext
|
|
93
|
-
};
|
|
94
|
-
//# sourceMappingURL=chunk-K2WWTH7O.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/context/organisationContext.ts"],"sourcesContent":["/**\n * @file Organisation Context Utility\n * @package @jmruthers/pace-core\n * @module Utils/OrganisationContext\n * @since 0.4.0\n *\n * Utility functions for managing organisation context in database sessions.\n * Provides fallback mechanisms for when database functions are not available.\n */\n\nimport type { SupabaseClient } from '@supabase/supabase-js';\nimport { createLogger } from '../core/logger';\n\nconst log = createLogger('organisationContext');\n\n/**\n * Set organisation context in the database session\n * \n * This function attempts to set the organisation context using a database function.\n * If the function is not available, it falls back gracefully without throwing errors.\n * \n * @param supabase - Supabase client instance\n * @param organisationId - The organisation ID to set as context\n * @returns Promise that resolves when context is set (or falls back gracefully)\n */\nexport async function setOrganisationContext(\n supabase: SupabaseClient,\n organisationId: string\n): Promise<void> {\n if (!supabase || !organisationId) {\n // TODO: Replace with proper logging service integration\n return;\n }\n\n try {\n // Add timeout to prevent hanging RPC calls\n const timeoutPromise = new Promise((_, reject) => {\n setTimeout(() => reject(new Error('RPC timeout after 3 seconds')), 3000);\n });\n \n // Call the database function to set organisation context\n const rpcPromise = supabase.rpc('set_organisation_context', {\n org_id: organisationId\n });\n\n const { error } = await Promise.race([rpcPromise, timeoutPromise]) as any;\n\n if (error) {\n // Function might not exist yet - this is expected during migration\n // Silent fail - will fall back to client-side filtering\n log.debug('RPC function not available or failed, continuing without database context');\n } else {\n log.debug('Organisation context set in database successfully');\n }\n } catch (error) {\n // Handle any other errors gracefully\n // Silent fail - will fall back to client-side filtering\n log.debug('Failed to set database context, continuing without it:', error);\n }\n}\n\n/**\n * Clear organisation context from the database session\n * \n * @param supabase - Supabase client instance\n * @returns Promise that resolves when context is cleared\n */\nexport async function clearOrganisationContext(\n supabase: SupabaseClient\n): Promise<void> {\n if (!supabase) {\n // TODO: Replace with proper logging service integration\n return;\n }\n\n try {\n const { error } = await supabase.rpc('rbac_audit_log', {\n p_event_type: 'organisation_switched',\n p_metadata: { action: 'clear_context' }\n });\n \n if (error) {\n // Silent fail - function not available\n // TODO: Replace with proper logging service integration\n } else {\n // TODO: Replace with proper logging service integration\n }\n } catch (error) {\n // Silent fail - error occurred\n // TODO: Replace with proper logging service integration\n }\n}\n\n/**\n * Get current organisation context from the database session\n * \n * @param supabase - Supabase client instance\n * @returns Promise that resolves to the current organisation ID or null\n */\nexport async function getOrganisationContext(\n supabase: SupabaseClient\n): Promise<string | null> {\n if (!supabase) {\n // TODO: Replace with proper logging service integration\n return null;\n }\n\n try {\n // For now, return null since we're not using database context\n // This will be replaced with proper context management\n const data = null;\n const error = null;\n \n if (error) {\n // TODO: Replace with proper logging service integration\n return null;\n }\n \n // Validate that data is a string (allow empty strings)\n if (typeof data === 'string') {\n return data;\n }\n \n // Return null for invalid data formats\n return null;\n } catch (error) {\n // TODO: Replace with proper logging service integration\n return null;\n }\n}\n\n/**\n * Check if organisation context functions are available in the database\n * \n * @param supabase - Supabase client instance\n * @returns Promise that resolves to true if functions are available\n */\nexport async function isOrganisationContextAvailable(\n supabase: SupabaseClient\n): Promise<boolean> {\n if (!supabase) {\n return false;\n }\n\n try {\n const { error } = await supabase.rpc('get_organisation_context');\n \n if (error) {\n return false;\n }\n \n return true;\n } catch (error) {\n return false;\n }\n} "],"mappings":";;;;;;;;;AAyBA,eAAsB,uBACpB,UACA,gBACe;AACf,MAAI,CAAC,YAAY,CAAC,gBAAgB;AAEhC;AAAA,EACF;AAEA,MAAI;AAEF,UAAM,iBAAiB,IAAI,QAAQ,CAAC,GAAG,WAAW;AAChD,iBAAW,MAAM,OAAO,IAAI,MAAM,6BAA6B,CAAC,GAAG,GAAI;AAAA,IACzE,CAAC;AAGD,UAAM,aAAa,SAAS,IAAI,4BAA4B;AAAA,MAC1D,QAAQ;AAAA,IACV,CAAC;AAED,UAAM,EAAE,MAAM,IAAI,MAAM,QAAQ,KAAK,CAAC,YAAY,cAAc,CAAC;AAEjE,QAAI,OAAO;AAGT,UAAI,MAAM,2EAA2E;AAAA,IACvF,OAAO;AACL,UAAI,MAAM,mDAAmD;AAAA,IAC/D;AAAA,EACF,SAAS,OAAO;AAGd,QAAI,MAAM,0DAA0D,KAAK;AAAA,EAC3E;AACF;AAQA,eAAsB,yBACpB,UACe;AACf,MAAI,CAAC,UAAU;AAEb;AAAA,EACF;AAEA,MAAI;AACF,UAAM,EAAE,MAAM,IAAI,MAAM,SAAS,IAAI,kBAAkB;AAAA,MACrD,cAAc;AAAA,MACd,YAAY,EAAE,QAAQ,gBAAgB;AAAA,IACxC,CAAC;AAED,QAAI,OAAO;AAAA,IAGX,OAAO;AAAA,IAEP;AAAA,EACF,SAAS,OAAO;AAAA,EAGhB;AACF;AAQA,eAAsB,uBACpB,UACwB;AACxB,MAAI,CAAC,UAAU;AAEb,WAAO;AAAA,EACT;AAEA,MAAI;AAGF,UAAM,OAAO;AACb,UAAM,QAAQ;AAEd,QAAI,OAAO;AAET,aAAO;AAAA,IACT;AAGA,QAAI,OAAO,SAAS,UAAU;AAC5B,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT,SAAS,OAAO;AAEd,WAAO;AAAA,EACT;AACF;AAQA,eAAsB,+BACpB,UACkB;AAClB,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,EAAE,MAAM,IAAI,MAAM,SAAS,IAAI,0BAA0B;AAE/D,QAAI,OAAO;AACT,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AA3JA,IAaM;AAbN;AAAA;AAAA;AAWA;AAEA,IAAM,MAAM,aAAa,qBAAqB;AAAA;AAAA;","names":[]}
|
package/dist/chunk-LMC26NLJ.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// src/utils/validation/schema.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
function pickSchema(schema, keys) {
|
|
4
|
-
const shape = Object.entries(schema.shape).filter(([key]) => keys.includes(key)).reduce((acc, [key, value]) => {
|
|
5
|
-
acc[key] = value;
|
|
6
|
-
return acc;
|
|
7
|
-
}, {});
|
|
8
|
-
return z.object(shape);
|
|
9
|
-
}
|
|
10
|
-
function combineSchemas(schemas) {
|
|
11
|
-
return schemas.reduce(
|
|
12
|
-
(merged, schema) => merged.merge(schema),
|
|
13
|
-
z.object({})
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// src/types/validation.ts
|
|
18
|
-
import { z as z2 } from "zod";
|
|
19
|
-
var emailSchema = z2.string().email("Please enter a valid email address");
|
|
20
|
-
var nameSchema = z2.string().min(1, "Name is required").max(100, "Name must be less than 100 characters");
|
|
21
|
-
var phoneSchema = z2.string().regex(/^\+?[\d\s\-\(\)]+$/, "Please enter a valid phone number");
|
|
22
|
-
var urlSchema = z2.string().url("Please enter a valid URL");
|
|
23
|
-
var dateSchema = z2.string().refine((date) => !isNaN(Date.parse(date)), "Please enter a valid date");
|
|
24
|
-
var passwordSchema = z2.string().min(8, "Password must be at least 8 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number");
|
|
25
|
-
var securePasswordSchema = passwordSchema.regex(/[!@#$%^&*(),.?":{}|<>]/, "Password must contain at least one special character");
|
|
26
|
-
var loginSchema = z2.object({
|
|
27
|
-
email: emailSchema,
|
|
28
|
-
password: z2.string().min(1, "Password is required")
|
|
29
|
-
});
|
|
30
|
-
var registrationSchema = z2.object({
|
|
31
|
-
email: emailSchema,
|
|
32
|
-
password: passwordSchema,
|
|
33
|
-
confirmPassword: z2.string()
|
|
34
|
-
}).refine((data) => data.password === data.confirmPassword, {
|
|
35
|
-
message: "Passwords don't match",
|
|
36
|
-
path: ["confirmPassword"]
|
|
37
|
-
});
|
|
38
|
-
var secureLoginSchema = z2.object({
|
|
39
|
-
email: emailSchema,
|
|
40
|
-
password: securePasswordSchema
|
|
41
|
-
});
|
|
42
|
-
var passwordResetSchema = z2.object({
|
|
43
|
-
email: emailSchema
|
|
44
|
-
});
|
|
45
|
-
var changePasswordSchema = z2.object({
|
|
46
|
-
currentPassword: z2.string().min(1, "Current password is required"),
|
|
47
|
-
newPassword: securePasswordSchema,
|
|
48
|
-
confirmPassword: z2.string()
|
|
49
|
-
}).refine((data) => data.newPassword === data.confirmPassword, {
|
|
50
|
-
message: "Passwords don't match",
|
|
51
|
-
path: ["confirmPassword"]
|
|
52
|
-
});
|
|
53
|
-
var userProfileSchema = z2.object({
|
|
54
|
-
name: nameSchema,
|
|
55
|
-
email: emailSchema,
|
|
56
|
-
phone: phoneSchema.optional(),
|
|
57
|
-
website: urlSchema.optional(),
|
|
58
|
-
bio: z2.string().max(500).optional()
|
|
59
|
-
});
|
|
60
|
-
var contactFormSchema = z2.object({
|
|
61
|
-
name: nameSchema,
|
|
62
|
-
email: emailSchema,
|
|
63
|
-
message: z2.string().min(1, "Message is required").max(1e3, "Message must be less than 1000 characters")
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
pickSchema,
|
|
68
|
-
combineSchemas,
|
|
69
|
-
emailSchema,
|
|
70
|
-
nameSchema,
|
|
71
|
-
phoneSchema,
|
|
72
|
-
urlSchema,
|
|
73
|
-
dateSchema,
|
|
74
|
-
passwordSchema,
|
|
75
|
-
securePasswordSchema,
|
|
76
|
-
loginSchema,
|
|
77
|
-
registrationSchema,
|
|
78
|
-
secureLoginSchema,
|
|
79
|
-
passwordResetSchema,
|
|
80
|
-
changePasswordSchema,
|
|
81
|
-
userProfileSchema,
|
|
82
|
-
contactFormSchema
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=chunk-LMC26NLJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/validation/schema.ts","../src/types/validation.ts"],"sourcesContent":["/**\n * @file Schema utility functions\n * @package @jmruthers/pace-core\n * @module Utils/Validation/Schema\n * @since 0.1.0\n * \n * Utility functions for working with Zod schemas.\n */\n\nimport { z } from 'zod';\n\n/**\n * Creates a subset schema from a larger schema\n * \n * @param schema - Original Zod schema\n * @param keys - Array of keys to pick from the schema\n * @returns New schema with only the selected fields\n */\nexport function pickSchema<T extends z.ZodObject<any, any, any>, K extends keyof z.infer<T>>(\n schema: T,\n keys: K[]\n): z.ZodObject<Pick<z.infer<T>, K>> {\n const shape = Object.entries(schema.shape)\n .filter(([key]) => keys.includes(key as K))\n .reduce((acc, [key, value]) => {\n (acc as Record<string, unknown>)[key] = value as unknown;\n return acc;\n }, {} as Record<string, unknown>);\n\n return z.object(shape as Record<string, z.ZodTypeAny>) as z.ZodObject<Pick<z.infer<T>, K>>;\n}\n\n/**\n * Combines multiple Zod schemas into one\n * \n * @param schemas - Array of Zod schemas to combine\n * @returns Combined schema\n */\nexport function combineSchemas<T extends z.ZodObject<any, any, any>[]>(\n schemas: T\n): z.ZodObject<any, any, any> {\n return schemas.reduce(\n (merged, schema) => merged.merge(schema),\n z.object({})\n );\n}\n\n","/**\n * @file Validation Types\n * @package @jmruthers/pace-core\n * @module Types/Validation\n * @since 0.1.0\n * \n * Consolidated validation types and interfaces for the PACE Core library.\n * This file contains all validation-related type definitions.\n */\n\nimport { z } from 'zod';\n\n// ============================================================================\n// Core Validation Interfaces\n// ============================================================================\n\nexport interface ValidationError {\n field: string;\n message: string;\n code: string;\n}\n\nexport interface ValidationResult<T = unknown> {\n success: boolean;\n data?: T;\n errors?: ValidationError[];\n}\n\n// ============================================================================\n// Form Value Types\n// ============================================================================\n\n// Basic form schemas\nexport const emailSchema = z.string().email('Please enter a valid email address');\nexport const nameSchema = z.string().min(1, 'Name is required').max(100, 'Name must be less than 100 characters');\nexport const phoneSchema = z.string().regex(/^\\+?[\\d\\s\\-\\(\\)]+$/, 'Please enter a valid phone number');\nexport const urlSchema = z.string().url('Please enter a valid URL');\nexport const dateSchema = z.string().refine((date) => !isNaN(Date.parse(date)), 'Please enter a valid date');\n\n// Password schemas\nexport const passwordSchema = z.string()\n .min(8, 'Password must be at least 8 characters')\n .regex(/[A-Z]/, 'Password must contain at least one uppercase letter')\n .regex(/[a-z]/, 'Password must contain at least one lowercase letter')\n .regex(/[0-9]/, 'Password must contain at least one number');\n\nexport const securePasswordSchema = passwordSchema\n .regex(/[!@#$%^&*(),.?\":{}|<>]/, 'Password must contain at least one special character');\n\n// Auth schemas\nexport const loginSchema = z.object({\n email: emailSchema,\n password: z.string().min(1, 'Password is required'),\n});\n\nexport const registrationSchema = z.object({\n email: emailSchema,\n password: passwordSchema,\n confirmPassword: z.string(),\n}).refine((data) => data.password === data.confirmPassword, {\n message: \"Passwords don't match\",\n path: [\"confirmPassword\"],\n});\n\nexport const secureLoginSchema = z.object({\n email: emailSchema,\n password: securePasswordSchema,\n});\n\nexport const passwordResetSchema = z.object({\n email: emailSchema,\n});\n\nexport const changePasswordSchema = z.object({\n currentPassword: z.string().min(1, 'Current password is required'),\n newPassword: securePasswordSchema,\n confirmPassword: z.string(),\n}).refine((data) => data.newPassword === data.confirmPassword, {\n message: \"Passwords don't match\",\n path: ['confirmPassword'],\n});\n\n// User schemas\nexport const userProfileSchema = z.object({\n name: nameSchema,\n email: emailSchema,\n phone: phoneSchema.optional(),\n website: urlSchema.optional(),\n bio: z.string().max(500).optional(),\n});\n\n// Contact form schema\nexport const contactFormSchema = z.object({\n name: nameSchema,\n email: emailSchema,\n message: z.string().min(1, 'Message is required').max(1000, 'Message must be less than 1000 characters'),\n});\n\n// ============================================================================\n// Inferred Types\n// ============================================================================\n\nexport type LoginFormValues = z.infer<typeof loginSchema>;\nexport type RegistrationFormValues = z.infer<typeof registrationSchema>;\nexport type ChangePasswordFormValues = z.infer<typeof changePasswordSchema>;\nexport type UserProfileFormValues = z.infer<typeof userProfileSchema>;\n\n// Secure form types (with CSRF protection)\nexport type SecureLoginFormValues = {\n email: string;\n password: string;\n csrfToken?: string;\n};\n\nexport type SecureRegistrationFormValues = {\n email: string;\n password: string;\n confirmPassword: string;\n csrfToken?: string;\n};\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\nexport type FormData = LoginFormData | RegistrationFormData | ProfileFormData | ContactFormData;\n\nexport type LoginFormData = z.infer<typeof loginSchema>;\nexport type RegistrationFormData = z.infer<typeof registrationSchema>;\nexport type ProfileFormData = z.infer<typeof userProfileSchema>;\nexport type ContactFormData = z.infer<typeof contactFormSchema>;\n\n// ============================================================================\n// Schema Utility Functions\n// ============================================================================\n// Re-exported from utils/validation/schema.ts\nexport { pickSchema, combineSchemas } from '../utils/validation/schema';\n"],"mappings":";AASA,SAAS,SAAS;AASX,SAAS,WACd,QACA,MACkC;AAClC,QAAM,QAAQ,OAAO,QAAQ,OAAO,KAAK,EACtC,OAAO,CAAC,CAAC,GAAG,MAAM,KAAK,SAAS,GAAQ,CAAC,EACzC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM;AAC7B,IAAC,IAAgC,GAAG,IAAI;AACxC,WAAO;AAAA,EACT,GAAG,CAAC,CAA4B;AAElC,SAAO,EAAE,OAAO,KAAqC;AACvD;AAQO,SAAS,eACd,SAC4B;AAC5B,SAAO,QAAQ;AAAA,IACb,CAAC,QAAQ,WAAW,OAAO,MAAM,MAAM;AAAA,IACvC,EAAE,OAAO,CAAC,CAAC;AAAA,EACb;AACF;;;ACnCA,SAAS,KAAAA,UAAS;AAuBX,IAAM,cAAcA,GAAE,OAAO,EAAE,MAAM,oCAAoC;AACzE,IAAM,aAAaA,GAAE,OAAO,EAAE,IAAI,GAAG,kBAAkB,EAAE,IAAI,KAAK,uCAAuC;AACzG,IAAM,cAAcA,GAAE,OAAO,EAAE,MAAM,sBAAsB,mCAAmC;AAC9F,IAAM,YAAYA,GAAE,OAAO,EAAE,IAAI,0BAA0B;AAC3D,IAAM,aAAaA,GAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,GAAG,2BAA2B;AAGpG,IAAM,iBAAiBA,GAAE,OAAO,EACpC,IAAI,GAAG,wCAAwC,EAC/C,MAAM,SAAS,qDAAqD,EACpE,MAAM,SAAS,qDAAqD,EACpE,MAAM,SAAS,2CAA2C;AAEtD,IAAM,uBAAuB,eACjC,MAAM,0BAA0B,sDAAsD;AAGlF,IAAM,cAAcA,GAAE,OAAO;AAAA,EAClC,OAAO;AAAA,EACP,UAAUA,GAAE,OAAO,EAAE,IAAI,GAAG,sBAAsB;AACpD,CAAC;AAEM,IAAM,qBAAqBA,GAAE,OAAO;AAAA,EACzC,OAAO;AAAA,EACP,UAAU;AAAA,EACV,iBAAiBA,GAAE,OAAO;AAC5B,CAAC,EAAE,OAAO,CAAC,SAAS,KAAK,aAAa,KAAK,iBAAiB;AAAA,EAC1D,SAAS;AAAA,EACT,MAAM,CAAC,iBAAiB;AAC1B,CAAC;AAEM,IAAM,oBAAoBA,GAAE,OAAO;AAAA,EACxC,OAAO;AAAA,EACP,UAAU;AACZ,CAAC;AAEM,IAAM,sBAAsBA,GAAE,OAAO;AAAA,EAC1C,OAAO;AACT,CAAC;AAEM,IAAM,uBAAuBA,GAAE,OAAO;AAAA,EAC3C,iBAAiBA,GAAE,OAAO,EAAE,IAAI,GAAG,8BAA8B;AAAA,EACjE,aAAa;AAAA,EACb,iBAAiBA,GAAE,OAAO;AAC5B,CAAC,EAAE,OAAO,CAAC,SAAS,KAAK,gBAAgB,KAAK,iBAAiB;AAAA,EAC7D,SAAS;AAAA,EACT,MAAM,CAAC,iBAAiB;AAC1B,CAAC;AAGM,IAAM,oBAAoBA,GAAE,OAAO;AAAA,EACxC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,YAAY,SAAS;AAAA,EAC5B,SAAS,UAAU,SAAS;AAAA,EAC5B,KAAKA,GAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AACpC,CAAC;AAGM,IAAM,oBAAoBA,GAAE,OAAO;AAAA,EACxC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAASA,GAAE,OAAO,EAAE,IAAI,GAAG,qBAAqB,EAAE,IAAI,KAAM,2CAA2C;AACzG,CAAC;","names":["z"]}
|