deepspace 0.6.0 → 0.6.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 +6 -0
- package/dist/cli.js +169 -55
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +26 -3
- package/dist/index.js +124 -13
- package/dist/index.js.map +1 -1
- package/features/cron/src/CronLogPage.tsx +3 -3
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -2778,6 +2778,21 @@ interface RecordContextValue {
|
|
|
2778
2778
|
}, timeoutMs?: number) => Promise<unknown>;
|
|
2779
2779
|
}
|
|
2780
2780
|
declare function useRecordContext(): RecordContextValue;
|
|
2781
|
+
/**
|
|
2782
|
+
* A server-rejected write, delivered to `RecordProvider`'s `onWriteError`.
|
|
2783
|
+
* One structured object rather than positional strings so future rejection
|
|
2784
|
+
* kinds (rate-limit, quota, dropped-while-offline) and correlation fields
|
|
2785
|
+
* (collection, recordId, the raw server string) can be added without
|
|
2786
|
+
* breaking the callback signature.
|
|
2787
|
+
*/
|
|
2788
|
+
interface WriteError {
|
|
2789
|
+
/** 'permission' — an RBAC denial; 'validation' — missing/immutable/invalid field or any other rejection. */
|
|
2790
|
+
kind: 'permission' | 'validation';
|
|
2791
|
+
/** Short human-readable summary, safe to show end users. */
|
|
2792
|
+
title: string;
|
|
2793
|
+
/** Longer human-readable explanation; may be empty. */
|
|
2794
|
+
detail: string;
|
|
2795
|
+
}
|
|
2781
2796
|
/**
|
|
2782
2797
|
* RecordProvider - Main entry point for storage.
|
|
2783
2798
|
*
|
|
@@ -2803,7 +2818,7 @@ declare function useRecordContext(): RecordContextValue;
|
|
|
2803
2818
|
* </RecordProvider>
|
|
2804
2819
|
* ```
|
|
2805
2820
|
*/
|
|
2806
|
-
declare function RecordProvider({ roomId, wsUrl, children, allowAnonymous, getAuthToken: getAuthTokenProp, }: {
|
|
2821
|
+
declare function RecordProvider({ roomId, schemas, wsUrl, children, allowAnonymous, getAuthToken: getAuthTokenProp, onWriteError, }: {
|
|
2807
2822
|
roomId?: string;
|
|
2808
2823
|
/**
|
|
2809
2824
|
* Accepted for API compatibility with `RecordScope` and documented usage,
|
|
@@ -2815,6 +2830,14 @@ declare function RecordProvider({ roomId, wsUrl, children, allowAnonymous, getAu
|
|
|
2815
2830
|
children: ReactNode;
|
|
2816
2831
|
allowAnonymous?: boolean;
|
|
2817
2832
|
getAuthToken?: () => Promise<string | null>;
|
|
2833
|
+
/**
|
|
2834
|
+
* Called when the server rejects a write. Optimistic mutations
|
|
2835
|
+
* (`create`/`put`/`remove`) resolve before the server answers, so this
|
|
2836
|
+
* callback is the only place a denied or invalid write surfaces — wire it
|
|
2837
|
+
* to your toast/alert system and branch on `error.kind`. Defaults to a
|
|
2838
|
+
* deduped console.error so rejections are never fully silent.
|
|
2839
|
+
*/
|
|
2840
|
+
onWriteError?: (error: WriteError) => void;
|
|
2818
2841
|
}): React__default.ReactElement;
|
|
2819
2842
|
|
|
2820
2843
|
interface SharedScopeConfig {
|
|
@@ -3315,7 +3338,7 @@ declare function useCronMonitor(roomId: string): UseCronMonitorResult;
|
|
|
3315
3338
|
* apps importing from both ends don't get type collisions.
|
|
3316
3339
|
*
|
|
3317
3340
|
* @example
|
|
3318
|
-
* const { jobs, enqueue, getJob, cancel } = useJobs(`app:${
|
|
3341
|
+
* const { jobs, enqueue, getJob, cancel } = useJobs(SCOPE_ID) // `app:${APP_ID}`
|
|
3319
3342
|
*
|
|
3320
3343
|
* async function onClick() {
|
|
3321
3344
|
* const jobId = await enqueue('ai-summarize', { text })
|
|
@@ -4616,4 +4639,4 @@ interface UseCheckoutReturn {
|
|
|
4616
4639
|
}
|
|
4617
4640
|
declare function useCheckout(opts?: UseCheckoutOpts): UseCheckoutReturn;
|
|
4618
4641
|
|
|
4619
|
-
export { ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, type BaseMessage, type CanvasShapeClient, type Channel, type ChannelInvitation, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, type ClientMessage, type CollectionSchema, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, ENV, type Environment, type FetchUserProfile, type FileAttachment, type GamePlayer, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, type IntegrationResponse, type JobStatusView, type JobView, type LinkPreviewData, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, 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, 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, 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, type ServerMessage, SignedIn, SignedOut, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, type SyncResult, 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 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, applyDeepSpaceTheme, applyUIThemeTokens, authClient, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, createDecoder, createEncoder, decodeAiStreamChunk, 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, useUser, useUserLookup, useUsers, useVoiceAgent, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };
|
|
4642
|
+
export { ASYNC_RESOURCE_DEFAULTS, type AdHocChargeOpts, type AiStreamAction, type AiStreamChunk, type AsyncResourceDefaults, type AsyncResourceState, type AsyncResourceStatus, AuthGate, type AuthGateProps, AuthOverlay, Awareness, type AwarenessState, type AwarenessStates, type BaseMessage, type CanvasShapeClient, type Channel, type ChannelInvitation, type ChannelMember, type ChargeOnceOpts, type ChargeOnceResult, type ClientMessage, type CollectionSchema, type ConnectionAttachment, type ConnectionStatus, type ContentSegment, type ConversationObject, type CronHistoryEntry, type CronTaskState, DEEPSPACE_THEME_PROPERTIES, DEFAULT_USER_COLORS, DeepSpaceAuthProvider, type DeepSpaceThemeConfig, DeepSpaceThemeProvider, type DeepSpaceThemeProviderProps, type DeriveLoadStateInput, ENV, type Environment, type FetchUserProfile, type FileAttachment, type GamePlayer, type GroupedReaction, GuestBanner, type HandlerContext, type InboxEntry, type IntegrationResponse, type JobStatusView, type JobView, type LinkPreviewData, type LoadState, type LoadStateAuthInput, type LoadStateStatusInput, 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, 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, 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, type ServerMessage, SignedIn, SignedOut, type SubscribeOpts, type SubscribeResult, type SubscriptionState, type SubscriptionStatus, type SyncResult, 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 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, type WriteError, applyDeepSpaceTheme, applyUIThemeTokens, authClient, canAutoLoadPagedResource, clampPagedResourceItems, clearAuthToken, clearDeepSpaceTheme, clientBuild, createDecoder, createEncoder, decodeAiStreamChunk, 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, useUser, useUserLookup, useUsers, useVoiceAgent, useYjsField, useYjsRoom, useYjsText, writeVarUint, writeVarUint8Array };
|
package/dist/index.js
CHANGED
|
@@ -712,6 +712,20 @@ var DEBUG = readDebugFlag();
|
|
|
712
712
|
function debugLog(...args) {
|
|
713
713
|
if (DEBUG) console.log(...args);
|
|
714
714
|
}
|
|
715
|
+
function isLocalDevHost() {
|
|
716
|
+
try {
|
|
717
|
+
const g = globalThis;
|
|
718
|
+
if (g.DEEPSPACE_DEV === true || g.DEEPSPACE_DEV === "1" || g.DEEPSPACE_DEV === "true" || g.DEEPSPACE_DEV === 1)
|
|
719
|
+
return true;
|
|
720
|
+
if (g.DEEPSPACE_DEV === false || g.DEEPSPACE_DEV === "0" || g.DEEPSPACE_DEV === "false" || g.DEEPSPACE_DEV === 0)
|
|
721
|
+
return false;
|
|
722
|
+
const host = g.location?.hostname;
|
|
723
|
+
if (!host) return false;
|
|
724
|
+
return host === "localhost" || host === "127.0.0.1" || host === "[::1]" || host.endsWith(".localhost");
|
|
725
|
+
} catch {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
715
729
|
|
|
716
730
|
// src/client/auth/DeepSpaceAuthProvider.tsx
|
|
717
731
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1712,7 +1726,7 @@ function ScopeRegistryProvider({ children }) {
|
|
|
1712
1726
|
}
|
|
1713
1727
|
|
|
1714
1728
|
// src/client/storage/context.tsx
|
|
1715
|
-
import { Fragment as Fragment5, jsx as jsx6 } from "react/jsx-runtime";
|
|
1729
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1716
1730
|
var RecordContext = createContext2(null);
|
|
1717
1731
|
function useRecordContext() {
|
|
1718
1732
|
const ctx = useContext2(RecordContext);
|
|
@@ -1731,7 +1745,9 @@ function RecordProviderCore({
|
|
|
1731
1745
|
children,
|
|
1732
1746
|
fetchUser,
|
|
1733
1747
|
allowAnonymous = false,
|
|
1734
|
-
getAuthToken: getAuthTokenProp
|
|
1748
|
+
getAuthToken: getAuthTokenProp,
|
|
1749
|
+
onPermissionError: onPermissionErrorProp,
|
|
1750
|
+
onValidationError: onValidationErrorProp
|
|
1735
1751
|
}) {
|
|
1736
1752
|
const [userProfile, setUserProfile] = useState3(null);
|
|
1737
1753
|
const [userProfileLoading, setUserProfileLoading] = useState3(true);
|
|
@@ -1746,6 +1762,8 @@ function RecordProviderCore({
|
|
|
1746
1762
|
const onValidationErrorRef = useRef4(
|
|
1747
1763
|
void 0
|
|
1748
1764
|
);
|
|
1765
|
+
onPermissionErrorRef.current = onPermissionErrorProp;
|
|
1766
|
+
onValidationErrorRef.current = onValidationErrorProp;
|
|
1749
1767
|
const storeRef = useRef4(new RecordStore());
|
|
1750
1768
|
const socketRef = useRef4(null);
|
|
1751
1769
|
const subscriptionsRef = useRef4(/* @__PURE__ */ new Map());
|
|
@@ -1954,10 +1972,22 @@ function RecordProviderAuthOnly({
|
|
|
1954
1972
|
children,
|
|
1955
1973
|
fetchUser,
|
|
1956
1974
|
allowAnonymous = false,
|
|
1957
|
-
getAuthToken: getAuthTokenProp
|
|
1975
|
+
getAuthToken: getAuthTokenProp,
|
|
1976
|
+
onPermissionError: onPermissionErrorProp,
|
|
1977
|
+
onValidationError: onValidationErrorProp
|
|
1958
1978
|
}) {
|
|
1959
1979
|
const [userProfile, setUserProfile] = useState3(null);
|
|
1960
1980
|
const [userProfileLoading, setUserProfileLoading] = useState3(true);
|
|
1981
|
+
const onPermissionErrorRef = useRef4(onPermissionErrorProp);
|
|
1982
|
+
onPermissionErrorRef.current = onPermissionErrorProp;
|
|
1983
|
+
const onValidationErrorRef = useRef4(onValidationErrorProp);
|
|
1984
|
+
onValidationErrorRef.current = onValidationErrorProp;
|
|
1985
|
+
const onPermissionError = useCallback2((title, detail) => {
|
|
1986
|
+
onPermissionErrorRef.current?.(title, detail);
|
|
1987
|
+
}, []);
|
|
1988
|
+
const onValidationError = useCallback2((title, detail) => {
|
|
1989
|
+
onValidationErrorRef.current?.(title, detail);
|
|
1990
|
+
}, []);
|
|
1961
1991
|
const refetchUserProfile = useCallback2(async () => {
|
|
1962
1992
|
try {
|
|
1963
1993
|
const profile = await fetchUser();
|
|
@@ -1993,20 +2023,86 @@ function RecordProviderAuthOnly({
|
|
|
1993
2023
|
userProfileLoading,
|
|
1994
2024
|
refetchUserProfile,
|
|
1995
2025
|
allowAnonymous,
|
|
1996
|
-
getAuthToken: getAuthTokenProp
|
|
2026
|
+
getAuthToken: getAuthTokenProp,
|
|
2027
|
+
onPermissionError,
|
|
2028
|
+
onValidationError
|
|
1997
2029
|
}),
|
|
1998
|
-
[
|
|
2030
|
+
[
|
|
2031
|
+
userProfile,
|
|
2032
|
+
userProfileLoading,
|
|
2033
|
+
refetchUserProfile,
|
|
2034
|
+
allowAnonymous,
|
|
2035
|
+
getAuthTokenProp,
|
|
2036
|
+
onPermissionError,
|
|
2037
|
+
onValidationError
|
|
2038
|
+
]
|
|
1999
2039
|
);
|
|
2000
2040
|
return /* @__PURE__ */ jsx6(RecordAuthContext.Provider, { value: authValue, children: /* @__PURE__ */ jsx6(ScopeRegistryProvider, { children }) });
|
|
2001
2041
|
}
|
|
2042
|
+
var seenWriteErrors = /* @__PURE__ */ new Set();
|
|
2043
|
+
function defaultOnWriteError(error) {
|
|
2044
|
+
const key = JSON.stringify([error.kind, error.title, error.detail]);
|
|
2045
|
+
if (seenWriteErrors.has(key)) return;
|
|
2046
|
+
if (seenWriteErrors.size >= 100) seenWriteErrors.clear();
|
|
2047
|
+
seenWriteErrors.add(key);
|
|
2048
|
+
console.error(
|
|
2049
|
+
`[deepspace] Write rejected \u2014 ${error.title}: ${error.detail}
|
|
2050
|
+
This error reached no UI. Pass onWriteError to <RecordProvider> (e.g. wire it to a toast) so users see rejected writes. (Further repeats of this error are suppressed.)`
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
var warnedIgnoredSchemas = false;
|
|
2054
|
+
var warnedSignedOutNull = false;
|
|
2055
|
+
function SignedOutDiagnostic() {
|
|
2056
|
+
return /* @__PURE__ */ jsxs4(
|
|
2057
|
+
"div",
|
|
2058
|
+
{
|
|
2059
|
+
role: "alert",
|
|
2060
|
+
"data-deepspace-diagnostic": "signed-out",
|
|
2061
|
+
style: {
|
|
2062
|
+
margin: "24px auto",
|
|
2063
|
+
maxWidth: 560,
|
|
2064
|
+
padding: "16px 20px",
|
|
2065
|
+
border: "1px solid #d97706",
|
|
2066
|
+
borderRadius: 8,
|
|
2067
|
+
background: "#fffbeb",
|
|
2068
|
+
color: "#78350f",
|
|
2069
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
2070
|
+
fontSize: 13,
|
|
2071
|
+
lineHeight: 1.5
|
|
2072
|
+
},
|
|
2073
|
+
children: [
|
|
2074
|
+
/* @__PURE__ */ jsx6("strong", { children: "DeepSpace: nothing rendered because you're signed out." }),
|
|
2075
|
+
/* @__PURE__ */ jsxs4("p", { style: { margin: "8px 0 0" }, children: [
|
|
2076
|
+
"This page is inside a ",
|
|
2077
|
+
"<RecordProvider>",
|
|
2078
|
+
" without ",
|
|
2079
|
+
/* @__PURE__ */ jsx6("code", { children: "allowAnonymous" }),
|
|
2080
|
+
", which renders nothing for signed-out visitors. Either add",
|
|
2081
|
+
" ",
|
|
2082
|
+
/* @__PURE__ */ jsx6("code", { children: "<RecordProvider allowAnonymous>" }),
|
|
2083
|
+
" to show the page publicly, or require sign-in before this point (e.g. a protected route / AuthGate)."
|
|
2084
|
+
] }),
|
|
2085
|
+
/* @__PURE__ */ jsx6("p", { style: { margin: "8px 0 0", opacity: 0.8 }, children: "This notice only appears on localhost \u2014 a deployed app renders nothing here." })
|
|
2086
|
+
]
|
|
2087
|
+
}
|
|
2088
|
+
);
|
|
2089
|
+
}
|
|
2002
2090
|
function RecordProvider({
|
|
2003
2091
|
roomId,
|
|
2092
|
+
schemas,
|
|
2004
2093
|
wsUrl,
|
|
2005
2094
|
children,
|
|
2006
2095
|
allowAnonymous = false,
|
|
2007
|
-
getAuthToken: getAuthTokenProp
|
|
2096
|
+
getAuthToken: getAuthTokenProp,
|
|
2097
|
+
onWriteError = defaultOnWriteError
|
|
2008
2098
|
}) {
|
|
2009
2099
|
const { isLoaded, isSignedIn } = useAuth();
|
|
2100
|
+
if (schemas && roomId && isLocalDevHost() && !warnedIgnoredSchemas) {
|
|
2101
|
+
warnedIgnoredSchemas = true;
|
|
2102
|
+
console.warn(
|
|
2103
|
+
"[deepspace] RecordProvider received a `schemas` prop alongside `roomId`, but the single-scope provider ignores it \u2014 schemas are resolved server-side in this mode. Remove the `schemas` prop, or adopt the multi-scope shape and pass schemas to <RecordScope>."
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2010
2106
|
const fetchUser = useCallback2(async () => {
|
|
2011
2107
|
if (!isSignedIn) return null;
|
|
2012
2108
|
const token = await getAuthToken();
|
|
@@ -2033,8 +2129,19 @@ function RecordProvider({
|
|
|
2033
2129
|
return /* @__PURE__ */ jsx6(Fragment5, { children: null });
|
|
2034
2130
|
}
|
|
2035
2131
|
if (!isSignedIn && !allowAnonymous) {
|
|
2132
|
+
if (isLocalDevHost()) {
|
|
2133
|
+
if (!warnedSignedOutNull) {
|
|
2134
|
+
warnedSignedOutNull = true;
|
|
2135
|
+
console.warn(
|
|
2136
|
+
"[deepspace] RecordProvider rendered nothing: signed out and allowAnonymous is off. Add `allowAnonymous` to show this page to signed-out visitors, or require sign-in before this point."
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
return /* @__PURE__ */ jsx6(SignedOutDiagnostic, {});
|
|
2140
|
+
}
|
|
2036
2141
|
return /* @__PURE__ */ jsx6(Fragment5, { children: null });
|
|
2037
2142
|
}
|
|
2143
|
+
const onPermissionError = (title, detail) => onWriteError({ kind: "permission", title, detail });
|
|
2144
|
+
const onValidationError = (title, detail) => onWriteError({ kind: "validation", title, detail });
|
|
2038
2145
|
if (roomId) {
|
|
2039
2146
|
return /* @__PURE__ */ jsx6(
|
|
2040
2147
|
RecordProviderCore,
|
|
@@ -2044,6 +2151,8 @@ function RecordProvider({
|
|
|
2044
2151
|
fetchUser,
|
|
2045
2152
|
allowAnonymous,
|
|
2046
2153
|
getAuthToken: getAuthTokenFn,
|
|
2154
|
+
onPermissionError,
|
|
2155
|
+
onValidationError,
|
|
2047
2156
|
children
|
|
2048
2157
|
}
|
|
2049
2158
|
);
|
|
@@ -2054,6 +2163,8 @@ function RecordProvider({
|
|
|
2054
2163
|
fetchUser,
|
|
2055
2164
|
allowAnonymous,
|
|
2056
2165
|
getAuthToken: getAuthTokenFn,
|
|
2166
|
+
onPermissionError,
|
|
2167
|
+
onValidationError,
|
|
2057
2168
|
children
|
|
2058
2169
|
}
|
|
2059
2170
|
);
|
|
@@ -2071,7 +2182,7 @@ function wsLog(event, label) {
|
|
|
2071
2182
|
}
|
|
2072
2183
|
|
|
2073
2184
|
// src/client/storage/RecordScope.tsx
|
|
2074
|
-
import { Fragment as Fragment6, jsx as jsx7, jsxs as
|
|
2185
|
+
import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2075
2186
|
function HeadlessScope({
|
|
2076
2187
|
roomId,
|
|
2077
2188
|
schemas,
|
|
@@ -2325,7 +2436,7 @@ function RecordScope({
|
|
|
2325
2436
|
wsPathPrefix = "/ws",
|
|
2326
2437
|
isolated = false
|
|
2327
2438
|
}) {
|
|
2328
|
-
return /* @__PURE__ */
|
|
2439
|
+
return /* @__PURE__ */ jsxs5(Fragment6, { children: [
|
|
2329
2440
|
sharedScopes?.map((shared) => /* @__PURE__ */ jsx7(
|
|
2330
2441
|
HeadlessScope,
|
|
2331
2442
|
{
|
|
@@ -5789,7 +5900,7 @@ function useSubscription() {
|
|
|
5789
5900
|
}
|
|
5790
5901
|
|
|
5791
5902
|
// src/client/subscriptions/PricingTable.tsx
|
|
5792
|
-
import { jsx as jsx10, jsxs as
|
|
5903
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5793
5904
|
function PricingTable(props) {
|
|
5794
5905
|
const interval = props.interval ?? "month";
|
|
5795
5906
|
return /* @__PURE__ */ jsx10("div", { className: "grid gap-4 md:grid-cols-3", children: props.plans.map((plan) => {
|
|
@@ -5802,14 +5913,14 @@ function PricingTable(props) {
|
|
|
5802
5913
|
const unavailableLabel = onlyInterval ? onlyInterval === "month" ? "Monthly only" : "Yearly only" : "Unavailable";
|
|
5803
5914
|
const priceLabel = price ? `$${(price.priceCents / 100).toFixed(0)}` : isTrueFree ? "Free" : unavailableLabel;
|
|
5804
5915
|
const disabled = selected || intervalUnavailable;
|
|
5805
|
-
return /* @__PURE__ */
|
|
5806
|
-
/* @__PURE__ */
|
|
5916
|
+
return /* @__PURE__ */ jsxs6("section", { className: "rounded-lg border border-border p-5", children: [
|
|
5917
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-1", children: [
|
|
5807
5918
|
/* @__PURE__ */ jsx10("h3", { className: "text-lg font-semibold", children: plan.name }),
|
|
5808
|
-
/* @__PURE__ */
|
|
5919
|
+
/* @__PURE__ */ jsxs6("p", { className: "text-3xl font-semibold", children: [
|
|
5809
5920
|
priceLabel,
|
|
5810
5921
|
/* @__PURE__ */ jsx10("span", { className: "text-sm font-normal text-muted-foreground", children: price ? `/${interval}` : "" })
|
|
5811
5922
|
] }),
|
|
5812
|
-
plan.trialDays ? /* @__PURE__ */
|
|
5923
|
+
plan.trialDays ? /* @__PURE__ */ jsxs6("p", { className: "text-xs text-muted-foreground", children: [
|
|
5813
5924
|
plan.trialDays,
|
|
5814
5925
|
"-day free trial"
|
|
5815
5926
|
] }) : null
|