docs: @objectstack/client SDK gap analysis for upstream development#8
Conversation
…velopment Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 基于目前已实现的API功能,重新调整本项目计划安排 |
There was a problem hiding this comment.
Pull request overview
Adds a comprehensive SDK gap analysis report to guide upstream development of @objectstack/client / @objectstack/client-react so the mobile app can proceed through Phases 4–6.
Changes:
- Introduces
docs/SDK-GAP-ANALYSIS.mdwith a phase/priority-based inventory of missing SDK namespaces and React hooks. - Proposes TypeScript signatures for critical missing APIs (views, permissions, workflows, realtime) and additional Phase 4–6 features.
- Documents current coverage for
@objectstack/client@1.1.0and@objectstack/client-react@1.1.0.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| on(event: 'message' | 'presence' | 'error' | 'reconnect', handler: Function): void; | ||
| off(event: string, handler: Function): void; |
There was a problem hiding this comment.
In the proposed client.realtime API, on(..., handler: Function) / off(event: string, handler: Function) is overly untyped and conflicts with common TS linting (Function is typically banned). Consider defining an event->handler signature map (e.g., overloads or a generic on<E extends RealtimeEventName>(event: E, handler: RealtimeHandlerMap[E])) and keep off’s event type aligned with on.
| function useSubscription(channel: string, options?: { | ||
| object?: string; | ||
| recordId?: string; | ||
| events?: string[]; | ||
| onEvent?: (event: RealtimeEvent) => void; |
There was a problem hiding this comment.
useSubscription’s events?: string[] is inconsistent with the earlier client.realtime.subscribe(... events?: ('create' | 'update' | 'delete')[]) suggestion. To keep the spec precise, use the same event union type in the hook (or define a shared RealtimeChangeEvent type) instead of string[].
| enabled?: boolean; | ||
| }): { | ||
| users: PresenceState[]; | ||
| setStatus: (status: string) => void; |
There was a problem hiding this comment.
usePresence returns setStatus: (status: string) => void, but the allowed statuses in this section are modeled as a union ('viewing' | 'editing', and client.realtime.setPresence also includes 'idle'). Using string weakens the spec and makes it easy to pass unsupported values; align setStatus’s parameter type with the intended status union (and decide whether 'idle' should be supported here too).
| setStatus: (status: string) => void; | |
| setStatus: (status: 'viewing' | 'editing') => void; |
| function useFileUpload(options?: { | ||
| scope?: string; | ||
| onProgress?: (progress: number) => void; | ||
| onSuccess?: (result: FileUploadResponse) => void; | ||
| onError?: (error: Error) => void; | ||
| }): { | ||
| upload: (file: File | Blob | { uri: string; type: string; name: string }) => Promise<FileUploadResponse>; |
There was a problem hiding this comment.
The proposed useFileUpload signature includes the DOM File type (upload: (file: File | Blob | { uri: ... })). In React Native / Expo TS configs, File may not exist unless dom libs are enabled, which can make the upstream hook types awkward for mobile consumers. Consider defining an SDK-owned Uploadable type and avoid referencing File directly (or make it conditional via an exported type alias).
| function useFileUpload(options?: { | |
| scope?: string; | |
| onProgress?: (progress: number) => void; | |
| onSuccess?: (result: FileUploadResponse) => void; | |
| onError?: (error: Error) => void; | |
| }): { | |
| upload: (file: File | Blob | { uri: string; type: string; name: string }) => Promise<FileUploadResponse>; | |
| export type Uploadable = Blob | { uri: string; type: string; name: string }; | |
| function useFileUpload(options?: { | |
| scope?: string; | |
| onProgress?: (progress: number) => void; | |
| onSuccess?: (result: FileUploadResponse) => void; | |
| onError?: (error: Error) => void; | |
| }): { | |
| upload: (file: Uploadable) => Promise<FileUploadResponse>; |
…ailability Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
已在 97952e1 中重构了 双轨并行策略:按 SDK API 可用性将 Phase 4–6 拆分为 A/B 两条轨道:
时间预估:
|
Changes
docs/SDK-GAP-ANALYSIS.md (unchanged)
Full audit of @objectstack/client@1.1.0 API surface vs mobile app needs.
docs/ROADMAP.md (restructured)
Rewrote the development roadmap based on SDK gap analysis:
Key changes:
Timeline estimate:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.