deepspace 0.25.0 → 0.26.1
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/CHANGELOG.md +41 -0
- package/README.md +7 -6
- package/dist/{chunk-2GUGZLAX.js → chunk-YBXIUDZJ.js} +2 -2
- package/dist/{chunk-2GUGZLAX.js.map → chunk-YBXIUDZJ.js.map} +1 -1
- package/dist/cli.js +1036 -966
- package/dist/cli.js.map +1 -1
- package/dist/documentation-client-core.js +1 -1
- package/dist/documentation-default-renderer.cjs +1 -1
- package/dist/documentation-react.js +1 -1
- package/dist/documentation-runtime.js +1 -1
- package/dist/documentation-server-core.js +1 -1
- package/dist/documentation.js +1 -1
- package/dist/documentation.js.map +1 -1
- package/dist/index.d.ts +26 -434
- package/dist/index.js +99 -864
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +4 -41
- package/dist/schema.js +2 -242
- package/dist/schema.js.map +1 -1
- package/dist/server.d.ts +6 -162
- package/dist/server.js +13 -281
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +4 -160
- package/dist/worker.js +15 -281
- package/dist/worker.js.map +1 -1
- package/features/messaging/feature.json +3 -43
- package/features/messaging/src/ChatPage.tsx +12 -16
- package/features/messaging/src/components/chat/ChatHeader.tsx +5 -13
- package/features/messaging/src/components/chat/MessageItem.tsx +7 -9
- package/features/messaging/src/components/chat/MessageList.tsx +57 -40
- package/features/messaging/src/components/chat/ThreadPanel.tsx +25 -11
- package/features/messaging/src/components/chat/UserProfilePopover.tsx +10 -29
- package/features/messaging/src/hooks/useChatChannel.ts +18 -23
- package/features/messaging/src/messaging-schema.ts +0 -2
- package/features/search-bar/feature.json +9 -20
- package/features/search-bar/src/InlineSearch.tsx +101 -0
- package/features/search-bar/src/__tests__/search-model.test.tsx +38 -0
- package/features/search-bar/src/search-model.ts +2 -149
- package/package.json +1 -1
- package/features/messaging/src/ChatMultiPage.tsx +0 -298
- package/features/messaging/src/components/chat-multi/AddMemberModal.tsx +0 -188
- package/features/messaging/src/components/chat-multi/BrowseGroupsModal.tsx +0 -163
- package/features/messaging/src/components/chat-multi/ChannelListItem.tsx +0 -147
- package/features/messaging/src/components/chat-multi/ChannelSettingsPanel.tsx +0 -344
- package/features/messaging/src/components/chat-multi/ChannelSidebar.tsx +0 -460
- package/features/messaging/src/components/chat-multi/CreateGroupModal.tsx +0 -190
- package/features/messaging/src/components/chat-multi/InvitationList.tsx +0 -149
- package/features/messaging/src/components/chat-multi/NewMessageModal.tsx +0 -159
- package/features/messaging/src/hooks/useMultiChannel.ts +0 -142
- package/features/search-bar/src/SearchOverlay.tsx +0 -566
- package/features/search-bar/src/__tests__/search-model.test.ts +0 -40
- package/features/sidebar/feature.json +0 -19
- package/features/sidebar/src/AppSidebar.tsx +0 -558
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as Y from 'yjs';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
4
|
-
import React__default, { ReactNode } from 'react';
|
|
3
|
+
import React$1, { ReactNode } from 'react';
|
|
5
4
|
import * as zod_v4_core from 'zod/v4/core';
|
|
6
5
|
import * as zod from 'zod';
|
|
7
6
|
import * as better_auth_plugins_two_factor from 'better-auth/plugins/two-factor';
|
|
@@ -130,85 +129,6 @@ interface YjsSubscription {
|
|
|
130
129
|
recordId: string;
|
|
131
130
|
fieldName: string;
|
|
132
131
|
}
|
|
133
|
-
interface DirectoryConversationData {
|
|
134
|
-
Name: string;
|
|
135
|
-
Description: string;
|
|
136
|
-
Type: string;
|
|
137
|
-
Visibility: string;
|
|
138
|
-
CreatedBy: string;
|
|
139
|
-
ParticipantHash: string;
|
|
140
|
-
ParticipantIds: string;
|
|
141
|
-
Status: string;
|
|
142
|
-
AssigneeId: string;
|
|
143
|
-
LinkedRef: string;
|
|
144
|
-
LastMessageAt: string;
|
|
145
|
-
LastMessagePreview: string;
|
|
146
|
-
LastMessageAuthor: string;
|
|
147
|
-
MessageCount: number;
|
|
148
|
-
}
|
|
149
|
-
interface ConversationStateData {
|
|
150
|
-
ConversationId: string;
|
|
151
|
-
UserId: string;
|
|
152
|
-
LastReadAt: string;
|
|
153
|
-
LastReadMessageCount: number;
|
|
154
|
-
Starred: number;
|
|
155
|
-
Archived: number;
|
|
156
|
-
Trashed: number;
|
|
157
|
-
Labels: string;
|
|
158
|
-
Folder: string;
|
|
159
|
-
}
|
|
160
|
-
interface DirectoryCommunityData {
|
|
161
|
-
Name: string;
|
|
162
|
-
Description: string;
|
|
163
|
-
CreatedBy: string;
|
|
164
|
-
Type: string;
|
|
165
|
-
Visibility: string;
|
|
166
|
-
MemberCount: number;
|
|
167
|
-
Rules: string;
|
|
168
|
-
IconUrl: string;
|
|
169
|
-
CoverUrl: string;
|
|
170
|
-
}
|
|
171
|
-
interface DirectoryMembershipData {
|
|
172
|
-
CommunityId: string;
|
|
173
|
-
UserId: string;
|
|
174
|
-
UserName: string;
|
|
175
|
-
Role: string;
|
|
176
|
-
JoinedAt: string;
|
|
177
|
-
}
|
|
178
|
-
interface DirectoryPostData {
|
|
179
|
-
Title: string;
|
|
180
|
-
Content: string;
|
|
181
|
-
AuthorId: string;
|
|
182
|
-
Type: string;
|
|
183
|
-
CommunityId: string;
|
|
184
|
-
ParentId: string;
|
|
185
|
-
ConversationId: string;
|
|
186
|
-
Status: string;
|
|
187
|
-
Tags: string;
|
|
188
|
-
LinkUrl: string;
|
|
189
|
-
}
|
|
190
|
-
interface ConvMessageData {
|
|
191
|
-
Content: string;
|
|
192
|
-
AuthorId: string;
|
|
193
|
-
ParentId: string;
|
|
194
|
-
Edited: number;
|
|
195
|
-
MessageType: string;
|
|
196
|
-
Metadata: string;
|
|
197
|
-
}
|
|
198
|
-
interface ConvReactionData {
|
|
199
|
-
MessageId: string;
|
|
200
|
-
Emoji: string;
|
|
201
|
-
UserId: string;
|
|
202
|
-
}
|
|
203
|
-
interface ConvMemberData {
|
|
204
|
-
UserId: string;
|
|
205
|
-
UserName: string;
|
|
206
|
-
Role: string;
|
|
207
|
-
}
|
|
208
|
-
interface ConvReadCursorData {
|
|
209
|
-
UserId: string;
|
|
210
|
-
LastReadAt: string;
|
|
211
|
-
}
|
|
212
132
|
|
|
213
133
|
/**
|
|
214
134
|
* Environment detection and URL configuration
|
|
@@ -270,6 +190,14 @@ declare const ROLES: {
|
|
|
270
190
|
readonly ADMIN: "admin";
|
|
271
191
|
};
|
|
272
192
|
type Role = (typeof ROLES)[keyof typeof ROLES];
|
|
193
|
+
/**
|
|
194
|
+
* Whether a role may write app content: member and admin can, viewer is
|
|
195
|
+
* read-only. The one chokepoint for every client-side write gate — an app
|
|
196
|
+
* that defines custom write-capable roles extends this predicate once. The
|
|
197
|
+
* server always re-checks writes against the schema's permission table; this
|
|
198
|
+
* only controls what the UI offers.
|
|
199
|
+
*/
|
|
200
|
+
declare function isWriterRole(role: unknown): role is Exclude<Role, typeof ROLES.VIEWER>;
|
|
273
201
|
declare const ROLE_CONFIG: Record<Role, {
|
|
274
202
|
title: string;
|
|
275
203
|
badgeVariant: string;
|
|
@@ -1503,7 +1431,7 @@ type AppMigrationIdsValidation = {
|
|
|
1503
1431
|
declare function validateAppMigrationIds(value: unknown): AppMigrationIdsValidation;
|
|
1504
1432
|
|
|
1505
1433
|
interface DeepSpaceAuthProviderProps {
|
|
1506
|
-
children:
|
|
1434
|
+
children: React$1.ReactNode;
|
|
1507
1435
|
}
|
|
1508
1436
|
/**
|
|
1509
1437
|
* Auth provider for DeepSpace apps.
|
|
@@ -2719,9 +2647,9 @@ interface AuthOverlayProps {
|
|
|
2719
2647
|
/** Line under the heading. Defaults to "Sync your data across devices". */
|
|
2720
2648
|
description?: string;
|
|
2721
2649
|
/** Optional brand mark rendered above the heading. Defaults to none (the current look). */
|
|
2722
|
-
logo?:
|
|
2650
|
+
logo?: React$1.ReactNode;
|
|
2723
2651
|
}
|
|
2724
|
-
declare function AuthOverlay({ onClose, providers, title, description, logo, }?: AuthOverlayProps):
|
|
2652
|
+
declare function AuthOverlay({ onClose, providers, title, description, logo, }?: AuthOverlayProps): React$1.ReactElement | null;
|
|
2725
2653
|
|
|
2726
2654
|
/** Conditional renderers, the route gate, and a display-name hook. */
|
|
2727
2655
|
|
|
@@ -2780,7 +2708,7 @@ interface GuestBannerProps {
|
|
|
2780
2708
|
/** Called when the user clicks "Sign in". */
|
|
2781
2709
|
onSignIn?: () => void;
|
|
2782
2710
|
}
|
|
2783
|
-
declare function GuestBanner({ message, storageKey, onSignIn, }: GuestBannerProps):
|
|
2711
|
+
declare function GuestBanner({ message, storageKey, onSignIn, }: GuestBannerProps): React$1.ReactElement | null;
|
|
2784
2712
|
|
|
2785
2713
|
/**
|
|
2786
2714
|
* Storage Types
|
|
@@ -2857,7 +2785,7 @@ interface RoomUser {
|
|
|
2857
2785
|
lastSeenAt?: string;
|
|
2858
2786
|
}
|
|
2859
2787
|
type RoomConnectionState = 'connecting' | 'connected' | 'disconnected';
|
|
2860
|
-
/** A rejected
|
|
2788
|
+
/** A rejected fire-and-forget write. */
|
|
2861
2789
|
interface WriteError {
|
|
2862
2790
|
/**
|
|
2863
2791
|
* `permission` — RBAC denial; `validation` — data validation/other server
|
|
@@ -3005,14 +2933,14 @@ declare function useRecordContext(): RecordContextValue;
|
|
|
3005
2933
|
* ```tsx
|
|
3006
2934
|
* <RecordProvider>
|
|
3007
2935
|
* <RecordScope roomId="app:slack-clone" schemas={appSchemas}>
|
|
3008
|
-
* <RecordScope roomId={`
|
|
2936
|
+
* <RecordScope roomId={`chat:${channelId}`} schemas={messagingSchemas}>
|
|
3009
2937
|
* <ChannelView />
|
|
3010
2938
|
* </RecordScope>
|
|
3011
2939
|
* </RecordScope>
|
|
3012
2940
|
* </RecordProvider>
|
|
3013
2941
|
* ```
|
|
3014
2942
|
*/
|
|
3015
|
-
declare function RecordProvider({ children, allowAnonymous, getAuthToken: getAuthTokenProp, onWriteError, }: RecordProviderProps):
|
|
2943
|
+
declare function RecordProvider({ children, allowAnonymous, getAuthToken: getAuthTokenProp, onWriteError, }: RecordProviderProps): React$1.ReactElement;
|
|
3016
2944
|
|
|
3017
2945
|
interface SharedScopeConfig {
|
|
3018
2946
|
roomId: string;
|
|
@@ -3840,7 +3768,7 @@ declare function getUserColor(userId: string, palette?: readonly string[]): stri
|
|
|
3840
3768
|
interface Channel {
|
|
3841
3769
|
name: string;
|
|
3842
3770
|
description?: string;
|
|
3843
|
-
type: 'public'
|
|
3771
|
+
type: 'public';
|
|
3844
3772
|
createdBy: string;
|
|
3845
3773
|
archived: boolean;
|
|
3846
3774
|
}
|
|
@@ -3870,11 +3798,11 @@ interface ReadReceipt {
|
|
|
3870
3798
|
userId: string;
|
|
3871
3799
|
lastReadAt: string;
|
|
3872
3800
|
}
|
|
3873
|
-
interface
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3801
|
+
interface GroupedReaction {
|
|
3802
|
+
emoji: string;
|
|
3803
|
+
count: number;
|
|
3804
|
+
currentUserReacted: boolean;
|
|
3805
|
+
userIds: string[];
|
|
3878
3806
|
}
|
|
3879
3807
|
|
|
3880
3808
|
/**
|
|
@@ -3903,7 +3831,6 @@ declare function useChannels(): {
|
|
|
3903
3831
|
error: string | undefined;
|
|
3904
3832
|
create: (data: {
|
|
3905
3833
|
name: string;
|
|
3906
|
-
type: Channel["type"];
|
|
3907
3834
|
description?: string;
|
|
3908
3835
|
}) => Promise<string>;
|
|
3909
3836
|
archive: (channelId: string) => void;
|
|
@@ -3911,54 +3838,6 @@ declare function useChannels(): {
|
|
|
3911
3838
|
remove: (recordId: string) => Promise<void>;
|
|
3912
3839
|
};
|
|
3913
3840
|
|
|
3914
|
-
/**
|
|
3915
|
-
* Shared messaging types for conversation-based apps.
|
|
3916
|
-
*/
|
|
3917
|
-
|
|
3918
|
-
type MessageRecord = RecordData<ConvMessageData>;
|
|
3919
|
-
type ReactionRecord = RecordData<ConvReactionData>;
|
|
3920
|
-
type MemberRecord = RecordData<ConvMemberData>;
|
|
3921
|
-
type ReadCursorRecord = RecordData<ConvReadCursorData>;
|
|
3922
|
-
interface GroupedReaction {
|
|
3923
|
-
emoji: string;
|
|
3924
|
-
count: number;
|
|
3925
|
-
currentUserReacted: boolean;
|
|
3926
|
-
userIds: string[];
|
|
3927
|
-
}
|
|
3928
|
-
type ContentSegment = {
|
|
3929
|
-
type: 'text';
|
|
3930
|
-
value: string;
|
|
3931
|
-
} | {
|
|
3932
|
-
type: 'emoji';
|
|
3933
|
-
value: string;
|
|
3934
|
-
shortcode: string;
|
|
3935
|
-
} | {
|
|
3936
|
-
type: 'link';
|
|
3937
|
-
value: string;
|
|
3938
|
-
href: string;
|
|
3939
|
-
} | {
|
|
3940
|
-
type: 'mention';
|
|
3941
|
-
userId: string;
|
|
3942
|
-
displayName: string;
|
|
3943
|
-
};
|
|
3944
|
-
interface LinkPreviewData {
|
|
3945
|
-
url: string;
|
|
3946
|
-
title?: string;
|
|
3947
|
-
description?: string;
|
|
3948
|
-
image?: string;
|
|
3949
|
-
favicon?: string;
|
|
3950
|
-
}
|
|
3951
|
-
interface ConversationObject {
|
|
3952
|
-
messages: MessageRecord[];
|
|
3953
|
-
reactions: ReactionRecord[];
|
|
3954
|
-
members: MemberRecord[];
|
|
3955
|
-
status: 'connecting' | 'connected';
|
|
3956
|
-
send: (content: string, parentMessageId?: string, messageType?: string, metadata?: Record<string, unknown>) => void;
|
|
3957
|
-
edit: (recordId: string, content: string) => void;
|
|
3958
|
-
remove: (recordId: string) => void;
|
|
3959
|
-
toggleReaction: (messageId: string, emoji: string) => void;
|
|
3960
|
-
}
|
|
3961
|
-
|
|
3962
3841
|
/**
|
|
3963
3842
|
* useReactions — subscribe to reactions in a channel with toggle.
|
|
3964
3843
|
*/
|
|
@@ -3979,8 +3858,8 @@ declare function useChannelMembers(channelId: string | undefined): {
|
|
|
3979
3858
|
members: RecordData<ChannelMember>[];
|
|
3980
3859
|
status: "error" | "ready" | "loading";
|
|
3981
3860
|
error: string | undefined;
|
|
3982
|
-
join: () => void
|
|
3983
|
-
leave: () => void
|
|
3861
|
+
join: () => Promise<void>;
|
|
3862
|
+
leave: () => Promise<void>;
|
|
3984
3863
|
isMember: boolean;
|
|
3985
3864
|
};
|
|
3986
3865
|
|
|
@@ -3996,179 +3875,6 @@ declare function useReadReceipts(): {
|
|
|
3996
3875
|
getUnreadCount: (channelId: string, messages: RecordData<Message>[]) => number;
|
|
3997
3876
|
};
|
|
3998
3877
|
|
|
3999
|
-
/**
|
|
4000
|
-
* useConversation — Shared hook for conversation messaging.
|
|
4001
|
-
*
|
|
4002
|
-
* Wraps useQuery/useMutations for conv_messages, conv_reactions, conv_members
|
|
4003
|
-
* and returns a ConversationObject. Must be used inside a RecordScope for the
|
|
4004
|
-
* conversation DO (conv:{channelId}).
|
|
4005
|
-
*/
|
|
4006
|
-
|
|
4007
|
-
interface UseConversationOptions {
|
|
4008
|
-
onMessageSent?: (content: string, parentMessageId?: string) => void;
|
|
4009
|
-
}
|
|
4010
|
-
declare function useConversation(opts?: UseConversationOptions): ConversationObject;
|
|
4011
|
-
|
|
4012
|
-
/**
|
|
4013
|
-
* Shared messaging utility functions.
|
|
4014
|
-
*/
|
|
4015
|
-
|
|
4016
|
-
declare function groupReactionsForMessage(reactions: ReactionRecord[], messageId: string, currentUserId: string): GroupedReaction[];
|
|
4017
|
-
/**
|
|
4018
|
-
* Determine whether a message should be visually grouped with the previous one
|
|
4019
|
-
* (same author, within threshold, no date boundary).
|
|
4020
|
-
*/
|
|
4021
|
-
declare function shouldGroupMessages(current: MessageRecord, previous: MessageRecord | null | undefined, options?: {
|
|
4022
|
-
thresholdMs?: number;
|
|
4023
|
-
dateChanged?: boolean;
|
|
4024
|
-
}): boolean;
|
|
4025
|
-
/**
|
|
4026
|
-
* Compute thread reply counts from a flat message array.
|
|
4027
|
-
*/
|
|
4028
|
-
declare function getThreadCounts(messages: MessageRecord[]): Map<string, number>;
|
|
4029
|
-
/**
|
|
4030
|
-
* Format a message timestamp for display.
|
|
4031
|
-
* Returns "2:30 PM" style short time.
|
|
4032
|
-
*/
|
|
4033
|
-
declare function formatMessageTime(dateStr: string): string;
|
|
4034
|
-
/**
|
|
4035
|
-
* Format a full message timestamp.
|
|
4036
|
-
* Returns "Mar 5, 2026 at 2:30 PM" style.
|
|
4037
|
-
*/
|
|
4038
|
-
declare function formatFullTimestamp(dateStr: string): string;
|
|
4039
|
-
|
|
4040
|
-
/**
|
|
4041
|
-
* Conversation Display Utilities
|
|
4042
|
-
*
|
|
4043
|
-
* Shared helpers for rendering conversation names, participant lists,
|
|
4044
|
-
* and type checks across apps (slack-clone, discord-clone, etc.).
|
|
4045
|
-
*/
|
|
4046
|
-
|
|
4047
|
-
interface ConversationData {
|
|
4048
|
-
Name: string;
|
|
4049
|
-
Type: string;
|
|
4050
|
-
ParticipantIds: string;
|
|
4051
|
-
ParticipantHash: string;
|
|
4052
|
-
}
|
|
4053
|
-
/**
|
|
4054
|
-
* Get a display name for a conversation.
|
|
4055
|
-
*
|
|
4056
|
-
* - Channels: use Name field
|
|
4057
|
-
* - DMs: look up the other participant's name
|
|
4058
|
-
* - Group DMs: "User A, User B, +N"
|
|
4059
|
-
*/
|
|
4060
|
-
declare function getConversationDisplayName(conversation: {
|
|
4061
|
-
data: ConversationData;
|
|
4062
|
-
}, currentUserId: string, getUser: (id: string) => UserInfo | undefined): string;
|
|
4063
|
-
/**
|
|
4064
|
-
* Check if a conversation type is a DM or group DM.
|
|
4065
|
-
*/
|
|
4066
|
-
declare function isDMConversation(type: string): boolean;
|
|
4067
|
-
/**
|
|
4068
|
-
* Parse participant IDs from a conversation.
|
|
4069
|
-
* Tries ParticipantIds JSON first, falls back to ParticipantHash (colon-separated).
|
|
4070
|
-
*/
|
|
4071
|
-
declare function getConversationParticipantIds(conversation: {
|
|
4072
|
-
data: Pick<ConversationData, 'ParticipantIds' | 'ParticipantHash'>;
|
|
4073
|
-
}, excludeUserId?: string): string[];
|
|
4074
|
-
|
|
4075
|
-
/**
|
|
4076
|
-
* Safely parse a Metadata field that may be a JSON string, an object, or null/undefined.
|
|
4077
|
-
* Returns the parsed object or null on failure.
|
|
4078
|
-
*/
|
|
4079
|
-
declare function parseMessageMetadata(raw: unknown): Record<string, unknown> | null;
|
|
4080
|
-
|
|
4081
|
-
/**
|
|
4082
|
-
* useConversations Hook
|
|
4083
|
-
*
|
|
4084
|
-
* Standardized conversation directory backed by the `conversations` and
|
|
4085
|
-
* `conversation_state` collections in the dir:{appName} DO.
|
|
4086
|
-
*
|
|
4087
|
-
* Apps that need a sidebar list of channels / DMs / threads should:
|
|
4088
|
-
* 1. Add { type: 'dir', instanceId: APP_ID } to SHARED_CONNECTIONS.
|
|
4089
|
-
* 2. Call useConversations() inside a RecordProvider.
|
|
4090
|
-
*/
|
|
4091
|
-
|
|
4092
|
-
declare function useConversations(): {
|
|
4093
|
-
conversations: RecordData<DirectoryConversationData>[];
|
|
4094
|
-
ready: boolean;
|
|
4095
|
-
createChannel: (name: string, description?: string) => Promise<string>;
|
|
4096
|
-
createDM: (otherUserId: string) => Promise<string | null>;
|
|
4097
|
-
createGroupDM: (participantIds: string[]) => Promise<string | null>;
|
|
4098
|
-
lookupByName: (name: string) => string | null;
|
|
4099
|
-
updateLastMessage: (conversationId: string, preview: string, authorId?: string) => void;
|
|
4100
|
-
readStateMap: Map<string, string>;
|
|
4101
|
-
readMessageCountMap: Map<string, number>;
|
|
4102
|
-
starredSet: Set<string>;
|
|
4103
|
-
archivedSet: Set<string>;
|
|
4104
|
-
getConversationState: (conversationId: string) => ConversationStateData | undefined;
|
|
4105
|
-
upsertState: (conversationId: string, partial: Partial<ConversationStateData>) => void;
|
|
4106
|
-
markRead: (conversationId: string) => void;
|
|
4107
|
-
toggleStar: (conversationId: string) => void;
|
|
4108
|
-
setArchived: (conversationId: string, archived: boolean) => void;
|
|
4109
|
-
setTrashed: (conversationId: string, trashed: boolean) => void;
|
|
4110
|
-
setLabels: (conversationId: string, labels: string[]) => void;
|
|
4111
|
-
setFolder: (conversationId: string, folder: string) => void;
|
|
4112
|
-
};
|
|
4113
|
-
|
|
4114
|
-
/**
|
|
4115
|
-
* useCommunities Hook
|
|
4116
|
-
*
|
|
4117
|
-
* CRUD operations for the `communities` and `memberships` collections
|
|
4118
|
-
* in the dir:{appName} DO.
|
|
4119
|
-
*
|
|
4120
|
-
* Apps that need forums, groups, or boards should:
|
|
4121
|
-
* 1. Add { type: 'dir', instanceId: APP_ID } to SHARED_CONNECTIONS.
|
|
4122
|
-
* 2. Call useCommunities() inside a RecordProvider.
|
|
4123
|
-
*/
|
|
4124
|
-
|
|
4125
|
-
declare function useCommunities(): {
|
|
4126
|
-
communities: RecordData<DirectoryCommunityData>[];
|
|
4127
|
-
memberships: RecordData<DirectoryMembershipData>[];
|
|
4128
|
-
ready: boolean;
|
|
4129
|
-
myMemberships: Set<string>;
|
|
4130
|
-
createCommunity: (name: string, opts?: {
|
|
4131
|
-
description?: string;
|
|
4132
|
-
type?: string;
|
|
4133
|
-
visibility?: string;
|
|
4134
|
-
rules?: string;
|
|
4135
|
-
}) => Promise<string>;
|
|
4136
|
-
updateCommunity: (communityId: string, updates: Partial<DirectoryCommunityData>) => void;
|
|
4137
|
-
joinCommunity: (communityId: string, userName: string) => Promise<string | null>;
|
|
4138
|
-
leaveCommunity: (communityId: string) => void;
|
|
4139
|
-
getMembersOf: (communityId: string) => DirectoryMembershipData[];
|
|
4140
|
-
lookupByName: (name: string) => string | null;
|
|
4141
|
-
};
|
|
4142
|
-
|
|
4143
|
-
/**
|
|
4144
|
-
* usePosts Hook
|
|
4145
|
-
*
|
|
4146
|
-
* CRUD operations for the `posts` collection in the dir:{appName} DO.
|
|
4147
|
-
*
|
|
4148
|
-
* Apps that need feeds, Q&A, or tweet-style content should:
|
|
4149
|
-
* 1. Add { type: 'dir', instanceId: APP_ID } to SHARED_CONNECTIONS.
|
|
4150
|
-
* 2. Call usePosts() inside a RecordProvider.
|
|
4151
|
-
*/
|
|
4152
|
-
|
|
4153
|
-
declare function usePosts(opts?: {
|
|
4154
|
-
communityId?: string;
|
|
4155
|
-
}): {
|
|
4156
|
-
posts: RecordData<DirectoryPostData>[];
|
|
4157
|
-
ready: boolean;
|
|
4158
|
-
createPost: (data: {
|
|
4159
|
-
title: string;
|
|
4160
|
-
content: string;
|
|
4161
|
-
type?: string;
|
|
4162
|
-
communityId?: string;
|
|
4163
|
-
parentId?: string;
|
|
4164
|
-
tags?: string[];
|
|
4165
|
-
linkUrl?: string;
|
|
4166
|
-
}) => Promise<string>;
|
|
4167
|
-
updatePost: (postId: string, updates: Partial<DirectoryPostData>) => void;
|
|
4168
|
-
deletePost: (postId: string) => void;
|
|
4169
|
-
setConversationId: (postId: string, conversationId: string) => void;
|
|
4170
|
-
};
|
|
4171
|
-
|
|
4172
3878
|
/**
|
|
4173
3879
|
* DeepSpace Theme Configuration
|
|
4174
3880
|
*
|
|
@@ -4236,7 +3942,7 @@ interface DeepSpaceThemeProviderProps {
|
|
|
4236
3942
|
* </DeepSpaceThemeProvider>
|
|
4237
3943
|
* ```
|
|
4238
3944
|
*/
|
|
4239
|
-
declare function DeepSpaceThemeProvider({ children, theme, }: DeepSpaceThemeProviderProps):
|
|
3945
|
+
declare function DeepSpaceThemeProvider({ children, theme, }: DeepSpaceThemeProviderProps): React$1.ReactElement;
|
|
4240
3946
|
|
|
4241
3947
|
/**
|
|
4242
3948
|
* Determine whether a CSS color is "dark" using relative luminance.
|
|
@@ -4294,120 +4000,6 @@ declare function readThemeFromDOM(root?: HTMLElement): DeepSpaceThemeConfig;
|
|
|
4294
4000
|
*/
|
|
4295
4001
|
declare function useIsDarkTheme(): boolean;
|
|
4296
4002
|
|
|
4297
|
-
/**
|
|
4298
|
-
* PlatformProvider — Zero-cost context for platform worker integration.
|
|
4299
|
-
*
|
|
4300
|
-
* Always present in the component tree (via template main.tsx), but only
|
|
4301
|
-
* activates expensive features (WebSocket connections, polling) when a
|
|
4302
|
-
* component subscribes via the corresponding hook.
|
|
4303
|
-
*
|
|
4304
|
-
* Always available (zero overhead):
|
|
4305
|
-
* platformFetch(path, init) — authenticated fetch, prepends /platform
|
|
4306
|
-
*
|
|
4307
|
-
* Subscription-activated (zero cost until first subscriber):
|
|
4308
|
-
* useInbox() — inbox entries from InboxRoom WebSocket
|
|
4309
|
-
*
|
|
4310
|
-
* Auth uses getAuthToken() from deepspace on demand.
|
|
4311
|
-
* The template already provides DeepSpaceAuthProvider.
|
|
4312
|
-
*
|
|
4313
|
-
* Usage:
|
|
4314
|
-
* import { PlatformProvider, usePlatform, useInbox } from 'deepspace'
|
|
4315
|
-
*
|
|
4316
|
-
* // Already in template main.tsx:
|
|
4317
|
-
* <PlatformProvider>
|
|
4318
|
-
* <App />
|
|
4319
|
-
* </PlatformProvider>
|
|
4320
|
-
*
|
|
4321
|
-
* // In any component:
|
|
4322
|
-
* const { platformFetch } = usePlatform()
|
|
4323
|
-
* const inbox = useInbox() // activates WebSocket on mount
|
|
4324
|
-
*/
|
|
4325
|
-
interface InboxEntry {
|
|
4326
|
-
conversationId: string;
|
|
4327
|
-
scope: {
|
|
4328
|
-
type: string;
|
|
4329
|
-
participants?: string[];
|
|
4330
|
-
appId?: string;
|
|
4331
|
-
contentRef?: string;
|
|
4332
|
-
ticketNumber?: string;
|
|
4333
|
-
};
|
|
4334
|
-
displayName: string;
|
|
4335
|
-
muted: boolean;
|
|
4336
|
-
joinedAt: string;
|
|
4337
|
-
lastMessageAt: string | null;
|
|
4338
|
-
lastMessagePreview: string | null;
|
|
4339
|
-
lastMessageAuthor: string | null;
|
|
4340
|
-
unreadCount: number;
|
|
4341
|
-
}
|
|
4342
|
-
interface PlatformContextValue {
|
|
4343
|
-
/** Authenticated fetch — prepends /platform, sets Authorization + Content-Type */
|
|
4344
|
-
platformFetch: (path: string, init?: RequestInit) => Promise<Response>;
|
|
4345
|
-
/** Subscribe to inbox — returns unsubscribe. Internal use by useInbox(). */
|
|
4346
|
-
subscribeInbox: () => () => void;
|
|
4347
|
-
/** Current inbox entries (populated when at least one subscriber is active) */
|
|
4348
|
-
inbox: InboxEntry[];
|
|
4349
|
-
}
|
|
4350
|
-
declare const PlatformContext: React$1.Context<PlatformContextValue | null>;
|
|
4351
|
-
declare function usePlatform(): PlatformContextValue;
|
|
4352
|
-
/**
|
|
4353
|
-
* Subscribe to inbox entries from the InboxRoom WebSocket.
|
|
4354
|
-
* The WebSocket connects when the first component calls useInbox()
|
|
4355
|
-
* and disconnects when the last one unmounts.
|
|
4356
|
-
*/
|
|
4357
|
-
declare function useInbox(): InboxEntry[];
|
|
4358
|
-
declare function PlatformProvider({ children }: {
|
|
4359
|
-
children: React.ReactNode;
|
|
4360
|
-
}): react_jsx_runtime.JSX.Element;
|
|
4361
|
-
|
|
4362
|
-
/**
|
|
4363
|
-
* usePlatformWS — Generic WebSocket hook for platform DO connections.
|
|
4364
|
-
*
|
|
4365
|
-
* Handles all the boilerplate:
|
|
4366
|
-
* - Auth token fetch
|
|
4367
|
-
* - WebSocket connection with wss:// protocol detection
|
|
4368
|
-
* - Exponential backoff reconnect (500ms -> 10s max)
|
|
4369
|
-
* - Ping every 30s
|
|
4370
|
-
* - Cleanup on unmount or scopeId change
|
|
4371
|
-
*
|
|
4372
|
-
* Usage:
|
|
4373
|
-
* const state = usePlatformWS({
|
|
4374
|
-
* path: 'orders', // -> /platform/ws/orders/{scopeId}
|
|
4375
|
-
* scopeId: 'app:demo-corp',
|
|
4376
|
-
* initialState: { orders: [], items: {}, status: 'connecting' },
|
|
4377
|
-
* onMessage: (msg, prev) => {
|
|
4378
|
-
* switch (msg.type) {
|
|
4379
|
-
* case 'init': return { orders: msg.orders, items: msg.items, status: 'connected' }
|
|
4380
|
-
* case 'order_created': return { ...prev, orders: [...prev.orders, msg.order] }
|
|
4381
|
-
* default: return prev
|
|
4382
|
-
* }
|
|
4383
|
-
* },
|
|
4384
|
-
* })
|
|
4385
|
-
*/
|
|
4386
|
-
|
|
4387
|
-
interface PlatformWSOptions<S> {
|
|
4388
|
-
/** DO path segment — e.g. 'orders' for /platform/ws/orders/{scopeId} */
|
|
4389
|
-
path: string;
|
|
4390
|
-
/** Scope ID — e.g. 'app:demo-corp'. Passing undefined skips connection. */
|
|
4391
|
-
scopeId: string | undefined;
|
|
4392
|
-
/** Initial state before WS connects */
|
|
4393
|
-
initialState: S;
|
|
4394
|
-
/**
|
|
4395
|
-
* Message handler. Receives the parsed message and current state.
|
|
4396
|
-
* Return a new state to update, or the same `prev` reference to skip.
|
|
4397
|
-
* The 'init' message should reset reconnect (handled automatically)
|
|
4398
|
-
* and return state with status: 'connected'.
|
|
4399
|
-
*/
|
|
4400
|
-
onMessage: (msg: Record<string, unknown>, prev: S) => S;
|
|
4401
|
-
}
|
|
4402
|
-
interface PlatformWSResult<S> {
|
|
4403
|
-
state: S;
|
|
4404
|
-
/** Send a JSON message to the WebSocket */
|
|
4405
|
-
send: (msg: Record<string, unknown>) => void;
|
|
4406
|
-
}
|
|
4407
|
-
declare function usePlatformWS<S extends {
|
|
4408
|
-
status: ConnectionStatus;
|
|
4409
|
-
}>(options: PlatformWSOptions<S>): PlatformWSResult<S>;
|
|
4410
|
-
|
|
4411
4003
|
/**
|
|
4412
4004
|
* Platform API error normalization — the one chokepoint that turns the
|
|
4413
4005
|
* api-worker's error envelope into a render-safe + branch-safe shape.
|
|
@@ -5117,4 +4709,4 @@ declare const ACCOUNT_STORAGE_LIMIT_BYTES: {
|
|
|
5117
4709
|
declare function storageLimitForTier(tier: string | null | undefined): number;
|
|
5118
4710
|
declare function formatBytes(bytes: number): string;
|
|
5119
4711
|
|
|
5120
|
-
export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, ANONYMOUS_USER_ID_PREFIX, APP_LOG_EVENT_KEYS, ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type ApiErrorIssue, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMigrationIdsValidation, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, BUILD_INJECTED_APP_ID_MIGRATION_ID, type BaseMessage, type CanvasShapeClient, type Channel, type
|
|
4712
|
+
export { ACCOUNT_STORAGE_LIMIT_BYTES, ACTION_ROUTES_BEARER_GUARD_MIGRATION_ID, ACTION_TOOLS_DELETE_WHERE_MIGRATION_ID, ANONYMOUS_USER_ID_PREFIX, APP_LOG_EVENT_KEYS, ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type ApiErrorIssue, type AppLogEvent, type AppLogEventKey, type AppLogsResponse, type AppMigrationIdsValidation, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, BUILD_INJECTED_APP_ID_MIGRATION_ID, type BaseMessage, type CanvasShapeClient, type Channel, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, type ClientErrorKind, type ClientErrorReport, type ClientErrorReporterOptions, type ClientMessage, type CollectionSchema, type ConnectionAttachment, type ConnectionStatus, type CronHistoryEntry, type CronMutationResult, type CronTaskState, DEEPSPACE_AGENT_PROFILES, DEEPSPACE_AI_DEFAULTS, DEEPSPACE_AI_MODELS, DEEPSPACE_MODEL_CATALOG_PROVENANCE, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, type DeepSpaceAIModel, type DeepSpaceAIModelId, type DeepSpaceAIProvider, type DeepSpaceAgentProfile, type DeepSpaceAgentProfileId, type DeepSpaceAgentSupport, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, ENV, type Environment, type FileAttachment, type GroupedReaction, GuestBanner, type HandlerContext, type IntegrationResponse, type JobStatusView, type JobView, LOG_LEVELS, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, type LogLevel, MSG, MSG_AWARENESS, MSG_SYNC, MSG_SYNC_STEP1, MSG_SYNC_STEP2, MSG_SYNC_UPDATE, MSG_YJS_AWARENESS, MSG_YJS_SYNC, type Message, type MessageHandlers, type MsgType, type NormalizedApiError, type PagedResourceFetchArgs, type PagedResourcePage, type PagedResourceState, type PagedResourceStatus, type PlanInfo, PlatformApiError, type PresencePeerClient, PricingTable, type PricingTablePlan, type PricingTablePrice, type ProductChargeOpts, type ProtocolMessage, type Purchase, type Query, type R2FileInfo, type R2FileListPage, type R2Scope, type R2UploadResult, RECORD_NOT_FOUND, ROLES, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_CONFIG, ROLE_DEFAULT, type Reaction, type ReadReceipt, type RecordData, RecordProvider, type RecordProviderProps, RecordRoomNotReadyError, RecordScope, type RequestOptions, type ResolvedDeepSpaceAgentModel, type Role, type RoomUser, SECURE_ROOM_BOUNDARIES_MIGRATION_ID, type ScopeEntry, ScopeRegistryProvider, type ServerMessage, SignedIn, SignedOut, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, type SyncResult, type UseAsyncResourceOptions, type UseAuthProfileReadyOptions, type UseAuthStatusOptions, type UseCanvasResult, type UseCheckoutOpts, type UseCronMonitorResult, type UseJobsResult, type UsePagedResourceOptions, type UsePresenceRoomResult, type UseR2FilesReturn, type UseVoiceAgentOptions, type UseVoiceAgentResult, type UseYjsFieldResult, type UseYjsRoomResult, type UseYjsTextResult, type User, type UserCredits, type UserInfo, type UserKarma, type UserProfile, type ViewportClient, type VoiceStatus, type VoiceTranscriptEntry, WORKER_OWNED_NOT_FOUND_MIGRATION_ID, type WriteError, applyDeepSpaceTheme, applyUIThemeTokens, authClient, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, createDecoder, createEncoder, decodeAiStreamChunk, deriveLoadState, detectEnvironment, dispatch, encode, encodeAwarenessMessage, encodeSyncStep1, encodeSyncStep2, encodeUpdate, formatBytes, formatFileSize, getApiUrl, getAuthToken, getAuthUrl, getDeepSpaceAIModel, getEnvironmentConfig, getMessageType, getPagedResourceCooldownMs, getPlatformWorkerUrl, getUserColor, handleAwarenessMessage, handleSyncMessage, hasContent, installClientErrorReporter, integration, isAnonymousUserId, isAsyncResourceSlow, isDarkColor, isImageFile, isLocalDev, isProduction, isWriterRole, listDeepSpaceAgentModels, parseSseLine, readThemeFromDOM, readVarUint, readVarUint8Array, reportClientError, resetEnvironmentCache, resolveDeepSpaceAgentModel, serverBuild, signIn, signOut, storageLimitForTier, toConnectionStatus, toUint8Array, useAsyncResource, useAuth, useAuthProfileReady, useAuthStatus, useAuthUser, useCanvas, useChannelMembers, useChannels, useCheckout, useCronMonitor, useDisplayName, useIsDarkTheme, useJobs, useMessages, useMutations, usePagedResource, usePresence, usePresenceRoom, useQuery, useR2Files, useReactions, useReadReceipts, useRecordContext, useSession, useSubscription, useUser, useUserLookup, useUsers, useVoiceAgent, useYjsField, useYjsRoom, useYjsText, validateAppMigrationIds, writeVarUint, writeVarUint8Array };
|