tachyon-protocol 0.2.1 → 0.3.1

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.
package/dist/index.d.ts CHANGED
@@ -719,55 +719,33 @@ export type MatchmakingReadyUpdateResponse =
719
719
  status: "failed";
720
720
  reason: "invalid_command";
721
721
  };
722
- export type SystemDisconnectedResponse =
722
+ export type SystemConnectedResponse =
723
723
  | {
724
724
  messageId: string;
725
- commandId: "system/disconnected/response";
726
- status: "success";
727
- }
728
- | {
729
- messageId: string;
730
- commandId: "system/disconnected/response";
731
- status: "failed";
732
- reason: "internal_error";
733
- }
734
- | {
735
- messageId: string;
736
- commandId: "system/disconnected/response";
737
- status: "failed";
738
- reason: "unauthorized";
739
- }
740
- | {
741
- messageId: string;
742
- commandId: "system/disconnected/response";
743
- status: "failed";
744
- reason: "invalid_command";
745
- };
746
- export type SystemVersionResponse =
747
- | {
748
- messageId: string;
749
- commandId: "system/version/response";
725
+ commandId: "system/connected/response";
750
726
  status: "success";
751
727
  data: {
752
- tachyonVersion: "0.2.1";
753
- versionParity: "major_mismatch" | "minor_mismatch" | "patch_mismatch" | "match" | "unknown";
728
+ accountId: number;
729
+ displayName: string;
730
+ avatarUrl: string;
731
+ countryCode?: string;
754
732
  };
755
733
  }
756
734
  | {
757
735
  messageId: string;
758
- commandId: "system/version/response";
736
+ commandId: "system/connected/response";
759
737
  status: "failed";
760
738
  reason: "internal_error";
761
739
  }
762
740
  | {
763
741
  messageId: string;
764
- commandId: "system/version/response";
742
+ commandId: "system/connected/response";
765
743
  status: "failed";
766
744
  reason: "unauthorized";
767
745
  }
768
746
  | {
769
747
  messageId: string;
770
- commandId: "system/version/response";
748
+ commandId: "system/connected/response";
771
749
  status: "failed";
772
750
  reason: "invalid_command";
773
751
  };
@@ -921,24 +899,16 @@ export interface Tachyon {
921
899
  };
922
900
  system: {
923
901
  /**
924
- * Ask the server to terminate the connection. The server will send a [disconnected](#disconnected) response.
902
+ * Sent immediately by the server on connection.
925
903
  */
926
- disconnect: {
927
- request: SystemDisconnectRequest;
928
- };
929
- /**
930
- * Sent when the server terminates the WebSocket connection with the client.
931
- */
932
- disconnected: {
933
- response: SystemDisconnectedResponse;
904
+ connected: {
905
+ response: SystemConnectedResponse;
934
906
  };
935
907
  /**
936
- * Sends the current version of the protocol to new Websocket clients as soon as they connect.
937
- *
938
- * Clients should send the version they're using in the WS connection URL, e.g. ?tachyonVersion=1.1.2.
908
+ * Ask the server to terminate the connection.
939
909
  */
940
- version: {
941
- response: SystemVersionResponse;
910
+ disconnect: {
911
+ request: SystemDisconnectRequest;
942
912
  };
943
913
  };
944
914
  }
@@ -1156,7 +1126,7 @@ export type ResponseType<S extends ServiceId, E extends ResponseEndpointId<S>> =
1156
1126
 
1157
1127
  export type RequestData<S extends ServiceId, E extends RequestEndpointId<S>> = Tachyon[S][E] extends { request: { data: infer Data } } ? Data : never;
1158
1128
 
1159
- export type ResponseData<S extends ServiceId, E extends ResponseEndpointId<S>> = Tachyon[S][E] extends { response: { data: infer Data } } ? Data : never;
1129
+ export type SuccessResponseData<S extends ServiceId, E extends ResponseEndpointId<S>> = ResponseType<S, E> & { status: "success" } extends { data: infer Data } ? Data : never;
1160
1130
 
1161
1131
  export type RemoveField<T, K extends string> = T extends { [P in K]: any } ? Omit<T, K> : never;
1162
1132
 
package/dist/meta.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.1",
2
+ "version": "0.3.1",
3
3
  "ids": {
4
4
  "bot": {
5
5
  "slave": [
@@ -85,14 +85,11 @@
85
85
  ]
86
86
  },
87
87
  "system": {
88
- "disconnect": [
89
- "request"
90
- ],
91
- "disconnected": [
88
+ "connected": [
92
89
  "response"
93
90
  ],
94
- "version": [
95
- "response"
91
+ "disconnect": [
92
+ "request"
96
93
  ]
97
94
  }
98
95
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "system/disconnected/response",
2
+ "$id": "system/connected/response",
3
3
  "requiresLogin": false,
4
4
  "anyOf": [
5
5
  {
@@ -9,18 +9,41 @@
9
9
  "type": "string"
10
10
  },
11
11
  "commandId": {
12
- "const": "system/disconnected/response",
12
+ "const": "system/connected/response",
13
13
  "type": "string"
14
14
  },
15
15
  "status": {
16
16
  "const": "success",
17
17
  "type": "string"
18
+ },
19
+ "data": {
20
+ "type": "object",
21
+ "properties": {
22
+ "accountId": {
23
+ "type": "integer"
24
+ },
25
+ "displayName": {
26
+ "type": "string"
27
+ },
28
+ "avatarUrl": {
29
+ "type": "string"
30
+ },
31
+ "countryCode": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ "required": [
36
+ "accountId",
37
+ "displayName",
38
+ "avatarUrl"
39
+ ]
18
40
  }
19
41
  },
20
42
  "required": [
21
43
  "messageId",
22
44
  "commandId",
23
- "status"
45
+ "status",
46
+ "data"
24
47
  ]
25
48
  },
26
49
  {
@@ -30,7 +53,7 @@
30
53
  "type": "string"
31
54
  },
32
55
  "commandId": {
33
- "const": "system/disconnected/response",
56
+ "const": "system/connected/response",
34
57
  "type": "string"
35
58
  },
36
59
  "status": {
@@ -56,7 +79,7 @@
56
79
  "type": "string"
57
80
  },
58
81
  "commandId": {
59
- "const": "system/disconnected/response",
82
+ "const": "system/connected/response",
60
83
  "type": "string"
61
84
  },
62
85
  "status": {
@@ -82,7 +105,7 @@
82
105
  "type": "string"
83
106
  },
84
107
  "commandId": {
85
- "const": "system/disconnected/response",
108
+ "const": "system/connected/response",
86
109
  "type": "string"
87
110
  },
88
111
  "status": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tachyon-protocol",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src/** --ext ts --exec npm run build",
@@ -1,143 +0,0 @@
1
- {
2
- "$id": "system/version/response",
3
- "requiresLogin": false,
4
- "anyOf": [
5
- {
6
- "type": "object",
7
- "properties": {
8
- "messageId": {
9
- "type": "string"
10
- },
11
- "commandId": {
12
- "const": "system/version/response",
13
- "type": "string"
14
- },
15
- "status": {
16
- "const": "success",
17
- "type": "string"
18
- },
19
- "data": {
20
- "type": "object",
21
- "properties": {
22
- "tachyonVersion": {
23
- "const": "0.2.1",
24
- "type": "string"
25
- },
26
- "versionParity": {
27
- "anyOf": [
28
- {
29
- "const": "major_mismatch",
30
- "type": "string"
31
- },
32
- {
33
- "const": "minor_mismatch",
34
- "type": "string"
35
- },
36
- {
37
- "const": "patch_mismatch",
38
- "type": "string"
39
- },
40
- {
41
- "const": "match",
42
- "type": "string"
43
- },
44
- {
45
- "const": "unknown",
46
- "type": "string"
47
- }
48
- ]
49
- }
50
- },
51
- "required": [
52
- "tachyonVersion",
53
- "versionParity"
54
- ]
55
- }
56
- },
57
- "required": [
58
- "messageId",
59
- "commandId",
60
- "status",
61
- "data"
62
- ]
63
- },
64
- {
65
- "type": "object",
66
- "properties": {
67
- "messageId": {
68
- "type": "string"
69
- },
70
- "commandId": {
71
- "const": "system/version/response",
72
- "type": "string"
73
- },
74
- "status": {
75
- "const": "failed",
76
- "type": "string"
77
- },
78
- "reason": {
79
- "const": "internal_error",
80
- "type": "string"
81
- }
82
- },
83
- "required": [
84
- "messageId",
85
- "commandId",
86
- "status",
87
- "reason"
88
- ]
89
- },
90
- {
91
- "type": "object",
92
- "properties": {
93
- "messageId": {
94
- "type": "string"
95
- },
96
- "commandId": {
97
- "const": "system/version/response",
98
- "type": "string"
99
- },
100
- "status": {
101
- "const": "failed",
102
- "type": "string"
103
- },
104
- "reason": {
105
- "const": "unauthorized",
106
- "type": "string"
107
- }
108
- },
109
- "required": [
110
- "messageId",
111
- "commandId",
112
- "status",
113
- "reason"
114
- ]
115
- },
116
- {
117
- "type": "object",
118
- "properties": {
119
- "messageId": {
120
- "type": "string"
121
- },
122
- "commandId": {
123
- "const": "system/version/response",
124
- "type": "string"
125
- },
126
- "status": {
127
- "const": "failed",
128
- "type": "string"
129
- },
130
- "reason": {
131
- "const": "invalid_command",
132
- "type": "string"
133
- }
134
- },
135
- "required": [
136
- "messageId",
137
- "commandId",
138
- "status",
139
- "reason"
140
- ]
141
- }
142
- ]
143
- }