msgpackr 1.11.13 → 1.11.14

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/pack.js CHANGED
@@ -189,7 +189,14 @@ export class Packr extends Unpackr {
189
189
  let newSharedData = prepareStructures(structures, packr);
190
190
  if (!encodingError) { // TODO: If there is an encoding error, should make the structures as uninitialized so they get rebuilt next time
191
191
  if (packr.saveStructures(newSharedData, newSharedData.isCompatible) === false) {
192
- // get updated structures and try again if the update failed
192
+ // The save was declined (a concurrent writer updated the shared structures,
193
+ // or the store transaction did not durably commit). Our in-memory
194
+ // structures + transition trie may now reference record ids that were
195
+ // never persisted; re-packing as-is would re-emit the same record pointing
196
+ // at an unpersisted structure (-> "Record id is not defined" on decode).
197
+ // Mark structures uninitialized so the re-pack reloads durable structures
198
+ // via getStructures, rebuilds the transition trie, and re-mints + re-saves.
199
+ structures.uninitialized = true
193
200
  return packr.pack(value, encodeOptions)
194
201
  }
195
202
  packr.lastNamedStructuresLength = sharedLength
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "msgpackr",
3
3
  "author": "Kris Zyp",
4
- "version": "1.11.13",
4
+ "version": "1.11.14",
5
5
  "description": "Ultra-fast MessagePack implementation with extensions for records and structured cloning",
6
6
  "license": "MIT",
7
7
  "types": "./index.d.ts",