1 line
16 KiB
JSON
1 line
16 KiB
JSON
{"path":"NexusReader.UI.Shared/Services/WebStorageService.cs","purpose":"Provides a web-local-storage backed implementation of INativeStorageService for Blazor/JS runtime using IJSRuntime to persist and read simple string/bool values with Result wrapping and basic error handling.","classification":{"role":"service","layer":"frontend","confidence":0.9,"evidence":["Service naming pattern","Application/service path heuristic","namespace NexusReader.UI.Shared.Services","class implements INativeStorageService","uses IJSRuntime to call localStorage.*"]},"className":"WebStorageService","methods":[{"name":"SaveStringAsync","line":16,"endLine":27,"signature":"(key: string, value: string) -> Task<Result>","purpose":"Saves a string value into browser localStorage under the given key and returns a Result indicating success or failure.","calls":[],"actions":[{"id":"savestringasync_try_18_0","kind":"try","label":"Begins protected execution","line":18,"detail":"try","visibility":"primary-visible","confidence":0.84},{"id":"try-catch_18","kind":"mapping","label":"Wraps JS call with exception handling","line":18,"detail":"try => return Result.Ok(); catch(Exception ex) => return Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"external-call_20","kind":"external-call","label":"Invoke JS localStorage.setItem","line":20,"detail":"_jsRuntime.InvokeVoidAsync(\"localStorage.setItem\", key, value)","visibility":"detail-only","confidence":0.7},{"id":"savestringasync_await_20_1","kind":"await","label":"Waits for async work","line":20,"detail":"await _jsRuntime.InvokeVoidAsync(\"localStorage.setItem\", key, value);","visibility":"secondary-visible","confidence":0.81},{"id":"savestringasync_return_21_2","kind":"return","label":"Returns result","line":21,"detail":"return Result.Ok();","visibility":"detail-only","confidence":0.7},{"id":"return_21","kind":"return","label":"success","line":21,"detail":"Result.Ok()","visibility":"detail-only","confidence":0.7},{"id":"savestringasync_catch_23_3","kind":"catch","label":"Handles exception path","line":23,"detail":"catch (Exception ex)","conditionSummary":"Exception ex","outcomeLabels":["handled exception"],"visibility":"primary-visible","confidence":0.86},{"id":"return_25","kind":"return","label":"failure","line":25,"detail":"Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"savestringasync_return_25_4","kind":"return","label":"Returns result","line":25,"detail":"return Result.Fail(ex.Message);","visibility":"detail-only","confidence":0.7}]},{"name":"GetStringAsync","line":29,"endLine":40,"signature":"(key: string) -> Task<Result<string?>>","purpose":"Reads a string value from browser localStorage for the given key and returns it wrapped in a Result; failures produce a failed Result.","calls":[],"actions":[{"id":"getstringasync_try_31_0","kind":"try","label":"Begins protected execution","line":31,"detail":"try","visibility":"primary-visible","confidence":0.84},{"id":"try-catch_31","kind":"mapping","label":"Wraps JS call with exception handling","line":31,"detail":"try => return Result.Ok(value); catch(Exception ex) => return Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"external-call_33","kind":"external-call","label":"Invoke JS localStorage.getItem","line":33,"detail":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","visibility":"detail-only","confidence":0.7},{"id":"getstringasync_await_33_1","kind":"await","label":"Waits for async work","line":33,"detail":"var value = await _jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key);","visibility":"secondary-visible","confidence":0.81},{"id":"getstringasync_return_34_2","kind":"return","label":"Returns result","line":34,"detail":"return Result.Ok(value);","visibility":"detail-only","confidence":0.7},{"id":"return_34","kind":"return","label":"success","line":34,"detail":"Result.Ok(value)","visibility":"detail-only","confidence":0.7},{"id":"getstringasync_catch_36_3","kind":"catch","label":"Handles exception path","line":36,"detail":"catch (Exception ex)","conditionSummary":"Exception ex","outcomeLabels":["handled exception"],"visibility":"primary-visible","confidence":0.86},{"id":"return_38","kind":"return","label":"failure","line":38,"detail":"Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"getstringasync_return_38_4","kind":"return","label":"Returns result","line":38,"detail":"return Result.Fail(ex.Message);","visibility":"detail-only","confidence":0.7}]},{"name":"SaveBoolAsync","line":42,"endLine":42,"signature":"(key: string, value: bool) -> Task<Result>","purpose":"Convenience wrapper that saves a boolean by converting it to string and delegating to SaveStringAsync.","calls":[{"targetFile":"self","targetMethod":"SaveStringAsync","callLine":42,"paramSummary":"key, value.ToString()"}],"actions":[{"id":"delegate-call_42","kind":"mapping","label":"delegates to SaveStringAsync","line":42,"detail":"SaveStringAsync(key, value.ToString())","visibility":"detail-only","confidence":0.7}]},{"name":"GetBoolAsync","line":44,"endLine":56,"signature":"(key: string, defaultValue: bool = false) -> Task<Result<bool>>","purpose":"Reads a stored string for the key, attempts to parse it as bool, and returns the parsed value or a default wrapped in a Result; catches errors and returns the default.","calls":[],"actions":[{"id":"getboolasync_try_46_0","kind":"try","label":"Begins protected execution","line":46,"detail":"try","visibility":"primary-visible","confidence":0.84},{"id":"external-call_48","kind":"external-call","label":"Invoke JS localStorage.getItem","line":48,"detail":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","visibility":"detail-only","confidence":0.7},{"id":"getboolasync_await_48_1","kind":"await","label":"Waits for async work","line":48,"detail":"var value = await _jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key);","visibility":"secondary-visible","confidence":0.81},{"id":"guard-clause_49","kind":"guard-clause","label":"Empty or null stored value -> return default","line":49,"detail":"if empty => Result.Ok(defaultValue)","conditionSummary":"string.IsNullOrEmpty(value)","outcomeLabels":["return default","continue"],"visibility":"detail-only","confidence":0.7},{"id":"getboolasync_guard-clause_49_2","kind":"guard-clause","label":"Guards early exit or rejection path","line":49,"detail":"if (string.IsNullOrEmpty(value)) return Result.Ok(defaultValue);","conditionSummary":"string.IsNullOrEmpty(value)) return Result.Ok(defaultValue","outcomeLabels":["exit","continue"],"visibility":"primary-visible","confidence":0.9},{"id":"getboolasync_return_50_3","kind":"return","label":"Returns result","line":50,"detail":"return Result.Ok(bool.TryParse(value, out var result) ? result : defaultValue);","visibility":"detail-only","confidence":0.7},{"id":"branch_50","kind":"branch","label":"Try parse bool with fallback","line":50,"detail":"returns parsed result when parse succeeds, otherwise defaultValue","conditionSummary":"bool.TryParse(value, out result)","outcomeLabels":["parsed bool","use default"],"visibility":"detail-only","confidence":0.7},{"id":"getboolasync_catch_52_4","kind":"catch","label":"Handles exception path","line":52,"detail":"catch","outcomeLabels":["handled exception"],"visibility":"primary-visible","confidence":0.86},{"id":"try-catch_52","kind":"mapping","label":"Returns default on any exception","line":52,"detail":"catch => Result.Ok(defaultValue)","visibility":"detail-only","confidence":0.7},{"id":"getboolasync_return_54_5","kind":"return","label":"Returns result","line":54,"detail":"return Result.Ok(defaultValue);","visibility":"detail-only","confidence":0.7}]},{"name":"RemoveAsync","line":58,"endLine":69,"signature":"(key: string) -> Task<Result>","purpose":"Removes an item from browser localStorage by key and returns Result success/failure.","calls":[],"actions":[{"id":"removeasync_try_60_0","kind":"try","label":"Begins protected execution","line":60,"detail":"try","visibility":"primary-visible","confidence":0.84},{"id":"try-catch_60","kind":"mapping","label":"Wraps JS call with exception handling","line":60,"detail":"try => Result.Ok(); catch(Exception ex) => Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"external-call_62","kind":"external-call","label":"Invoke JS localStorage.removeItem","line":62,"detail":"_jsRuntime.InvokeVoidAsync(\"localStorage.removeItem\", key)","visibility":"detail-only","confidence":0.7},{"id":"removeasync_await_62_1","kind":"await","label":"Waits for async work","line":62,"detail":"await _jsRuntime.InvokeVoidAsync(\"localStorage.removeItem\", key);","visibility":"secondary-visible","confidence":0.81},{"id":"removeasync_return_63_2","kind":"return","label":"Returns result","line":63,"detail":"return Result.Ok();","visibility":"detail-only","confidence":0.7},{"id":"return_63","kind":"return","label":"success","line":63,"detail":"Result.Ok()","visibility":"detail-only","confidence":0.7},{"id":"removeasync_catch_65_3","kind":"catch","label":"Handles exception path","line":65,"detail":"catch (Exception ex)","conditionSummary":"Exception ex","outcomeLabels":["handled exception"],"visibility":"primary-visible","confidence":0.86},{"id":"return_67","kind":"return","label":"failure","line":67,"detail":"Result.Fail(ex.Message)","visibility":"detail-only","confidence":0.7},{"id":"removeasync_return_67_4","kind":"return","label":"Returns result","line":67,"detail":"return Result.Fail(ex.Message);","visibility":"detail-only","confidence":0.7}]},{"name":"SaveSecureString","line":71,"endLine":71,"signature":"(key: string, value: string) -> Task<Result>","purpose":"Secure-named wrapper that currently delegates to SaveStringAsync (no extra security applied).","calls":[{"targetFile":"self","targetMethod":"SaveStringAsync","callLine":71,"paramSummary":"key, value"}],"actions":[{"id":"delegate-call_71","kind":"mapping","label":"delegates to SaveStringAsync","line":71,"detail":"await SaveStringAsync(key, value)","visibility":"detail-only","confidence":0.7},{"id":"savesecurestring_await_71_0","kind":"await","label":"Waits for async work","line":71,"detail":"public async Task<Result> SaveSecureString(string key, string value) => await SaveStringAsync(key, value);","visibility":"secondary-visible","confidence":0.81}]},{"name":"GetSecureString","line":73,"endLine":73,"signature":"(key: string) -> Task<Result<string?>>","purpose":"Secure-named wrapper that delegates to GetStringAsync (no extra security applied).","calls":[{"targetFile":"self","targetMethod":"GetStringAsync","callLine":73,"paramSummary":"key"}],"actions":[{"id":"delegate-call_73","kind":"mapping","label":"delegates to GetStringAsync","line":73,"detail":"await GetStringAsync(key)","visibility":"detail-only","confidence":0.7},{"id":"getsecurestring_await_73_0","kind":"await","label":"Waits for async work","line":73,"detail":"public async Task<Result<string?>> GetSecureString(string key) => await GetStringAsync(key);","visibility":"secondary-visible","confidence":0.81}]},{"name":"RemoveSecureAsync","line":75,"endLine":75,"signature":"(key: string) -> Task<Result>","purpose":"Secure-named wrapper that delegates to RemoveAsync (no extra security applied).","calls":[{"targetFile":"self","targetMethod":"RemoveAsync","callLine":75,"paramSummary":"key"}],"actions":[{"id":"delegate-call_75","kind":"mapping","label":"delegates to RemoveAsync","line":75,"detail":"RemoveAsync(key)","visibility":"detail-only","confidence":0.7}]}],"types":[],"serviceRegistrations":[],"startupActions":[],"dependencies":["NexusReader.Application.Abstractions.Services (INativeStorageService)","Microsoft.JSInterop (IJSRuntime)","FluentResults (Result)"],"patterns":["Adapter","Wrapper","LocalStorage adapter"],"domainConcepts":["LocalStorage","Key-Value persistence","Platform-native storage abstraction"],"keyDetails":"Implements INativeStorageService for web Blazor clients via IJSRuntime localStorage calls; secure-named methods currently just delegate to plain methods (no added encryption).","orchestrationMethods":[{"name":"GetBoolAsync","line":44,"confidence":0.69,"reason":"Contains 2 architectural actions relevant to business execution.","actionKinds":["try","external-call","await","guard-clause","return","branch","catch","mapping"],"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"name":"SaveStringAsync","line":16,"confidence":0.57,"reason":"Contains 1 architectural actions relevant to business execution.","actionKinds":["try","mapping","external-call","await","return","catch"],"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"name":"GetStringAsync","line":29,"confidence":0.57,"reason":"Contains 1 architectural actions relevant to business execution.","actionKinds":["try","mapping","external-call","await","return","catch"],"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"name":"RemoveAsync","line":58,"confidence":0.57,"reason":"Contains 1 architectural actions relevant to business execution.","actionKinds":["try","mapping","external-call","await","return","catch"],"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]}],"typedContracts":[],"persistenceInteractions":[],"externalInteractions":[{"methodName":"SaveStringAsync","line":20,"kind":"external-call","detail":"_jsRuntime.InvokeVoidAsync(\"localStorage.setItem\", key, value)","evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"methodName":"GetStringAsync","line":33,"kind":"external-call","detail":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"methodName":"GetBoolAsync","line":48,"kind":"external-call","detail":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"methodName":"RemoveAsync","line":62,"kind":"external-call","detail":"_jsRuntime.InvokeVoidAsync(\"localStorage.removeItem\", key)","evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]}],"evidenceAnchors":[{"kind":"orchestration-method","label":"GetBoolAsync","line":44,"summary":"Contains 2 architectural actions relevant to business execution.","confidence":0.69,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"orchestration-method","label":"SaveStringAsync","line":16,"summary":"Contains 1 architectural actions relevant to business execution.","confidence":0.57,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"orchestration-method","label":"GetStringAsync","line":29,"summary":"Contains 1 architectural actions relevant to business execution.","confidence":0.57,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"orchestration-method","label":"RemoveAsync","line":58,"summary":"Contains 1 architectural actions relevant to business execution.","confidence":0.57,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"external-call","label":"SaveStringAsync","line":20,"summary":"_jsRuntime.InvokeVoidAsync(\"localStorage.setItem\", key, value)","confidence":0.8,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"external-call","label":"GetStringAsync","line":33,"summary":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","confidence":0.8,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]},{"kind":"external-call","label":"GetBoolAsync","line":48,"summary":"_jsRuntime.InvokeAsync<string?>(\"localStorage.getItem\", key)","confidence":0.8,"evidencePaths":["NexusReader.UI.Shared/Services/WebStorageService.cs"]}],"cacheMetadata":{"schemaVersion":2,"analysisVersion":"2026-05-23.cache-v1","contentChecksum":"2f084abb98ae2db0b48ff37b2810ec23572153db3f3a3b87899f31b514ac3d39","sourceByteSize":2243,"analyzedAt":"2026-05-23T16:23:08.513Z","technology":"dotnet"}} |