Skip to content

Commit 4acedf4

Browse files
committed
Merge upstream a623911 into phase-10 (AD01)
2 parents 28ef884 + a623911 commit 4acedf4

32 files changed

Lines changed: 1804 additions & 541 deletions

‎app/.vitepress/theme/custom.css‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ a.VPSocialLink.no-icon svg {
8383
.pico select:focus {
8484
border-color: var(--vp-c-brand-1);
8585
}
86+
87+
.vp-doc table {
88+
display: table;
89+
table-layout: auto;
90+
width: 100%;
91+
}
92+
93+
.vp-doc table th,
94+
.vp-doc table td {
95+
min-width: 140px;
96+
max-width: 300px;
97+
}

‎app/api-utils.js‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ export function formatTypeToString(typeObj) {
5151
const returnType = typeObj.declaration?.signatures?.[0]?.type;
5252
return `() => ${formatTypeToString(returnType)}`;
5353
}
54+
if (
55+
typeObj.type === 'reflection' &&
56+
typeObj.declaration?.kind & 65536 // ReflectionKind.TypeLiteral
57+
) {
58+
const properties = typeObj.declaration?.children
59+
?.map((propEl) => {
60+
return `${propEl.name}: ${formatTypeToString(propEl.type)}`;
61+
})
62+
.join(', ');
63+
return `{ ${properties} }`;
64+
}
5465
if (typeObj.type === 'reference') {
5566
switch (typeObj.name) {
5667
case 'Record':
@@ -62,9 +73,12 @@ export function formatTypeToString(typeObj) {
6273
case 'Error':
6374
return `[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)`;
6475
case 'Promise':
65-
return `[Promise](https://developer.mozilla.org/en-US/docs/Web/API/Promise)<${formatTypeToString(
76+
// we include a zero-width space after the opening < have more readable line breaks (https://en.wikipedia.org/wiki/Zero-width_space)
77+
return `[Promise](https://developer.mozilla.org/en-US/docs/Web/API/Promise)&lt;<wbr>${formatTypeToString(
6678
typeObj.typeArguments[0],
67-
)}&gt;`;
79+
)}<wbr>&gt;`;
80+
case 'Omit':
81+
return formatTypeToString(typeObj.typeArguments[0]);
6882
}
6983
const ref = API.children.find((el) => el.id === typeObj.target);
7084
if (ref) {

‎app/api.data.js‎

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,64 @@ function processClass(apiElement, importPath) {
3232
);
3333
const properties = apiElement.children.filter(
3434
(item) =>
35-
item.kind & 262144 /* ReflectionKind.Accessor */ &&
35+
(item.kind & 262144 /* ReflectionKind.Accessor */ ||
36+
item.kind & 1024) /* ReflectionKind.Property */ &&
3637
!item.flags?.isInherited,
3738
);
3839
const methods = apiElement.children.filter(
3940
(item) =>
40-
item.kind & 2048 /* ReflectionKind.Method */ && !item.flags?.isInherited,
41+
item.kind & 2048 /* ReflectionKind.Method */ &&
42+
!item.flags?.isInherited &&
43+
!item.flags?.isStatic,
4144
);
45+
const staticMethods = apiElement.children
46+
.filter(
47+
(item) =>
48+
item.kind & 2048 /* ReflectionKind.Method */ &&
49+
!item.flags?.isInherited &&
50+
item.flags?.isStatic,
51+
)
52+
.map((methodElement) => ({
53+
...methodElement,
54+
name: `${apiElement.name}.${methodElement.name}`,
55+
}));
4256

4357
return {
4458
name: apiElement.name,
4559
descriptionHtml: markdown(getDescription(apiElement)),
4660
importHtml: markdown(`\`\`\`js
4761
import { ${apiElement.name} } from '${importPath}'
4862
\`\`\``),
49-
constructorSignature: markdownInline(
50-
formatConstructorToString(apiElement, constructorElement),
51-
),
52-
constructor: processFunction(constructorElement, importPath),
53-
constructorDescriptionHtml: markdown(getDescription(constructorElement)),
63+
constructorSignature: constructorElement
64+
? markdownInline(
65+
formatConstructorToString(apiElement, constructorElement),
66+
)
67+
: null,
68+
constructor: constructorElement
69+
? processFunction(constructorElement, importPath)
70+
: null,
71+
constructorDescriptionHtml: constructorElement
72+
? markdown(getDescription(constructorElement))
73+
: null,
5474
properties: properties.map((property) => ({
5575
name: property.name,
56-
signature: markdownInline(formatTypeToString(property.getSignature.type)),
76+
signature: markdownInline(
77+
formatTypeToString(property.getSignature?.type ?? property.type),
78+
),
5779
descriptionHtml: markdown(getDescription(property)),
5880
})),
5981
methods: methods.map((method) => processFunction(method, importPath)),
82+
staticMethods: staticMethods.map((method) =>
83+
processFunction(method, importPath),
84+
),
6085
extends: apiElement.extendedTypes?.map((extended) => ({
6186
signature: markdownInline(formatTypeToString(extended)),
6287
})),
6388
};
6489
}
6590

6691
function processFunction(apiElement, importPath) {
67-
const signature = apiElement?.signatures?.[0];
92+
const signature = apiElement.signatures?.[0];
6893

6994
return {
7095
name: apiElement.name,

‎app/index.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ title: Docs
77

88
## Presentation
99

10-
<span class="lib-name">ogc-client</span> is a pure Javascript library made for interacting with geospatial web services relying on standard protocols, namely [OGC standards](https://www.ogc.org/docs/is).
10+
<span class="lib-name">ogc-client</span> is a Typescript library made for interacting with geospatial web services relying on standard protocols, namely [OGC standards](https://www.ogc.org/docs/is).
1111

1212
Its purpose is to help you interact with them in a user-friendly and consistent way.
1313

1414
Its main features include:
1515

16-
- Support for many protoocols such as [WFS](https://www.ogc.org/standards/wfs), [WMS](https://www.ogc.org/standards/wms), [WMTS](https://www.ogc.org/standards/wmts), [WPS](https://www.ogc.org/standards/wps), [OGC API](https://ogcapi.ogc.org/), STAC API, TMS and NcWMS extension
16+
- Support for many protocols such as [WFS](https://www.ogc.org/standards/wfs), [WMS](https://www.ogc.org/standards/wms), [WMTS](https://www.ogc.org/standards/wmts), [WPS](https://www.ogc.org/standards/wps), [OGC API](https://ogcapi.ogc.org/), STAC API, TMS and NcWMS extension
1717
- Elaborate cache system to minimize network requests
1818
- Fast parsing of XML documents using [@rgrove/parse-xml](https://github.com/rgrove/parse-xml)
1919
- Detection of [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)-related issues

‎app/src/components/apidoc/ClassCard.vue‎

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
<MarkdownBlock :html="apiElement.importHtml"></MarkdownBlock>
1616
<MarkdownBlock :html="apiElement.descriptionHtml" />
1717

18-
<h4>📦 Constructor</h4>
19-
<CodeBlock :html="apiElement.constructorSignature"></CodeBlock>
18+
<h4 v-if="apiElement.constructor">📦 Constructor</h4>
19+
<CodeBlock
20+
v-if="apiElement.constructor"
21+
:html="apiElement.constructorSignature"
22+
></CodeBlock>
2023
<table v-if="apiElement.constructor?.parameters?.length > 0">
2124
<thead>
2225
<tr>
@@ -51,7 +54,7 @@
5154
<CodeBlock :html="extended.signature"></CodeBlock>
5255
</template>
5356

54-
<h4 v-if="apiElement.properties?.length > 0">💡 Accessors</h4>
57+
<h4 v-if="apiElement.properties?.length > 0">💡 Properties</h4>
5558
<table v-if="apiElement.properties?.length > 0">
5659
<thead>
5760
<tr>
@@ -77,7 +80,13 @@
7780
</tbody>
7881
</table>
7982

80-
<h4 v-if="apiElement.methods?.length > 0">⚡️ Methods</h4>
83+
<h4
84+
v-if="
85+
apiElement.methods?.length > 0 || apiElement.staticMethods?.length > 0
86+
"
87+
>
88+
⚡️ Methods
89+
</h4>
8190
<template v-for="method in apiElement.methods" style="display: contents">
8291
<br />
8392
<h5>
@@ -111,7 +120,66 @@
111120
<table v-if="!!method.returns">
112121
<thead>
113122
<tr>
114-
<th>Return type</th>
123+
<th>Return&nbsp;type</th>
124+
<th>Description</th>
125+
</tr>
126+
</thead>
127+
<tbody>
128+
<tr>
129+
<td><code v-html="method.returns"></code></td>
130+
<td>
131+
<MarkdownBlock
132+
v-if="method.returnsDescriptionHtml"
133+
class="mb-2 small"
134+
:html="method.returnsDescriptionHtml"
135+
/>
136+
</td>
137+
</tr>
138+
</tbody>
139+
</table>
140+
<MarkdownBlock
141+
v-if="method.descriptionHtml"
142+
:html="method.descriptionHtml"
143+
/>
144+
</template>
145+
<template
146+
v-for="method in apiElement.staticMethods"
147+
style="display: contents"
148+
>
149+
<br />
150+
<h5>
151+
<Badge type="tip" text="static" />&nbsp;
152+
<code>{{ method.name }}()</code>
153+
</h5>
154+
<CodeBlock :html="method.signature"></CodeBlock>
155+
<table v-if="method.parameters?.length > 0">
156+
<thead>
157+
<tr>
158+
<th>Parameter</th>
159+
<th>Type</th>
160+
<th>Description</th>
161+
</tr>
162+
</thead>
163+
<tbody>
164+
<tr v-for="parameter in method.parameters">
165+
<td>
166+
<code>{{ parameter.name }}</code>
167+
</td>
168+
<td><code v-html="parameter.signature"></code></td>
169+
<td>
170+
<MarkdownBlock
171+
v-if="parameter.descriptionHtml"
172+
class="mb-2 small"
173+
:html="parameter.descriptionHtml"
174+
/>
175+
</td>
176+
</tr>
177+
</tbody>
178+
</table>
179+
<table v-if="!!method.returns">
180+
<thead>
181+
<tr>
182+
<th>Return&nbsp;type</th>
115183
<th>Description</th>
116184
</tr>
117185
</thead>

‎app/src/components/apidoc/FunctionCard.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<table v-if="!!apiElement.returns">
4242
<thead>
4343
<tr>
44-
<th>Return type</th>
44+
<th>Return&nbsp;type</th>
4545
<th>Description</th>
4646
</tr>
4747
</thead>

‎examples/ncwms.js‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@
1010
* Run with: node examples/ncwms.js
1111
*/
1212

13-
import { getDimensionDefaultValue, NcwmsEndpoint } from '../dist/dist-node.js';
13+
import { NcwmsEndpoint } from '../dist/dist-node.js';
1414

1515
const NCWMS_URL =
1616
'https://tds0.ifremer.fr/thredds/wms/LPO_GLOBANA_ISAS20_ARGO_MNTH_TIME_SERIE?service=WMS&request=GetCapabilities';
1717
const LAYER_NAME = 'TEMP';
1818
const SAMPLE_BBOX = [-60, 30, -30, 50];
1919

20-
function getLayerDimensionValue(layer, dimensionName) {
21-
const dimension = layer.dimensions?.find((dim) => dim.name === dimensionName);
22-
return dimension ? getDimensionDefaultValue(dimension) : null;
23-
}
24-
2520
async function main() {
2621
try {
2722
console.log('╔═══════════════════════════════════════════════════════╗');
@@ -36,8 +31,8 @@ async function main() {
3631
throw new Error(`Layer "${LAYER_NAME}" was not found.`);
3732
}
3833

39-
const time = getLayerDimensionValue(layer, 'time');
40-
const elevation = getLayerDimensionValue(layer, 'elevation');
34+
const time = layer.timeDimension?.defaultValue;
35+
const elevation = layer.elevationDimension?.defaultValue;
4136

4237
if (!time || !elevation) {
4338
throw new Error(

‎fixtures/wms/capabilities-dimensions-1-1-1.xml‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎fixtures/wms/capabilities-dimensions-1-3-0.xml‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)