@form-engine-ts/core 4.7.0 → 5.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,3 +1,10 @@
1
+ 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
+ type BuilderTranslationKey = KnownBuilderTranslationKey;
3
+ 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
+ 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;
6
+ type FormEngineMessages = Partial<Record<FormEngineTranslationKey, string>>;
7
+
1
8
  type Result<T, E> = {
2
9
  readonly success: true;
3
10
  readonly value: T;
@@ -63,7 +70,35 @@ type VersionTransitionError = {
63
70
  } | {
64
71
  readonly type: "validation_failed";
65
72
  readonly issues: readonly SchemaIssue[];
73
+ } | {
74
+ readonly type: "transition_failed";
75
+ readonly cause: unknown;
66
76
  };
77
+ interface VersionTransitionContext<TDomain = unknown> {
78
+ readonly formId: string;
79
+ readonly fromVersion: number;
80
+ readonly toVersion: number;
81
+ readonly expectedRevision: number;
82
+ readonly plan: FormVersionTransitionPlan;
83
+ readonly domainData?: TDomain;
84
+ }
85
+ type FormVersionTransitionPlan = VersionTransitionPlan;
86
+ interface CommitVersionTransitionOptions<TDomain = unknown> {
87
+ readonly context: VersionTransitionContext<TDomain>;
88
+ readonly beforeTransition?: (context: VersionTransitionContext<TDomain>) => Promise<TDomain | void> | TDomain | void;
89
+ readonly afterTransition?: (context: VersionTransitionContext<TDomain> & {
90
+ readonly nextRevision: number;
91
+ }) => Promise<void> | void;
92
+ readonly persistAdapter: (params: {
93
+ readonly formId: string;
94
+ readonly targetVersion: number;
95
+ readonly expectedRevision: number;
96
+ readonly schema: FormSchema;
97
+ readonly domainData?: TDomain;
98
+ }) => Promise<{
99
+ readonly nextRevision: number;
100
+ }>;
101
+ }
67
102
  interface CloneVersionOptions {
68
103
  readonly maxVersions?: number;
69
104
  readonly expectedRevision?: number;
@@ -112,6 +147,12 @@ declare function createDeleteDraftTransitionPlan(state: FormVersionState, draftR
112
147
  readonly plan: VersionTransitionPlan;
113
148
  }, VersionTransitionError>;
114
149
  declare function assertVersionMutable(status: FormVersionStatus): void;
150
+ declare function applyTransitionPlan(plan: FormVersionTransitionPlan): FormSchema;
151
+ declare function commitVersionTransition<TDomain = unknown>(options: CommitVersionTransitionOptions<TDomain>): Promise<{
152
+ readonly success: boolean;
153
+ readonly nextRevision: number;
154
+ readonly error?: VersionTransitionError;
155
+ }>;
115
156
 
116
157
  type FieldType = "text" | "textarea" | "number" | "rating" | "select" | "multi-select" | "checkbox" | "radio";
117
158
  type QuestionType = FieldType;
@@ -155,6 +196,9 @@ type ConditionValue = string | number | boolean;
155
196
  type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
156
197
  readonly [key: string]: JsonValue;
157
198
  };
199
+ interface BaseSubmissionMetadata {
200
+ readonly [key: string]: JsonValue | undefined;
201
+ }
158
202
  /** Arbitrary, JSON-serializable data preserved by every form-engine operation. */
159
203
  interface ExtensibleNode {
160
204
  readonly metadata?: Readonly<Record<string, JsonValue>>;
@@ -300,13 +344,30 @@ type AnswerValidationResult = {
300
344
  readonly valid: false;
301
345
  readonly issues: readonly ValidationIssue[];
302
346
  };
303
- interface FormSubmission extends ExtensibleNode {
347
+ interface FormSubmissionBase extends ExtensibleNode {
304
348
  readonly id: string;
305
349
  readonly formId: string;
306
350
  readonly formVersion: number;
307
351
  readonly locale: string;
308
352
  readonly values: FormValues;
353
+ /** Alias used by API-facing consumers; values remains the canonical v4 field. */
354
+ readonly answers?: Readonly<Record<string, unknown>>;
309
355
  readonly submittedAt: string;
356
+ readonly schemaRevision?: number;
357
+ }
358
+ type FormSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined> = FormSubmissionBase & ([TMeta] extends [undefined] ? {
359
+ readonly metadata?: BaseSubmissionMetadata;
360
+ } : {
361
+ readonly metadata: TMeta;
362
+ });
363
+ interface CreateSubmissionInput<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
364
+ readonly id?: string;
365
+ readonly formId: string;
366
+ readonly formVersion: number;
367
+ readonly answers: Record<string, unknown>;
368
+ readonly metadata: TMeta;
369
+ readonly submittedAt?: string;
370
+ readonly schemaRevision?: number;
310
371
  }
311
372
  interface TranslationAdapter {
312
373
  /** Return null or undefined when the key cannot be resolved by the adapter. */
@@ -406,6 +467,8 @@ interface VersionTransitionPlan {
406
467
  readonly events: readonly VersionTransitionEvent[];
407
468
  /** The complete next state value used by persistent adapters. */
408
469
  readonly nextVersion?: number;
470
+ /** Optional target schema for adapters that do not use a version record. */
471
+ readonly schema?: FormSchema;
409
472
  readonly timestamp: string;
410
473
  }
411
474
  type StorageCommitError = {
@@ -472,8 +535,7 @@ interface FormAnalytics {
472
535
  }
473
536
  type Question = FormField;
474
537
  type ChoiceOption = FieldOption;
475
- /** Translation keys reserved for the form builder UI. */
476
- type BuilderTranslationKey = `builder.${string}`;
538
+
477
539
  interface FieldTypeDefinition {
478
540
  readonly type: QuestionType;
479
541
  readonly labelKey: BuilderTranslationKey;
@@ -596,16 +658,76 @@ declare function transformFieldType(field: FormField, nextType: QuestionType): F
596
658
 
597
659
  declare const DEFAULT_FIELD_TYPE_DEFINITIONS: readonly FieldTypeDefinition[];
598
660
 
661
+ declare const EN_MESSAGES: Readonly<Record<FormEngineTranslationKey, string>>;
662
+
663
+ declare const JA_MESSAGES: Readonly<Record<FormEngineTranslationKey, string>>;
664
+
665
+ interface FormEngineTranslatorOptions {
666
+ readonly locale?: string;
667
+ readonly fallbackLocale?: string;
668
+ readonly messages?: FormEngineMessages;
669
+ readonly customCatalogs?: Record<string, FormEngineMessages>;
670
+ readonly fallbackTextResolver?: (key: FormEngineTranslationKey, locale: string) => string;
671
+ }
672
+ type FormEngineTranslator = (key: FormEngineTranslationKey | string, params?: Record<string, unknown>) => string;
673
+ declare const createFormEngineTranslator: (options?: FormEngineTranslatorOptions) => FormEngineTranslator;
674
+
599
675
  interface PaginationIteratorOptions {
600
676
  readonly pageSize?: number;
601
677
  readonly maxItems?: number;
602
678
  readonly signal?: AbortSignal;
603
679
  }
680
+ interface SubmissionCursorPayload {
681
+ readonly kind: "submission";
682
+ readonly formId: string;
683
+ readonly submittedAt: string;
684
+ readonly id: string;
685
+ }
686
+ interface TextAnswerCursorPayload {
687
+ readonly kind: "text_answer";
688
+ readonly formId: string;
689
+ readonly fieldId: string;
690
+ readonly submittedAt: string;
691
+ readonly submissionId: string;
692
+ }
693
+ type StorageCursor = string;
694
+ interface StorageFilterCriteria {
695
+ readonly fieldId?: string;
696
+ readonly fromDate?: string;
697
+ readonly toDate?: string;
698
+ readonly metadataFilters?: Readonly<Record<string, JsonValue>>;
699
+ }
700
+ interface PaginatedResult<T> {
701
+ readonly items: readonly T[];
702
+ readonly hasMore: boolean;
703
+ readonly nextCursor?: StorageCursor;
704
+ readonly totalScannedCount: number;
705
+ }
706
+ interface CursorPagingOptions {
707
+ readonly pageSize: number;
708
+ readonly cursor?: StorageCursor;
709
+ readonly maxScanPages?: number;
710
+ }
711
+ declare function paginateWithFilter<T>(params: {
712
+ readonly pageSize: number;
713
+ readonly cursor?: StorageCursor;
714
+ readonly maxScanPages?: number;
715
+ readonly fetchPage: (rawCursor: StorageCursor | undefined, limit: number) => Promise<{
716
+ readonly rawItems: readonly T[];
717
+ readonly rawNextCursor?: StorageCursor;
718
+ }>;
719
+ readonly filterPredicate: (item: T) => boolean;
720
+ readonly encodeCursor: (lastItem: T) => StorageCursor;
721
+ }): Promise<PaginatedResult<T>>;
604
722
  declare function iterateSubmissionPages(adapter: PagedSubmissionStorageAdapter, formId: string, queryOptions?: SubmissionPageQueryOptions, options?: PaginationIteratorOptions): AsyncIterable<readonly FormResponse[]>;
605
723
  interface SubmissionCursorValue {
606
724
  readonly submittedAt: string;
607
725
  readonly responseId: string;
608
726
  }
727
+ declare function encodeStorageSubmissionCursor(value: SubmissionCursorPayload): StorageCursor;
728
+ declare function decodeStorageSubmissionCursor(cursor: StorageCursor): SubmissionCursorPayload;
729
+ declare function encodeStorageTextAnswerCursor(value: TextAnswerCursorPayload): StorageCursor;
730
+ declare function decodeStorageTextAnswerCursor(cursor: StorageCursor): TextAnswerCursorPayload;
609
731
  interface TextAnswerCursorValue {
610
732
  readonly responseId: string;
611
733
  readonly fieldId: string;
@@ -650,13 +772,30 @@ interface ValidateFormSchemaOptions {
650
772
  declare function validateFormSchema(input: unknown, options?: ValidateFormSchemaOptions): SchemaValidationResult;
651
773
  declare function assertValidFormSchema(input: unknown): asserts input is FormSchema;
652
774
 
653
- interface CreateSubmissionOptions extends ExtensibleNode {
775
+ interface CreateSubmissionOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends ExtensibleNode {
654
776
  readonly id: string;
655
777
  readonly locale: string;
656
778
  readonly submittedAt: string;
779
+ readonly metadata?: TMeta & Readonly<Record<string, JsonValue>>;
657
780
  }
658
781
  declare function createSubmission(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions): FormSubmission;
782
+ declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions<TMeta>): FormSubmission<TMeta>;
783
+ declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(input: CreateSubmissionInput<TMeta>): FormSubmission<TMeta>;
659
784
 
785
+ /**
786
+ * Normalizes a locale string to its BCP 47 canonical form.
787
+ *
788
+ * Underscore-separated locale tags are accepted for compatibility with common
789
+ * platform and user-input conventions. Invalid tags return null.
790
+ */
791
+ declare const normalizeLocale: (rawLocale: string) => string | null;
792
+
793
+ interface TranslationProviderError {
794
+ readonly code: "RATE_LIMIT" | "AUTH_FAILED" | "UNSUPPORTED_LANGUAGE" | "NETWORK_ERROR" | "UNKNOWN";
795
+ readonly message: string;
796
+ readonly retryable: boolean;
797
+ readonly rawError?: unknown;
798
+ }
660
799
  interface TranslationSlot {
661
800
  readonly kind: "form" | "page" | "field" | "option";
662
801
  readonly nodeId: string;
@@ -758,8 +897,28 @@ declare function populateSchemaTranslations(schema: FormSchema, targetLocales: r
758
897
  }>;
759
898
  declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
760
899
 
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
+ }
761
917
  declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
762
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;
763
922
 
764
923
  declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
765
924
  declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
@@ -768,4 +927,4 @@ declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Rea
768
927
  declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
769
928
  declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
770
929
 
771
- export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type ConditionOperator, type ConditionValue, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvExportOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, 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 JsonValue, type LegacyTranslationMetadata, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type StorageAdapter, type StorageCommitError, type StreamCsvOptions, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationReport, type TranslationSlot, type TranslationStatus, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
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 };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,10 @@
1
+ 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
+ type BuilderTranslationKey = KnownBuilderTranslationKey;
3
+ 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
+ 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;
6
+ type FormEngineMessages = Partial<Record<FormEngineTranslationKey, string>>;
7
+
1
8
  type Result<T, E> = {
2
9
  readonly success: true;
3
10
  readonly value: T;
@@ -63,7 +70,35 @@ type VersionTransitionError = {
63
70
  } | {
64
71
  readonly type: "validation_failed";
65
72
  readonly issues: readonly SchemaIssue[];
73
+ } | {
74
+ readonly type: "transition_failed";
75
+ readonly cause: unknown;
66
76
  };
77
+ interface VersionTransitionContext<TDomain = unknown> {
78
+ readonly formId: string;
79
+ readonly fromVersion: number;
80
+ readonly toVersion: number;
81
+ readonly expectedRevision: number;
82
+ readonly plan: FormVersionTransitionPlan;
83
+ readonly domainData?: TDomain;
84
+ }
85
+ type FormVersionTransitionPlan = VersionTransitionPlan;
86
+ interface CommitVersionTransitionOptions<TDomain = unknown> {
87
+ readonly context: VersionTransitionContext<TDomain>;
88
+ readonly beforeTransition?: (context: VersionTransitionContext<TDomain>) => Promise<TDomain | void> | TDomain | void;
89
+ readonly afterTransition?: (context: VersionTransitionContext<TDomain> & {
90
+ readonly nextRevision: number;
91
+ }) => Promise<void> | void;
92
+ readonly persistAdapter: (params: {
93
+ readonly formId: string;
94
+ readonly targetVersion: number;
95
+ readonly expectedRevision: number;
96
+ readonly schema: FormSchema;
97
+ readonly domainData?: TDomain;
98
+ }) => Promise<{
99
+ readonly nextRevision: number;
100
+ }>;
101
+ }
67
102
  interface CloneVersionOptions {
68
103
  readonly maxVersions?: number;
69
104
  readonly expectedRevision?: number;
@@ -112,6 +147,12 @@ declare function createDeleteDraftTransitionPlan(state: FormVersionState, draftR
112
147
  readonly plan: VersionTransitionPlan;
113
148
  }, VersionTransitionError>;
114
149
  declare function assertVersionMutable(status: FormVersionStatus): void;
150
+ declare function applyTransitionPlan(plan: FormVersionTransitionPlan): FormSchema;
151
+ declare function commitVersionTransition<TDomain = unknown>(options: CommitVersionTransitionOptions<TDomain>): Promise<{
152
+ readonly success: boolean;
153
+ readonly nextRevision: number;
154
+ readonly error?: VersionTransitionError;
155
+ }>;
115
156
 
116
157
  type FieldType = "text" | "textarea" | "number" | "rating" | "select" | "multi-select" | "checkbox" | "radio";
117
158
  type QuestionType = FieldType;
@@ -155,6 +196,9 @@ type ConditionValue = string | number | boolean;
155
196
  type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
156
197
  readonly [key: string]: JsonValue;
157
198
  };
199
+ interface BaseSubmissionMetadata {
200
+ readonly [key: string]: JsonValue | undefined;
201
+ }
158
202
  /** Arbitrary, JSON-serializable data preserved by every form-engine operation. */
159
203
  interface ExtensibleNode {
160
204
  readonly metadata?: Readonly<Record<string, JsonValue>>;
@@ -300,13 +344,30 @@ type AnswerValidationResult = {
300
344
  readonly valid: false;
301
345
  readonly issues: readonly ValidationIssue[];
302
346
  };
303
- interface FormSubmission extends ExtensibleNode {
347
+ interface FormSubmissionBase extends ExtensibleNode {
304
348
  readonly id: string;
305
349
  readonly formId: string;
306
350
  readonly formVersion: number;
307
351
  readonly locale: string;
308
352
  readonly values: FormValues;
353
+ /** Alias used by API-facing consumers; values remains the canonical v4 field. */
354
+ readonly answers?: Readonly<Record<string, unknown>>;
309
355
  readonly submittedAt: string;
356
+ readonly schemaRevision?: number;
357
+ }
358
+ type FormSubmission<TMeta extends BaseSubmissionMetadata | undefined = undefined> = FormSubmissionBase & ([TMeta] extends [undefined] ? {
359
+ readonly metadata?: BaseSubmissionMetadata;
360
+ } : {
361
+ readonly metadata: TMeta;
362
+ });
363
+ interface CreateSubmissionInput<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> {
364
+ readonly id?: string;
365
+ readonly formId: string;
366
+ readonly formVersion: number;
367
+ readonly answers: Record<string, unknown>;
368
+ readonly metadata: TMeta;
369
+ readonly submittedAt?: string;
370
+ readonly schemaRevision?: number;
310
371
  }
311
372
  interface TranslationAdapter {
312
373
  /** Return null or undefined when the key cannot be resolved by the adapter. */
@@ -406,6 +467,8 @@ interface VersionTransitionPlan {
406
467
  readonly events: readonly VersionTransitionEvent[];
407
468
  /** The complete next state value used by persistent adapters. */
408
469
  readonly nextVersion?: number;
470
+ /** Optional target schema for adapters that do not use a version record. */
471
+ readonly schema?: FormSchema;
409
472
  readonly timestamp: string;
410
473
  }
411
474
  type StorageCommitError = {
@@ -472,8 +535,7 @@ interface FormAnalytics {
472
535
  }
473
536
  type Question = FormField;
474
537
  type ChoiceOption = FieldOption;
475
- /** Translation keys reserved for the form builder UI. */
476
- type BuilderTranslationKey = `builder.${string}`;
538
+
477
539
  interface FieldTypeDefinition {
478
540
  readonly type: QuestionType;
479
541
  readonly labelKey: BuilderTranslationKey;
@@ -596,16 +658,76 @@ declare function transformFieldType(field: FormField, nextType: QuestionType): F
596
658
 
597
659
  declare const DEFAULT_FIELD_TYPE_DEFINITIONS: readonly FieldTypeDefinition[];
598
660
 
661
+ declare const EN_MESSAGES: Readonly<Record<FormEngineTranslationKey, string>>;
662
+
663
+ declare const JA_MESSAGES: Readonly<Record<FormEngineTranslationKey, string>>;
664
+
665
+ interface FormEngineTranslatorOptions {
666
+ readonly locale?: string;
667
+ readonly fallbackLocale?: string;
668
+ readonly messages?: FormEngineMessages;
669
+ readonly customCatalogs?: Record<string, FormEngineMessages>;
670
+ readonly fallbackTextResolver?: (key: FormEngineTranslationKey, locale: string) => string;
671
+ }
672
+ type FormEngineTranslator = (key: FormEngineTranslationKey | string, params?: Record<string, unknown>) => string;
673
+ declare const createFormEngineTranslator: (options?: FormEngineTranslatorOptions) => FormEngineTranslator;
674
+
599
675
  interface PaginationIteratorOptions {
600
676
  readonly pageSize?: number;
601
677
  readonly maxItems?: number;
602
678
  readonly signal?: AbortSignal;
603
679
  }
680
+ interface SubmissionCursorPayload {
681
+ readonly kind: "submission";
682
+ readonly formId: string;
683
+ readonly submittedAt: string;
684
+ readonly id: string;
685
+ }
686
+ interface TextAnswerCursorPayload {
687
+ readonly kind: "text_answer";
688
+ readonly formId: string;
689
+ readonly fieldId: string;
690
+ readonly submittedAt: string;
691
+ readonly submissionId: string;
692
+ }
693
+ type StorageCursor = string;
694
+ interface StorageFilterCriteria {
695
+ readonly fieldId?: string;
696
+ readonly fromDate?: string;
697
+ readonly toDate?: string;
698
+ readonly metadataFilters?: Readonly<Record<string, JsonValue>>;
699
+ }
700
+ interface PaginatedResult<T> {
701
+ readonly items: readonly T[];
702
+ readonly hasMore: boolean;
703
+ readonly nextCursor?: StorageCursor;
704
+ readonly totalScannedCount: number;
705
+ }
706
+ interface CursorPagingOptions {
707
+ readonly pageSize: number;
708
+ readonly cursor?: StorageCursor;
709
+ readonly maxScanPages?: number;
710
+ }
711
+ declare function paginateWithFilter<T>(params: {
712
+ readonly pageSize: number;
713
+ readonly cursor?: StorageCursor;
714
+ readonly maxScanPages?: number;
715
+ readonly fetchPage: (rawCursor: StorageCursor | undefined, limit: number) => Promise<{
716
+ readonly rawItems: readonly T[];
717
+ readonly rawNextCursor?: StorageCursor;
718
+ }>;
719
+ readonly filterPredicate: (item: T) => boolean;
720
+ readonly encodeCursor: (lastItem: T) => StorageCursor;
721
+ }): Promise<PaginatedResult<T>>;
604
722
  declare function iterateSubmissionPages(adapter: PagedSubmissionStorageAdapter, formId: string, queryOptions?: SubmissionPageQueryOptions, options?: PaginationIteratorOptions): AsyncIterable<readonly FormResponse[]>;
605
723
  interface SubmissionCursorValue {
606
724
  readonly submittedAt: string;
607
725
  readonly responseId: string;
608
726
  }
727
+ declare function encodeStorageSubmissionCursor(value: SubmissionCursorPayload): StorageCursor;
728
+ declare function decodeStorageSubmissionCursor(cursor: StorageCursor): SubmissionCursorPayload;
729
+ declare function encodeStorageTextAnswerCursor(value: TextAnswerCursorPayload): StorageCursor;
730
+ declare function decodeStorageTextAnswerCursor(cursor: StorageCursor): TextAnswerCursorPayload;
609
731
  interface TextAnswerCursorValue {
610
732
  readonly responseId: string;
611
733
  readonly fieldId: string;
@@ -650,13 +772,30 @@ interface ValidateFormSchemaOptions {
650
772
  declare function validateFormSchema(input: unknown, options?: ValidateFormSchemaOptions): SchemaValidationResult;
651
773
  declare function assertValidFormSchema(input: unknown): asserts input is FormSchema;
652
774
 
653
- interface CreateSubmissionOptions extends ExtensibleNode {
775
+ interface CreateSubmissionOptions<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends ExtensibleNode {
654
776
  readonly id: string;
655
777
  readonly locale: string;
656
778
  readonly submittedAt: string;
779
+ readonly metadata?: TMeta & Readonly<Record<string, JsonValue>>;
657
780
  }
658
781
  declare function createSubmission(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions): FormSubmission;
782
+ declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(schema: FormSchema, values: FormValues, options: CreateSubmissionOptions<TMeta>): FormSubmission<TMeta>;
783
+ declare function createSubmission<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata>(input: CreateSubmissionInput<TMeta>): FormSubmission<TMeta>;
659
784
 
785
+ /**
786
+ * Normalizes a locale string to its BCP 47 canonical form.
787
+ *
788
+ * Underscore-separated locale tags are accepted for compatibility with common
789
+ * platform and user-input conventions. Invalid tags return null.
790
+ */
791
+ declare const normalizeLocale: (rawLocale: string) => string | null;
792
+
793
+ interface TranslationProviderError {
794
+ readonly code: "RATE_LIMIT" | "AUTH_FAILED" | "UNSUPPORTED_LANGUAGE" | "NETWORK_ERROR" | "UNKNOWN";
795
+ readonly message: string;
796
+ readonly retryable: boolean;
797
+ readonly rawError?: unknown;
798
+ }
660
799
  interface TranslationSlot {
661
800
  readonly kind: "form" | "page" | "field" | "option";
662
801
  readonly nodeId: string;
@@ -758,8 +897,28 @@ declare function populateSchemaTranslations(schema: FormSchema, targetLocales: r
758
897
  }>;
759
898
  declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
760
899
 
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
+ }
761
917
  declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
762
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;
763
922
 
764
923
  declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
765
924
  declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
@@ -768,4 +927,4 @@ declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Rea
768
927
  declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
769
928
  declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
770
929
 
771
- export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BuilderTranslationKey, type CanonicalTranslationMetadata, type CheckboxField, type CheckboxQuestionAggregate, type ChoiceDistributionEntry, type ChoiceFieldConstraintRule, type ChoiceOption, type ChoiceQuestionAggregate, type CloneVersionOptions, type CollectedLocales, type ConditionOperator, type ConditionValue, type CreateSubmissionOptions, type CrossTabulationResult, type CsvColumnContext, type CsvColumnDef, type CsvExportOptions, DEFAULT_FIELD_TYPE_DEFINITIONS, type DeleteDraftOptions, type DisplayCondition, type DisplayConditionGroup, type DisplayRule, type ExtensibleNode, type FieldConstraintRule, type FieldDisplayCondition, type FieldOption, type FieldType, type FieldTypeDefinition, type FormAnalytics, 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 JsonValue, type LegacyTranslationMetadata, type LocalizedText, type MigrateSchemaTranslationMetadataOptions, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, type PopulateTranslationsOptions, type PublishDraftOptions, type PublishDraftResult, type Question, type QuestionAggregate, type QuestionType, type RatingField, type RatingFieldConstraintRule, type ResponseAccumulator, type ResponseAccumulatorOptions, type Result, type SanitizeSchemaOptions, type SchemaIssue, type SchemaStructureIssue, type SchemaStructureIssueType, type SchemaTranslations, type SchemaValidationResult, type SelectField, type StorageAdapter, type StorageCommitError, type StreamCsvOptions, type SubmissionCursorValue, type SubmissionFilter, type SubmissionPage, type SubmissionPageQueryOptions, type SubmissionQueryOptions, type TextAnswerCursorValue, type TextAnswerItem, type TextAnswerPage, type TextAnswerPageQueryOptions, type TextField, type TextFieldConstraintRule, type TextQuestionAggregate, type TranslationAdapter, type TranslationMetadataMigrator, type TranslationMigrationContext, type TranslationReport, type TranslationSlot, type TranslationStatus, type ValidateFormSchemaOptions, type ValidationCode, type ValidationError, type ValidationIssue, type VersionTransitionError, type VersionTransitionEvent, type VersionTransitionPlan, type VersionedFormStorageAdapter, type WebhookConfig, type WebhookDispatchResult, aggregateResponses, assertValidFormSchema, assertVersionMutable, calculateChoiceDistribution, calculateCrossTabulation, calculateFieldVisibility, calculateNumericSummary, calculatePageVisibility, cloneVersionToDraft, collectSchemaLocales, collectTranslationSlots, computeSourceTextHash, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, getTranslationStatus, isDisplayConditionGroupSatisfied, isDisplayConditionSatisfied, isManualTranslationMetadata, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, migrateSchemaTranslationMetadata, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, removeLocaleFromSchema, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
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 };