@pol-studios/db 1.0.31 → 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.
- package/dist/{DataLayerContext-Dc7nF2IG.d.ts → DataLayerContext-BwMk4VpG.d.ts} +92 -8
- package/dist/{UserMetadataContext-B8gVWGMl.d.ts → UserMetadataContext-pQb3A8_Q.d.ts} +1 -1
- package/dist/{UserMetadataContext-DntmpK41.d.ts → UserMetadataContext-yLZQu24J.d.ts} +1 -1
- package/dist/auth/context.d.ts +2 -2
- package/dist/auth/context.js +5 -8
- package/dist/auth/guards.d.ts +9 -9
- package/dist/auth/guards.js +2 -3
- package/dist/auth/hooks.d.ts +2 -2
- package/dist/auth/hooks.js +6 -9
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +7 -10
- package/dist/{chunk-VGEMLNNM.js → chunk-3XCW225W.js} +274 -469
- package/dist/chunk-3XCW225W.js.map +1 -0
- package/dist/{chunk-OQ7U6EQ3.js → chunk-4EJ6LUH7.js} +3800 -3425
- package/dist/chunk-4EJ6LUH7.js.map +1 -0
- package/dist/{chunk-FZF26ZRB.js → chunk-7BGDQT5X.js} +29 -16
- package/dist/{chunk-FZF26ZRB.js.map → chunk-7BGDQT5X.js.map} +1 -1
- package/dist/{chunk-P4UZ7IXC.js → chunk-7D4SUZUM.js} +1 -5
- package/dist/{chunk-3PJTNH2L.js → chunk-AKIRHA4Q.js} +2 -2
- package/dist/{chunk-5EFDS7SR.js → chunk-DMVUEJG2.js} +7 -2
- package/dist/chunk-DMVUEJG2.js.map +1 -0
- package/dist/{chunk-2NVSXZKQ.js → chunk-E64B4PJZ.js} +74 -309
- package/dist/chunk-E64B4PJZ.js.map +1 -0
- package/dist/{chunk-WX4ABYIF.js → chunk-E6JL3RUF.js} +149 -26
- package/dist/chunk-E6JL3RUF.js.map +1 -0
- package/dist/{chunk-U5UNPBKB.js → chunk-FI6JAD5G.js} +3 -3
- package/dist/{chunk-TKWR5AAY.js → chunk-JOULSXOI.js} +2 -2
- package/dist/{chunk-HTJ2FQW5.js → chunk-LF3V3ERS.js} +13 -15
- package/dist/{chunk-HTJ2FQW5.js.map → chunk-LF3V3ERS.js.map} +1 -1
- package/dist/{chunk-ADD5MIMK.js → chunk-OUCPYEKC.js} +15 -15
- package/dist/{chunk-ADD5MIMK.js.map → chunk-OUCPYEKC.js.map} +1 -1
- package/dist/{chunk-5BLKZUKM.js → chunk-PNC6CG5U.js} +5 -7
- package/dist/chunk-PNC6CG5U.js.map +1 -0
- package/dist/{chunk-CNIGRBRE.js → chunk-QJZUIAHA.js} +43 -19
- package/dist/{chunk-CNIGRBRE.js.map → chunk-QJZUIAHA.js.map} +1 -1
- package/dist/{chunk-HAWJTZCK.js → chunk-RT4O5H2E.js} +5 -7
- package/dist/chunk-RT4O5H2E.js.map +1 -0
- package/dist/{chunk-WVF7RUW5.js → chunk-WM25QE7E.js} +3 -3
- package/dist/{chunk-H6365JPC.js → chunk-YUX6RGLZ.js} +3 -3
- package/dist/{chunk-H6365JPC.js.map → chunk-YUX6RGLZ.js.map} +1 -1
- package/dist/{chunk-H3LNH2NT.js → chunk-Z456IHCB.js} +5 -9
- package/dist/{chunk-H3LNH2NT.js.map → chunk-Z456IHCB.js.map} +1 -1
- package/dist/{chunk-JAATANS3.js → chunk-ZCOFRJQD.js} +3 -3
- package/dist/{chunk-JAATANS3.js.map → chunk-ZCOFRJQD.js.map} +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +2 -2
- package/dist/core/index.d.ts +54 -31
- package/dist/{executor-Br27YZvl.d.ts → executor-YJw4m7Q7.d.ts} +9 -1
- package/dist/gen/index.js +1 -1
- package/dist/hooks/index.d.ts +3 -22
- package/dist/hooks/index.js +5 -4
- package/dist/{index-CYFdO0iB.d.ts → index-lveh8qb0.d.ts} +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.js +60 -42
- package/dist/index.native.d.ts +19 -13
- package/dist/index.native.js +65 -39
- package/dist/index.web.d.ts +18 -45
- package/dist/index.web.js +58 -52
- package/dist/index.web.js.map +1 -1
- package/dist/mutation/index.d.ts +2 -2
- package/dist/mutation/index.js +5 -5
- package/dist/parser/index.js +4 -4
- package/dist/powersync-bridge/index.d.ts +18 -3
- package/dist/powersync-bridge/index.js +2 -2
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +7 -8
- package/dist/realtime/index.js +7 -9
- package/dist/realtime/index.js.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +6 -7
- package/dist/{useBatchUpsert-9OYjibLh.d.ts → useBatchUpsert-DAkiCNo3.d.ts} +1 -1
- package/dist/{useDbCount-Dk0yCKlT.d.ts → useDbCount-DWfYB2iu.d.ts} +16 -2
- package/dist/{useResolveFeedback-C1KucfdQ.d.ts → useResolveFeedback-CxLccZKK.d.ts} +197 -93
- package/dist/{useSupabase-DvWVuHHE.d.ts → useSupabase-DSZNeXnF.d.ts} +1 -1
- package/dist/with-auth/index.d.ts +2 -2
- package/dist/with-auth/index.js +43 -32
- package/dist/with-auth/index.js.map +1 -1
- package/package.json +18 -8
- package/dist/canvas-C4TBBDUL.node +0 -0
- package/dist/canvas-ZQNCL7JL.js +0 -1541
- package/dist/canvas-ZQNCL7JL.js.map +0 -1
- package/dist/chunk-2NVSXZKQ.js.map +0 -1
- package/dist/chunk-5BLKZUKM.js.map +0 -1
- package/dist/chunk-5EFDS7SR.js.map +0 -1
- package/dist/chunk-HAWJTZCK.js.map +0 -1
- package/dist/chunk-O7SETNGD.js +0 -3391
- package/dist/chunk-O7SETNGD.js.map +0 -1
- package/dist/chunk-OQ7U6EQ3.js.map +0 -1
- package/dist/chunk-VGEMLNNM.js.map +0 -1
- package/dist/chunk-WX4ABYIF.js.map +0 -1
- package/dist/dist-NDNRSNOG.js +0 -521
- package/dist/dist-NDNRSNOG.js.map +0 -1
- package/dist/pdf-PHXP7RHD.js +0 -20336
- package/dist/pdf-PHXP7RHD.js.map +0 -1
- /package/dist/{chunk-P4UZ7IXC.js.map → chunk-7D4SUZUM.js.map} +0 -0
- /package/dist/{chunk-3PJTNH2L.js.map → chunk-AKIRHA4Q.js.map} +0 -0
- /package/dist/{chunk-U5UNPBKB.js.map → chunk-FI6JAD5G.js.map} +0 -0
- /package/dist/{chunk-TKWR5AAY.js.map → chunk-JOULSXOI.js.map} +0 -0
- /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-
|
|
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
|
|
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,
|
|
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-
|
|
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-
|
|
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"];
|
package/dist/auth/context.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ 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-
|
|
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-
|
|
8
|
+
import '../useSupabase-DSZNeXnF.js';
|
|
9
9
|
import '@supabase/supabase-js/dist/module/lib/types.js';
|
|
10
10
|
|
|
11
11
|
interface AuthProviderProps {
|
package/dist/auth/context.js
CHANGED
|
@@ -11,15 +11,12 @@ import {
|
|
|
11
11
|
useUserMetadataState,
|
|
12
12
|
useUserMetadataValue,
|
|
13
13
|
userMetadataContext
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-VGEMLNNM.js";
|
|
16
|
-
import "../chunk-GC3TBUWE.js";
|
|
14
|
+
} from "../chunk-E6JL3RUF.js";
|
|
17
15
|
import "../chunk-J4ZVCXZ4.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-P4UZ7IXC.js";
|
|
16
|
+
import "../chunk-YUX6RGLZ.js";
|
|
17
|
+
import "../chunk-AKIRHA4Q.js";
|
|
18
|
+
import "../chunk-DMVUEJG2.js";
|
|
19
|
+
import "../chunk-7D4SUZUM.js";
|
|
23
20
|
export {
|
|
24
21
|
AuthProvider,
|
|
25
22
|
PermissionProvider,
|
package/dist/auth/guards.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
* //
|
|
21
|
-
* const
|
|
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
|
-
*
|
|
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
|
|
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
|
|
90
|
-
* const
|
|
91
|
-
* accessKeys: ['
|
|
92
|
-
* }); // true,
|
|
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) {
|
package/dist/auth/guards.js
CHANGED
|
@@ -7,9 +7,8 @@ import {
|
|
|
7
7
|
hasEntityAccess,
|
|
8
8
|
isEntityAccessDenied,
|
|
9
9
|
isPermissionLoaded
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-P4UZ7IXC.js";
|
|
10
|
+
} from "../chunk-RT4O5H2E.js";
|
|
11
|
+
import "../chunk-7D4SUZUM.js";
|
|
13
12
|
export {
|
|
14
13
|
hasAccess,
|
|
15
14
|
hasAllAccess,
|
package/dist/auth/hooks.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { User } from '@supabase/supabase-js';
|
|
2
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-
|
|
4
|
+
export { u as useSetUserMetadata, a as useUserMetadata, b as useUserMetadataState, c as useUserMetadataValue } from '../UserMetadataContext-yLZQu24J.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
|
-
import '../useSupabase-
|
|
7
|
+
import '../useSupabase-DSZNeXnF.js';
|
|
8
8
|
import '@supabase/supabase-js/dist/module/lib/types.js';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/auth/hooks.js
CHANGED
|
@@ -11,21 +11,18 @@ import {
|
|
|
11
11
|
usePermissionLoading,
|
|
12
12
|
usePermissionsBatch,
|
|
13
13
|
useSetupAuth
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-PNC6CG5U.js";
|
|
15
15
|
import {
|
|
16
16
|
useSetUserMetadata,
|
|
17
17
|
useUserMetadata,
|
|
18
18
|
useUserMetadataState,
|
|
19
19
|
useUserMetadataValue
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-VGEMLNNM.js";
|
|
22
|
-
import "../chunk-GC3TBUWE.js";
|
|
20
|
+
} from "../chunk-E6JL3RUF.js";
|
|
23
21
|
import "../chunk-J4ZVCXZ4.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
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,
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { EntityWithPermission, useAuth, useCanCreate, useCanDelete, useCanEdit, useCanShare, useCanView, useInvalidatePermission, usePermission, usePermissionCheck, usePermissionLoading, usePermissionsBatch, useSetupAuth } from './hooks.js';
|
|
2
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-
|
|
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
8
|
import 'react';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
|
-
import '../useSupabase-
|
|
10
|
+
import '../useSupabase-DSZNeXnF.js';
|
|
11
11
|
import '@supabase/supabase-js/dist/module/lib/types.js';
|
package/dist/auth/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
usePermissionLoading,
|
|
13
13
|
usePermissionsBatch,
|
|
14
14
|
useSetupAuth
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-PNC6CG5U.js";
|
|
16
16
|
import {
|
|
17
17
|
AuthProvider,
|
|
18
18
|
PermissionProvider,
|
|
@@ -26,8 +26,7 @@ import {
|
|
|
26
26
|
useUserMetadataState,
|
|
27
27
|
useUserMetadataValue,
|
|
28
28
|
userMetadataContext
|
|
29
|
-
} from "../chunk-
|
|
30
|
-
import "../chunk-VGEMLNNM.js";
|
|
29
|
+
} from "../chunk-E6JL3RUF.js";
|
|
31
30
|
import {
|
|
32
31
|
hasAccess,
|
|
33
32
|
hasAllAccess,
|
|
@@ -37,14 +36,12 @@ import {
|
|
|
37
36
|
hasEntityAccess,
|
|
38
37
|
isEntityAccessDenied,
|
|
39
38
|
isPermissionLoaded
|
|
40
|
-
} from "../chunk-
|
|
41
|
-
import "../chunk-GC3TBUWE.js";
|
|
39
|
+
} from "../chunk-RT4O5H2E.js";
|
|
42
40
|
import "../chunk-J4ZVCXZ4.js";
|
|
43
|
-
import "../chunk-
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-
|
|
46
|
-
import "../chunk-
|
|
47
|
-
import "../chunk-P4UZ7IXC.js";
|
|
41
|
+
import "../chunk-YUX6RGLZ.js";
|
|
42
|
+
import "../chunk-AKIRHA4Q.js";
|
|
43
|
+
import "../chunk-DMVUEJG2.js";
|
|
44
|
+
import "../chunk-7D4SUZUM.js";
|
|
48
45
|
export {
|
|
49
46
|
AuthProvider,
|
|
50
47
|
PermissionProvider,
|