@schema-engine/forms 0.5.0 → 0.5.1

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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/index.js +4 -4
  3. package/dist/actions/plugins/index.js +3 -3
  4. package/dist/actions/plugins/registrations.js +3 -3
  5. package/dist/agent-tool/index.js +1 -1
  6. package/dist/{chunk-U2X3IYSD.js → chunk-6EYX257T.js} +1 -1
  7. package/dist/{chunk-HEAKWS27.js → chunk-A5VLMQAK.js} +693 -643
  8. package/dist/chunk-A5VLMQAK.js.map +7 -0
  9. package/dist/{chunk-5QXT7YAJ.js → chunk-CANRZY5A.js} +1 -1
  10. package/dist/{chunk-2VKEOE2L.js → chunk-GQHMU3AR.js} +12 -12
  11. package/dist/{chunk-WS7SLVXL.js → chunk-JA5ET6MC.js} +4 -4
  12. package/dist/{chunk-2PTM54FQ.js → chunk-KH6QWB5Y.js} +2 -2
  13. package/dist/chunk-PCL2KNHC.js.map +7 -0
  14. package/dist/{chunk-56CJ2UZ7.js → chunk-TSKELYW7.js} +2 -2
  15. package/dist/chunk-U3YHTQHR.js +215 -0
  16. package/dist/chunk-U3YHTQHR.js.map +7 -0
  17. package/dist/{chunk-XPQRHO5E.js → chunk-V5H7L5PJ.js} +1 -1
  18. package/dist/engine/build-form-engine.js +7 -7
  19. package/dist/engine/create-form-engine.js +8 -8
  20. package/dist/engine/form-engine.js +7 -7
  21. package/dist/engine/index.js +8 -8
  22. package/dist/engine/step-machine.js +1 -1
  23. package/dist/engine/submission-schema.js +1 -1
  24. package/dist/engine/value-validation.js +1 -1
  25. package/dist/index.js +26 -26
  26. package/dist/lib/validate-form.js +4 -4
  27. package/dist/recipes/index.js +1 -1
  28. package/dist/recipes/view-model.js +1 -1
  29. package/dist/runtime/create-form-runtime.js +7 -7
  30. package/dist/runtime/index.js +7 -7
  31. package/dist/schemas/base-field.js +2 -2
  32. package/dist/schemas/form-config-shape.js +2 -2
  33. package/dist/schemas/form-config.js +2 -2
  34. package/dist/schemas/index.js +5 -5
  35. package/dist/schemas/validation/dependencies.js +1 -1
  36. package/dist/schemas/validation/index.js +5 -5
  37. package/dist/schemas/validation/utils.js +1 -1
  38. package/dist/schemas/validation/validation-registry.js +1 -1
  39. package/dist/server-errors/from-json-api-errors.js +3 -3
  40. package/dist/server-errors/from-problem-details.js +3 -3
  41. package/dist/server-errors/index.js +6 -6
  42. package/dist/server-errors/shared.js +2 -2
  43. package/dist/state-container/create-form-state-container.js +5 -5
  44. package/dist/state-container/index.d.ts +1 -1
  45. package/dist/state-container/index.js +12 -12
  46. package/dist/state-container/selectors.js +1 -1
  47. package/dist/state-container/submission.js +1 -1
  48. package/dist/state-container/types.d.ts +1 -1
  49. package/dist/state-container/types.js +1 -1
  50. package/dist/testing/assert.d.ts +92 -0
  51. package/dist/testing/assert.js +42 -0
  52. package/dist/testing/assert.js.map +7 -0
  53. package/dist/testing/form-state-container-conformance.d.ts +15 -3
  54. package/dist/testing/form-state-container-conformance.js +4 -3
  55. package/dist/testing/index.d.ts +3 -2
  56. package/dist/testing/index.js +4 -3
  57. package/package.json +7 -13
  58. package/skill/reference/forms.md +3 -2
  59. package/dist/chunk-HEAKWS27.js.map +0 -7
  60. package/dist/chunk-PXWVKJGF.js.map +0 -7
  61. package/dist/{chunk-U2X3IYSD.js.map → chunk-6EYX257T.js.map} +0 -0
  62. package/dist/{chunk-5QXT7YAJ.js.map → chunk-CANRZY5A.js.map} +0 -0
  63. package/dist/{chunk-GY657L56.js → chunk-DP7SYLLI.js} +5 -5
  64. /package/dist/{chunk-GY657L56.js.map → chunk-DP7SYLLI.js.map} +0 -0
  65. /package/dist/{chunk-2VKEOE2L.js.map → chunk-GQHMU3AR.js.map} +0 -0
  66. /package/dist/{chunk-WS7SLVXL.js.map → chunk-JA5ET6MC.js.map} +0 -0
  67. /package/dist/{chunk-2PTM54FQ.js.map → chunk-KH6QWB5Y.js.map} +0 -0
  68. /package/dist/{chunk-PXWVKJGF.js → chunk-PCL2KNHC.js} +0 -0
  69. /package/dist/{chunk-56CJ2UZ7.js.map → chunk-TSKELYW7.js.map} +0 -0
  70. /package/dist/{chunk-XPQRHO5E.js.map → chunk-V5H7L5PJ.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/testing/form-state-container-conformance.ts"],
4
- "sourcesContent": ["import { describe, expect, test, vi } from 'vitest';\nimport * as z from 'zod/mini';\nimport { markNormalizedElementConfig } from '@/lib/normalized-form-config';\nimport type { ElementConfig } from '@/schemas/field-config';\nimport type { ValidationElementTree } from '@/engine/value-validation';\nimport { createDefaultValidationRegistry, type ValidationRegistry } from '@/schemas/validation/validation-registry';\nimport { logger } from '@/lib/logger';\nimport { toFieldArrayValue } from '@/state-container/field-array';\nimport { toHydration } from '@/state-container/hydration';\nimport { selectFieldState, selectValue } from '@/state-container/selectors';\nimport {\n\tFORM_ROOT,\n\ttype FormStateContainer,\n\ttype FormStateContainerFactory,\n\ttype FormStateContainerOptions,\n\ttype FormStateErrorsInput,\n\ttype FormStateHydration,\n\ttype FormSubmitResult,\n} from '@/state-container/types';\n\n/**\n * One rule of the internal form store contract, with the check that proves it.\n *\n * @remarks\n * `run` throws when the store breaks the rule. {@link formStateContainerCases} lists them so a test can point a\n * deliberately broken store at the rule it breaks; {@link formStateContainerConformance} registers them as tests.\n */\nexport interface FormStateContainerCase {\n\treadonly rule: string;\n\treadonly name: string;\n\treadonly run: (createStore: FormStateContainerFactory) => void | Promise<void>;\n}\n\n/**\n * An async validation rule that passes at once, except for the values a test holds, which it settles by\n * hand so a result can arrive after a reset or a row move.\n */\nfunction createGate() {\n\tconst waiting = new Map<string, Array<(valid: boolean) => void>>();\n\tconst held = new Set<string>();\n\tconst settled = new Map<string, boolean>();\n\treturn {\n\t\thold: (...values: string[]): void => values.forEach((value) => held.add(value)),\n\t\tcheck: (value: unknown): Promise<boolean> =>\n\t\t\tsettled.has(String(value))\n\t\t\t\t? Promise.resolve(settled.get(String(value)) === true)\n\t\t\t\t: !held.has(String(value))\n\t\t\t\t\t? Promise.resolve(true)\n\t\t\t\t\t: new Promise((resolve) => {\n\t\t\t\t\t\t\tconst key = String(value);\n\t\t\t\t\t\t\twaiting.set(key, [...(waiting.get(key) ?? []), resolve]);\n\t\t\t\t\t\t}),\n\t\tpending: (value: string): number => waiting.get(value)?.length ?? 0,\n\t\tsettle(value: string, valid: boolean): void {\n\t\t\tsettled.set(value, valid);\n\t\t\tfor (const resolve of waiting.get(value) ?? []) resolve(valid);\n\t\t\twaiting.delete(value);\n\t\t},\n\t};\n}\n\nconst element = (config: Record<string, unknown>, containerKind?: 'array' | 'object') =>\n\tmarkNormalizedElementConfig(config as unknown as ElementConfig, containerKind);\n\n/** The timing a normalized form config always carries, for a container built without a config. */\nexport const defaultModes = { validationMode: 'onSubmit', reValidateMode: 'onChange' } as const;\n\n/** What a container under test is built from, in the flat shape tests write; {@link containerOptions} turns it into the options of a container. */\nexport interface ContainerSetup {\n\treadonly registry: ValidationRegistry;\n\treadonly elements: ValidationElementTree;\n\treadonly validationMode?: FormStateContainerOptions['config']['validationMode'];\n\treadonly reValidateMode?: FormStateContainerOptions['config']['reValidateMode'];\n\treadonly payload?: Readonly<Record<string, unknown>>;\n\treadonly defaults?: Record<string, unknown>;\n\treadonly snapshot?: FormStateHydration;\n}\n\n/** The options of a container over `elements`, with the config a normalized form would give it. */\nexport function containerOptions(setup: ContainerSetup): FormStateContainerOptions {\n\tconst { registry, elements, defaults, snapshot, payload } = setup;\n\treturn {\n\t\tconfig: {\n\t\t\tsteps: [{ elements }],\n\t\t\tvalidationMode: setup.validationMode ?? defaultModes.validationMode,\n\t\t\treValidateMode: setup.reValidateMode ?? defaultModes.reValidateMode,\n\t\t\t...(payload === undefined ? {} : { payload }),\n\t\t},\n\t\tregistry,\n\t\t...(defaults === undefined ? {} : { defaults }),\n\t\t...(snapshot === undefined ? {} : { snapshot }),\n\t};\n}\n\ninterface Fixture {\n\treadonly options: FormStateContainerOptions;\n\treadonly gate: ReturnType<typeof createGate>;\n}\n\nfunction fixture(overrides: Partial<ContainerSetup> = {}): Fixture {\n\tconst gate = createGate();\n\tconst registry = createDefaultValidationRegistry([\n\t\t{\n\t\t\t$type: 'gate',\n\t\t\tschema: z.object({ $type: z.literal('gate') }),\n\t\t\tmetadata: { name: 'Gate' },\n\t\t\tcategory: 'generic',\n\t\t\thandler: () => z.any().check(z.refine((value: unknown) => gate.check(value), 'Value is taken')),\n\t\t},\n\t]);\n\treturn {\n\t\tgate,\n\t\toptions: containerOptions({\n\t\t\tregistry,\n\t\t\telements: [\n\t\t\t\telement({ $type: 'input', name: 'name', rules: [{ $type: 'required', message: 'Name is required' }] }),\n\t\t\t\telement({\n\t\t\t\t\t$type: 'input',\n\t\t\t\t\tname: 'nickname',\n\t\t\t\t\trules: [{ $type: 'required', message: 'Nickname is required' }],\n\t\t\t\t}),\n\t\t\t\telement({ $type: 'input', name: 'slug', rules: [{ $type: 'gate' }] }),\n\t\t\t\telement({\n\t\t\t\t\t$type: 'input',\n\t\t\t\t\tname: 'code',\n\t\t\t\t\trules: [\n\t\t\t\t\t\t{ $type: 'minLength', value: 5, message: 'Too short' },\n\t\t\t\t\t\t{ $type: 'pattern', value: '^\\\\d+$', message: 'Digits only' },\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\telement(\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'fieldset',\n\t\t\t\t\t\tname: 'address',\n\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t{ $type: 'input', name: 'street' },\n\t\t\t\t\t\t\t{ $type: 'input', name: 'country' },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t'object',\n\t\t\t\t),\n\t\t\t\telement(\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\tname: 'contacts',\n\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\t\tname: 'email',\n\t\t\t\t\t\t\t\trules: [{ $type: 'required', message: 'Email is required' }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ $type: 'input', name: 'label' },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t'array',\n\t\t\t\t),\n\t\t\t\telement(\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\tname: 'groups',\n\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t{ $type: 'input', name: 'title' },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\t\t\tname: 'members',\n\t\t\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t\t\t{ $type: 'input', name: 'code', rules: [{ $type: 'gate' }] },\n\t\t\t\t\t\t\t\t\t{ $type: 'input', name: 'label' },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t'array',\n\t\t\t\t),\n\t\t\t\telement(\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\tname: 'tags',\n\t\t\t\t\t\telements: [{ $type: 'input', name: 'tag' }],\n\t\t\t\t\t},\n\t\t\t\t\t'array',\n\t\t\t\t),\n\t\t\t\telement(\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\tname: 'invites',\n\t\t\t\t\t\trules: [{ $type: 'minItems', value: 2, message: 'Add two invites' }],\n\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t{ $type: 'input', name: 'code', rules: [{ $type: 'gate' }] },\n\t\t\t\t\t\t\t{ $type: 'input', name: 'label' },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t'array',\n\t\t\t\t),\n\t\t\t],\n\t\t\tdefaults: {\n\t\t\t\tname: 'Ada',\n\t\t\t\tnickname: 'ada',\n\t\t\t\tslug: 'free',\n\t\t\t\tcode: '12345',\n\t\t\t\taddress: { street: '1 Main', country: 'IT' },\n\t\t\t\tcontacts: [{ email: 'a@example.com' }, { email: 'b@example.com' }, { email: 'c@example.com' }],\n\t\t\t\tinvites: [{ code: 'one' }, { code: 'two' }],\n\t\t\t},\n\t\t\t...overrides,\n\t\t}),\n\t};\n}\n\nconst containerKinds: Record<string, 'array' | 'object'> = { arrayElements: 'array', fieldset: 'object' };\n\n/** A container over `elements` with the default rules and a rule, `boom`, that throws when it runs. */\nfunction custom(\n\tconfigs: ReadonlyArray<Record<string, unknown>>,\n\tdefaults: Record<string, unknown>,\n\toverrides: Partial<ContainerSetup> = {},\n): FormStateContainerOptions {\n\tconst registry = createDefaultValidationRegistry([\n\t\t{\n\t\t\t$type: 'boom',\n\t\t\tschema: z.object({ $type: z.literal('boom') }),\n\t\t\tmetadata: { name: 'Boom' },\n\t\t\tcategory: 'generic',\n\t\t\thandler: () =>\n\t\t\t\tz.any().check(\n\t\t\t\t\tz.refine(() => {\n\t\t\t\t\t\tthrow new Error('exploded');\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t},\n\t]);\n\treturn containerOptions({\n\t\tregistry,\n\t\telements: configs.map((config) => element(config, containerKinds[String(config.$type)])),\n\t\tdefaults,\n\t\t...overrides,\n\t});\n}\n\n/**\n * A form of three steps: `hasCompany` decides the company step, whose `wantsInvoice` decides the payment\n * step's `vat`, which is required.\n */\nconst stepsForm = (defaults: Record<string, unknown>): FormStateContainerOptions => {\n\tconst { config, ...rest } = custom([], defaults);\n\tconst input = (name: string, extra: Record<string, unknown> = {}) => element({ $type: 'input', name, ...extra });\n\treturn {\n\t\t...rest,\n\t\tconfig: {\n\t\t\t...config,\n\t\t\tsteps: [\n\t\t\t\t{ id: 'contact', elements: [input('hasCompany')] },\n\t\t\t\t{\n\t\t\t\t\tid: 'company',\n\t\t\t\t\tconstraints: [{ field: 'hasCompany', operator: 'equals', value: true, $type: 'show' }],\n\t\t\t\t\telements: [input('wantsInvoice'), input('company', { rules: [{ $type: 'required' }] })],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'payment',\n\t\t\t\t\telements: [\n\t\t\t\t\t\tinput('vat', {\n\t\t\t\t\t\t\trules: [{ $type: 'required' }],\n\t\t\t\t\t\t\tconstraints: [{ field: 'wantsInvoice', operator: 'equals', value: 'yes', $type: 'show' }],\n\t\t\t\t\t\t}),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t};\n};\n\n/** Two fields in a business form: `company` is required and shown only for a business. */\nconst businessForm = (defaults: Record<string, unknown> = { kind: 'person', company: '' }) =>\n\tcustom(\n\t\t[\n\t\t\t{ $type: 'input', name: 'kind' },\n\t\t\t{\n\t\t\t\t$type: 'input',\n\t\t\t\tname: 'company',\n\t\t\t\trules: [{ $type: 'required', id: 'company-required', message: 'Company is required' }],\n\t\t\t\tconstraints: [{ field: 'kind', $type: 'show', operator: 'equals', value: 'business' }],\n\t\t\t},\n\t\t],\n\t\tdefaults,\n\t);\n\n/** Two fields whose second must equal the first. */\nconst passwordForm = () =>\n\tcustom(\n\t\t[\n\t\t\t{ $type: 'input', name: 'password' },\n\t\t\t{ $type: 'input', name: 'confirm', rules: [{ $type: 'relate', fields: ['password'], assert: 'allEqual' }] },\n\t\t],\n\t\t{ password: 'a', confirm: 'a' },\n\t);\n\nconst isValidating = (store: FormStateContainer): boolean => Object.keys(store.getSnapshot().validating).length > 0;\n\n/**\n * Records whether a validation the store started was ever running, as a subscriber sees it.\n *\n * @remarks\n * A check that nothing validated cannot pass vacuously on a short wait: every validation the store\n * starts is observable as a path in `validating` while it runs.\n */\nexport function watchValidation(store: FormStateContainer): { readonly started: boolean } {\n\tconst watch = { started: false };\n\tstore.subscribe(() => {\n\t\tif (isValidating(store)) watch.started = true;\n\t});\n\treturn watch;\n}\n\n/** The paths of a flat map of marks, in order. */\nconst marked = (marks: object): string[] => Object.keys(marks).toSorted();\n\nconst serverIssue = (message: string) => ({ type: 'custom', message });\nconst fieldState = (store: FormStateContainer, path: string) => selectFieldState(store.getSnapshot(), path);\n\n/** The result of a submission, narrowed to a pass. */\nfunction passedOf(result: FormSubmitResult) {\n\tif (result.outcome !== 'passed') throw new Error(`The submission did not pass: ${result.outcome}.`);\n\treturn result;\n}\n\n/** A submission that passed, as a host starts one before it sends the values to a server. */\nconst passedSubmission = async (store: FormStateContainer) => passedOf(await store.submit());\n\n/** The server's answer to a submission that passed. */\nconst serverAnswer = async (store: FormStateContainer, errors: FormStateErrorsInput) =>\n\t(await passedSubmission(store)).setServerErrors(errors);\nconst settle = () => new Promise<void>((resolve) => setTimeout(resolve, 5));\nconst errorsOf = (store: FormStateContainer) => store.getSnapshot().errors;\nconst contacts = (store: FormStateContainer) =>\n\t(store.getSnapshot().values.contacts as Array<{ email: string }>).map((row) => row.email);\n\n/** The row ids of `contacts`, in row order. */\nconst ids = (store: FormStateContainer) => store.getSnapshot().rowIds.contacts ?? [];\n\nconst cases: FormStateContainerCase[] = [\n\t{\n\t\trule: 'snapshot stability',\n\t\tname: 'returns the same snapshot until something changes, and notifies once per change',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst first = store.getSnapshot();\n\t\t\texpect(store.getSnapshot()).toBe(first);\n\t\t\tconst listener = vi.fn();\n\t\t\tconst unsubscribe = store.subscribe(listener);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t\tconst second = store.getSnapshot();\n\t\t\texpect(second).not.toBe(first);\n\t\t\texpect(store.getSnapshot()).toBe(second);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t\texpect(store.getSnapshot()).toBe(second);\n\t\t\tunsubscribe();\n\t\t\tstore.setValue('name', 'Hedy');\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t},\n\t},\n\t{\n\t\trule: 'reset generation',\n\t\tname: 'the snapshot counts resets in generation: it starts at the server snapshot, goes up by one on every reset and on nothing else',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst start = store.getSnapshot().generation;\n\t\t\texpect(store.getServerSnapshot().generation).toBe(start);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tstore.blur('name');\n\t\t\tawait store.validate();\n\t\t\tawait store.submit();\n\t\t\texpect(store.getSnapshot().generation).toBe(start);\n\t\t\tstore.reset();\n\t\t\texpect(store.getSnapshot().generation).toBe(start + 1);\n\t\t\tstore.reset({ name: 'Hedy' });\n\t\t\texpect(store.getSnapshot().generation).toBe(start + 2);\n\t\t\texpect(store.getServerSnapshot().generation).toBe(start);\n\t\t},\n\t},\n\t{\n\t\trule: 'reset generation',\n\t\tname: 'a reset of a pristine form still notifies, since the generation changed',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tconst before = store.getSnapshot();\n\t\t\tstore.reset();\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t\texpect(store.getSnapshot()).not.toBe(before);\n\t\t\texpect(store.getSnapshot().values).toEqual(before.values);\n\t\t},\n\t},\n\t{\n\t\trule: 'snapshot stability',\n\t\tname: 'keeps one server snapshot for hydration, whatever happens to the store',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst server = store.getServerSnapshot();\n\t\t\texpect(store.getServerSnapshot()).toBe(server);\n\t\t\texpect(server.values.name).toBe('Ada');\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tstore.blur('name');\n\t\t\texpect(store.getServerSnapshot()).toBe(server);\n\t\t\texpect(server.values.name).toBe('Ada');\n\t\t\texpect(store.getSnapshot().values.name).toBe('Grace');\n\t\t},\n\t},\n\t{\n\t\trule: 'immutability',\n\t\tname: 'freezes snapshots and does not alias the values it was given',\n\t\tasync run(createStore) {\n\t\t\tconst defaults = {\n\t\t\t\tname: 'Ada',\n\t\t\t\tnickname: 'ada',\n\t\t\t\tslug: 'free',\n\t\t\t\tcode: '12345',\n\t\t\t\taddress: { street: '1 Main', country: 'IT' },\n\t\t\t\tcontacts: [{ email: 'a@example.com' }],\n\t\t\t\tinvites: [{ code: 'one' }, { code: 'two' }],\n\t\t\t};\n\t\t\tconst store = createStore(fixture({ defaults: defaults }).options);\n\t\t\tconst snapshot = store.getSnapshot();\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.values as Record<string, unknown>).name = 'Eve';\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.values.address as Record<string, unknown>).street = 'Eve';\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.errors as Record<string, unknown>).name = serverIssue('x');\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.touched as Record<string, unknown>).name = true;\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.dirty as Record<string, unknown>).name = true;\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.rowIds as Record<string, unknown>).contacts = [];\n\t\t\t}).toThrow(TypeError);\n\t\t\texpect(() => {\n\t\t\t\t(snapshot.rowIds.contacts as string[]).push('x');\n\t\t\t}).toThrow(TypeError);\n\n\t\t\tdefaults.address.street = 'changed after create';\n\t\t\texpect((store.getSnapshot().values.address as { street: string }).street).toBe('1 Main');\n\n\t\t\tconst branch = { street: '2 Side', country: 'FR' };\n\t\t\tstore.setValue('address', branch);\n\t\t\tbranch.street = 'changed after setValue';\n\t\t\texpect((store.getSnapshot().values.address as { street: string }).street).toBe('2 Side');\n\n\t\t\tconst given = { name: serverIssue('Taken') };\n\t\t\tawait serverAnswer(store, given);\n\t\t\tgiven.name.message = 'changed after the answer';\n\t\t\texpect(errorsOf(store).name?.message).toBe('Taken');\n\t\t\texpect(Object.getPrototypeOf(store.getSnapshot().values)).toBe(Object.prototype);\n\t\t},\n\t},\n\t{\n\t\trule: 'branch reference preservation',\n\t\tname: 'keeps the reference of every branch a command did not change',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(after.values.address).toBe(before.values.address);\n\t\t\texpect(after.values.contacts).toBe(before.values.contacts);\n\t\t\texpect(after.errors).toBe(before.errors);\n\t\t\texpect(after.touched).toBe(before.touched);\n\t\t\texpect(after.rowIds).toBe(before.rowIds);\n\n\t\t\tstore.setValue('contacts.1.email', 'new@example.com');\n\t\t\tconst rows = store.getSnapshot().values.contacts as unknown[];\n\t\t\tconst earlier = after.values.contacts as unknown[];\n\t\t\texpect(rows).not.toBe(earlier);\n\t\t\texpect(rows[0]).toBe(earlier[0]);\n\t\t\texpect(rows[1]).not.toBe(earlier[1]);\n\t\t\texpect(rows[2]).toBe(earlier[2]);\n\n\t\t\tconst valuesBeforeBlur = store.getSnapshot().values;\n\t\t\tstore.blur('name');\n\t\t\texpect(store.getSnapshot().values).toBe(valuesBeforeBlur);\n\t\t\texpect(store.getSnapshot().values.contacts).toBe(rows);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state per exact path',\n\t\tname: 'keeps errors, touched and dirty as flat maps by exact path, stable while unrelated state changes',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, { 'contacts.1.email': serverIssue('one'), nickname: serverIssue('nick') });\n\t\t\tstore.blur('contacts.1.email');\n\t\t\tstore.setValue('address.street', '2 Side');\n\t\t\tconst { errors, touched, dirty } = store.getSnapshot();\n\t\t\texpect(Object.keys(errors).toSorted()).toEqual(['contacts.1.email', 'nickname']);\n\t\t\texpect(errors.nickname).toMatchObject({ message: 'nick', source: 'server' });\n\t\t\texpect(touched).toEqual({ 'contacts.1.email': true });\n\t\t\texpect(dirty).toEqual({ 'address.street': true });\n\t\t\texpect(Object.keys(store.getSnapshot()).toSorted()).toEqual([\n\t\t\t\t'dirty',\n\t\t\t\t'errors',\n\t\t\t\t'generation',\n\t\t\t\t'isValid',\n\t\t\t\t'participation',\n\t\t\t\t'rowIds',\n\t\t\t\t'touched',\n\t\t\t\t'validating',\n\t\t\t\t'values',\n\t\t\t\t'warnings',\n\t\t\t]);\n\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(after.errors).toBe(errors);\n\t\t\texpect(after.touched).toBe(touched);\n\t\t\texpect(after.dirty).not.toBe(dirty);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state per exact path',\n\t\tname: 'an error is never inherited: a container and a row inside it can both have one',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, { contacts: serverIssue('too few'), 'contacts.0.email': serverIssue('row') });\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['contacts', 'contacts.0.email']);\n\t\t\texpect(fieldState(store, 'contacts').error?.message).toBe('too few');\n\t\t\texpect(fieldState(store, 'contacts.0.email').error?.message).toBe('row');\n\t\t\texpect(fieldState(store, 'contacts.1.email').error).toBeUndefined();\n\t\t\texpect(store.getSnapshot().isValid).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state per exact path',\n\t\tname: 'an error about the form is its own entry and is no field error',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, { [FORM_ROOT]: serverIssue('Try again later') });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual([FORM_ROOT]);\n\t\t\texpect(errorsOf(store)[FORM_ROOT]).toMatchObject({ message: 'Try again later' });\n\t\t\texpect(fieldState(store, 'name').error).toBeUndefined();\n\t\t\texpect(fieldState(store, 'contacts.0.email').invalid).toBe(false);\n\t\t\texpect(store.getSnapshot().isValid).toBe(false);\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state per exact path',\n\t\tname: 'editing a path drops the errors a host set there, below it and around it, and keeps the others',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, {\n\t\t\t\t[FORM_ROOT]: serverIssue('form'),\n\t\t\t\tcontacts: serverIssue('array'),\n\t\t\t\t'contacts.0': serverIssue('row'),\n\t\t\t\t'contacts.0.email': serverIssue('field'),\n\t\t\t\t'contacts.1.email': serverIssue('sibling'),\n\t\t\t\tnickname: serverIssue('other'),\n\t\t\t});\n\t\t\tstore.setValue('contacts.0.email', 'new@example.com');\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['contacts.1.email', 'nickname']);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state per exact path',\n\t\tname: 'touched marks cover the fields below them, and dirty marks do not cover but report below',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.blur('address');\n\t\t\texpect(fieldState(store, 'address.street').isTouched).toBe(true);\n\t\t\texpect(fieldState(store, 'address').isTouched).toBe(true);\n\t\t\texpect(fieldState(store, 'name').isTouched).toBe(false);\n\t\t\tstore.setValue('address.street', '2 Side');\n\t\t\texpect(fieldState(store, 'address').isDirty).toBe(true);\n\t\t\texpect(fieldState(store, 'address.country').isDirty).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'field state in the shape of the values',\n\t\tname: 'selectFieldState reports error, touched and dirty for a path',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\texpect(fieldState(store, 'name')).toEqual({\n\t\t\t\terror: undefined,\n\t\t\t\twarning: undefined,\n\t\t\t\tinvalid: false,\n\t\t\t\tisTouched: false,\n\t\t\t\tisDirty: false,\n\t\t\t\tisValidating: false,\n\t\t\t\thidden: false,\n\t\t\t\tdisabled: false,\n\t\t\t\trequired: false,\n\t\t\t});\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tstore.blur('name');\n\t\t\tawait serverAnswer(store, { name: serverIssue('no') });\n\t\t\texpect(fieldState(store, 'name')).toMatchObject({\n\t\t\t\terror: { message: 'no' },\n\t\t\t\tinvalid: true,\n\t\t\t\tisTouched: true,\n\t\t\t\tisDirty: true,\n\t\t\t});\n\t\t\tstore.setValue('address.street', '2 Side');\n\t\t\texpect(fieldState(store, 'address')).toMatchObject({ isDirty: true, isTouched: false });\n\t\t},\n\t},\n\t{\n\t\trule: 'snapshot stability',\n\t\tname: 'selectValue and selectFieldState read a snapshot by exact path and keep their reference while it holds',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\texpect(selectValue(before, 'address')).toBe(before.values.address);\n\t\t\texpect(selectValue(before, 'contacts.1.email')).toBe('b@example.com');\n\t\t\tawait serverAnswer(store, { contacts: serverIssue('array') });\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(selectValue(after, 'address')).toBe(selectValue(before, 'address'));\n\t\t\texpect(selectFieldState(after, 'contacts').error?.message).toBe('array');\n\t\t\texpect(selectFieldState(after, 'contacts.0.email').error).toBeUndefined();\n\t\t},\n\t},\n\t{\n\t\trule: 'snapshot stability',\n\t\tname: 'selectFieldState gives the same object for a snapshot and path, and a new one once its state changed',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\texpect(selectFieldState(before, 'name')).toBe(selectFieldState(before, 'name'));\n\t\t\texpect(fieldState(store, 'name')).toBe(selectFieldState(before, 'name'));\n\t\t\tstore.blur('name');\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(selectFieldState(after, 'name')).not.toBe(selectFieldState(before, 'name'));\n\t\t\texpect(selectFieldState(after, 'name').isTouched).toBe(true);\n\t\t\texpect(selectFieldState(before, 'name').isTouched).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'opaque values',\n\t\tname: 'stores and compares opaque values, such as File arrays, by reference',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst file = new File(['x'], 'a.txt');\n\t\t\tconst files = [file];\n\t\t\tstore.setValue('files', files);\n\t\t\texpect(store.getSnapshot().values.files).toBe(files);\n\t\t\texpect(store.getValue('files')).toBe(files);\n\t\t\texpect(Object.isFrozen(files)).toBe(false);\n\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tstore.setValue('files', files);\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\n\t\t\tstore.setValue('files', [file]);\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t\texpect(store.getSnapshot().values.files).not.toBe(files);\n\t\t\texpect((store.getSnapshot().values.files as File[])[0]).toBe(file);\n\t\t\texpect(store.getSnapshot().dirty.files).toBe(true);\n\n\t\t\tstore.setValue('profile', { avatar: [file] });\n\t\t\texpect((store.getSnapshot().values.profile as { avatar: File[] }).avatar[0]).toBe(file);\n\t\t},\n\t},\n\t{\n\t\trule: 'branch replacement',\n\t\tname: 'setValue replaces the whole branch rather than merging into it',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.setValue('address', { street: '9 Elm' });\n\t\t\texpect(store.getSnapshot().values.address).toEqual({ street: '9 Elm' });\n\t\t\texpect(store.getValue('address.country')).toBeUndefined();\n\t\t\tstore.setValue('contacts', [{ email: 'only@example.com' }]);\n\t\t\texpect(contacts(store)).toEqual(['only@example.com']);\n\t\t\texpect(store.getSnapshot().rowIds.contacts).toHaveLength(1);\n\t\t},\n\t},\n\t{\n\t\trule: 'branch replacement',\n\t\tname: 'a replacement with the same content changes nothing and keeps references',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tstore.setValue('address', { street: '1 Main', country: 'IT' });\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\tstore.setValue('address', { street: '1 Main', country: 'FR' });\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(after.values.contacts).toBe(before.values.contacts);\n\t\t},\n\t},\n\t{\n\t\trule: 'snapshot stability',\n\t\tname: 'notifies once per command even when the command starts a validation',\n\t\trun(createStore) {\n\t\t\tconst change = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tconst onChange = vi.fn();\n\t\t\tchange.subscribe(onChange);\n\t\t\tchange.setValue('name', '');\n\t\t\texpect(onChange).toHaveBeenCalledTimes(1);\n\t\t\texpect(change.getSnapshot().validating).toEqual({ name: true });\n\t\t\tchange.fieldArray('contacts').swap(0, 1);\n\t\t\texpect(onChange).toHaveBeenCalledTimes(2);\n\n\t\t\tconst blur = createStore(fixture({ validationMode: 'onBlur' }).options);\n\t\t\tconst onBlur = vi.fn();\n\t\t\tblur.subscribe(onBlur);\n\t\t\tblur.blur('name');\n\t\t\texpect(onBlur).toHaveBeenCalledTimes(1);\n\t\t\texpect(blur.getSnapshot().validating).toEqual({ name: true });\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'an empty list of paths validates nothing, and undefined validates the form',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ defaults: { name: '', nickname: '' } }).options);\n\t\t\tconst watch = watchValidation(store);\n\t\t\texpect(await store.validate([])).toEqual({ outcome: 'passed' });\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'a row operation validates the array own rules, and the rows inside it are not validated',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({ validationMode: 'onChange', defaults: { invites: [] } });\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('x');\n\t\t\tstore.fieldArray('invites').append({ code: 'x', label: 'first' });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).invites?.message).toBe('Add two invites'));\n\t\t\texpect(gate.pending('x')).toBe(0);\n\t\t\texpect(errorsOf(store)['invites.0.code']).toBeUndefined();\n\t\t\texpect(isValidating(store)).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'with onSubmit nothing validates until validate is called',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit' }).options);\n\t\t\tconst watch = watchValidation(store);\n\t\t\tstore.setValue('name', '');\n\t\t\tstore.blur('name');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(errorsOf(store).name?.message).toBe('Name is required');\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'with onChange a change validates and a blur alone does not',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange', defaults: { name: '' } }).options);\n\t\t\tconst watch = watchValidation(store);\n\t\t\tstore.blur('name');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tstore.setValue('name', 'Ada');\n\t\t\tstore.setValue('name', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.message).toBe('Name is required'));\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'with onBlur a blur validates and a change alone does not',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onBlur' }).options);\n\t\t\tconst watch = watchValidation(store);\n\t\t\tstore.setValue('name', '');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tstore.blur('name');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.message).toBe('Name is required'));\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'with all both a change and a blur validate',\n\t\tasync run(createStore) {\n\t\t\tconst onChange = createStore(fixture({ validationMode: 'all' }).options);\n\t\t\tonChange.setValue('name', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(onChange).name).toBeDefined());\n\t\t\tonChange.setValue('name', 'Ada');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(onChange).name).toBeUndefined());\n\n\t\t\tconst onBlur = createStore(fixture({ validationMode: 'all', defaults: { name: '' } }).options);\n\t\t\texpect(errorsOf(onBlur)).toEqual({});\n\t\t\tonBlur.blur('name');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(onBlur).name?.message).toBe('Name is required'));\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'validates only the path that changed',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tfixture({ validationMode: 'onChange', defaults: { name: '', nickname: 'ada' } }).options,\n\t\t\t);\n\t\t\tstore.setValue('nickname', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).nickname?.message).toBe('Nickname is required'));\n\t\t\texpect(errorsOf(store).name).toBeUndefined();\n\t\t},\n\t},\n\t{\n\t\trule: 're-validation after a failed check',\n\t\tname: 'after a failed validate the paths re-validate on change under reValidateMode onChange',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit', reValidateMode: 'onChange' }).options);\n\t\t\tstore.setValue('name', '');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tstore.setValue('name', 'Ada');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name).toBeUndefined());\n\t\t\tstore.setValue('name', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.message).toBe('Name is required'));\n\t\t},\n\t},\n\t{\n\t\trule: 're-validation after a failed check',\n\t\tname: 'reValidateMode onBlur re-validates on blur only, and onSubmit not at all',\n\t\tasync run(createStore) {\n\t\t\tconst onBlur = createStore(fixture({ validationMode: 'onSubmit', reValidateMode: 'onBlur' }).options);\n\t\t\tonBlur.setValue('name', '');\n\t\t\tawait onBlur.validate();\n\t\t\tconst changeWatch = watchValidation(onBlur);\n\t\t\tonBlur.setValue('name', 'Ada');\n\t\t\tawait settle();\n\t\t\texpect(changeWatch.started).toBe(false);\n\t\t\texpect(errorsOf(onBlur).name).toBeDefined();\n\t\t\tonBlur.blur('name');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(onBlur).name).toBeUndefined());\n\n\t\t\tconst onSubmit = createStore(fixture({ validationMode: 'onSubmit', reValidateMode: 'onSubmit' }).options);\n\t\t\tonSubmit.setValue('name', '');\n\t\t\tawait onSubmit.validate();\n\t\t\tconst submitWatch = watchValidation(onSubmit);\n\t\t\tonSubmit.setValue('name', 'Ada');\n\t\t\tonSubmit.blur('name');\n\t\t\tawait settle();\n\t\t\texpect(submitWatch.started).toBe(false);\n\t\t\texpect(errorsOf(onSubmit).name).toBeDefined();\n\t\t},\n\t},\n\t{\n\t\trule: 're-validation after a failed check',\n\t\tname: 'a failed check of some paths does not turn on re-validation for the others',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit', reValidateMode: 'onChange' }).options);\n\t\t\tstore.setValue('name', '');\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'invalid' });\n\t\t\tconst watch = watchValidation(store);\n\t\t\tstore.setValue('nickname', '');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(errorsOf(store).nickname).toBeUndefined();\n\t\t\tstore.setValue('name', 'Ada');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name).toBeUndefined());\n\t\t},\n\t},\n\t{\n\t\trule: 're-validation after a failed check',\n\t\tname: 'a passing validate starts re-validation of the paths it checked, and no others, and reset ends it',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit', reValidateMode: 'onChange' }).options);\n\t\t\texpect(await store.validate(['nickname'])).toEqual({ outcome: 'passed' });\n\t\t\tconst other = watchValidation(store);\n\t\t\tstore.setValue('name', '');\n\t\t\tawait settle();\n\t\t\texpect(other.started).toBe(false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tstore.setValue('name', 'Ada');\n\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\tstore.setValue('name', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.type).toBe('required'));\n\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tstore.reset();\n\t\t\tconst afterReset = watchValidation(store);\n\t\t\tstore.setValue('name', '');\n\t\t\tawait settle();\n\t\t\texpect(afterReset.started).toBe(false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'silent validity check',\n\t\tname: 'checkValidity reports validity and changes nothing, not even for subscribers',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.setValue('name', '');\n\t\t\tconst before = store.getSnapshot();\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'touched and dirty',\n\t\tname: 'touched is set by a blur, not by a change, and cleared by reset',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\t\t\tstore.blur('name');\n\t\t\texpect(store.getSnapshot().touched).toEqual({ name: true });\n\t\t\tconst touched = store.getSnapshot().touched;\n\t\t\tstore.blur('name');\n\t\t\texpect(store.getSnapshot().touched).toBe(touched);\n\t\t\tstore.reset();\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'touched and dirty',\n\t\tname: 'dirty follows the difference from the defaults, and appending a row does not make the rows before it dirty',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t\tstore.setValue('address.street', '2 Side');\n\t\t\texpect(marked(store.getSnapshot().dirty)).toEqual(['address.street']);\n\t\t\tstore.setValue('address.street', '1 Main');\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t\tstore.setValue('contacts.1.email', 'x@example.com');\n\t\t\texpect(marked(store.getSnapshot().dirty)).toEqual(['contacts.1.email']);\n\t\t\tstore.setValue('contacts.1.email', 'b@example.com');\n\t\t\tstore.fieldArray('contacts').append({ email: 'x@example.com' });\n\t\t\texpect(marked(store.getSnapshot().dirty)).toEqual(['contacts', 'contacts.3.email']);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tstore.reset();\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'touched and dirty',\n\t\tname: 'reset without values restores the defaults and clears every source of state',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit' }).options);\n\t\t\tawait serverAnswer(store, { nickname: serverIssue('no') });\n\t\t\tstore.setValue('name', '');\n\t\t\tstore.blur('name');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tstore.reset();\n\t\t\tconst snapshot = store.getSnapshot();\n\t\t\texpect(snapshot.values.name).toBe('Ada');\n\t\t\texpect(snapshot.errors).toEqual({});\n\t\t\texpect(snapshot.touched).toEqual({});\n\t\t\texpect(snapshot.dirty).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'touched and dirty',\n\t\tname: 'reset with values makes them the new defaults',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tstore.reset({ name: 'Hedy' });\n\t\t\texpect(store.getSnapshot().values).toEqual({ name: 'Hedy' });\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t\tstore.setValue('name', 'Ada');\n\t\t\texpect(store.getSnapshot().dirty).toEqual({ name: true });\n\t\t\tstore.reset();\n\t\t\texpect(store.getValue('name')).toBe('Hedy');\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'swap moves rows with their ids, errors and touched state in one update',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, {\n\t\t\t\t'contacts.0.email': serverIssue('zero'),\n\t\t\t\t'contacts.1.email': serverIssue('one'),\n\t\t\t});\n\t\t\tstore.blur('contacts.1.email');\n\t\t\tconst [first, second, third] = ids(store);\n\t\t\tconst listener = vi.fn(() => {\n\t\t\t\tconst snapshot = store.getSnapshot();\n\t\t\t\texpect(snapshot.rowIds.contacts).toEqual([second, first, third]);\n\t\t\t\texpect(contacts(store)).toEqual(['b@example.com', 'a@example.com', 'c@example.com']);\n\t\t\t\texpect(snapshot.errors['contacts.0.email']?.message).toBe('one');\n\t\t\t\texpect(snapshot.errors['contacts.1.email']?.message).toBe('zero');\n\t\t\t\texpect(marked(snapshot.touched)).toEqual(['contacts.0.email']);\n\t\t\t});\n\t\t\tstore.subscribe(listener);\n\t\t\tstore.fieldArray('contacts').swap(0, 1);\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'move, prepend, insert and remove shift state to the rows it belongs to',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst array = store.fieldArray('contacts');\n\t\t\tconst [first, second, third] = ids(store);\n\t\t\tawait serverAnswer(store, { 'contacts.2.email': serverIssue('two') });\n\t\t\tstore.blur('contacts.2.email');\n\n\t\t\tarray.move(2, 0);\n\t\t\texpect(ids(store)).toEqual([third, first, second]);\n\t\t\texpect(errorsOf(store)['contacts.0.email']?.message).toBe('two');\n\t\t\texpect(marked(store.getSnapshot().touched)).toEqual(['contacts.0.email']);\n\n\t\t\tarray.prepend({ email: 'new@example.com' });\n\t\t\texpect(ids(store).slice(1)).toEqual([third, first, second]);\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['contacts.1.email']);\n\n\t\t\tarray.insert(1, { email: 'mid@example.com' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['contacts.2.email']);\n\t\t\texpect(ids(store).slice(2)).toEqual([third, first, second]);\n\n\t\t\tarray.remove(0);\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['contacts.1.email']);\n\t\t\texpect(marked(store.getSnapshot().touched)).toEqual(['contacts.1.email']);\n\n\t\t\tarray.remove(1);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\t\t\texpect(contacts(store)).toEqual(['mid@example.com', 'a@example.com', 'b@example.com']);\n\t\t\texpect(toFieldArrayValue(ids(store), array).fields.map(({ id }) => id)).toEqual(ids(store));\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'append keeps existing rows and ids, and an array value appends several rows',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = ids(store);\n\t\t\tstore.fieldArray('contacts').append([{ email: 'x@example.com' }, { email: 'y@example.com' }]);\n\t\t\texpect(ids(store).slice(0, 3)).toEqual(before);\n\t\t\texpect(ids(store)).toHaveLength(5);\n\t\t\texpect(new Set(ids(store)).size).toBe(5);\n\t\t\texpect(contacts(store).slice(3)).toEqual(['x@example.com', 'y@example.com']);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'update and replace give the rows new ids and drop their state',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst array = store.fieldArray('contacts');\n\t\t\tconst before = ids(store);\n\t\t\tawait serverAnswer(store, {\n\t\t\t\t'contacts.0.email': serverIssue('zero'),\n\t\t\t\t'contacts.1.email': serverIssue('one'),\n\t\t\t});\n\t\t\tstore.blur('contacts.0.email');\n\t\t\tarray.update(1, { email: 'u@example.com' });\n\t\t\texpect(ids(store)[0]).toBe(before[0]);\n\t\t\texpect(ids(store)[1]).not.toBe(before[1]);\n\t\t\texpect(ids(store)[2]).toBe(before[2]);\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['contacts.0.email']);\n\t\t\texpect(marked(store.getSnapshot().touched)).toEqual(['contacts.0.email']);\n\n\t\t\tarray.replace([{ email: 'r@example.com' }]);\n\t\t\texpect(ids(store)).toHaveLength(1);\n\t\t\texpect(before).not.toContain(ids(store)[0]);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'an operation naming a row that does not exist does nothing, and remove removes each row once',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst array = store.fieldArray('contacts');\n\t\t\tconst before = store.getSnapshot();\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tarray.swap(0, 5);\n\t\t\tarray.move(-1, 0);\n\t\t\tarray.move(0, 3);\n\t\t\tarray.update(3, { email: 'z@example.com' });\n\t\t\tarray.insert(4, { email: 'z@example.com' });\n\t\t\tarray.insert(1.5, { email: 'z@example.com' });\n\t\t\tarray.remove(7);\n\t\t\tarray.remove([]);\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\n\t\t\tarray.insert(3, { email: 'end@example.com' });\n\t\t\texpect(contacts(store)).toHaveLength(4);\n\t\t\tarray.remove([0, 0, 9]);\n\t\t\texpect(contacts(store)).toEqual(['b@example.com', 'c@example.com', 'end@example.com']);\n\t\t\tarray.remove();\n\t\t\texpect(contacts(store)).toEqual([]);\n\t\t\texpect(store.getSnapshot().rowIds.contacts).toEqual([]);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'nested and scalar arrays carry their rows state, and shrinking drops it',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tfixture({\n\t\t\t\t\tdefaults: {\n\t\t\t\t\t\tname: 'Ada',\n\t\t\t\t\t\tnickname: 'ada',\n\t\t\t\t\t\tslug: 'free',\n\t\t\t\t\t\tcode: '12345',\n\t\t\t\t\t\tcontacts: [{ email: 'a@example.com' }],\n\t\t\t\t\t\tinvites: [{ code: 'one' }, { code: 'two' }],\n\t\t\t\t\t\tgroups: [\n\t\t\t\t\t\t\t{ title: 'a', members: [{ label: 'x' }, { label: 'y' }] },\n\t\t\t\t\t\t\t{ title: 'b', members: [{ label: 'z' }] },\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttags: ['p', 'q', 'r'],\n\t\t\t\t\t},\n\t\t\t\t}).options,\n\t\t\t);\n\t\t\tawait serverAnswer(store, {\n\t\t\t\t'groups.0.members.1.label': serverIssue('inner'),\n\t\t\t\t'tags.1': serverIssue('scalar'),\n\t\t\t});\n\t\t\tstore.blur('groups.0.members.1.label');\n\t\t\tstore.blur('tags.2');\n\n\t\t\tstore.fieldArray('groups').swap(0, 1);\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['groups.1.members.1.label', 'tags.1']);\n\t\t\texpect(marked(store.getSnapshot().touched).toSorted()).toEqual(['groups.1.members.1.label', 'tags.2']);\n\n\t\t\tstore.fieldArray('groups.1.members').remove(0);\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['groups.1.members.0.label', 'tags.1']);\n\n\t\t\tstore.fieldArray('tags').remove(0);\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['groups.1.members.0.label', 'tags.0']);\n\t\t\texpect(marked(store.getSnapshot().touched).toSorted()).toEqual(['groups.1.members.0.label', 'tags.1']);\n\n\t\t\tstore.setValue('groups', [{ title: 'only', members: [] }]);\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['tags.0']);\n\t\t\texpect(marked(store.getSnapshot().touched)).toEqual(['tags.1']);\n\t\t\texpect(store.getSnapshot().rowIds['groups.0.members']).toEqual([]);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'hydrates from the serialized snapshot of another container: its values and ids after row operations, and fresh ids for new rows',\n\t\tasync run(createStore) {\n\t\t\tconst server = createStore(fixture().options);\n\t\t\tserver.fieldArray('contacts').remove(0);\n\t\t\tserver.fieldArray('contacts').prepend({ email: 'first@example.com' });\n\t\t\tserver.fieldArray('invites').swap(0, 1);\n\t\t\tserver.setValue('name', 'Typed');\n\t\t\tconst hydration: FormStateHydration = JSON.parse(JSON.stringify(toHydration(server.getSnapshot())));\n\n\t\t\tconst client = createStore(fixture({ snapshot: hydration }).options);\n\t\t\tconst was = server.getSnapshot();\n\t\t\texpect(client.getSnapshot().values).toEqual(was.values);\n\t\t\texpect(client.getSnapshot().rowIds).toEqual(was.rowIds);\n\t\t\texpect(client.getSnapshot().dirty).toEqual(was.dirty);\n\t\t\texpect(client.getServerSnapshot().rowIds).toEqual(was.rowIds);\n\n\t\t\tclient.fieldArray('contacts').append({ email: 'new@example.com' });\n\t\t\tclient.fieldArray('contacts').remove(0);\n\t\t\tconst adopted = Object.values(was.rowIds).flat();\n\t\t\tconst minted = ids(client).filter((id) => !adopted.includes(id));\n\t\t\texpect(minted).toHaveLength(1);\n\t\t\texpect(ids(client).slice(0, 2)).toEqual(was.rowIds.contacts.slice(1));\n\t\t\texpect(new Set(ids(client)).size).toBe(ids(client).length);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'a branch written over rows drops the state of rows that no longer exist',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, { 'contacts.2.email': serverIssue('two') });\n\t\t\tstore.blur('contacts.2.email');\n\t\t\tstore.setValue('contacts', [{ email: 'a@example.com' }]);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\n\t\t\tconst checked = createStore(fixture().options);\n\t\t\tchecked.setValue('contacts.2.email', '');\n\t\t\texpect(await checked.validate(['contacts.2.email'])).toEqual({ outcome: 'invalid' });\n\t\t\tchecked.setValue('contacts', [{ email: 'a@example.com' }]);\n\t\t\tchecked.fieldArray('contacts').append({ email: 'fresh@example.com' });\n\t\t\tchecked.fieldArray('contacts').append({ email: '' });\n\t\t\texpect(errorsOf(checked)).toEqual({});\n\t\t\tconst watch = watchValidation(checked);\n\t\t\tchecked.setValue('contacts.2.email', 'changed@example.com');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'keeps row ids by position when a branch is replaced with the same number of rows',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = ids(store);\n\t\t\tstore.setValue('contacts', [{ email: '1' }, { email: '2' }, { email: '3' }]);\n\t\t\texpect(ids(store)).toEqual(before);\n\t\t\tstore.setValue('contacts', [{ email: '1' }]);\n\t\t\texpect(ids(store)).toEqual(before.slice(0, 1));\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'lists the server, then each failed rule in rule order, then the native fact, and shows the first',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\telements: [\n\t\t\t\t\telement({\n\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\tname: 'slug',\n\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t{ $type: 'gate', id: 'first' },\n\t\t\t\t\t\t\t{ $type: 'gate', id: 'second' },\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tdefaults: { slug: 'free' },\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tanswer.setServerErrors({ slug: { message: 'Taken' } });\n\t\t\tgate.settle('free', false);\n\t\t\tstore.reportNative({ slug: { type: 'patternMismatch', params: { pattern: '[0-9]+' } } });\n\t\t\texpect(await store.validate(['slug'])).toEqual({ outcome: 'invalid' });\n\t\t\tconst shown = errorsOf(store).slug;\n\t\t\texpect(shown.all).toEqual([\n\t\t\t\t{ type: 'server', message: 'Taken', source: 'server' },\n\t\t\t\t{ type: 'gate', source: 'validation', ruleId: 'first' },\n\t\t\t\t{ type: 'gate', source: 'validation', ruleId: 'second' },\n\t\t\t\t{ type: 'patternMismatch', source: 'native', params: { pattern: '[0-9]+' } },\n\t\t\t]);\n\t\t\tconst { all, ...fields } = shown;\n\t\t\texpect(fields).toEqual(all[0]);\n\n\t\t\tanswer.setServerErrors({});\n\t\t\tconst withoutServer = errorsOf(store).slug;\n\t\t\texpect(withoutServer.type).toBe('gate');\n\t\t\texpect(withoutServer.all).toHaveLength(3);\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'native validity is an input to validation: it shows with the timing of validation, and notifies nobody alone',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onSubmit' }).options);\n\t\t\tstore.reportNative({ name: { type: 'valueMissing', message: 'Fill in' } });\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'invalid' });\n\t\t\texpect(errorsOf(store).name).toMatchObject({ source: 'native', type: 'valueMissing', message: 'Fill in' });\n\n\t\t\tstore.reportNative({ name: null });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store)).toEqual({}));\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'passed' });\n\n\t\t\tconst quiet = createStore(fixture({ validationMode: 'onSubmit' }).options);\n\t\t\tquiet.blur('name');\n\t\t\tquiet.reportNative({ name: { type: 'valueMissing' } });\n\t\t\texpect(errorsOf(quiet)).toEqual({});\n\n\t\t\tconst onChange = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tonChange.setValue('nickname', 'nick');\n\t\t\tonChange.reportNative({ nickname: { type: 'valueMissing', message: 'Fill in this field' } });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(onChange).nickname?.source).toBe('native'));\n\t\t\texpect(errorsOf(onChange).nickname.message).toBe('Fill in this field');\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'validate and checkValidity count native facts and server errors alike, and checkValidity writes nothing',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.reportNative({ name: { type: 'valueMissing' } });\n\t\t\tconst before = store.getSnapshot();\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tstore.reportNative({ name: null });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\n\t\t\tawait serverAnswer(store, { name: { message: 'Taken' } });\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'a cleared server source lets validate pass, and the form-level error alone blocks it',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tanswer.setServerErrors({ [FORM_ROOT]: { message: 'Service unavailable' } });\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'passed' });\n\t\t\tanswer.setServerErrors({});\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'a source may give a type or a message or neither, and the error still counts',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tawait serverAnswer(store, {\n\t\t\t\tname: { message: 'Taken' },\n\t\t\t\tnickname: {},\n\t\t\t\t'address.street': { type: 'taken' },\n\t\t\t});\n\t\t\tconst { errors } = store.getSnapshot();\n\t\t\texpect(errors.name).toMatchObject({ type: 'server', message: 'Taken', source: 'server' });\n\t\t\texpect(errors.nickname).toEqual({\n\t\t\t\ttype: 'server',\n\t\t\t\tsource: 'server',\n\t\t\t\tall: [{ type: 'server', source: 'server' }],\n\t\t\t});\n\t\t\texpect(errors['address.street']).toMatchObject({ type: 'taken', source: 'server' });\n\t\t\texpect(errors['address.street'].message).toBeUndefined();\n\t\t\texpect(await store.validate(['nickname'])).toEqual({ outcome: 'invalid' });\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'identical errors change nothing and keep their objects, and a changed one replaces only its own',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tanswer.setServerErrors({ name: { message: 'Taken' }, nickname: { message: 'Taken' } });\n\t\t\tconst before = store.getSnapshot();\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tanswer.setServerErrors({ name: { message: 'Taken' }, nickname: { message: 'Taken' } });\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\n\t\t\tanswer.setServerErrors({ name: { message: 'Taken' }, nickname: { message: 'Other' } });\n\t\t\tconst after = store.getSnapshot();\n\t\t\texpect(after.errors.name).toBe(before.errors.name);\n\t\t\texpect(after.errors.nickname).not.toBe(before.errors.nickname);\n\t\t\texpect(selectFieldState(after, 'name')).toBe(selectFieldState(before, 'name'));\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'a validation that finds the same thing again keeps its error objects, and reset clears native facts',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ defaults: { name: '' } }).options);\n\t\t\tawait store.validate(['name']);\n\t\t\tconst first = store.getSnapshot();\n\t\t\tawait store.validate(['name']);\n\t\t\texpect(store.getSnapshot().errors.name).toBe(first.errors.name);\n\t\t\texpect(selectFieldState(store.getSnapshot(), 'name')).toBe(selectFieldState(first, 'name'));\n\n\t\t\tstore.blur('nickname');\n\t\t\tstore.reportNative({ nickname: { type: 'valueMissing' } });\n\t\t\tstore.reset();\n\t\t\tstore.setValue('nickname', '');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(errorsOf(store).nickname.all.map(({ source }) => source)).toEqual(['validation']);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'toFieldArrayValue gives the same object while the rows are the same, and the commands are one object per path',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst commands = store.fieldArray('contacts');\n\t\t\texpect(store.fieldArray('contacts')).toBe(commands);\n\t\t\tconst rows = store.getSnapshot().rowIds.contacts;\n\t\t\texpect(toFieldArrayValue(rows, commands)).toBe(toFieldArrayValue(rows, commands));\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(toFieldArrayValue(store.getSnapshot().rowIds.contacts, commands)).toBe(\n\t\t\t\ttoFieldArrayValue(rows, commands),\n\t\t\t);\n\t\t\tcommands.append({ email: 'x@example.com' });\n\t\t\texpect(toFieldArrayValue(store.getSnapshot().rowIds.contacts, commands)).not.toBe(\n\t\t\t\ttoFieldArrayValue(rows, commands),\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'a hydration whose row ids do not match its own values throws instead of starting from it',\n\t\trun(createStore) {\n\t\t\tconst good = toHydration(createStore(fixture().options).getSnapshot());\n\t\t\tconst start = (hydration: unknown) => () =>\n\t\t\t\tcreateStore(fixture({ snapshot: hydration as FormStateHydration }).options);\n\t\t\texpect(start({ ...good, rowIds: { ...good.rowIds, contacts: ['a', 'b'] } })).toThrow();\n\t\t\texpect(start({ ...good, rowIds: { ...good.rowIds, invites: ['k', 'k'] } })).toThrow();\n\t\t\texpect(start({ ...good, rowIds: { ...good.rowIds, name: ['x'] } })).toThrow();\n\t\t\texpect(start({ ...good, rowIds: { ...good.rowIds, contacts: ['a', 'b', 7] } })).toThrow();\n\t\t\texpect(start({ ...good, rowIds: { contacts: good.rowIds.contacts } })).toThrow();\n\t\t\texpect(start({ ...good, rowIds: { ...good.rowIds, invites: good.rowIds.contacts } })).toThrow();\n\t\t\texpect(start({ values: good.values })).toThrow();\n\t\t\texpect(start('nothing')).toThrow();\n\t\t\texpect(start(null)).toThrow();\n\t\t\texpect(start(good)).not.toThrow();\n\t\t},\n\t},\n\t{\n\t\trule: 'array reindexing',\n\t\tname: 'containers built from the same defaults mint the same row ids',\n\t\trun(createStore) {\n\t\t\texpect(createStore(fixture().options).getSnapshot().rowIds).toEqual(\n\t\t\t\tcreateStore(fixture().options).getSnapshot().rowIds,\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\trule: 'error sources',\n\t\tname: 'refuses a reserved path and a row that does not exist, and writes nothing',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tconst values = store.getSnapshot().values;\n\t\t\texpect(() => answer.setServerErrors({ __secret: { message: 'x' } })).toThrow(/reserved segment '__secret'/);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.__proto__.email': { message: 'x' } })).toThrow(/reserved/);\n\t\t\texpect(() => store.blur(FORM_ROOT)).toThrow(/reserved/);\n\t\t\texpect(() => store.setValue('__x', 1)).toThrow(/reserved/);\n\t\t\texpect(() => store.reportNative({ __x: { type: 'valueMissing' } })).toThrow(/reserved/);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.4.email': { message: 'bounced' } })).toThrow(\n\t\t\t\t/'contacts.4.email' names row '4' of 'contacts', which has 3 rows/,\n\t\t\t);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.x': { message: 'x' } })).toThrow(/names row 'x'/);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.-1.email': { message: 'x' } })).toThrow(/names row '-1'/);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.1e-7.email': { message: 'x' } })).toThrow(\n\t\t\t\t/names row '1e-7'/,\n\t\t\t);\n\t\t\texpect(() => answer.setServerErrors({ 'contacts.01.email': { message: 'x' } })).toThrow(/names row '01'/);\n\t\t\texpect(store.getSnapshot().values).toBe(values);\n\t\t\texpect(store.getSnapshot().errors).toEqual({});\n\t\t\texpect(() =>\n\t\t\t\tanswer.setServerErrors({ 'nothing.here': { message: 'fine' }, [FORM_ROOT]: { message: 'form' } }),\n\t\t\t).not.toThrow();\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual([FORM_ROOT]);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'applies an async result that is still current',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('taken');\n\t\t\tstore.setValue('slug', 'taken');\n\t\t\tconst run = store.validate(['slug']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('taken')).toBe(1));\n\t\t\texpect(isValidating(store)).toBe(true);\n\t\t\tgate.settle('taken', false);\n\t\t\texpect(await run).toEqual({ outcome: 'invalid' });\n\t\t\texpect(errorsOf(store).slug?.type).toBe('gate');\n\t\t\texpect(isValidating(store)).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'drops a result that arrives after a reset',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({ validationMode: 'onChange', defaults: { slug: 'taken' } });\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('taken');\n\t\t\tstore.setValue('slug', 'other');\n\t\t\tstore.setValue('slug', 'taken');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('taken')).toBe(1));\n\t\t\tstore.reset();\n\t\t\texpect(store.getValue('slug')).toBe('taken');\n\t\t\tgate.settle('taken', false);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'applies a late result to the row it was for after the rows moved',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\tvalidationMode: 'onBlur',\n\t\t\t\tdefaults: {\n\t\t\t\t\tinvites: [\n\t\t\t\t\t\t{ code: 'one', label: 'first' },\n\t\t\t\t\t\t{ code: 'one', label: 'second' },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tstore.blur('invites.0.code');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('invites').swap(0, 1);\n\t\t\tgate.settle('one', false);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(store.getValue('invites.1.label')).toBe('first');\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['invites.1.code']);\n\t\t\texpect(marked(store.getSnapshot().touched)).toEqual(['invites.1.code']);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'drops a late result for a row that was removed',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\tvalidationMode: 'onBlur',\n\t\t\t\tdefaults: {\n\t\t\t\t\tinvites: [\n\t\t\t\t\t\t{ code: 'one', label: 'first' },\n\t\t\t\t\t\t{ code: 'one', label: 'second' },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tstore.blur('invites.0.code');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('invites').remove(0);\n\t\t\tgate.settle('one', false);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'a validate that a reset overtook is dropped and not run again against the defaults',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({ defaults: { name: 'Ada', slug: 'taken' } });\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('taken');\n\t\t\tconst run = store.validate(['slug']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('taken')).toBe(1));\n\t\t\tstore.setValue('slug', 'other');\n\t\t\tstore.reset();\n\t\t\tconst watch = watchValidation(store);\n\t\t\tgate.settle('taken', false);\n\t\t\texpect(await run).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(gate.pending('taken')).toBe(0);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(isValidating(store)).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'drops a late result when its rows were replaced',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\tvalidationMode: 'onBlur',\n\t\t\t\tdefaults: { invites: [{ code: 'one', label: 'first' }] },\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tstore.blur('invites.0.code');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('invites').replace([{ code: 'one', label: 'second' }]);\n\t\t\tgate.settle('one', false);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'follows a nested row when the rows around it move',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\tvalidationMode: 'onBlur',\n\t\t\t\tdefaults: {\n\t\t\t\t\tgroups: [\n\t\t\t\t\t\t{ title: 'a', members: [{ code: 'x' }, { code: 'one' }] },\n\t\t\t\t\t\t{ title: 'b', members: [{ code: 'y' }] },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tstore.blur('groups.0.members.1.code');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('groups').swap(0, 1);\n\t\t\tstore.fieldArray('groups.1.members').remove(0);\n\t\t\tgate.settle('one', false);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['groups.1.members.0.code']);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'an explicit validate that lost part of its result ends with the verdict of the current state',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one', 'two');\n\t\t\tconst run = store.validate(['invites']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('invites').swap(0, 1);\n\t\t\tgate.settle('one', false);\n\t\t\tgate.settle('two', true);\n\t\t\texpect(await run).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['invites.1.code']);\n\t\t\texpect(isValidating(store)).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'stale async results',\n\t\tname: 'drops a result for a path whose value was written while it was running, and ends with the verdict of the current state',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('taken');\n\t\t\tstore.setValue('slug', 'taken');\n\t\t\tconst run = store.validate(['slug']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('taken')).toBe(1));\n\t\t\tstore.setValue('slug', 'free');\n\t\t\tgate.settle('taken', false);\n\t\t\texpect(await run).toEqual({ outcome: 'passed' });\n\t\t\texpect(errorsOf(store).slug).toBeUndefined();\n\t\t},\n\t},\n\t{\n\t\trule: 'freshness',\n\t\tname: 'a second edit during a validation retry is overtaken, not the validity of a value it never checked',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.settle('taken', false);\n\t\t\tgate.hold('a', 'b');\n\t\t\tstore.setValue('slug', 'a');\n\t\t\tconst run = store.validate(['slug']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('a')).toBe(1));\n\t\t\tstore.setValue('slug', 'b');\n\t\t\tgate.settle('a', true);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('b')).toBe(1));\n\t\t\tstore.setValue('slug', 'taken');\n\t\t\tgate.settle('b', true);\n\t\t\texpect(await run).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(await store.validate(['slug'])).toEqual({ outcome: 'invalid' });\n\t\t},\n\t},\n\t{\n\t\trule: 'freshness',\n\t\tname: 'a validate and a submit that one reset overtook end the same way: overtaken is no verdict, and the next check starts clean',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({ defaults: { name: 'Ada', nickname: 'Ace', slug: 'taken' } });\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('taken');\n\t\t\tconst validated = store.validate(['slug']);\n\t\t\tconst submitted = store.submit();\n\t\t\tawait vi.waitFor(() => expect(gate.pending('taken')).toBe(2));\n\t\t\tstore.reset();\n\t\t\tgate.settle('taken', false);\n\t\t\texpect(await validated).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(await submitted).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(await store.validate(['slug'])).toEqual({ outcome: 'invalid' });\n\t\t},\n\t},\n\t{\n\t\trule: 'freshness',\n\t\tname: 'a retry checks the rows it was asked about after they moved, not the ones now at those indexes',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tconst run = store.validate(['invites.0.code']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\tstore.fieldArray('invites').swap(0, 1);\n\t\t\tgate.settle('one', false);\n\t\t\texpect(await run).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['invites.1.code']);\n\t\t},\n\t},\n\t{\n\t\trule: 'freshness',\n\t\tname: 'a check whose rows were removed, or that a reset overtook, is overtaken and writes nothing',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('two');\n\t\t\tconst removed = store.validate(['invites.1.code']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('two')).toBe(1));\n\t\t\tstore.fieldArray('invites').remove(1);\n\t\t\tgate.settle('two', false);\n\t\t\texpect(await removed).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\n\t\t\tconst other = createStore(fixture().options);\n\t\t\tconst held = fixture();\n\t\t\theld.gate.hold('one');\n\t\t\tconst reset = createStore(held.options);\n\t\t\tconst overtaken = reset.validate(['invites.0.code']);\n\t\t\tawait vi.waitFor(() => expect(held.gate.pending('one')).toBe(1));\n\t\t\treset.reset();\n\t\t\theld.gate.settle('one', false);\n\t\t\texpect(await overtaken).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(errorsOf(reset)).toEqual({});\n\t\t\texpect(await other.validate()).toEqual({ outcome: 'passed' });\n\t\t},\n\t},\n\t{\n\t\trule: 'freshness',\n\t\tname: 'checkValidity answers for the values, facts and errors current when it was called, and never mixes in later ones',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tstore.setValue('invites.0.code', 'pending');\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tgate.hold('pending');\n\t\t\tconst first = store.checkValidity();\n\t\t\tawait vi.waitFor(() => expect(gate.pending('pending')).toBe(1));\n\t\t\tanswer.setServerErrors({ 'invites.0.code': { type: 'late' } });\n\t\t\tgate.settle('pending', true);\n\t\t\texpect(await first).toBe(true);\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\tstore.setValue('invites.0.code', 'other');\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\tstore.reportNative({ 'invites.0.code': { type: 'valueMissing' } });\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'an edit during validation followed by a passing retry submits the edited values, and the server answer for them applies',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst run = store.submit();\n\t\t\tstore.setValue('nickname', 'ada2');\n\t\t\tconst submitted = passedOf(await run);\n\t\t\texpect(submitted.values.nickname).toBe('ada2');\n\t\t\texpect(submitted.values).toEqual(store.getSnapshot().values);\n\t\t\texpect(Object.isFrozen(submitted.values)).toBe(true);\n\t\t\tsubmitted.setServerErrors({ nickname: { type: 'taken' } });\n\t\t\texpect(errorsOf(store).nickname?.type).toBe('taken');\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'a submission that fails is invalid and has no values, and an edit after a pass drops only the answers for what it touched',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.setValue('name', '');\n\t\t\texpect(await store.submit()).toEqual({ outcome: 'invalid' });\n\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tconst submitted = await passedSubmission(store);\n\t\t\texpect(submitted.values.name).toBe('Grace');\n\t\t\tstore.setValue('nickname', 'changed');\n\t\t\tsubmitted.setServerErrors({ name: { type: 'taken' }, nickname: { type: 'taken' } });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['name']);\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'a submission a later one superseded ends overtaken, and the values of a passed one are plain frozen data',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst older = store.submit();\n\t\t\tconst newer = store.submit();\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\texpect(await older).toEqual({ outcome: 'overtaken' });\n\t\t\tconst submitted = passedOf(await newer);\n\t\t\texpect(submitted.values.name).toBe('Grace');\n\t\t\texpect(Object.isFrozen(submitted.values)).toBe(true);\n\t\t\texpect(submitted.values).toBe(submitted.values);\n\t\t},\n\t},\n\t{\n\t\trule: 'pending per field',\n\t\tname: 'lists the paths a check is running for, moves with a row, and drops a path a later check took over',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({ validationMode: 'onBlur' });\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('one');\n\t\t\tstore.blur('invites.0.code');\n\t\t\tawait vi.waitFor(() => expect(gate.pending('one')).toBe(1));\n\t\t\texpect(store.getSnapshot().validating).toEqual({ 'invites.0.code': true });\n\t\t\texpect(isValidating(store)).toBe(true);\n\t\t\texpect(fieldState(store, 'invites.0.code').isValidating).toBe(true);\n\t\t\texpect(fieldState(store, 'invites.1.code').isValidating).toBe(false);\n\t\t\tstore.fieldArray('invites').swap(0, 1);\n\t\t\texpect(store.getSnapshot().validating).toEqual({ 'invites.1.code': true });\n\t\t\tgate.settle('one', true);\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\texpect(store.getSnapshot().validating).toEqual({});\n\n\t\t\tconst racing = fixture();\n\t\t\tracing.gate.hold('a');\n\t\t\tconst second = createStore(racing.options);\n\t\t\tsecond.setValue('slug', 'a');\n\t\t\tconst older = second.validate(['slug']);\n\t\t\tawait vi.waitFor(() => expect(racing.gate.pending('a')).toBe(1));\n\t\t\tsecond.setValue('slug', 'b');\n\t\t\texpect(await second.validate(['slug'])).toEqual({ outcome: 'passed' });\n\t\t\texpect(second.getSnapshot().validating).toEqual({});\n\t\t\tracing.gate.settle('a', true);\n\t\t\texpect(await older).toEqual({ outcome: 'passed' });\n\t\t},\n\t},\n\t{\n\t\trule: 'pending per field',\n\t\tname: 'a superseded async check leaves no issue and no pending mark: pending is state, never an issue',\n\t\tasync run(createStore) {\n\t\t\tvi.stubGlobal(\n\t\t\t\t'fetch',\n\t\t\t\tvi.fn(async () => new Response(JSON.stringify({ valid: true }))),\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst store = createStore(\n\t\t\t\t\tcustom(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\t\tname: 'handle',\n\t\t\t\t\t\t\t\trules: [{ $type: 'async', url: '/check', debounce: 30, disableCache: true }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t{ handle: '' },\n\t\t\t\t\t\t{ validationMode: 'onChange' },\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tstore.setValue('handle', 'a');\n\t\t\t\tstore.setValue('handle', 'ab');\n\t\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false), { timeout: 2000 });\n\t\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\t\texpect(store.getSnapshot().warnings).toEqual({});\n\t\t\t\texpect(store.getSnapshot().validating).toEqual({});\n\t\t\t\texpect(JSON.stringify(store.getSnapshot())).not.toMatch(/pending/i);\n\t\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\t} finally {\n\t\t\t\tvi.unstubAllGlobals();\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'a response for values that were edited since the submission began is dropped',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst old = await passedSubmission(store);\n\t\t\told.setServerErrors({ name: { type: 'old' } });\n\t\t\texpect(errorsOf(store).name?.type).toBe('old');\n\t\t\tconst submission = await passedSubmission(store);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tstore.setValue('name', 'Grace');\n\t\t\tsubmission.setServerErrors({ name: { type: 'taken' }, nickname: { type: 'blocked' } });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['nickname']);\n\t\t\tstore.setValue('nickname', 'other');\n\t\t\texpect(errorsOf(store)).toEqual({});\n\n\t\t\tconst formWide = await passedSubmission(store);\n\t\t\tstore.setValue('slug', 'changed');\n\t\t\tformWide.setServerErrors({ [FORM_ROOT]: { type: 'invalid_credentials' } });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'an error for a submitted row lands on that row wherever it is now, and is dropped when the row is gone',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst submission = await passedSubmission(store);\n\t\t\tstore.fieldArray('contacts').swap(0, 1);\n\t\t\tsubmission.setServerErrors({\n\t\t\t\t'contacts.0.email': { type: 'bounced' },\n\t\t\t\t'contacts.2.email': { type: 'blocked' },\n\t\t\t});\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['contacts.1.email', 'contacts.2.email']);\n\t\t\tstore.fieldArray('contacts').remove(2);\n\t\t\tconst again = await passedSubmission(store);\n\t\t\tstore.fieldArray('contacts').remove(0);\n\t\t\tagain.setServerErrors({ 'contacts.0.email': { type: 'bounced' } });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'a cross-field error is dropped when a value its rules read changed, and cleared when one changes after it was applied',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(passwordForm());\n\t\t\tconst stale = await passedSubmission(store);\n\t\t\tstore.setValue('password', 'b');\n\t\t\tstale.setServerErrors({ confirm: { type: 'mismatch' } });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\n\t\t\tstore.setValue('password', 'a');\n\t\t\tconst fresh = await passedSubmission(store);\n\t\t\tfresh.setServerErrors({ confirm: { type: 'mismatch' } });\n\t\t\texpect(errorsOf(store).confirm?.type).toBe('mismatch');\n\t\t\tstore.setValue('password', 'b');\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'an answer to a submission from before a reset, or to a superseded one, is ignored',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst beforeReset = await passedSubmission(store);\n\t\t\tstore.reset();\n\t\t\tbeforeReset.setServerErrors({ name: { type: 'taken' } });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\n\t\t\tconst first = await passedSubmission(store);\n\t\t\tconst second = await passedSubmission(store);\n\t\t\tfirst.setServerErrors({ name: { type: 'taken' } });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tsecond.setServerErrors({ name: { type: 'taken' } });\n\t\t\texpect(errorsOf(store).name?.type).toBe('taken');\n\t\t\texpect(second.values).toEqual(store.getSnapshot().values);\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'a path takes one issue or several, each with a code, params and an optional message',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst submission = await passedSubmission(store);\n\t\t\tsubmission.setServerErrors({\n\t\t\t\tname: [\n\t\t\t\t\t{ type: 'taken', message: 'Already registered' },\n\t\t\t\t\t{ type: 'blocked_domain', params: { domain: 'example.com' } },\n\t\t\t\t],\n\t\t\t\tnickname: [],\n\t\t\t});\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['name']);\n\t\t\texpect(errorsOf(store).name.all).toEqual([\n\t\t\t\t{ type: 'taken', source: 'server', message: 'Already registered' },\n\t\t\t\t{ type: 'blocked_domain', source: 'server', params: { domain: 'example.com' } },\n\t\t\t]);\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a fact describes the value it came with: a later write makes it stale, and a programmatic write never reuses it',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tstore.setValue('nickname', 'bad');\n\t\t\tstore.reportNative({ nickname: { type: 'typeMismatch' } });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).nickname?.source).toBe('native'));\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\tstore.setValue('nickname', 'good');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).nickname).toBeUndefined());\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\tstore.setValue('nickname', 'bad');\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store).nickname).toBeUndefined();\n\t\t\texpect(await store.validate(['nickname'])).toEqual({ outcome: 'passed' });\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'reporting the fact already held, or writing the value already held, changes nothing',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tstore.setValue('nickname', 'nick');\n\t\t\tstore.reportNative({ nickname: { type: 'badInput' } });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).nickname?.source).toBe('native'));\n\t\t\tawait vi.waitFor(() => expect(isValidating(store)).toBe(false));\n\t\t\tawait settle();\n\t\t\tconst watch = watchValidation(store);\n\t\t\tconst before = store.getSnapshot();\n\t\t\tstore.reportNative({ nickname: { type: 'badInput' } });\n\t\t\tstore.setValue('nickname', 'nick');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'reportNative binds facts to the values held now, validates only paths already checked, and is no user change',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tstore.reportNative({ nickname: { type: 'valueMissing' } });\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t\texpect(store.getSnapshot().touched).toEqual({});\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\n\t\t\texpect(await store.validate(['name'])).toEqual({ outcome: 'passed' });\n\t\t\tstore.reportNative({ name: { type: 'typeMismatch', params: { type: 'email' } }, nickname: null });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.type).toBe('typeMismatch'));\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\tstore.reportNative({ name: null });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name).toBeUndefined());\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a reset form that hears from its controls again shows no error, and a path the container does not hold is ignored',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tstore.setValue('nickname', 'x');\n\t\t\tstore.reportNative({ nickname: { type: 'typeMismatch' } });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).nickname?.source).toBe('native'));\n\t\t\tstore.reset();\n\t\t\tstore.reportNative({\n\t\t\t\tnickname: { type: 'valueMissing' },\n\t\t\t\t'contacts.9.email': { type: 'valueMissing' },\n\t\t\t\t'nothing.here': { type: 'valueMissing' },\n\t\t\t});\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t\tstore.fieldArray('contacts').remove(2);\n\t\t\texpect(() => store.reportNative({ 'contacts.2.email': { type: 'valueMissing' } })).not.toThrow();\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a fact moves with its row, and a removed row never returns as a native error',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.blur('contacts.1.label');\n\t\t\tstore.reportNative({ 'contacts.1.label': { type: 'typeMismatch' } });\n\t\t\tstore.fieldArray('contacts').swap(1, 2);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['contacts.2.label']);\n\t\t\tstore.fieldArray('contacts').remove(2);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a fact stays held until its control withdraws it: every held fact counts for validate and checkValidity',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.reportNative({ name: { type: 'valueMissing' }, nickname: { type: 'valueMissing' } });\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\tstore.reportNative({ nickname: null });\n\t\t\texpect(await store.checkValidity()).toBe(false);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['name']);\n\t\t\tstore.reportNative({ name: null });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'one call reports several controls in one commit, and ignores the rows that do not exist',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst listener = vi.fn();\n\t\t\tstore.subscribe(listener);\n\t\t\tstore.reportNative({\n\t\t\t\tname: { type: 'valueMissing' },\n\t\t\t\tnickname: { type: 'valueMissing' },\n\t\t\t\t'contacts.9.email': { type: 'valueMissing' },\n\t\t\t});\n\t\t\texpect(listener).not.toHaveBeenCalled();\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['name', 'nickname']);\n\t\t\tstore.reportNative({ name: null, nickname: null });\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store)).toEqual({}));\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'facts for rows that do not exist are ignored, and facts and params are copied so a caller cannot change a snapshot',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tstore.fieldArray('contacts').remove([0, 1, 2]);\n\t\t\texpect(() => store.blur('contacts.0.label')).toThrow(/names row/);\n\t\t\tstore.setValue('contacts', null);\n\t\t\tstore.reportNative({\n\t\t\t\t'contacts.0.label': { type: 'valueMissing' },\n\t\t\t\t'contacts.1.label': { type: 'valueMissing' },\n\t\t\t});\n\t\t\tawait store.validate();\n\t\t\texpect(Object.keys(errorsOf(store)).filter((path) => path.endsWith('.label'))).toEqual([]);\n\t\t\tstore.setValue('contacts', []);\n\n\t\t\tconst allowed = ['first'];\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tanswer.setServerErrors({ name: { type: 'invalid', params: { allowed } } });\n\t\t\tconst fact = { type: 'rangeUnderflow', params: { list: ['a'] } };\n\t\t\tstore.reportNative({ nickname: fact });\n\t\t\tawait store.validate(['nickname']);\n\t\t\tallowed.push('second');\n\t\t\tfact.params.list.push('b');\n\t\t\texpect(errorsOf(store).name.params).toEqual({ allowed: ['first'] });\n\t\t\texpect(errorsOf(store).nickname.params).toEqual({ list: ['a'] });\n\t\t\texpect(Object.isFrozen((errorsOf(store).name.params as { allowed: string[] }).allowed)).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'pending per field',\n\t\tname: 'a branch write that removes rows takes their pending marks with them',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture();\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('two');\n\t\t\tconst run = store.validate(['invites.1.code']);\n\t\t\tawait vi.waitFor(() => expect(gate.pending('two')).toBe(1));\n\t\t\texpect(store.getSnapshot().validating).toEqual({ 'invites.1.code': true });\n\t\t\tstore.setValue('invites', []);\n\t\t\texpect(store.getSnapshot().validating).toEqual({});\n\t\t\tgate.settle('two', true);\n\t\t\texpect(await run).toEqual({ outcome: 'overtaken' });\n\t\t\texpect(store.getSnapshot().validating).toEqual({});\n\t\t\texpect(isValidating(store)).toBe(false);\n\t\t},\n\t},\n\t{\n\t\trule: 'participation',\n\t\tname: 'a field a constraint hides takes no part: it does not block, count or show, however it was recorded',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(businessForm());\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\n\t\t\tstore.setValue('kind', 'business');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(errorsOf(store).company).toMatchObject({ type: 'required', ruleId: 'company-required' });\n\t\t\tstore.setValue('kind', 'person');\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\n\t\t\tawait serverAnswer(store, { company: { type: 'taken' } });\n\t\t\tstore.blur('company');\n\t\t\tstore.reportNative({ company: { type: 'valueMissing' } });\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'participation',\n\t\tname: 'a step its constraints hide is skipped: its fields take no part, its values are kept and the submitted values leave them out',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(stepsForm({ hasCompany: false, wantsInvoice: 'no', company: '', vat: '' }));\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\tconst submitted = await store.submit();\n\t\t\texpect(submitted.outcome).toBe('passed');\n\t\t\tif (submitted.outcome === 'passed') expect(submitted.values).toEqual({ hasCompany: false });\n\t\t\texpect(store.getSnapshot().values).toMatchObject({ wantsInvoice: 'no', company: '' });\n\n\t\t\tstore.setValue('hasCompany', true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['company']);\n\t\t},\n\t},\n\t{\n\t\trule: 'participation',\n\t\tname: 'a value that takes no part is absent for the constraints after it, in order: a skipped step cannot keep a later field shown',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(stepsForm({ hasCompany: false, wantsInvoice: 'yes', company: '', vat: '' }));\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\tstore.setValue('hasCompany', true);\n\t\t\tstore.setValue('company', 'Acme');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['vat']);\n\t\t\tstore.setValue('hasCompany', false);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t},\n\t},\n\t{\n\t\trule: 'participation',\n\t\tname: 'a path that takes part again is re-validated when it was checked before, and waits for its timing otherwise',\n\t\tasync run(createStore) {\n\t\t\tconst checked = createStore(businessForm({ kind: 'business', company: '' }));\n\t\t\texpect(await checked.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tchecked.setValue('kind', 'person');\n\t\t\texpect(errorsOf(checked)).toEqual({});\n\t\t\tchecked.setValue('kind', 'business');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(checked).company?.type).toBe('required'));\n\n\t\t\tconst untouched = createStore(businessForm());\n\t\t\tuntouched.setValue('kind', 'business');\n\t\t\tawait settle();\n\t\t\texpect(errorsOf(untouched)).toEqual({});\n\t\t\texpect(untouched.getSnapshot().isValid).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'participation',\n\t\tname: 'disabled fields, authored or by a constraint, and everything inside an excluded container, are excluded; an inactive step is not',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tcustom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{ $type: 'input', name: 'locked', disabled: true, rules: [{ $type: 'required' }] },\n\t\t\t\t\t\t{ $type: 'input', name: 'mode' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'frozen',\n\t\t\t\t\t\t\trules: [{ $type: 'required' }],\n\t\t\t\t\t\t\tconstraints: [{ field: 'mode', $type: 'enable', operator: 'equals', value: 'edit' }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'fieldset',\n\t\t\t\t\t\t\tname: 'extra',\n\t\t\t\t\t\t\tconstraints: [{ field: 'mode', $type: 'show', operator: 'equals', value: 'edit' }],\n\t\t\t\t\t\t\telements: [{ $type: 'input', name: 'note', rules: [{ $type: 'required' }] }],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $type: 'input', name: 'later', rules: [{ $type: 'required' }] },\n\t\t\t\t\t],\n\t\t\t\t\t{ locked: '', mode: 'view', frozen: '', extra: { note: '' }, later: '' },\n\t\t\t\t),\n\t\t\t);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual(['later']);\n\t\t\tstore.setValue('later', 'x');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\tstore.setValue('mode', 'edit');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual(['extra.note', 'frozen']);\n\t\t},\n\t},\n\t{\n\t\trule: 'issue identity',\n\t\tname: 'every rule reports its type, id and params, two rules of one type stay apart, and a rule reports once',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tcustom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'tag',\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{ $type: 'required', id: 'tag-required' },\n\t\t\t\t\t\t\t\t{ $type: 'pattern', id: 'tag-letters', value: '^[a-z]+$', message: 'Letters only' },\n\t\t\t\t\t\t\t\t{ $type: 'pattern', id: 'tag-short', value: '^.{0,3}$', message: 'Three at most' },\n\t\t\t\t\t\t\t\t{ $type: 'minLength', value: 8 },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{ tag: 'AB1234' },\n\t\t\t\t),\n\t\t\t);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tconst { all } = errorsOf(store).tag;\n\t\t\texpect(all.map(({ type, ruleId }) => [type, ruleId])).toEqual([\n\t\t\t\t['pattern', 'tag-letters'],\n\t\t\t\t['pattern', 'tag-short'],\n\t\t\t\t['minLength', undefined],\n\t\t\t]);\n\t\t\texpect(all[0]).toEqual({\n\t\t\t\ttype: 'pattern',\n\t\t\t\tsource: 'validation',\n\t\t\t\truleId: 'tag-letters',\n\t\t\t\tparams: { pattern: '^[a-z]+$' },\n\t\t\t\tmessage: 'Letters only',\n\t\t\t});\n\t\t\texpect(all[2].params).toEqual({ minLength: 8 });\n\t\t\texpect(all[2].message).toBeUndefined();\n\t\t\texpect(Object.isFrozen(all[2].params)).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'issue identity',\n\t\tname: 'rules are listed in authored order whatever order their checks finish in, and unchanged issues keep their objects',\n\t\tasync run(createStore) {\n\t\t\tconst { options, gate } = fixture({\n\t\t\t\telements: [\n\t\t\t\t\telement({\n\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\tname: 'slug',\n\t\t\t\t\t\trules: [{ $type: 'gate' }, { $type: 'minLength', value: 5, message: 'Too short' }],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tdefaults: { slug: 'ab' },\n\t\t\t});\n\t\t\tconst store = createStore(options);\n\t\t\tgate.hold('ab');\n\t\t\tconst run = store.validate();\n\t\t\tawait vi.waitFor(() => expect(gate.pending('ab')).toBe(1));\n\t\t\tgate.settle('ab', false);\n\t\t\texpect(await run).toEqual({ outcome: 'invalid' });\n\t\t\tconst first = errorsOf(store).slug;\n\t\t\texpect(first.all.map(({ type }) => type)).toEqual(['gate', 'minLength']);\n\t\t\tawait store.validate();\n\t\t\texpect(errorsOf(store).slug).toBe(first);\n\t\t},\n\t},\n\t{\n\t\trule: 'validator failures',\n\t\tname: 'a rule that throws is no field error: validate and checkValidity reject naming it, an automatic check logs it, the others still report',\n\t\tasync run(createStore) {\n\t\t\tconst options = custom(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\tname: 'secret',\n\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t{ $type: 'required', id: 'secret-required' },\n\t\t\t\t\t\t\t{ $type: 'boom', id: 'secret-boom' },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ secret: '' },\n\t\t\t\t{ validationMode: 'onChange' },\n\t\t\t);\n\t\t\tconst store = createStore(options);\n\t\t\tconst rejected: unknown = await store.validate().then(\n\t\t\t\t() => undefined,\n\t\t\t\t(error: unknown) => error,\n\t\t\t);\n\t\t\texpect(rejected).toMatchObject({\n\t\t\t\tname: 'FormValidationFailure',\n\t\t\t\tpath: 'secret',\n\t\t\t\truleType: 'boom',\n\t\t\t\truleId: 'secret-boom',\n\t\t\t});\n\t\t\tconst check: unknown = await store.checkValidity().then(\n\t\t\t\t() => undefined,\n\t\t\t\t(error: unknown) => error,\n\t\t\t);\n\t\t\texpect(check).toMatchObject({ path: 'secret', ruleType: 'boom' });\n\t\t\texpect(isValidating(store)).toBe(false);\n\n\t\t\tconst logged = vi.spyOn(logger, 'error').mockReturnThis();\n\t\t\ttry {\n\t\t\t\tconst automatic = createStore(options);\n\t\t\t\tautomatic.setValue('secret', 'x');\n\t\t\t\tautomatic.setValue('secret', '');\n\t\t\t\tawait vi.waitFor(() => expect(errorsOf(automatic).secret).toBeDefined());\n\t\t\t\texpect(logged).toHaveBeenCalledWith(expect.stringContaining(\"'secret'\"), {\n\t\t\t\t\terror: expect.objectContaining({ path: 'secret', ruleType: 'boom', ruleId: 'secret-boom' }),\n\t\t\t\t});\n\t\t\t\texpect(errorsOf(automatic).secret?.all).toEqual([\n\t\t\t\t\t{ type: 'required', source: 'validation', ruleId: 'secret-required' },\n\t\t\t\t]);\n\t\t\t\texpect(automatic.getSnapshot().isValid).toBe(false);\n\t\t\t} finally {\n\t\t\t\tlogged.mockRestore();\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\trule: 'warnings',\n\t\tname: 'a rule with severity warning reports advice that never blocks, with the shape and timing of an error',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tcustom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'password',\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$type: 'minLength',\n\t\t\t\t\t\t\t\t\tvalue: 8,\n\t\t\t\t\t\t\t\t\tseverity: 'warning',\n\t\t\t\t\t\t\t\t\tid: 'password-strength',\n\t\t\t\t\t\t\t\t\tmessage: 'Weak',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{ $type: 'minLength', value: 3, message: 'Too short' },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{ password: 'abcd' },\n\t\t\t\t\t{ validationMode: 'onChange' },\n\t\t\t\t),\n\t\t\t);\n\t\t\tstore.setValue('password', 'abcde');\n\t\t\tawait vi.waitFor(() => expect(store.getSnapshot().warnings.password).toBeDefined());\n\t\t\texpect(store.getSnapshot().warnings.password).toEqual({\n\t\t\t\ttype: 'minLength',\n\t\t\t\tsource: 'validation',\n\t\t\t\truleId: 'password-strength',\n\t\t\t\tparams: { minLength: 8 },\n\t\t\t\tmessage: 'Weak',\n\t\t\t\tall: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'minLength',\n\t\t\t\t\t\tsource: 'validation',\n\t\t\t\t\t\truleId: 'password-strength',\n\t\t\t\t\t\tparams: { minLength: 8 },\n\t\t\t\t\t\tmessage: 'Weak',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\tconst field = fieldState(store, 'password');\n\t\t\texpect(field).toMatchObject({ invalid: false, error: undefined });\n\t\t\texpect(fieldState(store, 'password').warning).toBe(field.warning);\n\t\t\tstore.setValue('password', 'abcdefgh');\n\t\t\tawait vi.waitFor(() => expect(store.getSnapshot().warnings).toEqual({}));\n\t\t\tstore.setValue('password', 'a');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).password?.message).toBe('Too short'));\n\t\t\texpect(store.getSnapshot().warnings.password?.message).toBe('Weak');\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t},\n\t},\n\t{\n\t\trule: 'warnings',\n\t\tname: 'warnings of a path that takes no part are not shown',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tcustom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{ $type: 'input', name: 'kind' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'company',\n\t\t\t\t\t\t\trules: [{ $type: 'required', severity: 'warning' }],\n\t\t\t\t\t\t\tconstraints: [{ field: 'kind', $type: 'show', operator: 'equals', value: 'business' }],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{ kind: 'business', company: '' },\n\t\t\t\t),\n\t\t\t);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(store.getSnapshot().warnings.company?.type).toBe('required');\n\t\t\tstore.setValue('kind', 'person');\n\t\t\texpect(store.getSnapshot().warnings).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'issue identity',\n\t\tname: 'an async rule reports the endpoint text on its own channel, never library text, and an outage is a failure to run and is not cached',\n\t\tasync run(createStore) {\n\t\t\tlet reply: () => Response = () => new Response(JSON.stringify({ valid: false }));\n\t\t\tconst fetchSpy = vi.fn(async () => reply());\n\t\t\tvi.stubGlobal('fetch', fetchSpy);\n\t\t\ttry {\n\t\t\t\tconst options = custom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'handle',\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$type: 'async',\n\t\t\t\t\t\t\t\t\tid: 'handle-free',\n\t\t\t\t\t\t\t\t\turl: '/check',\n\t\t\t\t\t\t\t\t\theaders: { Authorization: 'secret' },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{ handle: 'ada' },\n\t\t\t\t);\n\t\t\t\tconst store = createStore(options);\n\t\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\t\texpect(errorsOf(store).handle.all).toEqual([\n\t\t\t\t\t{ type: 'async', source: 'validation', ruleId: 'handle-free' },\n\t\t\t\t]);\n\n\t\t\t\treply = () => new Response(JSON.stringify({ valid: false, message: 'Handle is taken' }));\n\t\t\t\tstore.setValue('handle', 'ada2');\n\t\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\t\texpect(errorsOf(store).handle.message).toBe('Handle is taken');\n\t\t\t\texpect(JSON.stringify(store.getSnapshot())).not.toMatch(/Invalid input|secret|\\/check/);\n\n\t\t\t\treply = () => new Response('no', { status: 503 });\n\t\t\t\tstore.setValue('handle', 'ada3');\n\t\t\t\tconst down: unknown = await store.validate().then(\n\t\t\t\t\t() => undefined,\n\t\t\t\t\t(error: unknown) => error,\n\t\t\t\t);\n\t\t\t\texpect(down).toMatchObject({ name: 'FormValidationFailure', path: 'handle', ruleType: 'async' });\n\t\t\t\texpect((down as { cause: Error }).cause.name).toBe('ValidationUnavailable');\n\t\t\t\tconst calls = fetchSpy.mock.calls.length;\n\t\t\t\treply = () => new Response(JSON.stringify({ valid: true }));\n\t\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\t\texpect(fetchSpy.mock.calls.length).toBe(calls + 1);\n\n\t\t\t\tfetchSpy.mockImplementation(async () => {\n\t\t\t\t\tthrow new Error('offline');\n\t\t\t\t});\n\t\t\t\tconst offline: unknown = await createStore({ ...options, defaults: { handle: 'zed' } })\n\t\t\t\t\t.validate()\n\t\t\t\t\t.then(\n\t\t\t\t\t\t() => undefined,\n\t\t\t\t\t\t(error: unknown) => error,\n\t\t\t\t\t);\n\t\t\t\texpect((offline as { cause: Error }).cause.name).toBe('ValidationUnavailable');\n\t\t\t} finally {\n\t\t\t\tvi.unstubAllGlobals();\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'a submission ends passed, invalid, or overtaken',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\texpect((await store.submit()).outcome).toBe('passed');\n\n\t\t\tstore.setValue('name', '');\n\t\t\texpect(await store.submit()).toEqual({ outcome: 'invalid' });\n\n\t\t\tconst edit = fixture();\n\t\t\tconst edited = createStore(edit.options);\n\t\t\tedit.gate.settle('taken', false);\n\t\t\tedit.gate.hold('a', 'b');\n\t\t\tedited.setValue('slug', 'a');\n\t\t\tconst outrun = edited.submit();\n\t\t\tawait vi.waitFor(() => expect(edit.gate.pending('a')).toBe(1));\n\t\t\tedited.setValue('slug', 'b');\n\t\t\tedit.gate.settle('a', true);\n\t\t\tawait vi.waitFor(() => expect(edit.gate.pending('b')).toBe(1));\n\t\t\tedited.setValue('slug', 'taken');\n\t\t\tedit.gate.settle('b', true);\n\t\t\texpect(await outrun).toEqual({ outcome: 'overtaken' });\n\n\t\t\tconst hold = fixture();\n\t\t\tconst reset = createStore(hold.options);\n\t\t\thold.gate.hold('free');\n\t\t\tconst cleared = reset.submit();\n\t\t\tawait vi.waitFor(() => expect(hold.gate.pending('free')).toBe(1));\n\t\t\treset.reset();\n\t\t\thold.gate.settle('free', true);\n\t\t\texpect(await cleared).toEqual({ outcome: 'overtaken' });\n\t\t},\n\t},\n\t{\n\t\trule: 'paths of writes',\n\t\tname: 'a reserved path rejects the whole reportNative call before any write, and every reserved segment is named',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\texpect(() => store.reportNative({ name: { type: 'valueMissing' }, __x: { type: 'valueMissing' } })).toThrow(\n\t\t\t\t/reserved/,\n\t\t\t);\n\t\t\texpect(() => store.reportNative({ 'a.constructor': null })).toThrow(/'constructor'/);\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\texpect(() => store.setValue('prototype.x', 1)).toThrow(/__.*constructor.*prototype/s);\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a fact reported while the check of a write runs is not lost: the rule error and the native one both appear',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onChange' }).options);\n\t\t\tstore.setValue('nickname', '');\n\t\t\texpect(store.getSnapshot().validating.nickname).toBe(true);\n\t\t\tstore.reportNative({ nickname: { type: 'valueMissing' } });\n\t\t\tawait vi.waitFor(() =>\n\t\t\t\texpect(errorsOf(store).nickname?.all.map(({ source }) => source)).toEqual(['validation', 'native']),\n\t\t\t);\n\t\t\texpect(isValidating(store)).toBe(false);\n\n\t\t\tconst touched = createStore(fixture({ validationMode: 'onTouched' }).options);\n\t\t\ttouched.blur('name');\n\t\t\ttouched.setValue('name', '');\n\t\t\ttouched.reportNative({ name: { type: 'valueMissing' } });\n\t\t\tawait vi.waitFor(() =>\n\t\t\t\texpect(errorsOf(touched).name?.all.map(({ source }) => source)).toEqual(['validation', 'native']),\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'a later submission overtakes the earlier one, which has no verdict',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst first = store.submit();\n\t\t\tconst second = store.submit();\n\t\t\texpect(await first).toEqual({ outcome: 'overtaken' });\n\t\t\texpect((await second).outcome).toBe('passed');\n\t\t},\n\t},\n\t{\n\t\trule: 'validator failures',\n\t\tname: 'a failure says why a rule did not run: the service was unavailable, or the rule threw',\n\t\tasync run(createStore) {\n\t\t\tvi.stubGlobal(\n\t\t\t\t'fetch',\n\t\t\t\tvi.fn(async () => new Response('no', { status: 500 })),\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst unavailable = createStore(\n\t\t\t\t\tcustom(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\t\tname: 'handle',\n\t\t\t\t\t\t\t\trules: [{ $type: 'async', url: '/check', disableCache: true }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t{ handle: 'a' },\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst down: unknown = await unavailable.validate().then(\n\t\t\t\t\t() => undefined,\n\t\t\t\t\t(error: unknown) => error,\n\t\t\t\t);\n\t\t\t\texpect(down).toMatchObject({ path: 'handle', ruleType: 'async', reason: 'unavailable' });\n\n\t\t\t\tconst threw = createStore(\n\t\t\t\t\tcustom([{ $type: 'input', name: 'secret', rules: [{ $type: 'boom' }] }], { secret: '' }),\n\t\t\t\t);\n\t\t\t\tconst exploded: unknown = await threw.validate().then(\n\t\t\t\t\t() => undefined,\n\t\t\t\t\t(error: unknown) => error,\n\t\t\t\t);\n\t\t\t\texpect(exploded).toMatchObject({ path: 'secret', ruleType: 'boom', reason: 'error' });\n\t\t\t} finally {\n\t\t\t\tvi.unstubAllGlobals();\n\t\t\t}\n\t\t},\n\t},\n\t{\n\t\trule: 'submission-bound validation',\n\t\tname: 'the values of a submission leave out the paths that take no part, and carry the payload, which is never rendered or validated',\n\t\tasync run(createStore) {\n\t\t\tconst options = custom(\n\t\t\t\t[\n\t\t\t\t\t{ $type: 'input', name: 'kind' },\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\tname: 'company',\n\t\t\t\t\t\trules: [{ $type: 'required' }],\n\t\t\t\t\t\tconstraints: [{ field: 'kind', $type: 'show', operator: 'equals', value: 'business' }],\n\t\t\t\t\t},\n\t\t\t\t\t{ $type: 'input', name: 'locked', disabled: true },\n\t\t\t\t\t{\n\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\tname: 'rows',\n\t\t\t\t\t\telements: [\n\t\t\t\t\t\t\t{ $type: 'input', name: 'role' },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\t\tname: 'fax',\n\t\t\t\t\t\t\t\tconstraints: [{ field: 'role', $type: 'hide', operator: 'equals', value: 'office' }],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tkind: 'person',\n\t\t\t\t\tcompany: 'Acme',\n\t\t\t\t\tlocked: 'x',\n\t\t\t\t\trows: [\n\t\t\t\t\t\t{ role: 'office', fax: '1' },\n\t\t\t\t\t\t{ role: 'home', fax: '2' },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{ payload: { tenant: 't1', context: { source: 'email' } } },\n\t\t\t);\n\t\t\tconst store = createStore(options);\n\t\t\tconst submitted = await passedSubmission(store);\n\t\t\texpect(submitted.values).toEqual({\n\t\t\t\tkind: 'person',\n\t\t\t\trows: [{ role: 'office' }, { role: 'home', fax: '2' }],\n\t\t\t\ttenant: 't1',\n\t\t\t\tcontext: { source: 'email' },\n\t\t\t});\n\t\t\texpect(Object.isFrozen(submitted.values)).toBe(true);\n\t\t\texpect(store.getSnapshot().values).not.toHaveProperty('tenant');\n\t\t\texpect(store.getSnapshot().dirty).toEqual({});\n\t\t\tstore.setValue('kind', 'business');\n\t\t\tconst next = await passedSubmission(store);\n\t\t\texpect(next.values).toMatchObject({ company: 'Acme', tenant: 't1' });\n\t\t\texpect(next.values).not.toHaveProperty('locked');\n\t\t},\n\t},\n\t{\n\t\trule: 'touched and dirty',\n\t\tname: 'blur marks the path touched in one notification and validates by mode; written first, the value ends as one command would leave it',\n\t\tasync run(createStore) {\n\t\t\tconst quiet = createStore(fixture().options);\n\t\t\tconst listener = vi.fn();\n\t\t\tquiet.subscribe(listener);\n\t\t\tquiet.blur('name');\n\t\t\texpect(listener).toHaveBeenCalledTimes(1);\n\t\t\texpect(quiet.getSnapshot().touched).toEqual({ name: true });\n\t\t\texpect(quiet.getValue('name')).toBe('Ada');\n\t\t\texpect(quiet.getSnapshot().dirty).toEqual({});\n\n\t\t\tconst store = createStore(fixture({ validationMode: 'onBlur' }).options);\n\t\t\tstore.setValue('name', '');\n\t\t\tstore.blur('name');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.type).toBe('required'));\n\t\t\texpect(store.getSnapshot().dirty.name).toBe(true);\n\t\t\texpect(store.getSnapshot().touched.name).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'paths of writes',\n\t\tname: 'setValue and blur refuse a row the array does not have, and a reserved segment, instead of leaving holes',\n\t\trun(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\texpect(() => store.setValue('contacts.3.email', 'x')).toThrow(\n\t\t\t\t/'contacts.3.email' names row '3' of 'contacts'/,\n\t\t\t);\n\t\t\texpect(() => store.setValue('contacts.-1.email', 'x')).toThrow(/names row '-1'/);\n\t\t\texpect(() => store.blur('contacts.5.email')).toThrow(/names row '5'/);\n\t\t\texpect(() => store.setValue('name.3.x', 'x')).toThrow(/names row '3' of 'name'/);\n\t\t\texpect(() => store.setValue('name.03.x', 'x')).toThrow(/names row '03' of 'name'/);\n\t\t\texpect(() => store.setValue('__secret', 1)).toThrow(/reserved segment/);\n\t\t\texpect(store.getSnapshot()).toBe(before);\n\t\t\tstore.fieldArray('contacts').append({ email: 'd@example.com' });\n\t\t\tstore.setValue('contacts.3.email', 'e@example.com');\n\t\t\texpect(store.getSnapshot().rowIds.contacts).toHaveLength(4);\n\t\t\texpect(store.getSnapshot().rowIds.contacts.every((id) => typeof id === 'string')).toBe(true);\n\t\t},\n\t},\n\t{\n\t\trule: 'validation mode timing',\n\t\tname: 'onTouched validates on the first blur and on every change after it',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture({ validationMode: 'onTouched', defaults: { name: '' } }).options);\n\t\t\tconst watch = watchValidation(store);\n\t\t\tstore.setValue('name', '');\n\t\t\tstore.setValue('name', 'x');\n\t\t\tstore.setValue('name', '');\n\t\t\tawait settle();\n\t\t\texpect(watch.started).toBe(false);\n\t\t\tstore.blur('name');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.type).toBe('required'));\n\t\t\tstore.setValue('name', 'Ada');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name).toBeUndefined());\n\t\t\tstore.setValue('name', '');\n\t\t\tawait vi.waitFor(() => expect(errorsOf(store).name?.type).toBe('required'));\n\t\t},\n\t},\n\t{\n\t\trule: 'issue identity',\n\t\tname: 'a registration declares the params of its rule: native names, and nothing of the configuration of async or relate rules',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(\n\t\t\t\tcustom(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'tag',\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{ $type: 'maxLength', value: 2 },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$type: 'relate',\n\t\t\t\t\t\t\t\t\tfields: ['other'],\n\t\t\t\t\t\t\t\t\tassert: 'allEqual',\n\t\t\t\t\t\t\t\t\tincludeSelf: true,\n\t\t\t\t\t\t\t\t\tid: 'same',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $type: 'input', name: 'other' },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'input',\n\t\t\t\t\t\t\tname: 'count',\n\t\t\t\t\t\t\trules: [\n\t\t\t\t\t\t\t\t{ $type: 'min', value: 5 },\n\t\t\t\t\t\t\t\t{ $type: 'max', value: 1 },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$type: 'arrayElements',\n\t\t\t\t\t\t\tname: 'rows',\n\t\t\t\t\t\t\trules: [{ $type: 'minItems', value: 2 }],\n\t\t\t\t\t\t\telements: [{ $type: 'input', name: 'x' }],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{ tag: 'abc', other: 'z', count: 3, rows: [{ x: '' }] },\n\t\t\t\t),\n\t\t\t);\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'invalid' });\n\t\t\tconst errors = errorsOf(store);\n\t\t\texpect(errors.tag.all).toEqual([\n\t\t\t\t{ type: 'maxLength', source: 'validation', params: { maxLength: 2 } },\n\t\t\t\t{ type: 'relate', source: 'validation', ruleId: 'same', params: { assert: 'allEqual' } },\n\t\t\t]);\n\t\t\texpect(errors.count.all.map(({ params }) => params)).toEqual([{ min: 5 }, { max: 1 }]);\n\t\t\texpect(errors.rows.params).toEqual({ minItems: 2 });\n\t\t\texpect(JSON.stringify(errors)).not.toMatch(/Too (small|big)|Invalid input/);\n\t\t},\n\t},\n\t{\n\t\trule: 'native facts',\n\t\tname: 'a fact for a path no field declares is ignored: it does not block validate, checkValidity or a submission',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst before = store.getSnapshot();\n\t\t\tstore.reportNative({\n\t\t\t\tghost: { type: 'valueMissing' },\n\t\t\t\t'name.x': { type: 'valueMissing' },\n\t\t\t\t'address.nowhere': { type: 'valueMissing' },\n\t\t\t\t'contacts.0.nothing': { type: 'valueMissing' },\n\t\t\t});\n\t\t\texpect(await store.validate()).toEqual({ outcome: 'passed' });\n\t\t\texpect(await store.checkValidity()).toBe(true);\n\t\t\texpect(errorsOf(store)).toEqual({});\n\t\t\texpect(store.getSnapshot().isValid).toBe(true);\n\t\t\texpect((await store.submit()).outcome).toBe('passed');\n\t\t\texpect(before.errors).toEqual({});\n\t\t},\n\t},\n\t{\n\t\trule: 'server errors tied to a submission',\n\t\tname: 'an error for a path no field declares shows at the form, with its type, params and message',\n\t\tasync run(createStore) {\n\t\t\tconst store = createStore(fixture().options);\n\t\t\tconst answer = await passedSubmission(store);\n\t\t\tanswer.setServerErrors({\n\t\t\t\tghost: { type: 'unknown_field', params: { field: 'ghost' }, message: 'No such field' },\n\t\t\t\t'address.nowhere': [{ type: 'also_unknown' }],\n\t\t\t\t[FORM_ROOT]: { message: 'Try later' },\n\t\t\t\tname: { type: 'taken' },\n\t\t\t\t'contacts.1': { type: 'row_error' },\n\t\t\t});\n\t\t\texpect(Object.keys(errorsOf(store)).toSorted()).toEqual([FORM_ROOT, 'contacts.1', 'name']);\n\t\t\texpect(errorsOf(store)[FORM_ROOT].all).toEqual([\n\t\t\t\t{ type: 'server', source: 'server', message: 'Try later' },\n\t\t\t\t{\n\t\t\t\t\ttype: 'unknown_field',\n\t\t\t\t\tsource: 'server',\n\t\t\t\t\tparams: { field: 'ghost' },\n\t\t\t\t\tmessage: 'No such field',\n\t\t\t\t},\n\t\t\t\t{ type: 'also_unknown', source: 'server' },\n\t\t\t]);\n\n\t\t\tconst alone = await passedSubmission(store);\n\t\t\talone.setServerErrors({ ghost: { type: 'unknown_field' } });\n\t\t\texpect(Object.keys(errorsOf(store))).toEqual([FORM_ROOT]);\n\t\t\texpect(errorsOf(store)[FORM_ROOT].type).toBe('unknown_field');\n\t\t},\n\t},\n];\n\n/** Every rule of the contract, for a test that checks a deliberately broken store fails the rule it breaks. */\nexport const formStateContainerCases: readonly FormStateContainerCase[] = cases;\n\n/**\n * Registers the internal form store contract as vitest tests against the store `createStore` builds.\n *\n * @remarks\n * Call it from a test file, like `rendererConformance`. A fresh store is built for each test.\n */\nexport function formStateContainerConformance(createStore: FormStateContainerFactory): void {\n\tdescribe('form state container conformance', () => {\n\t\tfor (const rule of new Set(cases.map((entry) => entry.rule))) {\n\t\t\tdescribe(rule, () => {\n\t\t\t\tfor (const entry of cases.filter((candidate) => candidate.rule === rule)) {\n\t\t\t\t\ttest(entry.name, () => entry.run(createStore));\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,QAAQ,MAAM,UAAU;AAC3C,YAAY,OAAO;AAoCnB,SAAS,aAAa;AACrB,QAAM,UAAU,oBAAI,IAA6C;AACjE,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,UAAU,oBAAI,IAAqB;AACzC,SAAO;AAAA,IACN,MAAM,IAAI,WAA2B,OAAO,QAAQ,CAAC,UAAU,KAAK,IAAI,KAAK,CAAC;AAAA,IAC9E,OAAO,CAAC,UACP,QAAQ,IAAI,OAAO,KAAK,CAAC,IACtB,QAAQ,QAAQ,QAAQ,IAAI,OAAO,KAAK,CAAC,MAAM,IAAI,IACnD,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,IACtB,QAAQ,QA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AI,MAAM,IAAI,CAAC,UAAU,MAAM,IAAI,CAAC,GAAG;AAC7D,eAAS,MAAM,MAAM;AACpB,mBAAW,SAAS,MAAM,OAAO,CAAC,cAAc,UAAU,SAAS,IAAI,GAAG;AACzE,eAAK,MAAM,MAAM,MAAM,MAAM,IAAI,WAAW,CAAC;AAAA,QAC9C;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD,CAAC;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/state-container/types.ts"],
4
- "sourcesContent": ["import type { FieldParticipation, ValidationStep } from '@/engine/value-validation';\nimport type { ValidationRegistry } from '@/schemas/validation/validation-registry';\nimport type { FieldArrayCommands } from './field-array';\n\n/**\n * The internal form state contract: what a form's state container owns, and what it leaves to others.\n *\n * @remarks\n * The container owns the nested value tree, field state (errors, touched, dirty), field-array row ids and\n * the atomic updates that keep them consistent. A path is a plain dotted path with the row index in it\n * (`contacts.1.email`) wherever the API takes one, and {@link FORM_ROOT} names the form itself. It holds\n * no submission state (`isSubmitting`, `submitCount`, a submit guard): the runtime owns those. Focus,\n * native controls and native submit belong to the host, and there is no control registration: a host\n * bridges a control into the container with {@link FormStateContainer.setValue} and\n * {@link FormStateContainer.blur}, reports the control's native validity with\n * {@link FormStateContainer.reportNative}, and submits with {@link FormStateContainer.submit}, whose result\n * carries the way to hand back the server's answer.\n *\n * The container is named for what it holds, not `FormStore`, which is a class of Radiant UI. The contract is\n * public through `@schema-engine/forms/state-container`, with `@schema-engine/forms/csrf` and\n * `@schema-engine/forms/server-errors` beside it. Its conformance suite is `formStateContainerConformance` from\n * `@schema-engine/forms/testing`.\n */\n\n/**\n * The key of an error about the form itself rather than a field, in `snapshot.errors` and in `setServerErrors`.\n *\n * @remarks Path segments that start with `__` are reserved, so no field can have this name.\n */\nexport const FORM_ROOT = '__root__';\n\n/**\n * When a field validates before a check of it has failed: on `change`, on `blur`, on both (`all`), on the\n * first `blur` and on every change after it (`onTouched`, as React Hook Form's mode of that name) or only on\n * an explicit {@link FormStateContainer.validate}.\n */\nexport type FormValidationMode = 'onSubmit' | 'onChange' | 'onBlur' | 'onTouched' | 'all';\n\n/** When a field validates once a {@link FormStateContainer.validate} over it has failed. */\nexport type FormReValidateMode = 'onSubmit' | 'onChange' | 'onBlur';\n\n/** Who reported an issue. */\nexport type FormStateSource = 'server' | 'validation' | 'native';\n\n/**\n * One thing wrong with a path, who said so, and what a translation needs to say it.\n *\n * @remarks\n * `type` names the problem for a program: the rule's type (`'minLength'`), the `ValidityState` flag of a\n * native control (`'typeMismatch'`) or the server's code. `ruleId` is the author's stable name for the\n * rule, so two `pattern` rules stay distinguishable. `params` are the numbers and names the text is\n * built from, serializable (`{ minLength: 8 }` for a rule, `{ minLength: 8 }` for a native control).\n * `message` is only the text the author wrote on the rule, or the server or control sent, for a host with no\n * translation of the issue, and may be absent. Text the schema library would make up is never used.\n */\nexport interface FormStateIssue {\n\treadonly type: string;\n\treadonly source: FormStateSource;\n\treadonly ruleId?: string;\n\treadonly params?: Readonly<Record<string, unknown>>;\n\treadonly message?: string;\n}\n\n/**\n * The error of a path: the issue to show, and every issue the path has.\n *\n * @remarks\n * The fields of the issue are those of `all[0]`, so the error reads like a single issue, and `all` is\n * never empty. `all` lists, in this order, what the server said, then each rule the value fails in\n * authored order (never the order the checks finished in), then what the platform's own control reports.\n * The same error object comes back while none of that changes.\n */\nexport interface FormStateError extends FormStateIssue {\n\treadonly all: readonly FormStateIssue[];\n}\n\n/**\n * Advice about a path: shaped and timed exactly like an error, and never blocking.\n *\n * @remarks\n * It comes from rules declared with `severity: 'warning'`, so its issues have the source `'validation'`.\n * It never affects `isValid`, `validate` or `checkValidity`. A server cannot send warnings yet.\n */\nexport type FormStateWarning = FormStateError;\n\n/**\n * Why a submission as a whole failed, in the shape of an issue, so a host words it with the one formatter.\n *\n * @remarks\n * It is not a {@link FormStateIssue}: a submission failure (the action that threw, the callback that\n * rejected, the service that was down) concerns no field and the snapshot never holds one. `type` names the\n * failure for a program, `params` fill the text, and `message` is only the text the failure itself carried.\n */\nexport interface FormSubmissionIssue {\n\treadonly type: string;\n\treadonly source: 'submission';\n\treadonly params?: Readonly<Record<string, unknown>>;\n\treadonly message?: string;\n}\n\n/**\n * Turns an issue into the text to show, for the field at `field.path`.\n *\n * @remarks\n * The one seam between the engine, which reports what is wrong (`type`, `ruleId`, `params`), and the text\n * of the application's language, which the engine does not own. A binding takes one from its host and\n * calls it for the issue to show (an error or warning is itself an issue) and for each of `all` it lists,\n * falling back to `issue.message` when the host gives none or the formatter returns nothing worth showing.\n * `ruleId` picks a text of one rule, `type` a text of a kind of rule, and `params` fill its numbers. The\n * action context and the bindings use this same issue type, so one formatter serves them all. A\n * {@link FormSubmissionIssue} goes through it too, with the path of the form ({@link FORM_ROOT}).\n */\nexport type FormIssueFormatter = (\n\tissue: FormStateIssue | FormSubmissionIssue,\n\tfield: { readonly path: string },\n) => string;\n\n/**\n * An issue as a caller of `setServerErrors` may give it.\n *\n * @remarks\n * Every part is optional, as a server response may carry only a code or only a message. A missing `type`\n * is kept as `'server'`. An issue with nothing but a type still counts as an error: it blocks\n * {@link FormStateContainer.validate}.\n */\nexport interface FormStateErrorInput {\n\treadonly type?: string;\n\treadonly params?: Readonly<Record<string, unknown>>;\n\treadonly message?: string;\n}\n\n/** What `setServerErrors` takes: one issue or a list of them for each path. */\nexport type FormStateErrorsInput = Readonly<Record<string, FormStateErrorInput | readonly FormStateErrorInput[]>>;\n\n/**\n * What a platform control reports about its value.\n *\n * @remarks\n * `type` is the `ValidityState` flag (`'valueMissing'`, `'typeMismatch'`, `'tooShort'`), `params` the\n * constraint behind it that a text needs (`{ minLength: 8 }`, `{ pattern: '[0-9]+' }`), `message` the\n * control's own text, a fallback only.\n */\nexport interface NativeValidity {\n\treadonly type: string;\n\treadonly params?: Readonly<Record<string, unknown>>;\n\treadonly message?: string;\n}\n\n/**\n * How a check of the form ended, and what the host may do next.\n *\n * @remarks\n * `'passed'`: the scope was current and no error from any source remains at the paths that take part.\n * `'invalid'`: the scope was current and an error blocks. `'overtaken'`: an edit, a row move or a reset outran the\n * check, and the retry over the same rows was outrun too or the rows are gone, so there is no verdict and nothing\n * stale was written: ask again, and do not show errors the user did not cause. A {@link FormSubmitResult} is built on\n * it, so the outcomes are listed here only.\n */\nexport type FormValidateResult =\n\t{ readonly outcome: 'passed' } | { readonly outcome: 'invalid' } | { readonly outcome: 'overtaken' };\n\n/**\n * How a submission ended, and what the host may do next.\n *\n * @remarks\n * `'passed'`: the scope was current and nothing blocks; `values` are exactly the values that passed, frozen,\n * nested like `snapshot.values`, without the paths that took no part and with the config's `payload`. An\n * edit during the check followed by a retry that passes leaves the edit in them. `setServerErrors` hands back\n * the server's answer to that submission. `'invalid'`: the scope was current and an error blocks, so show the\n * errors and focus. `'overtaken'`: an edit, a row move, a reset, a later submission or a superseded check outran\n * it, so there is no verdict on anything: ask again, and do not show errors the user did not cause.\n */\nexport type FormSubmitResult =\n\t| Exclude<FormValidateResult, { readonly outcome: 'passed' }>\n\t| {\n\t\t\treadonly outcome: 'passed';\n\t\t\treadonly values: Readonly<Record<string, unknown>>;\n\t\t\t/**\n\t\t\t * Shows the server's answer to this submission, replacing the answer shown so far.\n\t\t\t *\n\t\t\t * @remarks\n\t\t\t * Each path takes one issue or a list, and {@link FORM_ROOT} stands for the form. Throws for a path with\n\t\t\t * a reserved `__` segment other than `FORM_ROOT`, and for a path that names a row the submitted values\n\t\t\t * did not have. Paths are as they are in `values`: an index counts only the rows that took part, and the container maps it to the form's row (so with the middle one of three rows left out, `rows.1` is the third row). An error for `contacts.0.email` lands\n\t\t\t * on that row wherever it is now, and is dropped when the row is gone. A path no field declares cannot be\n\t\t\t * shown at a field, so its issues move to `FORM_ROOT`, keeping their type, params and message. An error is applied only when its\n\t\t\t * target, and every value its rules read, are unchanged since the submission, and only while this is the\n\t\t\t * latest submission and no reset came between: otherwise the call does nothing. An error is cleared\n\t\t\t * when its path, or a path its rules read, is edited.\n\t\t\t */\n\t\t\treadonly setServerErrors: (errors: FormStateErrorsInput) => void;\n\t };\n\n/**\n * The immutable state a subscriber reads.\n *\n * @remarks\n * Stable: {@link FormStateContainer.getSnapshot} returns the same object until something changes, and a\n * branch that did not change keeps its reference, in `values` and in every map. Maps are plain records,\n * frozen, keyed by dotted path. An opaque value, such as an array holding `File` objects, is kept and\n * compared by reference: it is never copied, frozen or diffed.\n *\n * Paths that take no part in validation (hidden or disabled fields, and what is inside them) are absent\n * from `errors`, `warnings` and `validating`.\n */\nexport interface FormStateSnapshot {\n\t/** The nested value tree. */\n\treadonly values: Readonly<Record<string, unknown>>;\n\t/**\n\t * The error of each path, with every issue it has in `all`.\n\t *\n\t * @remarks\n\t * Never inherited: an error on `contacts` is not an error on `contacts.0.email`, and both can be present.\n\t * An error about the form itself is at {@link FORM_ROOT}.\n\t */\n\treadonly errors: Readonly<Record<string, FormStateError>>;\n\t/** The advice of each path, shaped like `errors` and never blocking. */\n\treadonly warnings: Readonly<Record<string, FormStateWarning>>;\n\t/** The paths the user has blurred; a mark on a container covers the fields below it. Moves with its row. */\n\treadonly touched: Readonly<Record<string, true>>;\n\t/**\n\t * The paths whose value differs from the defaults.\n\t *\n\t * @remarks An array's own mark means its row count changed; its rows are compared by index, so appending a row does not make the existing rows dirty.\n\t */\n\treadonly dirty: Readonly<Record<string, true>>;\n\t/** The ids of an array's rows, by array path, in row order. */\n\treadonly rowIds: Readonly<Record<string, readonly string[]>>;\n\t/**\n\t * The paths a check the container started is still running for.\n\t *\n\t * @remarks\n\t * A path is listed while the latest check that asked for it is running: a check overtaken by a later one\n\t * for the same path does not keep it pending. Pending is state, never an issue. It moves with its row.\n\t */\n\treadonly validating: Readonly<Record<string, true>>;\n\t/** Whether no error from any source is recorded for a path that takes part. Cheap, and not a fresh check. */\n\treadonly isValid: boolean;\n\t/**\n\t * How many times the form was reset: it goes up by one on every {@link FormStateContainer.reset} and on nothing else.\n\t *\n\t * @remarks\n\t * It lets what lives around the container, such as a runtime's submission and step state, notice a reset\n\t * that no one told it about, since `reset` is the only way back and any caller may use it.\n\t */\n\treadonly generation: number;\n\t/**\n\t * What the form's constraints say, resolved in order against the values with whatever took no part absent.\n\t *\n\t * @remarks\n\t * `skippedSteps` lists the ids of the steps its constraints hide. `fields` has an entry for each rendered path that has a constraint,\n\t * is disabled by authoring or is held by a skipped step; `selectFieldState` folds the ancestors in. The same object comes back\n\t * while nothing in it changes, however much else does.\n\t */\n\treadonly participation: {\n\t\treadonly skippedSteps: readonly string[];\n\t\treadonly fields: Readonly<Record<string, FieldParticipation>>;\n\t};\n}\n\n/**\n * The commands over a form's state, and the stable reads a binding builds on.\n *\n * @remarks\n * Every command is one atomic update: subscribers are notified once, and never see an array's values\n * and its row state out of step. No member depends on how it is called, so a binding may pass any of\n * them as a callback. Read state with `getSnapshot` and the selectors of `selectors.ts`.\n */\nexport interface FormStateContainer {\n\t/** Registers a listener for every snapshot change; returns the function that removes it. */\n\tsubscribe(listener: () => void): () => void;\n\tgetSnapshot(): FormStateSnapshot;\n\t/** The snapshot to render on the server and during hydration: the initial state, never replaced. */\n\tgetServerSnapshot(): FormStateSnapshot;\n\n\t/** The value at a dotted path, from the current state. */\n\tgetValue(path: string): unknown;\n\t/**\n\t * Replaces the whole branch at `path`.\n\t *\n\t * @remarks\n\t * Throws for a path with a reserved segment (one that starts with `__`, or `constructor`, `prototype`, `__proto__`) and for a path that names a row its array does not\n\t * have: rows are made with `fieldArray`, so a write cannot leave holes or rows without an id. It is a change: it validates when the mode says so, re-validates dependents, and drops what describes\n\t * a value that is gone: the errors a server answered with at the path and below, and on the paths around it, the form included,\n\t * and the native facts of the value. The state of rows and objects the branch no longer holds is dropped with\n\t * them. A write that leaves the value as it is changes nothing.\n\t */\n\tsetValue(path: string, value: unknown): void;\n\t/**\n\t * Marks `path` touched, and validates it when the mode says so.\n\t *\n\t * @remarks\n\t * The path is checked as in `setValue`. A control whose value the host has not written yet is written with\n\t * `setValue` first: the two are separate commands, and the end state is the one a single command would\n\t * leave.\n\t */\n\tblur(path: string): void;\n\t/**\n\t * Reports what the platform's controls say about the values the container holds, with no input from the user.\n\t *\n\t * @remarks\n\t * The one channel for native validity, for a host that owns controls: a path with its fact, `null` for a\n\t * control that reports itself valid or goes away, which withdraws the fact. A host reports a fact on a\n\t * change, a blur, a reset, or when a control's constraints change, and withdraws it when its control\n\t * disconnects. A fact is bound to the value held now and is dropped when that value changes, and it moves with\n\t * its row. A fact that is already held is a no-op. Reporting is no change: nothing becomes dirty or touched,\n\t * and one call is one commit that re-validates, in a single run, only the changed paths that were validated\n\t * before, are in a failed scope, or have a check in flight, never to start validating a pristine one. A path no field\n\t * of the config expands to for the values held (a name no field has, a removed row, anything below a scalar) is\n\t * ignored. A reserved path throws, for the whole\n\t * call and before anything is written. A fact is not part of the snapshot, so reporting alone notifies nobody.\n\t */\n\treportNative(facts: Readonly<Record<string, NativeValidity | null>>): void;\n\t/**\n\t * Replaces the defaults with `values` when given, then restores the values to the defaults and clears\n\t * every error, native fact, touched and dirty mark and the failed-check state.\n\t *\n\t * @remarks Validation still running when this is called is dropped and not run again, and so are the submissions begun before it; every row gets a new id.\n\t */\n\treset(values?: Record<string, unknown>): void;\n\t/**\n\t * Validates `paths` (the whole form when omitted, nothing when empty), records the findings and says how that ended.\n\t *\n\t * @remarks\n\t * Every check records the scope it covered: the values it read, the values its rules depend on, the\n\t * native facts, the reset generation and the rows by id. It is `'passed'` only when no error from any\n\t * source remains at the paths that take part and that scope was still current when it finished. A check\n\t * overtaken by an edit, a row move or a reset runs once more over the same rows, wherever they are now,\n\t * and one that is overtaken again, or whose rows are gone, is `'overtaken'` without writing anything stale:\n\t * it is not `'invalid'`, so the host must not read it as a failed field.\n\t * It rejects with a `FormValidationFailure` naming the path and rule when a rule could not run. A failure\n\t * of its own validation starts the failed-check state for those paths, so they re-validate by\n\t * `reValidateMode` from then on. It does not mark anything submitted or touched.\n\t */\n\tvalidate(paths?: readonly string[]): Promise<FormValidateResult>;\n\t/**\n\t * Whether the form is valid for the state at the moment of the call, by the same count as `validate`, without its writes.\n\t *\n\t * @remarks\n\t * It answers for the values, native facts, server errors and participation current when it was called,\n\t * and for no later state: it is never retried and never mixes those with errors set afterwards, so the\n\t * answer may already be out of date when it resolves. It writes no error and\n\t * changes no state. Errors recorded earlier do not count, as the check validates afresh. It rejects with\n\t * a `FormValidationFailure`, which keeps the `reason` and the `cause`, when a rule could not run.\n\t */\n\tcheckValidity(): Promise<boolean>;\n\t/**\n\t * Submits the form: clears the server's answer to the last submission, validates the whole form and says how that ended.\n\t *\n\t * @remarks\n\t * It validates as `validate()` does, with the same freshness and the one retry over the same rows, and\n\t * captures the submission the result speaks for: a later `submit` or a `reset` supersedes it, and the\n\t * earlier one ends `'overtaken'` or has its `setServerErrors` ignored. Like `validate`, it rejects with a\n\t * `FormValidationFailure` when a rule could not run, and a rejected call is no outcome.\n\t */\n\tsubmit(): Promise<FormSubmitResult>;\n\t/**\n\t * The commands of the array at `path`, the same object each time.\n\t *\n\t * @remarks\n\t * Cached per path, and a path names a position: `contacts.0.phones` is whatever row is at index 0 now,\n\t * not the row that was there when the commands were first asked for. Rows are read from\n\t * `snapshot.rowIds[path]`; `toFieldArrayValue` combines the two for a widget.\n\t */\n\tfieldArray(path: string): FieldArrayCommands;\n}\n\n/** What {@link createFormStateContainer} reads from a normalized form config. */\nexport interface FormStateContainerConfig {\n\t/**\n\t * The steps whose elements make up the form: fields, rules and constraints.\n\t *\n\t * @remarks A step's own `constraints` decide whether it is skipped; a skipped step's fields take no part, as hidden fields do not.\n\t */\n\treadonly steps: readonly ValidationStep[];\n\t/** When a field validates before a check of it has failed; the config schema always fills it. */\n\treadonly validationMode: FormValidationMode;\n\t/** When a field validates once a check of it has run; the config schema always fills it. */\n\treadonly reValidateMode: FormReValidateMode;\n\t/**\n\t * Data that travels with every submission.\n\t *\n\t * @remarks It is merged into the `values` of a passed submission and is never a value of the form: not in the snapshot, not dirty, not validated. Its keys cannot name fields, which the config validation checks.\n\t */\n\treadonly payload?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * The part of a snapshot that a server hands to a client so the client starts from the same state.\n *\n * @remarks\n * The `values` and `rowIds` of a snapshot are plain, frozen and serializable (but for opaque values such as\n * files), so `JSON.stringify(toHydration(container.getServerSnapshot()))` is the payload, and a snapshot is itself\n * accepted. The rest of a snapshot is derived from what the server's container did, not state to restore.\n */\nexport interface FormStateHydration {\n\treadonly values: Readonly<Record<string, unknown>>;\n\treadonly rowIds: Readonly<Record<string, readonly string[]>>;\n}\n\n/** What {@link FormStateContainerFactory} builds a container from. */\nexport interface FormStateContainerOptions {\n\t/** The normalized form config: the elements, the validation timing and the payload all come from it, so no renderer can differ. */\n\treadonly config: FormStateContainerConfig;\n\treadonly registry: ValidationRegistry;\n\treadonly defaults?: Record<string, unknown>;\n\t/**\n\t * The snapshot of a container that rendered the form elsewhere, to start from: its values and its row ids.\n\t *\n\t * @remarks\n\t * Without it the container starts from `defaults` and mints deterministic row ids (walk order, one counter per\n\t * container). With it the container starts from the values of the snapshot and adopts its row ids, so a client\n\t * keeps the identity a server rendered, whatever rows the user had added there. Values and ids come from the same\n\t * object, so there is nothing to compare; one whose ids do not match its own values cannot come from a real\n\t * snapshot and throws. `defaults` still say what the form started from, and what\n\t * `reset` restores, so pass the same ones the server used: the fields that differ from them are dirty.\n\t */\n\treadonly snapshot?: FormStateHydration;\n}\n\n/** What `formStateContainerConformance` builds the container under test with. */\nexport type FormStateContainerFactory = (options: FormStateContainerOptions) => FormStateContainer;\n"],
5
- "mappings": ";AA6BO,IAAM,YAAY;",
6
- "names": []
7
- }