@form-engine-ts/storage 7.18.0 → 8.0.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/README.md CHANGED
@@ -21,6 +21,12 @@ Both adapters implement the required `UnifiedSubmissionStorageAdapter` surface:
21
21
  free-text answer paging, idempotent saving, typed validation, response aggregation, and CSV export. These common
22
22
  operations use the same core contracts regardless of the backing database.
23
23
 
24
+ ## Migration notes
25
+
26
+ `StorageAdapter`, `TypedStorageAdapter`, and `UnifiedSubmissionStorageAdapter` now require
27
+ `countSubmissions(formId, formVersion?, options?)`. Implementations must apply inclusive `since` and `until` filters
28
+ from `SubmissionQueryOptions`; submission pipelines no longer fall back to scanning every page.
29
+
24
30
  The `./testing` subpath exports framework-independent JSON fixtures and contract runners for pagination,
25
31
  idempotency, revision conflicts, translation metadata, CSV, and form deletion. Adapters expose
26
32
  `inspectFormDeletion` and `deleteForm` through the lifecycle contract when their implementation supports it;
package/dist/testing.cjs CHANGED
@@ -84,6 +84,23 @@ async function runStorageContract(adapter) {
84
84
  check(JSON.stringify(loaded) === JSON.stringify(submissions), "submission ordering/metadata round trip");
85
85
  const passed = ["schema", "submission", "translation_metadata"];
86
86
  const unsupported = [];
87
+ check(await adapter.countSubmissions(schema.id) === submissions.length, "count must include all form versions");
88
+ check(
89
+ await adapter.countSubmissions(schema.id, schema.version) === submissions.length,
90
+ "count must filter by form version"
91
+ );
92
+ check(
93
+ await adapter.countSubmissions(schema.id, schema.version, {
94
+ since: "2026-01-01T00:00:00.000Z",
95
+ until: "2026-01-01T00:00:00.000Z"
96
+ }) === submissions.length,
97
+ "count must include since/until boundaries"
98
+ );
99
+ check(
100
+ await adapter.countSubmissions(schema.id, schema.version, { since: "2026-01-01T00:00:00.001Z" }) === 0,
101
+ "count must filter by submission time"
102
+ );
103
+ passed.push("count");
87
104
  if ("listSubmissionPage" in adapter && typeof adapter.listSubmissionPage === "function") {
88
105
  const paged = adapter;
89
106
  const ids = [];
package/dist/testing.js CHANGED
@@ -60,6 +60,23 @@ async function runStorageContract(adapter) {
60
60
  check(JSON.stringify(loaded) === JSON.stringify(submissions), "submission ordering/metadata round trip");
61
61
  const passed = ["schema", "submission", "translation_metadata"];
62
62
  const unsupported = [];
63
+ check(await adapter.countSubmissions(schema.id) === submissions.length, "count must include all form versions");
64
+ check(
65
+ await adapter.countSubmissions(schema.id, schema.version) === submissions.length,
66
+ "count must filter by form version"
67
+ );
68
+ check(
69
+ await adapter.countSubmissions(schema.id, schema.version, {
70
+ since: "2026-01-01T00:00:00.000Z",
71
+ until: "2026-01-01T00:00:00.000Z"
72
+ }) === submissions.length,
73
+ "count must include since/until boundaries"
74
+ );
75
+ check(
76
+ await adapter.countSubmissions(schema.id, schema.version, { since: "2026-01-01T00:00:00.001Z" }) === 0,
77
+ "count must filter by submission time"
78
+ );
79
+ passed.push("count");
63
80
  if ("listSubmissionPage" in adapter && typeof adapter.listSubmissionPage === "function") {
64
81
  const paged = adapter;
65
82
  const ids = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/storage",
3
- "version": "7.18.0",
3
+ "version": "8.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,7 +42,7 @@
42
42
  "url": "git+https://github.com/nitta-a/form-engine-ts.git"
43
43
  },
44
44
  "dependencies": {
45
- "@form-engine-ts/core": "7.18.0"
45
+ "@form-engine-ts/core": "8.0.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts src/types.ts src/pagination.ts src/testing.ts --format esm,cjs --dts --clean --external @form-engine-ts/core",