Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
278eaa9
feat: Add StorageService for offloading large controller data
andrepimenta Nov 19, 2025
e844fdd
refactor(storage-service): Move getAllKeys/clear logic to adapters
andrepimenta Nov 19, 2025
19c7d6f
refactor: Adapters now build storage keys (not core)
andrepimenta Nov 25, 2025
5fedbc0
refactor(storage-service): delegate key building and serialization to…
andrepimenta Nov 25, 2025
5af0861
docs(storage-service): update CHANGELOG for initial release
andrepimenta Nov 25, 2025
de5388c
docs(storage-service): fix CHANGELOG format
andrepimenta Nov 25, 2025
e493d3e
docs(storage-service): update README with current API and precise met…
andrepimenta Nov 25, 2025
81100c2
build: add storage-service to tsconfig.build.json
andrepimenta Nov 26, 2025
f5c5aec
Merge branch 'main' into storage-service
andrepimenta Nov 26, 2025
04939f6
docs(storage-service): add JSDoc guidance for large value storage
andrepimenta Nov 26, 2025
3fe4314
Update packages/storage-service/src/StorageService.ts
andrepimenta Nov 26, 2025
84adfd5
Update packages/storage-service/src/StorageService.ts
andrepimenta Nov 26, 2025
7ac8bfc
refactor(storage-service): remove itemRemoved events, keep only itemSet
andrepimenta Nov 27, 2025
24b150e
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 27, 2025
65efd41
chore(storage-service): add dual MIT+Apache2 license
andrepimenta Nov 27, 2025
60efad1
refactor(storage-service): use unknown instead of generic types
andrepimenta Nov 27, 2025
2222e57
refactor(storage-service): use generate-method-action-types pattern
andrepimenta Nov 27, 2025
ce68a05
Update packages/storage-service/package.json
andrepimenta Nov 27, 2025
afde837
docs(storage-service): simplify README to focus on usage
andrepimenta Nov 27, 2025
ae501a3
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 27, 2025
81c9cf8
docs(storage-service): simplify CHANGELOG for initial release
andrepimenta Nov 27, 2025
625eee6
fix(storage-service): change event payload order to [key, value]
andrepimenta Nov 27, 2025
bda7243
Merge branch 'main' into storage-service
andrepimenta Nov 27, 2025
d3a7e4e
Fix prettier
andrepimenta Nov 27, 2025
389e50a
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 27, 2025
3aeafac
Fix keywords
andrepimenta Nov 27, 2025
c46e2e2
Update packages/storage-service/package.json
andrepimenta Nov 27, 2025
1b48670
test(storage-service): add tests for itemSet event
andrepimenta Nov 27, 2025
8050f20
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 27, 2025
9a65054
refactor(storage-service): use Json type instead of unknown
andrepimenta Nov 27, 2025
d6fe459
chore(storage-service): add CODEOWNERS and teams.json entries
andrepimenta Nov 27, 2025
5b4faeb
Update packages/storage-service/src/StorageService.ts
andrepimenta Nov 28, 2025
363533a
Update packages/storage-service/src/InMemoryStorageAdapter.ts
andrepimenta Nov 28, 2025
f5ccb18
Update packages/storage-service/src/InMemoryStorageAdapter.ts
andrepimenta Nov 28, 2025
b5c5d79
feat(storage-service): add StorageGetResult type for getItem responses
andrepimenta Nov 28, 2025
8557995
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 28, 2025
7ccd865
Update packages/storage-service/CHANGELOG.md
andrepimenta Nov 28, 2025
a139816
fix(storage-service): fix prettier formatting in test
andrepimenta Nov 28, 2025
5598df9
Merge branch 'storage-service' of https://github.com/MetaMask/core in…
andrepimenta Nov 28, 2025
bbd8e39
Merge branch 'main' into storage-service
andrepimenta Nov 28, 2025
cf634fb
Prettier fix
andrepimenta Nov 28, 2025
6bf384a
Fix return types on StorageServiceGetItemAction
andrepimenta Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(storage-service): remove itemRemoved events, keep only itemSet
- Remove itemRemoved event publishing from removeItem() and clear()
- Remove StorageServiceItemRemovedEvent type
- Update StorageServiceEvents to only include itemSet
- Simplify API: controllers calling remove/clear already know what they're doing
- Update README and ADR documentation
  • Loading branch information
andrepimenta committed Nov 27, 2025
commit 7ac8bfc9966c8fc1dd23c7908f81e3b6f597bad2
2 changes: 0 additions & 2 deletions packages/storage-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ StorageService publishes events when data changes, enabling reactive patterns:
**Events published**:
- `StorageService:itemSet:{namespace}` - When data is stored
- Payload: `[value, key]`
- `StorageService:itemRemoved:{namespace}` - When data is removed
- Payload: `[key]`

**Example - Subscribe to changes**:
```typescript
Expand Down
9 changes: 0 additions & 9 deletions packages/storage-service/src/StorageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,6 @@ export class StorageService {
async removeItem(namespace: string, key: string): Promise<void> {
// Adapter builds full storage key (e.g., mobile: 'storageService:namespace:key')
await this.#storage.removeItem(namespace, key);

// Publish event so other controllers can react to removal
// Event type: StorageService:itemRemoved:namespace
// Payload: [key]
this.#messenger.publish(
`${SERVICE_NAME}:itemRemoved:${namespace}` as `${typeof SERVICE_NAME}:itemRemoved:${string}`,
key,
);
}

/**
Expand All @@ -221,7 +213,6 @@ export class StorageService {

/**
* Clear all data for a namespace.
* Delegates to storage adapter which handles clearing.
*
* @param namespace - Controller namespace (e.g., 'SnapController').
*/
Expand Down
1 change: 0 additions & 1 deletion packages/storage-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type {
StorageServiceGetAllKeysAction,
StorageServiceClearAction,
StorageServiceItemSetEvent,
StorageServiceItemRemovedEvent,
} from './types';

// Export service name and storage key prefix constants
Expand Down
13 changes: 1 addition & 12 deletions packages/storage-service/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,10 @@ export type StorageServiceItemSetEvent = {
payload: [value: unknown, key: string];
};

/**
* Event published when a storage item is removed.
* Event type includes namespace only, key passed in payload.
*/
export type StorageServiceItemRemovedEvent = {
type: `${typeof SERVICE_NAME}:itemRemoved:${string}`;
payload: [key: string];
};

/**
* All events that {@link StorageService} publishes.
*/
export type StorageServiceEvents =
| StorageServiceItemSetEvent
| StorageServiceItemRemovedEvent;
export type StorageServiceEvents = StorageServiceItemSetEvent;

/**
* Actions from other messengers that {@link StorageService} calls.
Expand Down