Skip to content

Fix TypeScript build errors in ObjectQL API usage and chart types - #57

Merged
hotlong merged 2 commits into
mainfrom
copilot/update-action-step-details
Jan 31, 2026
Merged

hotlong merged 2 commits into
mainfrom
copilot/update-action-step-details

Conversation

Copilot AI commented Jan 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

CI build failed with TypeScript errors in support and UI packages. Root causes: incorrect ObjectQL API namespace usage (pre-migration patterns), invalid sort parameter format, missing null guards on optional hook context, and non-spec-compliant chart types.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • CI/CD update

Related Issues

CI Failure: https://github.com/objectstack-ai/hotcrm/actions/runs/21545139473/job/62085377886#step:7:1

Changes Made

ObjectQL API Namespace Corrections (10 occurrences)

// Before: Direct method access (deprecated)
await ctx.db.update('Case', id, data);
await ctx.db.create('SLAMilestone', data);

// After: Namespaced doc operations
await ctx.db.doc.update('Case', id, data);
await ctx.db.doc.create('SLAMilestone', data);

Sort Parameter Type Alignment (3 occurrences)

// Before: Tuple array format (type mismatch)
sort: [['Priority', 'asc']]

// After: Simple field name per ObjectQLFindOptions
sort: 'Priority'

Null Safety for Hook Context (2 occurrences)

// Before: Unsafe access to optional ctx.old
if (oldArticle.Status !== article.Status)

// After: Null guard
if (oldArticle && oldArticle.Status !== article.Status)

Chart Type Spec Compliance (2 occurrences)

// 'list' not in ChartTypeSchema enum - use 'table'
type: 'table'  // was: 'list'

Testing

  • Unit tests pass (npm test)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Manual testing completed
  • New tests added (if applicable)

Screenshots

N/A - Build fix only

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

All changes align with @objectstack/spec v0.7.2 protocol requirements. No behavioral changes - purely type safety and API compliance fixes.

Original prompt

引用: https://github.com/objectstack-ai/hotcrm/actions/runs/21545139473/job/62085377886#step:7:1


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Jan 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hotcrm Ready Ready Preview, Comment Jan 31, 2026 1:35pm

Request Review

- Fix ObjectQL method calls in case.hook.ts: use ctx.db.doc.update() instead of ctx.db.update()
- Fix ObjectQL method calls in case.hook.ts: use ctx.db.doc.create() instead of ctx.db.create()
- Fix ObjectQL method calls in knowledge.hook.ts: use ctx.db.doc.update() instead of ctx.db.update()
- Fix filter syntax in case.hook.ts: use 'Priority' instead of [['Priority', 'asc']] for sort parameter
- Fix nullable reference errors in knowledge.hook.ts: add null checks for oldArticle and oldCase
- Fix chart type in sales_intelligence.dashboard.ts: use 'table' instead of invalid 'list' type

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update details for action step in workflow Fix TypeScript build errors in ObjectQL API usage and chart types Jan 31, 2026
Copilot AI requested a review from hotlong January 31, 2026 13:35
@hotlong
hotlong marked this pull request as ready for review January 31, 2026 14:48
Copilot AI review requested due to automatic review settings January 31, 2026 14:49
@hotlong
hotlong merged commit cb5e3c5 into main Jan 31, 2026
10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes TypeScript build errors caused by incorrect ObjectQL API usage, invalid sort parameter formats, missing null guards, and non-compliant chart types. The changes align with @objectstack/spec v0.7.2 protocol requirements and are purely type safety and API compliance fixes with no behavioral changes.

Changes:

  • Updated ObjectQL API calls to use namespaced ctx.db.doc.* methods instead of deprecated direct methods
  • Converted sort parameters from tuple array format to simple field names per ObjectQLFindOptions schema
  • Added null safety guards for optional ctx.old context in hook handlers
  • Changed chart type from non-spec-compliant 'list' to 'table'

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/support/src/hooks/case.hook.ts Fixed ObjectQL API namespace (7 db.doc.update calls, 1 db.doc.create call) and converted 3 sort parameters from tuple arrays to simple strings
packages/support/src/hooks/knowledge.hook.ts Added null guards for ctx.old access and fixed 1 ObjectQL db.doc.update call
packages/ui/src/dashboard/sales_intelligence.dashboard.ts Changed 2 widget types from 'list' to 'table' for spec compliance

This branch was successfully deployed

1 active deployment
Preview — 4bdaf10c Deployed Jan 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants