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
Split from #145 — assertResourceAvailable() + buildResourceUrl() two-line pattern repeated 90 times in url_builder.ts — DRY violation.
This is Part 3 of 3. See also: #158 (Part 1 — build() helper + Systems/Deployments/Procedures) and #159 (Part 2 — SamplingFeatures/Properties/Datastreams).
Scope — Part 3 Only
Rewrite Observations (8) + ControlStreams (11) + Commands (10) = 29 methods to delegate to the build() helper. This is the final batch and includes the getCommandStatus() deviation that auto-resolves #111.
Context
Parts 1 and 2 (#158, #159) rewrote 58 methods. This part completes the remaining 29 methods, finishing the refactor. After this part, ALL public URL-building methods delegate to build() and no direct assertResourceAvailable() calls remain in any public method.
ControlStreams (11):getControlStreams, getControlStream, createControlStream, updateControlStream, deleteControlStream, getControlStreamSchema, getControlStreamCommands, createCommand, createCommands, plus others — rewrite to this.build(...).
Commands (10):getCommands, getCommand, updateCommand, deleteCommand, getCommandStatus, updateCommandStatus, getCommandResult, cancelCommand, plus others — rewrite to this.build(...).
Special Case: getCommandStatus() — Auto-resolves #111
getCommandStatus() (currently at ~line 2404) is the ONE method that deviates from the standard pattern by concatenating buildQueryString() separately instead of passing options through buildResourceUrl():
// Current (broken pattern — tracked in #111):getCommandStatus(id: string,options?: CommandStatusQueryOptions): string {this.assertResourceAvailable('commands');returnthis.buildResourceUrl('commands',id,'status')+this.buildQueryString(options);}
After rewriting to build():
// Fixed (consistent with all other methods):getCommandStatus(id: string,options?: CommandStatusQueryOptions): string {returnthis.build('commands',id,'status',options);}
This automatically resolves #111 because build() delegates to buildResourceUrl() which already handles options internally. The manual buildQueryString() concatenation disappears.
Parent Issue
Split from #145 —
assertResourceAvailable()+buildResourceUrl()two-line pattern repeated 90 times inurl_builder.ts— DRY violation.This is Part 3 of 3. See also: #158 (Part 1 —
build()helper + Systems/Deployments/Procedures) and #159 (Part 2 — SamplingFeatures/Properties/Datastreams).Scope — Part 3 Only
Rewrite Observations (8) + ControlStreams (11) + Commands (10) = 29 methods to delegate to the
build()helper. This is the final batch and includes thegetCommandStatus()deviation that auto-resolves #111.Context
Parts 1 and 2 (#158, #159) rewrote 58 methods. This part completes the remaining 29 methods, finishing the refactor. After this part, ALL public URL-building methods delegate to
build()and no directassertResourceAvailable()calls remain in any public method.Methods to Rewrite (29)
Observations (8):
getObservations,getObservation,updateObservation,deleteObservation,getObservationDatastream,getObservationSamplingFeature,getObservationSystem,getObservationHistory— rewrite tothis.build(...).ControlStreams (11):
getControlStreams,getControlStream,createControlStream,updateControlStream,deleteControlStream,getControlStreamSchema,getControlStreamCommands,createCommand,createCommands, plus others — rewrite tothis.build(...).Commands (10):
getCommands,getCommand,updateCommand,deleteCommand,getCommandStatus,updateCommandStatus,getCommandResult,cancelCommand, plus others — rewrite tothis.build(...).Special Case:
getCommandStatus()— Auto-resolves #111getCommandStatus()(currently at ~line 2404) is the ONE method that deviates from the standard pattern by concatenatingbuildQueryString()separately instead of passingoptionsthroughbuildResourceUrl():After rewriting to
build():This automatically resolves #111 because
build()delegates tobuildResourceUrl()which already handles options internally. The manualbuildQueryString()concatenation disappears.Pattern
Same as Parts 1 and 2:
File to Modify
src/ogc-api/csapi/url_builder.tsbuild()What NOT to Touch
build()helper + rewrite Systems, Deployments, Procedures (33 methods) #158)build()(25 methods) #159)build()helper itself — created in Part 1url_builder.tsAcceptance Criteria (Part 3)
build()build()build()getCommandStatus()no longer uses manualbuildQueryString()concatenation — DEFERRED —getCommandStatus()uses string concatenation instead ofbuildResourceUrl()for query string (F45) #111 resolvedthis.assertResourceAvailable()calls remain in ANY public method across the entire filethis.buildResourceUrl()calls remain in ANY public method (all go throughbuild())build()'s conditional logic)tsc --noEmit— zero errorsnpm test— all tests passnpm run lint— zero errorsnpx prettier --check src/— all formattedDependencies
Blocked by: #159 (Part 2), #158 (Part 1)
Blocks: Nothing — this completes the #145 refactor
Resolves: #111 (
getCommandStatus()concatenation deviation)References
assertResourceAvailable()+buildResourceUrl()DRY violation (87 methods) → #158 + #159 + #160 #145 — parent issue with full analysis and all 38 referencesbuild()helper + rewrite Systems, Deployments, Procedures (33 methods) #158 — Part 1 (createsbuild()helper)build()(25 methods) #159 — Part 2 (SamplingFeatures/Properties/Datastreams)getCommandStatus()uses string concatenation instead ofbuildResourceUrl()for query string (F45) #111 —getCommandStatus()concatenation deviation — resolved by this partOperational Constraints
Upstream Isolation Constraint
Per the upstream maintainer's comment on PR #136:
url_builder.tsis withinsrc/ogc-api/csapi/— purely internal to the isolated CSAPI module.