@xh/hoist 75.0.0-SNAPSHOT.1752860174147 → 75.0.0-SNAPSHOT.1752873581842

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.
@@ -63,4 +63,5 @@ export declare abstract class PersistenceProvider<S = any> {
63
63
  protected writeRaw(obj: Record<typeof this.path, S>): void;
64
64
  protected readRaw(): Record<typeof this.path, S>;
65
65
  private static parseProviderClass;
66
+ private ensureValid;
66
67
  }
@@ -12,8 +12,10 @@ import {
12
12
  compact,
13
13
  debounce as lodashDebounce,
14
14
  get,
15
+ isArray,
15
16
  isEmpty,
16
17
  isNumber,
18
+ isObject,
17
19
  isString,
18
20
  isUndefined,
19
21
  omit,
@@ -88,6 +90,7 @@ export abstract class PersistenceProvider<S = any> {
88
90
 
89
91
  const providerClass = this.parseProviderClass<S>(cfg.persistOptions);
90
92
  ret = new providerClass(cfg);
93
+ ret.ensureValid();
91
94
  ret.bindToTarget(cfg.target);
92
95
  return ret;
93
96
  } catch (e) {
@@ -252,4 +255,13 @@ export abstract class PersistenceProvider<S = any> {
252
255
 
253
256
  return ret;
254
257
  }
258
+
259
+ private ensureValid() {
260
+ const data = this.readRaw();
261
+ throwIf(
262
+ !(isObject(data) && !isArray(data)),
263
+ `PersistenceProvider for ${this.path} may not be configured correctly. The provider ` +
264
+ 'should produce a javascript object for reading property values.'
265
+ );
266
+ }
255
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "75.0.0-SNAPSHOT.1752860174147",
3
+ "version": "75.0.0-SNAPSHOT.1752873581842",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",