@form-engine-ts/core 1.0.0 → 2.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 +34 -0
- package/dist/index.cjs +586 -57
- package/dist/index.d.cts +107 -9
- package/dist/index.d.ts +107 -9
- package/dist/index.js +579 -57
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,4 +24,38 @@ const result = validateAnswers(schema, { name: "Ada" });
|
|
|
24
24
|
if (!result.valid) console.error(result.issues);
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## Multi-step, localization, analytics, and events
|
|
28
|
+
|
|
29
|
+
Add `pages` to partition every field into an accessible wizard and use `validatePageAnswers(schema, pageIndex, values)`
|
|
30
|
+
for step-scoped validation. Schemas without `pages` remain single-page forms.
|
|
31
|
+
|
|
32
|
+
Store authoring-time translations on forms, fields, options, and pages. `resolveLocalizedSchema` applies them synchronously,
|
|
33
|
+
while `populateSchemaTranslations` fills them through an injected `AsyncTranslationAdapter`. Population defaults to
|
|
34
|
+
`overwrite: "missing-only"`, accepts per-slot `shouldOverwrite` and `createMetadata` callbacks, and returns
|
|
35
|
+
`{ schema, report }` with updated and skipped translation slots.
|
|
36
|
+
|
|
37
|
+
Forms, pages, fields, options, and submissions accept JSON-only `metadata` and per-locale/property
|
|
38
|
+
`translationMetadata`. These extension values survive sanitization, localization, submission creation, and storage
|
|
39
|
+
round-trips. `completionMessage` is localized with the rest of the form text.
|
|
40
|
+
|
|
41
|
+
`calculateCrossTabulation` builds a two-question frequency matrix from submissions. `dispatchWebhook` posts typed
|
|
42
|
+
`response.submitted` or `schema.updated` events with timeout handling, custom headers, and optional HMAC-SHA256 signing.
|
|
43
|
+
|
|
44
|
+
CSV export neutralizes string cells whose first non-whitespace character is `=`, `+`, `-`, or `@`. This is enabled by
|
|
45
|
+
default; trusted callers can pass `{ neutralizeFormulas: false }`. RFC 4180 quoting and the UTF-8 BOM remain unchanged.
|
|
46
|
+
|
|
47
|
+
Storage adapters share inclusive ISO 8601 submission-range filtering:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import type { SubmissionQueryOptions } from "@form-engine-ts/core";
|
|
51
|
+
|
|
52
|
+
const range: SubmissionQueryOptions = {
|
|
53
|
+
since: "2026-01-01T00:00:00.000Z",
|
|
54
|
+
until: "2026-01-31T23:59:59.999Z"
|
|
55
|
+
};
|
|
56
|
+
const submissions = await storage.listSubmissions("contact", 1, range);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Results are ordered by `submittedAt`, then submission ID. Both boundaries are inclusive.
|
|
60
|
+
|
|
27
61
|
See the [project documentation](https://github.com/nitta-a/form-engine-ts#readme) for the complete schema and API guide.
|