Skip to content
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

[MMB-178] Add members namespace #101

Merged
merged 6 commits into from
Aug 8, 2023
Merged

Commits on Aug 8, 2023

  1. Add types files

    These are split into an external and internal ones, the latter being ones that we might want to change without introducing breaking changes.
    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    d5a1d6e View commit details
    Browse the repository at this point in the history
  2. Sync ably-js version for demo

    Update as newer types were incompatible.
    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    91ea771 View commit details
    Browse the repository at this point in the history
  3. Add nanoid package for presence message updates

    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    101b30e View commit details
    Browse the repository at this point in the history
  4. Remove mock-server tests

    These tests add significant complexity to setup, and don't bring enough value on contrast to the mock tests.
    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    704ed02 View commit details
    Browse the repository at this point in the history
  5. Refactor structure of presence updates

    This commit changes how we handle updates for presence spaces. An presence update becomes a PresenceMember:
    
    export type PresenceMember = {
      data: {
        profileUpdate: {
          id: string | null;
          current: ProfileData;
        };
        locationUpdate: {
          id: string | null;
          previous: unknown;
          current: unknown;
        };
      };
    } & Omit<Types.PresenceMessage, 'data'>;
    
    Which then gets translated for the developer to a SpaceMember:
    
    export type SpaceMember = {
      clientId: string;
      connectionId: string;
      isConnected: boolean;
      profileData: ProfileData;
      location: unknown;
      lastEvent: {
        name: Types.PresenceAction;
        timestamp: number;
      };
    };
    
    data on PresenceMember contains the last update for profileData an location. The current key is the value of these properties on SpaceMember.
    
    profileUpdate and locationUpdate contain an id. This id is set on publish, but only when we are providing new data, not copying already set data.
    The handlers check the id to decide if an update should be emitted (it will still be applied, and it should be the same).
    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    10a2350 View commit details
    Browse the repository at this point in the history
  6. Run repo version of tsc for build commands

    Dominik Piatek committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    33c5990 View commit details
    Browse the repository at this point in the history