-
Notifications
You must be signed in to change notification settings - Fork 547
refactor(presence): Use branded JsonDeserialized type internally #24641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f6391fb
to
1c54887
Compare
@@ -172,12 +172,24 @@ export class PresenceDatastoreManagerImpl implements PresenceDatastoreManager { | |||
if (updateProviders.length > 3) { | |||
updateProviders.length = 3; | |||
} | |||
// TODO: #??? investigate and address `PresenceDatastore` incompatibility with `DatastoreMessageContent` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open a tracking issue.
@@ -146,12 +147,35 @@ export function prepareConnectedPresence( | |||
quorumClientIds.length = 3; | |||
} | |||
|
|||
const expectedClientJoin: OutboundClientJoinMessage & | |||
Partial<Pick<InboundClientJoinMessage, "clientId">> = generateBasicClientJoin(clock.now, { | |||
// TODO: #??? investigate and address `InboundClientJoinMessage` incompatibility with `OutboundClientJoinMessage` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File an issue.
} | ||
|
||
private broadcastAllKnownState(): void { | ||
// TODO: #??? investigate and address `PresenceDatastore` incompatibility with `DatastoreMessageContent` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all of these are incorrect. Likely you imported from the wrong path somewhere. See the note on lines 15-18.
…able Filtering the inner type when applying additional `JsonSerializable` filters broken the result down into `JsonTypeWith | Opaque` degenerate substitutes when `unknown` was sufficient already and would break the filter type checking. Now preserve the Opaque type's `T` as-is and rely on changes in `Controls` to dictate incompatibility.
This is required to allow `system:presence` workspace's datastore to deviated from the common general workspace datastore. This also removes test workarounds when specifying `clientToSessionId` records.
…able Filtering the inner type when applying additional `JsonSerializable` filters broken the result down into `JsonTypeWith | Opaque` degenerate substitutes when `unknown` was sufficient already and would break the filter type checking. Now preserve the Opaque type's `T` as-is and rely on changes in `Controls` to dictate incompatibility.
This is required to allow `system:presence` workspace's datastore to deviated from the common general workspace datastore. This also removes test workarounds when specifying `clientToSessionId` records.
…ral-datastore-typing' into presence-type-branding
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
Updates the presence internals to use an opaque/branded internal type when passing around JSON objects. There are two functions to make JSON types opaque/not opaque, as well as a helper that casts from an opaque JSON type to a
DeeplyReadonly<JsonDeserialized<T>>
object since that is what we often need.Externally, the API remains the same; the internal types and functions are marked
@system
and objects are converted between the types at the API boundaries.There were API level mismatches with the Notifications changes, so I marked
InternalUtilityTypes
as alpha. Is there a better change? Similarly, the core-interfaces types needed to be beta since the presence APIs are marked as such.