@axpecter/lync 1.5.0 → 1.5.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/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ```toml
15
15
  [dependencies]
16
- Lync = "axp3cter/lync@1.5.0"
16
+ Lync = "axp3cter/lync@1.5.1"
17
17
  ```
18
18
 
19
19
  **npm (roblox-ts)**
@@ -163,7 +163,7 @@ end
163
163
  | | What it does |
164
164
  |:---------|:------------|
165
165
  | `Lync.start()` | Sets up transport. Server creates remotes, client connects. Call once after all definitions. |
166
- | `Lync.VERSION` | `"1.5.0"` |
166
+ | `Lync.VERSION` | `"1.5.1"` |
167
167
 
168
168
  ## Packets
169
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axpecter/lync",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Buffer networking for Roblox. Delta compression, XOR framing, built-in security.",
5
5
  "main": "src/init.luau",
6
6
  "types": "src/index.d.ts",
@@ -41,31 +41,28 @@ type PacketFields = {
41
41
  _signal: Signal.Signal,
42
42
  }
43
43
 
44
- -- Shared methods(both contexts)
45
- local SharedImpl = {}
44
+ -- Server-only metatable. Single send() dispatches on target type.
45
+ local ServerImpl = {}
46
+ ServerImpl.__index = ServerImpl
47
+
48
+ export type Packet = typeof(setmetatable({} :: PacketFields, ServerImpl))
46
49
 
47
- function SharedImpl.listen(self: Packet, callback: (...any) -> ()): Connection
50
+ function ServerImpl.listen(self: Packet, callback: (...any) -> ()): Connection
48
51
  return self._signal:connect(callback)
49
52
  end
50
53
 
51
- function SharedImpl.once(self: Packet, callback: (...any) -> ()): Connection
54
+ function ServerImpl.once(self: Packet, callback: (...any) -> ()): Connection
52
55
  return self._signal:once(callback)
53
56
  end
54
57
 
55
- function SharedImpl.wait(self: Packet): ...any
58
+ function ServerImpl.wait(self: Packet): ...any
56
59
  return self._signal:wait()
57
60
  end
58
61
 
59
- function SharedImpl.disconnectAll(self: Packet): ()
62
+ function ServerImpl.disconnectAll(self: Packet): ()
60
63
  self._signal:disconnectAll()
61
64
  end
62
65
 
63
- -- Server-only metatable. Single send() dispatches on target type.
64
- local ServerImpl = setmetatable({}, { __index = SharedImpl })
65
- ServerImpl.__index = ServerImpl
66
-
67
- export type Packet = typeof(setmetatable({} :: PacketFields, ServerImpl))
68
-
69
66
  local function checkDeltaMode(self: Packet, mode: number): ()
70
67
  if not self._isDelta then
71
68
  return
@@ -127,9 +124,25 @@ end
127
124
  table.freeze(ServerImpl)
128
125
 
129
126
  -- Client-only metatable. Has send(), no target needed.
130
- local ClientImpl = setmetatable({}, { __index = SharedImpl })
127
+ local ClientImpl = {}
131
128
  ClientImpl.__index = ClientImpl
132
129
 
130
+ function ClientImpl.listen(self: Packet, callback: (...any) -> ()): Connection
131
+ return self._signal:connect(callback)
132
+ end
133
+
134
+ function ClientImpl.once(self: Packet, callback: (...any) -> ()): Connection
135
+ return self._signal:once(callback)
136
+ end
137
+
138
+ function ClientImpl.wait(self: Packet): ...any
139
+ return self._signal:wait()
140
+ end
141
+
142
+ function ClientImpl.disconnectAll(self: Packet): ()
143
+ self._signal:disconnectAll()
144
+ end
145
+
133
146
  function ClientImpl.send(self: Packet, data: any): ()
134
147
  clientWrite(self._id, self._name, self._codec, data, self._isUnreliable)
135
148
  end
package/src/index.d.ts CHANGED
@@ -186,11 +186,11 @@ export interface Namespace {
186
186
  ): Connection;
187
187
  onSend(
188
188
  this: Namespace,
189
- handler: (data: unknown, name: string, player: Player | undefined) => unknown | undefined,
189
+ handler: (data: unknown, name: string, player: Player | undefined) => unknown | DropSentinel | undefined,
190
190
  ): () => void;
191
191
  onReceive(
192
192
  this: Namespace,
193
- handler: (data: unknown, name: string, player: Player | undefined) => unknown | undefined,
193
+ handler: (data: unknown, name: string, player: Player | undefined) => unknown | DropSentinel | undefined,
194
194
  ): () => void;
195
195
  disconnectAll(this: Namespace): void;
196
196
  destroy(this: Namespace): void;
package/src/init.luau CHANGED
@@ -104,7 +104,7 @@ end
104
104
  -- Public --------------------------------------------------------------
105
105
 
106
106
  local Lync = {
107
- VERSION = "1.5.0",
107
+ VERSION = "1.5.1",
108
108
 
109
109
  -- Lifecycle
110
110
  start = start,