Skip to content

Commit f3ebcbc

Browse files
committed
refactor(csapi): rename DataStream -> Datastream throughout module (B1 / #176)
Phase 8 / Task B1 / Finding 019. Aligns method, type, parser, and resource- constant spellings on the OGC-spec form `Datastream` (one word). 14 `CSAPIQueryBuilder` methods renamed (the impl-guide table lists 13; `getPropertyDataStreams` was added to satisfy the issue's zero-grep acceptance gate. Identical structurally to the other 13; the omission appears to have been an audit oversight): getDataStreams -> getDatastreams getDataStream -> getDatastream createDataStream -> createDatastream updateDataStream -> updateDatastream deleteDataStream -> deleteDatastream getDataStreamSchema -> getDatastreamSchema getDataStreamObservations -> getDatastreamObservations getDataStreamSystems -> getDatastreamSystems getDataStreamProcedures -> getDatastreamProcedures getDataStreamHistory -> getDatastreamHistory getSystemDataStreams -> getSystemDatastreams createDataStreamForSystem -> createDatastreamForSystem getProcedureDataStreams -> getProcedureDatastreams getPropertyDataStreams -> getPropertyDatastreams Also normalizes incidental DataStream references in JSDoc, comments, and spec describe blocks across the csapi module. Per locked decision: straight rename, no aliases, no @deprecated tags (PR #136 unmerged -> no consumers). No method signatures, return types, or runtime behavior changed. Refs: docs/code-review/019-pending-p2-method-naming-datastream-vs-datastream.md Closes #176
1 parent 0dc8805 commit f3ebcbc

11 files changed

Lines changed: 125 additions & 125 deletions

File tree

‎src/ogc-api/csapi/factory.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function isCollectionInfo(doc: unknown): doc is OgcApiCollectionInfo {
4747
* const builder = await createCSAPIBuilder(endpoint, 'weather-stations');
4848
*
4949
* // 1. Builder → URL string (no network call here)
50-
* const url = builder.getDataStreams({ limit: 50 });
50+
* const url = builder.getDatastreams({ limit: 50 });
5151
*
5252
* // 2. Consumer owns the fetch — auth, timeouts, retries, etc.
5353
* const response = await fetch(url, {

‎src/ogc-api/csapi/formats/geojson.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export function isCSAPIFeature(feature: unknown): boolean {
201201
* Determines the CSAPI resource type from a GeoJSON Feature's `featureType` property.
202202
*
203203
* Only Part 1 resource types are recognized: System, Deployment, Procedure,
204-
* SamplingFeature. Part 2 resources (DataStreams, Observations, Control Streams,
204+
* SamplingFeature. Part 2 resources (Datastreams, Observations, Control Streams,
205205
* Commands) do not have a `featureType` property and will return `null`.
206206
*
207207
* Checks the SOSA vocabulary first, then SSN, then SensorML.
@@ -365,7 +365,7 @@ export function isValidUri(value: unknown): boolean {
365365
* **Important limitations:**
366366
*
367367
* - **Only supports Part 1 resources** — Systems, Deployments, Procedures,
368-
* and Sampling Features. Part 2 resources (DataStreams, Observations,
368+
* and Sampling Features. Part 2 resources (Datastreams, Observations,
369369
* Control Streams, Commands) are not GeoJSON Features and cannot be
370370
* parsed by this function.
371371
*

‎src/ogc-api/csapi/formats/part2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ interface BaseStream {
6969
* {@link parseControlStream}.
7070
*
7171
* Both resource types inherit the same `baseStream` schema in OGC 23-002
72-
* (§9.2 DataStream, §10.2 ControlStream). This helper consolidates the
72+
* (§9.2 Datastream, §10.2 ControlStream). This helper consolidates the
7373
* duplicated extraction logic into a single location.
7474
*
7575
* @param fn - Function name for error messages (forwarded to {@link requireObject}).

‎src/ogc-api/csapi/formats/swecommon/parser.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ export function detectEncoding(json: unknown): DataEncoding | undefined {
820820
// ========================================
821821

822822
/**
823-
* Validate a parsed observation result value against a DataStream's SWE
823+
* Validate a parsed observation result value against a Datastream's SWE
824824
* Common schema (DataComponent definition).
825825
*
826826
* Returns a {@link ValidationResult} indicating success or failure with

‎src/ogc-api/csapi/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* // 1. Endpoint → 2. Builder → 3. URL → 4. fetch → 5. parse
3535
* const endpoint = new OgcApiEndpoint('https://api.example.com');
3636
* const builder = await createCSAPIBuilder(endpoint, 'weather-stations');
37-
* const url = builder.getDataStreams({ limit: 10 });
37+
* const url = builder.getDatastreams({ limit: 10 });
3838
* const response = await fetch(url, {
3939
* headers: { Authorization: 'Bearer ...' },
4040
* });

‎src/ogc-api/csapi/integration/discovery.spec.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe('Discovery workflow — full lifecycle', () => {
175175
expect(builder.getSystems()).toBe(
176176
'https://api.example.com/collections/weather/systems'
177177
);
178-
expect(builder.getDataStreams()).toBe(
178+
expect(builder.getDatastreams()).toBe(
179179
'https://api.example.com/collections/weather/datastreams'
180180
);
181181
expect(builder.getCommands()).toBe(
@@ -345,7 +345,7 @@ describe('Discovery workflow — partial collection support', () => {
345345
expect(builder.availableResources.has('deployments')).toBe(true);
346346

347347
// Part 2 resources are unavailable
348-
expect(() => builder.getDataStreams()).toThrow(EndpointError);
348+
expect(() => builder.getDatastreams()).toThrow(EndpointError);
349349
expect(() => builder.getObservations()).toThrow(EndpointError);
350350
});
351351

@@ -378,7 +378,7 @@ describe('Discovery workflow — partial collection support', () => {
378378

379379
expect(builder.availableResources.size).toBe(2);
380380
expect(() => builder.getSystems()).toThrow(EndpointError);
381-
expect(builder.getDataStreams()).toContain('/datastreams');
381+
expect(builder.getDatastreams()).toContain('/datastreams');
382382
});
383383
});
384384

‎src/ogc-api/csapi/integration/navigation.spec.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('Navigation — system → nested resources', () => {
139139
const builder = new CSAPIQueryBuilder(makeFullCollection());
140140

141141
it('navigates system → datastreams', () => {
142-
const url = builder.getSystemDataStreams('sys-001');
142+
const url = builder.getSystemDatastreams('sys-001');
143143
expect(url).toBe(
144144
'https://api.example.com/collections/iot/systems/sys-001/datastreams'
145145
);
@@ -200,15 +200,15 @@ describe('Navigation — multi-hop top-level → nested chain', () => {
200200
expect(systemUrl).toContain('/systems/sys-001');
201201

202202
// 2. Navigate to system's datastreams
203-
const dstreamsUrl = builder.getSystemDataStreams('sys-001');
203+
const dstreamsUrl = builder.getSystemDatastreams('sys-001');
204204
expect(dstreamsUrl).toContain('/systems/sys-001/datastreams');
205205

206206
// 3. Get datastream schema
207-
const schemaUrl = builder.getDataStreamSchema('ds-temp');
207+
const schemaUrl = builder.getDatastreamSchema('ds-temp');
208208
expect(schemaUrl).toContain('/datastreams/ds-temp/schema');
209209

210210
// 4. Observations from that datastream
211-
const obsUrl = builder.getDataStreamObservations('ds-temp');
211+
const obsUrl = builder.getDatastreamObservations('ds-temp');
212212
expect(obsUrl).toContain('/datastreams/ds-temp/observations');
213213
});
214214

@@ -432,7 +432,7 @@ describe('Navigation — partial collection support', () => {
432432
expect(builder.getDeployments()).toContain('/deployments');
433433

434434
// Part 2 resources throw
435-
expect(() => builder.getDataStreams()).toThrow(EndpointError);
435+
expect(() => builder.getDatastreams()).toThrow(EndpointError);
436436
expect(() => builder.getObservations()).toThrow(EndpointError);
437437
expect(() => builder.getControlStreams()).toThrow(EndpointError);
438438
expect(() => builder.getCommands()).toThrow(EndpointError);
@@ -472,7 +472,7 @@ describe('Navigation — partial collection support', () => {
472472
const builder = new CSAPIQueryBuilder(part2Only);
473473

474474
// Part 2 resources work
475-
expect(builder.getDataStreams()).toContain('/datastreams');
475+
expect(builder.getDatastreams()).toContain('/datastreams');
476476
expect(builder.getObservations()).toContain('/observations');
477477

478478
// Part 1 resources throw

‎src/ogc-api/csapi/integration/observation.spec.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const OBSERVATIONS_PAGE_2 = {
148148
links: [],
149149
};
150150

151-
/** DataStream schema response (SWE Common DataRecord). */
151+
/** Datastream schema response (SWE Common DataRecord). */
152152
const DATASTREAM_SCHEMA = {
153153
type: 'DataRecord',
154154
label: 'Temperature Observation',
@@ -172,7 +172,7 @@ const DATASTREAM_SCHEMA = {
172172
};
173173

174174
// ========================================
175-
// System → DataStream Discovery
175+
// System → Datastream Discovery
176176
// ========================================
177177

178178
describe('Observation workflow — system to datastream discovery', () => {
@@ -188,7 +188,7 @@ describe('Observation workflow — system to datastream discovery', () => {
188188
});
189189

190190
it('builds nested datastream URL for a discovered system', () => {
191-
const url = builder.getSystemDataStreams('sys-001');
191+
const url = builder.getSystemDatastreams('sys-001');
192192
expect(url).toBe(
193193
'https://api.example.com/collections/iot/systems/sys-001/datastreams'
194194
);
@@ -213,7 +213,7 @@ describe('Observation workflow — temporal query parameters', () => {
213213
const builder = new CSAPIQueryBuilder(makeCollection());
214214

215215
it('builds observation URL with phenomenonTime filter', () => {
216-
const url = builder.getDataStreamObservations('ds-temp', {
216+
const url = builder.getDatastreamObservations('ds-temp', {
217217
phenomenonTime: {
218218
start: new Date('2024-06-15T00:00:00Z'),
219219
end: new Date('2024-06-15T23:59:59Z'),
@@ -225,14 +225,14 @@ describe('Observation workflow — temporal query parameters', () => {
225225
});
226226

227227
it('builds observation URL with resultTime=latest', () => {
228-
const url = builder.getDataStreamObservations('ds-temp', {
228+
const url = builder.getDatastreamObservations('ds-temp', {
229229
resultTime: 'latest',
230230
});
231231
expect(url).toContain('resultTime=latest');
232232
});
233233

234234
it('builds observation URL with limit and offset pagination', () => {
235-
const url = builder.getDataStreamObservations('ds-temp', {
235+
const url = builder.getDatastreamObservations('ds-temp', {
236236
limit: 100,
237237
offset: 200,
238238
});
@@ -287,7 +287,7 @@ describe('Observation workflow — cursor-based pagination', () => {
287287
const builder = new CSAPIQueryBuilder(makeCollection());
288288

289289
it('builds URL with cursor token', () => {
290-
const url = builder.getDataStreamObservations('ds-temp', {
290+
const url = builder.getDatastreamObservations('ds-temp', {
291291
cursor: 'abc123xyz',
292292
limit: 50,
293293
});
@@ -304,7 +304,7 @@ describe('Observation workflow — schema and SWE Common parsing', () => {
304304
const builder = new CSAPIQueryBuilder(makeCollection());
305305

306306
it('builds datastream schema URL', () => {
307-
const url = builder.getDataStreamSchema('ds-temp', {
307+
const url = builder.getDatastreamSchema('ds-temp', {
308308
f: 'application/swe+json',
309309
});
310310
expect(url).toContain('/datastreams/ds-temp/schema');
@@ -376,11 +376,11 @@ describe('Observation workflow — error handling', () => {
376376
});
377377
const builder = new CSAPIQueryBuilder(noDs);
378378

379-
expect(() => builder.getDataStreams()).toThrow(
379+
expect(() => builder.getDatastreams()).toThrow(
380380
/does not support 'datastreams'/
381381
);
382382
// Per-ID methods skip assertResourceAvailable (Phase 7 #156/#157)
383-
expect(builder.getDataStreamObservations('ds-001')).toEqual(
383+
expect(builder.getDatastreamObservations('ds-001')).toEqual(
384384
expect.any(String)
385385
);
386386
});

‎src/ogc-api/csapi/model.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { Geometry } from 'geojson';
1010
/**
1111
* Extends {@link DateTimeParameter} with the CSAPI Part 2 `'latest'` keyword.
1212
*
13-
* The `resultTime` parameter on DataStream and Observation endpoints supports
13+
* The `resultTime` parameter on Datastream and Observation endpoints supports
1414
* the special value `'latest'` to retrieve the most recent result. This type
1515
* alias keeps the `'latest'` keyword scoped to CSAPI without modifying the
1616
* shared `DateTimeParameter` used by EDR and other OGC API modules.
@@ -260,7 +260,7 @@ export interface PropertyQueryOptions extends QueryOptions {
260260
}
261261

262262
/**
263-
* Query options for DataStream list endpoints.
263+
* Query options for Datastream list endpoints.
264264
* @see https://docs.ogc.org/is/23-002/23-002.html#_datastream_resources
265265
*/
266266
export interface DatastreamQueryOptions extends QueryOptions {
@@ -558,9 +558,9 @@ export interface Property {
558558
// ========================================
559559

560560
/**
561-
* A DataStream resource.
561+
* A Datastream resource.
562562
*
563-
* DataStreams represent a stream of observations from a system, linking
563+
* Datastreams represent a stream of observations from a system, linking
564564
* a system to its observed properties and observation results.
565565
*
566566
* Required properties: `name`, `system@link`, `observedProperties`,

0 commit comments

Comments
 (0)