-
Notifications
You must be signed in to change notification settings - Fork 1
#145 Part 2: Rewrite SamplingFeatures, Properties, Datastreams to build() (25 methods) #159
Description
Parent Issue
Split from #145 — assertResourceAvailable() + buildResourceUrl() two-line pattern repeated 90 times in url_builder.ts — DRY violation.
This is Part 2 of 3. See also: #158 (Part 1 — build() helper + Systems/Deployments/Procedures) and Part 3 (issue to follow).
Scope — Part 2 Only
Rewrite SamplingFeatures (8) + Properties (6) + Datastreams (11) = 25 methods to delegate to the build() helper created in Part 1 (#158).
Context
Part 1 (#158) created the build() helper and established the pattern by rewriting 33 methods. This part continues the same mechanical transformation for the next 3 resource types.
Methods to Rewrite (25)
SamplingFeatures (8): getSamplingFeatures, getSamplingFeature, createSamplingFeature, updateSamplingFeature, deleteSamplingFeature, getSamplingFeatureSystems, plus others — rewrite from this.buildResourceUrl(...) to this.build(...).
Properties (6): getProperties, getProperty, updateProperty, deleteProperty, getPropertyDataStreams, getPropertyControlStreams — rewrite to this.build(...).
Datastreams (11): getDataStreams, getDataStream, createDataStream, updateDataStream, deleteDataStream, getDataStreamSchema, getDataStreamObservations, createObservation, plus others — rewrite to this.build(...).
Pattern
Same as Part 1. Each method body changes from:
return this.buildResourceUrl('samplingFeatures', id, undefined, options);to:
return this.build('samplingFeatures', id, undefined, options);For list/create methods that still have the guard:
// Before:
getSamplingFeatures(options?: QueryOptions): string {
this.assertResourceAvailable('samplingFeatures');
return this.buildResourceUrl('samplingFeatures', undefined, undefined, options);
}
// After:
getSamplingFeatures(options?: QueryOptions): string {
return this.build('samplingFeatures', undefined, undefined, options);
}File to Modify
| File | Action |
|---|---|
src/ogc-api/csapi/url_builder.ts |
Rewrite 25 methods to delegate to build() |
What NOT to Touch
- ❌ Systems, Deployments, Procedures — already done in Part 1 (#145 Part 1: Create
build()helper + rewrite Systems, Deployments, Procedures (33 methods) #158) - ❌ Observations, ControlStreams, Commands — Part 3
- ❌ The
build()helper itself — already created in Part 1 - ❌ Public method signatures, JSDoc, test files
- ❌ Any file outside
url_builder.ts
Acceptance Criteria (Part 2)
- All SamplingFeatures methods (8) delegate to
build() - All Properties methods (6) delegate to
build() - All Datastreams methods (11) delegate to
build() - No direct
this.assertResourceAvailable()or directthis.buildResourceUrl()calls remain in these 25 methods - Guard behavior preserved for list/create methods
-
tsc --noEmit— zero errors -
npm test— all tests pass -
npm run lint— zero errors
Dependencies
Blocked by: #158 (Part 1 — build() helper must exist)
Blocks: Part 3
References
- [SPLIT]
assertResourceAvailable()+buildResourceUrl()DRY violation (87 methods) → #158 + #159 + #160 #145 — parent issue with full analysis - #145 Part 1: Create
build()helper + rewrite Systems, Deployments, Procedures (33 methods) #158 — Part 1 (createsbuild()helper) - Phase 7 Scope & Split Assessment
Operational Constraints
⚠️ MANDATORY: Before starting work on this issue, reviewdocs/governance/AI_OPERATIONAL_CONSTRAINTS.md.
Upstream Isolation Constraint
Per the upstream maintainer's comment on PR #136: url_builder.ts is within src/ogc-api/csapi/ — purely internal to the isolated CSAPI module.