From 304e5c99ff74eb418faef09693285644c268867b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20Dr=C3=A9an?= Date: Fri, 3 Apr 2026 22:26:11 +0200 Subject: [PATCH] docs: fix TypeDoc config and add missing JSDoc @returns tags --- README.md | 6 +++--- src/common/config/config.service.ts | 18 +++++++++--------- src/jobs/jobs.types.ts | 1 - src/tasks/key-generation/key-generation.dto.ts | 10 ++++++++++ typedoc.json | 17 ++++++++++++++--- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 69b47cf..a8ddfb6 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,9 @@ Authorization: Bearer } ``` -* `JobType`: see [documentation](./docs/enums/jobs_jobs.types.JobType.html) for possible enum values. -* `JobStatus`: see [documentation](./docs/enums/jobs_jobs.types.JobStatus.html) for possible enum values. -* `JobResult`: see [documentation](./docs/types/jobs_jobs.types.JobResult.html) for possible result structures. +* `JobType`: see [documentation](https://shreeed-app.github.io/multi-party-computation-controller-api/enums/jobs_jobs.types.JobType.html) for possible enum values. +* `JobStatus`: see [documentation](https://shreeed-app.github.io/multi-party-computation-controller-api/enums/jobs_jobs.types.JobStatus.html) for possible enum values. +* `JobResult`: see [documentation](https://shreeed-app.github.io/multi-party-computation-controller-api/types/jobs_jobs.types.JobResult.html) for possible result structures. **Error response:** `404 Not Found` - job does not exist. diff --git a/src/common/config/config.service.ts b/src/common/config/config.service.ts index 7ec2806..548b042 100644 --- a/src/common/config/config.service.ts +++ b/src/common/config/config.service.ts @@ -41,7 +41,7 @@ class AppConfigService { /** * Current application environment, e.g. "development", "production". * - * @returns The current environment string. + * @returns {string} The current environment string. */ public get environment(): string { return this.getRequiredString(ConfigKeySchema.NODE_ENV); @@ -50,7 +50,7 @@ class AppConfigService { /** * TCP port on which the HTTP server listens. * - * @returns The configured port number; defaults to 3000. + * @returns {number} The configured port number; defaults to 3000. */ public get port(): number { return ( @@ -62,7 +62,7 @@ class AppConfigService { * Bearer token that client backends must present in the `Authorization` * header. * - * @returns The configured client bearer token. + * @returns {string} The configured client bearer token. */ public get clientBearerToken(): string { return this.getRequiredString(ConfigKeySchema.CLIENT_BEARER_TOKEN); @@ -71,7 +71,7 @@ class AppConfigService { /** * Hostname or IP address of the Rust controller engine gRPC server. * - * @returns The engine host string. + * @returns {string} The engine host string. */ public get rustEngineHost(): string { return this.getRequiredString(ConfigKeySchema.CRYPTOGRAPHIC_ENGINE_HOST); @@ -80,7 +80,7 @@ class AppConfigService { /** * Port of the Rust controller engine gRPC server. * - * @returns The engine port number. + * @returns {number} The engine port number. */ public get rustEnginePort(): number { return this.getRequiredNumber(ConfigKeySchema.CRYPTOGRAPHIC_ENGINE_PORT); @@ -90,7 +90,7 @@ class AppConfigService { * Bearer token injected into gRPC metadata for every call to the Rust * engine. * - * @returns The engine bearer token. + * @returns {string} The engine bearer token. */ public get rustEngineBearerToken(): string { return this.getRequiredString( @@ -101,7 +101,7 @@ class AppConfigService { /** * Hostname or IP address of the Redis instance. * - * @returns The Redis host string. + * @returns {string} The Redis host string. */ public get redisHost(): string { return this.getRequiredString(ConfigKeySchema.REDIS_HOST); @@ -110,7 +110,7 @@ class AppConfigService { /** * Port of the Redis instance. * - * @returns The Redis port number. + * @returns {number} The Redis port number. */ public get redisPort(): number { return this.getRequiredNumber(ConfigKeySchema.REDIS_PORT); @@ -119,7 +119,7 @@ class AppConfigService { /** * Directory where daily log files are written. * - * @returns The log directory path string. Defaults to "logs". + * @returns {string} The log directory path string. Defaults to "logs". */ public get logDirectory(): string { return this.getRequiredString(ConfigKeySchema.LOG_DIRECTORY); diff --git a/src/jobs/jobs.types.ts b/src/jobs/jobs.types.ts index 21a2c12..c3be016 100644 --- a/src/jobs/jobs.types.ts +++ b/src/jobs/jobs.types.ts @@ -27,7 +27,6 @@ enum JobType { SIGNING = "signing", } -// #JobResult /** Union of all possible job result payloads. */ type JobResult = KeyGenerationJobResult | SigningJobResult; diff --git a/src/tasks/key-generation/key-generation.dto.ts b/src/tasks/key-generation/key-generation.dto.ts index 14c5cbc..43399de 100644 --- a/src/tasks/key-generation/key-generation.dto.ts +++ b/src/tasks/key-generation/key-generation.dto.ts @@ -24,12 +24,22 @@ import { v4 } from "uuid"; */ @ValidatorConstraint({ name: "thresholdWithinParticipants", async: false }) class ThresholdWithinParticipants implements ValidatorConstraintInterface { + /** + * @param {number} threshold - The threshold value to validate. + * @param {ValidationArguments} args - Context containing the parent DTO. + * @returns {boolean} `true` if threshold is within participants or not yet + * parseable. + */ validate(threshold: number, { object }: ValidationArguments): boolean { const dto: KeyGenerationRequestDto = object as KeyGenerationRequestDto; // If `participants` hasn't been parsed yet, defer to its own validator. return dto.participants === undefined || threshold <= dto.participants; } + + /** + * @returns {string} The default validation failure message. + */ defaultMessage({ value }: ValidationArguments): string { return `Threshold (${value as number}) must not exceed participants.`; } diff --git a/typedoc.json b/typedoc.json index f67325d..85080d8 100644 --- a/typedoc.json +++ b/typedoc.json @@ -2,12 +2,23 @@ "entryPoints": ["src"], "entryPointStrategy": "expand", "out": "docs", - "excludePrivate": true, - "excludeProtected": true, - "excludeInternal": true, + "excludePrivate": false, + "excludeProtected": false, + "excludeInternal": false, "readme": "none", "disableSources": false, "navigation": { "includeCategories": true + }, + "externalSymbolLinkMappings": { + "@types/node": { + "\"crypto\".timingSafeEqual": "#" + }, + "@nestjs/common": { + "UnauthorizedException": "#" + }, + "@grpc/grpc-js": { + "Metadata": "#" + } } }