@smithy/core 3.36.0 → 3.36.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.36.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dbdacac: Keep the JSON string serializer's buffer reservation intact after 6-byte escape sequences so that the characters and closing quote that follow are always written within the buffer.
8
+
3
9
  ## 3.36.0
4
10
 
5
11
  ### Minor Changes
@@ -1812,9 +1812,9 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1812
1812
  this.i = i;
1813
1813
  }
1814
1814
  writeJsonString(s) {
1815
- this.ensure(s.length * 3 + 2);
1816
- this.json[this.i++] = QUOTE;
1817
1815
  const z = s.length;
1816
+ this.ensure(z * 3 + 2);
1817
+ this.json[this.i++] = QUOTE;
1818
1818
  for (let j = 0; j < z; ++j) {
1819
1819
  const c = s.charCodeAt(j);
1820
1820
  if (c > 0x22 && c < 0x5c) {
@@ -1823,7 +1823,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1823
1823
  else if (c < 0x80) {
1824
1824
  const esc = ESCAPE_TABLE[c];
1825
1825
  if (esc !== null) {
1826
- this.ensure(esc.length + 1);
1826
+ this.ensure(esc.length + 1 + (z - j - 1) * 3 + 1);
1827
1827
  this.json[this.i++] = BACKSLASH;
1828
1828
  for (let k = 0; k < esc.length; k++) {
1829
1829
  this.json[this.i++] = esc.charCodeAt(k);
@@ -1842,12 +1842,12 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1842
1842
  ++j;
1843
1843
  }
1844
1844
  else {
1845
- this.ensure(6);
1845
+ this.ensure(6 + (z - j - 1) * 3 + 1);
1846
1846
  this.writeUnicodeEscape(c);
1847
1847
  }
1848
1848
  }
1849
1849
  else if (c >= 0xdc00 && c <= 0xdfff) {
1850
- this.ensure(6);
1850
+ this.ensure(6 + (z - j - 1) * 3 + 1);
1851
1851
  this.writeUnicodeEscape(c);
1852
1852
  }
1853
1853
  else {
@@ -118,9 +118,9 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
118
118
  this.i = i;
119
119
  }
120
120
  writeJsonString(s) {
121
- this.ensure(s.length * 3 + 2);
122
- this.json[this.i++] = QUOTE;
123
121
  const z = s.length;
122
+ this.ensure(z * 3 + 2);
123
+ this.json[this.i++] = QUOTE;
124
124
  for (let j = 0; j < z; ++j) {
125
125
  const c = s.charCodeAt(j);
126
126
  if (c > 0x22 && c < 0x5c) {
@@ -129,7 +129,7 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
129
129
  else if (c < 0x80) {
130
130
  const esc = ESCAPE_TABLE[c];
131
131
  if (esc !== null) {
132
- this.ensure(esc.length + 1);
132
+ this.ensure(esc.length + 1 + (z - j - 1) * 3 + 1);
133
133
  this.json[this.i++] = BACKSLASH;
134
134
  for (let k = 0; k < esc.length; k++) {
135
135
  this.json[this.i++] = esc.charCodeAt(k);
@@ -148,12 +148,12 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
148
148
  ++j;
149
149
  }
150
150
  else {
151
- this.ensure(6);
151
+ this.ensure(6 + (z - j - 1) * 3 + 1);
152
152
  this.writeUnicodeEscape(c);
153
153
  }
154
154
  }
155
155
  else if (c >= 0xdc00 && c <= 0xdfff) {
156
- this.ensure(6);
156
+ this.ensure(6 + (z - j - 1) * 3 + 1);
157
157
  this.writeUnicodeEscape(c);
158
158
  }
159
159
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.36.0",
3
+ "version": "3.36.1",
4
4
  "homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
5
5
  "license": "Apache-2.0",
6
6
  "author": {