@darco2903/altv-web-api 1.2.0 → 1.3.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.
@@ -176,6 +176,96 @@ declare const _default: {
176
176
  currentTime: z.ZodNumber;
177
177
  url: z.ZodString;
178
178
  paused: z.ZodBoolean;
179
+ scene: z.ZodObject<{
180
+ speakers: z.ZodArray<z.ZodObject<{
181
+ id: z.ZodString;
182
+ x: z.ZodNumber;
183
+ y: z.ZodNumber;
184
+ z: z.ZodNumber;
185
+ yaw: z.ZodNumber;
186
+ pitch: z.ZodNumber;
187
+ directional: z.ZodBoolean;
188
+ }, "strip", z.ZodTypeAny, {
189
+ id: string;
190
+ x: number;
191
+ y: number;
192
+ z: number;
193
+ yaw: number;
194
+ pitch: number;
195
+ directional: boolean;
196
+ }, {
197
+ id: string;
198
+ x: number;
199
+ y: number;
200
+ z: number;
201
+ yaw: number;
202
+ pitch: number;
203
+ directional: boolean;
204
+ }>, "many">;
205
+ cars: z.ZodArray<z.ZodObject<{
206
+ id: z.ZodString;
207
+ x: z.ZodNumber;
208
+ z: z.ZodNumber;
209
+ yaw: z.ZodNumber;
210
+ doors: z.ZodArray<z.ZodBoolean, "many">;
211
+ windows: z.ZodArray<z.ZodBoolean, "many">;
212
+ radio: z.ZodBoolean;
213
+ }, "strip", z.ZodTypeAny, {
214
+ id: string;
215
+ x: number;
216
+ z: number;
217
+ yaw: number;
218
+ doors: boolean[];
219
+ windows: boolean[];
220
+ radio: boolean;
221
+ }, {
222
+ id: string;
223
+ x: number;
224
+ z: number;
225
+ yaw: number;
226
+ doors: boolean[];
227
+ windows: boolean[];
228
+ radio: boolean;
229
+ }>, "many">;
230
+ }, "strip", z.ZodTypeAny, {
231
+ speakers: {
232
+ id: string;
233
+ x: number;
234
+ y: number;
235
+ z: number;
236
+ yaw: number;
237
+ pitch: number;
238
+ directional: boolean;
239
+ }[];
240
+ cars: {
241
+ id: string;
242
+ x: number;
243
+ z: number;
244
+ yaw: number;
245
+ doors: boolean[];
246
+ windows: boolean[];
247
+ radio: boolean;
248
+ }[];
249
+ }, {
250
+ speakers: {
251
+ id: string;
252
+ x: number;
253
+ y: number;
254
+ z: number;
255
+ yaw: number;
256
+ pitch: number;
257
+ directional: boolean;
258
+ }[];
259
+ cars: {
260
+ id: string;
261
+ x: number;
262
+ z: number;
263
+ yaw: number;
264
+ doors: boolean[];
265
+ windows: boolean[];
266
+ radio: boolean;
267
+ }[];
268
+ }>;
179
269
  }, "strip", z.ZodTypeAny, {
180
270
  streamId: string;
181
271
  title: string;
@@ -184,6 +274,26 @@ declare const _default: {
184
274
  currentTime: number;
185
275
  url: string;
186
276
  paused: boolean;
277
+ scene: {
278
+ speakers: {
279
+ id: string;
280
+ x: number;
281
+ y: number;
282
+ z: number;
283
+ yaw: number;
284
+ pitch: number;
285
+ directional: boolean;
286
+ }[];
287
+ cars: {
288
+ id: string;
289
+ x: number;
290
+ z: number;
291
+ yaw: number;
292
+ doors: boolean[];
293
+ windows: boolean[];
294
+ radio: boolean;
295
+ }[];
296
+ };
187
297
  }, {
188
298
  streamId: string;
189
299
  title: string;
@@ -192,6 +302,26 @@ declare const _default: {
192
302
  currentTime: number;
193
303
  url: string;
194
304
  paused: boolean;
305
+ scene: {
306
+ speakers: {
307
+ id: string;
308
+ x: number;
309
+ y: number;
310
+ z: number;
311
+ yaw: number;
312
+ pitch: number;
313
+ directional: boolean;
314
+ }[];
315
+ cars: {
316
+ id: string;
317
+ x: number;
318
+ z: number;
319
+ yaw: number;
320
+ doors: boolean[];
321
+ windows: boolean[];
322
+ radio: boolean;
323
+ }[];
324
+ };
195
325
  }>;
196
326
  400: z.ZodUnion<[z.ZodObject<{
197
327
  name: z.ZodLiteral<"ZodError">;
@@ -828,6 +958,315 @@ declare const _default: {
828
958
  }>;
829
959
  };
830
960
  };
961
+ scene: {
962
+ description: "Change the scene of a media stream, listeners get the new scene through the mediaStreamScene socket event";
963
+ method: "POST";
964
+ body: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
965
+ type: z.ZodLiteral<"addSpeaker">;
966
+ speaker: z.ZodObject<Omit<{
967
+ id: z.ZodString;
968
+ x: z.ZodNumber;
969
+ y: z.ZodNumber;
970
+ z: z.ZodNumber;
971
+ yaw: z.ZodNumber;
972
+ pitch: z.ZodNumber;
973
+ directional: z.ZodBoolean;
974
+ }, "id">, "strip", z.ZodTypeAny, {
975
+ x: number;
976
+ y: number;
977
+ z: number;
978
+ yaw: number;
979
+ pitch: number;
980
+ directional: boolean;
981
+ }, {
982
+ x: number;
983
+ y: number;
984
+ z: number;
985
+ yaw: number;
986
+ pitch: number;
987
+ directional: boolean;
988
+ }>;
989
+ }, "strip", z.ZodTypeAny, {
990
+ type: "addSpeaker";
991
+ speaker: {
992
+ x: number;
993
+ y: number;
994
+ z: number;
995
+ yaw: number;
996
+ pitch: number;
997
+ directional: boolean;
998
+ };
999
+ }, {
1000
+ type: "addSpeaker";
1001
+ speaker: {
1002
+ x: number;
1003
+ y: number;
1004
+ z: number;
1005
+ yaw: number;
1006
+ pitch: number;
1007
+ directional: boolean;
1008
+ };
1009
+ }>, z.ZodObject<{
1010
+ type: z.ZodLiteral<"addCar">;
1011
+ car: z.ZodObject<Pick<{
1012
+ id: z.ZodString;
1013
+ x: z.ZodNumber;
1014
+ z: z.ZodNumber;
1015
+ yaw: z.ZodNumber;
1016
+ doors: z.ZodArray<z.ZodBoolean, "many">;
1017
+ windows: z.ZodArray<z.ZodBoolean, "many">;
1018
+ radio: z.ZodBoolean;
1019
+ }, "x" | "z" | "yaw">, "strip", z.ZodTypeAny, {
1020
+ x: number;
1021
+ z: number;
1022
+ yaw: number;
1023
+ }, {
1024
+ x: number;
1025
+ z: number;
1026
+ yaw: number;
1027
+ }>;
1028
+ }, "strip", z.ZodTypeAny, {
1029
+ type: "addCar";
1030
+ car: {
1031
+ x: number;
1032
+ z: number;
1033
+ yaw: number;
1034
+ };
1035
+ }, {
1036
+ type: "addCar";
1037
+ car: {
1038
+ x: number;
1039
+ z: number;
1040
+ yaw: number;
1041
+ };
1042
+ }>, z.ZodObject<{
1043
+ type: z.ZodLiteral<"remove">;
1044
+ id: z.ZodString;
1045
+ }, "strip", z.ZodTypeAny, {
1046
+ type: "remove";
1047
+ id: string;
1048
+ }, {
1049
+ type: "remove";
1050
+ id: string;
1051
+ }>, z.ZodObject<{
1052
+ type: z.ZodLiteral<"carDoor">;
1053
+ id: z.ZodString;
1054
+ index: z.ZodNumber;
1055
+ open: z.ZodBoolean;
1056
+ }, "strip", z.ZodTypeAny, {
1057
+ type: "carDoor";
1058
+ id: string;
1059
+ index: number;
1060
+ open: boolean;
1061
+ }, {
1062
+ type: "carDoor";
1063
+ id: string;
1064
+ index: number;
1065
+ open: boolean;
1066
+ }>, z.ZodObject<{
1067
+ type: z.ZodLiteral<"carWindow">;
1068
+ id: z.ZodString;
1069
+ index: z.ZodNumber;
1070
+ open: z.ZodBoolean;
1071
+ }, "strip", z.ZodTypeAny, {
1072
+ type: "carWindow";
1073
+ id: string;
1074
+ index: number;
1075
+ open: boolean;
1076
+ }, {
1077
+ type: "carWindow";
1078
+ id: string;
1079
+ index: number;
1080
+ open: boolean;
1081
+ }>, z.ZodObject<{
1082
+ type: z.ZodLiteral<"carRadio">;
1083
+ id: z.ZodString;
1084
+ on: z.ZodBoolean;
1085
+ }, "strip", z.ZodTypeAny, {
1086
+ type: "carRadio";
1087
+ id: string;
1088
+ on: boolean;
1089
+ }, {
1090
+ type: "carRadio";
1091
+ id: string;
1092
+ on: boolean;
1093
+ }>, z.ZodObject<{
1094
+ type: z.ZodLiteral<"reset">;
1095
+ }, "strip", z.ZodTypeAny, {
1096
+ type: "reset";
1097
+ }, {
1098
+ type: "reset";
1099
+ }>]>;
1100
+ path: "/media-stream/scene/:streamId";
1101
+ responses: {
1102
+ 200: typeof import("@ts-rest/core").ContractNoBody;
1103
+ 400: z.ZodUnion<[z.ZodObject<{
1104
+ name: z.ZodLiteral<"ZodError">;
1105
+ issues: z.ZodArray<z.ZodObject<{
1106
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
1107
+ message: z.ZodOptional<z.ZodString>;
1108
+ code: z.ZodNativeEnum<{
1109
+ invalid_type: "invalid_type";
1110
+ invalid_literal: "invalid_literal";
1111
+ custom: "custom";
1112
+ invalid_union: "invalid_union";
1113
+ invalid_union_discriminator: "invalid_union_discriminator";
1114
+ invalid_enum_value: "invalid_enum_value";
1115
+ unrecognized_keys: "unrecognized_keys";
1116
+ invalid_arguments: "invalid_arguments";
1117
+ invalid_return_type: "invalid_return_type";
1118
+ invalid_date: "invalid_date";
1119
+ invalid_string: "invalid_string";
1120
+ too_small: "too_small";
1121
+ too_big: "too_big";
1122
+ invalid_intersection_types: "invalid_intersection_types";
1123
+ not_multiple_of: "not_multiple_of";
1124
+ not_finite: "not_finite";
1125
+ }>;
1126
+ }, "strip", z.ZodAny, z.objectOutputType<{
1127
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
1128
+ message: z.ZodOptional<z.ZodString>;
1129
+ code: z.ZodNativeEnum<{
1130
+ invalid_type: "invalid_type";
1131
+ invalid_literal: "invalid_literal";
1132
+ custom: "custom";
1133
+ invalid_union: "invalid_union";
1134
+ invalid_union_discriminator: "invalid_union_discriminator";
1135
+ invalid_enum_value: "invalid_enum_value";
1136
+ unrecognized_keys: "unrecognized_keys";
1137
+ invalid_arguments: "invalid_arguments";
1138
+ invalid_return_type: "invalid_return_type";
1139
+ invalid_date: "invalid_date";
1140
+ invalid_string: "invalid_string";
1141
+ too_small: "too_small";
1142
+ too_big: "too_big";
1143
+ invalid_intersection_types: "invalid_intersection_types";
1144
+ not_multiple_of: "not_multiple_of";
1145
+ not_finite: "not_finite";
1146
+ }>;
1147
+ }, z.ZodAny, "strip">, z.objectInputType<{
1148
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
1149
+ message: z.ZodOptional<z.ZodString>;
1150
+ code: z.ZodNativeEnum<{
1151
+ invalid_type: "invalid_type";
1152
+ invalid_literal: "invalid_literal";
1153
+ custom: "custom";
1154
+ invalid_union: "invalid_union";
1155
+ invalid_union_discriminator: "invalid_union_discriminator";
1156
+ invalid_enum_value: "invalid_enum_value";
1157
+ unrecognized_keys: "unrecognized_keys";
1158
+ invalid_arguments: "invalid_arguments";
1159
+ invalid_return_type: "invalid_return_type";
1160
+ invalid_date: "invalid_date";
1161
+ invalid_string: "invalid_string";
1162
+ too_small: "too_small";
1163
+ too_big: "too_big";
1164
+ invalid_intersection_types: "invalid_intersection_types";
1165
+ not_multiple_of: "not_multiple_of";
1166
+ not_finite: "not_finite";
1167
+ }>;
1168
+ }, z.ZodAny, "strip">>, "many">;
1169
+ }, "strip", z.ZodTypeAny, {
1170
+ name: "ZodError";
1171
+ issues: z.objectOutputType<{
1172
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
1173
+ message: z.ZodOptional<z.ZodString>;
1174
+ code: z.ZodNativeEnum<{
1175
+ invalid_type: "invalid_type";
1176
+ invalid_literal: "invalid_literal";
1177
+ custom: "custom";
1178
+ invalid_union: "invalid_union";
1179
+ invalid_union_discriminator: "invalid_union_discriminator";
1180
+ invalid_enum_value: "invalid_enum_value";
1181
+ unrecognized_keys: "unrecognized_keys";
1182
+ invalid_arguments: "invalid_arguments";
1183
+ invalid_return_type: "invalid_return_type";
1184
+ invalid_date: "invalid_date";
1185
+ invalid_string: "invalid_string";
1186
+ too_small: "too_small";
1187
+ too_big: "too_big";
1188
+ invalid_intersection_types: "invalid_intersection_types";
1189
+ not_multiple_of: "not_multiple_of";
1190
+ not_finite: "not_finite";
1191
+ }>;
1192
+ }, z.ZodAny, "strip">[];
1193
+ }, {
1194
+ name: "ZodError";
1195
+ issues: z.objectInputType<{
1196
+ path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
1197
+ message: z.ZodOptional<z.ZodString>;
1198
+ code: z.ZodNativeEnum<{
1199
+ invalid_type: "invalid_type";
1200
+ invalid_literal: "invalid_literal";
1201
+ custom: "custom";
1202
+ invalid_union: "invalid_union";
1203
+ invalid_union_discriminator: "invalid_union_discriminator";
1204
+ invalid_enum_value: "invalid_enum_value";
1205
+ unrecognized_keys: "unrecognized_keys";
1206
+ invalid_arguments: "invalid_arguments";
1207
+ invalid_return_type: "invalid_return_type";
1208
+ invalid_date: "invalid_date";
1209
+ invalid_string: "invalid_string";
1210
+ too_small: "too_small";
1211
+ too_big: "too_big";
1212
+ invalid_intersection_types: "invalid_intersection_types";
1213
+ not_multiple_of: "not_multiple_of";
1214
+ not_finite: "not_finite";
1215
+ }>;
1216
+ }, z.ZodAny, "strip">[];
1217
+ }>, z.ZodObject<{
1218
+ code: z.ZodType<"SCENE_FULL", z.ZodTypeDef, "SCENE_FULL">;
1219
+ error: z.ZodType<"The scene can't have more of this object", z.ZodTypeDef, "The scene can't have more of this object">;
1220
+ name: z.ZodLiteral<"APIError">;
1221
+ }, "strip", z.ZodTypeAny, {
1222
+ code: "SCENE_FULL";
1223
+ error: "The scene can't have more of this object";
1224
+ name: "APIError";
1225
+ }, {
1226
+ code: "SCENE_FULL";
1227
+ error: "The scene can't have more of this object";
1228
+ name: "APIError";
1229
+ }>, z.ZodObject<{
1230
+ code: z.ZodType<"SCENE_OBJECT_NOT_FOUND", z.ZodTypeDef, "SCENE_OBJECT_NOT_FOUND">;
1231
+ error: z.ZodType<"The scene object was not found", z.ZodTypeDef, "The scene object was not found">;
1232
+ name: z.ZodLiteral<"APIError">;
1233
+ }, "strip", z.ZodTypeAny, {
1234
+ code: "SCENE_OBJECT_NOT_FOUND";
1235
+ error: "The scene object was not found";
1236
+ name: "APIError";
1237
+ }, {
1238
+ code: "SCENE_OBJECT_NOT_FOUND";
1239
+ error: "The scene object was not found";
1240
+ name: "APIError";
1241
+ }>]>;
1242
+ 404: z.ZodObject<{
1243
+ code: z.ZodType<"STREAM_NOT_FOUND", z.ZodTypeDef, "STREAM_NOT_FOUND">;
1244
+ error: z.ZodType<"The requested stream was not found", z.ZodTypeDef, "The requested stream was not found">;
1245
+ name: z.ZodLiteral<"APIError">;
1246
+ }, "strip", z.ZodTypeAny, {
1247
+ code: "STREAM_NOT_FOUND";
1248
+ error: "The requested stream was not found";
1249
+ name: "APIError";
1250
+ }, {
1251
+ code: "STREAM_NOT_FOUND";
1252
+ error: "The requested stream was not found";
1253
+ name: "APIError";
1254
+ }>;
1255
+ 500: z.ZodObject<{
1256
+ code: z.ZodType<"INTERNAL_SERVER_ERROR", z.ZodTypeDef, "INTERNAL_SERVER_ERROR">;
1257
+ error: z.ZodType<string, z.ZodTypeDef, string>;
1258
+ name: z.ZodLiteral<"APIError">;
1259
+ }, "strip", z.ZodTypeAny, {
1260
+ code: "INTERNAL_SERVER_ERROR";
1261
+ error: string;
1262
+ name: "APIError";
1263
+ }, {
1264
+ code: "INTERNAL_SERVER_ERROR";
1265
+ error: string;
1266
+ name: "APIError";
1267
+ }>;
1268
+ };
1269
+ };
831
1270
  stream: {
832
1271
  description: "Get media stream by stream ID";
833
1272
  method: "GET";
@@ -1,6 +1,7 @@
1
1
  import { initContract, ZodErrorSchema } from "@ts-rest/core";
2
2
  import { z } from "zod";
3
3
  import { apiError, apiSuccess } from "../types.js";
4
+ import { mediaStreamSceneSchema, sceneActionSchema } from "../types/scene.js";
4
5
  const c = initContract();
5
6
  export default c.router({
6
7
  init: {
@@ -37,6 +38,7 @@ export default c.router({
37
38
  currentTime: z.number(),
38
39
  url: z.string(),
39
40
  paused: z.boolean(),
41
+ scene: mediaStreamSceneSchema,
40
42
  })),
41
43
  400: z.union([
42
44
  ZodErrorSchema,
@@ -97,6 +99,23 @@ export default c.router({
97
99
  500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
98
100
  },
99
101
  },
102
+ scene: {
103
+ method: "POST",
104
+ path: "/media-stream/scene/:streamId",
105
+ description: "Change the scene of a media stream, listeners get the new scene through the mediaStreamScene socket event",
106
+ body: sceneActionSchema,
107
+ responses: {
108
+ 200: c.noBody(),
109
+ 400: z.union([
110
+ ZodErrorSchema,
111
+ apiError(z.literal("SCENE_FULL"), z.literal("The scene can't have more of this object")),
112
+ apiError(z.literal("SCENE_OBJECT_NOT_FOUND"), z.literal("The scene object was not found")),
113
+ ]),
114
+ // 401: apiError(z.literal("UNAUTHORIZED"), z.literal("Unauthorized")),
115
+ 404: apiError(z.literal("STREAM_NOT_FOUND"), z.literal("The requested stream was not found")),
116
+ 500: apiError(z.literal("INTERNAL_SERVER_ERROR"), z.string()),
117
+ },
118
+ },
100
119
  stream: {
101
120
  method: "GET",
102
121
  path: "/media-stream/stream/:streamId",
@@ -1,3 +1,4 @@
1
+ import type { MediaStreamScene } from "../types/scene.js";
1
2
  export interface SocketClientToServerMediaStream {
2
3
  mediaStreamListen: (streamId: string, callback: (success: boolean) => void) => void;
3
4
  mediaStreamUnlisten: (streamId: string, callback: (success: boolean) => void) => void;
@@ -15,4 +16,6 @@ export interface SocketServerToClientMediaStream {
15
16
  mediaStreamSeek: (streamId: string, startTime: number) => void;
16
17
  /** The stream is gone, every request about it now returns 404 */
17
18
  mediaStreamEnd: (streamId: string, reason: MediaStreamEndReason) => void;
19
+ /** The scene changed, the whole new scene */
20
+ mediaStreamScene: (streamId: string, scene: MediaStreamScene) => void;
18
21
  }
@@ -1 +1,2 @@
1
1
  export * from "./youtube.js";
2
+ export * from "./scene.js";
@@ -1 +1,2 @@
1
1
  export * from "./youtube.js";
2
+ export * from "./scene.js";