mcbe-ipc 3.0.3 → 3.0.4

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.
@@ -124,7 +124,7 @@ export var DirectIPC;
124
124
  const stream = new PROTO.ByteQueue();
125
125
  yield* serializer.serialize(value, stream);
126
126
  const bytes = yield* $.MAYBE_ENCRYPT(stream.to_uint8array());
127
- yield* NET.emit(`ipc:${$._to}:${channel}:send`, ConnectionSerializer, {
127
+ yield* NET.emit(`ipc:${$._to}:manager:${channel}:send`, ConnectionSerializer, {
128
128
  from: $._from,
129
129
  bytes
130
130
  });
@@ -136,13 +136,13 @@ export var DirectIPC;
136
136
  const stream = new PROTO.ByteQueue();
137
137
  yield* serializer.serialize(value, stream);
138
138
  const bytes = yield* $.MAYBE_ENCRYPT(stream.to_uint8array());
139
- yield* NET.emit(`ipc:${$._to}:${channel}:invoke`, ConnectionSerializer, {
139
+ yield* NET.emit(`ipc:${$._to}:manager:${channel}:invoke`, ConnectionSerializer, {
140
140
  from: $._from,
141
141
  bytes
142
142
  });
143
143
  })());
144
144
  return new Promise(resolve => {
145
- const terminate = NET.listen(`ipc:${$._from}:${channel}:handle`, ConnectionSerializer, function* (data) {
145
+ const terminate = NET.listen(`ipc:${$._from}:connection:${channel}:handle`, ConnectionSerializer, function* (data) {
146
146
  if (data.from === $._to) {
147
147
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes);
148
148
  const stream = PROTO.ByteQueue.from_uint8array(bytes);
@@ -155,7 +155,7 @@ export var DirectIPC;
155
155
  }
156
156
  on(channel, deserializer, listener) {
157
157
  const $ = this;
158
- const terminate = NET.listen(`ipc:${$._from}:${channel}:send`, ConnectionSerializer, function* (data) {
158
+ const terminate = NET.listen(`ipc:${$._from}:connection:${channel}:send`, ConnectionSerializer, function* (data) {
159
159
  if (data.from === $._to) {
160
160
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes);
161
161
  const stream = PROTO.ByteQueue.from_uint8array(bytes);
@@ -168,7 +168,7 @@ export var DirectIPC;
168
168
  }
169
169
  once(channel, deserializer, listener) {
170
170
  const $ = this;
171
- const terminate = NET.listen(`ipc:${$._from}:${channel}:send`, ConnectionSerializer, function* (data) {
171
+ const terminate = NET.listen(`ipc:${$._from}:connection:${channel}:send`, ConnectionSerializer, function* (data) {
172
172
  if (data.from === $._to) {
173
173
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes);
174
174
  const stream = PROTO.ByteQueue.from_uint8array(bytes);
@@ -182,7 +182,7 @@ export var DirectIPC;
182
182
  }
183
183
  handle(channel, deserializer, serializer, listener) {
184
184
  const $ = this;
185
- const terminate = NET.listen(`ipc:${$._from}:${channel}:invoke`, ConnectionSerializer, function* (data) {
185
+ const terminate = NET.listen(`ipc:${$._from}:connection:${channel}:invoke`, ConnectionSerializer, function* (data) {
186
186
  if (data.from === $._to) {
187
187
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes);
188
188
  const stream = PROTO.ByteQueue.from_uint8array(bytes);
@@ -191,7 +191,7 @@ export var DirectIPC;
191
191
  const return_stream = new PROTO.ByteQueue();
192
192
  yield* serializer.serialize(result, return_stream);
193
193
  const return_bytes = yield* $.MAYBE_ENCRYPT(return_stream.to_uint8array());
194
- yield* NET.emit(`ipc:${$._to}:${channel}:handle`, ConnectionSerializer, {
194
+ yield* NET.emit(`ipc:${$._to}:manager:${channel}:handle`, ConnectionSerializer, {
195
195
  from: $._from,
196
196
  bytes: return_bytes
197
197
  });
@@ -284,7 +284,7 @@ export var DirectIPC;
284
284
  const stream = new PROTO.ByteQueue();
285
285
  yield* serializer.serialize(value, stream);
286
286
  const bytes = yield* $.MAYBE_ENCRYPT(stream.to_uint8array(), enc);
287
- yield* NET.emit(`ipc:${key}:${channel}:send`, ConnectionSerializer, {
287
+ yield* NET.emit(`ipc:${key}:connection:${channel}:send`, ConnectionSerializer, {
288
288
  from: $._id,
289
289
  bytes
290
290
  });
@@ -299,13 +299,13 @@ export var DirectIPC;
299
299
  const stream = new PROTO.ByteQueue();
300
300
  yield* serializer.serialize(value, stream);
301
301
  const bytes = yield* $.MAYBE_ENCRYPT(stream.to_uint8array(), enc);
302
- yield* NET.emit(`ipc:${key}:${channel}:invoke`, ConnectionSerializer, {
302
+ yield* NET.emit(`ipc:${key}:connection:${channel}:invoke`, ConnectionSerializer, {
303
303
  from: $._id,
304
304
  bytes
305
305
  });
306
306
  })());
307
307
  promises.push(new Promise(resolve => {
308
- const terminate = NET.listen(`ipc:${$._id}:${channel}:handle`, ConnectionSerializer, function* (data) {
308
+ const terminate = NET.listen(`ipc:${$._id}:manager:${channel}:handle`, ConnectionSerializer, function* (data) {
309
309
  if (data.from === key) {
310
310
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes, enc);
311
311
  const stream = PROTO.ByteQueue.from_uint8array(bytes);
@@ -320,7 +320,7 @@ export var DirectIPC;
320
320
  }
321
321
  on(channel, deserializer, listener) {
322
322
  const $ = this;
323
- return NET.listen(`ipc:${$._id}:${channel}:send`, ConnectionSerializer, function* (data) {
323
+ return NET.listen(`ipc:${$._id}:manager:${channel}:send`, ConnectionSerializer, function* (data) {
324
324
  const enc = $._enc_map.get(data.from);
325
325
  if (enc !== undefined) {
326
326
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes, enc);
@@ -332,7 +332,7 @@ export var DirectIPC;
332
332
  }
333
333
  once(channel, deserializer, listener) {
334
334
  const $ = this;
335
- const terminate = NET.listen(`ipc:${$._id}:${channel}:send`, ConnectionSerializer, function* (data) {
335
+ const terminate = NET.listen(`ipc:${$._id}:manager:${channel}:send`, ConnectionSerializer, function* (data) {
336
336
  const enc = $._enc_map.get(data.from);
337
337
  if (enc !== undefined) {
338
338
  const bytes = yield* $.MAYBE_DECRYPT(data.bytes, enc);
@@ -346,7 +346,7 @@ export var DirectIPC;
346
346
  }
347
347
  handle(channel, deserializer, serializer, listener) {
348
348
  const $ = this;
349
- return NET.listen(`ipc:${$._id}:${channel}:invoke`, ConnectionSerializer, function* (data) {
349
+ return NET.listen(`ipc:${$._id}:manager:${channel}:invoke`, ConnectionSerializer, function* (data) {
350
350
  const enc = $._enc_map.get(data.from);
351
351
  if (enc !== undefined) {
352
352
  const input_bytes = yield* $.MAYBE_DECRYPT(data.bytes, enc);
@@ -356,7 +356,7 @@ export var DirectIPC;
356
356
  const output_stream = new PROTO.ByteQueue();
357
357
  yield* serializer.serialize(result, output_stream);
358
358
  const output_bytes = yield* $.MAYBE_ENCRYPT(output_stream.to_uint8array(), enc);
359
- yield* NET.emit(`ipc:${data.from}:${channel}:handle`, ConnectionSerializer, {
359
+ yield* NET.emit(`ipc:${data.from}:connection:${channel}:handle`, ConnectionSerializer, {
360
360
  from: $._id,
361
361
  bytes: output_bytes
362
362
  });
package/dist/ipc.js CHANGED
@@ -342,7 +342,7 @@ export var PROTO;
342
342
  function Optional(value) {
343
343
  return {
344
344
  *serialize(optional, stream) {
345
- yield* PROTO.Boolean.serialize(value !== undefined, stream);
345
+ yield* PROTO.Boolean.serialize(optional !== undefined, stream);
346
346
  if (optional !== undefined) {
347
347
  yield* value.serialize(optional, stream);
348
348
  }
@@ -420,7 +420,7 @@ export var NET;
420
420
  for (let i = 0; i < uint8array.length; i++) {
421
421
  const char_code = uint8array[i] | (uint8array[++i] << 8);
422
422
  const utf16_size = char_code <= 0x7f ? 1 : char_code <= 0x7ff ? 2 : char_code <= 0xffff ? 3 : 4;
423
- const char_size = char_code > 0xff ? utf16_size : 3;
423
+ const char_size = char_code > 0xff ? utf16_size : 2;
424
424
  if (acc_size + char_size > max_size) {
425
425
  result.push(acc_str);
426
426
  acc_str = '';
package/dist/proto.js CHANGED
@@ -341,7 +341,7 @@ export var PROTO;
341
341
  function Optional(value) {
342
342
  return {
343
343
  *serialize(optional, stream) {
344
- yield* PROTO.Boolean.serialize(value !== undefined, stream);
344
+ yield* PROTO.Boolean.serialize(optional !== undefined, stream);
345
345
  if (optional !== undefined) {
346
346
  yield* value.serialize(optional, stream);
347
347
  }
package/package.json CHANGED
@@ -3,10 +3,10 @@
3
3
  "author": "OmniacDev",
4
4
  "description": "IPC system for MCBE Script API projects",
5
5
  "license": "MIT",
6
- "version": "3.0.3",
6
+ "version": "3.0.4",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/OmniacDev/mcbe-ipc.git"
9
+ "url": "git+https://github.com/OmniacDev/mcbe-ipc.git"
10
10
  },
11
11
  "bugs": {
12
12
  "url": "https://github.com/OmniacDev/mcbe-ipc/issues"