From fe69ceb14b1398deb6aeb95f4357a6542a2c3ec8 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 22 Sep 2019 18:59:51 -0500 Subject: [PATCH] refactor: sync schema --- packages/net/s13n/synchronized-create.packet.js | 9 ++------- packages/net/s13n/synchronized-destroy.packet.js | 3 +-- packages/net/s13n/synchronized-update.packet.js | 3 +-- packages/net/s13n/synchronized.packet.js | 7 ++++++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/net/s13n/synchronized-create.packet.js b/packages/net/s13n/synchronized-create.packet.js index fd1ee58..6dcf828 100644 --- a/packages/net/s13n/synchronized-create.packet.js +++ b/packages/net/s13n/synchronized-create.packet.js @@ -10,14 +10,9 @@ export class SynchronizedCreatePacket extends SynchronizedPacket { return super.pack(packet); } - static get schema() { - const superSchema = super.schema; + static get synchronizationSchema() { return { - ...superSchema, - data: { - ...superSchema.data, - spec: 'buffer', - }, + spec: 'buffer', }; } diff --git a/packages/net/s13n/synchronized-destroy.packet.js b/packages/net/s13n/synchronized-destroy.packet.js index 4282e8f..bbcbdb5 100644 --- a/packages/net/s13n/synchronized-destroy.packet.js +++ b/packages/net/s13n/synchronized-destroy.packet.js @@ -1,4 +1,3 @@ import {SynchronizedPacket} from './synchronized.packet'; -export class SynchronizedDestroyPacket extends SynchronizedPacket { -} +export class SynchronizedDestroyPacket extends SynchronizedPacket {} diff --git a/packages/net/s13n/synchronized-update.packet.js b/packages/net/s13n/synchronized-update.packet.js index 0c29102..93961de 100644 --- a/packages/net/s13n/synchronized-update.packet.js +++ b/packages/net/s13n/synchronized-update.packet.js @@ -1,4 +1,3 @@ import {SynchronizedPacket} from './synchronized.packet'; -export class SynchronizedUpdatePacket extends SynchronizedPacket { -} +export class SynchronizedUpdatePacket extends SynchronizedPacket {} diff --git a/packages/net/s13n/synchronized.packet.js b/packages/net/s13n/synchronized.packet.js index 0719f27..691ad27 100644 --- a/packages/net/s13n/synchronized.packet.js +++ b/packages/net/s13n/synchronized.packet.js @@ -8,10 +8,15 @@ export class SynchronizedPacket extends Packet { data: { synchronized: { type: 'uint8', - id: 'uint32', + id: 'varuint', }, + ...this.synchronizationSchema, }, }; } + static get synchronizationSchema() { + return {}; + } + }