forked from jsnbuchanan/crowd-funder-for-time-pwa
docs: add comprehensive JSDoc documentation to service layer
Add detailed TypeScript JSDoc documentation to core service modules: - api.ts: Document error handling utilities and platform-specific logging - plan.ts: Document plan/claim loading with retry mechanism - deepLinks.ts: Document URL parsing and routing functionality - Platform services: - CapacitorPlatformService: Document mobile platform capabilities - ElectronPlatformService: Document desktop placeholder implementation - PyWebViewPlatformService: Document Python bridge placeholder - WebPlatformService: Document web platform limitations and features Key improvements: - Add detailed @remarks sections explaining implementation details - Include usage examples with TypeScript code snippets - Document error handling and platform-specific behaviors - Add @todo tags for unimplemented features - Fix PlanResponse interface to include headers property This documentation enhances code maintainability and developer experience by providing clear guidance on service layer functionality and usage.
This commit is contained in:
@@ -23,6 +23,23 @@
|
||||
* - Query parameter validation and sanitization
|
||||
* - Type-safe parameter passing to router
|
||||
*
|
||||
* Deep Link Format:
|
||||
* timesafari://<route>[/<param>][?queryParam1=value1&queryParam2=value2]
|
||||
*
|
||||
* Supported Routes:
|
||||
* - user-profile: View user profile
|
||||
* - project-details: View project details
|
||||
* - onboard-meeting-setup: Setup onboarding meeting
|
||||
* - invite-one-accept: Accept invitation
|
||||
* - contact-import: Import contacts
|
||||
* - confirm-gift: Confirm gift
|
||||
* - claim: View claim
|
||||
* - claim-cert: View claim certificate
|
||||
* - claim-add-raw: Add raw claim
|
||||
* - contact-edit: Edit contact
|
||||
* - contacts: View contacts
|
||||
* - did: View DID
|
||||
*
|
||||
* @example
|
||||
* const handler = new DeepLinkHandler(router);
|
||||
* await handler.handleDeepLink("timesafari://claim/123?view=details");
|
||||
@@ -38,15 +55,28 @@ import {
|
||||
import { logConsoleAndDb } from "../db";
|
||||
import type { DeepLinkError } from "../interfaces/deepLinks";
|
||||
|
||||
/**
|
||||
* Handles processing and routing of deep links in the application.
|
||||
* Provides validation, error handling, and routing for deep link URLs.
|
||||
*/
|
||||
export class DeepLinkHandler {
|
||||
private router: Router;
|
||||
|
||||
/**
|
||||
* Creates a new DeepLinkHandler instance.
|
||||
* @param router - Vue Router instance for navigation
|
||||
*/
|
||||
constructor(router: Router) {
|
||||
this.router = router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses deep link URL into path, params and query components
|
||||
* Parses deep link URL into path, params and query components.
|
||||
* Validates URL structure using Zod schemas.
|
||||
*
|
||||
* @param url - The deep link URL to parse (format: scheme://path[?query])
|
||||
* @throws {DeepLinkError} If URL format is invalid
|
||||
* @returns Parsed URL components (path, params, query)
|
||||
*/
|
||||
private parseDeepLink(url: string) {
|
||||
const parts = url.split("://");
|
||||
@@ -79,8 +109,11 @@ export class DeepLinkHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes incoming deep links and routes them appropriately
|
||||
* @param url The deep link URL to process
|
||||
* Processes incoming deep links and routes them appropriately.
|
||||
* Handles validation, error handling, and routing to the correct view.
|
||||
*
|
||||
* @param url - The deep link URL to process
|
||||
* @throws {DeepLinkError} If URL processing fails
|
||||
*/
|
||||
async handleDeepLink(url: string): Promise<void> {
|
||||
try {
|
||||
@@ -107,7 +140,13 @@ export class DeepLinkHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Routes the deep link to appropriate view with validated parameters
|
||||
* Routes the deep link to appropriate view with validated parameters.
|
||||
* Validates route and parameters using Zod schemas before routing.
|
||||
*
|
||||
* @param path - The route path from the deep link
|
||||
* @param params - URL parameters
|
||||
* @param query - Query string parameters
|
||||
* @throws {DeepLinkError} If validation fails or route is invalid
|
||||
*/
|
||||
private async validateAndRoute(
|
||||
path: string,
|
||||
|
||||
Reference in New Issue
Block a user