@form-engine-ts/storage-d1 8.0.2 → 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
@@ -27,9 +27,6 @@ var import_core = require("@form-engine-ts/core");
27
27
  function isRecord(value) {
28
28
  return typeof value === "object" && value !== null && !Array.isArray(value);
29
29
  }
30
- function isFormValue(value) {
31
- return value === void 0 || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || Array.isArray(value) && value.every((item) => typeof item === "string");
32
- }
33
30
  function cloneJson(value) {
34
31
  return JSON.parse(JSON.stringify(value));
35
32
  }
@@ -43,7 +40,7 @@ function parseJson(value, location) {
43
40
  }
44
41
  function parseSubmission(value, location) {
45
42
  const parsed = parseJson(value, location);
46
- 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)) {
43
+ 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)) {
47
44
  throw new Error(`D1 submission at ${location} is invalid.`);
48
45
  }
49
46
  return cloneJson(parsed);
package/dist/index.js CHANGED
@@ -2,14 +2,12 @@
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);
9
10
  }
10
- function isFormValue(value) {
11
- return value === void 0 || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || Array.isArray(value) && value.every((item) => typeof item === "string");
12
- }
13
11
  function cloneJson(value) {
14
12
  return JSON.parse(JSON.stringify(value));
15
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/storage-d1",
3
- "version": "8.0.2",
3
+ "version": "8.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -41,7 +41,7 @@
41
41
  "typescript"
42
42
  ],
43
43
  "dependencies": {
44
- "@form-engine-ts/core": "8.0.2"
44
+ "@form-engine-ts/core": "8.1.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@cloudflare/workers-types": "^4.20240000.0"
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@cloudflare/workers-types": "^4.20240000.0",
56
- "@form-engine-ts/storage": "8.0.2"
56
+ "@form-engine-ts/storage": "8.1.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external @form-engine-ts/core",