Type alias DataManagerMutation

DataManagerMutation: {
    dataManagerId: DataManagerId;
    deletes?: string[];
    increments?: {
        [key: string]: number;
    };
    updates?: {
        [key: string]: JSONValue;
    };
}

Represents a batch of changes to a DataManager.

Mutations are sent from clients to the server or from the server to clients to keep all data managers synchronized.

Type declaration

  • dataManagerId: DataManagerId

    The data manager this mutation applies to

  • Optional deletes?: string[]

    Keys to remove from the data manager.

  • Optional increments?: {
        [key: string]: number;
    }

    Key-value pairs to increment in the data manager. The values are the amount to increment by (can be negative).

    • [key: string]: number
  • Optional updates?: {
        [key: string]: JSONValue;
    }

    Key-value pairs to set in the data manager. These will overwrite existing values.

    • [key: string]: JSONValue

Example

// Setting values
const setMutation: DataManagerMutation = {
dataManagerId: { id: "gameState" },
updates: {
score: 100,
level: 5,
gameActive: true
}
};

// Deleting values
const deleteMutation: DataManagerMutation = {
dataManagerId: { id: "player_123" },
deletes: ["powerup", "shield"]
};

// Incrementing values
const incrementMutation: DataManagerMutation = {
dataManagerId: { id: "player_123" },
increments: { score: 10, lives: -1 }
};