ttfm-socket 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ import { Action, ParamsFrom } from "actionhero";
2
+ import { ActionName, MiddlewareName } from "../types/names";
3
+ import { Consumable, ConsumablePurchase } from "@ttfm-labs/merch-service";
4
+ export declare class HandleConsumablePurchaseCreatedAction extends Action {
5
+ name: ActionName.handleConsumablePurchaseCreated;
6
+ description: string;
7
+ inputs: {
8
+ consumablePurchase: {
9
+ required: true;
10
+ formatter: (consumablePurchase: import("../client").ConsumablePurchase) => import("../client").ConsumablePurchase;
11
+ validator: (consumablePurchase: ConsumablePurchase) => void;
12
+ };
13
+ consumable: {
14
+ required: true;
15
+ formatter: (consumable: import("../client").Consumable) => import("../client").Consumable;
16
+ validator: (consumable: Consumable) => void;
17
+ };
18
+ };
19
+ middleware: MiddlewareName[];
20
+ private consumableValidator;
21
+ private consumablePurchaseValidator;
22
+ run({ params: { consumablePurchase, consumable }, }: {
23
+ params: ParamsFrom<HandleConsumablePurchaseCreatedAction>;
24
+ }): Promise<void>;
25
+ }
@@ -1,4 +1,4 @@
1
- import { Action, ParamsFrom } from "actionhero";
1
+ import { Action, Connection, ParamsFrom } from "actionhero";
2
2
  import { ActionName, MiddlewareName } from "../types/names";
3
3
  import { OneTimeAnimationType } from "../types/messages";
4
4
  export declare class PlayOneTimeAnimationAction extends Action {
@@ -9,7 +9,7 @@ export declare class PlayOneTimeAnimationAction extends Action {
9
9
  required: true;
10
10
  };
11
11
  userUuid: {
12
- required: true;
12
+ description: string;
13
13
  };
14
14
  animation: {
15
15
  required: true;
@@ -21,11 +21,16 @@ export declare class PlayOneTimeAnimationAction extends Action {
21
21
  validator: (emojiString: string) => void;
22
22
  description: string;
23
23
  };
24
+ consumable: {
25
+ formatter: (consumable: import("../client").Consumable) => import("../client").Consumable;
26
+ description: string;
27
+ };
24
28
  };
25
29
  middleware: MiddlewareName[];
26
30
  private animationValidator;
27
31
  private emojiValidator;
28
- run({ params: { roomUuid, userUuid, animation, emoji }, }: {
32
+ run({ params: { roomUuid, userUuid, animation, emoji, consumable }, connection, }: {
29
33
  params: ParamsFrom<PlayOneTimeAnimationAction>;
34
+ connection: Connection;
30
35
  }): Promise<void>;
31
36
  }
@@ -1,6 +1,7 @@
1
1
  import { JoinRoomAction } from "../actions/joinRoom";
2
2
  import { ActionResponse } from "./actionhero";
3
3
  import { Operation } from "./jsonPatch";
4
+ import { Consumable } from "./services";
4
5
  export declare const StatefulServerMessageName: {
5
6
  readonly addedDj: "addedDj";
6
7
  readonly lookedUpSong: "lookedUpSong";
@@ -41,9 +42,10 @@ export type StatefulServerMessageNameType = (typeof StatefulServerMessageName)[k
41
42
  export type StatelessServerMessageNameType = (typeof StatelessServerMessageName)[keyof typeof StatelessServerMessageName];
42
43
  export type ServerMessageNameType = (typeof ServerMessageName)[keyof typeof ServerMessageName];
43
44
  export type PlayedOneTimeAnimationParams<O extends OneTimeAnimationType = OneTimeAnimationType> = {
44
- userUuid: string;
45
45
  animation: O;
46
+ userUuid: O extends typeof OneTimeAnimation.consumable ? undefined : string;
46
47
  emoji: O extends typeof OneTimeAnimation.emoji ? string : undefined;
48
+ consumable: O extends typeof OneTimeAnimation.consumable ? Consumable : undefined;
47
49
  };
48
50
  export type KickedFromRoomParams = {
49
51
  banReason?: string;
@@ -52,6 +54,7 @@ export type StatelessServerMessageParams = PlayedOneTimeAnimationParams | Kicked
52
54
  export declare const OneTimeAnimation: {
53
55
  readonly emoji: "emoji";
54
56
  readonly jump: "jump";
57
+ readonly consumable: "consumable";
55
58
  };
56
59
  export type OneTimeAnimationType = (typeof OneTimeAnimation)[keyof typeof OneTimeAnimation];
57
60
  export type StatefulServerMessage = {
@@ -27,4 +27,5 @@ exports.ServerMessageName = {
27
27
  exports.OneTimeAnimation = {
28
28
  emoji: "emoji",
29
29
  jump: "jump",
30
+ consumable: "consumable",
30
31
  };
@@ -3,6 +3,7 @@ export declare enum ActionName {
3
3
  addUser = "addUser",
4
4
  getRoomStates = "getRoomStates",
5
5
  getRoomStatus = "getRoomStatus",
6
+ handleConsumablePurchaseCreated = "handleConsumablePurchaseCreated",
6
7
  joinRoom = "joinRoom",
7
8
  kickUserFromRoom = "kickUserFromRoom",
8
9
  kickUserGlobally = "kickUserGlobally",
@@ -7,6 +7,7 @@ var ActionName;
7
7
  ActionName["addUser"] = "addUser";
8
8
  ActionName["getRoomStates"] = "getRoomStates";
9
9
  ActionName["getRoomStatus"] = "getRoomStatus";
10
+ ActionName["handleConsumablePurchaseCreated"] = "handleConsumablePurchaseCreated";
10
11
  ActionName["joinRoom"] = "joinRoom";
11
12
  ActionName["kickUserFromRoom"] = "kickUserFromRoom";
12
13
  ActionName["kickUserGlobally"] = "kickUserGlobally";
@@ -198,3 +198,23 @@ export declare type OtherUserProfileResDto = {
198
198
  badges: Array<"VERIFIED" | "PLATINUM" | "DOUBLE_PLATINUM" | "JQBX" | "STAFF">;
199
199
  priceForGig: number;
200
200
  };
201
+ export type Consumable = {
202
+ id: string;
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ deletedAt: string | null;
206
+ name: string;
207
+ tokenCost: number;
208
+ desktopFileUrl: string;
209
+ mobileFileUrl: string;
210
+ previewFileUrl: string;
211
+ isEnabled: boolean;
212
+ };
213
+ export type ConsumablePurchase = {
214
+ id: string;
215
+ createdAt: string;
216
+ byUserUuid: string;
217
+ roomUuid: string;
218
+ tokenCost: number;
219
+ transactionId: string;
220
+ };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "ttfm-socket",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "main": "./dist-client/client/index.js",
5
5
  "typings": "./dist-client/client/index.d.ts",
6
6
  "devDependencies": {
7
7
  "@faker-js/faker": "^9.7.0",
8
8
  "@ttfm-labs/nestjs-backend": "^2.3.10",
9
+ "@types/amqplib": "^0.10.7",
9
10
  "@types/glob": "^8.1.0",
10
11
  "@types/jest": "^29.5.3",
11
12
  "@types/jsonwebtoken": "^9.0.2",