@crvouga/mockingbird-service-dynamodb 3.10.5 → 3.10.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,19 @@
1
1
  # Changelog — @crvouga/mockingbird-service-dynamodb
2
2
 
3
+ ## 3.10.7 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - place key-order helpers away from the condition-expression code ([af51e56](https://github.com/crvouga/mockingbird/commit/af51e5649cf406c8b4f7a16a4eb80b5da1fabdcb))
8
+ - order sort keys by DynamoDB's byte order ([7331cc1](https://github.com/crvouga/mockingbird/commit/7331cc1244fa256c82abeba9860589791b03d193))
9
+
10
+ ## 3.10.6 (2026-11-02)
11
+
12
+ ### Fixes and improvements
13
+
14
+ - stop walkSchema recursing forever on a self-referential $ref ([69464a9](https://github.com/crvouga/mockingbird/commit/69464a9d9e7f468c5e1095125108d4d3d5515431))
15
+ - densify sparse bracket arrays by their written indices ([84a28cb](https://github.com/crvouga/mockingbird/commit/84a28cb182e3d7df91102897f0fc11fca714ba5f))
16
+
3
17
  ## 3.10.5 (2026-11-02)
4
18
 
5
19
  ### Fixes and improvements
@@ -1778,8 +1778,8 @@ var requestBodyMap = (value) => {
1778
1778
  for (const [path, expected] of Object.entries(value)) {
1779
1779
  if (path === "" || path.split(".").includes(""))
1780
1780
  throw new ControlError(`fault.requestBody: ${JSON.stringify(path)} is not a dotted path`);
1781
- const scalar2 = expected === null || typeof expected === "string" || typeof expected === "boolean" || typeof expected === "number" && Number.isFinite(expected);
1782
- if (!scalar2)
1781
+ const scalar = expected === null || typeof expected === "string" || typeof expected === "boolean" || typeof expected === "number" && Number.isFinite(expected);
1782
+ if (!scalar)
1783
1783
  throw new ControlError(`fault.requestBody.${path}: expected a string, number, boolean or null`);
1784
1784
  }
1785
1785
  return value;
@@ -3861,7 +3861,7 @@ var stateAdminRoutes = (routes) => {
3861
3861
  };
3862
3862
 
3863
3863
  // ../core/dist/version.js
3864
- var PACKAGE_VERSION = true ? "3.10.5" : UNRELEASED_VERSION;
3864
+ var PACKAGE_VERSION = true ? "3.10.7" : UNRELEASED_VERSION;
3865
3865
 
3866
3866
  // ../core/dist/webhooks.js
3867
3867
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -4032,21 +4032,21 @@ var realSleep = (ms, signal) => new Promise((resolve2, reject) => {
4032
4032
  signal?.addEventListener("abort", abort, { once: true });
4033
4033
  });
4034
4034
  var NULL_BODY_STATUS = /* @__PURE__ */ new Set([101, 204, 205, 304]);
4035
- var truncateResponse = (response, bytes2) => {
4035
+ var truncateResponse = (response, bytes3) => {
4036
4036
  if (NULL_BODY_STATUS.has(response.status))
4037
4037
  return response;
4038
4038
  const reader = response.body?.getReader();
4039
4039
  let sent = 0;
4040
4040
  const body = new ReadableStream({
4041
4041
  async pull(controller) {
4042
- const chunk = sent < bytes2 && reader ? await reader.read() : void 0;
4042
+ const chunk = sent < bytes3 && reader ? await reader.read() : void 0;
4043
4043
  if (!chunk || chunk.done) {
4044
4044
  await reader?.cancel().catch(() => {
4045
4045
  });
4046
4046
  controller.error(new DroppedConnectionError("truncate"));
4047
4047
  return;
4048
4048
  }
4049
- const part = chunk.value.subarray(0, bytes2 - sent);
4049
+ const part = chunk.value.subarray(0, bytes3 - sent);
4050
4050
  sent += part.length;
4051
4051
  controller.enqueue(part);
4052
4052
  },
@@ -5515,7 +5515,6 @@ var createRuntime2 = (options = {}) => createRuntime({
5515
5515
  var DYNAMODB_NAMESPACE = "dynamodb";
5516
5516
  var accessKeyCredential = sigV4AccessKeyId;
5517
5517
  var clone = (value) => structuredClone(value);
5518
- var scalar = (value) => value?.S ?? (value?.N !== void 0 ? Number(value.N) : value?.BOOL ?? value?.B);
5519
5518
  var resolveName = (name2, names) => name2.split(".").map((part) => names[part] ?? part).join(".");
5520
5519
  var get = (item, path, names) => {
5521
5520
  const parts = resolveName(path.trim(), names).split(".");
@@ -5538,6 +5537,23 @@ var set = (item, path, value, names) => {
5538
5537
  }
5539
5538
  current[leaf] = clone(value);
5540
5539
  };
5540
+ var utf8 = new TextEncoder();
5541
+ var bytes2 = (value) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));
5542
+ var compareBytes = (left, right) => {
5543
+ for (let i = 0; i < Math.min(left.length, right.length); i++)
5544
+ if (left[i] !== right[i]) return left[i] - right[i];
5545
+ return left.length - right.length;
5546
+ };
5547
+ var compareKeyValues = (left, right) => {
5548
+ if (left === void 0 || right === void 0)
5549
+ return left === right ? 0 : left === void 0 ? 1 : -1;
5550
+ if (left.N !== void 0 && right.N !== void 0) return Number(left.N) - Number(right.N);
5551
+ if (left.S !== void 0 && right.S !== void 0)
5552
+ return compareBytes(utf8.encode(left.S), utf8.encode(right.S));
5553
+ if (left.B !== void 0 && right.B !== void 0)
5554
+ return compareBytes(bytes2(left.B), bytes2(right.B));
5555
+ return 0;
5556
+ };
5541
5557
  var remove = (item, path, names) => {
5542
5558
  const parts = resolveName(path.trim(), names).split(".");
5543
5559
  const leaf = parts.pop();
@@ -5647,10 +5663,8 @@ var DynamoAPI = class {
5647
5663
  }
5648
5664
  compare(table, left, right, schema = table.keySchema) {
5649
5665
  for (const key of schema) {
5650
- const a = scalar(left[key.AttributeName]);
5651
- const b = scalar(right[key.AttributeName]);
5652
- if (a === b) continue;
5653
- return a !== void 0 && b !== void 0 && a < b ? -1 : 1;
5666
+ const order2 = compareKeyValues(left[key.AttributeName], right[key.AttributeName]);
5667
+ if (order2 !== 0) return order2 < 0 ? -1 : 1;
5654
5668
  }
5655
5669
  return 0;
5656
5670
  }
@@ -5999,4 +6013,4 @@ export {
5999
6013
  accessKeyCredential,
6000
6014
  DynamoAPI
6001
6015
  };
6002
- //# sourceMappingURL=chunk-APTU4NSH.js.map
6016
+ //# sourceMappingURL=chunk-C22XGG65.js.map