Open
Conversation
When localStorage is unavailable but node:fs is, persist data as JSON files under ~/.polkadot-apps/ (override with new storageDir option) instead of dropping writes silently. Replaces the misleading fallback to createLocalStorageBackend with an explicit createNoopBackend for edge runtimes that have neither.
Replace the in-house file-based StorageAdapter with a thin bridge to createKvStore from @polkadot-apps/storage, which now provides the same Node.js filesystem backend. node-storage.ts becomes a small adapter that translates the KvStore API to the novasama StorageAdapter shape, adding subscribe notifications and neverthrow wrapping. createTerminalAdapter is now async since it resolves the storage backend lazily; consumers must await the call.
@polkadot-api/ws-provider@0.7.5 (via polkadot-api@1.23.3) returns a JsonRpcProvider typed against @polkadot-api/json-rpc-provider@0.0.4 (string messages), while @novasamatech/statement-store@0.6.17's createLazyClient expects the same interface from json-rpc-provider@0.2.0 (typed JsonRpcMessage). The two are structurally incompatible in TypeScript but behaviorally identical at runtime. Cast at the single call site so terminal compiles cleanly. Remove when upstream packages converge on one json-rpc-provider version.
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
UtkarshBhardwaj007
approved these changes
Apr 14, 2026
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@polkadot-apps/storage": minor | |||
Member
There was a problem hiding this comment.
changeset for @polkadot-apps/terminal. createTerminalAdapter changed from sync to async - breaking change?
| async function set(key: string, value: string): Promise<void> { | ||
| try { | ||
| await ensureDir(); | ||
| await fs.writeFile(fp(key), value, "utf-8"); |
Member
There was a problem hiding this comment.
NIT: Consider write-to-temp-then-rename pattern: writeFile(fp(key) + '.tmp', value) then rename(fp(key) + '.tmp', fp(key)). rename is atomic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adding file-based kvstorage, mainly for cli usage.
Closes #92.