Skip to content

feat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18n - #547

Merged
hotlong merged 3 commits into
mainfrom
copilot/improve-api-specifications
Feb 8, 2026
Merged

feat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18n#547
hotlong merged 3 commits into
mainfrom
copilot/improve-api-specifications

Conversation

CopilotAI commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

The @objectstack/client SDK surface audit identified 7 missing namespaces with no corresponding protocol definitions in protocol.zod.ts. This adds the 33 missing Request/Response schema pairs, protocol methods, type exports, and legacy interface bindings.

New protocol namespaces

  • Views (5 ops) — listViews, getView, createView, updateView, deleteView
  • Permissions (3 ops) — checkPermission, getObjectPermissions, getEffectivePermissions
  • Workflows (5 ops) — getWorkflowConfig, getWorkflowState, workflowTransition, workflowApprove, workflowReject with WorkflowStateSchema for state machine representation
  • Realtime (6 ops) — realtimeConnect, realtimeDisconnect, realtimeSubscribe, realtimeUnsubscribe, setPresence, getPresence
  • Notifications (7 ops) — device registration, preference management, listing with cursor pagination, mark read/all read
  • AI (4 ops) — aiNlq, aiChat, aiSuggest, aiInsights
  • i18n (3 ops) — getLocales, getTranslations, getFieldLabels

Design decisions

  • Imports existing domain schemas where available (ObjectPermissionSchema, WorkflowRuleSchema, RealtimePresenceSchema, TranslationDataSchema, ViewSchema) rather than duplicating definitions
  • WorkflowStateSchema is new — models current state, available transitions, and transition history for the approval engine
  • NotificationPreferencesSchema supports per-channel overrides with digest frequency
  • All schemas follow existing conventions: .describe() on every field, z.input<> for request types, z.infer<> for response types

Example usage

importtype{CheckPermissionRequest,WorkflowTransitionRequest,AiNlqRequest,}from'@objectstack/spec/api';// Permission checkconstreq: CheckPermissionRequest={object: 'account',action: 'edit',recordId: 'acc_123',};// Workflow transitionconsttransition: WorkflowTransitionRequest={object: 'deal',recordId: 'd_001',transition: 'submit_for_approval',comment: 'Ready for review',};

ObjectStackProtocolSchema grows from 28 → 61 methods. Tests added for all 7 namespaces (3081 total, all passing).


✨ 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

vercelBot commented Feb 8, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
objectstack-studioErrorErrorFeb 8, 2026 7:47am
specReadyReadyPreview, CommentFeb 8, 2026 7:47am

Request Review

…rkflows, realtime, notifications, AI, and i18n
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ows, Realtime, Notifications, AI, i18n)
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI changed the title [WIP] Update API protocols and functionality for SDKfeat(api): add missing client protocol operations for views, permissions, workflows, realtime, notifications, AI, i18nFeb 8, 2026
CopilotAI requested a review from hotlongFebruary 8, 2026 07:48
@hotlong
hotlong marked this pull request as ready for review February 8, 2026 08:13
CopilotAI review requested due to automatic review settings February 8, 2026 08:13
@hotlong
hotlong merged commit 3e41aa7 into mainFeb 8, 2026
6 of 7 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the missing client-facing protocol namespaces to @objectstack/spec so the SDK can rely on first-class Request/Response schemas (and generated JSON Schemas) for Views, Permissions, Workflows, Realtime, Notifications, AI, and i18n.

Changes:

  • Added new Request/Response Zod schemas + type exports + legacy interface bindings for 7 previously-missing namespaces.
  • Extended ObjectStackProtocolSchema with 33 new protocol methods corresponding to those operations.
  • Regenerated/updated JSON Schema outputs (QA schema descriptions + new API operation schemas; removed obsolete integration JSON schemas).

Reviewed changes

Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
packages/spec/src/api/protocol.zod.tsAdds new Zod request/response schemas, protocol methods, and exported TS types for the missing namespaces.
packages/spec/src/api/protocol.test.tsAdds validation tests for a subset of the new protocol schemas.
packages/spec/json-schema/qa/TestSuite.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestStep.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestScenario.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAssertionType.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAssertion.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestActionType.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/qa/TestAction.jsonAdds missing description fields in generated QA JSON schema.
packages/spec/json-schema/integration/FieldTransform.jsonRemoves obsolete generated integration JSON schema.
packages/spec/json-schema/integration/Authentication.jsonRemoves obsolete generated integration JSON schema.
packages/spec/json-schema/api/WorkflowTransitionResponse.jsonNew generated JSON schema for WorkflowTransitionResponse.
packages/spec/json-schema/api/WorkflowTransitionRequest.jsonNew generated JSON schema for WorkflowTransitionRequest.
packages/spec/json-schema/api/WorkflowState.jsonNew generated JSON schema for WorkflowState.
packages/spec/json-schema/api/WorkflowRejectResponse.jsonNew generated JSON schema for WorkflowRejectResponse.
packages/spec/json-schema/api/WorkflowRejectRequest.jsonNew generated JSON schema for WorkflowRejectRequest.
packages/spec/json-schema/api/WorkflowApproveResponse.jsonNew generated JSON schema for WorkflowApproveResponse.
packages/spec/json-schema/api/WorkflowApproveRequest.jsonNew generated JSON schema for WorkflowApproveRequest.
packages/spec/json-schema/api/UpdateNotificationPreferencesResponse.jsonNew generated JSON schema for UpdateNotificationPreferencesResponse.
packages/spec/json-schema/api/UpdateNotificationPreferencesRequest.jsonNew generated JSON schema for UpdateNotificationPreferencesRequest.
packages/spec/json-schema/api/UnregisterDeviceResponse.jsonNew generated JSON schema for UnregisterDeviceResponse.
packages/spec/json-schema/api/UnregisterDeviceRequest.jsonNew generated JSON schema for UnregisterDeviceRequest.
packages/spec/json-schema/api/SetPresenceResponse.jsonNew generated JSON schema for SetPresenceResponse.
packages/spec/json-schema/api/SetPresenceRequest.jsonNew generated JSON schema for SetPresenceRequest.
packages/spec/json-schema/api/RegisterDeviceResponse.jsonNew generated JSON schema for RegisterDeviceResponse.
packages/spec/json-schema/api/RegisterDeviceRequest.jsonNew generated JSON schema for RegisterDeviceRequest.
packages/spec/json-schema/api/RealtimeUnsubscribeResponse.jsonNew generated JSON schema for RealtimeUnsubscribeResponse.
packages/spec/json-schema/api/RealtimeUnsubscribeRequest.jsonNew generated JSON schema for RealtimeUnsubscribeRequest.
packages/spec/json-schema/api/RealtimeSubscribeResponse.jsonNew generated JSON schema for RealtimeSubscribeResponse.
packages/spec/json-schema/api/RealtimeSubscribeRequest.jsonNew generated JSON schema for RealtimeSubscribeRequest.
packages/spec/json-schema/api/RealtimeDisconnectResponse.jsonNew generated JSON schema for RealtimeDisconnectResponse.
packages/spec/json-schema/api/RealtimeDisconnectRequest.jsonNew generated JSON schema for RealtimeDisconnectRequest.
packages/spec/json-schema/api/RealtimeConnectResponse.jsonNew generated JSON schema for RealtimeConnectResponse.
packages/spec/json-schema/api/RealtimeConnectRequest.jsonNew generated JSON schema for RealtimeConnectRequest.
packages/spec/json-schema/api/NotificationPreferences.jsonNew generated JSON schema for NotificationPreferences.
packages/spec/json-schema/api/Notification.jsonNew generated JSON schema for Notification.
packages/spec/json-schema/api/MarkNotificationsReadResponse.jsonNew generated JSON schema for MarkNotificationsReadResponse.
packages/spec/json-schema/api/MarkNotificationsReadRequest.jsonNew generated JSON schema for MarkNotificationsReadRequest.
packages/spec/json-schema/api/MarkAllNotificationsReadResponse.jsonNew generated JSON schema for MarkAllNotificationsReadResponse.
packages/spec/json-schema/api/MarkAllNotificationsReadRequest.jsonNew generated JSON schema for MarkAllNotificationsReadRequest.
packages/spec/json-schema/api/ListViewsRequest.jsonNew generated JSON schema for ListViewsRequest.
packages/spec/json-schema/api/ListNotificationsResponse.jsonNew generated JSON schema for ListNotificationsResponse.
packages/spec/json-schema/api/ListNotificationsRequest.jsonNew generated JSON schema for ListNotificationsRequest.
packages/spec/json-schema/api/GetWorkflowStateResponse.jsonNew generated JSON schema for GetWorkflowStateResponse.
packages/spec/json-schema/api/GetWorkflowStateRequest.jsonNew generated JSON schema for GetWorkflowStateRequest.
packages/spec/json-schema/api/GetWorkflowConfigResponse.jsonNew generated JSON schema for GetWorkflowConfigResponse.
packages/spec/json-schema/api/GetWorkflowConfigRequest.jsonNew generated JSON schema for GetWorkflowConfigRequest.
packages/spec/json-schema/api/GetViewResponse.jsonNew generated JSON schema for GetViewResponse.
packages/spec/json-schema/api/GetViewRequest.jsonNew generated JSON schema for GetViewRequest.
packages/spec/json-schema/api/GetTranslationsResponse.jsonNew generated JSON schema for GetTranslationsResponse.
packages/spec/json-schema/api/GetTranslationsRequest.jsonNew generated JSON schema for GetTranslationsRequest.
packages/spec/json-schema/api/GetPresenceResponse.jsonNew generated JSON schema for GetPresenceResponse.
packages/spec/json-schema/api/GetPresenceRequest.jsonNew generated JSON schema for GetPresenceRequest.
packages/spec/json-schema/api/GetObjectPermissionsResponse.jsonNew generated JSON schema for GetObjectPermissionsResponse.
packages/spec/json-schema/api/GetObjectPermissionsRequest.jsonNew generated JSON schema for GetObjectPermissionsRequest.
packages/spec/json-schema/api/GetNotificationPreferencesResponse.jsonNew generated JSON schema for GetNotificationPreferencesResponse.
packages/spec/json-schema/api/GetNotificationPreferencesRequest.jsonNew generated JSON schema for GetNotificationPreferencesRequest.
packages/spec/json-schema/api/GetLocalesResponse.jsonNew generated JSON schema for GetLocalesResponse.
packages/spec/json-schema/api/GetLocalesRequest.jsonNew generated JSON schema for GetLocalesRequest.
packages/spec/json-schema/api/GetFieldLabelsResponse.jsonNew generated JSON schema for GetFieldLabelsResponse.
packages/spec/json-schema/api/GetFieldLabelsRequest.jsonNew generated JSON schema for GetFieldLabelsRequest.
packages/spec/json-schema/api/GetEffectivePermissionsResponse.jsonNew generated JSON schema for GetEffectivePermissionsResponse.
packages/spec/json-schema/api/GetEffectivePermissionsRequest.jsonNew generated JSON schema for GetEffectivePermissionsRequest.
packages/spec/json-schema/api/DeleteViewResponse.jsonNew generated JSON schema for DeleteViewResponse.
packages/spec/json-schema/api/DeleteViewRequest.jsonNew generated JSON schema for DeleteViewRequest.
packages/spec/json-schema/api/CreateViewRequest.jsonNew generated JSON schema for CreateViewRequest.
packages/spec/json-schema/api/CheckPermissionResponse.jsonNew generated JSON schema for CheckPermissionResponse.
packages/spec/json-schema/api/CheckPermissionRequest.jsonNew generated JSON schema for CheckPermissionRequest.
packages/spec/json-schema/api/AiSuggestResponse.jsonNew generated JSON schema for AiSuggestResponse.
packages/spec/json-schema/api/AiSuggestRequest.jsonNew generated JSON schema for AiSuggestRequest.
packages/spec/json-schema/api/AiNlqResponse.jsonNew generated JSON schema for AiNlqResponse.
packages/spec/json-schema/api/AiNlqRequest.jsonNew generated JSON schema for AiNlqRequest.
packages/spec/json-schema/api/AiInsightsResponse.jsonNew generated JSON schema for AiInsightsResponse.
packages/spec/json-schema/api/AiInsightsRequest.jsonNew generated JSON schema for AiInsightsRequest.
packages/spec/json-schema/api/AiChatResponse.jsonNew generated JSON schema for AiChatResponse.
packages/spec/json-schema/api/AiChatRequest.jsonNew generated JSON schema for AiChatRequest.

Comment on lines +971 to +975
// View Management Operations
listViews: z.function()
.describe('List views for an object'),
getView: z.function()
.describe('Get a specific view'),

CopilotAIFeb 8, 2026

Copy link

Choose a reason for hiding this comment

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

ObjectStackProtocolSchema declares new protocol methods as z.function() with only .describe(). Without .args(...) and .returns(...), the contract doesn’t actually bind these operations to the Request/Response schemas (and inferred types degrade to unknown), which undermines the stated goal of SDK/protocol generation. Define each new method with its corresponding request schema and promise-wrapped response schema (and ideally retrofit the existing methods in this object similarly for consistency). Reference pattern: packages/spec/src/data/data-engine.zod.ts (e.g. DataEngineContractSchema.find).

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +188
it('validates Views operations', () => {
expect(ListViewsRequestSchema.safeParse({ object: 'project', type: 'list' }).success).toBe(true);
expect(ListViewsResponseSchema.safeParse({
object: 'project',
views: [{ list: { columns: [] } }],
}).success).toBe(true);
expect(GetViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true);
expect(CreateViewRequestSchema.safeParse({
object: 'project',
data: { list: { columns: [] } },
}).success).toBe(true);
expect(UpdateViewRequestSchema.safeParse({
object: 'project',
viewId: 'v1',
data: { list: { columns: [] } },
}).success).toBe(true);
expect(DeleteViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true);
expect(DeleteViewResponseSchema.safeParse({ object: 'project', viewId: 'v1', success: true }).success).toBe(true);
});

CopilotAIFeb 8, 2026

Copy link

Choose a reason for hiding this comment

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

The new protocol surface adds many Request/Response schemas, but protocol.test.ts only validates a subset. Several newly introduced schemas appear to have no test coverage anywhere in packages/spec/src (e.g. RealtimeDisconnectRequestSchema, MarkAllNotificationsReadRequestSchema, GetViewResponseSchema, UpdateViewResponseSchema). Add safeParse tests for the remaining new operations/schemas so regressions in schema shape/defaults are caught.

Copilot uses AI. Check for mistakes.
Sign up for freeto 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

@hotlong