Skip to content

Commit 303d3a6

Browse files
Strip "ById", change "undefined" for "null", fix syntax errors
1 parent b387f58 commit 303d3a6

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- New property `id` added to `FederationBackend` objects returned by `listFederation` in `Capabilities`
13-
- New functions `getFederationBackendById` and `getFederationBackendsByIds` in `Capabilities`
13+
- New functions `getFederationBackend` and `getFederationBackends` in `Capabilities`
1414

1515
## [2.7.0] - 2025-01-04
1616

openeo.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,17 @@ declare module OpenEO {
412412
/**
413413
* Given just the string ID of a backend within the federation, returns that backend's full details as a FederationBackend object
414414
*
415-
* @param {string} backendId The ID of a backend within the federation
416-
* @returns {FederationBackend} The full details of the backend, or `undefined` if no backend with the given ID exists
415+
* @param {string} backendId - The ID of a backend within the federation
416+
* @returns {FederationBackend} The full details of the backend, or `null` if no backend with the given ID exists
417417
*/
418-
getFederationBackendById(backendId: string): FederationBackend | undefined;
418+
getFederationBackend(backendId: string): FederationBackend | null;
419419
/**
420420
* Given a list of string IDs of backends within the federation, returns those backends' full details as FederationBackend objects
421421
*
422-
* @param {Array<string>} backendIds The IDs of backends within the federation
423-
* @returns {Array<FederationBackend>} An array in the same order as the input, containing for each position either the full details of the backend, or `undefined` if no backend with the given ID exists
422+
* @param {Array<string>} backendIds - The IDs of backends within the federation
423+
* @returns {Array<FederationBackend>} An array in the same order as the input, containing for each position either the full details of the backend, or `null` if no backend with the given ID exists
424424
*/
425-
getFederationBackendsByIds(backendIds: Array<string>): Array<FederationBackend | undefined>;
425+
getFederationBackends(backendIds: Array<string>): Array<FederationBackend | null>;
426426
/**
427427
* Lists all supported features.
428428
*

src/capabilities.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,23 +212,23 @@ class Capabilities {
212212
/**
213213
* Given just the string ID of a backend within the federation, returns that backend's full details as a FederationBackend object
214214
*
215-
* @param {string} backendId The ID of a backend within the federation
216-
* @returns {FederationBackend | undefined} The full details of the backend, or `undefined` if no backend with the given ID exists
215+
* @param {string} backendId - The ID of a backend within the federation
216+
* @returns {FederationBackend | null} The full details of the backend, or `null` if no backend with the given ID exists
217217
*/
218-
getFederationBackendById(backendId) {
219-
// Add `id` property to make it a proper FederationBackend object, but check for undefined case beforehand
220-
return this.data.federation[backendId] ? { id: backendId, ...this.data.federation[backendId] } : undefined;
218+
getFederationBackend(backendId) {
219+
// Add `id` property to make it a proper FederationBackend object, but check for null case beforehand
220+
return this.data.federation[backendId] ? { id: backendId, ...this.data.federation[backendId] } : null;
221221
}
222222

223223
/**
224224
* Given a list of string IDs of backends within the federation, returns those backends' full details as FederationBackend objects
225225
*
226-
* @param {Array<string>} backendIds The IDs of backends within the federation
227-
* @returns {Array<FederationBackend | undefined>} An array in the same order as the input, containing for each position either the full details of the backend, or `undefined` if no backend with the given ID exists
226+
* @param {Array<string>} backendIds - The IDs of backends within the federation
227+
* @returns {Array<FederationBackend | null>} An array in the same order as the input, containing for each position either the full details of the backend, or `null` if no backend with the given ID exists
228228
*/
229-
getFederationBackendsByIds(backendIds) {
229+
getFederationBackends(backendIds) {
230230
// Let 'single case' function do the work, but pass `this` so that `this.data.federation` can be accessed in the callback context
231-
return backendIds.map(this.getFederationBackendById, this);
231+
return backendIds.map(this.getFederationBackend, this);
232232
}
233233

234234
/**

0 commit comments

Comments
 (0)