You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement all 10 Commands methods in url_builder.ts and add Commands method tests to url_builder.spec.ts. Commands is the ninth and final Phase 2 resource type, completing all 80 QueryBuilder methods. Commands are the control equivalent of Observations — instructions sent to systems for actuation via Control Streams, with lifecycle management (status tracking, result retrieval, cancellation).
Follow the Observations methods pattern from Issue #11 and Control Streams from Issue #12 (same file). Also reference the EDR pattern in src/ogc-api/edr/url_builder.ts (562 lines) for resource validation and URL construction. Commands mirrors Observations architecturally but for the control/actuation direction, and adds status tracking, result retrieval, and cancellation patterns.
Scope — What to Implement
10 Commands Methods
Each method validates resource availability (~2 lines), builds a URL using buildResourceUrl(), appends query parameters using buildQueryString(), and returns the constructed URL string.
Collection query:
getCommands(options?: CommandQueryOptions): string — GET /commands with temporal filtering (issueTime, executionTime), status filtering, cursor-based pagination, sorting
Single resource:
getCommand(id: string, options?): string — GET /commands/{id}
CRUD operations:
createCommand(controlStreamId: string, body: object): string — POST /controlstreams/{controlStreamId}/commands (single command)
createCommands(controlStreamId: string, body: object): string — POST /controlstreams/{controlStreamId}/commands (bulk commands)
updateCommand(id: string, body: object): string — PUT /commands/{id}
getCommandResult(id: string): string — GET /commands/{id}/result
Lifecycle operations:
cancelCommand(id: string): string — POST /commands/{id}/cancel
⚠️ Implementation note: The Guide contains two cancel patterns: POST /commands/{id}/cancel (Update Operations section) and DELETE /commands/{id} (Lifecycle Endpoints section). The ROADMAP specifies "POST cancel operation". Use POST /commands/{id}/cancel for the cancelCommand method. The deleteCommand method handles DELETE /commands/{id} for actual deletion. See Documentation problem below.
Task
Implement all 10 Commands methods in
url_builder.tsand add Commands method tests tourl_builder.spec.ts. Commands is the ninth and final Phase 2 resource type, completing all 80 QueryBuilder methods. Commands are the control equivalent of Observations — instructions sent to systems for actuation via Control Streams, with lifecycle management (status tracking, result retrieval, cancellation).ROADMAP Reference: Phase 2, Task 9 — Commands Methods (~1.5–2 hours implementation + ~0.5 hour testing, Medium-High complexity)
Files to Create or Modify
src/ogc-api/csapi/url_builder.tssrc/ogc-api/csapi/url_builder.spec.tsBlueprint Reference
Follow the Observations methods pattern from Issue #11 and Control Streams from Issue #12 (same file). Also reference the EDR pattern in
src/ogc-api/edr/url_builder.ts(562 lines) for resource validation and URL construction. Commands mirrors Observations architecturally but for the control/actuation direction, and adds status tracking, result retrieval, and cancellation patterns.Scope — What to Implement
10 Commands Methods
Each method validates resource availability (~2 lines), builds a URL using
buildResourceUrl(), appends query parameters usingbuildQueryString(), and returns the constructed URL string.Collection query:
getCommands(options?: CommandQueryOptions): string—GET /commandswith temporal filtering (issueTime,executionTime), status filtering, cursor-based pagination, sortingSingle resource:
getCommand(id: string, options?): string—GET /commands/{id}CRUD operations:
createCommand(controlStreamId: string, body: object): string—POST /controlstreams/{controlStreamId}/commands(single command)createCommands(controlStreamId: string, body: object): string—POST /controlstreams/{controlStreamId}/commands(bulk commands)updateCommand(id: string, body: object): string—PUT /commands/{id}deleteCommand(id: string): string—DELETE /commands/{id}Status and result sub-resources:
getCommandStatus(id: string): string—GET /commands/{id}/statusupdateCommandStatus(id: string, body: object): string—PATCH /commands/{id}/status(system-generated status updates)getCommandResult(id: string): string—GET /commands/{id}/resultLifecycle operations:
cancelCommand(id: string): string—POST /commands/{id}/cancelCommands Query Parameters
Commands support:
issueTime,executionTime,status,controlstream,id,limit,offset,cursor,f,cmdFormat,sortBy,sortOrder.All parameters are serialised by the shared
buildQueryString()helper (Issue #3). Key features:issueTime— primary temporal filter (when command was issued), supports instants and intervalsexecutionTime— when command should be/was executedstatus— filter by command state (pending,accepted,executing,completed,failed,canceled), comma-separatedcontrolstream— filter commands by control streamcursorparameter for efficient streaming of command historiescmdFormat— command encoding formatNote: Commands do not support
bbox,datetime,phenomenonTime, orresultTime(see Guide §6 temporal applicability matrix).JSDoc Requirements
@paramfor all parameters,@returnsdescription, and usage example@seelinks to OGC CSAPI Part 2 specification sections for Commands endpointscreateCommandssrc/ogc-api/edr/url_builder.tsand the Observations methods from Issue Phase 2.7: Observations Methods #11Testing Requirements
src/ogc-api/csapi/url_builder.spec.ts(~40–50 lines)issueTime,executionTimeintervals)createCommandswith control stream ID)getCommandStatus,updateCommandStatus)getCommandResult)cancelCommandproduces correct URL)commandsis not inavailableResourcesthrows an errorsrc/ogc-api/edr/url_builder.spec.tsScope — What NOT to Touch
model.ts— type definitions belong to Issue Phase 1.1: Create Type System (csapi/model.ts) #1helpers.ts— helper utilities belong to Issue Phase 1.2: Create Helper Utilities (csapi/helpers.ts) #2buildResourceUrl(),buildQueryString(),extractAvailableResources(), oravailableResources— those belong to Issue Phase 1.3: Create Stub QueryBuilder (csapi/url_builder.ts) #3endpoint.ts,info.ts, orsrc/index.ts— integration belongs to Issue Phase 1.4: Integrate with OgcApiEndpoint #4Acceptance Criteria
url_builder.tscontains all 10 Commands methods listed abovebuildResourceUrl()andbuildQueryString()helperscreateCommandandcreateCommandscorrectly route to/controlstreams/{id}/commandscancelCommandroutes toPOST /commands/{id}/cancel@param,@returns,@seeurl_builder.spec.tscontains Commands tests covering temporal filtering, bulk creation, status, result, cancel, and resource validation (~40–50 lines)npm test)Dependencies
Blocked by: Issue #1 (Type System — provides
CommandQueryOptionsand resource types), Issue #2 (Helper Utilities — provides encoding helpers), Issue #3 (Stub QueryBuilder — provides constructor,buildResourceUrl,buildQueryString,availableResources), Issue #5 (Systems Methods — establishes the pattern), Issue #12 (Control Streams Methods — commands flow through control streams)Blocks: Phase 3 tasks (Issues #14–#30), Phase 4 tasks (Issues #31–#33)
Operational Constraints
Key constraints for this task:
References
Read these documents before starting implementation. They are ordered by priority.
Primary References (must read)
docs/planning/csapi-implementation-guide.mddocs/planning/csapi-implementation-guide.mddocs/planning/csapi-implementation-guide.mdsrc/ogc-api/edr/url_builder.tssrc/ogc-api/edr/url_builder.spec.tsdocs/planning/ROADMAP.mdUpstream Type/Import References (files this task imports from)
src/ogc-api/csapi/model.tsCommandQueryOptions,CSAPIResourceType(created by Issue #1)src/ogc-api/csapi/helpers.tsencodeDateTime,encodeArray(created by Issue #2)Research References (context, not required reading)
docs/research/requirements/csapi-part2-requirements.mddocs/research/requirements/csapi-query-parameters.mddocs/research/upstream/pr114-analysis.mdSpecification References (for
@seelinks and field accuracy)Convention Quick Reference
.jsextension for relative importsimport { X } from './file.js'import typefor interfaces/typesimport type { Y } from './model.js'export interface Z { ... }as constarrays for enum-like valuesexport const XTypes = [...] as constglobalThis.fetch = jest.fn()