@form-engine-ts/core 5.0.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,8 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ type AggregationSkipReason = "missing_field" | "type_mismatch" | "invalid_option" | "unsupported_version" | "locale_mismatch" | "pii_unconfirmed";
4
+ interface AggregationReport {
5
+ readonly totalProcessed: number;
6
+ readonly aggregatedCount: number;
7
+ readonly skippedItems: readonly {
8
+ readonly submissionId: string;
9
+ readonly fieldId: string;
10
+ readonly reason: AggregationSkipReason;
11
+ }[];
12
+ }
13
+
1
14
  type KnownBuilderTranslationKey = "builder.formTitle" | "builder.formDescription" | "builder.completionMessage" | "builder.addQuestion" | "builder.actions.addField" | "builder.actions.deleteField" | "builder.actions.moveUp" | "builder.actions.moveDown" | "builder.actions.add" | "builder.actions.delete" | "builder.actions.edit" | "builder.actions.settings" | "builder.actions.translate" | "builder.actions.close" | "builder.actions.dragHandle" | "builder.fields.selectType" | "builder.fields.typeText" | "builder.fields.typeTextarea" | "builder.fields.typeNumber" | "builder.fields.typeRadio" | "builder.fields.typeCheckbox" | "builder.fields.typeSelect" | "builder.fields.typeRating" | "builder.fields.typeMultiSelect" | "builder.fieldType.text" | "builder.fieldType.textarea" | "builder.fieldType.number" | "builder.fieldType.radio" | "builder.fieldType.checkbox" | "builder.fieldType.select" | "builder.fieldType.rating" | "builder.fieldType.multi-select" | "builder.fieldTypeDescription.text" | "builder.fieldTypeDescription.textarea" | "builder.fieldTypeDescription.number" | "builder.fieldTypeDescription.radio" | "builder.fieldTypeDescription.checkbox" | "builder.fieldTypeDescription.select" | "builder.fieldTypeDescription.rating" | "builder.fieldTypeDescription.multi-select" | "builder.fieldCategory.text" | "builder.fieldCategory.choice" | "builder.fieldCategory.number" | "builder.fieldCategory.advanced" | "builder.required" | "builder.options" | "builder.localization.title" | "builder.localization" | "builder.localization.addLocale" | "builder.localization.selectLocaleToAdd" | "builder.localization.defaultLocale" | "builder.localization.translateAll" | "builder.localization.noLocalesConfigured" | "builder.localization.localesConfiguredSummary" | "builder.localization.allLocalesAdded" | "builder.localization.maxLocalesReached" | "builder.submissionSettings.title" | "builder.submissionSettings.showConfirmation" | "builder.submissionSettings.renderMode" | "builder.formBuilder" | "builder.basicSettings" | "builder.description" | "builder.moveUp" | "builder.moveDown" | "builder.delete" | "builder.deleteAction" | "builder.questionTitle" | "builder.questionTitlePlaceholder" | "builder.newQuestionTitle" | "builder.type" | "builder.minimum" | "builder.maximum" | "builder.minimumLength" | "builder.maximumLength" | "builder.pattern" | "builder.step" | "builder.optionLabel" | "builder.optionLabelPlaceholder" | "builder.newOptionLabel" | "builder.remove" | "builder.addOption" | "builder.displayCondition" | "builder.alwaysVisible" | "builder.conditionOperator" | "builder.conditionValue" | "builder.conditionTrue" | "builder.conditionFalse" | "builder.pages" | "builder.enablePages" | "builder.addPage" | "builder.newPage" | "builder.pageTitle" | "builder.pageDescription" | "builder.pageQuestion" | "builder.questionPage" | "builder.pageCondition" | "builder.unassigned" | "builder.defaultLocale" | "builder.supportedLocales" | "builder.addLocale" | "builder.editLocale" | "builder.autoTranslate" | "builder.translating" | "builder.translationLocale" | "builder.selectLocale" | "builder.selectLocaleToAdd" | "builder.translation" | "builder.translatedFormTitle" | "builder.translatedFormDescription" | "builder.translatedCompletionMessage" | "builder.translatedQuestionTitle" | "builder.translatedDescription" | "builder.translationUnavailable" | "builder.operator.equals" | "builder.operator.not_equals" | "builder.operator.contains" | "builder.operator.not_empty" | "builder.showConfirmationBeforeSubmit" | "builder.confirmationRenderMode";
2
15
  type BuilderTranslationKey = KnownBuilderTranslationKey;
3
16
  type RendererTranslationKey = "renderer.submitButton" | "renderer.submittingButton" | "renderer.retryButton" | "renderer.requiredField" | "renderer.alreadySubmittedTitle" | "renderer.alreadySubmittedMessage" | "renderer.serverErrorSummary" | "renderer.confirmSensitiveDataTitle" | "renderer.confirmSensitiveDataMessage" | "renderer.confirmButton" | "renderer.cancelButton" | "form.submit" | "form.submitting" | "form.back" | "form.next" | "form.step" | "form.draftRestored" | "form.submissionBlocked" | "form.confirmSensitiveData" | "form.confirmSubmission" | "form.cancelSubmission" | "form.yes" | "form.no" | "form.alreadySubmitted" | "form.submitAnother" | "validation.required" | "validation.invalidOption" | "validation.invalidType" | "validation.max" | "validation.maxLength" | "validation.maxSelections" | "validation.min" | "validation.minLength" | "validation.minSelections" | "validation.pattern" | "validation.sensitiveData" | "validation.step" | "validation.unknownField";
4
17
  type TranslationWorkspaceTranslationKey = "workspace.title" | "workspace.status.missing" | "workspace.status.translated" | "workspace.status.stale" | "workspace.status.manual" | "workspace.status.manualStale" | "workspace.errors.localeNotAllowed" | "workspace.errors.maxLocalesExceeded" | "workspace.errors.readOnly" | "workspace.errors.adapterNotConfigured" | "workspace.errors.translationFailed";
5
- type FormEngineTranslationKey = KnownBuilderTranslationKey | RendererTranslationKey | TranslationWorkspaceTranslationKey;
18
+ type TranslationWorkspaceDetailedKey = "workspace.header.title" | "workspace.header.sourceLocale" | "workspace.header.targetLocale" | "workspace.header.translateAll" | "workspace.header.progress" | "workspace.slot.sourceText" | "workspace.slot.translatedText" | "workspace.slot.translateSingle" | "workspace.slot.revertManual" | "workspace.confirm.removeLocaleTitle" | "workspace.confirm.removeLocaleMessage" | "workspace.empty.noTargetLocales" | "workspace.empty.noSlotsToTranslate";
19
+ type FormEngineTranslationKey = KnownBuilderTranslationKey | RendererTranslationKey | TranslationWorkspaceTranslationKey | TranslationWorkspaceDetailedKey;
6
20
  type FormEngineMessages = Partial<Record<FormEngineTranslationKey, string>>;
7
21
 
8
22
  type Result<T, E> = {
@@ -199,6 +213,18 @@ type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
199
213
  interface BaseSubmissionMetadata {
200
214
  readonly [key: string]: JsonValue | undefined;
201
215
  }
216
+ /** A contract or tenant-managed locale and its translation capabilities. */
217
+ interface LocaleOption {
218
+ /** Canonical BCP 47 locale tag. */
219
+ readonly locale: string;
220
+ /** Human-readable locale name. */
221
+ readonly label: string;
222
+ /** Whether automatic translation is allowed for this locale. Defaults to true. */
223
+ readonly translatable?: boolean;
224
+ /** Whether the locale may be removed from the form. Defaults to true. */
225
+ readonly removable?: boolean;
226
+ readonly metadata?: Readonly<Record<string, unknown>>;
227
+ }
202
228
  /** Arbitrary, JSON-serializable data preserved by every form-engine operation. */
203
229
  interface ExtensibleNode {
204
230
  readonly metadata?: Readonly<Record<string, JsonValue>>;
@@ -344,14 +370,12 @@ type AnswerValidationResult = {
344
370
  readonly valid: false;
345
371
  readonly issues: readonly ValidationIssue[];
346
372
  };
347
- interface FormSubmissionBase extends ExtensibleNode {
373
+ interface FormSubmissionBase extends Pick<ExtensibleNode, "translationMetadata"> {
348
374
  readonly id: string;
349
375
  readonly formId: string;
350
376
  readonly formVersion: number;
351
- readonly locale: string;
377
+ readonly locale?: string;
352
378
  readonly values: FormValues;
353
- /** Alias used by API-facing consumers; values remains the canonical v4 field. */
354
- readonly answers?: Readonly<Record<string, unknown>>;
355
379
  readonly submittedAt: string;
356
380
  readonly schemaRevision?: number;
357
381
  }
@@ -360,6 +384,17 @@ type FormSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined
360
384
  } : {
361
385
  readonly metadata: TMeta;
362
386
  });
387
+ /** Clean network and persistence representation of a form submission. */
388
+ interface FormSubmissionWire<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
389
+ readonly id: string;
390
+ readonly formId: string;
391
+ readonly formVersion: number;
392
+ readonly values: Readonly<Record<string, unknown>>;
393
+ readonly locale?: string;
394
+ readonly metadata: TMeta;
395
+ readonly submittedAt: string;
396
+ readonly schemaRevision?: number;
397
+ }
363
398
  interface CreateSubmissionInput<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
364
399
  readonly id?: string;
365
400
  readonly formId: string;
@@ -600,9 +635,21 @@ interface ResponseAccumulatorOptions {
600
635
  }
601
636
  declare function createResponseAccumulator(schema: FormSchema, options?: ResponseAccumulatorOptions): ResponseAccumulator;
602
637
  declare function escapeCsvCell(value: string | number | boolean | null | undefined, neutralizeFormulas?: boolean): string;
603
- interface CsvExportOptions {
638
+ interface CsvColumnDefinition<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
639
+ readonly key: string;
640
+ readonly header: string;
641
+ readonly getValue: (submission: FormSubmission<TMeta>, schema: FormSchema) => string | number | boolean | null | undefined;
642
+ }
643
+ interface CsvExportOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
604
644
  readonly withBom?: boolean;
605
645
  readonly neutralizeFormulas?: boolean;
646
+ /** Alias for withBom used by the public export contract. */
647
+ readonly useBom?: boolean;
648
+ /** Alias for neutralizeFormulas used by the public export contract. */
649
+ readonly preventFormulaInjection?: boolean;
650
+ readonly customColumns?: readonly CsvColumnDefinition<TMeta>[];
651
+ readonly includePiiStatus?: boolean;
652
+ readonly includeLocale?: boolean;
606
653
  }
607
654
  interface CsvColumnDef {
608
655
  readonly header: string;
@@ -629,6 +676,60 @@ interface NodeWritableStream {
629
676
  declare function pipeResponsesToCsvStream(schema: FormSchema, submissions: AsyncIterable<AccumulatorResponse>, writable: WritableStream<Uint8Array> | NodeWritableStream, options?: StreamCsvOptions): Promise<void>;
630
677
  declare function exportResponsesToCsv(schema: FormSchema, responses: readonly FormSubmission[], options?: CsvExportOptions): string;
631
678
 
679
+ /** Submission shape used by pre-v4 clients and migration-only code. */
680
+ interface LegacyFormSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
681
+ readonly id: string;
682
+ readonly formId: string;
683
+ readonly formVersion: number;
684
+ readonly answers: Readonly<Record<string, unknown>>;
685
+ readonly locale?: string;
686
+ readonly metadata: TMeta;
687
+ readonly submittedAt: string;
688
+ readonly schemaRevision?: number;
689
+ }
690
+ declare const fromLegacyFormSubmission: <TMeta extends BaseSubmissionMetadata>(legacy: LegacyFormSubmission<TMeta>) => FormSubmission<TMeta>;
691
+
692
+ interface SensitiveDataFinding {
693
+ readonly fieldId: string;
694
+ readonly type: string;
695
+ readonly start?: number;
696
+ readonly end?: number;
697
+ readonly matchedText?: string;
698
+ readonly maskedText?: string;
699
+ }
700
+ interface PrivacyEngine {
701
+ detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
702
+ }
703
+ interface SubmissionValidationResult {
704
+ readonly valid: boolean;
705
+ readonly fieldErrors: Readonly<Record<string, string>>;
706
+ readonly formErrors: readonly string[];
707
+ readonly piiFindings?: readonly SensitiveDataFinding[];
708
+ }
709
+ declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
710
+ declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
711
+ declare function validateSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined>(schema: FormSchema, submission: FormSubmission<TMeta>, options?: {
712
+ readonly privacyEngine?: PrivacyEngine;
713
+ }): SubmissionValidationResult;
714
+
715
+ interface FormSubmissionSerializedError {
716
+ readonly code: "VALIDATION_FAILED" | "PII_CONFIRMATION_REQUIRED" | "SUBMISSION_BLOCKED" | "STORAGE_ERROR";
717
+ readonly messageKey: FormEngineTranslationKey | string;
718
+ readonly messageParams?: Readonly<Record<string, unknown>>;
719
+ readonly fieldErrors: Readonly<Record<string, string>>;
720
+ readonly formErrors: readonly string[];
721
+ readonly piiFindings?: readonly SensitiveDataFinding[];
722
+ readonly piiWarningAcknowledged?: boolean;
723
+ }
724
+ /** Error with a stable, JSON-serializable payload for RPC boundaries. */
725
+ declare class FormSubmissionError extends Error {
726
+ readonly payload: FormSubmissionSerializedError;
727
+ constructor(payload: FormSubmissionSerializedError);
728
+ toJSON(): FormSubmissionSerializedError;
729
+ }
730
+ declare const serializeSubmissionError: (error: FormSubmissionError) => FormSubmissionSerializedError;
731
+ declare const deserializeSubmissionError: (json: FormSubmissionSerializedError) => FormSubmissionError;
732
+
632
733
  type FormEventType = "response.submitted" | "schema.updated";
633
734
  interface FormEvent<T = unknown> {
634
735
  readonly id: string;
@@ -772,12 +873,32 @@ interface ValidateFormSchemaOptions {
772
873
  declare function validateFormSchema(input: unknown, options?: ValidateFormSchemaOptions): SchemaValidationResult;
773
874
  declare function assertValidFormSchema(input: unknown): asserts input is FormSchema;
774
875
 
876
+ /** Runtime schema for the JSON metadata carried by a submission wire payload. */
877
+ declare const FormSubmissionMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
878
+ /** Runtime schema for the clean, alias-free submission wire format. */
879
+ declare const FormSubmissionWireSchema: z.ZodObject<{
880
+ id: z.ZodString;
881
+ formId: z.ZodString;
882
+ formVersion: z.ZodNumber;
883
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
884
+ locale: z.ZodOptional<z.ZodString>;
885
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
886
+ submittedAt: z.ZodString;
887
+ schemaRevision: z.ZodOptional<z.ZodNumber>;
888
+ }, z.core.$strip>;
889
+ type FormSubmissionWireSchemaType = z.infer<typeof FormSubmissionWireSchema>;
890
+
775
891
  interface CreateSubmissionOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends ExtensibleNode {
776
892
  readonly id: string;
777
893
  readonly locale: string;
778
894
  readonly submittedAt: string;
779
895
  readonly metadata?: TMeta & Readonly<Record<string, JsonValue>>;
780
896
  }
897
+ declare function toFormSubmissionWire<TMeta extends BaseSubmissionMetadata>(submission: FormSubmission<TMeta>): FormSubmissionWire<TMeta>;
898
+ declare function toFormSubmissionWire(submission: FormSubmission): FormSubmissionWire;
899
+ declare function fromFormSubmissionWire<TMeta extends BaseSubmissionMetadata>(wire: FormSubmissionWire<TMeta>): FormSubmission<TMeta>;
900
+ declare function fromFormSubmissionWire(wire: FormSubmissionWireSchemaType): FormSubmission;
901
+ declare function fromFormSubmissionWire(wire: FormSubmissionWire): FormSubmission;
781
902
  declare function createSubmission(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions): FormSubmission;
782
903
  declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions<TMeta>): FormSubmission<TMeta>;
783
904
  declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(input: CreateSubmissionInput<TMeta>): FormSubmission<TMeta>;
@@ -897,29 +1018,6 @@ declare function populateSchemaTranslations(schema: FormSchema, targetLocales: r
897
1018
  }>;
898
1019
  declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
899
1020
 
900
- interface SensitiveDataFinding {
901
- readonly fieldId: string;
902
- readonly type: string;
903
- readonly start?: number;
904
- readonly end?: number;
905
- readonly matchedText?: string;
906
- readonly maskedText?: string;
907
- }
908
- interface PrivacyEngine {
909
- detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
910
- }
911
- interface SubmissionValidationResult {
912
- readonly valid: boolean;
913
- readonly fieldErrors: Readonly<Record<string, string>>;
914
- readonly formErrors: readonly string[];
915
- readonly piiFindings?: readonly SensitiveDataFinding[];
916
- }
917
- declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
918
- declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
919
- declare function validateSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined>(schema: FormSchema, submission: FormSubmission<TMeta>, options?: {
920
- readonly privacyEngine?: PrivacyEngine;
921
- }): SubmissionValidationResult;
922
-
923
1021
  declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
924
1022
  declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
925
1023
  declare function isDisplayConditionSatisfied(condition: DisplayCondition | undefined, currentAnswers: Readonly<Record<string, unknown>>): boolean;
@@ -927,4 +1025,4 @@ declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Rea
927
1025
  declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
928
1026
  declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
929
1027
 
930
- export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BaseSubmissionMetadata, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type CommitVersionTransitionOptions, type ConditionOperator, type ConditionValue, type CreateSubmissionInput, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvExportOptions, type CursorPagingOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, EN_MESSAGES, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, type FormEngineMessages, type FormEngineTranslationKey, type FormEngineTranslator, type FormEngineTranslatorOptions, type FormEvent, type FormEventType, type FormField, type FormPage, type FormPolicy, type FormResponse, type FormSchema, type FormStorageAdapter, type FormSubmission, type FormSubmissionSettings, type FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type FormVersionTransitionPlan, JA_MESSAGES, type JsonValue, type KnownBuilderTranslationKey, type LegacyTranslationMetadata, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginatedResult, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PrivacyEngine, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type RendererTranslationKey, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type SensitiveDataFinding, type StorageAdapter, type StorageCommitError, type StorageCursor, type StorageFilterCriteria, type StreamCsvOptions, type SubmissionCursorPayload, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type SubmissionValidationResult, type TextAnswerCursorPayload, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationProviderError, type TranslationReport, type TranslationSlot, type TranslationStatus, type TranslationWorkspaceTranslationKey, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionContext, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, applyTransitionPlan, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, commitVersionTransition, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createFormEngineTranslator, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeStorageSubmissionCursor, decodeStorageTextAnswerCursor, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeStorageSubmissionCursor, encodeStorageTextAnswerCursor, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeLocale, normalizeSubmissionPageSize, paginateWithFilter, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure, validateSubmission };
1028
+ export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AggregationReport, type AggregationSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BaseSubmissionMetadata, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type CommitVersionTransitionOptions, type ConditionOperator, type ConditionValue, type CreateSubmissionInput, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvColumnDefinition, type CsvExportOptions, type CursorPagingOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, EN_MESSAGES, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, type FormEngineMessages, type FormEngineTranslationKey, type FormEngineTranslator, type FormEngineTranslatorOptions, type FormEvent, type FormEventType, type FormField, type FormPage, type FormPolicy, type FormResponse, type FormSchema, type FormStorageAdapter, type FormSubmission, FormSubmissionError, FormSubmissionMetadataSchema, type FormSubmissionSerializedError, type FormSubmissionSettings, type FormSubmissionWire, FormSubmissionWireSchema, type FormSubmissionWireSchemaType, type FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type FormVersionTransitionPlan, JA_MESSAGES, type JsonValue, type KnownBuilderTranslationKey, type LegacyFormSubmission, type LegacyTranslationMetadata, type LocaleOption, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginatedResult, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PrivacyEngine, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type RendererTranslationKey, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type SensitiveDataFinding, type StorageAdapter, type StorageCommitError, type StorageCursor, type StorageFilterCriteria, type StreamCsvOptions, type SubmissionCursorPayload, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type SubmissionValidationResult, type TextAnswerCursorPayload, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationProviderError, type TranslationReport, type TranslationSlot, type TranslationStatus, type TranslationWorkspaceDetailedKey, type TranslationWorkspaceTranslationKey, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionContext, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, applyTransitionPlan, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, commitVersionTransition, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createFormEngineTranslator, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeStorageSubmissionCursor, decodeStorageTextAnswerCursor, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, deserializeSubmissionError, dispatchWebhook, encodeStorageSubmissionCursor, encodeStorageTextAnswerCursor, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, fromFormSubmissionWire, fromLegacyFormSubmission, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeLocale, normalizeSubmissionPageSize, paginateWithFilter, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, serializeSubmissionError, toFormSubmissionWire, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure, validateSubmission };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,22 @@
1
+ import { z } from 'zod';
2
+
3
+ type AggregationSkipReason = "missing_field" | "type_mismatch" | "invalid_option" | "unsupported_version" | "locale_mismatch" | "pii_unconfirmed";
4
+ interface AggregationReport {
5
+ readonly totalProcessed: number;
6
+ readonly aggregatedCount: number;
7
+ readonly skippedItems: readonly {
8
+ readonly submissionId: string;
9
+ readonly fieldId: string;
10
+ readonly reason: AggregationSkipReason;
11
+ }[];
12
+ }
13
+
1
14
  type KnownBuilderTranslationKey = "builder.formTitle" | "builder.formDescription" | "builder.completionMessage" | "builder.addQuestion" | "builder.actions.addField" | "builder.actions.deleteField" | "builder.actions.moveUp" | "builder.actions.moveDown" | "builder.actions.add" | "builder.actions.delete" | "builder.actions.edit" | "builder.actions.settings" | "builder.actions.translate" | "builder.actions.close" | "builder.actions.dragHandle" | "builder.fields.selectType" | "builder.fields.typeText" | "builder.fields.typeTextarea" | "builder.fields.typeNumber" | "builder.fields.typeRadio" | "builder.fields.typeCheckbox" | "builder.fields.typeSelect" | "builder.fields.typeRating" | "builder.fields.typeMultiSelect" | "builder.fieldType.text" | "builder.fieldType.textarea" | "builder.fieldType.number" | "builder.fieldType.radio" | "builder.fieldType.checkbox" | "builder.fieldType.select" | "builder.fieldType.rating" | "builder.fieldType.multi-select" | "builder.fieldTypeDescription.text" | "builder.fieldTypeDescription.textarea" | "builder.fieldTypeDescription.number" | "builder.fieldTypeDescription.radio" | "builder.fieldTypeDescription.checkbox" | "builder.fieldTypeDescription.select" | "builder.fieldTypeDescription.rating" | "builder.fieldTypeDescription.multi-select" | "builder.fieldCategory.text" | "builder.fieldCategory.choice" | "builder.fieldCategory.number" | "builder.fieldCategory.advanced" | "builder.required" | "builder.options" | "builder.localization.title" | "builder.localization" | "builder.localization.addLocale" | "builder.localization.selectLocaleToAdd" | "builder.localization.defaultLocale" | "builder.localization.translateAll" | "builder.localization.noLocalesConfigured" | "builder.localization.localesConfiguredSummary" | "builder.localization.allLocalesAdded" | "builder.localization.maxLocalesReached" | "builder.submissionSettings.title" | "builder.submissionSettings.showConfirmation" | "builder.submissionSettings.renderMode" | "builder.formBuilder" | "builder.basicSettings" | "builder.description" | "builder.moveUp" | "builder.moveDown" | "builder.delete" | "builder.deleteAction" | "builder.questionTitle" | "builder.questionTitlePlaceholder" | "builder.newQuestionTitle" | "builder.type" | "builder.minimum" | "builder.maximum" | "builder.minimumLength" | "builder.maximumLength" | "builder.pattern" | "builder.step" | "builder.optionLabel" | "builder.optionLabelPlaceholder" | "builder.newOptionLabel" | "builder.remove" | "builder.addOption" | "builder.displayCondition" | "builder.alwaysVisible" | "builder.conditionOperator" | "builder.conditionValue" | "builder.conditionTrue" | "builder.conditionFalse" | "builder.pages" | "builder.enablePages" | "builder.addPage" | "builder.newPage" | "builder.pageTitle" | "builder.pageDescription" | "builder.pageQuestion" | "builder.questionPage" | "builder.pageCondition" | "builder.unassigned" | "builder.defaultLocale" | "builder.supportedLocales" | "builder.addLocale" | "builder.editLocale" | "builder.autoTranslate" | "builder.translating" | "builder.translationLocale" | "builder.selectLocale" | "builder.selectLocaleToAdd" | "builder.translation" | "builder.translatedFormTitle" | "builder.translatedFormDescription" | "builder.translatedCompletionMessage" | "builder.translatedQuestionTitle" | "builder.translatedDescription" | "builder.translationUnavailable" | "builder.operator.equals" | "builder.operator.not_equals" | "builder.operator.contains" | "builder.operator.not_empty" | "builder.showConfirmationBeforeSubmit" | "builder.confirmationRenderMode";
2
15
  type BuilderTranslationKey = KnownBuilderTranslationKey;
3
16
  type RendererTranslationKey = "renderer.submitButton" | "renderer.submittingButton" | "renderer.retryButton" | "renderer.requiredField" | "renderer.alreadySubmittedTitle" | "renderer.alreadySubmittedMessage" | "renderer.serverErrorSummary" | "renderer.confirmSensitiveDataTitle" | "renderer.confirmSensitiveDataMessage" | "renderer.confirmButton" | "renderer.cancelButton" | "form.submit" | "form.submitting" | "form.back" | "form.next" | "form.step" | "form.draftRestored" | "form.submissionBlocked" | "form.confirmSensitiveData" | "form.confirmSubmission" | "form.cancelSubmission" | "form.yes" | "form.no" | "form.alreadySubmitted" | "form.submitAnother" | "validation.required" | "validation.invalidOption" | "validation.invalidType" | "validation.max" | "validation.maxLength" | "validation.maxSelections" | "validation.min" | "validation.minLength" | "validation.minSelections" | "validation.pattern" | "validation.sensitiveData" | "validation.step" | "validation.unknownField";
4
17
  type TranslationWorkspaceTranslationKey = "workspace.title" | "workspace.status.missing" | "workspace.status.translated" | "workspace.status.stale" | "workspace.status.manual" | "workspace.status.manualStale" | "workspace.errors.localeNotAllowed" | "workspace.errors.maxLocalesExceeded" | "workspace.errors.readOnly" | "workspace.errors.adapterNotConfigured" | "workspace.errors.translationFailed";
5
- type FormEngineTranslationKey = KnownBuilderTranslationKey | RendererTranslationKey | TranslationWorkspaceTranslationKey;
18
+ type TranslationWorkspaceDetailedKey = "workspace.header.title" | "workspace.header.sourceLocale" | "workspace.header.targetLocale" | "workspace.header.translateAll" | "workspace.header.progress" | "workspace.slot.sourceText" | "workspace.slot.translatedText" | "workspace.slot.translateSingle" | "workspace.slot.revertManual" | "workspace.confirm.removeLocaleTitle" | "workspace.confirm.removeLocaleMessage" | "workspace.empty.noTargetLocales" | "workspace.empty.noSlotsToTranslate";
19
+ type FormEngineTranslationKey = KnownBuilderTranslationKey | RendererTranslationKey | TranslationWorkspaceTranslationKey | TranslationWorkspaceDetailedKey;
6
20
  type FormEngineMessages = Partial<Record<FormEngineTranslationKey, string>>;
7
21
 
8
22
  type Result<T, E> = {
@@ -199,6 +213,18 @@ type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
199
213
  interface BaseSubmissionMetadata {
200
214
  readonly [key: string]: JsonValue | undefined;
201
215
  }
216
+ /** A contract or tenant-managed locale and its translation capabilities. */
217
+ interface LocaleOption {
218
+ /** Canonical BCP 47 locale tag. */
219
+ readonly locale: string;
220
+ /** Human-readable locale name. */
221
+ readonly label: string;
222
+ /** Whether automatic translation is allowed for this locale. Defaults to true. */
223
+ readonly translatable?: boolean;
224
+ /** Whether the locale may be removed from the form. Defaults to true. */
225
+ readonly removable?: boolean;
226
+ readonly metadata?: Readonly<Record<string, unknown>>;
227
+ }
202
228
  /** Arbitrary, JSON-serializable data preserved by every form-engine operation. */
203
229
  interface ExtensibleNode {
204
230
  readonly metadata?: Readonly<Record<string, JsonValue>>;
@@ -344,14 +370,12 @@ type AnswerValidationResult = {
344
370
  readonly valid: false;
345
371
  readonly issues: readonly ValidationIssue[];
346
372
  };
347
- interface FormSubmissionBase extends ExtensibleNode {
373
+ interface FormSubmissionBase extends Pick<ExtensibleNode, "translationMetadata"> {
348
374
  readonly id: string;
349
375
  readonly formId: string;
350
376
  readonly formVersion: number;
351
- readonly locale: string;
377
+ readonly locale?: string;
352
378
  readonly values: FormValues;
353
- /** Alias used by API-facing consumers; values remains the canonical v4 field. */
354
- readonly answers?: Readonly<Record<string, unknown>>;
355
379
  readonly submittedAt: string;
356
380
  readonly schemaRevision?: number;
357
381
  }
@@ -360,6 +384,17 @@ type FormSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined
360
384
  } : {
361
385
  readonly metadata: TMeta;
362
386
  });
387
+ /** Clean network and persistence representation of a form submission. */
388
+ interface FormSubmissionWire<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
389
+ readonly id: string;
390
+ readonly formId: string;
391
+ readonly formVersion: number;
392
+ readonly values: Readonly<Record<string, unknown>>;
393
+ readonly locale?: string;
394
+ readonly metadata: TMeta;
395
+ readonly submittedAt: string;
396
+ readonly schemaRevision?: number;
397
+ }
363
398
  interface CreateSubmissionInput<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
364
399
  readonly id?: string;
365
400
  readonly formId: string;
@@ -600,9 +635,21 @@ interface ResponseAccumulatorOptions {
600
635
  }
601
636
  declare function createResponseAccumulator(schema: FormSchema, options?: ResponseAccumulatorOptions): ResponseAccumulator;
602
637
  declare function escapeCsvCell(value: string | number | boolean | null | undefined, neutralizeFormulas?: boolean): string;
603
- interface CsvExportOptions {
638
+ interface CsvColumnDefinition<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
639
+ readonly key: string;
640
+ readonly header: string;
641
+ readonly getValue: (submission: FormSubmission<TMeta>, schema: FormSchema) => string | number | boolean | null | undefined;
642
+ }
643
+ interface CsvExportOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
604
644
  readonly withBom?: boolean;
605
645
  readonly neutralizeFormulas?: boolean;
646
+ /** Alias for withBom used by the public export contract. */
647
+ readonly useBom?: boolean;
648
+ /** Alias for neutralizeFormulas used by the public export contract. */
649
+ readonly preventFormulaInjection?: boolean;
650
+ readonly customColumns?: readonly CsvColumnDefinition<TMeta>[];
651
+ readonly includePiiStatus?: boolean;
652
+ readonly includeLocale?: boolean;
606
653
  }
607
654
  interface CsvColumnDef {
608
655
  readonly header: string;
@@ -629,6 +676,60 @@ interface NodeWritableStream {
629
676
  declare function pipeResponsesToCsvStream(schema: FormSchema, submissions: AsyncIterable<AccumulatorResponse>, writable: WritableStream<Uint8Array> | NodeWritableStream, options?: StreamCsvOptions): Promise<void>;
630
677
  declare function exportResponsesToCsv(schema: FormSchema, responses: readonly FormSubmission[], options?: CsvExportOptions): string;
631
678
 
679
+ /** Submission shape used by pre-v4 clients and migration-only code. */
680
+ interface LegacyFormSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
681
+ readonly id: string;
682
+ readonly formId: string;
683
+ readonly formVersion: number;
684
+ readonly answers: Readonly<Record<string, unknown>>;
685
+ readonly locale?: string;
686
+ readonly metadata: TMeta;
687
+ readonly submittedAt: string;
688
+ readonly schemaRevision?: number;
689
+ }
690
+ declare const fromLegacyFormSubmission: <TMeta extends BaseSubmissionMetadata>(legacy: LegacyFormSubmission<TMeta>) => FormSubmission<TMeta>;
691
+
692
+ interface SensitiveDataFinding {
693
+ readonly fieldId: string;
694
+ readonly type: string;
695
+ readonly start?: number;
696
+ readonly end?: number;
697
+ readonly matchedText?: string;
698
+ readonly maskedText?: string;
699
+ }
700
+ interface PrivacyEngine {
701
+ detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
702
+ }
703
+ interface SubmissionValidationResult {
704
+ readonly valid: boolean;
705
+ readonly fieldErrors: Readonly<Record<string, string>>;
706
+ readonly formErrors: readonly string[];
707
+ readonly piiFindings?: readonly SensitiveDataFinding[];
708
+ }
709
+ declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
710
+ declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
711
+ declare function validateSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined>(schema: FormSchema, submission: FormSubmission<TMeta>, options?: {
712
+ readonly privacyEngine?: PrivacyEngine;
713
+ }): SubmissionValidationResult;
714
+
715
+ interface FormSubmissionSerializedError {
716
+ readonly code: "VALIDATION_FAILED" | "PII_CONFIRMATION_REQUIRED" | "SUBMISSION_BLOCKED" | "STORAGE_ERROR";
717
+ readonly messageKey: FormEngineTranslationKey | string;
718
+ readonly messageParams?: Readonly<Record<string, unknown>>;
719
+ readonly fieldErrors: Readonly<Record<string, string>>;
720
+ readonly formErrors: readonly string[];
721
+ readonly piiFindings?: readonly SensitiveDataFinding[];
722
+ readonly piiWarningAcknowledged?: boolean;
723
+ }
724
+ /** Error with a stable, JSON-serializable payload for RPC boundaries. */
725
+ declare class FormSubmissionError extends Error {
726
+ readonly payload: FormSubmissionSerializedError;
727
+ constructor(payload: FormSubmissionSerializedError);
728
+ toJSON(): FormSubmissionSerializedError;
729
+ }
730
+ declare const serializeSubmissionError: (error: FormSubmissionError) => FormSubmissionSerializedError;
731
+ declare const deserializeSubmissionError: (json: FormSubmissionSerializedError) => FormSubmissionError;
732
+
632
733
  type FormEventType = "response.submitted" | "schema.updated";
633
734
  interface FormEvent<T = unknown> {
634
735
  readonly id: string;
@@ -772,12 +873,32 @@ interface ValidateFormSchemaOptions {
772
873
  declare function validateFormSchema(input: unknown, options?: ValidateFormSchemaOptions): SchemaValidationResult;
773
874
  declare function assertValidFormSchema(input: unknown): asserts input is FormSchema;
774
875
 
876
+ /** Runtime schema for the JSON metadata carried by a submission wire payload. */
877
+ declare const FormSubmissionMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
878
+ /** Runtime schema for the clean, alias-free submission wire format. */
879
+ declare const FormSubmissionWireSchema: z.ZodObject<{
880
+ id: z.ZodString;
881
+ formId: z.ZodString;
882
+ formVersion: z.ZodNumber;
883
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
884
+ locale: z.ZodOptional<z.ZodString>;
885
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
886
+ submittedAt: z.ZodString;
887
+ schemaRevision: z.ZodOptional<z.ZodNumber>;
888
+ }, z.core.$strip>;
889
+ type FormSubmissionWireSchemaType = z.infer<typeof FormSubmissionWireSchema>;
890
+
775
891
  interface CreateSubmissionOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends ExtensibleNode {
776
892
  readonly id: string;
777
893
  readonly locale: string;
778
894
  readonly submittedAt: string;
779
895
  readonly metadata?: TMeta & Readonly<Record<string, JsonValue>>;
780
896
  }
897
+ declare function toFormSubmissionWire<TMeta extends BaseSubmissionMetadata>(submission: FormSubmission<TMeta>): FormSubmissionWire<TMeta>;
898
+ declare function toFormSubmissionWire(submission: FormSubmission): FormSubmissionWire;
899
+ declare function fromFormSubmissionWire<TMeta extends BaseSubmissionMetadata>(wire: FormSubmissionWire<TMeta>): FormSubmission<TMeta>;
900
+ declare function fromFormSubmissionWire(wire: FormSubmissionWireSchemaType): FormSubmission;
901
+ declare function fromFormSubmissionWire(wire: FormSubmissionWire): FormSubmission;
781
902
  declare function createSubmission(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions): FormSubmission;
782
903
  declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions<TMeta>): FormSubmission<TMeta>;
783
904
  declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(input: CreateSubmissionInput<TMeta>): FormSubmission<TMeta>;
@@ -897,29 +1018,6 @@ declare function populateSchemaTranslations(schema: FormSchema, targetLocales: r
897
1018
  }>;
898
1019
  declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
899
1020
 
900
- interface SensitiveDataFinding {
901
- readonly fieldId: string;
902
- readonly type: string;
903
- readonly start?: number;
904
- readonly end?: number;
905
- readonly matchedText?: string;
906
- readonly maskedText?: string;
907
- }
908
- interface PrivacyEngine {
909
- detect(schema: FormSchema, values: Record<string, unknown>): readonly SensitiveDataFinding[];
910
- }
911
- interface SubmissionValidationResult {
912
- readonly valid: boolean;
913
- readonly fieldErrors: Readonly<Record<string, string>>;
914
- readonly formErrors: readonly string[];
915
- readonly piiFindings?: readonly SensitiveDataFinding[];
916
- }
917
- declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
918
- declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
919
- declare function validateSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined>(schema: FormSchema, submission: FormSubmission<TMeta>, options?: {
920
- readonly privacyEngine?: PrivacyEngine;
921
- }): SubmissionValidationResult;
922
-
923
1021
  declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
924
1022
  declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
925
1023
  declare function isDisplayConditionSatisfied(condition: DisplayCondition | undefined, currentAnswers: Readonly<Record<string, unknown>>): boolean;
@@ -927,4 +1025,4 @@ declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Rea
927
1025
  declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
928
1026
  declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
929
1027
 
930
- export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BaseSubmissionMetadata, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type CommitVersionTransitionOptions, type ConditionOperator, type ConditionValue, type CreateSubmissionInput, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvExportOptions, type CursorPagingOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, EN_MESSAGES, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, type FormEngineMessages, type FormEngineTranslationKey, type FormEngineTranslator, type FormEngineTranslatorOptions, type FormEvent, type FormEventType, type FormField, type FormPage, type FormPolicy, type FormResponse, type FormSchema, type FormStorageAdapter, type FormSubmission, type FormSubmissionSettings, type FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type FormVersionTransitionPlan, JA_MESSAGES, type JsonValue, type KnownBuilderTranslationKey, type LegacyTranslationMetadata, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginatedResult, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PrivacyEngine, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type RendererTranslationKey, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type SensitiveDataFinding, type StorageAdapter, type StorageCommitError, type StorageCursor, type StorageFilterCriteria, type StreamCsvOptions, type SubmissionCursorPayload, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type SubmissionValidationResult, type TextAnswerCursorPayload, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationProviderError, type TranslationReport, type TranslationSlot, type TranslationStatus, type TranslationWorkspaceTranslationKey, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionContext, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, applyTransitionPlan, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, commitVersionTransition, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createFormEngineTranslator, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeStorageSubmissionCursor, decodeStorageTextAnswerCursor, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeStorageSubmissionCursor, encodeStorageTextAnswerCursor, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeLocale, normalizeSubmissionPageSize, paginateWithFilter, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure, validateSubmission };
1028
+ export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AggregationReport, type AggregationSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BaseSubmissionMetadata, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type CommitVersionTransitionOptions, type ConditionOperator, type ConditionValue, type CreateSubmissionInput, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvColumnDefinition, type CsvExportOptions, type CursorPagingOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, EN_MESSAGES, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, type FormEngineMessages, type FormEngineTranslationKey, type FormEngineTranslator, type FormEngineTranslatorOptions, type FormEvent, type FormEventType, type FormField, type FormPage, type FormPolicy, type FormResponse, type FormSchema, type FormStorageAdapter, type FormSubmission, FormSubmissionError, FormSubmissionMetadataSchema, type FormSubmissionSerializedError, type FormSubmissionSettings, type FormSubmissionWire, FormSubmissionWireSchema, type FormSubmissionWireSchemaType, type FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type FormVersionTransitionPlan, JA_MESSAGES, type JsonValue, type KnownBuilderTranslationKey, type LegacyFormSubmission, type LegacyTranslationMetadata, type LocaleOption, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginatedResult, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PrivacyEngine, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type RendererTranslationKey, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type SensitiveDataFinding, type StorageAdapter, type StorageCommitError, type StorageCursor, type StorageFilterCriteria, type StreamCsvOptions, type SubmissionCursorPayload, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type SubmissionValidationResult, type TextAnswerCursorPayload, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationProviderError, type TranslationReport, type TranslationSlot, type TranslationStatus, type TranslationWorkspaceDetailedKey, type TranslationWorkspaceTranslationKey, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionContext, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, applyTransitionPlan, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, commitVersionTransition, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createFormEngineTranslator, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeStorageSubmissionCursor, decodeStorageTextAnswerCursor, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, deserializeSubmissionError, dispatchWebhook, encodeStorageSubmissionCursor, encodeStorageTextAnswerCursor, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, fromFormSubmissionWire, fromLegacyFormSubmission, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeLocale, normalizeSubmissionPageSize, paginateWithFilter, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, serializeSubmissionError, toFormSubmissionWire, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure, validateSubmission };