@form-engine-ts/storage-localstorage 8.0.1 → 8.1.0

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/index.cjs CHANGED
@@ -48,7 +48,7 @@ function parseSchema(value, key, validation = {}) {
48
48
  }
49
49
  function parseSubmission(value, key) {
50
50
  const parsed = parseJson(value, key);
51
- if (!isRecord(parsed) || typeof parsed.id !== "string" || typeof parsed.formId !== "string" || !Number.isInteger(parsed.formVersion) || typeof parsed.locale !== "string" || typeof parsed.submittedAt !== "string" || !isRecord(parsed.values)) {
51
+ if (!isRecord(parsed) || typeof parsed.id !== "string" || typeof parsed.formId !== "string" || !Number.isInteger(parsed.formVersion) || typeof parsed.locale !== "string" || typeof parsed.submittedAt !== "string" || !isRecord(parsed.values) || !Object.values(parsed.values).every(import_core.isFormValue)) {
52
52
  throw new Error(`Stored submission at "${key}" is invalid.`);
53
53
  }
54
54
  return parsed;
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import {
3
3
  assertValidFormSchema,
4
4
  createFormLifecycleAdapter,
5
- hashFormSubmissionPayload
5
+ hashFormSubmissionPayload,
6
+ isFormValue
6
7
  } from "@form-engine-ts/core";
7
8
  function isRecord(value) {
8
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -28,7 +29,7 @@ function parseSchema(value, key, validation = {}) {
28
29
  }
29
30
  function parseSubmission(value, key) {
30
31
  const parsed = parseJson(value, key);
31
- if (!isRecord(parsed) || typeof parsed.id !== "string" || typeof parsed.formId !== "string" || !Number.isInteger(parsed.formVersion) || typeof parsed.locale !== "string" || typeof parsed.submittedAt !== "string" || !isRecord(parsed.values)) {
32
+ if (!isRecord(parsed) || typeof parsed.id !== "string" || typeof parsed.formId !== "string" || !Number.isInteger(parsed.formVersion) || typeof parsed.locale !== "string" || typeof parsed.submittedAt !== "string" || !isRecord(parsed.values) || !Object.values(parsed.values).every(isFormValue)) {
32
33
  throw new Error(`Stored submission at "${key}" is invalid.`);
33
34
  }
34
35
  return parsed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/storage-localstorage",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,10 +39,10 @@
39
39
  "typescript"
40
40
  ],
41
41
  "dependencies": {
42
- "@form-engine-ts/core": "8.0.1"
42
+ "@form-engine-ts/core": "8.1.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@form-engine-ts/storage": "8.0.1"
45
+ "@form-engine-ts/storage": "8.1.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external @form-engine-ts/core",