deepspace 0.4.1 → 0.4.3

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/index.d.ts CHANGED
@@ -6966,6 +6966,7 @@ interface IntegrationResponse<T = unknown> {
6966
6966
  interface RequestOptions {
6967
6967
  headers?: Record<string, string>;
6968
6968
  timeoutMs?: number;
6969
+ signal?: AbortSignal;
6969
6970
  }
6970
6971
  declare const integration: {
6971
6972
  post<T = unknown>(endpoint: string, data?: unknown, options?: RequestOptions): Promise<IntegrationResponse<T>>;
@@ -7053,6 +7054,155 @@ type AiStreamAction = {
7053
7054
  /** Decode one v5 UIMessage stream chunk into an action, or `null` to ignore. */
7054
7055
  declare function decodeAiStreamChunk(chunk: AiStreamChunk): AiStreamAction | null;
7055
7056
 
7057
+ type LoadState = 'loading' | 'ready' | 'empty' | 'error' | 'signedOut';
7058
+ interface LoadStateAuthInput {
7059
+ isLoaded: boolean;
7060
+ isSignedIn: boolean;
7061
+ requireSignedIn?: boolean;
7062
+ requireUser?: boolean;
7063
+ userLoading?: boolean;
7064
+ }
7065
+ interface LoadStateStatusInput {
7066
+ status: 'loading' | 'ready' | 'error' | 'idle' | 'refreshing';
7067
+ error?: unknown;
7068
+ }
7069
+ interface DeriveLoadStateInput {
7070
+ auth?: LoadStateAuthInput;
7071
+ queries?: LoadStateStatusInput[];
7072
+ resources?: LoadStateStatusInput[];
7073
+ empty?: boolean;
7074
+ }
7075
+ interface AsyncResourceDefaults {
7076
+ retry: number;
7077
+ retryDelayMs: number;
7078
+ slowAfterMs: number;
7079
+ }
7080
+ declare const ASYNC_RESOURCE_DEFAULTS: AsyncResourceDefaults;
7081
+ declare function isAsyncResourceSlow(input: {
7082
+ startedAt: number;
7083
+ now: number;
7084
+ slowAfterMs: number;
7085
+ }): boolean;
7086
+ interface PagedResourceCooldownInput {
7087
+ failureCount: number;
7088
+ retryDelayMs: number;
7089
+ maxRetryDelayMs: number;
7090
+ }
7091
+ declare function getPagedResourceCooldownMs(input: PagedResourceCooldownInput): number;
7092
+ declare function canAutoLoadPagedResource(input: {
7093
+ hasMore: boolean;
7094
+ isLoading: boolean;
7095
+ now: number;
7096
+ cooldownUntil: number;
7097
+ }): boolean;
7098
+ declare function clampPagedResourceItems<T>(input: {
7099
+ items: T[];
7100
+ maxItemsPerPage: number;
7101
+ }): {
7102
+ items: T[];
7103
+ droppedItemCount: number;
7104
+ };
7105
+ declare function deriveLoadState(input: DeriveLoadStateInput): LoadState;
7106
+
7107
+ interface UseAuthStatusOptions {
7108
+ requireSignedIn?: boolean;
7109
+ }
7110
+ interface UseAuthProfileReadyOptions extends UseAuthStatusOptions {
7111
+ requireUser?: boolean;
7112
+ }
7113
+ /** @deprecated Use `UseAuthProfileReadyOptions` instead. */
7114
+ type UseAuthReadyOptions = UseAuthProfileReadyOptions;
7115
+ declare function useAuthStatus(options?: UseAuthStatusOptions): {
7116
+ status: LoadState;
7117
+ isReady: boolean;
7118
+ isLoaded: boolean;
7119
+ isSignedIn: boolean;
7120
+ userId: string | null;
7121
+ sessionId: string | null;
7122
+ };
7123
+ declare function useAuthProfileReady(options?: UseAuthProfileReadyOptions): {
7124
+ user: User | null;
7125
+ userLoading: boolean;
7126
+ refetchUser: () => Promise<void>;
7127
+ status: LoadState;
7128
+ isReady: boolean;
7129
+ isLoaded: boolean;
7130
+ isSignedIn: boolean;
7131
+ userId: string | null;
7132
+ sessionId: string | null;
7133
+ };
7134
+ /** @deprecated Use `useAuthStatus` for auth-only UI or `useAuthProfileReady` for profile-backed UI. */
7135
+ declare const useAuthReady: typeof useAuthProfileReady;
7136
+ type AsyncResourceStatus = 'idle' | 'loading' | 'ready' | 'error';
7137
+ type PagedResourceStatus = AsyncResourceStatus;
7138
+ interface AsyncResourceState<T> {
7139
+ status: AsyncResourceStatus;
7140
+ data: T | null;
7141
+ error: string | null;
7142
+ isRefreshing: boolean;
7143
+ isSlow: boolean;
7144
+ retryCount: number;
7145
+ }
7146
+ interface UseAsyncResourceOptions<T> {
7147
+ enabled?: boolean;
7148
+ initialData?: T | null;
7149
+ keepPreviousData?: boolean;
7150
+ retry?: number;
7151
+ retryDelayMs?: number;
7152
+ slowAfterMs?: number;
7153
+ }
7154
+ interface PagedResourceFetchArgs {
7155
+ page: number;
7156
+ pageSize: number;
7157
+ signal: AbortSignal;
7158
+ }
7159
+ interface PagedResourcePage<T> {
7160
+ items: T[];
7161
+ hasMore?: boolean;
7162
+ }
7163
+ interface PagedResourceState<T> {
7164
+ status: PagedResourceStatus;
7165
+ items: T[];
7166
+ error: string | null;
7167
+ warning: string | null;
7168
+ hasMore: boolean;
7169
+ isLoadingInitial: boolean;
7170
+ isLoadingMore: boolean;
7171
+ isRefreshing: boolean;
7172
+ }
7173
+ interface UsePagedResourceOptions<T> {
7174
+ enabled?: boolean;
7175
+ initialItems?: T[];
7176
+ pageSize?: number;
7177
+ maxItemsPerPage?: number;
7178
+ keepPreviousData?: boolean;
7179
+ autoRetryOnError?: boolean;
7180
+ retryDelayMs?: number;
7181
+ maxRetryDelayMs?: number;
7182
+ }
7183
+ declare function useAsyncResource<T>(fetcher: (signal: AbortSignal) => Promise<T>, deps: readonly unknown[], options?: UseAsyncResourceOptions<T>): {
7184
+ reload: () => void;
7185
+ status: AsyncResourceStatus;
7186
+ data: T | null;
7187
+ error: string | null;
7188
+ isRefreshing: boolean;
7189
+ isSlow: boolean;
7190
+ retryCount: number;
7191
+ };
7192
+ declare function usePagedResource<T>(fetchPage: (args: PagedResourceFetchArgs) => Promise<PagedResourcePage<T>>, deps: readonly unknown[], options?: UsePagedResourceOptions<T>): {
7193
+ loadMore: () => void;
7194
+ retry: () => void;
7195
+ refresh: () => void;
7196
+ status: PagedResourceStatus;
7197
+ items: T[];
7198
+ error: string | null;
7199
+ warning: string | null;
7200
+ hasMore: boolean;
7201
+ isLoadingInitial: boolean;
7202
+ isLoadingMore: boolean;
7203
+ isRefreshing: boolean;
7204
+ };
7205
+
7056
7206
  /**
7057
7207
  * Subscription primitives shared between client (useSubscription hook) and
7058
7208
  * server (requireSubscription helper). Pulled into a shared module so the
@@ -7447,6 +7597,43 @@ interface ToastProviderProps {
7447
7597
  }
7448
7598
  declare function ToastProvider({ children, position, maxToasts, }: ToastProviderProps): React__default.ReactElement;
7449
7599
 
7600
+ /**
7601
+ * Error decoding + a friendly error screen.
7602
+ *
7603
+ * Production React replaces error text with a numeric code and a docs link
7604
+ * (e.g. `Minified React error #310`), so a developer whose app crashes in a
7605
+ * deployed build sees only the number. `decodeReactError` turns that number
7606
+ * back into a plain-English explanation; `ErrorScreen` renders it. The most
7607
+ * common offenders are the hook-order errors (#300 / #310), which almost
7608
+ * always mean a hook was placed after an early `return`.
7609
+ */
7610
+ interface DecodedReactError {
7611
+ code: number;
7612
+ title: string;
7613
+ explanation: string;
7614
+ hint: string;
7615
+ docsUrl: string;
7616
+ }
7617
+ /**
7618
+ * Decode a (possibly minified) React error into a friendly explanation, or
7619
+ * `null` if it isn't a recognizable React error — in which case the caller
7620
+ * should just show the raw message.
7621
+ */
7622
+ declare function decodeReactError(error: unknown): DecodedReactError | null;
7623
+ interface ErrorScreenProps {
7624
+ /** The thrown value, as caught by an error boundary (often non-Error). */
7625
+ error: unknown;
7626
+ /** Recovery action. Defaults to a full page reload. */
7627
+ onReset?: () => void;
7628
+ }
7629
+ /**
7630
+ * A self-contained crash screen. Renders standalone — it replaces the app
7631
+ * shell when used as a root error boundary, so it must not depend on app
7632
+ * providers (toasts, auth, theme context). It reuses only context-free
7633
+ * primitives and reads its colors from the active theme's CSS variables.
7634
+ */
7635
+ declare function ErrorScreen({ error, onReset }: ErrorScreenProps): react_jsx_runtime.JSX.Element;
7636
+
7450
7637
  interface EmptyStateProps extends React__default.HTMLAttributes<HTMLDivElement> {
7451
7638
  icon?: ReactNode;
7452
7639
  title: string;
@@ -7595,4 +7782,4 @@ interface SearchInputProps extends Omit<React$1.ComponentProps<'input'>, 'type'>
7595
7782
  }
7596
7783
  declare const SearchInput: React$1.ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
7597
7784
 
7598
- export { type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, Alert, AlertDescription, AlertTitle, AuthGate, type AuthGateProps, AuthOverlay, Avatar, AvatarFallback, AvatarImage, Awareness, type AwarenessState, type AwarenessStates, Badge, type BadgeProps, type BaseMessage, Button, type ButtonProps, type CanvasShapeClient, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, type Channel, type ChannelInvitation, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, Checkbox, type ClientMessage, type CollectionSchema, ConfirmModal, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENV, EmptyDocuments, EmptyError, EmptyItems, EmptyProjects, EmptySearch, EmptyState, EmptyTeam, type Environment, type FetchUserProfile, type FileAttachment, type GamePlayer, GridCard, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, Input, type IntegrationResponse, type JobStatusView, type JobView, Label, type LinkPreviewData, LoadingOverlay, LoadingSpinner, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MemberRecord, type Message, type MessageHandlers, type MessageRecord, Modal, type MsgType, type PlanInfo, PlatformContext, type PlatformContextValue, PlatformProvider, type PlatformWSOptions, type PlatformWSResult, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, Progress, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2Scope, type R2UploadResult, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReactionRecord, type ReadCursorRecord, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordScope, type RequestOptions, type Role, type RoomUser, type ScopeEntry, ScopeRegistryProvider, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type ServerMessage, SignedIn, SignedOut, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, SkeletonTable, SkeletonText, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, Switch, type SyncResult, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseGameRoomResult, type UseJobsResult, type UsePresenceRoomResult, type UseR2FilesReturn, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, applyDeepSpaceTheme, applyUIThemeTokens, authClient, badgeVariants, buttonVariants, clearAuthToken, clearDeepSpaceTheme, clientBuild, cn, createDecoder, createEncoder, decodeAiStreamChunk, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatFileSize, formatFullTimestamp, formatMessageTime, getApiUrl, getAuthToken, getAuthUrl, getConversationDisplayName, getConversationParticipantIds, getEnvironmentConfig, getMessageType, getPlatformWorkerUrl, getThreadCounts, getUserColor, groupReactionsForMessage, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isDMConversation, isDarkColor, isImageFile, isLocalDev, isProduction, parseMessageMetadata, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, serverBuild, shouldGroupMessages, signIn, signOut, toConnectionStatus, toUint8Array, useAuth, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCommunities, useConversation, useConversations, useCronMonitor, useDisplayName, useGameRoom, useInbox, useIsDarkTheme, useJobs, useMessages, useMutations, usePlatform, usePlatformWS, usePosts, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useToast, useUser, useUserLookup, useUsers, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };
7785
+ export { ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, Alert, AlertDescription, AlertTitle, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Avatar, AvatarFallback, AvatarImage, Awareness, type AwarenessState, type AwarenessStates, Badge, type BadgeProps, type BaseMessage, Button, type ButtonProps, type CanvasShapeClient, Card, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardTitle, type Channel, type ChannelInvitation, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, Checkbox, type ClientMessage, type CollectionSchema, ConfirmModal, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, type DecodedReactError, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENV, EmptyDocuments, EmptyError, EmptyItems, EmptyProjects, EmptySearch, EmptyState, EmptyTeam, type Environment, ErrorScreen, type ErrorScreenProps, type FetchUserProfile, type FileAttachment, type GamePlayer, GridCard, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, Input, type IntegrationResponse, type JobStatusView, type JobView, Label, type LinkPreviewData, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, LoadingOverlay, LoadingSpinner, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type MemberRecord, type Message, type MessageHandlers, type MessageRecord, Modal, type MsgType, type PagedResourceFetchArgs, type PagedResourcePage, type PagedResourceState, type PagedResourceStatus, type PlanInfo, PlatformContext, type PlatformContextValue, PlatformProvider, type PlatformWSOptions, type PlatformWSResult, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, Progress, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2Scope, type R2UploadResult, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReactionRecord, type ReadCursorRecord, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordScope, type RequestOptions, type Role, type RoomUser, type ScopeEntry, ScopeRegistryProvider, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, type ServerMessage, SignedIn, SignedOut, Skeleton, SkeletonAvatar, SkeletonCard, SkeletonList, SkeletonTable, SkeletonText, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, Switch, type SyncResult, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseAsyncResourceOptions, type UseAuthProfileReadyOptions, type UseAuthReadyOptions, type UseAuthStatusOptions, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseGameRoomResult, type UseJobsResult, type UsePagedResourceOptions, type UsePresenceRoomResult, type UseR2FilesReturn, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, applyDeepSpaceTheme, applyUIThemeTokens, authClient, badgeVariants, buttonVariants, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, cn, createDecoder, createEncoder, decodeAiStreamChunk, decodeReactError, deriveLoadState, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatFileSize, formatFullTimestamp, formatMessageTime, getApiUrl, getAuthToken, getAuthUrl, getConversationDisplayName, getConversationParticipantIds, getEnvironmentConfig, getMessageType, getPagedResourceCooldownMs, getPlatformWorkerUrl, getThreadCounts, getUserColor, groupReactionsForMessage, handleAwarenessMessage, handleSyncMessage, hasContent, integration, isAsyncResourceSlow, isDMConversation, isDarkColor, isImageFile, isLocalDev, isProduction, parseMessageMetadata, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, resetEnvironmentCache, serverBuild, shouldGroupMessages, signIn, signOut, toConnectionStatus, toUint8Array, useAsyncResource, useAuth, useAuthProfileReady, useAuthReady, useAuthStatus, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCommunities, useConversation, useConversations, useCronMonitor, useDisplayName, useGameRoom, useInbox, useIsDarkTheme, useJobs, useMessages, useMutations, usePagedResource, usePlatform, usePlatformWS, usePosts, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useToast, useUser, useUserLookup, useUsers, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };