payload-live-preview 1.0.2 → 1.0.3

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/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "1.0.2"};
3
+ version: "1.0.3"};
4
4
 
5
5
  // src/version.ts
6
6
  var VERSION = package_default.version;
@@ -453,16 +453,20 @@ function isObjectMessage(value) {
453
453
  }
454
454
  function isLivePreviewMessage(value) {
455
455
  const v = value;
456
- if (v["data"] !== void 0 && !isPlainObject(v["data"])) return false;
457
- if (v["fieldSchemaJSON"] !== void 0 && !Array.isArray(v["fieldSchemaJSON"])) return false;
458
- if (v["globalSlug"] !== void 0 && typeof v["globalSlug"] !== "string") return false;
459
- if (v["collectionSlug"] !== void 0 && typeof v["collectionSlug"] !== "string") return false;
460
- if (v["locale"] !== void 0 && typeof v["locale"] !== "string") return false;
461
- if (v["ready"] !== void 0 && typeof v["ready"] !== "boolean") return false;
462
- if (v["previewToken"] !== void 0 && typeof v["previewToken"] !== "string") return false;
463
- if (v["protocolVersion"] !== void 0 && typeof v["protocolVersion"] !== "number") return false;
456
+ if (v["data"] !== void 0 && v["data"] !== null && !isPlainObject(v["data"])) return false;
457
+ if (!optionalTypeOk(v["fieldSchemaJSON"], (x) => Array.isArray(x))) return false;
458
+ if (!optionalTypeOk(v["globalSlug"], (x) => typeof x === "string")) return false;
459
+ if (!optionalTypeOk(v["collectionSlug"], (x) => typeof x === "string")) return false;
460
+ if (!optionalTypeOk(v["locale"], (x) => typeof x === "string")) return false;
461
+ if (!optionalTypeOk(v["ready"], (x) => typeof x === "boolean")) return false;
462
+ if (!optionalTypeOk(v["previewToken"], (x) => typeof x === "string")) return false;
463
+ if (!optionalTypeOk(v["protocolVersion"], (x) => typeof x === "number")) return false;
464
464
  return true;
465
465
  }
466
+ function optionalTypeOk(value, check) {
467
+ if (value === void 0 || value === null) return true;
468
+ return check(value);
469
+ }
466
470
  function isPlainObject(value) {
467
471
  return typeof value === "object" && value !== null && !Array.isArray(value);
468
472
  }