client SDK: add approvals namespace; remove dead workflow surface (ADR-0019)#1516
Merged
Conversation
…ADR-0019) ADR-0019 collapsed approval into Flow — approval is a first-class flow node, not a workflow step. The server exposes a dedicated `/api/v1/approvals` surface, but the client SDK still carried the old approval-on-`workflow` methods pointing at routes that never existed. - `@objectstack/client`: add a `client.approvals` namespace backed by the real REST surface — `listRequests` (the "my approvals" inbox), `getRequest`, `approve` / `reject` (record a decision, resume the owning flow), and `listActions` (audit trail). Re-export the approval runtime types. - Remove the dead workflow approve/reject surface: `client.workflow.approve` / `reject`, the `WorkflowApprove*` / `WorkflowReject*` protocol schemas, types, `IProtocolService` methods, and the `/approve` / `/reject` entries in `DEFAULT_WORKFLOW_ROUTES`. `workflow` is reclaimed for state machines, so `getConfig` / `getState` / `transition` are unchanged. - Discovery advertises the new `approvals` route key.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ADR-0019 collapsed approval into Flow: approval is no longer a workflow step but a first-class flow node that opens a request and suspends the run, with a human decision resuming the flow down the matching
approve/rejectedge. The server already exposes this as a dedicated/api/v1/approvalssurface (registerApprovalsEndpoints), but the client SDK still carried the old approval-on-workflowmethods — which pointed at/api/v1/workflow/.../approveroutes that never existed server-side.This PR brings the client SDK in line with ADR-0019.
Add:
client.approvalsnamespaceBacked by the real REST surface under
/api/v1/approvals:approvals.listRequests(filter?)GET /requests— the "my approvals" inbox (filter bystatus(single or array),object,recordId,approverId,submitterId)approvals.getRequest(id)GET /requests/:idapprovals.approve(id, { actorId?, comment? })POST /requests/:id/approveapprovals.reject(id, { actorId?, comment? })POST /requests/:id/rejectapprovals.listActions(id)GET /requests/:id/actions— audit trailThe approval runtime types (
ApprovalRequestRow,ApprovalActionRow,ApprovalStatus,ApprovalDecisionInput,ApprovalDecisionResult) are re-exported from@objectstack/clientso consumers can type the namespace without reaching into@objectstack/spec.Remove: dead workflow approve/reject surface
ADR-0019 orphaned the approval-on-
workflowsurface. Removed end-to-end:client.workflow.approve/client.workflow.rejectWorkflowApprove{Request,Response}Schema/WorkflowReject{Request,Response}Schema+ inferred types (protocol.zod.ts)workflowApprove/workflowRejecton theIProtocolServiceinterface + the protocol function map/:object/:recordId/{approve,reject}entries inDEFAULT_WORKFLOW_ROUTESworkflowis reclaimed for state machines (ADR-0019 §Context, ADR-0020), sogetConfig/getState/transitionare intentionally left intact — theIWorkflowServicecontract is a state machine with no approve/reject.Discovery advertises the new route key:
ApiRoutesSchema.approvals.Test plan
@objectstack/specfull suite: 6608 passed (incl. updatedprotocol.test.ts,plugin-rest-api.test.ts).@objectstack/clientclient.test.ts: 79 passed, including a new "Approvals namespace (ADR-0019)" block covering list (with single + array status filters), get, approve, reject, and the audit trail.@objectstack/clientbuilds clean (DTS typecheck green).https://claude.ai/code/session_01TkMt3gAmWgYv9z1LQVYK1a
Generated by Claude Code