@jmruthers/pace-core 0.5.120 → 0.5.121

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.
Files changed (124) hide show
  1. package/dist/chunk-BDZUMRBD.js 3.map +1 -0
  2. package/dist/chunk-CGURJ27Z.js 2.map +1 -0
  3. package/dist/chunk-GKHF54DI 2.js +619 -0
  4. package/dist/chunk-GKHF54DI.js 2.map +1 -0
  5. package/dist/chunk-NZ32EONV.js 2.map +1 -0
  6. package/dist/chunk-O3NWNXDY 2.js +76 -0
  7. package/dist/chunk-TDNI6ZWL.js 2.map +1 -0
  8. package/dist/chunk-VKOCWWVY.js 3.map +1 -0
  9. package/dist/chunk-WP5I5GLN 2.js +1564 -0
  10. package/dist/index 3.js +856 -0
  11. package/dist/providers 3.js +38 -0
  12. package/dist/providers.js 3.map +1 -0
  13. package/dist/types 3.js +128 -0
  14. package/dist/types.js 3.map +1 -0
  15. package/dist/useInactivityTracker-MRUU55XI.js 3.map +1 -0
  16. package/dist/utils.js 3.map +1 -0
  17. package/dist/validation 3.js +479 -0
  18. package/docs/api/classes/ColumnFactory.md +1 -1
  19. package/docs/api/classes/ErrorBoundary.md +1 -1
  20. package/docs/api/classes/InvalidScopeError.md +1 -1
  21. package/docs/api/classes/MissingUserContextError.md +1 -1
  22. package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
  23. package/docs/api/classes/PermissionDeniedError.md +1 -1
  24. package/docs/api/classes/PublicErrorBoundary.md +1 -1
  25. package/docs/api/classes/RBACAuditManager.md +1 -1
  26. package/docs/api/classes/RBACCache.md +1 -1
  27. package/docs/api/classes/RBACEngine.md +1 -1
  28. package/docs/api/classes/RBACError.md +1 -1
  29. package/docs/api/classes/RBACNotInitializedError.md +1 -1
  30. package/docs/api/classes/SecureSupabaseClient.md +1 -1
  31. package/docs/api/classes/StorageUtils.md +1 -1
  32. package/docs/api/enums/FileCategory.md +1 -1
  33. package/docs/api/interfaces/AggregateConfig.md +1 -1
  34. package/docs/api/interfaces/ButtonProps.md +1 -1
  35. package/docs/api/interfaces/CardProps.md +1 -1
  36. package/docs/api/interfaces/ColorPalette.md +1 -1
  37. package/docs/api/interfaces/ColorShade.md +1 -1
  38. package/docs/api/interfaces/DataAccessRecord.md +1 -1
  39. package/docs/api/interfaces/DataRecord.md +1 -1
  40. package/docs/api/interfaces/DataTableAction.md +1 -1
  41. package/docs/api/interfaces/DataTableColumn.md +1 -1
  42. package/docs/api/interfaces/DataTableProps.md +1 -1
  43. package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
  44. package/docs/api/interfaces/EmptyStateConfig.md +1 -1
  45. package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
  46. package/docs/api/interfaces/EventAppRoleData.md +1 -1
  47. package/docs/api/interfaces/FileDisplayProps.md +1 -1
  48. package/docs/api/interfaces/FileMetadata.md +1 -1
  49. package/docs/api/interfaces/FileReference.md +1 -1
  50. package/docs/api/interfaces/FileSizeLimits.md +1 -1
  51. package/docs/api/interfaces/FileUploadOptions.md +1 -1
  52. package/docs/api/interfaces/FileUploadProps.md +1 -1
  53. package/docs/api/interfaces/FooterProps.md +1 -1
  54. package/docs/api/interfaces/GrantEventAppRoleParams.md +1 -1
  55. package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
  56. package/docs/api/interfaces/InputProps.md +1 -1
  57. package/docs/api/interfaces/LabelProps.md +1 -1
  58. package/docs/api/interfaces/LoginFormProps.md +1 -1
  59. package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
  60. package/docs/api/interfaces/NavigationContextType.md +1 -1
  61. package/docs/api/interfaces/NavigationGuardProps.md +1 -1
  62. package/docs/api/interfaces/NavigationItem.md +1 -1
  63. package/docs/api/interfaces/NavigationMenuProps.md +1 -1
  64. package/docs/api/interfaces/NavigationProviderProps.md +1 -1
  65. package/docs/api/interfaces/Organisation.md +1 -1
  66. package/docs/api/interfaces/OrganisationContextType.md +1 -1
  67. package/docs/api/interfaces/OrganisationMembership.md +1 -1
  68. package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
  69. package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
  70. package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
  71. package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
  72. package/docs/api/interfaces/PageAccessRecord.md +1 -1
  73. package/docs/api/interfaces/PagePermissionContextType.md +1 -1
  74. package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
  75. package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
  76. package/docs/api/interfaces/PaletteData.md +1 -1
  77. package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
  78. package/docs/api/interfaces/ProtectedRouteProps.md +1 -1
  79. package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
  80. package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
  81. package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
  82. package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
  83. package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
  84. package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
  85. package/docs/api/interfaces/RBACConfig.md +1 -1
  86. package/docs/api/interfaces/RBACLogger.md +1 -1
  87. package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
  88. package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
  89. package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
  90. package/docs/api/interfaces/RoleManagementResult.md +1 -1
  91. package/docs/api/interfaces/RouteAccessRecord.md +1 -1
  92. package/docs/api/interfaces/RouteConfig.md +1 -1
  93. package/docs/api/interfaces/SecureDataContextType.md +1 -1
  94. package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
  95. package/docs/api/interfaces/StorageConfig.md +1 -1
  96. package/docs/api/interfaces/StorageFileInfo.md +1 -1
  97. package/docs/api/interfaces/StorageFileMetadata.md +1 -1
  98. package/docs/api/interfaces/StorageListOptions.md +1 -1
  99. package/docs/api/interfaces/StorageListResult.md +1 -1
  100. package/docs/api/interfaces/StorageUploadOptions.md +1 -1
  101. package/docs/api/interfaces/StorageUploadResult.md +1 -1
  102. package/docs/api/interfaces/StorageUrlOptions.md +1 -1
  103. package/docs/api/interfaces/StyleImport.md +1 -1
  104. package/docs/api/interfaces/SwitchProps.md +1 -1
  105. package/docs/api/interfaces/ToastActionElement.md +1 -1
  106. package/docs/api/interfaces/ToastProps.md +1 -1
  107. package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
  108. package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
  109. package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
  110. package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
  111. package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
  112. package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
  113. package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
  114. package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
  115. package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
  116. package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
  117. package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
  118. package/docs/api/interfaces/UserEventAccess.md +1 -1
  119. package/docs/api/interfaces/UserMenuProps.md +1 -1
  120. package/docs/api/interfaces/UserProfile.md +1 -1
  121. package/docs/api/modules.md +2 -2
  122. package/package.json +1 -1
  123. package/src/components/DataTable/utils/flexibleImport.ts +27 -6
  124. package/src/types/database.generated.ts +1515 -424
@@ -0,0 +1,856 @@
1
+ import {
2
+ ALL_PERMISSIONS,
3
+ AccessLevelGuard,
4
+ EVENT_APP_PERMISSIONS,
5
+ EnhancedNavigationMenu,
6
+ GLOBAL_PERMISSIONS,
7
+ NavigationGuard,
8
+ NavigationProvider,
9
+ ORGANISATION_PERMISSIONS,
10
+ PAGE_PERMISSIONS,
11
+ PagePermissionGuard,
12
+ PagePermissionProvider,
13
+ PermissionEnforcer,
14
+ PermissionGuard,
15
+ RoleBasedRouter,
16
+ SecureDataProvider,
17
+ SecureSupabaseClient,
18
+ createRBACExpressMiddleware,
19
+ createRBACMiddleware,
20
+ createSecureClient,
21
+ fromSupabaseClient,
22
+ getPermissionsForRole,
23
+ hasAnyPermissionCached,
24
+ hasPermissionCached,
25
+ isValidPermission,
26
+ useNavigationPermissions,
27
+ usePagePermissions,
28
+ useRoleBasedRouter,
29
+ useSecureData,
30
+ withAccessLevelGuard,
31
+ withPermissionGuard,
32
+ withRoleGuard
33
+ } from "./chunk-TDNI6ZWL.js";
34
+ import {
35
+ init_useInactivityTracker,
36
+ useInactivityTracker
37
+ } from "./chunk-5F3NDPJV.js";
38
+ import {
39
+ Avatar,
40
+ AvatarFallback,
41
+ AvatarImage,
42
+ ErrorBoundary,
43
+ EventSelector,
44
+ FileDisplay,
45
+ FileUpload,
46
+ Footer,
47
+ Form,
48
+ Header,
49
+ Label,
50
+ LoginForm,
51
+ NavigationMenu,
52
+ OrganisationSelector,
53
+ PaceAppLayout,
54
+ PaceLoginPage,
55
+ PasswordChangeForm,
56
+ PasswordResetForm,
57
+ Progress,
58
+ ProtectedRoute,
59
+ PublicLoadingSkeleton,
60
+ PublicLoadingSpinner,
61
+ PublicLoadingSpinnerFullPage,
62
+ PublicPageContextChecker,
63
+ PublicPageDebugger,
64
+ PublicPageDiagnostic,
65
+ PublicPageFooter,
66
+ PublicPageHeader,
67
+ PublicPageLayout,
68
+ SessionRestorationLoader,
69
+ Switch,
70
+ Table,
71
+ TableBody,
72
+ TableCaption,
73
+ TableCell,
74
+ TableFooter,
75
+ TableHead,
76
+ TableHeader,
77
+ TableRow,
78
+ Toast,
79
+ ToastAction,
80
+ ToastClose,
81
+ ToastDescription,
82
+ ToastProvider,
83
+ ToastTitle,
84
+ ToastViewport,
85
+ Toaster,
86
+ UserMenu,
87
+ init_EventProvider,
88
+ useFileReference,
89
+ useFileReferenceById,
90
+ useFileReferenceForRecord,
91
+ useFilesByCategory,
92
+ usePublicPageContext as usePublicPageContext2
93
+ } from "./chunk-QPI2CCBA.js";
94
+ import {
95
+ Alert,
96
+ AlertDescription,
97
+ AlertTitle,
98
+ Button,
99
+ Card,
100
+ CardActions,
101
+ CardContent,
102
+ CardDescription,
103
+ CardFooter,
104
+ CardHeader,
105
+ CardTitle,
106
+ Checkbox,
107
+ ColumnFactory,
108
+ DataTable,
109
+ Dialog,
110
+ DialogBody,
111
+ DialogClose,
112
+ DialogContent,
113
+ DialogDescription,
114
+ DialogFooter,
115
+ DialogHeader,
116
+ DialogOverlay,
117
+ DialogPortal,
118
+ DialogTitle,
119
+ DialogTrigger,
120
+ Input,
121
+ Select,
122
+ SelectContent,
123
+ SelectGroup,
124
+ SelectItem,
125
+ SelectLabel,
126
+ SelectSeparator,
127
+ SelectTrigger,
128
+ SelectValue,
129
+ Tooltip,
130
+ TooltipContent,
131
+ TooltipProvider,
132
+ TooltipRoot,
133
+ TooltipTrigger
134
+ } from "./chunk-HFBOFZ3Z.js";
135
+ import {
136
+ useAccessLevel,
137
+ useCachedPermissions,
138
+ useCan,
139
+ useHasAllPermissions,
140
+ useHasAnyPermission,
141
+ useMultiplePermissions,
142
+ usePermissions,
143
+ useRBAC,
144
+ useResolvedScope,
145
+ useRoleManagement
146
+ } from "./chunk-D6BOFXYR.js";
147
+ import {
148
+ CACHE_PATTERNS,
149
+ RBACCache,
150
+ RBACEngine,
151
+ createRBACConfig,
152
+ createRBACEngine,
153
+ getAccessLevel,
154
+ getPermissionMap,
155
+ getRBACConfig,
156
+ getRBACLogger,
157
+ getRoleContext,
158
+ hasAllPermissions,
159
+ hasAnyPermission,
160
+ hasPermission,
161
+ isDebugMode,
162
+ isDevelopmentMode,
163
+ isPermitted,
164
+ isPermittedCached,
165
+ rbacCache,
166
+ resolveAppContext,
167
+ setupRBAC
168
+ } from "./chunk-WP5I5GLN.js";
169
+ import {
170
+ RBACAuditManager,
171
+ createAuditManager,
172
+ emitAuditEvent,
173
+ getGlobalAuditManager,
174
+ setGlobalAuditManager
175
+ } from "./chunk-3DBFLLLU.js";
176
+ import {
177
+ clearPublicEventCache,
178
+ extractEventCodeFromPath,
179
+ generatePublicRoutePath,
180
+ getPublicEventCacheStats,
181
+ useOrganisationPermissions,
182
+ useOrganisationSecurity,
183
+ usePublicEvent,
184
+ usePublicEventCode,
185
+ usePublicRouteParams
186
+ } from "./chunk-RIEJGKD3.js";
187
+ import "./chunk-B4GZ2BXO.js";
188
+ import {
189
+ APP_PATH_MAPPING,
190
+ DEFAULT_FILE_SIZE_LIMIT,
191
+ DefaultPublicErrorFallback,
192
+ FILE_SIZE_LIMITS,
193
+ PublicErrorBoundary,
194
+ PublicPageProvider,
195
+ STORAGE_CONFIG,
196
+ archiveFile,
197
+ clearPublicFileDisplayCache,
198
+ deleteFile,
199
+ downloadFile,
200
+ extractFileMetadata,
201
+ generateFilePath,
202
+ generateUniqueFileName,
203
+ getBucketName,
204
+ getFileSizeLimit,
205
+ getPublicFileDisplayCacheStats,
206
+ getPublicUrl,
207
+ getSignedUrl,
208
+ init_OrganisationProvider,
209
+ listFiles,
210
+ uploadFile,
211
+ useAppConfig,
212
+ useErrorBoundary,
213
+ useEventTheme,
214
+ useIsPublicPage,
215
+ usePublicFileDisplay,
216
+ usePublicPageContext,
217
+ validateFileSize
218
+ } from "./chunk-FKFHZUGF.js";
219
+ import {
220
+ useToast
221
+ } from "./chunk-GKHF54DI.js";
222
+ import {
223
+ init_useOrganisations,
224
+ useEvents,
225
+ useOrganisations
226
+ } from "./chunk-CGURJ27Z.js";
227
+ import {
228
+ init_UnifiedAuthProvider
229
+ } from "./chunk-ZYJ6O5CA.js";
230
+ import "./chunk-NZ32EONV.js";
231
+ import {
232
+ EventServiceProvider,
233
+ InactivityServiceProvider,
234
+ OrganisationServiceProvider,
235
+ UnifiedAuthProvider,
236
+ init_InactivityServiceProvider,
237
+ init_useAuthService,
238
+ init_useEventService,
239
+ init_useInactivityService,
240
+ init_useOrganisationService,
241
+ init_useSessionRestoration,
242
+ useAuthService2 as useAuthService,
243
+ useEventService2 as useEventService,
244
+ useInactivityService2 as useInactivityService,
245
+ useOrganisationService2 as useOrganisationService,
246
+ useSessionRestoration,
247
+ useUnifiedAuth
248
+ } from "./chunk-BHWIUEYH.js";
249
+ import {
250
+ FileCategory
251
+ } from "./chunk-XJ2HZOBU.js";
252
+ import {
253
+ formatCompactNumber,
254
+ formatCurrency,
255
+ formatDate,
256
+ formatFileSize,
257
+ formatNumber,
258
+ formatPercent,
259
+ getAppConfig,
260
+ getCurrentAppId,
261
+ getCurrentAppName,
262
+ setAppConfig,
263
+ useSessionTracking
264
+ } from "./chunk-GZRXOUBE.js";
265
+ import {
266
+ LoadingSpinner
267
+ } from "./chunk-CDQ3PX7L.js";
268
+ import {
269
+ cn
270
+ } from "./chunk-PYUXFQJ3.js";
271
+ import "./chunk-JCQZ6LA7.js";
272
+ import "./chunk-O3NWNXDY.js";
273
+ import "./chunk-BDZUMRBD.js";
274
+ import "./chunk-UJI6WSMD.js";
275
+ import {
276
+ getAllStylePaths,
277
+ getStylePath,
278
+ styleConfig
279
+ } from "./chunk-VKOCWWVY.js";
280
+ import {
281
+ applyPalette,
282
+ clearPalette,
283
+ generateSSRThemeCSS,
284
+ getCurrentThemeData,
285
+ isDynamicThemingActive
286
+ } from "./chunk-SMJZMKYN.js";
287
+ import "./chunk-PLDDJCW6.js";
288
+
289
+ // src/index.ts
290
+ init_UnifiedAuthProvider();
291
+ init_EventProvider();
292
+ init_OrganisationProvider();
293
+
294
+ // src/providers/InactivityProvider.tsx
295
+ init_InactivityServiceProvider();
296
+
297
+ // src/index.ts
298
+ init_useOrganisations();
299
+ init_useEventService();
300
+ init_useOrganisationService();
301
+ init_useAuthService();
302
+ init_useInactivityService();
303
+ init_useSessionRestoration();
304
+
305
+ // src/components/InactivityWarningModal/InactivityWarningModal.tsx
306
+ import { useEffect, useState, useCallback } from "react";
307
+ import { Clock, AlertTriangle } from "lucide-react";
308
+ import { jsx, jsxs } from "react/jsx-runtime";
309
+ function InactivityWarningModal({
310
+ isOpen,
311
+ timeRemaining,
312
+ onStaySignedIn,
313
+ onSignOutNow,
314
+ title = "Session Timeout Warning",
315
+ description = "You've been inactive for a while. Your session will expire soon for security reasons.",
316
+ className
317
+ }) {
318
+ const [displayTime, setDisplayTime] = useState(timeRemaining);
319
+ useEffect(() => {
320
+ setDisplayTime(timeRemaining);
321
+ }, [timeRemaining]);
322
+ const formatTime = useCallback((seconds) => {
323
+ const mins = Math.floor(seconds / 60);
324
+ const secs = seconds % 60;
325
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
326
+ }, []);
327
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onStaySignedIn(), children: /* @__PURE__ */ jsxs(
328
+ DialogContent,
329
+ {
330
+ className: `sm:max-w-md ${className || ""}`,
331
+ preventCloseOnEscape: false,
332
+ preventCloseOnOutsideClick: true,
333
+ "data-testid": "inactivity-warning-modal",
334
+ children: [
335
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
336
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
337
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-6 w-6 text-acc-600" }) }),
338
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-lg font-semibold text-main-900", children: title }) })
339
+ ] }),
340
+ /* @__PURE__ */ jsx(DialogDescription, { className: "text-main-700 mt-2", children: description })
341
+ ] }),
342
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
343
+ /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
344
+ /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-2 px-4 py-3 bg-acc-50 border border-acc-200 rounded-lg", children: [
345
+ /* @__PURE__ */ jsx(Clock, { className: "h-5 w-5 text-acc-600" }),
346
+ /* @__PURE__ */ jsx("span", { className: "text-2xl font-mono font-bold text-acc-700", children: formatTime(displayTime) })
347
+ ] }),
348
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-main-600 mt-2", children: "Time remaining before automatic logout" })
349
+ ] }),
350
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row gap-3", children: [
351
+ /* @__PURE__ */ jsx(
352
+ Button,
353
+ {
354
+ onClick: onStaySignedIn,
355
+ className: "flex-1 bg-main-600 hover:bg-main-700 text-main-50",
356
+ size: "lg",
357
+ children: "Stay Signed In"
358
+ }
359
+ ),
360
+ /* @__PURE__ */ jsx(
361
+ Button,
362
+ {
363
+ onClick: onSignOutNow,
364
+ variant: "outline",
365
+ className: "flex-1 border-acc-300 text-acc-700 hover:bg-acc-50",
366
+ size: "lg",
367
+ children: "Sign Out Now"
368
+ }
369
+ )
370
+ ] }),
371
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-main-500 text-center", children: /* @__PURE__ */ jsx("p", { children: "For security reasons, you'll be automatically signed out after 30 minutes of inactivity." }) })
372
+ ] })
373
+ ]
374
+ }
375
+ ) });
376
+ }
377
+
378
+ // src/index.ts
379
+ init_useInactivityTracker();
380
+
381
+ // src/utils/secureDataAccess.ts
382
+ var createSecureDataAccess = (supabase, organisationId, isSuperAdmin = false) => {
383
+ const validateOrganisationContext = (orgId) => {
384
+ if (!orgId) {
385
+ throw new Error("Organisation context is required for secure data access");
386
+ }
387
+ if (!isSuperAdmin && !orgId) {
388
+ throw new Error("Organisation context is mandatory for non-super admin users");
389
+ }
390
+ };
391
+ const ensureOrganisationColumn = (table) => {
392
+ const tablesWithOrganisation = [
393
+ "event",
394
+ "organisation_settings",
395
+ "rbac_event_app_roles",
396
+ "rbac_organisation_roles",
397
+ // SECURITY: Phase 2 additions - complete organisation table mapping
398
+ "organisation_audit_log",
399
+ "organisation_invitations",
400
+ "organisation_app_access",
401
+ // SECURITY: Emergency additions for Phase 1 fixes
402
+ "cake_meal",
403
+ "cake_mealtype",
404
+ "pace_person",
405
+ "pace_member",
406
+ // SECURITY: Phase 3A additions - medical and personal data
407
+ "medi_profile",
408
+ "medi_condition",
409
+ "medi_diet",
410
+ "medi_action_plan",
411
+ "medi_profile_versions",
412
+ "pace_consent",
413
+ "pace_contact",
414
+ "pace_id_documents",
415
+ "pace_qualifications",
416
+ "form_responses",
417
+ "form_response_values",
418
+ "forms",
419
+ // SECURITY: Phase 3B additions - remaining critical tables
420
+ "invoice",
421
+ "line_item",
422
+ "credit_balance",
423
+ "payment_method",
424
+ "form_contexts",
425
+ "form_field_config",
426
+ "form_fields",
427
+ "cake_delivery",
428
+ "cake_diettype",
429
+ "cake_diner",
430
+ "cake_dish",
431
+ "cake_item",
432
+ "cake_logistics",
433
+ "cake_mealplan",
434
+ "cake_package",
435
+ "cake_recipe",
436
+ "cake_supplier",
437
+ "cake_supply",
438
+ "cake_unit",
439
+ "event_app_access",
440
+ "base_application",
441
+ "base_questions"
442
+ ];
443
+ return tablesWithOrganisation.includes(table);
444
+ };
445
+ const buildSecureQuery = (options) => {
446
+ const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;
447
+ validateOrganisationContext(orgId);
448
+ let query = supabase.from(table).select(select);
449
+ if (!isSuperAdmin && ensureOrganisationColumn(table)) {
450
+ query = query.eq("organisation_id", orgId);
451
+ }
452
+ if (filters) {
453
+ Object.entries(filters).forEach(([key, value]) => {
454
+ if (value !== void 0 && value !== null) {
455
+ const columnName = key.includes(".") ? key.split(".").pop() : key;
456
+ query = query.eq(columnName, value);
457
+ }
458
+ });
459
+ }
460
+ if (orderBy) {
461
+ const orderByColumn = orderBy.split(".").pop();
462
+ if (orderByColumn) {
463
+ query = query.order(orderByColumn);
464
+ }
465
+ }
466
+ if (limit) {
467
+ query = query.limit(limit);
468
+ }
469
+ if (offset) {
470
+ query = query.range(offset, offset + (limit || 10) - 1);
471
+ }
472
+ return query;
473
+ };
474
+ const secureQuery = async (options) => {
475
+ const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;
476
+ try {
477
+ const query = buildSecureQuery({
478
+ table,
479
+ select,
480
+ organisationId: orgId,
481
+ filters,
482
+ orderBy,
483
+ limit,
484
+ offset
485
+ });
486
+ const { data, error } = await query;
487
+ if (error) {
488
+ throw error;
489
+ }
490
+ if (Array.isArray(data)) {
491
+ return data;
492
+ }
493
+ return [];
494
+ } catch (error) {
495
+ throw error;
496
+ }
497
+ };
498
+ const secureSingleQuery = async (options) => {
499
+ const { table, select, organisationId: orgId, filters, orderBy, limit, offset } = options;
500
+ try {
501
+ const query = buildSecureQuery({
502
+ table,
503
+ select,
504
+ organisationId: orgId,
505
+ filters,
506
+ orderBy,
507
+ limit,
508
+ offset
509
+ });
510
+ const { data, error } = await query.single();
511
+ if (error) {
512
+ if (error.code === "PGRST116") {
513
+ return null;
514
+ }
515
+ throw error;
516
+ }
517
+ if (data && typeof data === "object" && !("code" in data)) {
518
+ return data;
519
+ }
520
+ return null;
521
+ } catch (error) {
522
+ throw error;
523
+ }
524
+ };
525
+ const secureInsert = async (table, data, organisationId2) => {
526
+ validateOrganisationContext(organisationId2);
527
+ try {
528
+ const insertData = {
529
+ ...data,
530
+ organisation_id: organisationId2
531
+ };
532
+ const { data: result, error } = await supabase.from(table).insert(insertData).select().single();
533
+ if (error) {
534
+ throw error;
535
+ }
536
+ return result;
537
+ } catch (error) {
538
+ throw error;
539
+ }
540
+ };
541
+ const secureUpdate = async (table, data, filters, organisationId2) => {
542
+ validateOrganisationContext(organisationId2);
543
+ try {
544
+ let query = supabase.from(table).update(data);
545
+ if (!isSuperAdmin && ensureOrganisationColumn(table)) {
546
+ query = query.eq("organisation_id", organisationId2);
547
+ }
548
+ if (filters) {
549
+ Object.entries(filters).forEach(([key, value]) => {
550
+ if (value !== void 0 && value !== null) {
551
+ query = query.eq(key, value);
552
+ }
553
+ });
554
+ }
555
+ const { data: result, error } = await query.select().single();
556
+ if (error) {
557
+ throw error;
558
+ }
559
+ return result;
560
+ } catch (error) {
561
+ throw error;
562
+ }
563
+ };
564
+ const secureDelete = async (table, filters, organisationId2) => {
565
+ validateOrganisationContext(organisationId2);
566
+ try {
567
+ let query = supabase.from(table).delete();
568
+ if (!isSuperAdmin && ensureOrganisationColumn(table)) {
569
+ query = query.eq("organisation_id", organisationId2);
570
+ }
571
+ if (filters) {
572
+ Object.entries(filters).forEach(([key, value]) => {
573
+ if (value !== void 0 && value !== null) {
574
+ query = query.eq(key, value);
575
+ }
576
+ });
577
+ }
578
+ const { error } = await query;
579
+ if (error) {
580
+ throw error;
581
+ }
582
+ return true;
583
+ } catch (error) {
584
+ throw error;
585
+ }
586
+ };
587
+ const queryByOrganisation = async (table, select, organisationId2, filters) => {
588
+ return secureQuery({
589
+ table,
590
+ select,
591
+ organisationId: organisationId2,
592
+ filters
593
+ });
594
+ };
595
+ return {
596
+ secureQuery,
597
+ secureSingleQuery,
598
+ secureInsert,
599
+ secureUpdate,
600
+ secureDelete,
601
+ queryByOrganisation,
602
+ validateOrganisationContext,
603
+ ensureOrganisationColumn
604
+ };
605
+ };
606
+
607
+ // src/utils/storage/index.ts
608
+ var StorageUtils = class {
609
+ };
610
+ StorageUtils.generateFilePath = generateFilePath;
611
+ StorageUtils.generateUniqueFileName = generateUniqueFileName;
612
+ StorageUtils.extractFileMetadata = extractFileMetadata;
613
+ StorageUtils.uploadFile = uploadFile;
614
+ StorageUtils.getPublicUrl = getPublicUrl;
615
+ StorageUtils.getSignedUrl = getSignedUrl;
616
+ StorageUtils.deleteFile = deleteFile;
617
+ StorageUtils.downloadFile = downloadFile;
618
+ StorageUtils.listFiles = listFiles;
619
+ StorageUtils.archiveFile = archiveFile;
620
+ export {
621
+ ALL_PERMISSIONS,
622
+ APP_PATH_MAPPING,
623
+ AccessLevelGuard,
624
+ Alert,
625
+ AlertDescription,
626
+ AlertTitle,
627
+ Avatar,
628
+ AvatarFallback,
629
+ AvatarImage,
630
+ Button,
631
+ CACHE_PATTERNS,
632
+ Card,
633
+ CardActions,
634
+ CardContent,
635
+ CardDescription,
636
+ CardFooter,
637
+ CardHeader,
638
+ CardTitle,
639
+ Checkbox,
640
+ ColumnFactory,
641
+ DEFAULT_FILE_SIZE_LIMIT,
642
+ DataTable,
643
+ DefaultPublicErrorFallback,
644
+ Dialog,
645
+ DialogBody,
646
+ DialogClose,
647
+ DialogContent,
648
+ DialogDescription,
649
+ DialogFooter,
650
+ DialogHeader,
651
+ DialogOverlay,
652
+ DialogPortal,
653
+ DialogTitle,
654
+ DialogTrigger,
655
+ EVENT_APP_PERMISSIONS,
656
+ EnhancedNavigationMenu,
657
+ ErrorBoundary,
658
+ EventServiceProvider as EventProvider,
659
+ EventSelector,
660
+ FILE_SIZE_LIMITS,
661
+ FileCategory,
662
+ FileDisplay,
663
+ FileUpload,
664
+ Footer,
665
+ Form,
666
+ GLOBAL_PERMISSIONS,
667
+ Header,
668
+ InactivityServiceProvider as InactivityProvider,
669
+ InactivityWarningModal,
670
+ Input,
671
+ Label,
672
+ LoadingSpinner,
673
+ LoginForm,
674
+ NavigationGuard,
675
+ NavigationMenu,
676
+ NavigationProvider,
677
+ ORGANISATION_PERMISSIONS,
678
+ OrganisationServiceProvider as OrganisationProvider,
679
+ OrganisationSelector,
680
+ PAGE_PERMISSIONS,
681
+ PaceAppLayout,
682
+ PaceLoginPage,
683
+ PagePermissionGuard,
684
+ PagePermissionProvider,
685
+ PasswordChangeForm,
686
+ PasswordResetForm,
687
+ PermissionEnforcer,
688
+ PermissionGuard,
689
+ Progress,
690
+ ProtectedRoute,
691
+ PublicErrorBoundary,
692
+ PublicLoadingSkeleton,
693
+ PublicLoadingSpinner,
694
+ PublicLoadingSpinnerFullPage,
695
+ PublicPageContextChecker,
696
+ PublicPageDebugger,
697
+ PublicPageDiagnostic,
698
+ PublicPageFooter,
699
+ PublicPageHeader,
700
+ PublicPageLayout,
701
+ PublicPageProvider,
702
+ RBACAuditManager,
703
+ RBACCache,
704
+ RBACEngine,
705
+ RoleBasedRouter,
706
+ STORAGE_CONFIG,
707
+ SecureDataProvider,
708
+ SecureSupabaseClient,
709
+ Select,
710
+ SelectContent,
711
+ SelectGroup,
712
+ SelectItem,
713
+ SelectLabel,
714
+ SelectSeparator,
715
+ SelectTrigger,
716
+ SelectValue,
717
+ SessionRestorationLoader,
718
+ StorageUtils,
719
+ Switch,
720
+ Table,
721
+ TableBody,
722
+ TableCaption,
723
+ TableCell,
724
+ TableFooter,
725
+ TableHead,
726
+ TableHeader,
727
+ TableRow,
728
+ Toast,
729
+ ToastAction,
730
+ ToastClose,
731
+ ToastDescription,
732
+ ToastProvider,
733
+ ToastTitle,
734
+ ToastViewport,
735
+ Toaster,
736
+ Tooltip,
737
+ TooltipContent,
738
+ TooltipProvider,
739
+ TooltipRoot,
740
+ TooltipTrigger,
741
+ UnifiedAuthProvider,
742
+ UserMenu,
743
+ applyPalette,
744
+ archiveFile,
745
+ clearPalette,
746
+ clearPublicEventCache,
747
+ clearPublicFileDisplayCache,
748
+ cn,
749
+ createAuditManager,
750
+ createRBACConfig,
751
+ createRBACEngine,
752
+ createRBACExpressMiddleware,
753
+ createRBACMiddleware,
754
+ createSecureClient,
755
+ createSecureDataAccess,
756
+ deleteFile,
757
+ downloadFile,
758
+ emitAuditEvent,
759
+ extractEventCodeFromPath,
760
+ extractFileMetadata,
761
+ formatCompactNumber,
762
+ formatCurrency,
763
+ formatDate,
764
+ formatFileSize,
765
+ formatNumber,
766
+ formatPercent,
767
+ fromSupabaseClient,
768
+ generateFilePath,
769
+ generatePublicRoutePath,
770
+ generateSSRThemeCSS,
771
+ generateUniqueFileName,
772
+ getAccessLevel,
773
+ getAllStylePaths,
774
+ getAppConfig,
775
+ getBucketName,
776
+ getCurrentAppId,
777
+ getCurrentAppName,
778
+ getCurrentThemeData,
779
+ getFileSizeLimit,
780
+ getGlobalAuditManager,
781
+ getPermissionMap,
782
+ getPermissionsForRole,
783
+ getPublicEventCacheStats,
784
+ getPublicFileDisplayCacheStats,
785
+ getPublicUrl,
786
+ getRBACConfig,
787
+ getRBACLogger,
788
+ getRoleContext,
789
+ getSignedUrl,
790
+ getStylePath,
791
+ hasAllPermissions,
792
+ hasAnyPermission,
793
+ hasAnyPermissionCached,
794
+ hasPermission,
795
+ hasPermissionCached,
796
+ isDebugMode,
797
+ isDevelopmentMode,
798
+ isDynamicThemingActive,
799
+ isPermitted,
800
+ isPermittedCached,
801
+ isValidPermission,
802
+ listFiles,
803
+ rbacCache,
804
+ resolveAppContext,
805
+ setAppConfig,
806
+ setGlobalAuditManager,
807
+ setupRBAC,
808
+ styleConfig,
809
+ uploadFile,
810
+ useAccessLevel,
811
+ useAppConfig,
812
+ useAuthService,
813
+ useCachedPermissions,
814
+ useCan,
815
+ useErrorBoundary,
816
+ useEventService,
817
+ useEventTheme,
818
+ useEvents,
819
+ useFileReference,
820
+ useFileReferenceById,
821
+ useFileReferenceForRecord,
822
+ useFilesByCategory,
823
+ useHasAllPermissions,
824
+ useHasAnyPermission,
825
+ useInactivityService,
826
+ useInactivityTracker,
827
+ useIsPublicPage,
828
+ useMultiplePermissions,
829
+ useNavigationPermissions,
830
+ useOrganisationPermissions,
831
+ useOrganisationSecurity,
832
+ useOrganisationService,
833
+ useOrganisations,
834
+ usePagePermissions,
835
+ usePermissions,
836
+ usePublicEvent,
837
+ usePublicEventCode,
838
+ usePublicFileDisplay,
839
+ usePublicPageContext2 as usePublicPageContext,
840
+ usePublicPageContext as usePublicPageProviderContext,
841
+ usePublicRouteParams,
842
+ useRBAC,
843
+ useResolvedScope,
844
+ useRoleBasedRouter,
845
+ useRoleManagement,
846
+ useSecureData,
847
+ useSessionRestoration,
848
+ useSessionTracking,
849
+ useToast,
850
+ useUnifiedAuth,
851
+ validateFileSize,
852
+ withAccessLevelGuard,
853
+ withPermissionGuard,
854
+ withRoleGuard
855
+ };
856
+ //# sourceMappingURL=index.js.map