diff --git a/src/common/getters.ts b/src/common/getters.ts index f6328c56..db5b5db6 100644 --- a/src/common/getters.ts +++ b/src/common/getters.ts @@ -37,7 +37,7 @@ import { DataFactory } from "n3"; import type { AccessGrantGConsent } from "../gConsent/type/AccessGrant"; import type { AccessModes } from "../type/AccessModes"; import { INHERIT, TYPE, XSD_BOOLEAN, acl, gc, ldp } from "./constants"; -import type { CustomFields } from "../type/CustomFields"; +import type { CustomField } from "../type/CustomFields"; const { namedNode, defaultGraph, quad, literal } = DataFactory; diff --git a/src/gConsent/manage/approveAccessRequest.ts b/src/gConsent/manage/approveAccessRequest.ts index 97cd9037..0da7b1ce 100644 --- a/src/gConsent/manage/approveAccessRequest.ts +++ b/src/gConsent/manage/approveAccessRequest.ts @@ -51,12 +51,12 @@ import { getBaseAccess } from "../util/getBaseAccessVerifiableCredential"; import { initializeGrantParameters } from "../util/initializeGrantParameters"; import { getGrantBody, issueAccessVc } from "../util/issueAccessVc"; import { toVcDataset } from "../../common/util/toVcDataset"; -import type { CustomFields } from "../../type/CustomFields"; +import type { CustomField } from "../../type/CustomFields"; export type ApproveAccessRequestOverrides = Omit< Omit, "expirationDate" -> & { expirationDate?: Date | null; customFields?: Set }; +> & { expirationDate?: Date | null; customFields?: Set }; /** * Internal function. This is a stopgap until we have proper JSON-LD parsing. diff --git a/src/gConsent/request/issueAccessRequest.ts b/src/gConsent/request/issueAccessRequest.ts index f0e5da56..f49e8088 100644 --- a/src/gConsent/request/issueAccessRequest.ts +++ b/src/gConsent/request/issueAccessRequest.ts @@ -31,7 +31,7 @@ import type { IssueAccessRequestParameters, } from "../type/IssueAccessRequestParameters"; import type { AccessRequest } from "../type/AccessRequest"; -import { type CustomFields, toJson } from "../../type/CustomFields"; +import { type CustomField, toJson } from "../../type/CustomFields"; import { isAccessRequest, isRdfjsAccessRequest, @@ -86,7 +86,7 @@ async function issueAccessRequest( params: IssueAccessRequestParameters, options: AccessBaseOptions & { returnLegacyJsonld: false; - customFields?: Set; + customFields?: Set; }, ): Promise; /** @@ -102,7 +102,7 @@ async function issueAccessRequest( params: IssueAccessRequestParameters, options?: AccessBaseOptions & { returnLegacyJsonld?: true; - customFields?: Set; + customFields?: Set; }, ): Promise; /** @@ -118,7 +118,7 @@ async function issueAccessRequest( params: IssueAccessRequestParameters, options?: AccessBaseOptions & { returnLegacyJsonld?: boolean; - customFields?: Set; + customFields?: Set; }, ): Promise; /** @@ -128,13 +128,13 @@ async function issueAccessRequest( params: DeprecatedAccessRequestParameters, options?: AccessBaseOptions & { returnLegacyJsonld?: boolean; - customFields?: Set; + customFields?: Set; }, ): Promise; async function issueAccessRequest( params: IssueAccessRequestParameters, options: AccessBaseOptions & { - customFields?: Set; + customFields?: Set; returnLegacyJsonld?: boolean; } = {}, ): Promise { diff --git a/src/gConsent/util/issueAccessVc.ts b/src/gConsent/util/issueAccessVc.ts index cff595bb..90776356 100644 --- a/src/gConsent/util/issueAccessVc.ts +++ b/src/gConsent/util/issueAccessVc.ts @@ -52,7 +52,7 @@ import { getAccessApiEndpoint } from "../discover/getAccessApiEndpoint"; import { accessToResourceAccessModeArray } from "./accessToResourceAccessModeArray"; import { isBaseRequest } from "../guard/isBaseRequest"; import type { AccessCredentialType } from "../type/AccessCredentialType"; -import type { CustomFields } from "../../type/CustomFields"; +import type { CustomField } from "../../type/CustomFields"; function getGConsentAttributes( params: AccessRequestParameters, @@ -147,7 +147,7 @@ function getBaseBody( export function getRequestBody( params: AccessRequestParameters, - options?: Partial<{ customFields: Record }>, + options?: Partial<{ customFields: Record }>, ): AccessRequestBody { const base = getBaseBody(params, "BaseRequestBody") as AccessRequestBody; if (typeof options?.customFields === "object") { diff --git a/src/index.ts b/src/index.ts index 32f6b4f3..d6260dec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,7 +37,7 @@ export type { AccessParameters } from "./gConsent/manage/getAccessGrantAll"; export type { AccessGrantAny } from "./type/AccessGrant"; export type { AccessModes } from "./type/AccessModes"; -export type { CustomFields } from "./type/CustomFields"; +export type { CustomField as CustomFields } from "./type/CustomFields"; export type { FetchOptions } from "./type/FetchOptions"; export type { RedirectOptions } from "./type/RedirectOptions"; diff --git a/src/type/CustomFields.ts b/src/type/CustomFields.ts index 6fbcc20d..bfe1bb5e 100644 --- a/src/type/CustomFields.ts +++ b/src/type/CustomFields.ts @@ -19,7 +19,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -export type CustomFields = { +export type CustomField = { /* The custom field name (this must be a URL). */ key: URL; /* The custom field value (this must be a literal). */ @@ -33,8 +33,8 @@ export type CustomFields = { * @hidden */ export const toJson = ( - c: Set = new Set(), -): Record => { + c: Set = new Set(), +): Record => { return ( Array.from(c) // Check that all the provided custom fields match the expected type, @@ -50,7 +50,7 @@ export const toJson = ( // Collapse all the JSON object entries into a single object. .reduce( (acc, cur) => Object.assign(acc, cur), - {} as Record, + {} as Record, ) ); };