@crvouga/mockingbird-service-aws-iot 0.9.5 → 0.9.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog — @crvouga/mockingbird-service-aws-iot
2
2
 
3
+ ## 0.9.7 (2026-11-03)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - rewrite mounted HTML for any media type case, formaction, srcset and meta refresh ([c70f512](https://github.com/crvouga/mockingbird/commit/c70f5126a340da0217d0217fb9652daf465e1ecb))
8
+ - show a placeholder for an audit event without a time ([2b2611b](https://github.com/crvouga/mockingbird/commit/2b2611b1af75fc48ec91e07ba15b96372946695f))
9
+ - attach the snapshot download link and revoke its URL later ([a106903](https://github.com/crvouga/mockingbird/commit/a106903abe9d7d5def7f2857e2d7644c4ebcdae2))
10
+ - stop the page-hide save inheriting the last write's result as `force` ([551c2dc](https://github.com/crvouga/mockingbird/commit/551c2dcd3615f82e70e0cd0b8a11c82a663d18b6))
11
+ - keep the record id in the State table's id column ([2fc9bee](https://github.com/crvouga/mockingbird/commit/2fc9beeba6dd8bfe129993a4ff53fbd2925bf569))
12
+ - bound what routeConnection buffers before CONNECT ([1bd5af7](https://github.com/crvouga/mockingbird/commit/1bd5af7070165303ff7bae9d55f850f27d5a5aa7))
13
+ - prune idempotency keys after 24 hours on the mock clock ([094c8b1](https://github.com/crvouga/mockingbird/commit/094c8b124211ae02901c26eb96cca410434b855a))
14
+ - drop the previous emulator's manifest when switching emulators ([7ed4666](https://github.com/crvouga/mockingbird/commit/7ed46661288662a3789dbe013f1a195905b217e4))
15
+ - reject a migration list that repeats an id, naming it ([47721d9](https://github.com/crvouga/mockingbird/commit/47721d96a29f4b5184322d19c1b10750086e8da4))
16
+ - reserve the manual admin view id ([3d4da92](https://github.com/crvouga/mockingbird/commit/3d4da926182ce609fba44e0fd58abcbb253eee2c))
17
+ - cap a reassembled WebSocket message and close with 1009 past it ([ae04b19](https://github.com/crvouga/mockingbird/commit/ae04b19cad284380e376cff5222d6e1af14d6d45))
18
+
19
+ ### Dependencies
20
+
21
+ - `@crvouga/mockingbird-service-sqlite`
22
+
23
+ ## 0.9.6 (2026-11-02)
24
+
25
+ ### Fixes and improvements
26
+
27
+ - save and replay a 500 the endpoint produced under an Idempotency-Key ([789bbcc](https://github.com/crvouga/mockingbird/commit/789bbcccb792cddaf27f4f6db6d2fcf2da1d07fe))
28
+
3
29
  ## 0.9.5 (2026-11-02)
4
30
 
5
31
  ### Fixes and improvements
@@ -1,4 +1,5 @@
1
1
  import {
2
+ MAX_VARIABLE_BYTE_INTEGER,
2
3
  MQTT_WEBSOCKET_PATH,
3
4
  createClock,
4
5
  createRuntime,
@@ -11,7 +12,7 @@ import {
11
12
  parseSettings,
12
13
  resolveAdminPrefix,
13
14
  restoreClock
14
- } from "./chunk-5ZZQG35Z.js";
15
+ } from "./chunk-BVRCGL7Y.js";
15
16
 
16
17
  // src/server.ts
17
18
  import { readFileSync } from "node:fs";
@@ -3062,7 +3063,7 @@ async function preflightFleet(config, options) {
3062
3063
  break;
3063
3064
  }
3064
3065
  }
3065
- targets.set(name, { ...target, packageVersion: packageVersion ?? "0.9.5" });
3066
+ targets.set(name, { ...target, packageVersion: packageVersion ?? "0.9.7" });
3066
3067
  } catch (error) {
3067
3068
  throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
3068
3069
  }
@@ -5038,7 +5039,7 @@ var listenTcp = (attach, options = {}) => {
5038
5039
  });
5039
5040
  };
5040
5041
  var WEBSOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
5041
- var MAX_FRAME_BYTES = 268435460;
5042
+ var MAX_MESSAGE_BYTES = MAX_VARIABLE_BYTE_INTEGER + 5;
5042
5043
  var OPCODE = { continuation: 0, text: 1, binary: 2, close: 8, ping: 9, pong: 10 };
5043
5044
  var encodeFrame = (opcode, payload) => {
5044
5045
  const length = payload.length;
@@ -5058,11 +5059,21 @@ var encodeFrame = (opcode, payload) => {
5058
5059
  header[0] = 128 | opcode;
5059
5060
  return Buffer.concat([header, payload]);
5060
5061
  };
5061
- var frameParser = (onFrame, onError) => {
5062
+ var frameParser = (onFrame, onError, maxMessageBytes) => {
5062
5063
  let buffer = Buffer.alloc(0);
5063
5064
  let fragments = [];
5065
+ let fragmentBytes = 0;
5064
5066
  let fragmentOpcode = 0;
5067
+ let failed = false;
5068
+ const fail = (error) => {
5069
+ failed = true;
5070
+ fragments = [];
5071
+ buffer = Buffer.alloc(0);
5072
+ onError(error);
5073
+ };
5065
5074
  return (chunk) => {
5075
+ if (failed)
5076
+ return;
5066
5077
  buffer = buffer.length === 0 ? chunk : Buffer.concat([buffer, chunk]);
5067
5078
  for (; ; ) {
5068
5079
  if (buffer.length < 2)
@@ -5070,7 +5081,7 @@ var frameParser = (onFrame, onError) => {
5070
5081
  const first = buffer[0] ?? 0;
5071
5082
  const second = buffer[1] ?? 0;
5072
5083
  if ((first & 112) !== 0 || (second & 128) === 0) {
5073
- onError();
5084
+ fail("protocol");
5074
5085
  return;
5075
5086
  }
5076
5087
  const fin = (first & 128) !== 0;
@@ -5086,13 +5097,20 @@ var frameParser = (onFrame, onError) => {
5086
5097
  if (buffer.length < 10)
5087
5098
  return;
5088
5099
  const wide = buffer.readBigUInt64BE(2);
5089
- if (wide > BigInt(MAX_FRAME_BYTES)) {
5090
- onError();
5100
+ if (wide > BigInt(MAX_MESSAGE_BYTES)) {
5101
+ fail("too-big");
5091
5102
  return;
5092
5103
  }
5093
5104
  length = Number(wide);
5094
5105
  offset = 10;
5095
5106
  }
5107
+ if (opcode < 8) {
5108
+ const total = (opcode === OPCODE.continuation ? fragmentBytes : 0) + length;
5109
+ if (total > maxMessageBytes) {
5110
+ fail("too-big");
5111
+ return;
5112
+ }
5113
+ }
5096
5114
  if (buffer.length < offset + 4 + length)
5097
5115
  return;
5098
5116
  const mask = buffer.subarray(offset, offset + 4);
@@ -5107,14 +5125,16 @@ var frameParser = (onFrame, onError) => {
5107
5125
  }
5108
5126
  if (opcode === OPCODE.continuation) {
5109
5127
  if (fragmentOpcode === 0) {
5110
- onError();
5128
+ fail("protocol");
5111
5129
  return;
5112
5130
  }
5113
5131
  fragments.push(payload);
5132
+ fragmentBytes += length;
5114
5133
  if (fin) {
5115
5134
  const message = Buffer.concat(fragments);
5116
5135
  const type = fragmentOpcode;
5117
5136
  fragments = [];
5137
+ fragmentBytes = 0;
5118
5138
  fragmentOpcode = 0;
5119
5139
  onFrame(type, message);
5120
5140
  }
@@ -5125,6 +5145,7 @@ var frameParser = (onFrame, onError) => {
5125
5145
  else {
5126
5146
  fragmentOpcode = opcode;
5127
5147
  fragments = [payload];
5148
+ fragmentBytes = length;
5128
5149
  }
5129
5150
  }
5130
5151
  };
@@ -5190,7 +5211,13 @@ var attachWebSocket = (server, options) => {
5190
5211
  socket.end(() => socket.destroy());
5191
5212
  } else if (opcode === OPCODE.text)
5192
5213
  socket.destroy();
5193
- }, () => socket.destroy());
5214
+ }, (error) => {
5215
+ if (error === "too-big" && socket.writable) {
5216
+ socket.write(encodeFrame(OPCODE.close, Uint8Array.of(3, 241)));
5217
+ socket.end(() => socket.destroy());
5218
+ } else
5219
+ socket.destroy();
5220
+ }, Math.min(options.maxMessageBytes ?? MAX_MESSAGE_BYTES, MAX_MESSAGE_BYTES));
5194
5221
  socket.on("data", (chunk) => parse(chunk));
5195
5222
  socket.on("error", () => socket.destroy());
5196
5223
  socket.on("close", () => {
@@ -5404,4 +5431,4 @@ export {
5404
5431
  loadSettingsFile,
5405
5432
  serveTarget
5406
5433
  };
5407
- //# sourceMappingURL=chunk-JR6YTJ6D.js.map
5434
+ //# sourceMappingURL=chunk-7RCP6E2W.js.map