@pol-studios/db 1.0.36 → 1.0.38
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/UserMetadataContext-yLZQu24J.d.ts +33 -0
- package/dist/auth/context.d.ts +5 -53
- package/dist/auth/context.js +1 -25
- package/dist/auth/hooks.d.ts +3 -107
- package/dist/auth/hooks.js +2 -8
- package/dist/auth/index.d.ts +5 -5
- package/dist/auth/index.js +9 -39
- package/dist/{chunk-YQUNORJD.js → chunk-6OSNGHRE.js} +77 -153
- package/dist/chunk-6OSNGHRE.js.map +1 -0
- package/dist/{chunk-7NFMEDJW.js → chunk-ILGWCJ6S.js} +9 -42
- package/dist/chunk-ILGWCJ6S.js.map +1 -0
- package/dist/{chunk-U4BZKCBH.js → chunk-INIX2V6L.js} +3 -3
- package/dist/chunk-NSIAAYW3.js +1 -0
- package/dist/{chunk-QHXN6BNL.js → chunk-QMHHKYZO.js} +2 -2
- package/dist/{chunk-HFIGNQ7T.js → chunk-TO5QB4UM.js} +4 -4
- package/dist/chunk-TO5QB4UM.js.map +1 -0
- package/dist/index.js +6 -7
- package/dist/index.native.js +6 -7
- package/dist/index.web.js +5 -6
- package/dist/index.web.js.map +1 -1
- package/dist/with-auth/index.js +4 -5
- package/dist/with-auth/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/UserMetadataContext-QLIv-mfF.d.ts +0 -171
- package/dist/chunk-5HJLTYRA.js +0 -355
- package/dist/chunk-5HJLTYRA.js.map +0 -1
- package/dist/chunk-6KN7KLEG.js +0 -1
- package/dist/chunk-7NFMEDJW.js.map +0 -1
- package/dist/chunk-HFIGNQ7T.js.map +0 -1
- package/dist/chunk-YQUNORJD.js.map +0 -1
- /package/dist/{chunk-U4BZKCBH.js.map → chunk-INIX2V6L.js.map} +0 -0
- /package/dist/{chunk-6KN7KLEG.js.map → chunk-NSIAAYW3.js.map} +0 -0
- /package/dist/{chunk-QHXN6BNL.js.map → chunk-QMHHKYZO.js.map} +0 -0
|
@@ -1,41 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
permissionContext,
|
|
3
3
|
setupAuthContext
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
|
|
6
|
-
// src/auth/hooks/useOfflineAuth.ts
|
|
7
|
-
import { useMemo } from "react";
|
|
8
|
-
var PROFILE_QUERY = `
|
|
9
|
-
SELECT id, email, firstName, lastName, fullName, status, profilePath
|
|
10
|
-
FROM Profile
|
|
11
|
-
WHERE id = ?
|
|
12
|
-
LIMIT 1
|
|
13
|
-
`;
|
|
14
|
-
var USER_ACCESS_QUERY = `
|
|
15
|
-
SELECT id, userId, accessKey
|
|
16
|
-
FROM UserAccess
|
|
17
|
-
WHERE userId = ?
|
|
18
|
-
`;
|
|
19
|
-
var offlineAuthQueryKeys = {
|
|
20
|
-
profile: (userId) => ["profile", userId],
|
|
21
|
-
userAccess: (userId) => ["userAccess", userId]
|
|
22
|
-
};
|
|
23
|
-
var offlineAuthQueries = {
|
|
24
|
-
async fetchProfile(db, userId) {
|
|
25
|
-
return db.getOptional(PROFILE_QUERY, [userId]);
|
|
26
|
-
},
|
|
27
|
-
async fetchUserAccess(db, userId) {
|
|
28
|
-
return db.getAll(USER_ACCESS_QUERY, [userId]);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
function extractAccessKeys(userAccess) {
|
|
32
|
-
if (!userAccess) return [];
|
|
33
|
-
return userAccess.map((ua) => ua.accessKey).filter(Boolean);
|
|
34
|
-
}
|
|
4
|
+
} from "./chunk-6OSNGHRE.js";
|
|
35
5
|
|
|
36
6
|
// src/auth/hooks/useAuth.ts
|
|
37
7
|
import { isUsable } from "@pol-studios/utils";
|
|
38
|
-
import { useCallback
|
|
8
|
+
import { useCallback, useContext, useMemo } from "react";
|
|
39
9
|
function useAuth() {
|
|
40
10
|
const auth = useContext(setupAuthContext);
|
|
41
11
|
if (isUsable(auth.user) === false) {
|
|
@@ -50,7 +20,7 @@ function useAuth() {
|
|
|
50
20
|
function useSetupAuth() {
|
|
51
21
|
const auth = useContext(setupAuthContext);
|
|
52
22
|
const entityPermissions = useContext(permissionContext);
|
|
53
|
-
const hasAccess =
|
|
23
|
+
const hasAccess = useCallback((key) => {
|
|
54
24
|
if (auth.hasAccess) {
|
|
55
25
|
return auth.hasAccess(key);
|
|
56
26
|
}
|
|
@@ -64,7 +34,7 @@ function useSetupAuth() {
|
|
|
64
34
|
if (isUsable(key) === false) return true;
|
|
65
35
|
return false;
|
|
66
36
|
}, [auth.hasAccess, auth.access, auth.isArchived, auth.isSuspended]);
|
|
67
|
-
const hasEntityAccess =
|
|
37
|
+
const hasEntityAccess = useCallback((entityType, entityId, action) => {
|
|
68
38
|
if (auth.isArchived || auth.isSuspended) {
|
|
69
39
|
return false;
|
|
70
40
|
}
|
|
@@ -80,7 +50,7 @@ function useSetupAuth() {
|
|
|
80
50
|
}
|
|
81
51
|
return entityPermissions.checkPermission(entityType, entityId, action);
|
|
82
52
|
}, [auth.access, auth.isArchived, auth.isSuspended, entityPermissions]);
|
|
83
|
-
return
|
|
53
|
+
return useMemo(() => ({
|
|
84
54
|
hasAccess,
|
|
85
55
|
hasEntityAccess,
|
|
86
56
|
...auth,
|
|
@@ -91,7 +61,7 @@ function useSetupAuth() {
|
|
|
91
61
|
|
|
92
62
|
// src/auth/hooks/usePermission.ts
|
|
93
63
|
import { c as _c } from "react/compiler-runtime";
|
|
94
|
-
import { useContext as useContext2, useEffect, useMemo as
|
|
64
|
+
import { useContext as useContext2, useEffect, useMemo as useMemo2 } from "react";
|
|
95
65
|
function usePermissionContext() {
|
|
96
66
|
const context = useContext2(permissionContext);
|
|
97
67
|
if (!context || Object.keys(context).length === 0) {
|
|
@@ -171,7 +141,7 @@ function usePermissionsBatch(entities) {
|
|
|
171
141
|
getPermission,
|
|
172
142
|
prefetchPermissions
|
|
173
143
|
} = usePermissionContext();
|
|
174
|
-
const entitiesKey =
|
|
144
|
+
const entitiesKey = useMemo2(() => entities.map((e) => `${e.type}:${e.id}`).sort().join(","), [entities]);
|
|
175
145
|
useEffect(() => {
|
|
176
146
|
if (entities.length === 0) {
|
|
177
147
|
return;
|
|
@@ -182,7 +152,7 @@ function usePermissionsBatch(entities) {
|
|
|
182
152
|
}));
|
|
183
153
|
prefetchPermissions(entitiesToPrefetch);
|
|
184
154
|
}, [entities, entitiesKey, prefetchPermissions]);
|
|
185
|
-
return
|
|
155
|
+
return useMemo2(() => {
|
|
186
156
|
if (entities.length === 0) {
|
|
187
157
|
return [];
|
|
188
158
|
}
|
|
@@ -222,9 +192,6 @@ function usePermissionLoading() {
|
|
|
222
192
|
}
|
|
223
193
|
|
|
224
194
|
export {
|
|
225
|
-
offlineAuthQueryKeys,
|
|
226
|
-
offlineAuthQueries,
|
|
227
|
-
extractAccessKeys,
|
|
228
195
|
useAuth,
|
|
229
196
|
useSetupAuth,
|
|
230
197
|
usePermission,
|
|
@@ -238,4 +205,4 @@ export {
|
|
|
238
205
|
useInvalidatePermission,
|
|
239
206
|
usePermissionLoading
|
|
240
207
|
};
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-ILGWCJ6S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth/hooks/useAuth.ts","../src/auth/hooks/usePermission.ts"],"sourcesContent":["import { isUsable } from \"@pol-studios/utils\";\nimport { useCallback, useContext, useMemo } from \"react\";\nimport { User } from \"@supabase/supabase-js\";\nimport { SetupAuthContext, setupAuthContext, type EffectivePermission } from \"../context/AuthProvider\";\nimport { permissionContext } from \"../context/PermissionContext\";\nimport { EntityAction, EntityType } from \"../types/EntityPermissions\";\n\n// Re-export EffectivePermission type for consumers\nexport type { EffectivePermission };\n\n/**\n * Hook for authenticated users only.\n * Throws an error if the user is not authenticated.\n * Use useSetupAuth() if you need to handle unauthenticated users.\n *\n * @returns Auth context with guaranteed non-null user and hasAccess helper\n * @throws Error if user is not authenticated\n *\n * @example\n * ```tsx\n * function AuthenticatedComponent() {\n * const { user, hasAccess, profile } = useAuth();\n *\n * // user is guaranteed to be non-null\n * console.log(user.id);\n *\n * if (hasAccess('admin')) {\n * return <AdminDashboard />;\n * }\n *\n * return <UserDashboard />;\n * }\n * ```\n */\nexport function useAuth() {\n const auth = useContext(setupAuthContext);\n if (isUsable(auth.user) === false) {\n console.log({\n auth\n });\n throw new Error(\"User must not be null, use useSetupAuth() to use a nullable user.\");\n } else {\n return auth as any;\n }\n}\n\n/**\n * Hook for handling both authenticated and unauthenticated states.\n * Does not throw if user is not authenticated.\n *\n * @returns Auth context with possibly null user, hasAccess, and hasEntityAccess helpers\n *\n * @example\n * ```tsx\n * function FlexibleComponent() {\n * const { user, hasAccess, hasEntityAccess, isLoading } = useSetupAuth();\n *\n * if (isLoading) {\n * return <Spinner />;\n * }\n *\n * if (!user) {\n * return <LoginPrompt />;\n * }\n *\n * // Check global access\n * const isAdmin = hasAccess('admin');\n *\n * // Check entity-level access\n * const canEditProject = hasEntityAccess('Project', 123, 'edit');\n *\n * return <Dashboard />;\n * }\n * ```\n */\nexport function useSetupAuth(): SetupAuthContext & {\n hasAccess: (access: string) => boolean;\n hasEntityAccess: (entityType: EntityType, entityId: number, action: EntityAction) => boolean;\n effectivePermissions: EffectivePermission[];\n} {\n const auth = useContext(setupAuthContext);\n const entityPermissions = useContext(permissionContext);\n\n // Use the context's hasAccess which now includes effective permissions checking\n const hasAccess = useCallback((key: string) => {\n // Delegate to context hasAccess if available (includes effective permissions)\n if (auth.hasAccess) {\n return auth.hasAccess(key);\n }\n\n // Fallback for backward compatibility\n // Archived/suspended users have no access\n if (auth.isArchived || auth.isSuspended) {\n return false;\n }\n const accessGiven = auth.access;\n if (isUsable(accessGiven) === false) return false;\n // Super-admin key bypasses all permission checks\n if (accessGiven.includes(\"*:*:*\")) return true;\n if (accessGiven.includes(key)) return true;\n if (isUsable(key) === false) return true;\n return false;\n }, [auth.hasAccess, auth.access, auth.isArchived, auth.isSuspended]);\n\n /**\n * Check if the current user has access to a specific entity.\n * Super-admin key (*:*:*) bypasses entity permissions entirely.\n * Otherwise, delegates to the PermissionContext for granular permission checks.\n *\n * @param entityType - 'Project' | 'Client' | 'ProjectDatabase'\n * @param entityId - The ID of the entity to check\n * @param action - 'view' | 'adminView' | 'edit' | 'create' | 'delete' | 'share'\n * @returns boolean - true if user has permission for the action on the entity\n */\n const hasEntityAccess = useCallback((entityType: EntityType, entityId: number, action: EntityAction): boolean => {\n // Archived/suspended users have no entity access\n if (auth.isArchived || auth.isSuspended) {\n return false;\n }\n\n // Validate entityId is a valid positive integer\n if (!entityId || entityId <= 0 || !Number.isInteger(entityId)) {\n return false;\n }\n\n // Super-admin key bypasses all entity permission checks\n const accessGiven_0 = auth.access;\n if (isUsable(accessGiven_0) && accessGiven_0.includes(\"*:*:*\")) {\n return true;\n }\n\n // If PermissionContext is not available, deny access\n if (!entityPermissions || typeof entityPermissions.checkPermission !== \"function\") {\n return false;\n }\n\n // Delegate to PermissionContext\n return entityPermissions.checkPermission(entityType, entityId, action);\n }, [auth.access, auth.isArchived, auth.isSuspended, entityPermissions]);\n return useMemo(() => ({\n hasAccess,\n hasEntityAccess,\n ...auth,\n user: auth.user,\n effectivePermissions: auth.effectivePermissions || []\n }), [hasAccess, hasEntityAccess, auth]);\n}","import { c as _c } from \"react/compiler-runtime\";\nimport { useContext, useEffect, useMemo } from \"react\";\nimport { permissionContext } from \"../context/PermissionContext\";\nimport { EntityType, EntityAction, EntityPermissionCheck } from \"../types/EntityPermissions\";\n\n// Re-export types for convenience\nexport type { EntityType, EntityAction, EntityPermissionCheck };\n\n/**\n * Hook to get the full PermissionContext\n * @throws Error if used outside of PermissionProvider\n */\nfunction usePermissionContext() {\n const context = useContext(permissionContext);\n if (!context || Object.keys(context).length === 0) {\n throw new Error(\"usePermission hooks must be used within a PermissionProvider\");\n }\n return context;\n}\n\n/**\n * Hook to get full permission info for a single entity\n * @param entityType - 'Project' | 'Client' | 'ProjectDatabase'\n * @param entityId - The ID of the entity (can be undefined for loading states)\n * @returns EntityPermissionCheck with canView, canEdit, etc. and isLoading\n *\n * @example\n * ```tsx\n * function ProjectHeader({ projectId }: { projectId: number }) {\n * const permission = usePermission('Project', projectId);\n *\n * if (permission.isLoading) {\n * return <Spinner />;\n * }\n *\n * return (\n * <div>\n * {permission.canEdit && <EditButton />}\n * {permission.canDelete && <DeleteButton />}\n * </div>\n * );\n * }\n * ```\n */\nexport function usePermission(entityType, entityId) {\n const $ = _c(5);\n const {\n getPermission\n } = usePermissionContext();\n let t0;\n bb0: {\n if (entityId === undefined) {\n let t1;\n if ($[0] === Symbol.for(\"react.memo_cache_sentinel\")) {\n t1 = {\n canView: false,\n canAdminView: false,\n canEdit: false,\n canCreate: false,\n canDelete: false,\n canShare: false,\n permissionLevel: null,\n isLoading: true\n };\n $[0] = t1;\n } else {\n t1 = $[0];\n }\n t0 = t1;\n break bb0;\n }\n let t1;\n if ($[1] !== entityId || $[2] !== entityType || $[3] !== getPermission) {\n t1 = getPermission(entityType, entityId);\n $[1] = entityId;\n $[2] = entityType;\n $[3] = getPermission;\n $[4] = t1;\n } else {\n t1 = $[4];\n }\n t0 = t1;\n }\n return t0;\n}\n\n/**\n * Hook to check a single action permission\n * @param entityType - Entity type\n * @param entityId - Entity ID\n * @param action - 'view' | 'adminView' | 'edit' | 'create' | 'delete' | 'share'\n * @returns boolean - true if user has permission for action\n *\n * @example\n * ```tsx\n * function ProjectActions({ projectId }: { projectId: number }) {\n * const canEdit = usePermissionCheck('Project', projectId, 'edit');\n * const canDelete = usePermissionCheck('Project', projectId, 'delete');\n *\n * return (\n * <div>\n * <Button disabled={!canEdit}>Edit</Button>\n * <Button disabled={!canDelete}>Delete</Button>\n * </div>\n * );\n * }\n * ```\n */\nexport function usePermissionCheck(entityType, entityId, action) {\n const $ = _c(5);\n const {\n checkPermission\n } = usePermissionContext();\n let t0;\n bb0: {\n if (entityId === undefined) {\n t0 = false;\n break bb0;\n }\n let t1;\n if ($[0] !== action || $[1] !== checkPermission || $[2] !== entityId || $[3] !== entityType) {\n t1 = checkPermission(entityType, entityId, action);\n $[0] = action;\n $[1] = checkPermission;\n $[2] = entityId;\n $[3] = entityType;\n $[4] = t1;\n } else {\n t1 = $[4];\n }\n t0 = t1;\n }\n return t0;\n}\n\n/**\n * Result type for usePermissions batch hook\n */\nexport interface EntityWithPermission {\n type: EntityType;\n id: number;\n permission: EntityPermissionCheck;\n}\n\n/**\n * Hook for batch permission lookup - useful for lists\n * @param entities - Array of { type, id } objects\n * @returns Array of entities with their permissions attached\n *\n * This hook:\n * - Calls prefetchPermissions on mount and when entities change\n * - Returns memoized results\n * - Handles empty arrays gracefully\n *\n * @example\n * ```tsx\n * function ProjectList({ projects }: { projects: Array<{ id: number; name: string }> }) {\n * const entities = projects.map(p => ({ type: 'Project' as const, id: p.id }));\n * const entitiesWithPermissions = usePermissionsBatch(entities);\n *\n * return (\n * <ul>\n * {entitiesWithPermissions.map(({ id, permission }) => {\n * const project = projects.find(p => p.id === id);\n * return (\n * <li key={id}>\n * {project?.name}\n * {permission.canEdit && <EditIcon />}\n * </li>\n * );\n * })}\n * </ul>\n * );\n * }\n * ```\n */\nexport function usePermissionsBatch(entities: Array<{\n type: EntityType;\n id: number;\n}>): EntityWithPermission[] {\n const {\n getPermission,\n prefetchPermissions\n } = usePermissionContext();\n\n // Memoize the entities array to prevent unnecessary re-renders\n const entitiesKey = useMemo(() => entities.map(e => `${e.type}:${e.id}`).sort().join(\",\"), [entities]);\n\n // Prefetch permissions when entities change\n useEffect(() => {\n if (entities.length === 0) {\n return;\n }\n\n // Convert to the format expected by prefetchPermissions\n const entitiesToPrefetch = entities.map(e_0 => ({\n entityType: e_0.type,\n entityId: e_0.id\n }));\n prefetchPermissions(entitiesToPrefetch);\n }, [entities, entitiesKey, prefetchPermissions]);\n\n // Return memoized results\n return useMemo(() => {\n if (entities.length === 0) {\n return [];\n }\n return entities.map(entity => ({\n type: entity.type,\n id: entity.id,\n permission: getPermission(entity.type, entity.id)\n }));\n }, [getPermission, entitiesKey]);\n}\n\n/**\n * Simple boolean hook to check if user can view an entity\n * @param entityType - Entity type\n * @param entityId - Entity ID (can be undefined for loading states)\n * @returns boolean - true if user can view the entity\n *\n * @example\n * ```tsx\n * function ProjectPage({ projectId }: { projectId: number }) {\n * const canView = useCanView('Project', projectId);\n *\n * if (!canView) {\n * return <AccessDenied />;\n * }\n *\n * return <ProjectContent projectId={projectId} />;\n * }\n * ```\n */\nexport function useCanView(entityType, entityId) {\n return usePermissionCheck(entityType, entityId, \"view\");\n}\n\n/**\n * Simple boolean hook to check if user can edit an entity\n * @param entityType - Entity type\n * @param entityId - Entity ID (can be undefined for loading states)\n * @returns boolean - true if user can edit the entity\n *\n * @example\n * ```tsx\n * function ProjectEditor({ projectId }: { projectId: number }) {\n * const canEdit = useCanEdit('Project', projectId);\n *\n * return (\n * <form>\n * <input disabled={!canEdit} />\n * <button disabled={!canEdit}>Save</button>\n * </form>\n * );\n * }\n * ```\n */\nexport function useCanEdit(entityType, entityId) {\n return usePermissionCheck(entityType, entityId, \"edit\");\n}\n\n/**\n * Simple boolean hook to check if user can delete an entity\n * @param entityType - Entity type\n * @param entityId - Entity ID (can be undefined for loading states)\n * @returns boolean - true if user can delete the entity\n *\n * @example\n * ```tsx\n * function ProjectActions({ projectId }: { projectId: number }) {\n * const canDelete = useCanDelete('Project', projectId);\n *\n * return (\n * <Button\n * variant=\"destructive\"\n * disabled={!canDelete}\n * onClick={handleDelete}\n * >\n * Delete Project\n * </Button>\n * );\n * }\n * ```\n */\nexport function useCanDelete(entityType, entityId) {\n return usePermissionCheck(entityType, entityId, \"delete\");\n}\n\n/**\n * Simple boolean hook to check if user can share an entity\n * @param entityType - Entity type\n * @param entityId - Entity ID (can be undefined for loading states)\n * @returns boolean - true if user can share the entity\n *\n * @example\n * ```tsx\n * function ShareButton({ projectId }: { projectId: number }) {\n * const canShare = useCanShare('Project', projectId);\n *\n * if (!canShare) {\n * return null;\n * }\n *\n * return <Button onClick={openShareModal}>Share</Button>;\n * }\n * ```\n */\nexport function useCanShare(entityType, entityId) {\n return usePermissionCheck(entityType, entityId, \"share\");\n}\n\n/**\n * Simple boolean hook to check if user can create entities of a type\n * Note: For create permission, the entityId should be the parent entity ID\n * (e.g., for creating a ProjectDatabase, pass the Project ID)\n *\n * @param entityType - Entity type\n * @param entityId - Parent entity ID (can be undefined for loading states)\n * @returns boolean - true if user can create entities\n *\n * @example\n * ```tsx\n * function AddDatabaseButton({ projectId }: { projectId: number }) {\n * const canCreate = useCanCreate('ProjectDatabase', projectId);\n *\n * return (\n * <Button disabled={!canCreate} onClick={handleCreate}>\n * Add Database\n * </Button>\n * );\n * }\n * ```\n */\nexport function useCanCreate(entityType, entityId) {\n return usePermissionCheck(entityType, entityId, \"create\");\n}\n\n/**\n * Hook to invalidate permission cache for a specific entity\n * Useful after permission changes (e.g., after sharing an entity)\n *\n * @returns Function to invalidate permission for an entity\n *\n * @example\n * ```tsx\n * function ShareModal({ projectId }: { projectId: number }) {\n * const invalidatePermission = useInvalidatePermission();\n *\n * const handleShare = async (userId: string) => {\n * await shareProject(projectId, userId);\n * invalidatePermission('Project', projectId);\n * };\n *\n * return <ShareForm onShare={handleShare} />;\n * }\n * ```\n */\nexport function useInvalidatePermission() {\n const {\n invalidatePermission\n } = usePermissionContext();\n return invalidatePermission;\n}\n\n/**\n * Hook to get the loading state of the permission context\n * @returns boolean - true if permissions are being fetched\n *\n * @example\n * ```tsx\n * function PermissionAwareComponent() {\n * const isLoadingPermissions = usePermissionLoading();\n *\n * if (isLoadingPermissions) {\n * return <LoadingSpinner />;\n * }\n *\n * return <Content />;\n * }\n * ```\n */\nexport function usePermissionLoading() {\n const {\n isLoading\n } = usePermissionContext();\n return isLoading;\n}"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,aAAa,YAAY,eAAe;AAiC1C,SAAS,UAAU;AACxB,QAAM,OAAO,WAAW,gBAAgB;AACxC,MAAI,SAAS,KAAK,IAAI,MAAM,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IAClD,EAAE;AAAA,EACJ,GAAG,CAAC,eAAe,WAAW,CAAC;AACjC;AAqBO,SAAS,WAAW,YAAY,UAAU;AAC/C,SAAO,mBAAmB,YAAY,UAAU,MAAM;AACxD;AAsBO,SAAS,WAAW,YAAY,UAAU;AAC/C,SAAO,mBAAmB,YAAY,UAAU,MAAM;AACxD;AAyBO,SAAS,aAAa,YAAY,UAAU;AACjD,SAAO,mBAAmB,YAAY,UAAU,QAAQ;AAC1D;AAqBO,SAAS,YAAY,YAAY,UAAU;AAChD,SAAO,mBAAmB,YAAY,UAAU,OAAO;AACzD;AAwBO,SAAS,aAAa,YAAY,UAAU;AACjD,SAAO,mBAAmB,YAAY,UAAU,QAAQ;AAC1D;AAsBO,SAAS,0BAA0B;AACxC,QAAM;AAAA,IACJ;AAAA,EACF,IAAI,qBAAqB;AACzB,SAAO;AACT;AAmBO,SAAS,uBAAuB;AACrC,QAAM;AAAA,IACJ;AAAA,EACF,IAAI,qBAAqB;AACzB,SAAO;AACT;","names":["useContext","useMemo","useContext","t1","useMemo"]}
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-SM73S2DY.js";
|
|
7
7
|
import {
|
|
8
8
|
useSetupAuth
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ILGWCJ6S.js";
|
|
10
10
|
import {
|
|
11
11
|
useDbQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6OSNGHRE.js";
|
|
13
13
|
import {
|
|
14
14
|
useSupabase
|
|
15
15
|
} from "./chunk-DMVUEJG2.js";
|
|
@@ -467,4 +467,4 @@ export {
|
|
|
467
467
|
useSetUserMetadata,
|
|
468
468
|
useUserMetadataState
|
|
469
469
|
};
|
|
470
|
-
//# sourceMappingURL=chunk-
|
|
470
|
+
//# sourceMappingURL=chunk-INIX2V6L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-NSIAAYW3.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createAdapterRegistry,
|
|
4
4
|
createSupabaseAdapter,
|
|
5
5
|
stripSchemaPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TO5QB4UM.js";
|
|
7
7
|
import {
|
|
8
8
|
DataLayerContext,
|
|
9
9
|
DataLayerCoreContext,
|
|
@@ -4952,4 +4952,4 @@ object-assign/index.js:
|
|
|
4952
4952
|
@license MIT
|
|
4953
4953
|
*)
|
|
4954
4954
|
*/
|
|
4955
|
-
//# sourceMappingURL=chunk-
|
|
4955
|
+
//# sourceMappingURL=chunk-QMHHKYZO.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-7SCJNYTE.js";
|
|
10
10
|
import {
|
|
11
11
|
useDbQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6OSNGHRE.js";
|
|
13
13
|
import {
|
|
14
14
|
useDataLayerCoreOptional
|
|
15
15
|
} from "./chunk-UBHORKBS.js";
|
|
@@ -4282,8 +4282,8 @@ var AdapterAutoDetector = class {
|
|
|
4282
4282
|
if (typeof this.powerSyncDb.getAll !== "function") {
|
|
4283
4283
|
return "initializing" /* INITIALIZING */;
|
|
4284
4284
|
}
|
|
4285
|
-
if (this.options.useOnlineUntilSynced
|
|
4286
|
-
if (!this.syncStatus.hasSynced) {
|
|
4285
|
+
if (this.options.useOnlineUntilSynced) {
|
|
4286
|
+
if (!this.syncStatus || !this.syncStatus.hasSynced) {
|
|
4287
4287
|
return "initializing" /* INITIALIZING */;
|
|
4288
4288
|
}
|
|
4289
4289
|
}
|
|
@@ -7924,4 +7924,4 @@ moment/moment.js:
|
|
|
7924
7924
|
(*! license : MIT *)
|
|
7925
7925
|
(*! momentjs.com *)
|
|
7926
7926
|
*/
|
|
7927
|
-
//# sourceMappingURL=chunk-
|
|
7927
|
+
//# sourceMappingURL=chunk-TO5QB4UM.js.map
|