Skip to content

Commit 491edec

Browse files
committed
Format all files with Prettier
1 parent 944ff32 commit 491edec

67 files changed

Lines changed: 3699 additions & 2311 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/coverage.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ permissions:
1414
jobs:
1515
coverage:
1616
runs-on: ubuntu-latest
17-
17+
1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
21-
21+
2222
- name: Setup Node.js
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: '20'
2626
cache: 'npm'
27-
27+
2828
- name: Install dependencies
2929
run: npm ci
30-
30+
3131
- name: Run tests with coverage
3232
run: |
3333
npm run test:browser -- --coverage --coverageReporters=html --coverageReporters=lcov --coverageReporters=json-summary
3434
npm run test:node -- --coverage --coverageReporters=html --coverageReporters=lcov --coverageReporters=json-summary
35-
35+
3636
- name: Upload coverage to artifacts
3737
uses: actions/upload-artifact@v4
3838
with:
3939
name: coverage-report
4040
path: coverage/
4141
retention-days: 30
42-
42+
4343
- name: Generate coverage summary
4444
if: github.event_name == 'pull_request'
4545
run: |
@@ -48,7 +48,7 @@ jobs:
4848
if [ -f coverage/coverage-summary.json ]; then
4949
node -e "const fs = require('fs'); const data = JSON.parse(fs.readFileSync('coverage/coverage-summary.json')); const total = data.total; console.log('| Metric | Coverage |'); console.log('|--------|----------|'); console.log('| Statements | ' + total.statements.pct + '% |'); console.log('| Branches | ' + total.branches.pct + '% |'); console.log('| Functions | ' + total.functions.pct + '% |'); console.log('| Lines | ' + total.lines.pct + '% |');" >> $GITHUB_STEP_SUMMARY
5050
fi
51-
51+
5252
- name: Deploy to GitHub Pages
5353
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5454
uses: peaceiris/actions-gh-pages@v3

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ dist
44
app/dist
55
node_modules
66
app/node_modules
7+
8+
coverage
9+
temp-coverage-map.json
10+
jest-results.json

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,3 @@ Run examples with:
8787
npm run build
8888
node examples/stac-query.js
8989
```
90-

fixtures/ogc-api/csapi/sample-server/collections/sensors.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
"href": "http://example.com/csapi/controlStreams"
6262
}
6363
],
64-
"itemFormats": ["application/json", "application/sml+json", "application/geo+json"],
64+
"itemFormats": [
65+
"application/json",
66+
"application/sml+json",
67+
"application/geo+json"
68+
],
6569
"crs": ["http://www.opengis.net/def/crs/OGC/1.3/CRS84"]
6670
}

spec/ogcapi-connectedsystems-2.bundled.oas31.yaml

Lines changed: 98 additions & 47 deletions
Large diffs are not rendered by default.

src/ogc-api/csapi/formats.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ describe('Format Detection', () => {
4040
});
4141

4242
it('should handle content type with parameters', () => {
43-
const result = detectFormatFromContentType('application/geo+json; charset=utf-8');
43+
const result = detectFormatFromContentType(
44+
'application/geo+json; charset=utf-8'
45+
);
4446
expect(result?.format).toBe('geojson');
4547
});
4648

@@ -249,9 +251,7 @@ describe('Format Detection', () => {
249251
});
250252

251253
it('should handle arrays', () => {
252-
const data = [
253-
{ type: 'Feature' },
254-
];
254+
const data = [{ type: 'Feature' }];
255255

256256
const result = detectFormatFromBody(data as any);
257257
expect(result.format).toBe('json');
@@ -266,7 +266,7 @@ describe('Format Detection', () => {
266266

267267
it('should be case-sensitive', () => {
268268
const data = {
269-
type: 'feature', // lowercase
269+
type: 'feature', // lowercase
270270
};
271271

272272
const result = detectFormatFromBody(data);
@@ -278,7 +278,9 @@ describe('Format Detection', () => {
278278

279279
describe('detectFormat (combined)', () => {
280280
it('should prefer high-confidence header result', () => {
281-
const result = detectFormat('application/geo+json', { type: 'SomethingElse' });
281+
const result = detectFormat('application/geo+json', {
282+
type: 'SomethingElse',
283+
});
282284
expect(result.format).toBe('geojson');
283285
expect(result.confidence).toBe('high');
284286
});

src/ogc-api/csapi/formats.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* CSAPI Format Detection and Constants
3-
*
3+
*
44
* Handles detection and management of different response formats
55
* used by OGC API Connected Systems.
66
*/
@@ -32,7 +32,9 @@ export interface FormatDetectionResult {
3232
/**
3333
* Detect format from Content-Type header
3434
*/
35-
export function detectFormatFromContentType(contentType: string | null): FormatDetectionResult | null {
35+
export function detectFormatFromContentType(
36+
contentType: string | null
37+
): FormatDetectionResult | null {
3638
if (!contentType) {
3739
return null;
3840
}
@@ -62,7 +64,7 @@ export function detectFormatFromContentType(contentType: string | null): FormatD
6264

6365
/**
6466
* Detect format from response body structure
65-
*
67+
*
6668
* This is used as a fallback when Content-Type header is missing or ambiguous.
6769
*/
6870
export function detectFormatFromBody(body: unknown): FormatDetectionResult {
@@ -74,7 +76,11 @@ export function detectFormatFromBody(body: unknown): FormatDetectionResult {
7476

7577
// GeoJSON detection
7678
if (obj.type === 'Feature' || obj.type === 'FeatureCollection') {
77-
return { format: 'geojson', mediaType: CSAPI_MEDIA_TYPES.GEOJSON, confidence: 'high' };
79+
return {
80+
format: 'geojson',
81+
mediaType: CSAPI_MEDIA_TYPES.GEOJSON,
82+
confidence: 'high',
83+
};
7884
}
7985

8086
// SensorML detection - look for type field with SensorML values
@@ -87,7 +93,11 @@ export function detectFormatFromBody(body: unknown): FormatDetectionResult {
8793
type === 'AggregateProcess' ||
8894
type === 'Deployment'
8995
) {
90-
return { format: 'sensorml', mediaType: CSAPI_MEDIA_TYPES.SENSORML_JSON, confidence: 'high' };
96+
return {
97+
format: 'sensorml',
98+
mediaType: CSAPI_MEDIA_TYPES.SENSORML_JSON,
99+
confidence: 'high',
100+
};
91101
}
92102
}
93103

@@ -108,7 +118,11 @@ export function detectFormatFromBody(body: unknown): FormatDetectionResult {
108118
type === 'Matrix' ||
109119
type === 'DataStream'
110120
) {
111-
return { format: 'swe', mediaType: CSAPI_MEDIA_TYPES.SWE_JSON, confidence: 'medium' };
121+
return {
122+
format: 'swe',
123+
mediaType: CSAPI_MEDIA_TYPES.SWE_JSON,
124+
confidence: 'medium',
125+
};
112126
}
113127
}
114128

@@ -118,7 +132,7 @@ export function detectFormatFromBody(body: unknown): FormatDetectionResult {
118132

119133
/**
120134
* Detect format from both Content-Type header and body
121-
*
135+
*
122136
* Prefers Content-Type header when available and unambiguous,
123137
* falls back to body inspection when needed.
124138
*/

src/ogc-api/csapi/geojson/base-types.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Base types for CSAPI GeoJSON features
3-
*
3+
*
44
* CSAPI uses GeoJSON (RFC 7946) as one of its primary formats for resource representation.
55
* All resources except Observations and Commands are represented as GeoJSON features.
6-
*
6+
*
77
* @see https://docs.ogc.org/is/23-001r2/23-001r2.html (Part 1: Feature Resources)
88
* @see https://tools.ietf.org/html/rfc7946 (GeoJSON Specification)
99
*/
@@ -24,7 +24,7 @@ export interface TimeExtent {
2424
* Start of time period (ISO 8601)
2525
*/
2626
start?: ISODateTime;
27-
27+
2828
/**
2929
* End of time period (ISO 8601)
3030
*/
@@ -50,22 +50,22 @@ export interface Link {
5050
* Link relation type
5151
*/
5252
rel: string;
53-
53+
5454
/**
5555
* Target URI
5656
*/
5757
href: string;
58-
58+
5959
/**
6060
* MIME type of the linked resource
6161
*/
6262
type?: string;
63-
63+
6464
/**
6565
* Human-readable title
6666
*/
6767
title?: string;
68-
68+
6969
/**
7070
* Language of the linked resource (RFC 5646)
7171
*/
@@ -74,7 +74,7 @@ export interface Link {
7474

7575
/**
7676
* Common properties shared by all CSAPI feature types
77-
*
77+
*
7878
* @see https://docs.ogc.org/is/23-001r2/23-001r2.html#_common_properties
7979
*/
8080
export interface CSAPIFeatureProperties {
@@ -83,28 +83,28 @@ export interface CSAPIFeatureProperties {
8383
* Examples: 'System', 'Deployment', 'Procedure', 'SamplingFeature', etc.
8484
*/
8585
featureType: string;
86-
86+
8787
/**
8888
* Unique identifier for this resource
8989
* Required by CSAPI specification
9090
*/
9191
uid: UniqueID;
92-
92+
9393
/**
9494
* Human-readable name
9595
*/
9696
name?: string;
97-
97+
9898
/**
9999
* Detailed description
100100
*/
101101
description?: string;
102-
102+
103103
/**
104104
* Time period during which this resource is/was valid
105105
*/
106106
validTime?: TimeExtent;
107-
107+
108108
/**
109109
* Links to related resources (self, alternate, collection, etc.)
110110
*/
@@ -113,7 +113,7 @@ export interface CSAPIFeatureProperties {
113113

114114
/**
115115
* Base type for all CSAPI GeoJSON features
116-
*
116+
*
117117
* @template P - Properties type extending CSAPIFeatureProperties
118118
* @template G - Geometry type (defaults to any GeoJSON geometry)
119119
*/
@@ -125,17 +125,17 @@ export interface CSAPIFeature<
125125
* Always 'Feature' for GeoJSON features
126126
*/
127127
type: 'Feature';
128-
128+
129129
/**
130130
* Feature ID (may differ from properties.uid)
131131
*/
132132
id?: string | number;
133-
133+
134134
/**
135135
* Geometry (can be null for features without location)
136136
*/
137137
geometry: G;
138-
138+
139139
/**
140140
* CSAPI-specific properties
141141
*/
@@ -144,7 +144,7 @@ export interface CSAPIFeature<
144144

145145
/**
146146
* Base type for CSAPI GeoJSON feature collections
147-
*
147+
*
148148
* @template F - Feature type extending CSAPIFeature
149149
*/
150150
export interface CSAPIFeatureCollection<F extends CSAPIFeature = CSAPIFeature>
@@ -153,27 +153,27 @@ export interface CSAPIFeatureCollection<F extends CSAPIFeature = CSAPIFeature>
153153
* Always 'FeatureCollection'
154154
*/
155155
type: 'FeatureCollection';
156-
156+
157157
/**
158158
* Array of features
159159
*/
160160
features: F[];
161-
161+
162162
/**
163163
* Optional links for pagination and related resources
164164
*/
165165
links?: Link[];
166-
166+
167167
/**
168168
* Number of features returned (may be less than total)
169169
*/
170170
numberReturned?: number;
171-
171+
172172
/**
173173
* Total number of features available (if known)
174174
*/
175175
numberMatched?: number;
176-
176+
177177
/**
178178
* Timestamp when collection was generated
179179
*/
@@ -200,7 +200,9 @@ export function isCSAPIFeature(obj: unknown): obj is CSAPIFeature {
200200
/**
201201
* Type guard to check if object is a CSAPI feature collection
202202
*/
203-
export function isCSAPIFeatureCollection(obj: unknown): obj is CSAPIFeatureCollection {
203+
export function isCSAPIFeatureCollection(
204+
obj: unknown
205+
): obj is CSAPIFeatureCollection {
204206
return (
205207
typeof obj === 'object' &&
206208
obj !== null &&

0 commit comments

Comments
 (0)