From 3b9b61c1ec10f9a5bbb65e5470258f0302b51836 Mon Sep 17 00:00:00 2001 From: Zwifi Date: Thu, 19 Dec 2024 12:53:59 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Pete Edwards --- CHANGELOG.md | 6 +++--- src/gConsent/query/query.ts | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7842c58..42ef3129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ The following changes are pending, and will be applied on the next major release Although the two functions behavior is different, they can be used to achieve similar results. - The `gConsent` and all of `gConsent/*` submodules are deprecated. The former can - be replaced by a regular import of the library, and the latters can be replaced + be replaced by a regular import of the library, and the latter can be replaced with the equivalent non-gConsent submodules (e.g. `gConsent/manage` can be replaced with `manage`). There is no functionality change between the two. @@ -24,8 +24,8 @@ The following changes are pending, and will be applied on the next major release custom fields, and via a set of dedicated getters in the `getters/` module. A generic getter is introduced, `getCustomFields`, as well as a set of typed helpers, such as `getCustomInteger`. Typed helpers are available for integers, floats, strings and booleans. -- Support new query endpoint: the new `query` function allows to query for Access Credentials using - the newly introduce ESS endpoint. +- Support new query endpoint: the new `query` function enables querying for Access Credentials using + the newly introduced ESS endpoint. ## [3.1.1](https://github.com/inrupt/solid-client-access-grants-js/releases/tag/v3.1.1) - 2024-10-23 diff --git a/src/gConsent/query/query.ts b/src/gConsent/query/query.ts index cb87fd3a..24a1285d 100644 --- a/src/gConsent/query/query.ts +++ b/src/gConsent/query/query.ts @@ -27,7 +27,7 @@ import { verifiableCredentialToDataset } from "@inrupt/solid-client-vc"; import type { UrlString } from "@inrupt/solid-client"; /** - * Supported Access Credentials status + * Supported Access Credential statuses */ export type CredentialStatus = | "Pending" @@ -58,11 +58,11 @@ export const DURATION = { export type CredentialFilter = { /** - * The Access Credential type (e.g. Access Request, Access Grant...) + * The Access Credential type (e.g. Access Request, Access Grant...). */ type?: CredentialType; /** - * The Access Credential status (e.g. Active, Revoked...) + * The Access Credential status (e.g. Active, Revoked...). */ status?: CredentialStatus; /** @@ -82,11 +82,11 @@ export type CredentialFilter = { */ purpose?: UrlString; /** - * Interval (expressed using ISO 8601) during which the Credential was issued. + * Period (expressed using ISO 8601) during which the Credential was issued. */ issuedWithin?: "P1D" | "P7D" | "P1M" | "P3M"; /** - * Interval (expressed using ISO 8601) during which the Credential was revoked. + * Period (expressed using ISO 8601) during which the Credential was revoked. */ revokedWithin?: "P1D" | "P7D" | "P1M" | "P3M"; /** @@ -177,7 +177,7 @@ async function toCredentialResult( const link = parsedLinks.get("rel", rel); if (link.length > 1) { throw Error( - `Unexpected response, found more than one ${rel} Link headers.`, + `Unexpected response, found more than one [${rel}] Link headers.`, ); } if (link.length === 0) { @@ -213,15 +213,15 @@ function toQueryUrl(endpoint: URL, filter: CredentialFilter): URL { /** * Query for Access Requests or Access Grants based on a given filter. * - * @param filter the query filter - * @param options query options + * @param filter The query filter + * @param options Query options * @returns a paginated set of Access Credential matching the given filter * @since unreleased * * @example * ``` * // Get the first results page. - * const activeGrantsToday = await query( + * const activeGrantsWithinDay = await query( * { * type: "SolidAccessGrant", * status: "Active", @@ -233,8 +233,8 @@ function toQueryUrl(endpoint: URL, filter: CredentialFilter): URL { * }, * ); * // Get the next results page. - * const activeGrantsToday2 = await query( - * activeGrantsToday.next, + * const activeGrantsWithinDay2 = await query( + * activeGrantsWithinDay.next, * { * fetch: session.fetch, * queryEndpoint: config.queryEndpoint,