* Expand state provider fakes
- default null initial value for fake states
- Easier mocking of key definitions through just the use of key names
- allows for not exporting KeyDefinition as long as the key doesn't collide
- mock of fake state provider to verify `get` calls
- `nextMock` for use of the fn mock matchers on emissions of `state$`
- `FakeAccountService` which allows for easy initialization and working with account switching
* Small bug fix for cache key collision on key definitions unique by only storage location
* Fix initial value for test
#7290 introduced these types, but during development we switched over to specifying dependencies in type parameters instead of an object. This change meant we no longer needed these `Type` or `ShapeToInstance` types, greatly simplifying the types related to derived state.
* Remove derived state from state classes
* Create provider for derived state
Derived state is automatically stored to memory storage, but can be derived from any observable.
* Fixup state provider method definitions
* Test `DefaultDerivedState`
* remove implementation notes
* Write docs for derived state
* fixup derived state provider types
* Implement buffered delayUntil operator
* Move state types to a common module
* Move mock ports to centra location
* Alias DerivedStateDependency type
* Add dependencies to browser
* Prefer internal rxjs operators for ref counting
* WIP
* Ensure complete on subjects
* Foreground/background messaging for browser
Defers work for browser to the background
* Test foreground port behaviors
* Inject foreground and background derived state services
* remove unnecessary class field
* Adhere to required options
* Add dderived state to CLI
* Prefer type definition in type parameters to options
* Prefer instance method
* Implements factory methods for common uses
* Remove nothing test
* Remove share subject reference
Share manages connector subjects internally and will reuse them until
refcount is 0 and the cleanup time has passed. Saving our own reference
just risks memory leaks without real testability benefits.
* Fix interaction state
* Specify state provider for currently active user
* Split active and single user States
UserStateProvider is still the mechanism to build each State object.
The SingleUserState is basically a repeat of GlobalState, but with
additional scoping.
* Fixup global state cache
* fix fakers to new interface
* Make userId available in single user state
* Split providers by dependency requirements
This allows usage of the single state provider in contexts that would
otherwise form circular dependencies.
* Offer convenience wrapper classes for common use
* Import for docs
* Bind wrapped methods
* Handle switch messaging
TODO: handle loading state for account switcher
* Async updates required for state
* Fallback to email for current account avatar
* Await un-awaited promises
* Remove unnecessary Prune
Prune was getting confused in browser and deleting memory in browser on
account switch. This method isn't needed since logout already removes
memory data, which is the condition for pruning
* Fix temp password in browser
* Use direct memory access until data is serializable
Safari uses a different message object extraction than firefox/chrome
and is removing `UInt8Array`s. Until all data passed into StorageService
is guaranteed serializable, we need to use direct access in state
service
* Reload badge and context menu on switch
* Gracefully switch account as they log out.
* Maintain location on account switch
* Remove unused state definitions
* Prefer null for state
undefined can be misinterpreted to indicate a value has not been set.
* Hack: structured clone in memory storage
We are currently getting dead objects on account switch due to updating
the object in the foreground state service. However, the storage service
is owned by the background. This structured clone hack ensures that all
objects stored in memory are owned by the appropriate context
* Null check nullable values
active account can be null, so we should include null safety in the
equality
* Correct background->foreground switch command
* Already providing background memory storage
* Handle connection and clipboard on switch account
* Prefer strict equal
* Ensure structuredClone is available to jsdom
This is a deficiency in jsdom --
https://github.com/jsdom/jsdom/issues/3363 -- structured clone is well
supported.
* Fixup types in faker class