Skip to content

Instantly share code, notes, and snippets.

@mikecann
Created September 16, 2024 05:55
Show Gist options
  • Save mikecann/c7ad434ffcf94eb4e5c0d0b30f7967e1 to your computer and use it in GitHub Desktop.
Save mikecann/c7ad434ffcf94eb4e5c0d0b30f7967e1 to your computer and use it in GitHub Desktop.
battletabsevents.ts
export interface AppEventMappings {
// Entities
entityUpdated: Omit<EntityUpdatedAppEvent, "kind">;
entityInserted: Omit<EntityInsertedAppEvent, "kind">;
entityDeleted: Omit<EntityDeletedAppEvent, "kind">;
// Matches
matchTurnTaken: {
match: PrismaBattle;
turnTaker: PrismaUser;
events: BattleEvent[];
event: PlayerTookTurnBattleEvent;
eventIndex: number;
};
turnResponded: {
match: PrismaBattle;
turn: PlayerTookTurnBattleEvent;
events: BattleEvent[];
turnTaker: PrismaUser;
turnResponder: PrismaUser;
event: ExtractBattleEvent<"player-responded-to-turn">;
eventIndex: number;
};
matchFinished: { match: PrismaBattle; events: BattleEvent[] };
turnTimedOut: { match: PrismaBattle; byUser: PrismaUser; event: TurnTimedOutBattleEvent };
shipPlacementTimedOut: {
match: PrismaBattle;
byUser: PrismaUser;
events: ShipsPlacementTimedOutBattleEvent[];
};
matchEmoted: {
matchId: UUID;
fromUserId: UUID;
emote: Emote;
matchKind: string;
};
matchMade: { proposalAId: UUID; proposalBId: UUID; matchCreatedId: UUID };
fleetChosen: { battleId: UUID; fleet: ChosenFleet; userId: UserId };
shipChosen: { battleId: UUID; userId: UserId; shipDefinitionId: string };
matchStarted_v2: { match: PrismaBattle };
aiPracticeBattleCreated: { battleId: UUID; byUserId: UUID };
// Battle Emotes
battleEmoteCreated: {
id: string;
battle: PrismaBattle;
emote: Emote;
by: PrismaUser;
createdAt: number;
};
// Proposals
temporaryProposalCreated: { proposalId: UUID };
proposalMatchmade: { proposalId: UUID; opponentKind: "human" | "ai" };
proposalCancelled: { proposalId: UUID; cancelledByUserId: string };
proposalJoined: { proposalId: UUID; joinedByUserId: string };
// Users
userNameUpdated: { userId: string };
useSettingsUpdated: { userId: string };
userAvatarUpdated: { userId: string };
userSeeablesUpdated: { userId: string };
userReviewStatusUpdated: { userId: string; status: ReviewPromptStatus };
userSubscriptionUpdated: { userId: string };
userFlagsUpdated: { userId: string };
userReported: { reportee: string; reporter: string; message: string };
medalEquipped: { userId: string; medalId: string };
medalUnequipped: { userId: string; medalId: string };
userAwardedPoints: { userId: string; points: number };
userEnhancedStatsUpdated: { userId: string };
userAccountDeleted: { user: PrismaUser };
userShadowBanned: { userId: string };
// Auth
userUninstalled: { userId: string };
userLinkedGoogle: { userId: string; email: string };
userSignedUpWithCredentials: { userId: string };
userExchangedCredentialsForToken: { userId: string };
passwordResetRequested: { email: string };
passwordReset: { email: string };
linkWithOAuthBegan: { provider: OAuthProvider };
loginWithOAuthBegan: { provider: OAuthProvider };
signupWithOAuthBegan: { provider: OAuthProvider };
linkedWithOAuth: { provider: OAuthProvider; userId: string | null };
loggedInWithOAuth: { provider: OAuthProvider; userId: string | null };
signedUpWithOAuth: { provider: OAuthProvider; userId: string | null };
userLoggedInWithApple: { userId: string };
userLinkedWithApple: { userId: string };
userSignedUpWithApple: { userId: string };
// Friends
friendUnfriended: { friendId: string; byUserId: string };
// HighScores
dailyHighScoreRankIncreased: { highScoreId: string; rank: number };
dailyHighScoreRankDecreased: { highScoreId: string; rank: number };
// Friend Invites
friendInviteAccepted: { invite: PrismaFriendInvite; byUser: PrismaUser };
friendInviteDeclined: { invite: PrismaFriendInvite; byUser: PrismaUser };
friendInviteCancelled: { invite: PrismaFriendInvite; byUserId: string };
// Match Invites
matchInviteAccepted: { invite: PrismaBattleInvite; byUserId: string };
matchInviteDeclined: { invite: PrismaBattleInvite; byUserId: string };
matchInviteCancelled: { invite: PrismaBattleInvite; byUserId: string };
// Waiting Proposals
waitingProposalAccepted: { proposalId: string; byUserId: string };
// Server
// eslint-disable-next-line @typescript-eslint/ban-types
serverStarted: {};
// Analytics
analyticsDesignEventTracked: { name: string; value: number | undefined; userId: string | null };
analyticsProgressionEventTracked: {
status: "Start" | "Fail" | "Completed";
progression01: string;
progression02: string | undefined;
progression03: string | undefined;
score: number | undefined;
userId: string | null;
};
// Sockets
socketConnected: {
userId: string | undefined;
analyticsId: string;
platform: string;
iframeParent: string | undefined | null;
};
socketDisconnected: { userId: string | undefined };
// Discord
discordStreamersUpdated: { streamers: DiscordStreamerInfo[] };
discordMemberStartedStreaming: { info: DiscordStreamerInfo };
userDiscordOAuthInfoUpdated: { userId: string };
cloudMessageSentToDiscordUserViaDM: { userId: string; message: CloudMessage };
cloudMessageToDiscordUserErrored: {
userId: string;
message: CloudMessage;
error: {
code: number | string;
message: string;
method: string;
url: string;
};
};
discordInteractionPlayButtonClicked: {
userId?: string;
buttonId: string;
interaction: APIMessageComponentButtonInteraction;
};
// Misc
errorOccurred: { error: string };
// Battletabs
battletabsUpdated: { battletabsId: string };
currentMapChanged: { mapId: string };
// Redis
redisWarning: { message: string };
redisError: { message: string };
// Stripe
stripeWebhookCalled: { eventType: string };
stripeBCCheckoutSessionCreated: {};
stripeCustomerPortalSessionCreated: {};
// Ship Blueprints
shipBlueprintDiscovered: { shipDefinitionId: string; userId: string };
shipBlueprintRented: { definitionId: string; userId: string };
shipBlueprintPurchased: { definitionId: string; userId: string };
shipBlueprintExpired: { id: string; definitionId: string; userId: string };
// Presence
userPresenceChanged: { presence: UserPresence };
// Shop
shopFreeGoldCollected: { byUserId: UUID; userId: string };
dailyShipSkinBought: { userId: string; definitionId: string };
dailyEmoteBought: { userId: string; definitionId: string };
// Skins
shipSkinPurchased: { userId: string; definitionId: string };
// Fractal
userLinkedWithFractal: { userId: UUID };
userSignedUpWithFractal: { userId: UUID };
userLoggedInWithFractal: { userId: UUID };
// Board Ping
boardPingCreated: {
id: string;
battle: PrismaBattle;
by: PrismaUser;
boardOwnerId: string;
isoPosition: Point2D;
matchKind: string;
};
// FTUE
ftueEnded: { userId: string };
ftueSkipped: { userId: string };
// League
userTrophiesChanged: {
userId: UUID;
leagueId: string;
before: number;
after: number;
};
userHighestTrophiesChanged: {
userId: UUID;
leagueId: string;
before: number;
after: number;
};
useEnteredDiamondDash: {
userId: UUID;
leagueId: string;
diamondDashId: string;
};
trophiesRequiredToWinDiamondDashChanged: {
leagueId: string;
diamondDashId: string;
trophiesRequired: number;
};
userLeagueLevelChanged: {
userId: UUID;
leagueId: string;
before: number;
after: number;
leagueDefinitionId: string;
};
userLeagueLevelRewardsGranted: { userId: UUID; leagueDefinitionId: string; toLevelValue: number };
diamondDashEnded: { id: UUID; newId: UUID };
diamondDashWinnerAwarded: {
leagueId: UUID;
userId: UUID;
updatedProgress: PrismaUserLeagueProgress;
};
leagueEnded: { leagueId: UUID; newLeagueId: UUID };
profanityChecked: {
phrase: string;
message: string | undefined;
isProfane: string;
deltaMs: number;
};
// Research
researchBegan: { userId: string; nodeId: string; researcherId: string };
researchCollected: { userId: string; nodeId: string; researcherId: string };
researchComplete: { userId: string; node: PrismaResearchNode };
researchBoostPurchased: { userId: string; nodeId: string };
researchCancelled: { userId: string; nodeId: string };
researcherUnlocked: { userId: string; researcherId: string };
researcherLocked: { userId: string; researcherId: string };
// Feature Keys
featureKeyCreated: { userId: string; definitionId: FeatureKeyDefinitionIds };
// Challenges
challengeSlotUnlocked: { userId: string; definitionId: string };
challengeOptionSlotUnlocked: { userId: string; definitionId: string };
challengeOptionsRefreshed: { userId: string };
challengeOptionRefreshPurchased: {
userId: string;
previousPurchasedRefreshesSinceLastAutoRefresh: number;
};
challengeAbandoned: {
userId: string;
challenge: {
before: PrismaChallenge;
after: PrismaChallenge;
};
};
challengeRetried: {
userId: string;
challenge: {
before: PrismaChallenge;
after: PrismaChallenge;
};
};
challengeSlotCooldownSkipped: { userId: string; slot: PrismaChallengeSlot };
challengeCompleted: { challenge: PrismaChallenge };
challengeFailed: { challenge: PrismaChallenge };
challengeProgressed: { challenge: PrismaChallenge };
challengeSlotCooldownEnded: { slot: PrismaChallengeSlot };
challengeRewardsCollected: {
challenge: PrismaChallenge;
slot: PrismaChallengeSlot;
rewards: ChallengeRewards[];
};
passiveChallengePoolCompleted: {
userId: string;
poolId: string;
};
// Payments
paymentTransactionValidatedAndEntitlementsGranted: {
userId: string;
productDefinitionId: string;
gateway: string;
};
userSubscriptionCreated: {
subscription: PrismaUserSubscription;
};
userSubscriptionReactivated: {
subscription: PrismaUserSubscription;
};
// User Linked Accounts
userLinkedAccountCreated: {
link: PrismaUserLinkedAccount;
};
// Native Auth
nativeAccountRestored: {
vendorUserId: string;
vendor: NativeAccountVendor;
userId: UserId;
};
nativeAccountRemoved: {
vendorUserId: string;
vendor: NativeAccountVendor;
userId: UserId;
};
nativeAccountLinked: {
vendorUserId: string;
vendor: NativeAccountVendor;
userId: UserId;
};
// Starting Fleets
startingFleetUnlocked: {
userId: UserId;
definitionId: string;
};
// Auth
discordActivityAuthenticated: {
result: DiscordActivityAuthResult["__typename"];
userId: Maybe<string>;
guild: APIPartialGuild | null;
instanceId: string;
channelId: Maybe<string>;
};
// BC
// userGainedBattleClub: {
// userId: string;
// };
// userLostBattleClub: {
// userId: string;
// };
// Debug
dumpMemOnWorkerRequested: {};
// Clans
clanCreated: { clan: PrismaClan };
clanUpdated: { clan: PrismaClan };
clanJoined: { userId: string; clanId: string };
clanMembershipPaused: { userId: string; clanId: string };
clanMembershipResumed: { userId: string; clanId: string };
// Daily Login
dailyLoginDayCollected: { userId: string; dayIndex: number };
dailyLoginDayAwarded: { userId: string; dayIndex: number };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment