@pol-studios/db 1.0.30 → 1.0.33

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 (100) hide show
  1. package/dist/{DataLayerContext-Dc7nF2IG.d.ts → DataLayerContext-BwMk4VpG.d.ts} +92 -8
  2. package/dist/{UserMetadataContext-B8gVWGMl.d.ts → UserMetadataContext-pQb3A8_Q.d.ts} +1 -1
  3. package/dist/{UserMetadataContext-DntmpK41.d.ts → UserMetadataContext-yLZQu24J.d.ts} +1 -1
  4. package/dist/auth/context.d.ts +3 -3
  5. package/dist/auth/context.js +5 -10
  6. package/dist/auth/guards.d.ts +9 -9
  7. package/dist/auth/guards.js +2 -3
  8. package/dist/auth/hooks.d.ts +5 -4
  9. package/dist/auth/hooks.js +6 -9
  10. package/dist/auth/index.d.ts +4 -4
  11. package/dist/auth/index.js +7 -12
  12. package/dist/{chunk-EKUDGIQZ.js → chunk-3XCW225W.js} +274 -468
  13. package/dist/chunk-3XCW225W.js.map +1 -0
  14. package/dist/{chunk-OQ7U6EQ3.js → chunk-4EJ6LUH7.js} +3800 -3425
  15. package/dist/chunk-4EJ6LUH7.js.map +1 -0
  16. package/dist/{chunk-FZF26ZRB.js → chunk-7BGDQT5X.js} +29 -16
  17. package/dist/{chunk-FZF26ZRB.js.map → chunk-7BGDQT5X.js.map} +1 -1
  18. package/dist/{chunk-P4UZ7IXC.js → chunk-7D4SUZUM.js} +1 -5
  19. package/dist/{chunk-3PJTNH2L.js → chunk-AKIRHA4Q.js} +2 -2
  20. package/dist/{chunk-5EFDS7SR.js → chunk-DMVUEJG2.js} +7 -2
  21. package/dist/chunk-DMVUEJG2.js.map +1 -0
  22. package/dist/{chunk-KQNOEADH.js → chunk-E64B4PJZ.js} +74 -309
  23. package/dist/chunk-E64B4PJZ.js.map +1 -0
  24. package/dist/{chunk-A7C2FMUF.js → chunk-E6JL3RUF.js} +209 -53
  25. package/dist/chunk-E6JL3RUF.js.map +1 -0
  26. package/dist/{chunk-U5UNPBKB.js → chunk-FI6JAD5G.js} +3 -3
  27. package/dist/{chunk-TKWR5AAY.js → chunk-JOULSXOI.js} +2 -2
  28. package/dist/{chunk-HTJ2FQW5.js → chunk-LF3V3ERS.js} +13 -15
  29. package/dist/{chunk-HTJ2FQW5.js.map → chunk-LF3V3ERS.js.map} +1 -1
  30. package/dist/{chunk-D522CKBU.js → chunk-OUCPYEKC.js} +15 -15
  31. package/dist/{chunk-D522CKBU.js.map → chunk-OUCPYEKC.js.map} +1 -1
  32. package/dist/{chunk-7DJELYBA.js → chunk-PNC6CG5U.js} +43 -82
  33. package/dist/chunk-PNC6CG5U.js.map +1 -0
  34. package/dist/{chunk-CNIGRBRE.js → chunk-QJZUIAHA.js} +43 -19
  35. package/dist/{chunk-CNIGRBRE.js.map → chunk-QJZUIAHA.js.map} +1 -1
  36. package/dist/{chunk-HAWJTZCK.js → chunk-RT4O5H2E.js} +5 -7
  37. package/dist/chunk-RT4O5H2E.js.map +1 -0
  38. package/dist/{chunk-WVF7RUW5.js → chunk-WM25QE7E.js} +3 -3
  39. package/dist/{chunk-H6365JPC.js → chunk-YUX6RGLZ.js} +3 -3
  40. package/dist/{chunk-H6365JPC.js.map → chunk-YUX6RGLZ.js.map} +1 -1
  41. package/dist/{chunk-H3LNH2NT.js → chunk-Z456IHCB.js} +5 -9
  42. package/dist/{chunk-H3LNH2NT.js.map → chunk-Z456IHCB.js.map} +1 -1
  43. package/dist/{chunk-JAATANS3.js → chunk-ZCOFRJQD.js} +3 -3
  44. package/dist/{chunk-JAATANS3.js.map → chunk-ZCOFRJQD.js.map} +1 -1
  45. package/dist/client/index.d.ts +1 -1
  46. package/dist/client/index.js +2 -2
  47. package/dist/core/index.d.ts +54 -31
  48. package/dist/{executor-Br27YZvl.d.ts → executor-YJw4m7Q7.d.ts} +9 -1
  49. package/dist/gen/index.js +1 -1
  50. package/dist/hooks/index.d.ts +3 -22
  51. package/dist/hooks/index.js +5 -4
  52. package/dist/{index-CYFdO0iB.d.ts → index-lveh8qb0.d.ts} +1 -1
  53. package/dist/index.d.ts +38 -10
  54. package/dist/index.js +60 -42
  55. package/dist/index.native.d.ts +19 -13
  56. package/dist/index.native.js +65 -39
  57. package/dist/index.web.d.ts +18 -45
  58. package/dist/index.web.js +58 -52
  59. package/dist/index.web.js.map +1 -1
  60. package/dist/mutation/index.d.ts +2 -2
  61. package/dist/mutation/index.js +5 -5
  62. package/dist/parser/index.js +4 -4
  63. package/dist/powersync-bridge/index.d.ts +18 -3
  64. package/dist/powersync-bridge/index.js +2 -2
  65. package/dist/query/index.d.ts +1 -1
  66. package/dist/query/index.js +7 -8
  67. package/dist/realtime/index.js +7 -9
  68. package/dist/realtime/index.js.map +1 -1
  69. package/dist/{setupAuthContext-Kv-THH-h.d.ts → setupAuthContext-B76nbIP6.d.ts} +23 -17
  70. package/dist/types/index.d.ts +3 -3
  71. package/dist/types/index.js +6 -7
  72. package/dist/{useBatchUpsert-9OYjibLh.d.ts → useBatchUpsert-DAkiCNo3.d.ts} +1 -1
  73. package/dist/{useDbCount-Dk0yCKlT.d.ts → useDbCount-DWfYB2iu.d.ts} +16 -2
  74. package/dist/{useResolveFeedback-C1KucfdQ.d.ts → useResolveFeedback-CxLccZKK.d.ts} +197 -93
  75. package/dist/{useSupabase-DvWVuHHE.d.ts → useSupabase-DSZNeXnF.d.ts} +1 -1
  76. package/dist/with-auth/index.d.ts +3 -3
  77. package/dist/with-auth/index.js +43 -32
  78. package/dist/with-auth/index.js.map +1 -1
  79. package/package.json +18 -8
  80. package/dist/canvas-C4TBBDUL.node +0 -0
  81. package/dist/canvas-ZQNCL7JL.js +0 -1541
  82. package/dist/canvas-ZQNCL7JL.js.map +0 -1
  83. package/dist/chunk-5EFDS7SR.js.map +0 -1
  84. package/dist/chunk-7DJELYBA.js.map +0 -1
  85. package/dist/chunk-A7C2FMUF.js.map +0 -1
  86. package/dist/chunk-EKUDGIQZ.js.map +0 -1
  87. package/dist/chunk-HAWJTZCK.js.map +0 -1
  88. package/dist/chunk-IXBDCSM3.js +0 -3391
  89. package/dist/chunk-IXBDCSM3.js.map +0 -1
  90. package/dist/chunk-KQNOEADH.js.map +0 -1
  91. package/dist/chunk-OQ7U6EQ3.js.map +0 -1
  92. package/dist/dist-NDNRSNOG.js +0 -521
  93. package/dist/dist-NDNRSNOG.js.map +0 -1
  94. package/dist/pdf-PHXP7RHD.js +0 -20336
  95. package/dist/pdf-PHXP7RHD.js.map +0 -1
  96. /package/dist/{chunk-P4UZ7IXC.js.map → chunk-7D4SUZUM.js.map} +0 -0
  97. /package/dist/{chunk-3PJTNH2L.js.map → chunk-AKIRHA4Q.js.map} +0 -0
  98. /package/dist/{chunk-U5UNPBKB.js.map → chunk-FI6JAD5G.js.map} +0 -0
  99. /package/dist/{chunk-TKWR5AAY.js.map → chunk-JOULSXOI.js.map} +0 -0
  100. /package/dist/{chunk-WVF7RUW5.js.map → chunk-WM25QE7E.js.map} +0 -0
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { SupabaseClient } from '@supabase/supabase-js';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
4
  import { DatabaseSchema, QueryOptions, DataLayerConfig, TableStrategy, SyncStatus, SyncControl } from './core/index.js';
5
- import { P as PowerSyncDatabase } from './executor-Br27YZvl.js';
5
+ import { P as PowerSyncDatabase } from './executor-YJw4m7Q7.js';
6
6
 
7
7
  /**
8
8
  * V3 Data Layer Adapter Types
@@ -318,6 +318,25 @@ declare class AdapterAutoDetector {
318
318
  * @returns Detection result with recommendation and reasoning
319
319
  */
320
320
  detect(): AutoDetectionResult;
321
+ /**
322
+ * Detect backend availability WITHOUT notifying listeners.
323
+ *
324
+ * This method is safe to call during React's render phase because it does not
325
+ * trigger state updates in other components. Use this method when you need to
326
+ * check backend status synchronously during render (e.g., in getAdapter()).
327
+ *
328
+ * The regular detect() method with listener notifications should only be called
329
+ * from useEffect or event handlers to avoid the React warning:
330
+ * "Cannot update a component while rendering a different component"
331
+ *
332
+ * @returns Detection result with recommendation and reasoning
333
+ */
334
+ detectSilent(): AutoDetectionResult;
335
+ /**
336
+ * Internal detection logic shared by detect() and detectSilent().
337
+ * @private
338
+ */
339
+ private performDetection;
321
340
  /**
322
341
  * Check if PowerSync is available.
323
342
  *
@@ -342,7 +361,8 @@ declare class AdapterAutoDetector {
342
361
  *
343
362
  * Prefers the sync status's isOnline property if available (from React Native NetInfo).
344
363
  * Falls back to navigator.onLine in browser environments.
345
- * Returns true by default for other environments.
364
+ * Returns false by default for non-browser environments (React Native, Node.js, etc.)
365
+ * to ensure offline-first behavior works correctly.
346
366
  *
347
367
  * @returns Whether the device has network connectivity
348
368
  */
@@ -431,6 +451,50 @@ declare class AdapterAutoDetector {
431
451
  */
432
452
  declare function createAdapterAutoDetector(powerSyncDb: PowerSyncDatabase | null, supabase: SupabaseClient | null, options?: AutoDetectorOptions): AdapterAutoDetector;
433
453
 
454
+ /**
455
+ * Minimal interface for sync tracking callbacks.
456
+ * Intentionally decoupled from the full SyncControl to keep
457
+ * the adapter layer independent of React context types.
458
+ */
459
+ interface SyncTracker {
460
+ addPendingMutation: (entry: {
461
+ id: string;
462
+ table: string;
463
+ op: string;
464
+ opData?: unknown;
465
+ createdAt?: Date;
466
+ }) => void;
467
+ removePendingMutation: (id: string) => void;
468
+ }
469
+ /**
470
+ * Decorator that wraps a TableDataAdapter and automatically
471
+ * tracks pending mutations via SyncTracker callbacks.
472
+ *
473
+ * Read operations (query, queryById, subscribe) are passed
474
+ * through without modification. Mutation operations (insert,
475
+ * update, upsert, delete) are wrapped with addPendingMutation
476
+ * before the write and removePendingMutation on error.
477
+ *
478
+ * NOTE: The syncTracker can be null/undefined during initialization
479
+ * due to React's useEffect timing. The adapter handles this gracefully
480
+ * by using optional chaining - mutations still work, just without tracking.
481
+ */
482
+ declare class SyncTrackingAdapter implements TableDataAdapter {
483
+ private readonly inner;
484
+ private readonly syncTracker;
485
+ readonly name: string;
486
+ constructor(inner: TableDataAdapter, syncTracker: SyncTracker | null | undefined);
487
+ query<T>(table: string, options: QueryOptions): Promise<AdapterQueryResult<T>>;
488
+ queryById<T>(table: string, id: string, options?: Pick<QueryOptions, "select">): Promise<T | null>;
489
+ subscribe<T>(table: string, options: QueryOptions, callback: (data: T[]) => void): () => void;
490
+ insert<T>(table: string, data: Partial<T>): Promise<T>;
491
+ update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
492
+ upsert<T>(table: string, data: Partial<T>): Promise<T>;
493
+ delete(table: string, id: string): Promise<void>;
494
+ /** Get the underlying unwrapped adapter */
495
+ getInnerAdapter(): TableDataAdapter;
496
+ }
497
+
434
498
  /**
435
499
  * V3 Data Layer Adapter Registry
436
500
  *
@@ -489,6 +553,14 @@ declare class AdapterRegistry {
489
553
  * Auto-detector instance for automatic backend selection
490
554
  */
491
555
  private autoDetector;
556
+ /**
557
+ * Sync tracker for mutation tracking
558
+ */
559
+ private syncTracker;
560
+ /**
561
+ * Sync tracking adapter that wraps PowerSync adapter
562
+ */
563
+ private syncTrackingAdapter;
492
564
  /**
493
565
  * Listeners for backend change events
494
566
  */
@@ -520,6 +592,17 @@ declare class AdapterRegistry {
520
592
  * @param adapter - PowerSync adapter implementation
521
593
  */
522
594
  setPowerSyncAdapter(adapter: TableDataAdapter): void;
595
+ /**
596
+ * Set the sync tracker for mutation tracking.
597
+ * When set, write operations on PowerSync tables will
598
+ * automatically track pending mutations.
599
+ *
600
+ * NOTE: This also clears the adapter cache to ensure any
601
+ * previously cached adapters (which may have been created
602
+ * before the sync tracker was available) are recreated
603
+ * with the new sync tracker on next access.
604
+ */
605
+ setSyncTracker(tracker: SyncTracker): void;
523
606
  /**
524
607
  * Set the Supabase adapter instance
525
608
  *
@@ -556,10 +639,11 @@ declare class AdapterRegistry {
556
639
  * - Auto-generates PowerSync alias as "CoreProfile" if not explicitly set
557
640
  *
558
641
  * @param table - The table name (may be schema-qualified like "core.Profile")
642
+ * @param operation - The operation type: 'read' uses fallback logic during init, 'write' always uses PowerSync for powersync tables
559
643
  * @returns The appropriate adapter for the table
560
644
  * @throws Error if adapters are not initialized
561
645
  */
562
- getAdapter(table: string): TableDataAdapter;
646
+ getAdapter(table: string, operation?: 'read' | 'write'): TableDataAdapter;
563
647
  /**
564
648
  * Get the PowerSync adapter directly
565
649
  *
@@ -748,8 +832,8 @@ interface DataLayerStatus {
748
832
  interface DataLayerCoreContextValue {
749
833
  /** Adapter registry for getting table adapters */
750
834
  registry: AdapterRegistry;
751
- /** Get adapter for a specific table */
752
- getAdapter: (table: string) => TableDataAdapter;
835
+ /** Get adapter for a specific table (defaults to 'read' operation) */
836
+ getAdapter: (table: string, operation?: 'read' | 'write') => TableDataAdapter;
753
837
  /** PowerSync database instance (null when not available) */
754
838
  powerSync: PowerSyncDatabase | null;
755
839
  /** Supabase client (always available) */
@@ -782,8 +866,8 @@ interface DataLayerStatusContextValue {
782
866
  interface DataLayerContextValue {
783
867
  /** Adapter registry for getting table adapters */
784
868
  registry: AdapterRegistry;
785
- /** Get adapter for a specific table */
786
- getAdapter: (table: string) => TableDataAdapter;
869
+ /** Get adapter for a specific table (defaults to 'read' operation) */
870
+ getAdapter: (table: string, operation?: 'read' | 'write') => TableDataAdapter;
787
871
  /** PowerSync database instance (null when not available) */
788
872
  powerSync: PowerSyncDatabase | null;
789
873
  /** Supabase client (always available) */
@@ -822,4 +906,4 @@ declare const DataLayerStatusContext: react.Context<DataLayerStatusContextValue>
822
906
  */
823
907
  declare const DataLayerContext: react.Context<DataLayerContextValue>;
824
908
 
825
- export { type AdapterQueryResult as A, BackendStatus as B, type CapableDataAdapter as C, DataLayerContext as D, type SyncStatusInfo as S, type TableDataAdapter as T, type AdapterConfig as a, type AdapterFactory as b, type AdapterCapabilities as c, type AdapterDependencies as d, type AdapterStrategyType as e, ADAPTER_STRATEGIES as f, AdapterRegistry as g, createAdapterRegistry as h, AdapterAutoDetector as i, createAdapterAutoDetector as j, type AutoDetectionResult as k, type AutoDetectorOptions as l, type BackendChangeListener as m, DataLayerCoreContext as n, DataLayerStatusContext as o, type DataLayerContextValue as p, type DataLayerCoreContextValue as q, type DataLayerStatusContextValue as r, type DataLayerStatus as s };
909
+ export { type AdapterQueryResult as A, BackendStatus as B, type CapableDataAdapter as C, DataLayerContext as D, type SyncStatusInfo as S, type TableDataAdapter as T, type AdapterConfig as a, type AdapterFactory as b, type AdapterCapabilities as c, type AdapterDependencies as d, type AdapterStrategyType as e, ADAPTER_STRATEGIES as f, AdapterRegistry as g, createAdapterRegistry as h, AdapterAutoDetector as i, createAdapterAutoDetector as j, type AutoDetectionResult as k, type AutoDetectorOptions as l, type BackendChangeListener as m, SyncTrackingAdapter as n, type SyncTracker as o, DataLayerCoreContext as p, DataLayerStatusContext as q, type DataLayerContextValue as r, type DataLayerCoreContextValue as s, type DataLayerStatusContextValue as t, type DataLayerStatus as u };
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { D as Database } from './useSupabase-DvWVuHHE.js';
4
+ import { D as Database } from './useSupabase-DSZNeXnF.js';
5
5
 
6
6
  declare function useLiveChangesIndicator(value: any, field: string | undefined): [boolean, string];
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { D as Database } from './useSupabase-DvWVuHHE.js';
4
+ import { D as Database } from './useSupabase-DSZNeXnF.js';
5
5
 
6
6
  type UserMetadataRow = Database["core"]["Tables"]["UserMetadata"]["Row"];
7
7
  type UserMetadataInsert = Database["core"]["Tables"]["UserMetadata"]["Insert"];
@@ -1,11 +1,11 @@
1
- export { c as Profile, P as ProfileStatus, a as SetupAuthContext, S as SetupAuthContextProvider, b as SetupAuthContextProviderProps, s as setupAuthContext } from '../setupAuthContext-Kv-THH-h.js';
1
+ export { P as Profile, a as ProfileStatus, S as SetupAuthContext, b as SetupAuthContextProviderProps, s as setupAuthContext } from '../setupAuthContext-B76nbIP6.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  import { d as EntityType, b as EntityPermissionCheck, a as EntityAction } from '../EntityPermissions-DwFt4tUd.js';
6
- export { U as UserMetadataContextType, e as UserMetadataInsert, f as UserMetadataProvider, g as UserMetadataRow, h as UserMetadataUpdate, u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue, d as userMetadataContext } from '../UserMetadataContext-DntmpK41.js';
6
+ export { U as UserMetadataContextType, e as UserMetadataInsert, f as UserMetadataProvider, g as UserMetadataRow, h as UserMetadataUpdate, u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue, d as userMetadataContext } from '../UserMetadataContext-yLZQu24J.js';
7
7
  import '@supabase/supabase-js';
8
- import '../useSupabase-DvWVuHHE.js';
8
+ import '../useSupabase-DSZNeXnF.js';
9
9
  import '@supabase/supabase-js/dist/module/lib/types.js';
10
10
 
11
11
  interface AuthProviderProps {
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  AuthProvider,
3
3
  PermissionProvider,
4
- SetupAuthContextProvider,
5
4
  UserMetadataProvider,
6
5
  entityPermissionContext,
7
6
  permissionContext,
@@ -12,19 +11,15 @@ import {
12
11
  useUserMetadataState,
13
12
  useUserMetadataValue,
14
13
  userMetadataContext
15
- } from "../chunk-A7C2FMUF.js";
16
- import "../chunk-EKUDGIQZ.js";
17
- import "../chunk-GC3TBUWE.js";
14
+ } from "../chunk-E6JL3RUF.js";
18
15
  import "../chunk-J4ZVCXZ4.js";
19
- import "../chunk-OQ7U6EQ3.js";
20
- import "../chunk-H6365JPC.js";
21
- import "../chunk-3PJTNH2L.js";
22
- import "../chunk-5EFDS7SR.js";
23
- import "../chunk-P4UZ7IXC.js";
16
+ import "../chunk-YUX6RGLZ.js";
17
+ import "../chunk-AKIRHA4Q.js";
18
+ import "../chunk-DMVUEJG2.js";
19
+ import "../chunk-7D4SUZUM.js";
24
20
  export {
25
21
  AuthProvider,
26
22
  PermissionProvider,
27
- SetupAuthContextProvider,
28
23
  UserMetadataProvider,
29
24
  entityPermissionContext,
30
25
  permissionContext,
@@ -2,7 +2,7 @@ import { b as EntityPermissionCheck, a as EntityAction } from '../EntityPermissi
2
2
 
3
3
  /**
4
4
  * Check if a user has access to a specific permission key.
5
- * Owners bypass all permission checks.
5
+ * Super-admin key (*:*:*) bypasses all permission checks.
6
6
  *
7
7
  * @param accessKeys - Array of access keys the user has
8
8
  * @param key - The access key to check for
@@ -17,8 +17,8 @@ import { b as EntityPermissionCheck, a as EntityAction } from '../EntityPermissi
17
17
  * const canAccess = hasAccess(['admin', 'viewer'], 'admin'); // true
18
18
  * const cannotAccess = hasAccess(['viewer'], 'admin'); // false
19
19
  *
20
- * // Owner bypasses all checks
21
- * const ownerAccess = hasAccess(['owner'], 'any-key'); // true
20
+ * // Super-admin key bypasses all checks
21
+ * const superAdminAccess = hasAccess(['*:*:*'], 'any-key'); // true
22
22
  *
23
23
  * // Empty key always returns true (no permission required)
24
24
  * const noKeyRequired = hasAccess(['viewer'], ''); // true
@@ -70,12 +70,12 @@ declare function hasAllAccess(accessKeys: string[] | undefined | null, keys: str
70
70
 
71
71
  /**
72
72
  * Check if a user has entity-level access based on permission check result.
73
- * Owners (users with 'owner' access key) bypass entity permissions entirely.
73
+ * Super-admin key (*:*:*) bypasses entity permissions entirely.
74
74
  *
75
75
  * @param permission - The permission check result from getPermission/usePermission
76
76
  * @param action - The action to check for
77
77
  * @param options - Additional options for the check
78
- * @param options.accessKeys - User's access keys (for owner check)
78
+ * @param options.accessKeys - User's access keys (for super-admin check)
79
79
  * @param options.isArchived - Whether the user is archived
80
80
  * @param options.isSuspended - Whether the user is suspended
81
81
  * @returns boolean - true if user has permission for the action
@@ -86,10 +86,10 @@ declare function hasAllAccess(accessKeys: string[] | undefined | null, keys: str
86
86
  * const permission = await getPermission('Project', 123);
87
87
  * const canEdit = hasEntityAccess(permission, 'edit');
88
88
  *
89
- * // With owner bypass
90
- * const canEditAsOwner = hasEntityAccess(permission, 'edit', {
91
- * accessKeys: ['owner'],
92
- * }); // true, owners bypass all checks
89
+ * // With super-admin bypass
90
+ * const canEditAsSuperAdmin = hasEntityAccess(permission, 'edit', {
91
+ * accessKeys: ['*:*:*'],
92
+ * }); // true, super-admin bypasses all checks
93
93
  *
94
94
  * // Check loading state
95
95
  * if (permission.isLoading) {
@@ -7,9 +7,8 @@ import {
7
7
  hasEntityAccess,
8
8
  isEntityAccessDenied,
9
9
  isPermissionLoaded
10
- } from "../chunk-HAWJTZCK.js";
11
- import "../chunk-OQ7U6EQ3.js";
12
- import "../chunk-P4UZ7IXC.js";
10
+ } from "../chunk-RT4O5H2E.js";
11
+ import "../chunk-7D4SUZUM.js";
13
12
  export {
14
13
  hasAccess,
15
14
  hasAllAccess,
@@ -1,10 +1,10 @@
1
1
  import { User } from '@supabase/supabase-js';
2
- import { a as SetupAuthContext } from '../setupAuthContext-Kv-THH-h.js';
2
+ import { S as SetupAuthContext, E as EffectivePermission } from '../setupAuthContext-B76nbIP6.js';
3
3
  import { d as EntityType, a as EntityAction, b as EntityPermissionCheck } from '../EntityPermissions-DwFt4tUd.js';
4
- export { u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue } from '../UserMetadataContext-DntmpK41.js';
5
- import 'react/jsx-runtime';
4
+ export { u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue } from '../UserMetadataContext-yLZQu24J.js';
6
5
  import 'react';
7
- import '../useSupabase-DvWVuHHE.js';
6
+ import 'react/jsx-runtime';
7
+ import '../useSupabase-DSZNeXnF.js';
8
8
  import '@supabase/supabase-js/dist/module/lib/types.js';
9
9
 
10
10
  /**
@@ -67,6 +67,7 @@ declare function useAuth(): Omit<SetupAuthContext, "user"> & {
67
67
  declare function useSetupAuth(): SetupAuthContext & {
68
68
  hasAccess: (access: string) => boolean;
69
69
  hasEntityAccess: (entityType: EntityType, entityId: number, action: EntityAction) => boolean;
70
+ effectivePermissions: EffectivePermission[];
70
71
  };
71
72
 
72
73
  /**
@@ -11,21 +11,18 @@ import {
11
11
  usePermissionLoading,
12
12
  usePermissionsBatch,
13
13
  useSetupAuth
14
- } from "../chunk-7DJELYBA.js";
14
+ } from "../chunk-PNC6CG5U.js";
15
15
  import {
16
16
  useSetUserMetadata,
17
17
  useUserMetadata,
18
18
  useUserMetadataState,
19
19
  useUserMetadataValue
20
- } from "../chunk-A7C2FMUF.js";
21
- import "../chunk-EKUDGIQZ.js";
22
- import "../chunk-GC3TBUWE.js";
20
+ } from "../chunk-E6JL3RUF.js";
23
21
  import "../chunk-J4ZVCXZ4.js";
24
- import "../chunk-OQ7U6EQ3.js";
25
- import "../chunk-H6365JPC.js";
26
- import "../chunk-3PJTNH2L.js";
27
- import "../chunk-5EFDS7SR.js";
28
- import "../chunk-P4UZ7IXC.js";
22
+ import "../chunk-YUX6RGLZ.js";
23
+ import "../chunk-AKIRHA4Q.js";
24
+ import "../chunk-DMVUEJG2.js";
25
+ import "../chunk-7D4SUZUM.js";
29
26
  export {
30
27
  useAuth,
31
28
  useCanCreate,
@@ -1,11 +1,11 @@
1
1
  export { EntityWithPermission, useAuth, useCanCreate, useCanDelete, useCanEdit, useCanShare, useCanView, useInvalidatePermission, usePermission, usePermissionCheck, usePermissionLoading, usePermissionsBatch, useSetupAuth } from './hooks.js';
2
- export { c as Profile, P as ProfileStatus, a as SetupAuthContext, S as SetupAuthContextProvider, b as SetupAuthContextProviderProps, s as setupAuthContext } from '../setupAuthContext-Kv-THH-h.js';
2
+ export { P as Profile, a as ProfileStatus, S as SetupAuthContext, b as SetupAuthContextProviderProps, s as setupAuthContext } from '../setupAuthContext-B76nbIP6.js';
3
3
  export { AuthProvider, AuthProviderProps, EntityPermissionContextValue, PermissionContextValue, PermissionProvider, entityPermissionContext, permissionContext, usePermissions } from './context.js';
4
- export { U as UserMetadataContextType, e as UserMetadataInsert, f as UserMetadataProvider, g as UserMetadataRow, h as UserMetadataUpdate, u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue, d as userMetadataContext } from '../UserMetadataContext-DntmpK41.js';
4
+ export { U as UserMetadataContextType, e as UserMetadataInsert, f as UserMetadataProvider, g as UserMetadataRow, h as UserMetadataUpdate, u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue, d as userMetadataContext } from '../UserMetadataContext-yLZQu24J.js';
5
5
  export { hasAccess, hasAllAccess, hasAllEntityAccess, hasAnyAccess, hasAnyEntityAccess, hasEntityAccess, isEntityAccessDenied, isPermissionLoaded } from './guards.js';
6
6
  export { E as EntityAccessRecord, a as EntityAction, b as EntityPermissionCheck, c as EntityPermissionLevel, d as EntityType, P as PermissionEffect } from '../EntityPermissions-DwFt4tUd.js';
7
7
  import '@supabase/supabase-js';
8
- import 'react/jsx-runtime';
9
8
  import 'react';
10
- import '../useSupabase-DvWVuHHE.js';
9
+ import 'react/jsx-runtime';
10
+ import '../useSupabase-DSZNeXnF.js';
11
11
  import '@supabase/supabase-js/dist/module/lib/types.js';
@@ -12,11 +12,10 @@ import {
12
12
  usePermissionLoading,
13
13
  usePermissionsBatch,
14
14
  useSetupAuth
15
- } from "../chunk-7DJELYBA.js";
15
+ } from "../chunk-PNC6CG5U.js";
16
16
  import {
17
17
  AuthProvider,
18
18
  PermissionProvider,
19
- SetupAuthContextProvider,
20
19
  UserMetadataProvider,
21
20
  entityPermissionContext,
22
21
  permissionContext,
@@ -27,8 +26,7 @@ import {
27
26
  useUserMetadataState,
28
27
  useUserMetadataValue,
29
28
  userMetadataContext
30
- } from "../chunk-A7C2FMUF.js";
31
- import "../chunk-EKUDGIQZ.js";
29
+ } from "../chunk-E6JL3RUF.js";
32
30
  import {
33
31
  hasAccess,
34
32
  hasAllAccess,
@@ -38,18 +36,15 @@ import {
38
36
  hasEntityAccess,
39
37
  isEntityAccessDenied,
40
38
  isPermissionLoaded
41
- } from "../chunk-HAWJTZCK.js";
42
- import "../chunk-GC3TBUWE.js";
39
+ } from "../chunk-RT4O5H2E.js";
43
40
  import "../chunk-J4ZVCXZ4.js";
44
- import "../chunk-OQ7U6EQ3.js";
45
- import "../chunk-H6365JPC.js";
46
- import "../chunk-3PJTNH2L.js";
47
- import "../chunk-5EFDS7SR.js";
48
- import "../chunk-P4UZ7IXC.js";
41
+ import "../chunk-YUX6RGLZ.js";
42
+ import "../chunk-AKIRHA4Q.js";
43
+ import "../chunk-DMVUEJG2.js";
44
+ import "../chunk-7D4SUZUM.js";
49
45
  export {
50
46
  AuthProvider,
51
47
  PermissionProvider,
52
- SetupAuthContextProvider,
53
48
  UserMetadataProvider,
54
49
  entityPermissionContext,
55
50
  hasAccess,