@statezero/core 0.2.21 → 0.2.22

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.
@@ -3,7 +3,6 @@ import { Model } from "./model.js";
3
3
  import { ModelSerializer, relationshipFieldSerializer, dateFieldSerializer } from "./serializers.js";
4
4
  import axios from "axios";
5
5
  import { QueryExecutor } from "./queryExecutor.js";
6
- import { json } from "stream/consumers";
7
6
  import { v7 } from "uuid";
8
7
  import hash from "object-hash";
9
8
  import rfdc from "rfdc";
@@ -310,7 +310,21 @@ export class Cache {
310
310
  }
311
311
  set(key, value) {
312
312
  this.localMap.set(key, value);
313
- this.store.set(key, value);
313
+ try {
314
+ this.store.set(key, structuredClone(value));
315
+ }
316
+ catch (e) {
317
+ const badFields = Object.entries(value).map(([k, v]) => {
318
+ try {
319
+ structuredClone(v);
320
+ return null;
321
+ }
322
+ catch {
323
+ return k;
324
+ }
325
+ }).filter(Boolean);
326
+ console.warn(`Cache.set failed for "${key}", problematic fields: ${badFields.join(', ')}`, e.message);
327
+ }
314
328
  }
315
329
  delete(key) {
316
330
  this.localMap.delete(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statezero/core",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "module": "ESNext",
6
6
  "description": "The type-safe frontend client for StateZero - connect directly to your backend models with zero boilerplate",