@hytopia.com/server-protocol 1.3.20 → 1.3.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/server-protocol",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -23,7 +23,7 @@ export enum PacketId {
23
23
  INPUT = 1,
24
24
  STATE_REQUEST = 2,
25
25
  CHAT_MESSAGE_SEND = 3,
26
- UI_MESSAGE_SEND = 4,
26
+ UI_DATA_SEND = 4,
27
27
 
28
28
  // Standard Outbound Packet Types: 32 - 127 range
29
29
  SYNC_RESPONSE = 32,
@@ -36,7 +36,7 @@ export enum PacketId {
36
36
  WORLD = 39,
37
37
  CAMERA = 40,
38
38
  UI = 41,
39
- UI_MESSAGES = 42,
39
+ UI_DATAS = 42,
40
40
 
41
41
  // Debug Inbound Packet Types: 128 - 191 range
42
42
  DEBUG_CONFIG = 128,
@@ -0,0 +1,11 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { uiDataSchema } from '../../schemas/UIData';
4
+ import type { UIDataSchema } from '../../schemas/UIData';
5
+
6
+ export type UIDataSendPacket = IPacket<typeof PacketId.UI_DATA_SEND, UIDataSchema>;
7
+
8
+ export const uiDataSendPacketDefinition = definePacket(
9
+ PacketId.UI_DATA_SEND,
10
+ uiDataSchema
11
+ );
@@ -3,4 +3,4 @@ export * from './DebugConfig';
3
3
  export * from './Input';
4
4
  export * from './StateRequest';
5
5
  export * from './SyncRequest';
6
- export * from './UIMessageSend';
6
+ export * from './UIDataSend';
@@ -0,0 +1,12 @@
1
+ import { definePacket, PacketId } from '../PacketCore';
2
+ import type { IPacket } from '../PacketCore';
3
+ import { uiDatasSchema } from '../../schemas/UIDatas';
4
+ import type { UIDatasSchema } from '../../schemas/UIDatas';
5
+ import type { WorldTick } from '../PacketCore';
6
+
7
+ export type UIDatasPacket = IPacket<typeof PacketId.UI_DATAS, UIDatasSchema> & [WorldTick];
8
+
9
+ export const uiDatasPacketDefinition = definePacket(
10
+ PacketId.UI_DATAS,
11
+ uiDatasSchema,
12
+ );
@@ -9,5 +9,5 @@ export * from './PhysicsDebugRender';
9
9
  export * from './PhysicsDebugRaycasts';
10
10
  export * from './SyncResponse';
11
11
  export * from './UI';
12
- export * from './UIMessages';
12
+ export * from './UIDatas';
13
13
  export * from './World';
package/schemas/UI.ts CHANGED
@@ -1,17 +1,14 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
3
  export type UISchema = {
4
- c?: string[]; // css uris
5
- h?: string[]; // html uris
6
- j?: string[]; // js uris
4
+ u: string; // .html ui uri
7
5
  };
8
6
 
9
7
  export const uiSchema: JSONSchemaType<UISchema> = {
10
8
  type: 'object',
11
9
  properties: {
12
- c: { type: 'array', items: { type: 'string' }, nullable: true },
13
- h: { type: 'array', items: { type: 'string' }, nullable: true },
14
- j: { type: 'array', items: { type: 'string' }, nullable: true },
10
+ u: { type: 'string' },
15
11
  },
12
+ required: ['u'],
16
13
  additionalProperties: false,
17
14
  }
@@ -1,10 +1,10 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
- export type UIMessageSchema = {
3
+ export type UIDataSchema = {
4
4
  [key: string]: any;
5
5
  }
6
6
 
7
- export const uiMessageSchema: JSONSchemaType<UIMessageSchema> = {
7
+ export const uiDataSchema: JSONSchemaType<UIDataSchema> = {
8
8
  type: 'object',
9
9
  properties: {},
10
10
  additionalProperties: true,
@@ -0,0 +1,10 @@
1
+ import { uiDataSchema } from './UIData';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { UIDataSchema } from './UIData';
4
+
5
+ export type UIDatasSchema = UIDataSchema[];
6
+
7
+ export const uiDatasSchema: JSONSchemaType<UIDatasSchema> = {
8
+ type: 'array',
9
+ items: { ...uiDataSchema },
10
+ }
package/schemas/index.ts CHANGED
@@ -23,8 +23,8 @@ export * from './StateRequest';
23
23
  export * from './SyncRequest';
24
24
  export * from './SyncResponse';
25
25
  export * from './UI';
26
- export * from './UIMessage';
27
- export * from './UIMessages';
26
+ export * from './UIData';
27
+ export * from './UIDatas';
28
28
  export * from './Vector';
29
29
  export * from './VectorBoolean';
30
30
  export * from './World';
@@ -1,11 +0,0 @@
1
- import { definePacket, PacketId } from '../PacketCore';
2
- import type { IPacket } from '../PacketCore';
3
- import { uiMessageSchema } from '../../schemas/UIMessage';
4
- import type { UIMessageSchema } from '../../schemas/UIMessage';
5
-
6
- export type UIMessageSendPacket = IPacket<typeof PacketId.UI_MESSAGE_SEND, UIMessageSchema>;
7
-
8
- export const uiMessageSendPacketDefinition = definePacket(
9
- PacketId.UI_MESSAGE_SEND,
10
- uiMessageSchema
11
- );
@@ -1,12 +0,0 @@
1
- import { definePacket, PacketId } from '../PacketCore';
2
- import type { IPacket } from '../PacketCore';
3
- import { uiMessagesSchema } from '../../schemas/UIMessages';
4
- import type { UIMessagesSchema } from '../../schemas/UIMessages';
5
- import type { WorldTick } from '../PacketCore';
6
-
7
- export type UIMessagesPacket = IPacket<typeof PacketId.UI_MESSAGES, UIMessagesSchema> & [WorldTick];
8
-
9
- export const uiMessagesPacketDefinition = definePacket(
10
- PacketId.UI_MESSAGES,
11
- uiMessagesSchema,
12
- );
@@ -1,10 +0,0 @@
1
- import { uiMessageSchema } from './UIMessage';
2
- import type { JSONSchemaType } from 'ajv';
3
- import type { UIMessageSchema } from './UIMessage';
4
-
5
- export type UIMessagesSchema = UIMessageSchema[];
6
-
7
- export const uiMessagesSchema: JSONSchemaType<UIMessagesSchema> = {
8
- type: 'array',
9
- items: { ...uiMessageSchema },
10
- }