@form-engine-ts/core 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/index.cjs +279 -61
- package/dist/index.d.cts +57 -3
- package/dist/index.d.ts +57 -3
- package/dist/index.js +275 -61
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -148,7 +148,9 @@ interface FormPolicy {
|
|
|
148
148
|
/** Per-question-type defaults and immutable or bounded field constraints. */
|
|
149
149
|
readonly fieldConstraints?: Partial<Record<QuestionType, FieldConstraintRule>>;
|
|
150
150
|
}
|
|
151
|
-
type ConditionOperator = "equals" | "not_equals" | "contains" | "
|
|
151
|
+
type ConditionOperator = "equals" | "not_equals" | "contains" | "not_contains" | "is_empty" | "is_not_empty" | "greater_than" | "less_than"
|
|
152
|
+
/** @deprecated Use is_not_empty instead. */
|
|
153
|
+
| "not_empty";
|
|
152
154
|
type ConditionValue = string | number | boolean;
|
|
153
155
|
type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
|
|
154
156
|
readonly [key: string]: JsonValue;
|
|
@@ -164,6 +166,19 @@ interface DisplayCondition {
|
|
|
164
166
|
readonly operator: ConditionOperator;
|
|
165
167
|
readonly value?: ConditionValue;
|
|
166
168
|
}
|
|
169
|
+
interface FieldDisplayCondition {
|
|
170
|
+
readonly fieldId: string;
|
|
171
|
+
readonly operator: ConditionOperator;
|
|
172
|
+
readonly value?: unknown;
|
|
173
|
+
}
|
|
174
|
+
interface DisplayConditionGroup {
|
|
175
|
+
readonly logic: "all" | "any";
|
|
176
|
+
readonly conditions: readonly (FieldDisplayCondition | DisplayConditionGroup)[];
|
|
177
|
+
}
|
|
178
|
+
interface DisplayRule {
|
|
179
|
+
readonly action: "show" | "hide";
|
|
180
|
+
readonly condition: DisplayConditionGroup;
|
|
181
|
+
}
|
|
167
182
|
interface LocalizedText {
|
|
168
183
|
readonly title?: string;
|
|
169
184
|
readonly description?: string;
|
|
@@ -185,6 +200,7 @@ interface BaseField extends ExtensibleNode {
|
|
|
185
200
|
readonly required: boolean;
|
|
186
201
|
readonly messages?: Partial<Record<ValidationCode, string>>;
|
|
187
202
|
readonly displayCondition?: DisplayCondition;
|
|
203
|
+
readonly displayRule?: DisplayRule;
|
|
188
204
|
readonly translations?: SchemaTranslations;
|
|
189
205
|
}
|
|
190
206
|
interface TextField extends BaseField {
|
|
@@ -240,6 +256,13 @@ interface FormSchema extends ExtensibleNode {
|
|
|
240
256
|
readonly translations?: SchemaTranslations;
|
|
241
257
|
readonly fields: readonly FormField[];
|
|
242
258
|
readonly pages?: readonly FormPage[];
|
|
259
|
+
readonly submissionSettings?: FormSubmissionSettings;
|
|
260
|
+
}
|
|
261
|
+
interface FormSubmissionSettings extends ExtensibleNode {
|
|
262
|
+
readonly showConfirmationBeforeSubmit?: boolean;
|
|
263
|
+
readonly confirmationRenderMode?: "dialog" | "inline" | "replace";
|
|
264
|
+
readonly confirmButtonLabel?: string;
|
|
265
|
+
readonly cancelButtonLabel?: string;
|
|
243
266
|
}
|
|
244
267
|
type FormValue = string | number | boolean | readonly string[] | undefined;
|
|
245
268
|
type FormValues = Readonly<Record<string, FormValue>>;
|
|
@@ -253,6 +276,7 @@ interface SchemaIssue {
|
|
|
253
276
|
readonly fieldId?: string;
|
|
254
277
|
readonly property?: string;
|
|
255
278
|
readonly expected?: boolean | number | readonly [number, number];
|
|
279
|
+
readonly cycle?: readonly string[];
|
|
256
280
|
}
|
|
257
281
|
type SchemaValidationResult = {
|
|
258
282
|
readonly valid: true;
|
|
@@ -615,6 +639,7 @@ interface SchemaStructureIssue {
|
|
|
615
639
|
readonly questionId: string;
|
|
616
640
|
readonly choiceId?: string;
|
|
617
641
|
readonly message: string;
|
|
642
|
+
readonly cycle?: readonly string[];
|
|
618
643
|
}
|
|
619
644
|
declare function validateSchemaStructure(schema: FormSchema): SchemaStructureIssue[];
|
|
620
645
|
declare function sanitizeSchema(schema: FormSchema, options?: SanitizeSchemaOptions): FormSchema;
|
|
@@ -641,11 +666,30 @@ interface TranslationSlot {
|
|
|
641
666
|
readonly existingText?: string;
|
|
642
667
|
readonly nodeMetadata?: Readonly<Record<string, JsonValue>>;
|
|
643
668
|
readonly existingTranslationMetadata?: Readonly<Record<string, JsonValue>>;
|
|
669
|
+
/** Canonical target information for workspace clients. */
|
|
670
|
+
readonly target?: {
|
|
671
|
+
readonly kind: "form" | "page" | "field" | "option";
|
|
672
|
+
readonly id?: string;
|
|
673
|
+
readonly property: "title" | "description" | "label" | "completionMessage";
|
|
674
|
+
};
|
|
675
|
+
readonly path?: string;
|
|
676
|
+
readonly sourceTextHash?: string;
|
|
677
|
+
readonly status?: TranslationStatus;
|
|
644
678
|
/** @deprecated Use nodeMetadata instead. */
|
|
645
679
|
readonly metadata?: Readonly<Record<string, JsonValue>>;
|
|
646
680
|
}
|
|
681
|
+
type TranslationStatus = "missing" | "translated" | "stale" | "manual" | "manual-stale";
|
|
682
|
+
interface CanonicalTranslationMetadata {
|
|
683
|
+
readonly sourceLocale: string;
|
|
684
|
+
readonly sourceTextHash: string;
|
|
685
|
+
readonly translationSource: "automatic" | "manual";
|
|
686
|
+
readonly translatedAt?: string;
|
|
687
|
+
readonly editedAt?: string;
|
|
688
|
+
}
|
|
647
689
|
interface PopulateTranslationOptions {
|
|
648
|
-
readonly overwrite?: "missing-only" | "
|
|
690
|
+
readonly overwrite?: "all" | "missing-only" | "stale-and-missing";
|
|
691
|
+
readonly preserveManualTranslations?: boolean;
|
|
692
|
+
readonly markStaleTranslations?: boolean;
|
|
649
693
|
readonly shouldOverwrite?: (slot: TranslationSlot) => boolean;
|
|
650
694
|
readonly createMetadata?: (slot: TranslationSlot, translatedText: string) => Readonly<Record<string, JsonValue>>;
|
|
651
695
|
/** Applies locale admission and count limits before the adapter is called. */
|
|
@@ -654,21 +698,31 @@ interface PopulateTranslationOptions {
|
|
|
654
698
|
interface TranslationReport {
|
|
655
699
|
readonly updatedSlots: readonly TranslationSlot[];
|
|
656
700
|
readonly skippedSlots: readonly TranslationSlot[];
|
|
701
|
+
readonly staleSlots?: readonly TranslationSlot[];
|
|
702
|
+
readonly skippedReasons?: Readonly<Record<string, "manual" | "unchanged" | "unsupported">>;
|
|
657
703
|
}
|
|
704
|
+
declare const computeSourceTextHash: (text: string) => string;
|
|
705
|
+
declare function getTranslationStatus(sourceText: string, translatedText: string | undefined, metadata: CanonicalTranslationMetadata | Readonly<Record<string, JsonValue>> | undefined): TranslationStatus;
|
|
706
|
+
declare function collectTranslationSlots(schema: FormSchema, locale: string): readonly TranslationSlot[];
|
|
658
707
|
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
|
|
659
708
|
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
660
709
|
readonly schema: FormSchema;
|
|
661
710
|
readonly report: TranslationReport;
|
|
662
711
|
}>;
|
|
712
|
+
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: TranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
713
|
+
readonly schema: FormSchema;
|
|
714
|
+
readonly report: TranslationReport;
|
|
715
|
+
}>;
|
|
663
716
|
declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
|
|
664
717
|
|
|
665
718
|
declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
|
|
666
719
|
declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
|
|
667
720
|
|
|
721
|
+
declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
668
722
|
declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
669
723
|
declare function isDisplayConditionSatisfied(condition: DisplayCondition | undefined, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
670
724
|
declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
|
|
671
725
|
declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
|
|
672
726
|
declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
|
|
673
727
|
|
|
674
|
-
export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BuilderTranslationKey, 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 ExtensibleNode, type FieldConstraintRule, 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 FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type JsonValue, type LocalizedText, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, 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 TranslationReport, type TranslationSlot, 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, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, isDisplayConditionSatisfied, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
|
|
728
|
+
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 LocalizedText, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, 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 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, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
|
package/dist/index.d.ts
CHANGED
|
@@ -148,7 +148,9 @@ interface FormPolicy {
|
|
|
148
148
|
/** Per-question-type defaults and immutable or bounded field constraints. */
|
|
149
149
|
readonly fieldConstraints?: Partial<Record<QuestionType, FieldConstraintRule>>;
|
|
150
150
|
}
|
|
151
|
-
type ConditionOperator = "equals" | "not_equals" | "contains" | "
|
|
151
|
+
type ConditionOperator = "equals" | "not_equals" | "contains" | "not_contains" | "is_empty" | "is_not_empty" | "greater_than" | "less_than"
|
|
152
|
+
/** @deprecated Use is_not_empty instead. */
|
|
153
|
+
| "not_empty";
|
|
152
154
|
type ConditionValue = string | number | boolean;
|
|
153
155
|
type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
|
|
154
156
|
readonly [key: string]: JsonValue;
|
|
@@ -164,6 +166,19 @@ interface DisplayCondition {
|
|
|
164
166
|
readonly operator: ConditionOperator;
|
|
165
167
|
readonly value?: ConditionValue;
|
|
166
168
|
}
|
|
169
|
+
interface FieldDisplayCondition {
|
|
170
|
+
readonly fieldId: string;
|
|
171
|
+
readonly operator: ConditionOperator;
|
|
172
|
+
readonly value?: unknown;
|
|
173
|
+
}
|
|
174
|
+
interface DisplayConditionGroup {
|
|
175
|
+
readonly logic: "all" | "any";
|
|
176
|
+
readonly conditions: readonly (FieldDisplayCondition | DisplayConditionGroup)[];
|
|
177
|
+
}
|
|
178
|
+
interface DisplayRule {
|
|
179
|
+
readonly action: "show" | "hide";
|
|
180
|
+
readonly condition: DisplayConditionGroup;
|
|
181
|
+
}
|
|
167
182
|
interface LocalizedText {
|
|
168
183
|
readonly title?: string;
|
|
169
184
|
readonly description?: string;
|
|
@@ -185,6 +200,7 @@ interface BaseField extends ExtensibleNode {
|
|
|
185
200
|
readonly required: boolean;
|
|
186
201
|
readonly messages?: Partial<Record<ValidationCode, string>>;
|
|
187
202
|
readonly displayCondition?: DisplayCondition;
|
|
203
|
+
readonly displayRule?: DisplayRule;
|
|
188
204
|
readonly translations?: SchemaTranslations;
|
|
189
205
|
}
|
|
190
206
|
interface TextField extends BaseField {
|
|
@@ -240,6 +256,13 @@ interface FormSchema extends ExtensibleNode {
|
|
|
240
256
|
readonly translations?: SchemaTranslations;
|
|
241
257
|
readonly fields: readonly FormField[];
|
|
242
258
|
readonly pages?: readonly FormPage[];
|
|
259
|
+
readonly submissionSettings?: FormSubmissionSettings;
|
|
260
|
+
}
|
|
261
|
+
interface FormSubmissionSettings extends ExtensibleNode {
|
|
262
|
+
readonly showConfirmationBeforeSubmit?: boolean;
|
|
263
|
+
readonly confirmationRenderMode?: "dialog" | "inline" | "replace";
|
|
264
|
+
readonly confirmButtonLabel?: string;
|
|
265
|
+
readonly cancelButtonLabel?: string;
|
|
243
266
|
}
|
|
244
267
|
type FormValue = string | number | boolean | readonly string[] | undefined;
|
|
245
268
|
type FormValues = Readonly<Record<string, FormValue>>;
|
|
@@ -253,6 +276,7 @@ interface SchemaIssue {
|
|
|
253
276
|
readonly fieldId?: string;
|
|
254
277
|
readonly property?: string;
|
|
255
278
|
readonly expected?: boolean | number | readonly [number, number];
|
|
279
|
+
readonly cycle?: readonly string[];
|
|
256
280
|
}
|
|
257
281
|
type SchemaValidationResult = {
|
|
258
282
|
readonly valid: true;
|
|
@@ -615,6 +639,7 @@ interface SchemaStructureIssue {
|
|
|
615
639
|
readonly questionId: string;
|
|
616
640
|
readonly choiceId?: string;
|
|
617
641
|
readonly message: string;
|
|
642
|
+
readonly cycle?: readonly string[];
|
|
618
643
|
}
|
|
619
644
|
declare function validateSchemaStructure(schema: FormSchema): SchemaStructureIssue[];
|
|
620
645
|
declare function sanitizeSchema(schema: FormSchema, options?: SanitizeSchemaOptions): FormSchema;
|
|
@@ -641,11 +666,30 @@ interface TranslationSlot {
|
|
|
641
666
|
readonly existingText?: string;
|
|
642
667
|
readonly nodeMetadata?: Readonly<Record<string, JsonValue>>;
|
|
643
668
|
readonly existingTranslationMetadata?: Readonly<Record<string, JsonValue>>;
|
|
669
|
+
/** Canonical target information for workspace clients. */
|
|
670
|
+
readonly target?: {
|
|
671
|
+
readonly kind: "form" | "page" | "field" | "option";
|
|
672
|
+
readonly id?: string;
|
|
673
|
+
readonly property: "title" | "description" | "label" | "completionMessage";
|
|
674
|
+
};
|
|
675
|
+
readonly path?: string;
|
|
676
|
+
readonly sourceTextHash?: string;
|
|
677
|
+
readonly status?: TranslationStatus;
|
|
644
678
|
/** @deprecated Use nodeMetadata instead. */
|
|
645
679
|
readonly metadata?: Readonly<Record<string, JsonValue>>;
|
|
646
680
|
}
|
|
681
|
+
type TranslationStatus = "missing" | "translated" | "stale" | "manual" | "manual-stale";
|
|
682
|
+
interface CanonicalTranslationMetadata {
|
|
683
|
+
readonly sourceLocale: string;
|
|
684
|
+
readonly sourceTextHash: string;
|
|
685
|
+
readonly translationSource: "automatic" | "manual";
|
|
686
|
+
readonly translatedAt?: string;
|
|
687
|
+
readonly editedAt?: string;
|
|
688
|
+
}
|
|
647
689
|
interface PopulateTranslationOptions {
|
|
648
|
-
readonly overwrite?: "missing-only" | "
|
|
690
|
+
readonly overwrite?: "all" | "missing-only" | "stale-and-missing";
|
|
691
|
+
readonly preserveManualTranslations?: boolean;
|
|
692
|
+
readonly markStaleTranslations?: boolean;
|
|
649
693
|
readonly shouldOverwrite?: (slot: TranslationSlot) => boolean;
|
|
650
694
|
readonly createMetadata?: (slot: TranslationSlot, translatedText: string) => Readonly<Record<string, JsonValue>>;
|
|
651
695
|
/** Applies locale admission and count limits before the adapter is called. */
|
|
@@ -654,21 +698,31 @@ interface PopulateTranslationOptions {
|
|
|
654
698
|
interface TranslationReport {
|
|
655
699
|
readonly updatedSlots: readonly TranslationSlot[];
|
|
656
700
|
readonly skippedSlots: readonly TranslationSlot[];
|
|
701
|
+
readonly staleSlots?: readonly TranslationSlot[];
|
|
702
|
+
readonly skippedReasons?: Readonly<Record<string, "manual" | "unchanged" | "unsupported">>;
|
|
657
703
|
}
|
|
704
|
+
declare const computeSourceTextHash: (text: string) => string;
|
|
705
|
+
declare function getTranslationStatus(sourceText: string, translatedText: string | undefined, metadata: CanonicalTranslationMetadata | Readonly<Record<string, JsonValue>> | undefined): TranslationStatus;
|
|
706
|
+
declare function collectTranslationSlots(schema: FormSchema, locale: string): readonly TranslationSlot[];
|
|
658
707
|
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
|
|
659
708
|
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
660
709
|
readonly schema: FormSchema;
|
|
661
710
|
readonly report: TranslationReport;
|
|
662
711
|
}>;
|
|
712
|
+
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: TranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
713
|
+
readonly schema: FormSchema;
|
|
714
|
+
readonly report: TranslationReport;
|
|
715
|
+
}>;
|
|
663
716
|
declare function resolveFormTranslation(schema: FormSchema, adapter: AsyncTranslationAdapter, targetLocale: string, sourceLocale?: string): Promise<FormSchema>;
|
|
664
717
|
|
|
665
718
|
declare function validateAnswers(schema: FormSchema, values: FormValues): AnswerValidationResult;
|
|
666
719
|
declare function validatePageAnswers(schema: FormSchema, pageIndex: number, values: FormValues): AnswerValidationResult;
|
|
667
720
|
|
|
721
|
+
declare function isDisplayConditionGroupSatisfied(group: DisplayConditionGroup, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
668
722
|
declare function isQuestionVisible(question: FormField, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
669
723
|
declare function isDisplayConditionSatisfied(condition: DisplayCondition | undefined, currentAnswers: Readonly<Record<string, unknown>>): boolean;
|
|
670
724
|
declare function calculatePageVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
|
|
671
725
|
declare function calculateFieldVisibility(schema: FormSchema, currentAnswers: Readonly<Record<string, unknown>>): Readonly<Record<string, boolean>>;
|
|
672
726
|
declare function selectVisibleAnswers(schema: FormSchema, currentAnswers: FormValues): FormValues;
|
|
673
727
|
|
|
674
|
-
export { type AccumulatorReport, type AccumulatorResponse, type AccumulatorSkipReason, type AnswerValidationResult, type AsyncTranslationAdapter, type BaseField, type BaseFieldConstraintRule, type BuilderTranslationKey, 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 ExtensibleNode, type FieldConstraintRule, 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 FormValue, type FormValues, type FormVersionRecord, type FormVersionState, type FormVersionStatus, type JsonValue, type LocalizedText, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, 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 TranslationReport, type TranslationSlot, 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, createCloneTransitionPlan, createDeleteDraftTransitionPlan, createPublishTransitionPlan, createResponseAccumulator, createSubmission, decodeSubmissionCursor, decodeTextAnswerCursor, deleteDraft, dispatchWebhook, encodeSubmissionCursor, encodeTextAnswerCursor, escapeCsvCell, exportResponsesToCsv, exportResponsesToCsvStream, isDisplayConditionSatisfied, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
|
|
728
|
+
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 LocalizedText, type MultiSelectField, type NodeWritableStream, type NumberField, type NumberQuestionAggregate, type NumericSummary, type OptionAggregate, type PagedSubmissionStorageAdapter, type PaginationIteratorOptions, type PopulateTranslationOptions, 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 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, isQuestionVisible, iterateSubmissionPages, jsonValuesEqual, matchesSubmissionFilter, matchesSubmissionPageFilters, normalizeSubmissionPageSize, pipeResponsesToCsvStream, populateSchemaTranslations, publishDraft, resolveFormTranslation, resolveLocalizedSchema, sanitizeSchema, selectVisibleAnswers, transformFieldType, validateAnswers, validateFormSchema, validatePageAnswers, validateSchemaStructure };
|