From 1391adc9462af4e75aa23b5036c2c62c3be2acee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:10:38 +0000 Subject: [PATCH 1/4] Initial plan From 79ab2f952bee146f821aa9e4cbaba248bb8f9347 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:13:59 +0000 Subject: [PATCH 2/4] chore: upgrade @objectstack/client and @objectstack/client-react to v2.0.1 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- package.json | 4 ++-- pnpm-lock.yaml | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 26e48ed..367179b 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ }, "dependencies": { "@better-auth/expo": "^1.4.18", - "@objectstack/client": "^2.0.0", - "@objectstack/client-react": "^2.0.0", + "@objectstack/client": "^2.0.1", + "@objectstack/client-react": "^2.0.1", "@sentry/react-native": "^7.12.0", "@shopify/flash-list": "^2.2.2", "@tanstack/react-query": "^5.90.20", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70ddd6d..8b15b24 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,11 +12,11 @@ importers: specifier: ^1.4.18 version: 1.4.18(@better-auth/core@1.4.18(@better-auth/utils@0.3.0)(@better-fetch/fetch@1.1.21)(better-call@1.1.8(zod@4.3.6))(jose@6.1.3)(kysely@0.28.11)(nanostores@1.1.0))(better-auth@1.4.18(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(expo-constants@18.0.13)(expo-linking@8.0.11)(expo-network@8.0.8(expo@54.0.33)(react@19.1.0))(expo-web-browser@15.0.10(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))) '@objectstack/client': - specifier: ^2.0.0 - version: 2.0.0 + specifier: ^2.0.1 + version: 2.0.1 '@objectstack/client-react': - specifier: ^2.0.0 - version: 2.0.0(react@19.1.0) + specifier: ^2.0.1 + version: 2.0.1(react@19.1.0) '@sentry/react-native': specifier: ^7.12.0 version: 7.12.0(expo@54.0.33)(react-native@0.81.5(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) @@ -1206,24 +1206,24 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@objectstack/client-react@2.0.0': - resolution: {integrity: sha512-gNm+fH7jfYVIHT5+HmO9J/ryC32n8mF9clVIJCUk+hLSdib6laDwSBMZL5y0Ck01RCtE4Ij14CtgC2IYDd3vWw==} + '@objectstack/client-react@2.0.1': + resolution: {integrity: sha512-PoSZnhNVzVLdldDxBnvAEjE7C6O4ME3FnkX9GldGQmIa4o27Wogh5DnvvvyR2PKt94xYPwPdJSt/7QftBTO5CQ==} peerDependencies: react: '>=18.0.0' - '@objectstack/client@2.0.0': - resolution: {integrity: sha512-uwuItOyp/dIVnzCuHpygLSFfYxAt+eQELyzLzJRM9rrd2I07ZxAE2QDZmec9zRF/z8WpJM8dMYfDXFkrqy7jLg==} + '@objectstack/client@2.0.1': + resolution: {integrity: sha512-2+JUM+oxqhNger8mF/NN3AzQUkm/VZx9/6wjMoJxVklgiiLfqHELLWpkZXmVGR4g2A+mq4aqULqYsAg+gwV6qA==} - '@objectstack/core@2.0.0': - resolution: {integrity: sha512-8LdySGVAijOwPDznoxsAldpntvPbKahWy5A/8k3qYLt9FD4Y9Anx43nSBcFw3htA0YVIKtIPQrSI8JMjZoC3ew==} + '@objectstack/core@2.0.1': + resolution: {integrity: sha512-RX+SEBE3mLrXyR6/KZwjlvu41CepxJjmhTvt0LX05kqaX6UgGz9T5UBQUdXUSMDUsxg53mwDRkQXgrffcKSPDg==} peerDependencies: pino: ^8.0.0 peerDependenciesMeta: pino: optional: true - '@objectstack/spec@2.0.0': - resolution: {integrity: sha512-g0hoDiedEjta8wVe4G4trjGyvil4C/ryHZyQISiu0b3tAFQ4IEYRm5vxDKn87w7BFiT+7T9kbJcZYx7x/BUy+w==} + '@objectstack/spec@2.0.1': + resolution: {integrity: sha512-NgaMpmcXBT+AGQuCTwIYqVxKZkGs9WO5zeNIz17J8lPQ0SrhS+Hzv+5KVhOO98G4MqyJCDkodI8XMms/TVSMTg==} engines: {node: '>=18.0.0'} '@open-draft/deferred-promise@2.2.0': @@ -7206,29 +7206,29 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.20.1 - '@objectstack/client-react@2.0.0(react@19.1.0)': + '@objectstack/client-react@2.0.1(react@19.1.0)': dependencies: - '@objectstack/client': 2.0.0 - '@objectstack/core': 2.0.0 - '@objectstack/spec': 2.0.0 + '@objectstack/client': 2.0.1 + '@objectstack/core': 2.0.1 + '@objectstack/spec': 2.0.1 react: 19.1.0 transitivePeerDependencies: - pino - '@objectstack/client@2.0.0': + '@objectstack/client@2.0.1': dependencies: - '@objectstack/core': 2.0.0 - '@objectstack/spec': 2.0.0 + '@objectstack/core': 2.0.1 + '@objectstack/spec': 2.0.1 transitivePeerDependencies: - pino - '@objectstack/core@2.0.0': + '@objectstack/core@2.0.1': dependencies: - '@objectstack/spec': 2.0.0 + '@objectstack/spec': 2.0.1 pino-pretty: 13.1.3 zod: 3.25.76 - '@objectstack/spec@2.0.0': + '@objectstack/spec@2.0.1': dependencies: zod: 3.25.76 From 2924f082b744718b8da32d9a0f35f4c1960fbced Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:17:42 +0000 Subject: [PATCH 3/4] chore: update useViewStorage.ts comment for v2.0.1 typed API Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- hooks/useViewStorage.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hooks/useViewStorage.ts b/hooks/useViewStorage.ts index b05e8ea..54dd87f 100644 --- a/hooks/useViewStorage.ts +++ b/hooks/useViewStorage.ts @@ -28,13 +28,11 @@ export interface SaveViewInput { /** * Helper to access the views namespace on the client. - * - * **Note (v2.0.0)**: The `client.views` API is documented in the v2.0.0 README - * and should be fully implemented, but TypeScript types are not yet exported - * in the .d.ts files. This workaround will be removed once the upstream SDK - * exports the proper type definitions. - * - * See: docs/SDK-V2-UPGRADE.md for details on the expected v2.0.0 API. + * + * As of v2.0.1, `client.views` is fully typed and available at runtime. + * However, this hook's data model (name/visibility/filters) does not yet + * match the SDK's typed view data schema (list/form view configs). + * A future refactor (Phase 4B.1) will align this hook with the SDK types. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function viewsApi(client: any) { From 952ecf9a4de4f9efefaa64362be405275cd6a542 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:29:15 +0000 Subject: [PATCH 4/4] docs: update roadmap and development plans for v2.0.1 - all SDK gaps resolved Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- docs/PROJECT-STATUS.md | 115 ++++++++------- docs/ROADMAP.md | 147 +++++++++---------- docs/SDK-GAP-ANALYSIS.md | 286 +++++++++++++++++++------------------ docs/SDK-V2-UPGRADE.md | 195 ++++++++----------------- docs/V2-UPGRADE-SUMMARY.md | 162 ++++++++++----------- 5 files changed, 416 insertions(+), 489 deletions(-) diff --git a/docs/PROJECT-STATUS.md b/docs/PROJECT-STATUS.md index 4d2d5b0..4baa930 100644 --- a/docs/PROJECT-STATUS.md +++ b/docs/PROJECT-STATUS.md @@ -2,13 +2,13 @@ > **Date**: 2026-02-09 > **Version**: 1.0.0 -> **Status**: Development Complete (Pending SDK APIs) +> **Status**: Development In Progress (SDK APIs Ready) --- ## Executive Summary -The ObjectStack Mobile client has successfully completed **all feasible development phases** based on available SDK APIs. The project is production-ready for features that don't require the currently missing SDK APIs. All 346 unit and integration tests pass successfully. +The ObjectStack Mobile client has successfully completed **all feasible development phases** based on available SDK APIs. With the v2.0.1 SDK upgrade, **all previously blocked phases (4B, 5B) are now unblocked** — all 13 API namespaces are fully implemented with TypeScript type exports. All 346 unit and integration tests pass successfully. ### Key Achievements @@ -25,13 +25,14 @@ The ObjectStack Mobile client has successfully completed **all feasible developm - Comprehensive test coverage (346 tests, 80%+ coverage) - CI/CD pipeline with EAS Build/Update -⚠️ **Blocked by Upstream SDK**: -- Views API (documented but not implemented in v2.0.0) -- Permissions system -- Workflow/approval system -- Real-time WebSocket updates -- Push notifications registration -- AI/NLQ integration +⚠️ **Ready for Development (SDK v2.0.1 已就绪)**: +- Views API 重构 (client.views.* 已完整类型化) +- Permissions system (client.permissions.*) +- Workflow/approval system (client.workflow.*) +- Real-time WebSocket updates (client.realtime.*) +- Push notifications registration (client.notifications.*) +- AI/NLQ integration (client.ai.*) +- Server-side i18n (client.i18n.*) ## Development Phase Status @@ -52,7 +53,7 @@ The ObjectStack Mobile client has successfully completed **all feasible developm | Component | Status | Files | |-----------|--------|-------| -| SDK Installation | ✅ Done | `@objectstack/client@2.0.0` | +| SDK Installation | ✅ Done | `@objectstack/client@2.0.1` | | Client Init | ✅ Done | `lib/objectstack.ts` | | Provider | ✅ Done | `ObjectStackProvider` in root layout | | Metadata Hooks | ✅ Done | `useObject()`, `useView()`, `useFields()` | @@ -110,19 +111,19 @@ The ObjectStack Mobile client has successfully completed **all feasible developm **Test Coverage**: 85% -### Phase 4B: ObjectOS Integration ⛔ BLOCKED +### Phase 4B: ObjectOS Integration ✅ SDK READY -**Status**: Waiting for upstream SDK implementation +**Status**: SDK v2.0.1 provides all required APIs — ready for development -| Feature | Blocker | SDK Gap | ETA | -|---------|---------|---------|-----| -| Views API Types | ❌ Not implemented | Gap 1 | Unknown | -| Permissions System | ❌ Not implemented | Gap 2 | 1-2 weeks | -| Workflows | ❌ Not implemented | Gap 3 | 1-2 weeks | -| Real-time Updates | ❌ Not implemented | Gap 4 | 2-3 weeks | -| Push Notifications | ❌ Not implemented | Gap 5 | 1 week | +| Feature | Status | SDK API | ETA | +|---------|--------|---------|-----| +| Views API Refactor | ⬜ Ready | ✅ `client.views.*` | 1 week | +| Permissions System | ⬜ Ready | ✅ `client.permissions.*` | 1-2 weeks | +| Workflows | ⬜ Ready | ✅ `client.workflow.*` | 1-2 weeks | +| Real-time Updates | ⬜ Ready | ✅ `client.realtime.*` | 2-3 weeks | +| Push Notifications | ⬜ Ready | ✅ `client.notifications.*` | 1 week | -**Work Required**: Cannot proceed until SDK APIs are available. +**Work Required**: Mobile-side implementation of hooks and UI components using the now-available SDK APIs. ### Phase 5A: Advanced Features ✅ COMPLETE @@ -138,17 +139,17 @@ The ObjectStack Mobile client has successfully completed **all feasible developm **Test Coverage**: 80%+ overall -### Phase 5B: Advanced Features (SDK) ⛔ BLOCKED +### Phase 5B: Advanced Features (SDK) ✅ SDK READY -**Status**: Waiting for upstream SDK implementation +**Status**: SDK v2.0.1 provides all required APIs — ready for development -| Feature | Blocker | SDK Gap | ETA | -|---------|---------|---------|-----| -| AI Agent Chat | ❌ Not implemented | Gap 6 | 2-3 weeks | -| NLQ to ObjectQL | ❌ Not implemented | Gap 6 | 2-3 weeks | -| Server i18n | ❌ Not implemented | Gap 9 | 1 week | +| Feature | Status | SDK API | ETA | +|---------|--------|---------|-----| +| AI Agent Chat | ⬜ Ready | ✅ `client.ai.*` | 2-3 weeks | +| NLQ to ObjectQL | ⬜ Ready | ✅ `client.ai.nlq()` | 2-3 weeks | +| Server i18n | ⬜ Ready | ✅ `client.i18n.*` | 1 week | -**Work Required**: Cannot proceed until SDK APIs are available. +**Work Required**: Mobile-side implementation of hooks and UI components using the now-available SDK APIs. ### Phase 6: Production Readiness ✅ MOSTLY COMPLETE @@ -178,7 +179,7 @@ The ObjectStack Mobile client has successfully completed **all feasible developm - **Styling**: NativeWind v4 (Tailwind CSS for React Native) ### State & Data -- **Client SDK**: `@objectstack/client@2.0.0`, `@objectstack/client-react@2.0.0` +- **Client SDK**: `@objectstack/client@2.0.1`, `@objectstack/client-react@2.0.1` - **State Management**: Zustand - **Server State**: TanStack Query v5 - **Offline Storage**: expo-sqlite (with sync queue) @@ -258,18 +259,18 @@ Coverage (as of 2026-02-09): ## Known Issues & Limitations -### 1. SDK API Gaps (Blocking) +### 1. Phase 4B/5B Implementation (Ready to Develop) -All Phase 4B and 5B features are blocked by missing SDK APIs: -- `client.views.*` - Documented but NOT implemented in v2.0.0 -- `client.permissions.*` - Not available -- `client.workflows.*` - Not available -- `client.realtime.*` - Not available -- `client.notifications.*` - Not available -- `client.ai.*` - Not available -- `client.i18n.*` - Not available +All SDK APIs are now available in v2.0.1. Phase 4B and 5B can begin immediately: +- `client.views.*` — Fully typed, needs hook refactoring +- `client.permissions.*` — Available, needs `usePermissions` hook +- `client.workflow.*` — Available, needs `useWorkflowState` hook +- `client.realtime.*` — Available, needs `useSubscription` hook +- `client.notifications.*` — Available, needs notification UI +- `client.ai.*` — Available, needs AI chat UI +- `client.i18n.*` — Available, needs server translation integration -**Workaround**: Mobile app uses metadata API and custom implementations where possible. +**Note**: `@objectstack/client-react` does not yet provide dedicated hooks for these namespaces. Mobile-side hooks will need to be built using `useClient()` + custom state management. ### 2. E2E Tests (Manual Run Required) @@ -378,9 +379,9 @@ eas update --branch production All development work that can be completed with current SDK is done. See ROADMAP.md for detailed breakdown. -### Blocked (Phases 4B, 5B) +### Ready to Develop (Phases 4B, 5B) -Cannot proceed until upstream SDK implements required APIs. Estimated timeline: 4-8 weeks pending SDK team. +SDK v2.0.1 provides all required APIs. Estimated timeline: 6-8 weeks. ### Remaining Work (Phase 6.3) @@ -407,17 +408,17 @@ Cannot proceed until upstream SDK implements required APIs. Estimated timeline: ### For Mobile Team -1. **Continue SDK-Independent Work**: +1. **Start Phase 4B Development**: + - Begin with Permissions hook (`usePermissions`) — most impact + - Implement Workflow state hooks and UI + - Build real-time subscription system + - Add push notification registration + +2. **Continue SDK-Independent Work**: - Enhance UI/UX based on user feedback - - Add more view renderers if needed - Expand test coverage to 90%+ - Performance optimization -2. **Prepare for SDK APIs**: - - Review planned APIs in SDK roadmap - - Design UI for permissions, workflows, etc. - - Prepare migration plan for view storage - 3. **Focus on Production Readiness**: - Execute E2E tests thoroughly - Profile on real devices @@ -425,15 +426,11 @@ Cannot proceed until upstream SDK implements required APIs. Estimated timeline: ### For SDK Team -1. **Priority APIs** (Most Impact): - - `client.views.*` - Currently using workaround - - `client.realtime.*` - Critical for collaborative features - - `client.permissions.*` - Needed for enterprise use - -2. **Documentation Sync**: - - Update README to reflect actual implementation status - - Remove references to unimplemented APIs - - Add "Coming Soon" tags for planned features +1. **React Hooks** (Quality of Life): + - `usePermissions()` — Most requested + - `useWorkflowState()` — Critical for Phase 4B.3 + - `useSubscription()` — Real-time updates + - `useSavedViews()` — Views management ## Support & Contact @@ -445,6 +442,6 @@ Cannot proceed until upstream SDK implements required APIs. Estimated timeline: --- **Last Updated**: 2026-02-09 -**Project Status**: ✅ Development Complete (SDK-blocked features pending) +**Project Status**: ✅ Development In Progress (SDK APIs Ready, Phase 4B/5B unblocked) **Test Status**: ✅ 346/346 passing -**Production Ready**: ⚠️ Yes (with limitations) +**Production Ready**: ⚠️ Yes (Phase 4B/5B features in development) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index ff92590..6bd5f38 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1,8 +1,8 @@ # ObjectStack Mobile — Development Roadmap -> **Version**: 2.2 · **Last Updated**: 2026-02-09 +> **Version**: 2.3 · **Last Updated**: 2026-02-09 > -> Comprehensive development plan for the ObjectStack Mobile client, restructured based on the [SDK Gap Analysis](./SDK-GAP-ANALYSIS.md) of `@objectstack/client@2.0.0`. +> Comprehensive development plan for the ObjectStack Mobile client, restructured based on the [SDK Gap Analysis](./SDK-GAP-ANALYSIS.md) of `@objectstack/client@2.0.1`. --- @@ -62,7 +62,7 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 | Area | Status | Details | |------|--------|---------| -| **SDK Install** | ✅ Done | `@objectstack/client@1.1.0` + `@objectstack/client-react@1.1.0` | +| **SDK Install** | ✅ Done | `@objectstack/client@2.0.1` + `@objectstack/client-react@2.0.1` | | **Client Init** | ✅ Done | `lib/objectstack.ts` with auth token injection | | **Provider** | ✅ Done | `ObjectStackProvider` wraps root layout | | **Metadata Layer** | ✅ Done | `useObject()`, `useView()`, `useFields()` integrated | @@ -103,7 +103,7 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 ## SDK API Availability Matrix -基于 `@objectstack/client@1.1.0` 实际 API 分析(详见 [SDK-GAP-ANALYSIS.md](./SDK-GAP-ANALYSIS.md)): +基于 `@objectstack/client@2.0.1` 实际 API 分析(详见 [SDK-GAP-ANALYSIS.md](./SDK-GAP-ANALYSIS.md)): ### ✅ 已有且可用的 SDK API @@ -117,18 +117,13 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 | `client.automation.*` | trigger | ✅ 已集成(ActionExecutor) | | `client.analytics.*` | query, meta, explain | ⬜ 待使用(Phase 5A 图表功能) | | `client.hub.*` | spaces.list, spaces.create, plugins.install | ⬜ 备用 | - -### ❌ SDK 缺失·阻塞 Mobile 开发的 API - -| 缺失 API | 阻塞的功能 | 上游预估工作量 | v2.0.0 状态 | 详见 | -|----------|-----------|-------------|------------|------| -| `client.views.*` | View Storage 完整实现 | 1–2 天 | ❌ 未实现 (仅文档) | [Gap 1](./SDK-GAP-ANALYSIS.md#gap-1--views-api-clientviews) | -| `client.permissions.*` | 权限系统 | 1–2 周 | ❌ 未实现 | [Gap 2](./SDK-GAP-ANALYSIS.md#gap-2--permission-system-api) | -| `client.workflows.*` | 工作流/审批 | 1–2 周 | ❌ 未实现 | [Gap 3](./SDK-GAP-ANALYSIS.md#gap-3--workflow--state-machine-api) | -| `client.realtime.*` | 实时 WebSocket | 2–3 周 | ❌ 未实现 | [Gap 4](./SDK-GAP-ANALYSIS.md#gap-4--real-time--websocket-api) | -| `client.notifications.*` | 推送通知 | 1 周 | ❌ 未实现 | [Gap 5](./SDK-GAP-ANALYSIS.md#gap-5--push-notification-registration-api) | -| `client.ai.*` | AI/NLQ 集成 | 2–3 周 | ❌ 未实现 | [Gap 6](./SDK-GAP-ANALYSIS.md#gap-6--ai--nlq-api) | -| `client.i18n.*` | 国际化翻译 | 1 周 | ❌ 未实现 | [Gap 9](./SDK-GAP-ANALYSIS.md#gap-9--i18n--localization-api) | +| `client.views.*` | list, get, create, update, delete | ✅ 可用 (v2.0.1 新增完整类型) | +| `client.permissions.*` | check, getObjectPermissions, getEffectivePermissions | ✅ 可用 (v2.0.1 新增) | +| `client.workflow.*` | getConfig, getState, transition, approve, reject | ✅ 可用 (v2.0.1 新增) | +| `client.realtime.*` | connect, disconnect, subscribe, unsubscribe, setPresence, getPresence | ✅ 可用 (v2.0.1 新增) | +| `client.notifications.*` | registerDevice, unregisterDevice, getPreferences, updatePreferences, list, markRead, markAllRead | ✅ 可用 (v2.0.1 新增) | +| `client.ai.*` | nlq, chat, suggest, insights | ✅ 可用 (v2.0.1 新增) | +| `client.i18n.*` | getLocales, getTranslations, getFieldLabels | ✅ 可用 (v2.0.1 新增) | ### ⚠️ SDK 已有但缺 React Hooks @@ -138,7 +133,13 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 | `useFileUpload` | `client.storage.upload()` ✅ | 待实现 | | `useAnalyticsQuery` | `client.analytics.query()` ✅ | 可通过 `useMetadata()` 包装 | | `usePackages` | `client.packages.list()` ✅ | 自建 `useAppDiscovery` | -| `useSavedViews` | `client.views.*` ⚠️ untyped | 自建 `useViewStorage` + `as any` | +| `useSavedViews` | `client.views.*` ✅ | 自建 `useViewStorage` (待重构对齐 SDK 类型) | +| `usePermissions` | `client.permissions.*` ✅ | 待实现 | +| `useWorkflowState` | `client.workflow.*` ✅ | 待实现 | +| `useSubscription` | `client.realtime.*` ✅ | 待实现 | +| `useNotifications` | `client.notifications.*` ✅ | 待实现 | +| `useNLQ` | `client.ai.*` ✅ | 待实现 | +| `useTranslations` | `client.i18n.*` ✅ | 待实现 | --- @@ -203,37 +204,33 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 --- -### Phase 4B — ObjectOS 系统集成(等待 SDK) +### Phase 4B — ObjectOS 系统集成(✅ SDK 已就绪) > **Goal**: 接入 ObjectOS 系统能力,包括权限、工作流和实时功能。 > -> **Duration**: 3–4 周(SDK API 就绪后) +> **Duration**: 3–4 周 > -> **SDK 依赖**: ⛔ 需要上游先完成以下 API 开发(详见 [SDK-GAP-ANALYSIS.md](./SDK-GAP-ANALYSIS.md)) +> **SDK 依赖**: ✅ v2.0.1 已提供全部所需 API,所有 13 个命名空间均已实现并导出 TypeScript 类型 > -> **v2.0.0 更新**: ❌ Gap 1 (client.views.*) **仍未实现** -> -> **重要发现 (2026-02-09)**: 经过运行时验证,v2.0.0 的 `client.views` API 命名空间**并未实际实现**。 -> 尽管 README 中有文档说明,但运行时 client 对象上不存在 views 属性。该功能似乎是计划中的未来版本特性。 +> **v2.0.1 更新**: ✅ 所有 Gap 已解决!全部 API 命名空间已实现,TypeScript 类型已导出。 ``` -❌ 所有阻塞项仍未解决: - • client.views.* → Gap 1 (预估 1-2 天) ❌ v2.0.0 未实现 - • client.permissions.* → Gap 2 (预估 1-2 周) - • client.workflows.* → Gap 3 (预估 1-2 周) - • client.realtime.* → Gap 4 (预估 2-3 周) - • client.notifications.* → Gap 5 (预估 1 周) +✅ 所有阻塞项已解决 (v2.0.1): + • client.views.* → Gap 1 ✅ 已解决 + • client.permissions.* → Gap 2 ✅ 已解决 + • client.workflow.* → Gap 3 ✅ 已解决 + • client.realtime.* → Gap 4 ✅ 已解决 + • client.notifications.* → Gap 5 ✅ 已解决 ``` -#### 4B.1 Views API 类型修复 ⛔ **仍然阻塞 (v2.0.0 未实现 Gap 1)** +#### 4B.1 Views API 重构 ✅ **解除阻塞 (v2.0.1)** -- [ ] 等待 SDK 实际实现 `client.views.*` API(当前 v2.0.0 仅有文档,无实现) -- [ ] 移除 `hooks/useViewStorage.ts` 中的 `(client as any).views` workaround -- [ ] 使用 SDK 正式的 typed `client.views.*` API -- [ ] 补全 SavedView 类型定义以匹配实际 API +- [x] SDK 已实现 `client.views.*` API 并导出 TypeScript 类型 +- [ ] 重构 `hooks/useViewStorage.ts` 对齐 SDK 正式类型(list/form view configs) +- [ ] 补全 SavedView 类型定义以匹配 v2.0.1 API - [ ] 更新相关测试用例 -#### 4B.2 权限系统(等待 Gap 2: `client.permissions.*`) +#### 4B.2 权限系统 ✅ **解除阻塞 (v2.0.1: `client.permissions.*`)** - [ ] 创建 `hooks/usePermissions.ts`,调用 `client.permissions.getObjectPermissions()` - [ ] 在列表视图中根据权限隐藏/禁用 create 按钮 @@ -241,22 +238,22 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 - [ ] 在详情视图中根据权限隐藏 edit/delete 操作 - [ ] 在 ActionBar 中过滤无权限的 actions -#### 4B.3 工作流 & 审批(等待 Gap 3: `client.workflows.*`) +#### 4B.3 工作流 & 审批 ✅ **解除阻塞 (v2.0.1: `client.workflow.*`)** -- [ ] 创建 `hooks/useWorkflowState.ts`,调用 `client.workflows.getState()` +- [ ] 创建 `hooks/useWorkflowState.ts`,调用 `client.workflow.getState()` - [ ] 在记录详情页显示当前工作流状态(state badge) -- [ ] 渲染可用的状态转换按钮(调用 `client.workflows.transition()`) -- [ ] 实现审批流 UI(approve/reject,调用 `client.workflows.approve()` / `reject()`) +- [ ] 渲染可用的状态转换按钮(调用 `client.workflow.transition()`) +- [ ] 实现审批流 UI(approve/reject,调用 `client.workflow.approve()` / `reject()`) - [ ] 展示工作流历史记录 -#### 4B.4 实时更新(等待 Gap 4: `client.realtime.*`) +#### 4B.4 实时更新 ✅ **解除阻塞 (v2.0.1: `client.realtime.*`)** - [ ] 创建 `hooks/useSubscription.ts`,建立 WebSocket 连接 - [ ] 订阅记录变更事件,实现列表实时刷新 - [ ] 实现协作指示器(谁正在查看/编辑同一记录) - [ ] 利用 WebSocket 实现实时通知推送 -#### 4B.5 推送通知(等待 Gap 5: `client.notifications.*`) +#### 4B.5 推送通知 ✅ **解除阻塞 (v2.0.1: `client.notifications.*`)** - [ ] 配置 `expo-notifications`,获取设备 push token - [ ] 调用 `client.notifications.registerDevice()` 注册 token 到服务端 @@ -313,22 +310,22 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 --- -### Phase 5B — 高级功能·等待 SDK +### Phase 5B — 高级功能·✅ SDK 已就绪 > **Goal**: 依赖上游 SDK 新 API 的高级功能。 > -> **Duration**: 3–4 周(SDK API 就绪后) +> **Duration**: 3–4 周 > -> **SDK 依赖**: ⛔ 需要上游先完成以下 API 开发 +> **SDK 依赖**: ✅ v2.0.1 已提供全部所需 API ``` -⛔ 阻塞项: - • client.ai.* → Gap 6 (预估 2-3 周) - • client.i18n.* → Gap 9 (预估 1 周) - • React hooks: useBatchMutation, useFileUpload, useAnalytics → Gap 7/8/10/11 +✅ 所有阻塞项已解决 (v2.0.1): + • client.ai.* → Gap 6 ✅ 已解决 + • client.i18n.* → Gap 9 ✅ 已解决 + • React hooks: 需自建(client-react 暂未提供) → Gap 7/8/10/11 ``` -#### 5B.1 AI Agent 集成(等待 Gap 6: `client.ai.*`) +#### 5B.1 AI Agent 集成 ✅ **解除阻塞 (v2.0.1: `client.ai.*`)** - [ ] 构建对话式 AI 界面(自然语言查询) - [ ] 调用 `client.ai.nlq()` 将自然语言转为 ObjectQL 查询 @@ -336,7 +333,7 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 - [ ] 调用 `client.ai.suggest()` 实现智能搜索建议 - [ ] 调用 `client.ai.insights()` 在仪表盘展示 AI 洞察 -#### 5B.2 服务端国际化(等待 Gap 9: `client.i18n.*`) +#### 5B.2 服务端国际化 ✅ **解除阻塞 (v2.0.1: `client.i18n.*`)** > 在 Phase 5A.1 客户端框架的基础上接入服务端翻译。 @@ -345,9 +342,9 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 - [ ] 调用 `client.i18n.getFieldLabels()` 获取字段标签翻译 - [ ] 实现翻译资源的离线缓存 -#### 5B.3 SDK React Hooks 升级(等待 Gap 7/8/10/11) +#### 5B.3 SDK React Hooks 升级(Gap 7/8/10/11 — client API 已有,待自建 hooks) -> 当上游 `@objectstack/client-react` 提供以下 hooks 后,替换本地 workaround。 +> `@objectstack/client-react@2.0.1` 暂未提供以下 hooks,可基于 `useClient()` 自建。 - [ ] 替换 `hooks/useBatchOperations.ts` → SDK `useBatchMutation()` - [ ] 替换手动 `client.storage.upload()` 调用 → SDK `useFileUpload()` @@ -425,6 +422,9 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 │ │ @objectstack/client │ │ │ │ client.meta.* client.data.* client.storage.* │ │ │ │ client.automation.* client.analytics.* │ │ +│ │ client.views.* client.permissions.* client.workflow.* │ │ +│ │ client.realtime.* client.notifications.* client.ai.* │ │ +│ │ client.i18n.* client.packages.* │ │ │ │ ┌───────────────────────────────────────────────────┐ │ │ │ │ │ Offline Layer (SQLite + Sync Queue) │ │ │ │ │ └───────────────────────────────────────────────────┘ │ │ @@ -538,38 +538,31 @@ Phase 0–3 已全部完成或大部分完成。以下为各阶段完成状态 ## Release Plan ``` -时间线(基于 SDK 依赖的双轨并行策略): +时间线(v2.0.1 SDK 全部就绪,阻塞已解除): - ┌─ Phase 4A (2-3w) ─┐ ┌─ Phase 5A (2-3w) ─┐ ┌ Phase 6 (2-3w) ┐ + ┌─ Phase 4A (✅) ──┐ ┌─ Phase 5A (✅) ──┐ ┌ Phase 6 (✅) ──┐ Mobile: ████████████████████ → █████████████████████ → █████████████████ -Upstream: ██████████████████████████ (Gap 1-5: ~6-9w) -SDK Dev: ├─ views ─┤ - ├────── permissions ──────┤ - ├────── workflows ────────┤ - ├──────── realtime ──────────────┤ - ├──── notifications ─────┤ - - ┌────────────── Phase 4B (3-4w) ──────────────┐ -Mobile: ██████████████████████████████ → (merge to v1.0) -(after SDK) - ┌──────── Phase 5B (3-4w) ────────┐ - ████████████████████████████████████ + ┌────── Phase 4B (3-4w) ──────┐ +Mobile: ██████████████████████████████ → (可立即开始) +(next) + ┌──── Phase 5B (3-4w) ────┐ + ████████████████████████████ ``` | Milestone | Content | Prerequisites | 预估时间 | |-----------|---------|---------------|---------| | **v0.4-alpha** ✅ | Phase 4A:渲染引擎补全 + 文件功能 + 图表 + 高级视图 + 安全 | 无(现有 SDK 即可) | ✅ 已完成 | | **v0.5-alpha** ✅ | Phase 5A:i18n 框架 + 性能优化 + 测试 + CI/CD | 无 | ✅ 已完成 | -| **v0.6-beta** | Phase 4B:权限 + 工作流 + 实时 + 推送通知 | ⛔ SDK Gap 1-5 完成 | 3–4 周 | -| **v0.7-beta** | Phase 5B:AI 集成 + 服务端 i18n + SDK hooks 升级 | ⛔ SDK Gap 6/9/7/8/10/11 | 3–4 周 | +| **v0.6-beta** | Phase 4B:权限 + 工作流 + 实时 + 推送通知 | ✅ SDK v2.0.1 已就绪 | 3–4 周 | +| **v0.7-beta** | Phase 5B:AI 集成 + 服务端 i18n + SDK hooks 自建 | ✅ SDK v2.0.1 已就绪 | 3–4 周 | | **v1.0-RC** ✅ | Phase 6:监控 + 分析 + 安全审计 + 性能基准 + 发布准备 | Phase 4A+5A 完成 | ✅ 大部分完成(待 E2E 全量通过) | ### 关键路径 - **Mobile 独立开发**(4A → 5A → 6):✅ **已基本完成**,仅余 E2E 全量通过 -- **等待 SDK 后开发**(4B + 5B):~6–8 周,在上游 SDK 就绪后启动 -- **总计到 v1.0 GA**:取决于 SDK 上游交付节奏(Mobile 独立可发 RC) +- **Phase 4B + 5B**:~6–8 周,✅ **SDK v2.0.1 已就绪,可立即启动开发** +- **总计到 v1.0 GA**:~6–8 周(Mobile 独立可发 RC) --- @@ -580,20 +573,22 @@ Mobile: █████████████████ | **ObjectQL — Objects** | `client.meta.getObject()` → form fields + list columns | ✅ Available | | **ObjectQL — Fields** | `FieldRenderer` with type-specific native components | ✅ Available | | **ObjectQL — Queries** | `client.data.find()` with filter AST, sort, pagination | ✅ Available | -| **ObjectQL — State Machine** | Workflow state badges + transition actions | ⛔ Needs `client.workflows.*` | +| **ObjectQL — State Machine** | Workflow state badges + transition actions | ✅ Available (v2.0.1: `client.workflow.*`) | | **ObjectUI — Views** | `ViewRenderer` — list, form, detail, dashboard, kanban, calendar | ✅ Available | | **ObjectUI — Layout DSL** | `FormViewRenderer` for sections, rows, columns, tabs | ✅ Available | | **ObjectUI — Actions** | `ActionExecutor` — navigate, create, update, delete, callFlow | ✅ Available | | **ObjectUI — Dashboards** | `DashboardViewRenderer` with widget grid | ✅ Available | | **ObjectOS — Auth** | better-auth token → `ObjectStackClient` | ✅ Available | -| **ObjectOS — Permissions** | UI-level enforcement via `usePermissions()` | ⛔ Needs `client.permissions.*` | -| **ObjectOS — Real-Time** | WebSocket subscription for live updates | ⛔ Needs `client.realtime.*` | -| **ObjectOS — i18n** | Labels + formatting localized per ObjectOS standard | ⛔ Needs `client.i18n.*` | +| **ObjectOS — Permissions** | UI-level enforcement via `usePermissions()` | ✅ Available (v2.0.1: `client.permissions.*`) | +| **ObjectOS — Real-Time** | WebSocket subscription for live updates | ✅ Available (v2.0.1: `client.realtime.*`) | +| **ObjectOS — i18n** | Labels + formatting localized per ObjectOS standard | ✅ Available (v2.0.1: `client.i18n.*`) | | **ObjectOS — Storage** | File upload/download via `client.storage.*` | ✅ Available | | **ObjectOS — Analytics** | Charts + dashboards via `client.analytics.*` | ✅ Available | | **ObjectOS — Automation** | Flow triggers via `client.automation.trigger()` | ✅ Available | +| **ObjectOS — Notifications** | Push notifications via `client.notifications.*` | ✅ Available (v2.0.1) | +| **ObjectOS — AI** | NLQ, chat, suggest, insights via `client.ai.*` | ✅ Available (v2.0.1) | | **ObjectOS — HTTP Protocol** | REST API via `@objectstack/client`, error code contract | ✅ Available | --- -*This document is a living plan. Last restructured on 2026-02-08 based on SDK Gap Analysis. See [SDK-GAP-ANALYSIS.md](./SDK-GAP-ANALYSIS.md) for detailed API requirements.* +*This document is a living plan. Last restructured on 2026-02-09 based on SDK v2.0.1 upgrade — all SDK gaps resolved. See [SDK-GAP-ANALYSIS.md](./SDK-GAP-ANALYSIS.md) for detailed API requirements.* diff --git a/docs/SDK-GAP-ANALYSIS.md b/docs/SDK-GAP-ANALYSIS.md index 09e1805..7a6087d 100644 --- a/docs/SDK-GAP-ANALYSIS.md +++ b/docs/SDK-GAP-ANALYSIS.md @@ -1,8 +1,8 @@ # @objectstack/client SDK — Gap Analysis Report -> **Version analyzed**: `@objectstack/client@2.0.0`, `@objectstack/client-react@2.0.0`, `@objectstack/spec@2.0.0` +> **Version analyzed**: `@objectstack/client@2.0.1`, `@objectstack/client-react@2.0.1`, `@objectstack/spec@2.0.1` > -> **Date**: 2026-02-09 (Updated after v2.0.0 upgrade) +> **Date**: 2026-02-09 (Updated after v2.0.1 upgrade) > > **Purpose**: 列出 Mobile 客户端完成全部开发所需但 SDK 目前尚未提供(或未完善)的 API 与功能,供上游项目排期开发。 @@ -30,40 +30,41 @@ ## Executive Summary -ObjectStack Mobile 客户端目前已完成 Phase 0–3(基础框架、SDK 集成、渲染引擎、数据层),以及大部分 Phase 4A, 5A, 6(独立功能)。**Phase 4B 和 5B 的开发仍被 SDK 缺失功能阻塞**。 +ObjectStack Mobile 客户端目前已完成 Phase 0–3(基础框架、SDK 集成、渲染引擎、数据层),以及大部分 Phase 4A, 5A, 6(独立功能)。**v2.0.1 升级后,所有 SDK Gap 已解决,Phase 4B 和 5B 可以立即启动开发。** -### v2.0.0 更新摘要 (2026-02-09) +### v2.0.1 更新摘要 (2026-02-09) -✅ **Gap 1 已解决**: `client.views.*` API 现已完全类型化并可用 -- 新增 `client.views.create()`, `get()`, `list()`, `update()`, `delete()`, `share()`, `setDefault()` -- 可移除 `hooks/useViewStorage.ts` 中的 `(client as any).views` workaround -- Phase 4B.1 现已解除阻塞 +✅ **所有 Gap 已解决**: SDK v2.0.1 完整实现了全部 13 个 API 命名空间,并导出了 TypeScript 类型定义。 -✅ **新增功能**: -- ETag 元数据缓存: `client.meta.getCached()` -- 增强的批量操作: `client.data.batch()` 支持更多选项 -- 类型安全查询构建器: `createQuery()`, `createFilter()` +**新增已解决 API**: +- `client.views.*` — 完整类型化的 Views API (create/get/list/update/delete) +- `client.permissions.*` — 权限检查 API (check/getObjectPermissions/getEffectivePermissions) +- `client.workflow.*` — 工作流 API (getConfig/getState/transition/approve/reject) +- `client.realtime.*` — 实时 WebSocket API (connect/disconnect/subscribe/unsubscribe/setPresence/getPresence) +- `client.notifications.*` — 推送通知 API (registerDevice/unregisterDevice/getPreferences/updatePreferences/list/markRead/markAllRead) +- `client.ai.*` — AI/NLQ API (nlq/chat/suggest/insights) +- `client.i18n.*` — 国际化 API (getLocales/getTranslations/getFieldLabels) -### 剩余关键 Gap +### 剩余改进项 | Category | Status | Impact | |----------|--------|--------| -| **Views API 类型缺失** | ✅ **已解决 (v2.0.0)** | Phase 4B.1 解除阻塞 | -| **Permission API** | ❌ 完全缺失 | Phase 4B.2 阻塞 | -| **Workflow/State Machine API** | ❌ 完全缺失 | Phase 4B.3 阻塞 | -| **Real-Time WebSocket API** | ❌ 完全缺失 | Phase 4B.4 阻塞 | -| **Push Notification API** | ❌ 完全缺失 | Phase 4B.5 阻塞 | -| **AI/NLQ API** | ❌ 完全缺失 | Phase 5B.1 阻塞 | +| **Views API** | ✅ **已解决 (v2.0.1)** | Phase 4B.1 完全解除阻塞 | +| **Permission API** | ✅ **已解决 (v2.0.1)** | Phase 4B.2 解除阻塞 | +| **Workflow/State Machine API** | ✅ **已解决 (v2.0.1)** | Phase 4B.3 解除阻塞 | +| **Real-Time WebSocket API** | ✅ **已解决 (v2.0.1)** | Phase 4B.4 解除阻塞 | +| **Push Notification API** | ✅ **已解决 (v2.0.1)** | Phase 4B.5 解除阻塞 | +| **AI/NLQ API** | ✅ **已解决 (v2.0.1)** | Phase 5B.1 解除阻塞 | | **Batch 优化** | ✅ **已改进 (v2.0.0)** | 性能可继续优化 | -| **Storage React Hooks** | ❌ 缺失 | Phase 5B.3 阻塞 | -| **i18n API** | ❌ 完全缺失 | Phase 5B.2 阻塞 | -| **Analytics React Hooks** | ❌ 缺失 | 可用 hooks wrapper 优化 | +| **Storage React Hooks** | ⚠️ client-react 缺失 | 可自建 hooks | +| **i18n API** | ✅ **已解决 (v2.0.1)** | Phase 5B.2 解除阻塞 | +| **Analytics React Hooks** | ⚠️ client-react 缺失 | 可用 hooks wrapper 优化 | --- ## Current SDK Coverage -### `@objectstack/client@2.0.0` — 已有 API +### `@objectstack/client@2.0.1` — 已有 API 以下 API 在 SDK 中有完整类型定义且 Mobile 端已成功集成: @@ -111,6 +112,34 @@ client.analytics.explain(payload) ✅ Analytics explain client.hub.spaces.list() ✅ List spaces client.hub.spaces.create(payload) ✅ Create space client.hub.plugins.install(pkg, ver?) ✅ Install hub plugin +client.permissions.check(params) ✅ Check permission (v2.0.1 新增) +client.permissions.getObjectPermissions(obj) ✅ Object permissions (v2.0.1 新增) +client.permissions.getEffectivePermissions() ✅ Effective permissions (v2.0.1 新增) +client.workflow.getConfig(obj) ✅ Workflow config (v2.0.1 新增) +client.workflow.getState(obj, recordId) ✅ Workflow state (v2.0.1 新增) +client.workflow.transition(params) ✅ Workflow transition (v2.0.1 新增) +client.workflow.approve(params) ✅ Workflow approve (v2.0.1 新增) +client.workflow.reject(params) ✅ Workflow reject (v2.0.1 新增) +client.realtime.connect(options?) ✅ Realtime connect (v2.0.1 新增) +client.realtime.disconnect() ✅ Realtime disconnect (v2.0.1 新增) +client.realtime.subscribe(params) ✅ Realtime subscribe (v2.0.1 新增) +client.realtime.unsubscribe(params) ✅ Realtime unsubscribe (v2.0.1 新增) +client.realtime.setPresence(params) ✅ Set presence (v2.0.1 新增) +client.realtime.getPresence(params) ✅ Get presence (v2.0.1 新增) +client.notifications.registerDevice(p) ✅ Register device (v2.0.1 新增) +client.notifications.unregisterDevice(id) ✅ Unregister device (v2.0.1 新增) +client.notifications.getPreferences() ✅ Get preferences (v2.0.1 新增) +client.notifications.updatePreferences(p) ✅ Update preferences (v2.0.1 新增) +client.notifications.list(options?) ✅ List notifications (v2.0.1 新增) +client.notifications.markRead(ids) ✅ Mark read (v2.0.1 新增) +client.notifications.markAllRead() ✅ Mark all read (v2.0.1 新增) +client.ai.nlq(params) ✅ Natural language query (v2.0.1 新增) +client.ai.chat(params) ✅ AI chat (v2.0.1 新增) +client.ai.suggest(params) ✅ AI suggestions (v2.0.1 新增) +client.ai.insights(params) ✅ AI insights (v2.0.1 新增) +client.i18n.getLocales() ✅ Get locales (v2.0.1 新增) +client.i18n.getTranslations(locale, opts?) ✅ Get translations (v2.0.1 新增) +client.i18n.getFieldLabels(obj, locale) ✅ Get field labels (v2.0.1 新增) ``` ### v2.0.0 新增工具 @@ -122,7 +151,7 @@ QueryBuilder ✅ 链式查询构建器类 FilterBuilder ✅ 链式过滤器构建器类 ``` -### `@objectstack/client-react@2.0.0` — 已有 Hooks +### `@objectstack/client-react@2.0.1` — 已有 Hooks ``` ObjectStackProvider ✅ Context provider @@ -141,15 +170,15 @@ useMetadata(fetcher, options?) ✅ Generic metadata hook ## Gap 1 — Views API (client.views) -### 状态:⚠️ **部分解决 (v2.0.0)** +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 Mobile 端的 `hooks/useViewStorage.ts` 需要通过 `client.views` 命名空间进行 Saved Views 的 CRUD 操作。在 v1.1.0 中,`ObjectStackClient` 类型定义中不包含 `views` 属性,当前通过 unsafe cast 绕过。 -### v2.0.0 解决方案(部分) +### v2.0.1 解决方案 -SDK v2.0.0 已实现 `client.views` API 的运行时功能,但 **TypeScript 类型定义尚未导出到 .d.ts 文件**。这是一个打包/导出问题,预计将在后续 patch 版本修复。 +SDK v2.0.1 已完全实现 `client.views` API,包括运行时功能和 TypeScript 类型定义导出。 ```typescript client.views: { @@ -197,24 +226,24 @@ client.views: { ### Mobile 端行动项 -- [x] SDK 已升级至 v2.0.0 -- [ ] **等待上游**: TypeScript 类型定义尚未在 .d.ts 文件中导出 -- [ ] 一旦类型导出后:更新 `hooks/useViewStorage.ts` 移除 workaround -- [ ] 一旦类型导出后:补全 SavedView 类型定义以匹配 v2.0.0 API +- [x] SDK 已升级至 v2.0.1 +- [x] TypeScript 类型定义已在 .d.ts 文件中导出 +- [ ] 重构 `hooks/useViewStorage.ts` 对齐 SDK 正式类型 +- [ ] 补全 SavedView 类型定义以匹配 v2.0.1 API ### 影响范围 - ✅ API 已实现(运行时可用) -- ⚠️ TypeScript 类型定义尚未导出(预计后续 patch 版本解决) -- ⏳ Phase 4B.1 部分解除阻塞(可使用运行时 API,但需等待类型定义) +- ✅ TypeScript 类型定义已导出 +- ✅ Phase 4B.1 完全解除阻塞 -### 优先级:⚠️ **部分解决 (v2.0.0)** - 等待类型导出完成 +### 优先级:✅ **已解决 (v2.0.1)** --- ## Gap 2 — Permission System API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -274,13 +303,13 @@ function usePermissions(objectName: string, options?: { }; ``` -### 优先级:🔴 Critical(Phase 4.1 阻塞,企业客户核心需求) +### 优先级:✅ **已解决 (v2.0.1)** — `client.permissions.check()`, `getObjectPermissions()`, `getEffectivePermissions()` --- ## Gap 3 — Workflow & State Machine API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -357,13 +386,13 @@ function useWorkflowState(objectName: string, recordId: string, options?: { }; ``` -### 优先级:🔴 Critical(Phase 4.2 阻塞,业务流程自动化核心) +### 优先级:✅ **已解决 (v2.0.1)** — `client.workflow.getConfig()`, `getState()`, `transition()`, `approve()`, `reject()` --- ## Gap 4 — Real-Time / WebSocket API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -449,13 +478,13 @@ function usePresence(channel: string, options?: { }; ``` -### 优先级:🔴 Critical(Phase 4.3 阻塞,协作和实时更新核心) +### 优先级:✅ **已解决 (v2.0.1)** — `client.realtime.connect()`, `subscribe()`, `unsubscribe()`, `setPresence()`, `getPresence()` --- ## Gap 5 — Push Notification Registration API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -532,13 +561,13 @@ function useNotifications(options?: { }; ``` -### 优先级:🟡 High(Phase 4.4,移动端核心体验) +### 优先级:✅ **已解决 (v2.0.1)** — `client.notifications.registerDevice()`, `list()`, `markRead()`, etc. --- ## Gap 6 — AI / NLQ API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -633,7 +662,7 @@ function useAIChat(options?: { }; ``` -### 优先级:🟡 High(Phase 5.1,差异化竞争力) +### 优先级:✅ **已解决 (v2.0.1)** — `client.ai.nlq()`, `chat()`, `suggest()`, `insights()` --- @@ -724,7 +753,7 @@ client.storage.upload(file, { ## Gap 9 — i18n / Localization API -### 状态:❌ 完全缺失 +### 状态:✅ **已解决 (v2.0.1)** ### 问题描述 @@ -776,7 +805,7 @@ function useTranslations(locale: string, options?: { }; ``` -### 优先级:🟡 High(Phase 5.2,国际化市场准入需求) +### 优先级:✅ **已解决 (v2.0.1)** — `client.i18n.getLocales()`, `getTranslations()`, `getFieldLabels()` --- @@ -862,49 +891,39 @@ function useSavedViews(objectName: string, options?: { ## Priority Summary -### ✅ v2.0.0 已解决 +### ✅ v2.0.1 已解决 | # | Gap | 涉及 Phase | 状态 | |---|-----|-----------|------| | 1 | Views API 类型化 | Phase 4B.1 | ✅ 完全解决 | +| 2 | Permission System API | Phase 4B.2 | ✅ 完全解决 | +| 3 | Workflow / State Machine API | Phase 4B.3 | ✅ 完全解决 | +| 4 | Real-Time / WebSocket API | Phase 4B.4 | ✅ 完全解决 | +| 5 | Push Notification API | Phase 4B.5 | ✅ 完全解决 | +| 6 | AI / NLQ API | Phase 5B.1 | ✅ 完全解决 | +| 9 | i18n API | Phase 5B.2 | ✅ 完全解决 | -### 🔴 Critical — Phase 4B 阻塞,必须优先开发 +### 🟢 Medium — 有 workaround 或已改进,可后续优化 -| # | Gap | 涉及 Phase | Spec 类型就绪 | 预估工作量 | -|---|-----|-----------|-------------|----------| -| 2 | Permission System API | Phase 4B.2 | ✅ 完整 | 1-2 周 | -| 3 | Workflow / State Machine API | Phase 4B.3 | ✅ 完整 | 1-2 周 | -| 4 | Real-Time / WebSocket API | Phase 4B.4 | ✅ 完整 | 2-3 周 | - -### 🟡 High — Phase 4B-5B 需要,应在 Critical 之后排期 - -| # | Gap | 涉及 Phase | Spec 类型就绪 | 预估工作量 | -|---|-----|-----------|-------------|----------| -| 5 | Push Notification API | Phase 4B.5 | ✅ 部分 | 1 周 | -| 6 | AI / NLQ API | Phase 5B.1 | ✅ 完整 | 2-3 周 | -| 8 | File/Storage React Hooks | Phase 5B.3 | ✅ Client 已有 | 2-3 天 | -| 9 | i18n API | Phase 5B.2 | ✅ 部分 | 1 周 | - -### 🟢 Medium — 有 workaround 或已改进 (v2.0.0),可后续优化 - -| # | Gap | 涉及 Phase | Spec 类型就绪 | v2.0.0 状态 | +| # | Gap | 涉及 Phase | Spec 类型就绪 | v2.0.1 状态 | |---|-----|-----------|-------------|------------| | 7 | Batch React Hook | Phase 3.3 | ✅ Client 已有 | ✅ 已改进 | +| 8 | File/Storage React Hooks | Phase 5B.3 | ✅ Client 已有 | 可自建 hooks | | 10 | Analytics React Hooks | Phase 5.3/6 | ✅ Client 已有 | 可用 hooks wrapper | -| 11 | 其他 React Hook 补全 | 多个 | ✅ | 可继续优化 | +| 11 | 其他 React Hook 补全 | 多个 | ✅ | 可自建 hooks | -### 总预估 (更新后) +### 总预估 (v2.0.1 更新后) -- **Critical items**: ~5-7 周 (减少 1-2 周,Gap 1 已解决) -- **High items**: ~5-6 周 -- **Medium items**: ~1 周 (v2.0.0 batch 改进,减少 1 周) -- **总计**: ~11-14 周(可并行开发缩短周期,相比 v1.1.0 减少 2-3 周) +- **Phase 4B (权限+工作流+实时+通知)**: ~3-4 周(Mobile 端实现) +- **Phase 5B (AI+i18n+hooks)**: ~3-4 周(Mobile 端实现) +- **总计**: ~6-8 周(无上游阻塞) +- **总计**: ~6-8 周(无上游阻塞,可并行开发缩短周期) --- ## Appendix: SDK API Surface Inventory -### `@objectstack/client@1.1.0` 完整类型树 +### `@objectstack/client@2.0.1` 完整类型树 ``` ObjectStackClient @@ -952,54 +971,49 @@ ObjectStackClient │ ├── spaces.list() ✅ Available │ ├── spaces.create(payload) ✅ Available │ └── plugins.install(pkg, ver?) ✅ Available -│ -│ ────── MISSING NAMESPACES ────── -│ -├── views ❌ Not typed -│ ├── list(objectName, filters?) -│ ├── get(objectName, viewId) -│ ├── create(objectName, data) -│ ├── update(objectName, viewId, data) -│ └── delete(objectName, viewId) -├── permissions ❌ Missing -│ ├── check(params) -│ ├── getObjectPermissions(objectName) -│ └── getEffective() -├── workflows ❌ Missing -│ ├── getConfig(objectName) -│ ├── getState(objectName, recordId) -│ ├── transition(objectName, recordId, params) -│ ├── approve(objectName, recordId, params) -│ └── reject(objectName, recordId, params) -├── realtime ❌ Missing -│ ├── connect(options?) -│ ├── disconnect() -│ ├── subscribe(channel, options?) -│ ├── unsubscribe(subscriptionId) -│ ├── setPresence(channel, state) -│ ├── getPresence(channel) -│ ├── on(event, handler) -│ └── off(event, handler) -├── notifications ❌ Missing -│ ├── registerDevice(params) -│ ├── unregisterDevice(deviceId) -│ ├── getPreferences() -│ ├── updatePreferences(prefs) -│ ├── list(options?) -│ ├── markRead(ids) -│ └── markAllRead() -├── ai ❌ Missing -│ ├── nlq(params) -│ ├── chat(params) -│ ├── suggest(params) -│ └── insights(params) -└── i18n ❌ Missing - ├── getLocales() - ├── getTranslations(locale, options?) - └── getFieldLabels(objectName, locale) +├── views ✅ Available (v2.0.1) +│ ├── list(object, type?) ✅ Typed +│ ├── get(object, viewId) ✅ Typed +│ ├── create(object, data) ✅ Typed +│ ├── update(object, viewId, data) ✅ Typed +│ └── delete(object, viewId) ✅ Typed +├── permissions ✅ Available (v2.0.1) +│ ├── check(params) ✅ Typed +│ ├── getObjectPermissions(objectName) ✅ Typed +│ └── getEffectivePermissions() ✅ Typed +├── workflow ✅ Available (v2.0.1) +│ ├── getConfig(objectName) ✅ Typed +│ ├── getState(objectName, recordId) ✅ Typed +│ ├── transition(params) ✅ Typed +│ ├── approve(params) ✅ Typed +│ └── reject(params) ✅ Typed +├── realtime ✅ Available (v2.0.1) +│ ├── connect(options?) ✅ Typed +│ ├── disconnect() ✅ Typed +│ ├── subscribe(params) ✅ Typed +│ ├── unsubscribe(params) ✅ Typed +│ ├── setPresence(params) ✅ Typed +│ └── getPresence(params) ✅ Typed +├── notifications ✅ Available (v2.0.1) +│ ├── registerDevice(params) ✅ Typed +│ ├── unregisterDevice(deviceId) ✅ Typed +│ ├── getPreferences() ✅ Typed +│ ├── updatePreferences(prefs) ✅ Typed +│ ├── list(options?) ✅ Typed +│ ├── markRead(ids) ✅ Typed +│ └── markAllRead() ✅ Typed +├── ai ✅ Available (v2.0.1) +│ ├── nlq(params) ✅ Typed +│ ├── chat(params) ✅ Typed +│ ├── suggest(params) ✅ Typed +│ └── insights(params) ✅ Typed +└── i18n ✅ Available (v2.0.1) + ├── getLocales() ✅ Typed + ├── getTranslations(locale, options?) ✅ Typed + └── getFieldLabels(objectName, locale) ✅ Typed ``` -### `@objectstack/client-react@1.1.0` 完整导出 +### `@objectstack/client-react@2.0.1` 完整导出 ``` Providers @@ -1017,25 +1031,25 @@ Hooks ├── useFields(objectName, options?) ✅ Available ├── useMetadata(fetcher, options?) ✅ Available │ -│ ────── MISSING HOOKS ────── +│ ────── MISSING HOOKS (可基于 useClient() 自建) ────── │ -├── usePermissions(objectName, options?) ❌ Missing -├── useWorkflowState(objectName, recordId) ❌ Missing -├── useSubscription(channel, options?) ❌ Missing -├── usePresence(channel, options?) ❌ Missing -├── useNotifications(options?) ❌ Missing -├── useNLQ(options?) ❌ Missing -├── useAIChat(options?) ❌ Missing -├── useSavedViews(objectName, options?) ❌ Missing -├── usePackages(filters?) ❌ Missing -├── useBatchMutation(object, options?) ❌ Missing -├── useFileUpload(options?) ❌ Missing -├── useFileDownload(fileId, options?) ❌ Missing -├── useAnalyticsQuery(payload, options?) ❌ Missing -├── useAnalyticsMeta(cube, options?) ❌ Missing -└── useTranslations(locale, options?) ❌ Missing +├── usePermissions(objectName, options?) ❌ Missing (client API ✅) +├── useWorkflowState(objectName, recordId) ❌ Missing (client API ✅) +├── useSubscription(channel, options?) ❌ Missing (client API ✅) +├── usePresence(channel, options?) ❌ Missing (client API ✅) +├── useNotifications(options?) ❌ Missing (client API ✅) +├── useNLQ(options?) ❌ Missing (client API ✅) +├── useAIChat(options?) ❌ Missing (client API ✅) +├── useSavedViews(objectName, options?) ❌ Missing (client API ✅) +├── usePackages(filters?) ❌ Missing (client API ✅) +├── useBatchMutation(object, options?) ❌ Missing (client API ✅) +├── useFileUpload(options?) ❌ Missing (client API ✅) +├── useFileDownload(fileId, options?) ❌ Missing (client API ✅) +├── useAnalyticsQuery(payload, options?) ❌ Missing (client API ✅) +├── useAnalyticsMeta(cube, options?) ❌ Missing (client API ✅) +└── useTranslations(locale, options?) ❌ Missing (client API ✅) ``` --- -*This report is based on the SDK versions installed in the ObjectStack Mobile project as of 2026-02-08. Please update this document when new SDK versions are released.* +*This report is based on the SDK versions installed in the ObjectStack Mobile project as of 2026-02-09. All client API gaps have been resolved in v2.0.1. Remaining work is Mobile-side hook implementation.* diff --git a/docs/SDK-V2-UPGRADE.md b/docs/SDK-V2-UPGRADE.md index 18ddbd8..db1b345 100644 --- a/docs/SDK-V2-UPGRADE.md +++ b/docs/SDK-V2-UPGRADE.md @@ -1,85 +1,38 @@ -# @objectstack/client v2.0.0 Upgrade Guide +# @objectstack/client v2.0.1 Upgrade Guide > **Date**: 2026-02-09 -> **Previous Version**: v1.1.0 -> **Current Version**: v2.0.0 +> **Previous Version**: v2.0.0 +> **Current Version**: v2.0.1 --- ## Overview -The mobile application has been successfully upgraded to `@objectstack/client@2.0.0` and `@objectstack/client-react@2.0.0`. This upgrade is **fully backward compatible** with no breaking API changes. All 346 existing tests pass without modification. +The mobile application has been successfully upgraded to `@objectstack/client@2.0.1` and `@objectstack/client-react@2.0.1`. This upgrade is **fully backward compatible** with no breaking API changes. All 346 existing tests pass without modification. -## What's New in v2.0.0 +## What's New in v2.0.1 -### ❌ Gap 1 Status: Views API NOT YET IMPLEMENTED +### ✅ ALL SDK Gaps Resolved -**UPDATE (2026-02-09)**: After runtime verification, the `client.views.*` API namespace is **NOT implemented** in v2.0.0. While the README documentation describes the intended API, the actual runtime does not expose a `views` property on the client object. +**v2.0.1** completes the implementation of all 13 API namespaces with full TypeScript type exports. This resolves **all previously blocked development phases (4B, 5B)**. -**Current Status:** -- ❌ `client.views` namespace does not exist at runtime -- ❌ No TypeScript type definitions for views API -- ⚠️ README documentation is aspirational/planned for future release -- ✅ Mobile app continues using `hooks/useViewStorage.ts` workaround via metadata API +**Newly Available APIs:** -**Planned API (NOT YET AVAILABLE):** +| Namespace | Methods | Phase Unblocked | +|-----------|---------|-----------------| +| `client.views.*` | list, get, create, update, delete | Phase 4B.1 | +| `client.permissions.*` | check, getObjectPermissions, getEffectivePermissions | Phase 4B.2 | +| `client.workflow.*` | getConfig, getState, transition, approve, reject | Phase 4B.3 | +| `client.realtime.*` | connect, disconnect, subscribe, unsubscribe, setPresence, getPresence | Phase 4B.4 | +| `client.notifications.*` | registerDevice, unregisterDevice, getPreferences, updatePreferences, list, markRead, markAllRead | Phase 4B.5 | +| `client.ai.*` | nlq, chat, suggest, insights | Phase 5B.1 | +| `client.i18n.*` | getLocales, getTranslations, getFieldLabels | Phase 5B.2 | -The following API is documented in the README but NOT functional in v2.0.0: - -```typescript -// ⚠️ THESE DO NOT WORK IN v2.0.0 - FOR REFERENCE ONLY - -// Create a saved view -const view = await client.views.create({ - name: 'active_tasks', - label: 'Active Tasks', - object: 'todo_task', - type: 'list', - visibility: 'public', - query: { - object: 'todo_task', - where: { status: 'active' }, - orderBy: [{ field: 'priority', order: 'desc' }], - limit: 50 - }, - layout: { - columns: [ - { field: 'subject', label: 'Task', width: 200 }, - { field: 'priority', label: 'Priority', width: 100 } - ] - } -}); - -// Get a saved view -const view = await client.views.get('view-id'); - -// List saved views -const { views, total } = await client.views.list({ - object: 'todo_task', - visibility: 'public' -}); - -// Update a saved view -await client.views.update({ - id: 'view-id', - name: 'Updated Name', - visibility: 'private' -}); - -// Delete a saved view -await client.views.delete('view-id'); - -// Share a view with users -await client.views.share('view-id', ['user-1', 'user-2']); - -// Set as default view for an object -await client.views.setDefault('view-id', 'todo_task'); -``` - -**Impact on Mobile Development:** -- Phase 4B.1 remains **blocked** until SDK implements `client.views.*` -- Continue using current workaround in `hooks/useViewStorage.ts` -- No migration work can be done at this time +**Previously Available (v2.0.0):** +- Enhanced batch operations with `atomic`, `returnRecords`, `continueOnError`, `validateOnly` options +- ETag-based metadata caching via `client.meta.getCached()` +- Type-safe query builders: `createQuery()`, `createFilter()` +- Improved error handling with retry guidance ### 🚀 Enhanced Batch Operations @@ -167,73 +120,45 @@ try { ## Migration Checklist -### Status Update (2026-02-09) - -**Important**: While the Views API is documented in the v2.0.0 README and appears to be functionally available at runtime, the TypeScript type definitions have not yet been exported in the package's `.d.ts` files. This means we cannot yet remove the `(client as any).views` workaround without TypeScript compilation errors. +### Completed -**Next Steps**: We are tracking this with the upstream @objectstack/client team and expect the type definitions to be exported in an upcoming patch release (e.g., v2.0.1). +- [x] **Upgrade to v2.0.1** — packages installed and tested +- [x] **All 346 tests pass** — backward compatible +- [x] **TypeScript types available** — all namespaces properly typed -### High Priority (Blocked by Type Exports) +### High Priority (Phase 4B Implementation) -- [ ] **Wait for type exports in upstream @objectstack/client** - - Currently: API is runtime-available but types not exported - - Expected: Future patch release (v2.0.1+) -- [ ] **Update `hooks/useViewStorage.ts`** once types are available - - Remove `viewsApi(client: any)` helper function - - Use properly typed `client.views.*` API - - Update SavedView types to match v2.0.0 schema -- [ ] **Add tests for new Views API** to ensure proper integration -- [ ] **Document new query builder** usage patterns for the team +- [ ] **Refactor `hooks/useViewStorage.ts`** to align with SDK view data types +- [ ] **Create `hooks/usePermissions.ts`** using `client.permissions.*` +- [ ] **Create `hooks/useWorkflowState.ts`** using `client.workflow.*` +- [ ] **Create `hooks/useSubscription.ts`** using `client.realtime.*` +- [ ] **Create notification hooks** using `client.notifications.*` -### Medium Priority +### Medium Priority (Phase 5B Implementation) +- [ ] **Create AI chat UI** using `client.ai.*` +- [ ] **Integrate server i18n** using `client.i18n.*` - [ ] **Consider using `createQuery()` and `createFilter()`** in `lib/query-builder.ts` - - Provides better type safety - - Improves developer experience with auto-completion -- [ ] **Leverage ETag caching** in `lib/metadata-cache.ts` - - Reduce unnecessary API calls - - Improve offline experience -- [ ] **Update batch operations** to use new `batch()` options - - Set `atomic: true` for critical operations - - Use `validateOnly: true` for validation before commit - -### Low Priority - -- [ ] **Explore new error handling** for better user feedback -- [ ] **Update documentation** with v2.0.0 examples -- [ ] **Store memory** about new v2.0.0 features for future reference ## Impact on Development Roadmap -### Phase 4B.1 — Partially Unblocked ⚠️ - -With the Views API now runtime-available in v2.0.0, **Phase 4B.1 can partially proceed**: - -**Current State**: -1. ✅ Runtime API is functional and can be used -2. ⚠️ TypeScript types not yet exported (awaiting v2.0.1+) -3. ⏳ Can proceed with runtime implementation using type casts -4. ⏳ Full type safety pending upstream type export - -**Once Types Exported**: -1. Remove `(client as any).views` workaround -2. Use proper TypeScript types -3. Improve code quality and maintainability -4. Fully complete Phase 4B.1 +### All Phases Unblocked ✅ -### Remaining Blocked Phases +With v2.0.1, **all previously blocked phases are now unblocked**: -Phase 4B still has blocking dependencies: -- **4B.2**: Permissions API (Gap 2) -- **4B.3**: Workflows API (Gap 3) -- **4B.4**: Real-time API (Gap 4) -- **4B.5**: Notifications API (Gap 5) +- **Phase 4B.1**: Views API — ✅ Fully typed and available +- **Phase 4B.2**: Permissions — ✅ `client.permissions.*` available +- **Phase 4B.3**: Workflows — ✅ `client.workflow.*` available +- **Phase 4B.4**: Real-time — ✅ `client.realtime.*` available +- **Phase 4B.5**: Notifications — ✅ `client.notifications.*` available +- **Phase 5B.1**: AI/NLQ — ✅ `client.ai.*` available +- **Phase 5B.2**: Server i18n — ✅ `client.i18n.*` available ### Timeline Impact -The v2.0.0 upgrade reduces the overall timeline by **2-3 weeks**: -- **Before**: ~13-17 weeks to complete all gaps -- **After**: ~11-14 weeks (Gap 1 resolved, batch operations improved) +The v2.0.1 upgrade **eliminates all upstream SDK dependencies**: +- **Before (v2.0.0)**: ~11-14 weeks remaining (blocked by SDK) +- **After (v2.0.1)**: ~6-8 weeks remaining (no blockers, Mobile-side implementation only) ## Testing Status @@ -245,29 +170,25 @@ The v2.0.0 upgrade reduces the overall timeline by **2-3 weeks**: ## Next Steps 1. **Immediate (This Week)**: - - Update `useViewStorage.ts` to use typed Views API - - Update related tests - - Document migration for team + - Begin Phase 4B.2 — Permissions hook implementation + - Refactor `useViewStorage.ts` to align with SDK types -2. **Short Term (Next 2 Weeks)**: - - Explore query builder in new features - - Implement ETag caching optimizations - - Update batch operations to use new options +2. **Short Term (Next 2-4 Weeks)**: + - Complete Phase 4B (Permissions, Workflows, Real-time, Notifications) + - Begin Phase 5B (AI, Server i18n) -3. **Long Term**: - - Monitor upstream SDK for remaining gaps (2-5) - - Plan Phase 4B.2-4B.5 implementation once APIs available - - Continue Phase 6 production readiness tasks +3. **Medium Term (Next 4-8 Weeks)**: + - Complete Phase 5B + - Full E2E testing + - App Store submission preparation ## References -- [Client v2.0.0 README](../node_modules/.pnpm/@objectstack+client@2.0.0/node_modules/@objectstack/client/README.md) -- [Client v2.0.0 CHANGELOG](../node_modules/.pnpm/@objectstack+client@2.0.0/node_modules/@objectstack/client/CHANGELOG.md) - [SDK Gap Analysis](./SDK-GAP-ANALYSIS.md) - [Development Roadmap](./ROADMAP.md) --- -**Document Version**: 1.0 +**Document Version**: 2.0 **Last Updated**: 2026-02-09 -**Status**: ✅ Upgrade Complete, Migration In Progress +**Status**: ✅ Upgrade Complete — All SDK Gaps Resolved diff --git a/docs/V2-UPGRADE-SUMMARY.md b/docs/V2-UPGRADE-SUMMARY.md index 96640fc..2baf97f 100644 --- a/docs/V2-UPGRADE-SUMMARY.md +++ b/docs/V2-UPGRADE-SUMMARY.md @@ -1,4 +1,4 @@ -# v2.0.0 升级评估总结 +# v2.0.1 升级评估总结 > **Date**: 2026-02-09 > **Task**: 重新评估并重新安排下一步开发计划和 roadmap @@ -8,40 +8,47 @@ ## 执行摘要 -ObjectStack Mobile 已成功升级至 `@objectstack/client@2.0.0` 和 `@objectstack/client-react@2.0.0`。本次升级完全向后兼容,所有 346 个测试用例通过,未引入破坏性变更。 +ObjectStack Mobile 已成功升级至 `@objectstack/client@2.0.1` 和 `@objectstack/client-react@2.0.1`。本次升级完全向后兼容,所有 346 个测试用例通过,未引入破坏性变更。 ### 主要发现 -1. **Gap 1 部分解决**: Views API (`client.views.*`) 在运行时可用,但 TypeScript 类型定义尚未导出 -2. **新增功能**: 增强的批量操作、ETag 缓存、类型安全查询构建器 -3. **时间线优化**: 总体开发时间减少 2-3 周(从 13-17 周降至 11-14 周) -4. **阻塞状态**: Phase 4B.2-4B.5 仍需等待上游 SDK 开发 +1. **所有 Gap 已解决**: v2.0.1 完整实现了全部 13 个 API 命名空间,并导出 TypeScript 类型定义 +2. **Phase 4B/5B 解除阻塞**: 权限、工作流、实时更新、推送通知、AI/NLQ、国际化 API 全部可用 +3. **时间线大幅缩短**: 从 11-14 周降至 6-8 周(无上游阻塞) +4. **保留功能**: v2.0.0 的增强批量操作、ETag 缓存、类型安全查询构建器继续可用 --- -## v2.0.0 新增功能 +## v2.0.1 新增功能 -### 1. Views API (Gap 1) +### 1. 全部 API 命名空间已实现 -**状态**: ✅ 运行时可用 | ⚠️ 类型定义未导出 +**状态**: ✅ 全部可用,TypeScript 类型已导出 ```typescript -// 功能已实现,但需等待类型定义导出 -client.views.create(request) // ✅ 可用 -client.views.get(id) // ✅ 可用 -client.views.list(request?) // ✅ 可用 -client.views.update(request) // ✅ 可用 -client.views.delete(id) // ✅ 可用 -client.views.share(id, userIds) // ✅ 可用 -client.views.setDefault(id, obj) // ✅ 可用 +// 以下 API 全部已实现并可用 (v2.0.1) +client.views.list(object) // ✅ Views CRUD +client.views.create(object, data) // ✅ +client.permissions.check(params) // ✅ 权限检查 +client.permissions.getObjectPermissions() // ✅ +client.workflow.getConfig(object) // ✅ 工作流 +client.workflow.transition(params) // ✅ +client.realtime.connect() // ✅ 实时 WebSocket +client.realtime.subscribe(params) // ✅ +client.notifications.registerDevice(p) // ✅ 推送通知 +client.notifications.list() // ✅ +client.ai.nlq(params) // ✅ AI/NLQ +client.ai.chat(params) // ✅ +client.i18n.getLocales() // ✅ 国际化 +client.i18n.getTranslations(locale) // ✅ ``` **影响**: -- Phase 4B.1 部分解除阻塞 -- 可使用运行时 API,但仍需 `(client as any)` workaround -- 等待上游 v2.0.1+ 导出类型定义 +- Phase 4B 全部解除阻塞 +- Phase 5B 全部解除阻塞 +- 无需等待上游 SDK 开发 -### 2. 增强的批量操作 +### 2. 增强的批量操作 (v2.0.0+) **状态**: ✅ 完全可用 @@ -62,7 +69,7 @@ client.data.batch(object, { - 改进批量操作性能和控制 - 可优化 `hooks/useBatchOperations.ts` -### 3. ETag 元数据缓存 +### 3. ETag 元数据缓存 (v2.0.0+) **状态**: ✅ 完全可用 @@ -82,7 +89,7 @@ if (result.notModified) { - 减少不必要的 API 调用 - 可优化 `lib/metadata-cache.ts` -### 4. 类型安全查询构建器 +### 4. 类型安全查询构建器 (v2.0.0+) **状态**: ✅ 完全可用 @@ -144,18 +151,17 @@ const query = createQuery('todo_task') - 图表和高级视图 - 安全增强 -### Phase 4B ⏳ 部分可开发 +### Phase 4B ✅ SDK 已就绪,可立即开发 -#### 4B.1 Views API ✅ 可开发 -- **状态**: 运行时 API 可用 -- **等待**: TypeScript 类型定义导出 -- **行动**: 可使用运行时 API,等待类型后移除 workaround +#### 4B.1 Views API ✅ 完全可用 +- **状态**: API 和 TypeScript 类型均已导出 +- **行动**: 重构 `useViewStorage.ts` 对齐 SDK 类型 -#### 4B.2-4B.5 ⛔ 仍被阻塞 -- **4B.2**: 权限系统 (Gap 2) - 预估 1-2 周 -- **4B.3**: 工作流 (Gap 3) - 预估 1-2 周 -- **4B.4**: 实时更新 (Gap 4) - 预估 2-3 周 -- **4B.5**: 推送通知 (Gap 5) - 预估 1 周 +#### 4B.2-4B.5 ✅ 全部解除阻塞 +- **4B.2**: 权限系统 — `client.permissions.*` ✅ +- **4B.3**: 工作流 — `client.workflow.*` ✅ +- **4B.4**: 实时更新 — `client.realtime.*` ✅ +- **4B.5**: 推送通知 — `client.notifications.*` ✅ ### Phase 5A ✅ 完成 - 国际化框架 @@ -163,10 +169,10 @@ const query = createQuery('todo_task') - 测试基础设施 - CI/CD Pipeline -### Phase 5B ⛔ 等待 SDK -- **5B.1**: AI Agent 集成 (Gap 6) - 预估 2-3 周 -- **5B.2**: 服务端国际化 (Gap 9) - 预估 1 周 -- **5B.3**: SDK React Hooks 升级 (Gap 7/8/10/11) - 预估 2-3 天 +### Phase 5B ✅ SDK 已就绪,可立即开发 +- **5B.1**: AI Agent 集成 — `client.ai.*` ✅ +- **5B.2**: 服务端国际化 — `client.i18n.*` ✅ +- **5B.3**: SDK React Hooks — 需自建(client-react 暂未提供) ### Phase 6 ✅ 大部分完成 - 监控和错误追踪 ✅ @@ -177,19 +183,19 @@ const query = createQuery('todo_task') ## 时间线影响 -### 更新前(基于 v1.1.0) -- Critical items: ~6-9 周 -- High items: ~5-6 周 -- Medium items: ~2 周 -- **总计**: ~13-17 周 - -### 更新后(基于 v2.0.0) -- Critical items: ~5-7 周(Gap 1 部分解决,减少 1-2 周) -- High items: ~5-6 周 -- Medium items: ~1 周(批量操作改进,减少 1 周) +### 更新前(基于 v2.0.0) +- Phase 4B: ~3-4 周(被 SDK 阻塞) +- Phase 5B: ~3-4 周(被 SDK 阻塞) +- 上游 SDK 开发: ~6-9 周 - **总计**: ~11-14 周 -**节省**: 2-3 周开发时间 +### 更新后(基于 v2.0.1) +- Phase 4B: ~3-4 周(✅ 可立即开始) +- Phase 5B: ~3-4 周(✅ 可立即开始) +- 上游 SDK 开发: 无需等待 +- **总计**: ~6-8 周(可并行开发缩短周期) + +**节省**: 5-6 周开发时间(消除所有上游阻塞) --- @@ -200,28 +206,23 @@ const query = createQuery('todo_task') 1. ✅ 完成文档更新 2. ✅ 验证所有测试通过 3. ✅ 存储关键上下文到 memory -4. ⏳ 通知团队 v2.0.0 升级状态 - -### 短期(未来 2 周) - -1. 探索新查询构建器在新功能中的应用 -2. 实施 ETag 缓存优化元数据获取 -3. 更新批量操作使用新选项 -4. 监控上游 @objectstack/client 版本更新 +4. ⬜ 开始 Phase 4B.2 权限系统开发 -### 中期(未来 1-2 月) +### 短期(未来 2-4 周) -1. 等待 v2.0.1+ 导出 Views API 类型定义 -2. 更新 `useViewStorage.ts` 移除 workaround -3. 跟踪上游 SDK Gap 2-5 开发进度 -4. 准备 Phase 4B.2-4B.5 实现 +1. 实现 `hooks/usePermissions.ts` +2. 实现 `hooks/useWorkflowState.ts` +3. 重构 `hooks/useViewStorage.ts` 对齐 SDK 类型 +4. 构建推送通知注册流程 -### 长期(未来 3-6 月) +### 中期(未来 4-8 周) -1. 实现剩余 Phase 4B 功能(一旦 SDK 就绪) -2. 实现 Phase 5B 功能 -3. 完成 Phase 6 最终优化 -4. 准备 v1.0 生产发布 +1. 实现实时 WebSocket 订阅 +2. 构建 AI/NLQ 聊天界面 +3. 集成服务端国际化翻译 +4. 完成 Phase 4B 和 5B 全部功能 +5. 完成 E2E 测试 +6. 准备 v1.0 生产发布 --- @@ -240,24 +241,24 @@ const query = createQuery('todo_task') ### 技术团队 -1. **v2.0.0 已升级**: 所有依赖已更新,测试通过 -2. **Views API 可用**: 运行时功能齐全,类型定义等待上游导出 -3. **新功能探索**: 鼓励在新代码中使用查询构建器和 ETag 缓存 -4. **workaround 保留**: `useViewStorage.ts` 的类型转换仍需保留 +1. **v2.0.1 已升级**: 所有依赖已更新,测试通过 +2. **所有 API 可用**: 全部 13 个命名空间已实现并导出 TypeScript 类型 +3. **Phase 4B/5B 可开始**: 权限、工作流、实时、通知、AI、i18n 全部可用 +4. **React Hooks 需自建**: client-react 暂未提供新命名空间的 hooks ### 产品/项目管理 -1. **时间线优化**: 总体开发时间减少 2-3 周 -2. **部分解除阻塞**: Phase 4B.1 可部分进行 -3. **主要阻塞项**: Phase 4B.2-4B.5 和 5B 仍等待上游 -4. **预计交付**: 取决于上游 SDK 开发进度 +1. **时间线大幅缩短**: 从 11-14 周降至 6-8 周 +2. **全部解除阻塞**: Phase 4B 和 5B 可以立即启动 +3. **优先级**: 建议先开发权限系统(企业客户核心需求) +4. **预计交付**: 6-8 周内可完成所有功能 ### 利益相关方 1. **向后兼容**: 无破坏性变更,平滑升级 -2. **功能增强**: 新增批量操作、缓存优化等性能改进 -3. **开发加速**: 整体时间线缩短 15-20% -4. **依赖管理**: 部分功能仍依赖上游开发 +2. **功能大幅扩展**: 新增权限、工作流、实时、通知、AI 等核心功能支持 +3. **开发加速**: 整体时间线缩短 40-50% +4. **无外部依赖**: 所有开发工作现在完全由 Mobile 团队控制 --- @@ -265,12 +266,11 @@ const query = createQuery('todo_task') - [SDK Gap Analysis](./SDK-GAP-ANALYSIS.md) - Gap 状态和优先级 - [Development Roadmap](./ROADMAP.md) - 开发路线图 -- [SDK v2.0.0 Upgrade Guide](./SDK-V2-UPGRADE.md) - 详细升级指南 -- [Client v2.0.0 README](../node_modules/@objectstack/client/README.md) - API 文档 +- [SDK v2.0.1 Upgrade Guide](./SDK-V2-UPGRADE.md) - 详细升级指南 --- -**Document Version**: 1.0 +**Document Version**: 2.0 **Author**: GitHub Copilot Agent **Date**: 2026-02-09 -**Status**: ✅ 评估完成 +**Status**: ✅ 评估完成 — 所有 SDK Gap 已解决