@case-framework/survey-core 0.1.0 → 0.2.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 +181 -0
- package/build/editor.d.mts +169 -5
- package/build/editor.d.mts.map +1 -1
- package/build/editor.mjs +429 -8
- package/build/editor.mjs.map +1 -1
- package/build/index.d.mts +189 -6
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +361 -2
- package/build/index.mjs.map +1 -1
- package/build/{package.json/package.json → package.json} +1 -1
- package/build/{survey-TUPUXiXl.d.mts → survey-D3sMutUV.d.mts} +63 -3
- package/build/{survey-TUPUXiXl.d.mts.map → survey-D3sMutUV.d.mts.map} +1 -1
- package/build/{survey-C3ZHI-5z.mjs → survey-DQmpzihl.mjs} +249 -183
- package/build/survey-DQmpzihl.mjs.map +1 -0
- package/package.json +1 -1
- package/build/survey-C3ZHI-5z.mjs.map +0 -1
package/build/editor.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.mjs","names":[],"sources":["../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"sourcesContent":["import { Survey } from \"../survey/survey\";\nimport { SurveyItemCore } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport { ReservedSurveyItemTypes } from \"../survey/items/types\";\nimport { SurveyItemTranslations, JsonComponentContent } from \"../survey/utils\";\nimport { RawSurveyItem } from \"../survey/items/survey-item-json\";\nimport { Target } from \"./types\";\nimport { generateId } from \"../utils\";\n\n\n// Serialized translation data format for clipboard\nexport type SerializedTranslations = {\n [locale: string]: JsonComponentContent;\n};\n\n// Clipboard data structure for copy-paste functionality\nexport interface SurveyItemClipboardData {\n type: 'survey-item';\n version: string;\n items: Array<{\n itemId: string;\n itemData: RawSurveyItem;\n }>;\n translations: { [itemId: string]: SerializedTranslations };\n rootItemId: string; // The id of the main item being copied\n timestamp: number;\n}\n\n\nexport class ItemCopyPaste {\n private survey: Survey;\n\n constructor(survey: Survey) {\n this.survey = survey;\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * When copying a group, automatically includes all items in the subtree\n * @param itemId - The id of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const item = this.survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Collect all items to copy (including subtree for groups)\n const itemsToCopy = this.collectItemsForCopy(itemId);\n\n // Create items array with their data\n const items = itemsToCopy.map(id => {\n const item = this.survey.surveyItems.get(id);\n if (!item) throw new Error(`Item with id '${id}' not found during copy`);\n return { itemId: id, itemData: item.rawItem };\n });\n\n // Collect translations for all items\n const translations: { [itemId: string]: SerializedTranslations } = {};\n itemsToCopy.forEach(id => {\n try {\n const itemTranslations = this.survey.getItemTranslations(id);\n if (itemTranslations?.locales?.length) {\n const serializedTranslations: SerializedTranslations = {};\n itemTranslations.locales.forEach(locale => {\n const localeContent = itemTranslations.getAllForLocale(locale);\n if (localeContent) {\n serializedTranslations[locale] = localeContent;\n }\n });\n translations[id] = serializedTranslations;\n } else {\n translations[id] = {};\n }\n } catch {\n translations[id] = {};\n }\n });\n\n // Create clipboard data\n const clipboardData: SurveyItemClipboardData = {\n type: 'survey-item',\n version: '1.0.0',\n items: items,\n translations: translations,\n rootItemId: itemId,\n timestamp: Date.now()\n };\n\n return clipboardData;\n }\n\n /**\n * Collect all items that should be copied, including subtree for groups\n * @param itemId - The root item id\n * @returns Array of item keys to copy\n */\n private collectItemsForCopy(itemId: string): string[] {\n const itemsToCopy: string[] = [itemId];\n const item = this.survey.surveyItems.get(itemId);\n\n if (!item) {\n return [];\n }\n\n // If this is a group item, collect all child items recursively\n if (item instanceof GroupItemCore) {\n const childIds = item.items;\n if (childIds.length > 0) {\n childIds.forEach(childId => {\n const childItems = this.collectItemsForCopy(childId);\n itemsToCopy.push(...childItems);\n });\n }\n }\n\n return itemsToCopy;\n }\n\n /**\n * Add an item to its parent group.\n * Ensures key uniqueness among siblings.\n * @param target - Target location information\n * @param item - The item to add (may have key adjusted for uniqueness)\n */\n private addItemToParentGroup(target: Target, item: SurveyItemCore): void {\n const parentGroup = this.survey.surveyItems.get(target.parentId);\n\n if (!parentGroup) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(parentGroup instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item`);\n }\n\n const siblingIds = parentGroup.items;\n const siblings = siblingIds\n .map(id => this.survey.surveyItems.get(id))\n .filter((s): s is SurveyItemCore => s !== undefined);\n const siblingKeys = new Set(siblings.map(s => s.key));\n\n let uniqueKey = item.key;\n if (siblingKeys.has(uniqueKey)) {\n let counter = 1;\n const originalKey = item.key;\n while (siblingKeys.has(uniqueKey)) {\n uniqueKey = originalKey + `_${counter}`;\n counter++;\n }\n if (uniqueKey !== item.key) {\n const updatedRawItem = { ...item.rawItem, key: uniqueKey };\n const newItem = this.survey.createItemFromRaw(updatedRawItem);\n this.survey.surveyItems.delete(item.id);\n this.survey.surveyItems.set(newItem.id, newItem);\n item = newItem;\n }\n }\n\n const insertIndex =\n target.index !== undefined\n ? Math.min(target.index, parentGroup.items.length)\n : parentGroup.items.length;\n\n parentGroup.addChild(item.id, insertIndex);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * Handles multiple items and subtrees from the clipboard data\n * @param clipboardData - The clipboard data containing the item(s) to paste\n * @param target - Target location where to paste the item\n * @returns The id of the pasted root item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n // Validate clipboard data\n if (!ItemCopyPaste.isValidClipboardData(clipboardData)) {\n throw new Error('Invalid clipboard data format');\n }\n\n // Create id mapping for all items in the subtree\n const idMapping: { [oldId: string]: string } = {};\n clipboardData.items.forEach(({ itemId }) => {\n idMapping[itemId] = generateId();\n });\n\n // Create all items with updated ids\n clipboardData.items.forEach(({ itemId, itemData }) => {\n const newId = idMapping[itemId];\n if (newId) {\n const updatedItemData = this.updateItemIdsInData(itemData, idMapping);\n updatedItemData.id = newId;\n\n const newItem = this.survey.createItemFromRaw(updatedItemData);\n this.survey.surveyItems.set(newItem.id, newItem);\n\n if (itemId === clipboardData.rootItemId) {\n this.addItemToParentGroup(target, newItem);\n }\n }\n });\n\n // Update translations with new IDs\n const updatedTranslations = this.updateTranslations(clipboardData.translations, idMapping);\n Object.keys(updatedTranslations).forEach(itemId => {\n // Convert serialized translations back to SurveyItemTranslations instance\n const itemTranslations = new SurveyItemTranslations();\n const serializedData = updatedTranslations[itemId];\n Object.keys(serializedData).forEach(locale => {\n itemTranslations.setAllForLocale(locale, serializedData[locale]);\n });\n this.survey.translations.setItemTranslations(itemId, itemTranslations);\n });\n\n // TODO: update prefill rules where needed to use the new keys\n\n return idMapping[clipboardData.rootItemId];\n }\n\n // PRIVATE HELPER METHODS\n /**\n * Update all item ids in the raw item data recursively\n */\n private updateItemIdsInData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): RawSurveyItem {\n const updatedData = JSON.parse(JSON.stringify(itemData));\n\n if (updatedData.itemType === ReservedSurveyItemTypes.Group && updatedData.config) {\n const config = updatedData.config as { items?: string[] };\n if (config.items) {\n config.items = config.items.map((childId: string) => idMapping[childId] ?? childId);\n }\n }\n\n this.updateExpressionsInItemData(updatedData, idMapping);\n return updatedData;\n }\n\n /**\n * Update expressions in item data that reference the old ids\n */\n private updateExpressionsInItemData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): void {\n\n // Update display conditions\n if (itemData.displayConditions?.root) {\n this.updateExpressionReferences(itemData.displayConditions.root, idMapping);\n }\n if (itemData.displayConditions?.components) {\n Object.values(itemData.displayConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update disabled conditions\n if (itemData.disabledConditions?.components) {\n Object.values(itemData.disabledConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update validations\n if (itemData.validations) {\n Object.values(itemData.validations).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n }\n\n /**\n * Update references in a single expression (recursive)\n */\n private updateExpressionReferences(\n expression: unknown,\n idMapping: { [oldId: string]: string }\n ): void {\n if (!expression || typeof expression !== 'object') {\n return;\n }\n\n const expr = expression as Record<string, unknown>;\n if (Array.isArray(expr.data)) {\n expr.data.forEach((arg: unknown) => {\n if (arg && typeof arg === 'object' && arg !== null && 'str' in arg) {\n const argObj = arg as { str?: string };\n if (\n typeof argObj.str === 'string' &&\n Object.prototype.hasOwnProperty.call(idMapping, argObj.str)\n ) {\n argObj.str = idMapping[argObj.str];\n }\n this.updateExpressionReferences(arg, idMapping);\n }\n });\n }\n\n Object.keys(expr).forEach(key => {\n const val = expr[key];\n if (val && typeof val === 'object') {\n this.updateExpressionReferences(val, idMapping);\n }\n });\n }\n\n /**\n* Update translation keys for the pasted item\n*/\n private updateTranslations(translations: { [itemId: string]: SerializedTranslations }, idMapping: { [oldId: string]: string }): { [itemId: string]: SerializedTranslations } {\n const newTranslations: { [itemId: string]: SerializedTranslations } = {};\n\n // Update ids for all items in the translation data\n Object.keys(translations).forEach(itemId => {\n const itemTranslations = translations[itemId];\n\n // Determine the new key for this item (update the key mapping)\n const newItemId = idMapping[itemId];\n\n // Copy the serialized translations as-is (content is preserved, only keys change)\n newTranslations[newItemId] = itemTranslations;\n });\n\n return newTranslations;\n }\n\n\n /**\n * Validate clipboard data format\n */\n static isValidClipboardData(data: unknown): data is SurveyItemClipboardData {\n if (typeof data !== 'object' || data === null || data === undefined) return false;\n const clipboardData = data as SurveyItemClipboardData;\n return (\n clipboardData.type === 'survey-item' &&\n clipboardData.version === '1.0.0' &&\n clipboardData.rootItemId !== undefined\n );\n }\n}\n","import { RawSurvey } from \"../survey/survey-file-schema\";\nimport { structuredCloneMethod } from \"../utils\";\n\nexport interface UndoRedoConfig {\n maxTotalMemoryMB: number;\n minHistorySize: number;\n maxHistorySize: number;\n}\n\nexport const CommitSource = {\n USER: \"user\",\n SYSTEM: \"system\",\n} as const;\nexport type CommitSource = typeof CommitSource[keyof typeof CommitSource];\n\nexport interface CommitMeta {\n label: string;\n source?: CommitSource;\n}\n\n\ninterface HistoryEntry {\n survey: RawSurvey;\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n}\n\n// Memory calculation utilities\nclass MemoryCalculator {\n private static encoder = new TextEncoder();\n\n static calculateSize(obj: object): number {\n const jsonString = JSON.stringify(obj);\n return this.encoder.encode(jsonString).length;\n }\n\n static formatBytes(bytes: number): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(1)} ${units[unitIndex]}`;\n }\n}\n\n\nexport class SurveyEditorUndoRedo {\n private history: HistoryEntry[] = [];\n private currentIndex: number = -1;\n private _config: UndoRedoConfig;\n\n constructor(initialSurvey: RawSurvey, config: Partial<UndoRedoConfig> = {}, meta: CommitMeta = { label: 'Initial state', source: CommitSource.SYSTEM }) {\n this._config = {\n maxTotalMemoryMB: 50,\n minHistorySize: 10,\n maxHistorySize: 200,\n ...config\n };\n\n this.saveSnapshot(initialSurvey, meta);\n }\n\n\n private saveSnapshot(survey: RawSurvey, meta: CommitMeta): void {\n const memorySize = MemoryCalculator.calculateSize(survey);\n\n // Remove any history after current index\n this.history = this.history.slice(0, this.currentIndex + 1);\n\n // Add new snapshot\n this.history.push({\n survey: structuredCloneMethod(survey),\n timestamp: Date.now(),\n meta,\n memorySize\n });\n\n this.currentIndex++;\n\n // Clean up history based on memory usage\n this.cleanupHistory();\n }\n\n private cleanupHistory(): void {\n let totalMemory = this.getTotalMemoryUsage();\n const maxMemoryBytes = this._config.maxTotalMemoryMB * 1024 * 1024;\n\n // Remove oldest snapshots while preserving minimum\n while (this.history.length > this._config.minHistorySize &&\n (totalMemory > maxMemoryBytes || this.history.length > this._config.maxHistorySize)) {\n\n const removedSnapshot = this.history.shift();\n this.currentIndex--;\n\n if (removedSnapshot) {\n totalMemory -= removedSnapshot.memorySize;\n }\n }\n }\n\n private getTotalMemoryUsage(): number {\n return this.history.reduce((total, entry) => total + entry.memorySize, 0);\n }\n\n // Commit a change to history\n commit(survey: RawSurvey, meta: CommitMeta): void {\n this.saveSnapshot(survey, meta);\n }\n\n // Get current committed state\n getCurrentState(): RawSurvey {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error('Invalid history state');\n }\n return structuredCloneMethod(this.history[this.currentIndex].survey);\n }\n\n undo(): RawSurvey | null {\n if (!this.canUndo()) return null;\n\n this.currentIndex--;\n return this.getCurrentState();\n }\n\n redo(): RawSurvey | null {\n if (!this.canRedo()) return null;\n\n this.currentIndex++;\n return this.getCurrentState();\n }\n\n canUndo(): boolean {\n return this.currentIndex > 0;\n }\n\n canRedo(): boolean {\n return this.currentIndex < this.history.length - 1;\n }\n\n getUndoMeta(): CommitMeta | null {\n if (!this.canUndo()) return null;\n return this.history[this.currentIndex].meta;\n }\n\n getRedoMeta(): CommitMeta | null {\n if (!this.canRedo()) return null;\n return this.history[this.currentIndex + 1].meta;\n }\n\n getMemoryUsage(): { totalMB: number; entries: number } {\n return {\n totalMB: this.getTotalMemoryUsage() / (1024 * 1024),\n entries: this.history.length\n };\n }\n\n getConfig(): UndoRedoConfig {\n return { ...this._config };\n }\n\n /**\n * Get the full history list with metadata\n */\n getHistory(): Array<{\n index: number;\n meta: CommitMeta;\n timestamp: number;\n memorySize: number;\n isCurrent: boolean;\n }> {\n return this.history.map((entry, index) => ({\n index,\n meta: entry.meta,\n timestamp: entry.timestamp,\n memorySize: entry.memorySize,\n isCurrent: index === this.currentIndex\n }));\n }\n\n /**\n * Get the current index in the history\n */\n getCurrentIndex(): number {\n return this.currentIndex;\n }\n\n /**\n * Get the total number of history entries\n */\n getHistoryLength(): number {\n return this.history.length;\n }\n\n /**\n * Jump to a specific index in the history (can go forward or backward)\n * @param targetIndex The index to jump to\n * @returns The survey state at the target index, or null if invalid\n */\n jumpToIndex(targetIndex: number): RawSurvey | null {\n if (targetIndex < 0 || targetIndex >= this.history.length || targetIndex === this.currentIndex) {\n return null;\n }\n\n this.currentIndex = targetIndex;\n return this.getCurrentState();\n }\n\n /**\n * Check if we can jump to a specific index\n */\n canJumpToIndex(targetIndex: number): boolean {\n return targetIndex >= 0 && targetIndex < this.history.length && targetIndex !== this.currentIndex;\n }\n\n /**\n * Serialize the undo/redo state to JSON\n * @returns A JSON-serializable object containing the complete state\n */\n serialize(): {\n history: Array<HistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n } {\n return {\n history: this.history.map(entry => ({\n survey: entry.survey,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n })),\n currentIndex: this.currentIndex,\n config: { ...this._config }\n };\n }\n\n /**\n * Create a new SurveyEditorUndoRedo instance from JSON data\n * @param jsonData The serialized undo/redo state\n * @returns A new SurveyEditorUndoRedo instance with the restored state\n */\n static deserialize(jsonData: {\n history: Array<{\n survey: RawSurvey;\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n }>;\n currentIndex: number;\n config: UndoRedoConfig;\n }): SurveyEditorUndoRedo {\n if (!jsonData.history || !Array.isArray(jsonData.history) || jsonData.history.length === 0) {\n throw new Error('Invalid object: history must be an array and must not be empty');\n }\n\n if (typeof jsonData.currentIndex !== 'number' ||\n jsonData.currentIndex < 0 ||\n jsonData.currentIndex >= jsonData.history.length) {\n throw new Error('Invalid object: currentIndex must be a valid index within the history array');\n }\n\n if (!jsonData.config) {\n throw new Error('Invalid object: config is required');\n }\n\n // Create a new instance with the first survey and config\n const instance = new SurveyEditorUndoRedo(jsonData.history[0].survey, jsonData.config);\n\n // Clear the default initial state and restore the full history\n instance.history = jsonData.history.map(entry => ({\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n }));\n\n instance.currentIndex = jsonData.currentIndex;\n\n return instance;\n }\n\n}\n","import { Survey } from \"../survey/survey\";\nimport { CommitMeta, CommitSource, SurveyEditorUndoRedo, type UndoRedoConfig } from \"./undo-redo\";\nimport { SurveyItemTranslations } from \"../survey/utils\";\nimport { RawSurvey } from \"../survey/survey-file-schema\";\nimport { ItemCopyPaste, SurveyItemClipboardData } from \"./item-copy-paste\";\nimport { Target } from \"./types\";\nimport { SurveyItemCore } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { ItemTypeRegistry } from \"../survey/registry/item-registry\";\n\n\n// Interface for serializing SurveyEditor state\nexport interface SerializedSurveyEditor {\n version: string;\n survey: RawSurvey;\n undoRedo: ReturnType<SurveyEditorUndoRedo['serialize']>;\n hasUncommittedChanges: boolean;\n}\n\n\nexport interface SurveyEditorConfig extends Partial<UndoRedoConfig> {\n /** Plugin registry for deserializing survey state during undo/redo. Required when survey contains custom item types. */\n pluginRegistry?: ItemTypeRegistry;\n}\n\nexport class SurveyEditor {\n private _survey: Survey;\n private _undoRedo: SurveyEditorUndoRedo;\n private _hasUncommittedChanges: boolean = false;\n private _pluginRegistry?: ItemTypeRegistry;\n\n constructor(\n survey: Survey,\n config: SurveyEditorConfig = {},\n meta?: CommitMeta,\n ) {\n this._survey = survey;\n const { pluginRegistry, ...undoRedoConfig } = config;\n this._pluginRegistry = pluginRegistry;\n this._undoRedo = new SurveyEditorUndoRedo(survey.serialize(), undoRedoConfig, meta);\n }\n\n get survey(): Survey {\n return this._survey;\n }\n\n get hasUncommittedChanges(): boolean {\n return this._hasUncommittedChanges;\n }\n\n // Expose the undo-redo instance directly\n get undoRedo(): SurveyEditorUndoRedo {\n return this._undoRedo;\n }\n\n // Commit current changes to undo/redo history\n commit(meta: CommitMeta): void {\n this._undoRedo.commit(this._survey.serialize(), meta);\n this._hasUncommittedChanges = false;\n }\n\n commitIfNeeded(): void {\n if (this._hasUncommittedChanges) {\n this.commit({\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n });\n }\n }\n\n // Undo to previous state\n undo(): boolean {\n if (this._hasUncommittedChanges) {\n // If there are uncommitted changes, revert to last committed state\n this._survey = Survey.fromJson(this._undoRedo.getCurrentState(), this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n } else {\n // Normal undo operation\n const previousState = this._undoRedo.undo();\n if (previousState) {\n this._survey = Survey.fromJson(previousState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n }\n\n // Redo to next state\n redo(): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot redo when there are uncommitted changes\n return false;\n }\n\n const nextState = this._undoRedo.redo();\n if (nextState) {\n this._survey = Survey.fromJson(nextState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n // Enhanced undo/redo methods that use the exposed instance\n /**\n * Jump to a specific index in the history (can go forward or backward)\n */\n jumpToIndex(targetIndex: number): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot jump to specific index with uncommitted changes\n return false;\n }\n\n const targetState = this._undoRedo.jumpToIndex(targetIndex);\n if (targetState) {\n this._survey = Survey.fromJson(targetState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n canUndo(): boolean {\n return this._hasUncommittedChanges || this._undoRedo.canUndo();\n }\n\n canRedo(): boolean {\n return !this._hasUncommittedChanges && this._undoRedo.canRedo();\n }\n\n getUndoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return {\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n };\n }\n return this._undoRedo.getUndoMeta();\n }\n\n getRedoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return null;\n }\n return this._undoRedo.getRedoMeta();\n }\n\n // Get memory usage statistics\n getMemoryUsage(): { totalMB: number; entries: number } {\n return this._undoRedo.getMemoryUsage();\n }\n\n // Get undo/redo configuration\n getUndoRedoConfig(): UndoRedoConfig {\n return this._undoRedo.getConfig();\n }\n\n /**\n * Serialize the SurveyEditor state to JSON\n * @returns A JSON-serializable object containing the complete editor state\n */\n toJson(): SerializedSurveyEditor {\n return {\n version: '1.0.0',\n survey: this._survey.serialize(),\n undoRedo: this._undoRedo.serialize(),\n hasUncommittedChanges: this._hasUncommittedChanges\n };\n }\n\n /**\n * Create a new SurveyEditor instance from JSON data\n * @param jsonData The serialized editor state\n * @param pluginRegistry Optional plugin registry for deserializing survey state (required when survey contains custom item types)\n * @returns A new SurveyEditor instance with the restored state\n */\n static fromJson(jsonData: SerializedSurveyEditor, pluginRegistry?: ItemTypeRegistry): SurveyEditor {\n if (!jsonData.survey) {\n throw new Error('Invalid object: survey is required');\n }\n\n if (!jsonData.undoRedo) {\n throw new Error('Invalid object: undoRedo is required');\n }\n\n if (typeof jsonData.hasUncommittedChanges !== 'boolean') {\n throw new Error('Invalid object: hasUncommittedChanges must be a boolean');\n }\n\n // Validate version (for future compatibility)\n if (jsonData.version && !jsonData.version.startsWith('1.')) {\n console.warn(`Warning: Loading SurveyEditor with version ${jsonData.version}, current version is 1.0.0`);\n }\n\n // Create survey from JSON\n const survey = Survey.fromJson(jsonData.survey, pluginRegistry);\n\n // Create a new editor instance\n const editor = new SurveyEditor(survey, { pluginRegistry });\n\n // Restore undo/redo state\n editor._undoRedo = SurveyEditorUndoRedo.deserialize(jsonData.undoRedo);\n\n // Restore uncommitted changes flag\n editor._hasUncommittedChanges = jsonData.hasUncommittedChanges;\n\n return editor;\n }\n\n private markAsModified(): void {\n this._hasUncommittedChanges = true;\n }\n\n addItem(\n target: Target,\n item: SurveyItemCore,\n content?: SurveyItemTranslations,\n ): void {\n // Mark as modified (uncommitted change)\n this.markAsModified();\n\n // Find the parent group item\n let parentGroup: GroupItemCore;\n\n if (!target) {\n // If no target provided, add to root\n\n const rootItem = this._survey.rootItem;\n if (!rootItem) {\n throw new Error('No root group found in survey');\n }\n if (!(rootItem instanceof GroupItemCore)) {\n throw new Error('Root item is not a group item');\n }\n parentGroup = rootItem;\n } else {\n // Find the target parent group\n const targetItem = this._survey.surveyItems.get(target.parentId);\n\n if (!targetItem) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item (${targetItem.type})`);\n }\n\n parentGroup = targetItem;\n }\n\n if (parentGroup.hasChild(item.id)) {\n throw new Error(`Item ${item.id} already in this group`);\n }\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => parentGroup.items?.includes(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n\n // Determine insertion index\n let insertIndex: number;\n if (target?.index !== undefined) {\n // Insert at specified index, or at end if index is larger than array length\n insertIndex = Math.min(target.index, parentGroup.items.length);\n } else {\n // Insert at the end\n insertIndex = parentGroup.items.length;\n }\n\n // Add the item to the survey items collection\n this._survey.surveyItems.set(item.id, item);\n\n // Add the item key to the parent group's items array\n parentGroup.items.splice(insertIndex, 0, item.id);\n\n // Update translations in the survey\n if (content) {\n this._survey.translations.setItemTranslations(item.id, content);\n }\n }\n\n // Remove an item from the survey\n removeItem(itemId: string, nested: boolean = false): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n // Find parent group and remove from its items array\n const parentItem = this._survey.getParentItem(itemId);\n if (!parentItem) {\n throw new Error(`Item with id '${itemId}' is the root item`);\n }\n\n\n if (item instanceof GroupItemCore) {\n for (const childId of item.getChildrenIds()) {\n this.removeItem(childId, true);\n }\n }\n\n // Remove from survey items\n this._survey.surveyItems.delete(itemId);\n\n // Remove translations\n this._survey.translations?.onItemDeleted(itemId);\n\n if (!nested) {\n parentItem.removeChild(itemId);\n }\n return true;\n }\n\n // Move an item to a different position\n moveItem(itemId: string, newTarget: Target): boolean {\n this.markAsModified();\n // Check if item exists\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Check if new target exists and is a group\n const targetItem = this._survey.surveyItems.get(newTarget.parentId);\n if (!targetItem) {\n throw new Error(`Target parent with id '${newTarget.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Target parent '${newTarget.parentId}' is not a group item (${targetItem.type})`);\n }\n\n // Check if new target is not a child of the current item (prevent circular reference)\n if (this._survey.isDescendantOf(newTarget.parentId, itemId)) {\n throw new Error(`Cannot move item '${itemId}' to its descendant '${newTarget.parentId}'`);\n }\n\n // If the item is already in the target parent\n const currentParentItem = this._survey.getParentItem(itemId);\n if (currentParentItem?.id === newTarget.parentId) {\n throw new Error(`Item '${itemId}' is already in the target parent '${newTarget.parentId}'`);\n }\n\n // Remove item from current parent's items array\n if (currentParentItem) {\n const currentParentGroup = currentParentItem as GroupItemCore;\n currentParentGroup.removeChild(itemId);\n }\n\n // Add item to new parent's items array\n const targetGroup = targetItem as GroupItemCore;\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => targetGroup.hasChild(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n const insertIndex = newTarget.index !== undefined ?\n Math.min(newTarget.index, targetGroup.items.length) :\n targetGroup.items.length;\n\n targetGroup.items.splice(insertIndex, 0, itemId);\n\n return true;\n }\n\n // TODO: add also to update component translations (updating part of the item)\n // Update item translations\n updateItemTranslations(itemId: string, updatedContent?: SurveyItemTranslations): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n this._survey.translations.setItemTranslations(itemId, updatedContent);\n\n return true;\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * @param itemKey - The full key of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemKey: string): SurveyItemClipboardData {\n const copyPaste = new ItemCopyPaste(this._survey);\n return copyPaste.copyItem(itemKey);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * @param clipboardData - The clipboard data containing the item to paste\n * @param target - Target location where to paste the item\n * @returns The full key of the pasted item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n this.markAsModified();\n const copyPaste = new ItemCopyPaste(this._survey);\n const newFullKey = copyPaste.pasteItem(clipboardData, target);\n\n\n return newFullKey;\n }\n}\n"],"mappings":";;;AA6BA,IAAa,gBAAb,MAAa,cAAc;CACzB,AAAQ;CAER,YAAY,QAAgB;AAC1B,OAAK,SAAS;;;;;;;;CAShB,SAAS,QAAyC;AAEhD,MAAI,CADS,KAAK,OAAO,YAAY,IAAI,OAAO,CAE9C,OAAM,IAAI,MAAM,iBAAiB,OAAO,aAAa;EAIvD,MAAM,cAAc,KAAK,oBAAoB,OAAO;EAGpD,MAAM,QAAQ,YAAY,KAAI,OAAM;GAClC,MAAM,OAAO,KAAK,OAAO,YAAY,IAAI,GAAG;AAC5C,OAAI,CAAC,KAAM,OAAM,IAAI,MAAM,iBAAiB,GAAG,yBAAyB;AACxE,UAAO;IAAE,QAAQ;IAAI,UAAU,KAAK;IAAS;IAC7C;EAGF,MAAM,eAA6D,EAAE;AACrE,cAAY,SAAQ,OAAM;AACxB,OAAI;IACF,MAAM,mBAAmB,KAAK,OAAO,oBAAoB,GAAG;AAC5D,QAAI,kBAAkB,SAAS,QAAQ;KACrC,MAAM,yBAAiD,EAAE;AACzD,sBAAiB,QAAQ,SAAQ,WAAU;MACzC,MAAM,gBAAgB,iBAAiB,gBAAgB,OAAO;AAC9D,UAAI,cACF,wBAAuB,UAAU;OAEnC;AACF,kBAAa,MAAM;UAEnB,cAAa,MAAM,EAAE;WAEjB;AACN,iBAAa,MAAM,EAAE;;IAEvB;AAYF,SAT+C;GAC7C,MAAM;GACN,SAAS;GACF;GACO;GACd,YAAY;GACZ,WAAW,KAAK,KAAK;GACtB;;;;;;;CAUH,AA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AAI;AAChB;;EAGF,MAAM,cAAc,UAAU,UAAU,SACtC,KAAK,IAAI,UAAU,OAAO,YAAY,MAAM,OAAO,GACnD,YAAY,MAAM;AAEpB,cAAY,MAAM,OAAO,aAAa,GAAG,OAAO;AAEhD,SAAO;;CAKT,uBAAuB,QAAgB,gBAAkD;AACvF,OAAK,gBAAgB;AAErB,MAAI,CADS,KAAK,QAAQ,YAAY,IAAI,OAAO,CAE/C,OAAM,IAAI,MAAM,iBAAiB,OAAO,aAAa;AAGvD,OAAK,QAAQ,aAAa,oBAAoB,QAAQ,eAAe;AAErE,SAAO;;;;;;;CAQT,SAAS,SAA0C;AAEjD,SADkB,IAAI,cAAc,KAAK,QAAQ,CAChC,SAAS,QAAQ;;;;;;;;CASpC,UAAU,eAAwC,QAAwB;AACxE,OAAK,gBAAgB;AAKrB,SAJkB,IAAI,cAAc,KAAK,QAAQ,CACpB,UAAU,eAAe,OAAO"}
|
|
1
|
+
{"version":3,"file":"editor.mjs","names":[],"sources":["../src/editor/ai-context.ts","../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"sourcesContent":["import { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { RawSurvey } from \"../survey/survey-file-schema\";\nimport { Survey } from \"../survey/survey\";\nimport type { Content } from \"../survey/utils/content\";\n\nexport type SurveyAIContextScope = \"tiny\" | \"focused\" | \"full\";\nexport type SurveyAIContextPurpose =\n | \"generic\"\n | \"key-suggestion\"\n | \"label-suggestion\"\n | \"item-generation\"\n | \"translation\"\n | \"condition-management\";\n\nexport interface SurveyAIOutlineNode {\n itemId: string;\n parentId?: string;\n depth: number;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n childCount: number;\n}\n\nexport interface SurveyAIFocus {\n focusItemId: string;\n parentItemId?: string;\n pathItemIds: string[];\n siblingItemIds: string[];\n childItemIds: string[];\n}\n\nexport interface SurveyAITranslationSnippet {\n locale: string;\n contentKey: string;\n text: string;\n}\n\nexport interface SurveyAIItemContextNode {\n itemId: string;\n itemType: string;\n itemKey: string;\n fullKey: string;\n itemLabel?: string;\n siblingKeys: string[];\n translations: SurveyAITranslationSnippet[];\n descendants: SurveyAIItemContextNode[];\n}\n\nexport interface SurveyAIKeyIndexEntry {\n itemId: string;\n itemType: string;\n key: string;\n fullKey: string;\n itemLabel?: string;\n path: string[];\n}\n\nexport interface SurveyAIContextIndexes {\n keyIndex: SurveyAIKeyIndexEntry[];\n responseSlots?: string[];\n}\n\nexport interface SurveyAIContextPack {\n purpose: SurveyAIContextPurpose;\n scope: SurveyAIContextScope;\n surveyKey?: string;\n locales: string[];\n itemCount: number;\n outline: SurveyAIOutlineNode[];\n focus?: SurveyAIFocus;\n focusItem?: SurveyAIItemContextNode;\n indexes?: SurveyAIContextIndexes;\n flags: {\n outlineTruncated: boolean;\n rawSurveyIncluded: boolean;\n focusItemTreeTruncated: boolean;\n };\n rawSurvey?: RawSurvey;\n}\n\nexport interface BuildSurveyAIContextPackOptions {\n purpose?: SurveyAIContextPurpose;\n scope?: SurveyAIContextScope;\n focusItemId?: string;\n includeRawSurvey?: boolean;\n outlineLimit?: number;\n includeIndexes?: boolean;\n includeFocusItemTree?: boolean;\n focusItemTreeLimit?: number;\n translationSnippetsPerItemLimit?: number;\n translationSnippetTextLimit?: number;\n}\n\nconst DEFAULT_SCOPE_LIMITS: Record<SurveyAIContextScope, number> = {\n tiny: 40,\n focused: 150,\n full: 500,\n};\n\nconst DEFAULT_FOCUS_TREE_LIMIT = 120;\nconst DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM = 8;\nconst DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT = 120;\n\nconst PURPOSE_DEFAULTS: Record<\n SurveyAIContextPurpose,\n {\n scope: SurveyAIContextScope;\n includeRawSurvey: boolean;\n includeIndexes: boolean;\n includeFocusItemTree: boolean;\n }\n> = {\n generic: {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: false,\n },\n \"key-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"label-suggestion\": {\n scope: \"tiny\",\n includeRawSurvey: false,\n includeIndexes: false,\n includeFocusItemTree: true,\n },\n \"item-generation\": {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n translation: {\n scope: \"focused\",\n includeRawSurvey: false,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n \"condition-management\": {\n scope: \"full\",\n includeRawSurvey: true,\n includeIndexes: true,\n includeFocusItemTree: true,\n },\n};\n\nconst sortByItemId = <T extends { itemId: string }>(items: T[]): T[] =>\n [...items].sort((a, b) => a.itemId.localeCompare(b.itemId));\n\nfunction getChildIds(survey: Survey, itemId: string): string[] {\n const item = survey.surveyItems.get(itemId);\n if (!(item instanceof GroupItemCore)) {\n return [];\n }\n return [...(item.items ?? [])];\n}\n\nfunction buildParentLookup(survey: Survey): Map<string, string> {\n const lookup = new Map<string, string>();\n for (const item of survey.surveyItems.values()) {\n if (!(item instanceof GroupItemCore)) {\n continue;\n }\n for (const childId of item.items ?? []) {\n lookup.set(childId, item.id);\n }\n }\n return lookup;\n}\n\nfunction createFullKeyGetter(survey: Survey, parentLookup: Map<string, string>) {\n const fullKeyCache = new Map<string, string>();\n\n const getFullKey = (itemId: string, stack = new Set<string>()): string => {\n const cached = fullKeyCache.get(itemId);\n if (cached) {\n return cached;\n }\n\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return itemId;\n }\n\n if (stack.has(itemId)) {\n return item.key;\n }\n\n const parentId = parentLookup.get(itemId);\n if (!parentId) {\n fullKeyCache.set(itemId, item.key);\n return item.key;\n }\n\n stack.add(itemId);\n const parentFullKey = getFullKey(parentId, stack);\n stack.delete(itemId);\n const fullKey = `${parentFullKey}.${item.key}`;\n fullKeyCache.set(itemId, fullKey);\n return fullKey;\n };\n\n return getFullKey;\n}\n\nfunction buildFullOutline(\n survey: Survey,\n parentLookup: Map<string, string>,\n getFullKey: (itemId: string) => string,\n): SurveyAIOutlineNode[] {\n const outline: SurveyAIOutlineNode[] = [];\n const visited = new Set<string>();\n\n const toNode = (itemId: string, depth: number): SurveyAIOutlineNode | undefined => {\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n const childCount = item instanceof GroupItemCore ? item.items.length : 0;\n return {\n itemId,\n parentId: parentLookup.get(itemId),\n depth,\n itemType: item.type,\n key: item.key,\n fullKey: getFullKey(itemId),\n itemLabel: item.metadata?.itemLabel,\n childCount,\n };\n };\n\n const visit = (itemId: string, depth: number) => {\n if (visited.has(itemId)) {\n return;\n }\n visited.add(itemId);\n const node = toNode(itemId, depth);\n if (node) {\n outline.push(node);\n }\n for (const childId of getChildIds(survey, itemId)) {\n visit(childId, depth + 1);\n }\n };\n\n const root = survey.rootItem;\n if (root) {\n visit(root.id, 0);\n }\n\n const remaining = sortByItemId(\n Array.from(survey.surveyItems.values())\n .filter((item) => !visited.has(item.id))\n .map((item) => ({ itemId: item.id })),\n );\n for (const item of remaining) {\n visit(item.itemId, 0);\n }\n\n return outline;\n}\n\nfunction collectTinyScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = new Set<string>();\n const rootItem = survey.rootItem;\n if (rootItem) {\n ids.add(rootItem.id);\n }\n\n ids.add(focusItemId);\n for (const id of survey.getItemPath(focusItemId)) {\n ids.add(id);\n }\n\n for (const sibling of survey.getSiblings(focusItemId)) {\n ids.add(sibling.id);\n }\n\n for (const childId of getChildIds(survey, focusItemId)) {\n ids.add(childId);\n }\n\n return ids;\n}\n\nfunction addDescendants(\n survey: Survey,\n itemId: string,\n set: Set<string>,\n maxDepth: number,\n): void {\n const queue: Array<{ id: string; depth: number }> = [{ id: itemId, depth: 0 }];\n while (queue.length > 0) {\n const current = queue.shift();\n if (!current) {\n continue;\n }\n if (current.depth >= maxDepth) {\n continue;\n }\n for (const childId of getChildIds(survey, current.id)) {\n set.add(childId);\n queue.push({ id: childId, depth: current.depth + 1 });\n }\n }\n}\n\nfunction collectFocusedScopeIds(survey: Survey, focusItemId: string): Set<string> {\n const ids = collectTinyScopeIds(survey, focusItemId);\n const ancestors = survey.getItemPath(focusItemId);\n\n addDescendants(survey, focusItemId, ids, 2);\n for (const sibling of survey.getSiblings(focusItemId)) {\n if (sibling.id === focusItemId) {\n continue;\n }\n ids.add(sibling.id);\n addDescendants(survey, sibling.id, ids, 1);\n }\n\n for (const ancestorId of ancestors) {\n const parent = survey.getParentItem(ancestorId);\n const siblingIds = (parent?.items ?? []).filter((id) => id !== ancestorId);\n for (const siblingId of siblingIds) {\n ids.add(siblingId);\n addDescendants(survey, siblingId, ids, 1);\n }\n }\n\n return ids;\n}\n\nfunction buildFocusInfo(survey: Survey, focusItemId: string): SurveyAIFocus | undefined {\n if (!survey.surveyItems.has(focusItemId)) {\n return undefined;\n }\n\n const pathItemIds = [...survey.getItemPath(focusItemId), focusItemId];\n const parentItemId = survey.getParentItem(focusItemId)?.id;\n const siblingItemIds = survey\n .getSiblings(focusItemId)\n .filter((item) => item.id !== focusItemId)\n .map((item) => item.id);\n const childItemIds = getChildIds(survey, focusItemId);\n\n return {\n focusItemId,\n parentItemId,\n pathItemIds,\n siblingItemIds,\n childItemIds,\n };\n}\n\nconst normalizeSnippetText = (text: string, maxChars: number): string => {\n return text.trim().replace(/\\s+/g, \" \").slice(0, maxChars);\n};\n\nconst getContentText = (content: Content | undefined, maxChars: number): string | null => {\n if (!content) {\n return null;\n }\n const maybeText = (content as { content?: unknown }).content;\n if (typeof maybeText !== \"string\") {\n return null;\n }\n const normalized = normalizeSnippetText(maybeText, maxChars);\n return normalized.length > 0 ? normalized : null;\n};\n\nfunction getItemTranslationSnippets(\n survey: Survey,\n itemId: string,\n maxSnippets: number,\n textLimit: number,\n): SurveyAITranslationSnippet[] {\n const snippets: SurveyAITranslationSnippet[] = [];\n const translations = survey.getItemTranslations(itemId);\n if (!translations) {\n return snippets;\n }\n\n for (const locale of translations.locales) {\n const localeContent = translations.getAllForLocale(locale);\n if (!localeContent) {\n continue;\n }\n\n for (const [contentKey, content] of Object.entries(localeContent)) {\n const text = getContentText(content, textLimit);\n if (!text) {\n continue;\n }\n snippets.push({ locale, contentKey, text });\n if (snippets.length >= maxSnippets) {\n return snippets;\n }\n }\n }\n\n return snippets;\n}\n\nfunction buildFocusItemTree(\n survey: Survey,\n focusItemId: string,\n getFullKey: (itemId: string) => string,\n options: {\n treeLimit: number;\n snippetsPerItem: number;\n snippetTextLimit: number;\n },\n): { focusItem?: SurveyAIItemContextNode; truncated: boolean } {\n if (!survey.surveyItems.has(focusItemId)) {\n return { truncated: false };\n }\n\n let remainingBudget = options.treeLimit;\n let truncated = false;\n\n const visit = (itemId: string): SurveyAIItemContextNode | undefined => {\n if (remainingBudget <= 0) {\n truncated = true;\n return undefined;\n }\n const item = survey.surveyItems.get(itemId);\n if (!item) {\n return undefined;\n }\n remainingBudget -= 1;\n\n const siblingKeys = survey\n .getSiblings(itemId)\n .filter((sibling) => sibling.id !== itemId)\n .map((sibling) => sibling.key);\n\n const descendants: SurveyAIItemContextNode[] = [];\n if (item instanceof GroupItemCore) {\n for (const childId of item.items) {\n const childNode = visit(childId);\n if (childNode) {\n descendants.push(childNode);\n }\n }\n }\n\n return {\n itemId: item.id,\n itemType: item.type,\n itemKey: item.key,\n fullKey: getFullKey(item.id),\n itemLabel: item.metadata?.itemLabel,\n siblingKeys,\n translations: getItemTranslationSnippets(\n survey,\n item.id,\n options.snippetsPerItem,\n options.snippetTextLimit,\n ),\n descendants,\n };\n };\n\n return {\n focusItem: visit(focusItemId),\n truncated,\n };\n}\n\nfunction buildContextIndexes(\n survey: Survey,\n fullOutline: SurveyAIOutlineNode[],\n purpose: SurveyAIContextPurpose,\n): SurveyAIContextIndexes {\n const keyIndex: SurveyAIKeyIndexEntry[] = fullOutline.map((node) => ({\n itemId: node.itemId,\n itemType: node.itemType,\n key: node.key,\n fullKey: node.fullKey,\n itemLabel: node.itemLabel,\n path: node.fullKey.split(\".\").slice(0, -1),\n }));\n\n const indexes: SurveyAIContextIndexes = {\n keyIndex,\n };\n\n if (purpose === \"condition-management\") {\n indexes.responseSlots = Object.keys(survey.getAvailableResponseValueSlots());\n }\n\n return indexes;\n}\n\nexport function buildSurveyAIContextPack(\n survey: Survey,\n options: BuildSurveyAIContextPackOptions = {},\n): SurveyAIContextPack {\n const purpose = options.purpose ?? \"generic\";\n const purposeDefaults = PURPOSE_DEFAULTS[purpose];\n const scope = options.scope ?? purposeDefaults.scope;\n const defaultLimit = DEFAULT_SCOPE_LIMITS[scope];\n const outlineLimit = Math.max(1, options.outlineLimit ?? defaultLimit);\n const includeRawSurvey = options.includeRawSurvey ?? purposeDefaults.includeRawSurvey;\n const includeIndexes = options.includeIndexes ?? purposeDefaults.includeIndexes;\n const includeFocusItemTree = options.includeFocusItemTree ?? purposeDefaults.includeFocusItemTree;\n const focusItemId = options.focusItemId;\n const focusExists = Boolean(focusItemId && survey.surveyItems.has(focusItemId));\n\n const parentLookup = buildParentLookup(survey);\n const getFullKey = createFullKeyGetter(survey, parentLookup);\n const fullOutline = buildFullOutline(survey, parentLookup, getFullKey);\n\n let scopedOutline = fullOutline;\n if (scope === \"tiny\" && focusItemId && focusExists) {\n const includedIds = collectTinyScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n } else if (scope === \"focused\" && focusItemId && focusExists) {\n const includedIds = collectFocusedScopeIds(survey, focusItemId);\n scopedOutline = fullOutline.filter((node) => includedIds.has(node.itemId));\n }\n\n const outlineTruncated = scopedOutline.length > outlineLimit;\n const outline = outlineTruncated\n ? scopedOutline.slice(0, outlineLimit)\n : scopedOutline;\n\n let focusItemTreeTruncated = false;\n let focusItem: SurveyAIItemContextNode | undefined;\n if (includeFocusItemTree && focusItemId && focusExists) {\n const focusTreeResult = buildFocusItemTree(survey, focusItemId, getFullKey, {\n treeLimit: Math.max(1, options.focusItemTreeLimit ?? DEFAULT_FOCUS_TREE_LIMIT),\n snippetsPerItem: Math.max(1, options.translationSnippetsPerItemLimit ?? DEFAULT_TRANSLATION_SNIPPETS_PER_ITEM),\n snippetTextLimit: Math.max(1, options.translationSnippetTextLimit ?? DEFAULT_TRANSLATION_SNIPPET_TEXT_LIMIT),\n });\n focusItemTreeTruncated = focusTreeResult.truncated;\n focusItem = focusTreeResult.focusItem;\n }\n\n return {\n purpose,\n scope,\n surveyKey: survey.surveyKey,\n locales: [...survey.locales],\n itemCount: survey.surveyItems.size,\n outline,\n focus: focusItemId ? buildFocusInfo(survey, focusItemId) : undefined,\n focusItem,\n indexes: includeIndexes ? buildContextIndexes(survey, fullOutline, purpose) : undefined,\n flags: {\n outlineTruncated,\n rawSurveyIncluded: includeRawSurvey,\n focusItemTreeTruncated,\n },\n rawSurvey: includeRawSurvey ? survey.serialize() : undefined,\n };\n}\n","import { Survey } from \"../survey/survey\";\nimport { SurveyItemCore } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport { ReservedSurveyItemTypes } from \"../survey/items/types\";\nimport { SurveyItemTranslations, JsonComponentContent } from \"../survey/utils\";\nimport { RawSurveyItem } from \"../survey/items/survey-item-json\";\nimport { Target } from \"./types\";\nimport { generateId } from \"../utils\";\n\n\n// Serialized translation data format for clipboard\nexport type SerializedTranslations = {\n [locale: string]: JsonComponentContent;\n};\n\n// Clipboard data structure for copy-paste functionality\nexport interface SurveyItemClipboardData {\n type: 'survey-item';\n version: string;\n items: Array<{\n itemId: string;\n itemData: RawSurveyItem;\n }>;\n translations: { [itemId: string]: SerializedTranslations };\n rootItemId: string; // The id of the main item being copied\n timestamp: number;\n}\n\n\nexport class ItemCopyPaste {\n private survey: Survey;\n\n constructor(survey: Survey) {\n this.survey = survey;\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * When copying a group, automatically includes all items in the subtree\n * @param itemId - The id of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const item = this.survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Collect all items to copy (including subtree for groups)\n const itemsToCopy = this.collectItemsForCopy(itemId);\n\n // Create items array with their data\n const items = itemsToCopy.map(id => {\n const item = this.survey.surveyItems.get(id);\n if (!item) throw new Error(`Item with id '${id}' not found during copy`);\n return { itemId: id, itemData: item.rawItem };\n });\n\n // Collect translations for all items\n const translations: { [itemId: string]: SerializedTranslations } = {};\n itemsToCopy.forEach(id => {\n try {\n const itemTranslations = this.survey.getItemTranslations(id);\n if (itemTranslations?.locales?.length) {\n const serializedTranslations: SerializedTranslations = {};\n itemTranslations.locales.forEach(locale => {\n const localeContent = itemTranslations.getAllForLocale(locale);\n if (localeContent) {\n serializedTranslations[locale] = localeContent;\n }\n });\n translations[id] = serializedTranslations;\n } else {\n translations[id] = {};\n }\n } catch {\n translations[id] = {};\n }\n });\n\n // Create clipboard data\n const clipboardData: SurveyItemClipboardData = {\n type: 'survey-item',\n version: '1.0.0',\n items: items,\n translations: translations,\n rootItemId: itemId,\n timestamp: Date.now()\n };\n\n return clipboardData;\n }\n\n /**\n * Collect all items that should be copied, including subtree for groups\n * @param itemId - The root item id\n * @returns Array of item keys to copy\n */\n private collectItemsForCopy(itemId: string): string[] {\n const itemsToCopy: string[] = [itemId];\n const item = this.survey.surveyItems.get(itemId);\n\n if (!item) {\n return [];\n }\n\n // If this is a group item, collect all child items recursively\n if (item instanceof GroupItemCore) {\n const childIds = item.items;\n if (childIds.length > 0) {\n childIds.forEach(childId => {\n const childItems = this.collectItemsForCopy(childId);\n itemsToCopy.push(...childItems);\n });\n }\n }\n\n return itemsToCopy;\n }\n\n /**\n * Add an item to its parent group.\n * Ensures key uniqueness among siblings.\n * @param target - Target location information\n * @param item - The item to add (may have key adjusted for uniqueness)\n */\n private addItemToParentGroup(target: Target, item: SurveyItemCore): void {\n const parentGroup = this.survey.surveyItems.get(target.parentId);\n\n if (!parentGroup) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(parentGroup instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item`);\n }\n\n const siblingIds = parentGroup.items;\n const siblings = siblingIds\n .map(id => this.survey.surveyItems.get(id))\n .filter((s): s is SurveyItemCore => s !== undefined);\n const siblingKeys = new Set(siblings.map(s => s.key));\n\n let uniqueKey = item.key;\n if (siblingKeys.has(uniqueKey)) {\n let counter = 1;\n const originalKey = item.key;\n while (siblingKeys.has(uniqueKey)) {\n uniqueKey = originalKey + `_${counter}`;\n counter++;\n }\n if (uniqueKey !== item.key) {\n const updatedRawItem = { ...item.rawItem, key: uniqueKey };\n const newItem = this.survey.createItemFromRaw(updatedRawItem);\n this.survey.surveyItems.delete(item.id);\n this.survey.surveyItems.set(newItem.id, newItem);\n item = newItem;\n }\n }\n\n const insertIndex =\n target.index !== undefined\n ? Math.min(target.index, parentGroup.items.length)\n : parentGroup.items.length;\n\n parentGroup.addChild(item.id, insertIndex);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * Handles multiple items and subtrees from the clipboard data\n * @param clipboardData - The clipboard data containing the item(s) to paste\n * @param target - Target location where to paste the item\n * @returns The id of the pasted root item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n // Validate clipboard data\n if (!ItemCopyPaste.isValidClipboardData(clipboardData)) {\n throw new Error('Invalid clipboard data format');\n }\n\n // Create id mapping for all items in the subtree\n const idMapping: { [oldId: string]: string } = {};\n clipboardData.items.forEach(({ itemId }) => {\n idMapping[itemId] = generateId();\n });\n\n // Create all items with updated ids\n clipboardData.items.forEach(({ itemId, itemData }) => {\n const newId = idMapping[itemId];\n if (newId) {\n const updatedItemData = this.updateItemIdsInData(itemData, idMapping);\n updatedItemData.id = newId;\n\n const newItem = this.survey.createItemFromRaw(updatedItemData);\n this.survey.surveyItems.set(newItem.id, newItem);\n\n if (itemId === clipboardData.rootItemId) {\n this.addItemToParentGroup(target, newItem);\n }\n }\n });\n\n // Update translations with new IDs\n const updatedTranslations = this.updateTranslations(clipboardData.translations, idMapping);\n Object.keys(updatedTranslations).forEach(itemId => {\n // Convert serialized translations back to SurveyItemTranslations instance\n const itemTranslations = new SurveyItemTranslations();\n const serializedData = updatedTranslations[itemId];\n Object.keys(serializedData).forEach(locale => {\n itemTranslations.setAllForLocale(locale, serializedData[locale]);\n });\n this.survey.translations.setItemTranslations(itemId, itemTranslations);\n });\n\n // TODO: update prefill rules where needed to use the new keys\n\n return idMapping[clipboardData.rootItemId];\n }\n\n // PRIVATE HELPER METHODS\n /**\n * Update all item ids in the raw item data recursively\n */\n private updateItemIdsInData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): RawSurveyItem {\n const updatedData = JSON.parse(JSON.stringify(itemData));\n\n if (updatedData.itemType === ReservedSurveyItemTypes.Group && updatedData.config) {\n const config = updatedData.config as { items?: string[] };\n if (config.items) {\n config.items = config.items.map((childId: string) => idMapping[childId] ?? childId);\n }\n }\n\n this.updateExpressionsInItemData(updatedData, idMapping);\n return updatedData;\n }\n\n /**\n * Update expressions in item data that reference the old ids\n */\n private updateExpressionsInItemData(itemData: RawSurveyItem, idMapping: { [oldId: string]: string }): void {\n\n // Update display conditions\n if (itemData.displayConditions?.root) {\n this.updateExpressionReferences(itemData.displayConditions.root, idMapping);\n }\n if (itemData.displayConditions?.components) {\n Object.values(itemData.displayConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update disabled conditions\n if (itemData.disabledConditions?.components) {\n Object.values(itemData.disabledConditions.components).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n\n // Update validations\n if (itemData.validations) {\n Object.values(itemData.validations).forEach(expr => {\n if (expr) this.updateExpressionReferences(expr, idMapping);\n });\n }\n }\n\n /**\n * Update references in a single expression (recursive)\n */\n private updateExpressionReferences(\n expression: unknown,\n idMapping: { [oldId: string]: string }\n ): void {\n if (!expression || typeof expression !== 'object') {\n return;\n }\n\n const expr = expression as Record<string, unknown>;\n if (Array.isArray(expr.data)) {\n expr.data.forEach((arg: unknown) => {\n if (arg && typeof arg === 'object' && arg !== null && 'str' in arg) {\n const argObj = arg as { str?: string };\n if (\n typeof argObj.str === 'string' &&\n Object.prototype.hasOwnProperty.call(idMapping, argObj.str)\n ) {\n argObj.str = idMapping[argObj.str];\n }\n this.updateExpressionReferences(arg, idMapping);\n }\n });\n }\n\n Object.keys(expr).forEach(key => {\n const val = expr[key];\n if (val && typeof val === 'object') {\n this.updateExpressionReferences(val, idMapping);\n }\n });\n }\n\n /**\n* Update translation keys for the pasted item\n*/\n private updateTranslations(translations: { [itemId: string]: SerializedTranslations }, idMapping: { [oldId: string]: string }): { [itemId: string]: SerializedTranslations } {\n const newTranslations: { [itemId: string]: SerializedTranslations } = {};\n\n // Update ids for all items in the translation data\n Object.keys(translations).forEach(itemId => {\n const itemTranslations = translations[itemId];\n\n // Determine the new key for this item (update the key mapping)\n const newItemId = idMapping[itemId];\n\n // Copy the serialized translations as-is (content is preserved, only keys change)\n newTranslations[newItemId] = itemTranslations;\n });\n\n return newTranslations;\n }\n\n\n /**\n * Validate clipboard data format\n */\n static isValidClipboardData(data: unknown): data is SurveyItemClipboardData {\n if (typeof data !== 'object' || data === null || data === undefined) return false;\n const clipboardData = data as SurveyItemClipboardData;\n return (\n clipboardData.type === 'survey-item' &&\n clipboardData.version === '1.0.0' &&\n clipboardData.rootItemId !== undefined\n );\n }\n}\n","import { RawSurvey } from \"../survey/survey-file-schema\";\nimport { structuredCloneMethod } from \"../utils\";\n\nexport interface UndoRedoConfig {\n maxTotalMemoryMB: number;\n minHistorySize: number;\n maxHistorySize: number;\n}\n\nexport const CommitSource = {\n USER: \"user\",\n SYSTEM: \"system\",\n} as const;\nexport type CommitSource = typeof CommitSource[keyof typeof CommitSource];\n\nexport interface CommitMeta {\n label: string;\n source?: CommitSource;\n}\n\n\ninterface HistoryEntry {\n survey: RawSurvey;\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n}\n\n// Memory calculation utilities\nclass MemoryCalculator {\n private static encoder = new TextEncoder();\n\n static calculateSize(obj: object): number {\n const jsonString = JSON.stringify(obj);\n return this.encoder.encode(jsonString).length;\n }\n\n static formatBytes(bytes: number): string {\n const units = ['B', 'KB', 'MB', 'GB'];\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(1)} ${units[unitIndex]}`;\n }\n}\n\n\nexport class SurveyEditorUndoRedo {\n private history: HistoryEntry[] = [];\n private currentIndex: number = -1;\n private _config: UndoRedoConfig;\n\n constructor(initialSurvey: RawSurvey, config: Partial<UndoRedoConfig> = {}, meta: CommitMeta = { label: 'Initial state', source: CommitSource.SYSTEM }) {\n this._config = {\n maxTotalMemoryMB: 50,\n minHistorySize: 10,\n maxHistorySize: 200,\n ...config\n };\n\n this.saveSnapshot(initialSurvey, meta);\n }\n\n\n private saveSnapshot(survey: RawSurvey, meta: CommitMeta): void {\n const memorySize = MemoryCalculator.calculateSize(survey);\n\n // Remove any history after current index\n this.history = this.history.slice(0, this.currentIndex + 1);\n\n // Add new snapshot\n this.history.push({\n survey: structuredCloneMethod(survey),\n timestamp: Date.now(),\n meta,\n memorySize\n });\n\n this.currentIndex++;\n\n // Clean up history based on memory usage\n this.cleanupHistory();\n }\n\n private cleanupHistory(): void {\n let totalMemory = this.getTotalMemoryUsage();\n const maxMemoryBytes = this._config.maxTotalMemoryMB * 1024 * 1024;\n\n // Remove oldest snapshots while preserving minimum\n while (this.history.length > this._config.minHistorySize &&\n (totalMemory > maxMemoryBytes || this.history.length > this._config.maxHistorySize)) {\n\n const removedSnapshot = this.history.shift();\n this.currentIndex--;\n\n if (removedSnapshot) {\n totalMemory -= removedSnapshot.memorySize;\n }\n }\n }\n\n private getTotalMemoryUsage(): number {\n return this.history.reduce((total, entry) => total + entry.memorySize, 0);\n }\n\n // Commit a change to history\n commit(survey: RawSurvey, meta: CommitMeta): void {\n this.saveSnapshot(survey, meta);\n }\n\n // Get current committed state\n getCurrentState(): RawSurvey {\n if (this.currentIndex < 0 || this.currentIndex >= this.history.length) {\n throw new Error('Invalid history state');\n }\n return structuredCloneMethod(this.history[this.currentIndex].survey);\n }\n\n undo(): RawSurvey | null {\n if (!this.canUndo()) return null;\n\n this.currentIndex--;\n return this.getCurrentState();\n }\n\n redo(): RawSurvey | null {\n if (!this.canRedo()) return null;\n\n this.currentIndex++;\n return this.getCurrentState();\n }\n\n canUndo(): boolean {\n return this.currentIndex > 0;\n }\n\n canRedo(): boolean {\n return this.currentIndex < this.history.length - 1;\n }\n\n getUndoMeta(): CommitMeta | null {\n if (!this.canUndo()) return null;\n return this.history[this.currentIndex].meta;\n }\n\n getRedoMeta(): CommitMeta | null {\n if (!this.canRedo()) return null;\n return this.history[this.currentIndex + 1].meta;\n }\n\n getMemoryUsage(): { totalMB: number; entries: number } {\n return {\n totalMB: this.getTotalMemoryUsage() / (1024 * 1024),\n entries: this.history.length\n };\n }\n\n getConfig(): UndoRedoConfig {\n return { ...this._config };\n }\n\n /**\n * Get the full history list with metadata\n */\n getHistory(): Array<{\n index: number;\n meta: CommitMeta;\n timestamp: number;\n memorySize: number;\n isCurrent: boolean;\n }> {\n return this.history.map((entry, index) => ({\n index,\n meta: entry.meta,\n timestamp: entry.timestamp,\n memorySize: entry.memorySize,\n isCurrent: index === this.currentIndex\n }));\n }\n\n /**\n * Get the current index in the history\n */\n getCurrentIndex(): number {\n return this.currentIndex;\n }\n\n /**\n * Get the total number of history entries\n */\n getHistoryLength(): number {\n return this.history.length;\n }\n\n /**\n * Jump to a specific index in the history (can go forward or backward)\n * @param targetIndex The index to jump to\n * @returns The survey state at the target index, or null if invalid\n */\n jumpToIndex(targetIndex: number): RawSurvey | null {\n if (targetIndex < 0 || targetIndex >= this.history.length || targetIndex === this.currentIndex) {\n return null;\n }\n\n this.currentIndex = targetIndex;\n return this.getCurrentState();\n }\n\n /**\n * Check if we can jump to a specific index\n */\n canJumpToIndex(targetIndex: number): boolean {\n return targetIndex >= 0 && targetIndex < this.history.length && targetIndex !== this.currentIndex;\n }\n\n /**\n * Serialize the undo/redo state to JSON\n * @returns A JSON-serializable object containing the complete state\n */\n serialize(): {\n history: Array<HistoryEntry>;\n currentIndex: number;\n config: UndoRedoConfig;\n } {\n return {\n history: this.history.map(entry => ({\n survey: entry.survey,\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n })),\n currentIndex: this.currentIndex,\n config: { ...this._config }\n };\n }\n\n /**\n * Create a new SurveyEditorUndoRedo instance from JSON data\n * @param jsonData The serialized undo/redo state\n * @returns A new SurveyEditorUndoRedo instance with the restored state\n */\n static deserialize(jsonData: {\n history: Array<{\n survey: RawSurvey;\n timestamp: number;\n meta: CommitMeta;\n memorySize: number;\n }>;\n currentIndex: number;\n config: UndoRedoConfig;\n }): SurveyEditorUndoRedo {\n if (!jsonData.history || !Array.isArray(jsonData.history) || jsonData.history.length === 0) {\n throw new Error('Invalid object: history must be an array and must not be empty');\n }\n\n if (typeof jsonData.currentIndex !== 'number' ||\n jsonData.currentIndex < 0 ||\n jsonData.currentIndex >= jsonData.history.length) {\n throw new Error('Invalid object: currentIndex must be a valid index within the history array');\n }\n\n if (!jsonData.config) {\n throw new Error('Invalid object: config is required');\n }\n\n // Create a new instance with the first survey and config\n const instance = new SurveyEditorUndoRedo(jsonData.history[0].survey, jsonData.config);\n\n // Clear the default initial state and restore the full history\n instance.history = jsonData.history.map(entry => ({\n survey: structuredCloneMethod(entry.survey),\n timestamp: entry.timestamp,\n meta: entry.meta,\n memorySize: entry.memorySize\n }));\n\n instance.currentIndex = jsonData.currentIndex;\n\n return instance;\n }\n\n}\n","import { Survey } from \"../survey/survey\";\nimport { CommitMeta, CommitSource, SurveyEditorUndoRedo, type UndoRedoConfig } from \"./undo-redo\";\nimport {\n SurveyItemTranslations,\n SurveyCardContent,\n NavigationContent,\n Content,\n} from \"../survey/utils\";\nimport { RawSurvey } from \"../survey/survey-file-schema\";\nimport { ItemCopyPaste, SurveyItemClipboardData } from \"./item-copy-paste\";\nimport { Target } from \"./types\";\nimport { SurveyItemCore, RawSurveyItem } from \"../survey/items\";\nimport { GroupItemCore } from \"../survey/registry/built-in-items\";\nimport type { ItemTypeRegistry } from \"../survey/registry/item-registry\";\nimport type { TemplateValueDefinition } from \"../expressions/template-value\";\nimport { structuredCloneMethod } from \"../utils\";\n\n\n// Interface for serializing SurveyEditor state\nexport interface SerializedSurveyEditor {\n version: string;\n survey: RawSurvey;\n undoRedo: ReturnType<SurveyEditorUndoRedo['serialize']>;\n hasUncommittedChanges: boolean;\n}\n\n\nexport interface SurveyEditorConfig extends Partial<UndoRedoConfig> {\n /** Plugin registry for deserializing survey state during undo/redo. Required when survey contains custom item types. */\n pluginRegistry?: ItemTypeRegistry;\n}\n\nexport class SurveyEditor {\n private _survey: Survey;\n private _undoRedo: SurveyEditorUndoRedo;\n private _hasUncommittedChanges: boolean = false;\n private _pluginRegistry?: ItemTypeRegistry;\n\n constructor(\n survey: Survey,\n config: SurveyEditorConfig = {},\n meta?: CommitMeta,\n ) {\n this._survey = survey;\n const { pluginRegistry, ...undoRedoConfig } = config;\n this._pluginRegistry = pluginRegistry;\n this._undoRedo = new SurveyEditorUndoRedo(survey.serialize(), undoRedoConfig, meta);\n }\n\n /** Returns an immutable copy of the current survey state. */\n get survey(): Survey {\n const serialized = this._survey.serialize();\n const registry = this._pluginRegistry ?? this._survey.getPluginRegistry();\n return Survey.fromJson(serialized, registry);\n }\n\n get hasUncommittedChanges(): boolean {\n return this._hasUncommittedChanges;\n }\n\n // Expose the undo-redo instance directly\n get undoRedo(): SurveyEditorUndoRedo {\n return this._undoRedo;\n }\n\n // Commit current changes to undo/redo history\n commit(meta: CommitMeta): void {\n this._undoRedo.commit(this._survey.serialize(), meta);\n this._hasUncommittedChanges = false;\n }\n\n commitIfNeeded(): void {\n if (this._hasUncommittedChanges) {\n this.commit({\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n });\n }\n }\n\n // Undo to previous state\n undo(): boolean {\n if (this._hasUncommittedChanges) {\n // If there are uncommitted changes, revert to last committed state\n this._survey = Survey.fromJson(this._undoRedo.getCurrentState(), this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n } else {\n // Normal undo operation\n const previousState = this._undoRedo.undo();\n if (previousState) {\n this._survey = Survey.fromJson(previousState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n }\n\n // Redo to next state\n redo(): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot redo when there are uncommitted changes\n return false;\n }\n\n const nextState = this._undoRedo.redo();\n if (nextState) {\n this._survey = Survey.fromJson(nextState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n // Enhanced undo/redo methods that use the exposed instance\n /**\n * Jump to a specific index in the history (can go forward or backward)\n */\n jumpToIndex(targetIndex: number): boolean {\n if (this._hasUncommittedChanges) {\n // Cannot jump to specific index with uncommitted changes\n return false;\n }\n\n const targetState = this._undoRedo.jumpToIndex(targetIndex);\n if (targetState) {\n this._survey = Survey.fromJson(targetState, this._pluginRegistry);\n this._hasUncommittedChanges = false;\n return true;\n }\n return false;\n }\n\n canUndo(): boolean {\n return this._hasUncommittedChanges || this._undoRedo.canUndo();\n }\n\n canRedo(): boolean {\n return !this._hasUncommittedChanges && this._undoRedo.canRedo();\n }\n\n getUndoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return {\n label: 'Latest content changes',\n source: CommitSource.SYSTEM\n };\n }\n return this._undoRedo.getUndoMeta();\n }\n\n getRedoMeta(): CommitMeta | null {\n if (this._hasUncommittedChanges) {\n return null;\n }\n return this._undoRedo.getRedoMeta();\n }\n\n // Get memory usage statistics\n getMemoryUsage(): { totalMB: number; entries: number } {\n return this._undoRedo.getMemoryUsage();\n }\n\n // Get undo/redo configuration\n getUndoRedoConfig(): UndoRedoConfig {\n return this._undoRedo.getConfig();\n }\n\n /**\n * Serialize the SurveyEditor state to JSON\n * @returns A JSON-serializable object containing the complete editor state\n */\n toJson(): SerializedSurveyEditor {\n return {\n version: '1.0.0',\n survey: this._survey.serialize(),\n undoRedo: this._undoRedo.serialize(),\n hasUncommittedChanges: this._hasUncommittedChanges\n };\n }\n\n /**\n * Create a new SurveyEditor instance from JSON data\n * @param jsonData The serialized editor state\n * @param pluginRegistry Optional plugin registry for deserializing survey state (required when survey contains custom item types)\n * @returns A new SurveyEditor instance with the restored state\n */\n static fromJson(jsonData: SerializedSurveyEditor, pluginRegistry?: ItemTypeRegistry): SurveyEditor {\n if (!jsonData.survey) {\n throw new Error('Invalid object: survey is required');\n }\n\n if (!jsonData.undoRedo) {\n throw new Error('Invalid object: undoRedo is required');\n }\n\n if (typeof jsonData.hasUncommittedChanges !== 'boolean') {\n throw new Error('Invalid object: hasUncommittedChanges must be a boolean');\n }\n\n // Validate version (for future compatibility)\n if (jsonData.version && !jsonData.version.startsWith('1.')) {\n console.warn(`Warning: Loading SurveyEditor with version ${jsonData.version}, current version is 1.0.0`);\n }\n\n // Create survey from JSON\n const survey = Survey.fromJson(jsonData.survey, pluginRegistry);\n\n // Create a new editor instance\n const editor = new SurveyEditor(survey, { pluginRegistry });\n\n // Restore undo/redo state\n editor._undoRedo = SurveyEditorUndoRedo.deserialize(jsonData.undoRedo);\n\n // Restore uncommitted changes flag\n editor._hasUncommittedChanges = jsonData.hasUncommittedChanges;\n\n return editor;\n }\n\n private markAsModified(): void {\n this._hasUncommittedChanges = true;\n }\n\n addItem(\n target: Target,\n item: SurveyItemCore,\n content?: SurveyItemTranslations,\n ): void {\n // Mark as modified (uncommitted change)\n this.markAsModified();\n\n // Find the parent group item\n let parentGroup: GroupItemCore;\n\n if (!target) {\n // If no target provided, add to root\n\n const rootItem = this._survey.rootItem;\n if (!rootItem) {\n throw new Error('No root group found in survey');\n }\n if (!(rootItem instanceof GroupItemCore)) {\n throw new Error('Root item is not a group item');\n }\n parentGroup = rootItem;\n } else {\n // Find the target parent group\n const targetItem = this._survey.surveyItems.get(target.parentId);\n\n if (!targetItem) {\n throw new Error(`Parent item with id '${target.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Parent item '${target.parentId}' is not a group item (${targetItem.type})`);\n }\n\n parentGroup = targetItem;\n }\n\n if (parentGroup.hasChild(item.id)) {\n throw new Error(`Item ${item.id} already in this group`);\n }\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => parentGroup.items?.includes(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n\n // Determine insertion index\n let insertIndex: number;\n if (target?.index !== undefined) {\n // Insert at specified index, or at end if index is larger than array length\n insertIndex = Math.min(target.index, parentGroup.items.length);\n } else {\n // Insert at the end\n insertIndex = parentGroup.items.length;\n }\n\n // Add the item to the survey items collection\n this._survey.surveyItems.set(item.id, item);\n\n // Add the item to the parent group (uses addChild for proper persistence)\n parentGroup.addChild(item.id, insertIndex);\n\n // Update translations in the survey\n if (content) {\n this._survey.translations.setItemTranslations(item.id, content);\n }\n }\n\n // Remove an item from the survey\n removeItem(itemId: string, nested: boolean = false): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n return false;\n }\n\n // Find parent group and remove from its items array\n const parentItem = this._survey.getParentItem(itemId);\n if (!parentItem) {\n throw new Error(`Item with id '${itemId}' is the root item`);\n }\n\n\n if (item instanceof GroupItemCore) {\n for (const childId of item.getChildrenIds()) {\n this.removeItem(childId, true);\n }\n }\n\n // Remove from survey items\n this._survey.surveyItems.delete(itemId);\n\n // Remove translations\n this._survey.translations?.onItemDeleted(itemId);\n\n if (!nested) {\n parentItem.removeChild(itemId);\n }\n return true;\n }\n\n // Move an item to a different position\n moveItem(itemId: string, newTarget: Target): boolean {\n this.markAsModified();\n // Check if item exists\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n // Check if new target exists and is a group\n const targetItem = this._survey.surveyItems.get(newTarget.parentId);\n if (!targetItem) {\n throw new Error(`Target parent with id '${newTarget.parentId}' not found`);\n }\n\n if (!(targetItem instanceof GroupItemCore)) {\n throw new Error(`Target parent '${newTarget.parentId}' is not a group item (${targetItem.type})`);\n }\n\n // Check if new target is not a child of the current item (prevent circular reference)\n if (this._survey.isDescendantOf(newTarget.parentId, itemId)) {\n throw new Error(`Cannot move item '${itemId}' to its descendant '${newTarget.parentId}'`);\n }\n\n // If the item is already in the target parent\n const currentParentItem = this._survey.getParentItem(itemId);\n if (currentParentItem?.id === newTarget.parentId) {\n throw new Error(`Item '${itemId}' is already in the target parent '${newTarget.parentId}'`);\n }\n\n // Remove item from current parent's items array\n if (currentParentItem) {\n const currentParentGroup = currentParentItem as GroupItemCore;\n currentParentGroup.removeChild(itemId);\n }\n\n // Add item to new parent's items array\n const targetGroup = targetItem as GroupItemCore;\n\n // ensure that item's key not already used within the group\n const siblings = Array.from(this._survey.surveyItems.values()).filter(sItem => targetGroup.hasChild(sItem.id));\n let counter = 1;\n while (siblings.some(sibling => sibling.key === item.key)) {\n item.key += `_${counter}`;\n counter++;\n }\n\n const insertIndex = newTarget.index !== undefined ?\n Math.min(newTarget.index, targetGroup.items.length) :\n targetGroup.items.length;\n\n targetGroup.items.splice(insertIndex, 0, itemId);\n\n return true;\n }\n\n /**\n * Get a deep copy of an item's raw data.\n * The returned object is independent of the survey—mutating it will not affect the survey.\n * Use this when you need to edit an item in a form or pass it to updateItem after modifications.\n *\n * @param itemId - The ID of the item to copy\n * @returns A deep copy of the item's RawSurveyItem data\n * @throws Error if the item is not found\n */\n getItemDataCopy(itemId: string): RawSurveyItem {\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n return JSON.parse(JSON.stringify(item.rawItem)) as RawSurveyItem;\n }\n\n /**\n * Update an item's data in the survey.\n * Can update common attributes (displayConditions, disabledConditions, validations, etc.)\n * as well as type-specific config.\n *\n * Use getItemDataCopy to obtain an editable copy, modify it, then pass it here.\n * Alternatively, pass a Partial to merge specific fields (top-level keys only;\n * e.g. config replaces the entire config object).\n *\n * @param itemId - The ID of the item to update (must match data.id if provided)\n * @param rawItemData - Full RawSurveyItem or Partial to merge. The id cannot be changed.\n */\n updateItem(itemId: string, rawItemData: RawSurveyItem | Partial<RawSurveyItem>): void {\n const existingItem = this._survey.surveyItems.get(itemId);\n if (!existingItem) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n if ('id' in rawItemData && rawItemData.id !== undefined && rawItemData.id !== itemId) {\n throw new Error(`Cannot change item id from '${itemId}' to '${rawItemData.id}'`);\n }\n\n const currentRaw = existingItem.rawItem;\n const merged: RawSurveyItem = {\n ...currentRaw,\n ...rawItemData,\n id: itemId, // Ensure id is never changed\n };\n\n // Reject key change if it would collide with a sibling\n const newKey = merged.key ?? existingItem.key;\n const parentGroup = this._survey.getParentItem(itemId);\n if (parentGroup) {\n const siblingWithSameKey = (parentGroup.items ?? [])\n .filter(id => id !== itemId)\n .map(id => this._survey.surveyItems.get(id))\n .find(s => s !== undefined && s.key === newKey);\n if (siblingWithSameKey) {\n throw new Error(`Key '${newKey}' is already in use by sibling item '${siblingWithSameKey.id}'`);\n }\n }\n\n const newItem = this._survey.createItemFromRaw(merged);\n this._survey.surveyItems.set(itemId, newItem);\n this.markAsModified();\n }\n\n // TODO: add also to update component translations (updating part of the item)\n // Update item translations\n updateItemTranslations(itemId: string, updatedContent?: SurveyItemTranslations): boolean {\n this.markAsModified();\n const item = this._survey.surveyItems.get(itemId);\n if (!item) {\n throw new Error(`Item with id '${itemId}' not found`);\n }\n\n this._survey.translations.setItemTranslations(itemId, updatedContent);\n\n return true;\n }\n\n /**\n * Update survey-level translations that are not tied to specific items.\n * Use these for survey card, navigation, validation messages, etc.\n */\n updateSurveyTranslations(updates: {\n surveyCard?: { locale: string; content?: SurveyCardContent };\n navigation?: { locale: string; content?: NavigationContent };\n validationMessages?: { locale: string; content?: { invalidResponse?: Content } };\n }): void {\n this.markAsModified();\n if (updates.surveyCard) {\n this._survey.translations.setSurveyCardContent(updates.surveyCard.locale, updates.surveyCard.content);\n }\n if (updates.navigation) {\n this._survey.translations.setNavigationContent(updates.navigation.locale, updates.navigation.content);\n }\n if (updates.validationMessages) {\n this._survey.translations.setValidationMessages(updates.validationMessages.locale, updates.validationMessages.content);\n }\n }\n\n /**\n * Get maxItemsPerPage immutably (returns a copy).\n */\n getMaxItemsPerPage(): { large: number; small: number } | undefined {\n const val = this._survey.maxItemsPerPage;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update maxItemsPerPage.\n */\n updateMaxItemsPerPage(value: { large: number; small: number } | undefined): void {\n this.markAsModified();\n this._survey.maxItemsPerPage = value ? { ...value } : undefined;\n }\n\n /**\n * Get metadata immutably (returns a copy).\n */\n getMetadata(): { [key: string]: string } | undefined {\n const val = this._survey.metadata;\n return val ? { ...val } : undefined;\n }\n\n /**\n * Update metadata.\n */\n updateMetadata(metadata: { [key: string]: string } | undefined): void {\n this.markAsModified();\n this._survey.metadata = metadata ? { ...metadata } : undefined;\n }\n\n /**\n * Get a template value immutably (returns a deep copy).\n */\n getTemplateValue(key: string): TemplateValueDefinition | undefined {\n const val = this._survey.getTemplateValue(key);\n return val ? structuredCloneMethod(val) : undefined;\n }\n\n /**\n * Get all template values immutably (returns a new Map with deep-copied values).\n */\n getTemplateValues(): Map<string, TemplateValueDefinition> {\n const keys = this._survey.getTemplateValueKeys();\n const result = new Map<string, TemplateValueDefinition>();\n for (const key of keys) {\n const val = this._survey.getTemplateValue(key);\n if (val) {\n result.set(key, structuredCloneMethod(val));\n }\n }\n return result;\n }\n\n /**\n * Add or replace a template value.\n */\n setTemplateValue(key: string, templateValue: TemplateValueDefinition): void {\n this.markAsModified();\n this._survey.setTemplateValue(key, structuredCloneMethod(templateValue));\n }\n\n /**\n * Remove a template value.\n */\n removeTemplateValue(key: string): void {\n this.markAsModified();\n this._survey.deleteTemplateValue(key);\n }\n\n /**\n * Copy a survey item and all its data to clipboard format\n * @param itemId - The ID of the item to copy\n * @returns Clipboard data that can be serialized to JSON for clipboard\n */\n copyItem(itemId: string): SurveyItemClipboardData {\n const copyPaste = new ItemCopyPaste(this._survey);\n return copyPaste.copyItem(itemId);\n }\n\n /**\n * Paste a survey item from clipboard data to a target location\n * @param clipboardData - The clipboard data containing the item to paste\n * @param target - Target location where to paste the item\n * @returns The ID of the pasted item\n */\n pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string {\n this.markAsModified();\n const copyPaste = new ItemCopyPaste(this._survey);\n const newItemId = copyPaste.pasteItem(clipboardData, target);\n\n\n return newItemId;\n }\n}\n"],"mappings":";;;AA+FA,MAAM,uBAA6D;CACjE,MAAM;CACN,SAAS;CACT,MAAM;CACP;AAED,MAAM,2BAA2B;AACjC,MAAM,wCAAwC;AAC9C,MAAM,yCAAyC;AAE/C,MAAM,mBAQF;CACF,SAAS;EACP,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,kBAAkB;EAChB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,oBAAoB;EAClB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,mBAAmB;EACjB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,aAAa;EACX,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACD,wBAAwB;EACtB,OAAO;EACP,kBAAkB;EAClB,gBAAgB;EAChB,sBAAsB;EACvB;CACF;AAED,MAAM,gBAA8C,UAClD,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,cAAc,EAAE,OAAO,CAAC;AAE7D,SAAS,YAAY,QAAgB,QAA0B;CAC7D,MAAM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Lookup, B as SurveyItemCoreType, C as SurveyCardContent, Ct as NumberResponse, D as validateLocale, Dt as SlotResponseBase, E as SurveyTranslations, Et as ResponseValue, F as TemplateAttribution, G as TemplateValueFormatDate, H as TemplateDefTypes, I as ReservedSurveyItemTypes, J as serializeTemplateValue, K as deserializeTemplateValue, L as RawSurveyItem, M as ContentType, N as MDContent, O as Attribution, Ot as StringArrayResponse, P as StyleAttribution, Q as ContextVariableType, R as ItemCoreConstructor, S as NavigationContent, St as NumberPrecision, T as SurveyItemTranslations, Tt as ReferenceResponse, U as TemplateValueBase, V as JsonTemplateValue, W as TemplateValueDefinition, X as ConstExpression, Y as serializeTemplateValues, Z as ContextVariableExpression, _ as toItemTypeDefinitionRegistry, _t as DurationArrayResponse, a as PageBreakConfig, at as JsonContextVariableExpression, b as JsonComponentContent, bt as DurationUnits, c as isBuiltInItemType, ct as JsonResponseVariableExpression, d as ItemTypeDefinitionRegistry, dt as ReferenceUsageType, et as ExpressionEditorConfig, f as ItemTypeName, ft as ValueReference, g as createItemTypeDefinitionRegistry, gt as DateResponse, h as createItemCore, ht as DateArrayResponse, i as GroupItemCore, it as JsonConstExpression, j as Content, jt as ValueType, k as AttributionType, kt as StringResponse, l as ItemTypeCapabilities, lt as ResponseVariableExpression, m as createFullRegistry, mt as BooleanResponse, n as BuiltInItemType, nt as FunctionExpression, o as PageBreakItemCore, ot as JsonExpression, p as ItemTypeRegistry, pt as ValueReferenceMethod, q as deserializeTemplateValues, r as GroupConfig, rt as FunctionExpressionNames, s as builtInItemCoreRegistry, st as JsonFunctionExpression, t as Survey, tt as ExpressionType, u as ItemTypeDefinition, ut as ReferenceUsage, v as SurveyItemKey, vt as DurationResponse, w as SurveyCardTranslations, wt as ReferenceArrayResponse, x as JsonSurveyTranslations, xt as NumberArrayResponse, yt as DurationUnit, z as SurveyItemCore } from "./survey-D3sMutUV.mjs";
|
|
2
2
|
import { Locale } from "date-fns";
|
|
3
3
|
|
|
4
4
|
//#region src/survey/responses/response-meta.d.ts
|
|
@@ -66,6 +66,12 @@ declare class ResponseItem {
|
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region src/survey/responses/survey-response.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* Survey response context: key-value pairs where values are typed ResponseValue.
|
|
71
|
+
*/
|
|
72
|
+
type SurveyResponseContext = {
|
|
73
|
+
[key: string]: ResponseValue;
|
|
74
|
+
};
|
|
69
75
|
/**
|
|
70
76
|
* SurveyResponse to store the responses of a survey.
|
|
71
77
|
*/
|
|
@@ -76,9 +82,7 @@ declare class SurveyResponse {
|
|
|
76
82
|
versionId: string;
|
|
77
83
|
responses: Map<string, SurveyItemResponse>;
|
|
78
84
|
events: Array<SurveyEvent>;
|
|
79
|
-
context?:
|
|
80
|
-
[key: string]: string;
|
|
81
|
-
};
|
|
85
|
+
context?: SurveyResponseContext;
|
|
82
86
|
constructor(key: string, versionId: string);
|
|
83
87
|
serialize(): JsonSurveyResponse;
|
|
84
88
|
static deserialize(json: JsonSurveyResponse): SurveyResponse;
|
|
@@ -94,7 +98,7 @@ interface JsonSurveyResponse {
|
|
|
94
98
|
responses: JsonSurveyItemResponse[];
|
|
95
99
|
events: SurveyEvent[];
|
|
96
100
|
context?: {
|
|
97
|
-
[key: string]:
|
|
101
|
+
[key: string]: ResponseValue;
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
//#endregion
|
|
@@ -592,6 +596,185 @@ declare const flattenTree: (itemTree: RenderedSurveyItem) => RenderedSurveyItem[
|
|
|
592
596
|
declare function shuffleIndices(length: number): number[];
|
|
593
597
|
declare function structuredCloneMethod<T>(obj: T): T;
|
|
594
598
|
declare function generateId(): string;
|
|
599
|
+
/**
|
|
600
|
+
* Generates a short random coding key suitable for item keys in exports/codebooks.
|
|
601
|
+
* @param length - Key length (default 4)
|
|
602
|
+
* @returns A random string of the specified length.
|
|
603
|
+
*/
|
|
604
|
+
declare function generateCodingKey(length?: number): string;
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/response-exporter/types.d.ts
|
|
607
|
+
/** Meta column keys in fixed order (common attributes first). */
|
|
608
|
+
declare const META_COLUMN_ORDER: readonly ["submittedAt", "participantId", "responseId", "versionId"];
|
|
609
|
+
type MetaColumnKey = (typeof META_COLUMN_ORDER)[number];
|
|
610
|
+
/** Built-in transform modes for slot export. */
|
|
611
|
+
declare const SlotTransformMode: {
|
|
612
|
+
readonly default: "default";
|
|
613
|
+
readonly mask: "mask";
|
|
614
|
+
readonly dateFormat: "dateFormat";
|
|
615
|
+
};
|
|
616
|
+
type SlotTransformMode = (typeof SlotTransformMode)[keyof typeof SlotTransformMode];
|
|
617
|
+
/** Slot identifier for profile overrides. */
|
|
618
|
+
interface SlotRef {
|
|
619
|
+
itemId: string;
|
|
620
|
+
slotId: string;
|
|
621
|
+
}
|
|
622
|
+
/** Configuration for dateFormat transform. Uses date-fns format pattern. */
|
|
623
|
+
interface DateFormatConfig {
|
|
624
|
+
pattern: string;
|
|
625
|
+
}
|
|
626
|
+
/** Slot-level override in exporter profile. */
|
|
627
|
+
interface SlotTransformConfig {
|
|
628
|
+
/** Built-in mode or custom formatter key. */
|
|
629
|
+
mode: SlotTransformMode | string;
|
|
630
|
+
/** Custom export key (overrides default key lookup). */
|
|
631
|
+
exportKey?: string;
|
|
632
|
+
/** For dateFormat: date-fns format pattern (e.g. 'yyyy-MM-dd'). */
|
|
633
|
+
dateFormat?: DateFormatConfig;
|
|
634
|
+
/** For mask: replacement string (default '***'). */
|
|
635
|
+
maskChar?: string;
|
|
636
|
+
}
|
|
637
|
+
/** Exporter profile: optional version targeting, overrides, and column ordering. */
|
|
638
|
+
interface ExporterProfile {
|
|
639
|
+
/** If set, applies only to this version. Otherwise applies to all. */
|
|
640
|
+
versionId?: string;
|
|
641
|
+
/** Slot-level overrides. Key: `${itemId}::${slotId}`. Profile overrides always win over defaults. */
|
|
642
|
+
slotOverrides?: Record<string, SlotTransformConfig>;
|
|
643
|
+
/** Overrides for context keys. Key = context key name. */
|
|
644
|
+
contextOverrides?: Record<string, SlotTransformConfig>;
|
|
645
|
+
/** Ordered list of response column keys. Columns in this list appear in this order; others follow alphabetically. */
|
|
646
|
+
responseColumnOrder?: string[];
|
|
647
|
+
/** Ordered list of context column keys. If omitted, context columns are alphabetical. */
|
|
648
|
+
contextColumnOrder?: string[];
|
|
649
|
+
}
|
|
650
|
+
/** Survey version binding: version metadata + parsed survey. */
|
|
651
|
+
interface SurveyVersionBinding {
|
|
652
|
+
versionId: string;
|
|
653
|
+
surveyKey: string;
|
|
654
|
+
/** Unix timestamp ms when published. */
|
|
655
|
+
published?: number;
|
|
656
|
+
/** Unix timestamp ms when unpublished. */
|
|
657
|
+
unpublished?: number;
|
|
658
|
+
survey: Survey;
|
|
659
|
+
}
|
|
660
|
+
/** Source of an export column. */
|
|
661
|
+
declare const ExportColumnSource: {
|
|
662
|
+
readonly meta: "meta";
|
|
663
|
+
readonly context: "context";
|
|
664
|
+
readonly response: "response";
|
|
665
|
+
};
|
|
666
|
+
type ExportColumnSource = (typeof ExportColumnSource)[keyof typeof ExportColumnSource];
|
|
667
|
+
/** Single export column. */
|
|
668
|
+
interface ExportColumn {
|
|
669
|
+
/** Column key for output. */
|
|
670
|
+
key: string;
|
|
671
|
+
source: ExportColumnSource;
|
|
672
|
+
/** For meta: the meta field name. */
|
|
673
|
+
metaField?: MetaColumnKey;
|
|
674
|
+
/** For context: the context key. */
|
|
675
|
+
contextKey?: string;
|
|
676
|
+
/** For response: item/slot ids and value type. */
|
|
677
|
+
itemId?: string;
|
|
678
|
+
slotId?: string;
|
|
679
|
+
valueType?: ValueType;
|
|
680
|
+
}
|
|
681
|
+
/** Single export row: key -> string value. */
|
|
682
|
+
type ExportRow = Record<string, string>;
|
|
683
|
+
/** CSV export options. */
|
|
684
|
+
interface CsvExportOptions {
|
|
685
|
+
/** Cell separator (default ','). */
|
|
686
|
+
separator?: string;
|
|
687
|
+
/** Line ending (default '\n'). */
|
|
688
|
+
lineEnding?: string;
|
|
689
|
+
/** Include header row (default true). */
|
|
690
|
+
includeHeader?: boolean;
|
|
691
|
+
}
|
|
692
|
+
/** Parameters for single-slot export (unit-testable). */
|
|
693
|
+
interface ExportSingleSlotParams {
|
|
694
|
+
value: ResponseValue | undefined;
|
|
695
|
+
valueType: ValueType;
|
|
696
|
+
/** Resolved formatter config (default or profile override). */
|
|
697
|
+
transformConfig: SlotTransformConfig;
|
|
698
|
+
}
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/response-exporter/exporter.d.ts
|
|
701
|
+
declare class SurveyResponseExporter {
|
|
702
|
+
private profiles;
|
|
703
|
+
private versions;
|
|
704
|
+
constructor(versionBindings: SurveyVersionBinding[], profiles?: ExporterProfile[]);
|
|
705
|
+
getSurveyForVersion(versionId: string): SurveyVersionBinding | undefined;
|
|
706
|
+
/**
|
|
707
|
+
* Compute response-only columns from survey definition.
|
|
708
|
+
*/
|
|
709
|
+
computeResponseColumns(versionId: string): ExportColumn[];
|
|
710
|
+
/**
|
|
711
|
+
* Compute full export columns: meta first, then context (from responses), then response columns.
|
|
712
|
+
* Column order: meta (fixed) -> context (profile order or alphabetical) -> response (profile order + alphabetical).
|
|
713
|
+
*/
|
|
714
|
+
computeColumns(versionId: string, responses?: SurveyResponse[], versionIds?: string[]): ExportColumn[];
|
|
715
|
+
private resolveProfileForVersion;
|
|
716
|
+
private getTransformConfig;
|
|
717
|
+
private getContextTransformConfig;
|
|
718
|
+
exportResponse(response: SurveyResponse): ExportRow | null;
|
|
719
|
+
/**
|
|
720
|
+
* Compute columns for a batch of responses (union of response columns across versions).
|
|
721
|
+
*/
|
|
722
|
+
computeColumnsForBatch(responses: SurveyResponse[]): ExportColumn[];
|
|
723
|
+
exportResponsesToCsv(responses: SurveyResponse[], options?: CsvExportOptions): string;
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/response-exporter/slot-formatter.d.ts
|
|
727
|
+
/** Default transform config when no profile override. */
|
|
728
|
+
declare const DEFAULT_TRANSFORM: SlotTransformConfig;
|
|
729
|
+
/**
|
|
730
|
+
* Export a single response slot to a string. Pure function for unit testing.
|
|
731
|
+
* Uses default formatting by ValueType unless overridden by transformConfig.
|
|
732
|
+
*/
|
|
733
|
+
declare function exportSingleResponseSlot(params: {
|
|
734
|
+
value: ResponseValue | undefined;
|
|
735
|
+
valueType: ValueType;
|
|
736
|
+
transformConfig: SlotTransformConfig;
|
|
737
|
+
}): string;
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region src/response-exporter/csv-serializer.d.ts
|
|
740
|
+
/**
|
|
741
|
+
* Escape a cell value for CSV. Quotes the cell when it contains separator, quote, CR, or LF.
|
|
742
|
+
* Doubles embedded quotes. Preserves multiline content inside quoted cells.
|
|
743
|
+
*/
|
|
744
|
+
declare function escapeCsvCell(value: string, separator?: string): string;
|
|
745
|
+
/**
|
|
746
|
+
* Serialize export rows to CSV string.
|
|
747
|
+
*/
|
|
748
|
+
declare function serializeToCsv(columns: ExportColumn[], rows: ExportRow[], options?: CsvExportOptions): string;
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/response-exporter/codebook.d.ts
|
|
751
|
+
/** Single slot entry in codebook. */
|
|
752
|
+
interface CodebookSlot {
|
|
753
|
+
slotId: string;
|
|
754
|
+
valueType: ValueType;
|
|
755
|
+
}
|
|
756
|
+
/** Single item entry in codebook. */
|
|
757
|
+
interface CodebookItem {
|
|
758
|
+
id: string;
|
|
759
|
+
key: string;
|
|
760
|
+
keyPath: string[];
|
|
761
|
+
type: string;
|
|
762
|
+
interactive: boolean;
|
|
763
|
+
slots: CodebookSlot[];
|
|
764
|
+
/** Content by locale, keyed by content key (e.g. 'title', 'description'). */
|
|
765
|
+
contentByLocale?: Record<string, Record<string, string>>;
|
|
766
|
+
}
|
|
767
|
+
/** Full codebook for a survey. */
|
|
768
|
+
interface Codebook {
|
|
769
|
+
surveyKey?: string;
|
|
770
|
+
items: CodebookItem[];
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Generate a structured codebook from a survey definition.
|
|
774
|
+
*/
|
|
775
|
+
declare function generateCodebook(survey: Survey, options?: {
|
|
776
|
+
locales?: string[];
|
|
777
|
+
}): Codebook;
|
|
595
778
|
//#endregion
|
|
596
|
-
export { AndExpressionEditor, Attribution, AttributionType, BooleanResponse, CQMContent, ConstBooleanEditor, ConstDateArrayEditor, ConstDateEditor, ConstExpression, ConstNumberArrayEditor, ConstNumberEditor, ConstStringArrayEditor, ConstStringEditor, Content, ContentType, ContextVariableExpression, ContextVariableType, CtxCustomExpressionEditor, CtxCustomValueEditor, CtxLocaleEditor, CtxPFlagDateEditor, CtxPFlagIsDefinedEditor, CtxPFlagNumEditor, CtxPFlagStringEditor, DateArrayResponse, DateResponse, DurationArrayResponse, DurationResponse, DurationUnit, DurationUnits, EqExpressionEditor, Expression, ExpressionContext, ExpressionEditor, ExpressionEditorConfig, ExpressionEvaluator, ExpressionType, FunctionExpression, FunctionExpressionNames, GtExpressionEditor, GteExpressionEditor, InRangeExpressionEditor, ItemCoreConstructor, ItemResponseMeta, JsonComponentContent, JsonConstExpression, JsonContextVariableExpression, JsonExpression, JsonFunctionExpression, JsonResponseItem, JsonResponseVariableExpression, JsonSurveyItemResponse, JsonSurveyResponse, JsonSurveyTranslations, JsonTemplateValue, LanguageChangedEvent, LegacyComponentProperties, LegacyConfidentialMode, LegacyItemComponent, LegacyItemGroupComponent, LegacyLocalizedObject, LegacyLocalizedObjectBase, LegacyLocalizedString, LegacyResponseComponent, LegacySurvey, LegacySurveyGroupItem, LegacySurveyItem, LegacySurveyItemTypes, LegacySurveyProps, LegacySurveySingleItem, LegacyValidation, LtExpressionEditor, LteExpressionEditor, MDContent, MaxExpressionEditor, MinExpressionEditor, NavigationContent, NumberArrayResponse, NumberPrecision, NumberResponse, OpenSurveyEvent, OrExpressionEditor, PageChangedEvent, RawSurveyItem, ReferenceArrayResponse, ReferenceResponse, ReferenceUsage, ReferenceUsageType, RenderedSurveyItem, ReservedSurveyItemTypes, ResponseChangedEvent, ResponseItem, ResponseValue, ResponseVariableEditor, ResponseVariableExpression, ScreenSize, SlotResponseBase, StrEqExpressionEditor, StrListContainsExpressionEditor, StringArrayResponse, StringResponse, StyleAttribution, SumExpressionEditor, Survey, SurveyCardContent, SurveyCardTranslations, SurveyEngineCore, SurveyEvent, SurveyEventBase, SurveyEventTypes, SurveyItemCore, SurveyItemCoreType, SurveyItemKey, SurveyItemResponse, SurveyItemTranslations, SurveyResponse, SurveyTranslations, TemplateAttribution, TemplateDefTypes, TemplateValueBase, TemplateValueDefinition, TemplateValueFormatDate, ValueRefTypeLookup, ValueReference, ValueReferenceMethod, ValueType, and, const_boolean, const_date, const_date_array, const_number, const_number_array, const_string, const_string_array, ctx_custom_expression, ctx_custom_value, ctx_locale, ctx_pflag_date, ctx_pflag_is_defined, ctx_pflag_num, ctx_pflag_string, deserializeTemplateValue, deserializeTemplateValues, eq, flattenTree, generateId, gt, gte, in_range, initValueForType, isLegacyItemGroupComponent, isLegacySurveyGroupItem, lt, lte, max, min, or, response_boolean, response_date, response_date_array, response_number, response_number_array, response_string, response_string_array, serializeTemplateValue, serializeTemplateValues, shuffleIndices, str_eq, str_list_contains, structuredCloneMethod, sum, validateLocale };
|
|
779
|
+
export { AndExpressionEditor, Attribution, AttributionType, BooleanResponse, BuiltInItemType, CQMContent, Codebook, CodebookItem, CodebookSlot, ConstBooleanEditor, ConstDateArrayEditor, ConstDateEditor, ConstExpression, ConstNumberArrayEditor, ConstNumberEditor, ConstStringArrayEditor, ConstStringEditor, Content, ContentType, ContextVariableExpression, ContextVariableType, CsvExportOptions, CtxCustomExpressionEditor, CtxCustomValueEditor, CtxLocaleEditor, CtxPFlagDateEditor, CtxPFlagIsDefinedEditor, CtxPFlagNumEditor, CtxPFlagStringEditor, DEFAULT_TRANSFORM, DateArrayResponse, DateFormatConfig, DateResponse, DurationArrayResponse, DurationResponse, DurationUnit, DurationUnits, EqExpressionEditor, ExportColumn, ExportColumnSource, ExportRow, ExportSingleSlotParams, ExporterProfile, Expression, ExpressionContext, ExpressionEditor, ExpressionEditorConfig, ExpressionEvaluator, ExpressionType, FunctionExpression, FunctionExpressionNames, GroupConfig, GroupItemCore, GtExpressionEditor, GteExpressionEditor, InRangeExpressionEditor, ItemCoreConstructor, ItemResponseMeta, ItemTypeCapabilities, ItemTypeDefinition, ItemTypeDefinitionRegistry, ItemTypeName, ItemTypeRegistry, JsonComponentContent, JsonConstExpression, JsonContextVariableExpression, JsonExpression, JsonFunctionExpression, JsonResponseItem, JsonResponseVariableExpression, JsonSurveyItemResponse, JsonSurveyResponse, JsonSurveyTranslations, JsonTemplateValue, LanguageChangedEvent, LegacyComponentProperties, LegacyConfidentialMode, LegacyItemComponent, LegacyItemGroupComponent, LegacyLocalizedObject, LegacyLocalizedObjectBase, LegacyLocalizedString, LegacyResponseComponent, LegacySurvey, LegacySurveyGroupItem, LegacySurveyItem, LegacySurveyItemTypes, LegacySurveyProps, LegacySurveySingleItem, LegacyValidation, LtExpressionEditor, LteExpressionEditor, MDContent, META_COLUMN_ORDER, MaxExpressionEditor, MetaColumnKey, MinExpressionEditor, NavigationContent, NumberArrayResponse, NumberPrecision, NumberResponse, OpenSurveyEvent, OrExpressionEditor, PageBreakConfig, PageBreakItemCore, PageChangedEvent, RawSurveyItem, ReferenceArrayResponse, ReferenceResponse, ReferenceUsage, ReferenceUsageType, RenderedSurveyItem, ReservedSurveyItemTypes, ResponseChangedEvent, ResponseItem, ResponseValue, ResponseVariableEditor, ResponseVariableExpression, ScreenSize, SlotRef, SlotResponseBase, SlotTransformConfig, SlotTransformMode, StrEqExpressionEditor, StrListContainsExpressionEditor, StringArrayResponse, StringResponse, StyleAttribution, SumExpressionEditor, Survey, SurveyCardContent, SurveyCardTranslations, SurveyEngineCore, SurveyEvent, SurveyEventBase, SurveyEventTypes, SurveyItemCore, SurveyItemCoreType, SurveyItemKey, SurveyItemResponse, SurveyItemTranslations, SurveyResponse, SurveyResponseContext, SurveyResponseExporter, SurveyTranslations, SurveyVersionBinding, TemplateAttribution, TemplateDefTypes, TemplateValueBase, TemplateValueDefinition, TemplateValueFormatDate, ValueRefTypeLookup, ValueReference, ValueReferenceMethod, ValueType, and, builtInItemCoreRegistry, const_boolean, const_date, const_date_array, const_number, const_number_array, const_string, const_string_array, createFullRegistry, createItemCore, createItemTypeDefinitionRegistry, ctx_custom_expression, ctx_custom_value, ctx_locale, ctx_pflag_date, ctx_pflag_is_defined, ctx_pflag_num, ctx_pflag_string, deserializeTemplateValue, deserializeTemplateValues, eq, escapeCsvCell, exportSingleResponseSlot, flattenTree, generateCodebook, generateCodingKey, generateId, gt, gte, in_range, initValueForType, isBuiltInItemType, isLegacyItemGroupComponent, isLegacySurveyGroupItem, lt, lte, max, min, or, response_boolean, response_date, response_date_array, response_number, response_number_array, response_string, response_string_array, serializeTemplateValue, serializeTemplateValues, serializeToCsv, shuffleIndices, str_eq, str_list_contains, structuredCloneMethod, sum, toItemTypeDefinitionRegistry, validateLocale };
|
|
597
780
|
//# sourceMappingURL=index.d.mts.map
|
package/build/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/survey/responses/response-meta.ts","../src/survey/responses/item-response.ts","../src/survey/responses/survey-response.ts","../src/survey/responses/utils.ts","../src/survey/utils/context.ts","../src/expressions/expression-evaluator.ts","../src/expressions/editors/expression-editor.ts","../src/expressions/editors/expression-editor-generators.ts","../src/to_mirgrate/data_types/expression.ts","../src/to_mirgrate/data_types/legacy-types.ts","../src/engine/engine.ts","../src/utils.ts"],"mappings":";;;;UAAiB,gBAAA;EACf,QAAA;AAAA;AAAA,cAGW,gBAAA;EAAA;;;;;KAOD,gBAAA,UAA0B,gBAAA,cAA8B,gBAAA;AAAA,UAInD,eAAA,oBAAmC,gBAAA,GAAmB,gBAAA;EACrE,IAAA,EAAM,UAAA;EACN,SAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,eAAA,QAAuB,gBAAA,CAAi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A,QAuBA,YAAA;EAAA,QAQA,gBAAA;EAAA,QAiCA,oBAAA;EAAA,QA6CA,WAAA;EAAA,QAgBA,kBAAA;EAAA,QAOA,oBAAA;EAAA,QAIA,aAAA;EAIR,eAAA,CAAgB,MAAA,WAAiB,kBAAA;EAAA,QAIzB,eAAA;EAAA,QAcA,kBAAA;EAAA,QAgCA,qBAAA;EAAA,QAwBA,qBAAA;EAAA,QAgBA,eAAA;AAAA;AAAA,cAgBG,WAAA,GAAe,QAAA,EAAU,kBAAA,KAAqB,kBAAA;;;;;;;AVpnB3D;iBWMgB,cAAA,CAAe,MAAA;AAAA,iBAWf,qBAAA,GAAA,CAAyB,GAAA,EAAK,CAAA,GAAI,CAAA;AAAA,iBAUlC,UAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/survey/responses/response-meta.ts","../src/survey/responses/item-response.ts","../src/survey/responses/survey-response.ts","../src/survey/responses/utils.ts","../src/survey/utils/context.ts","../src/expressions/expression-evaluator.ts","../src/expressions/editors/expression-editor.ts","../src/expressions/editors/expression-editor-generators.ts","../src/to_mirgrate/data_types/expression.ts","../src/to_mirgrate/data_types/legacy-types.ts","../src/engine/engine.ts","../src/utils.ts","../src/response-exporter/types.ts","../src/response-exporter/exporter.ts","../src/response-exporter/slot-formatter.ts","../src/response-exporter/csv-serializer.ts","../src/response-exporter/codebook.ts"],"mappings":";;;;UAAiB,gBAAA;EACf,QAAA;AAAA;AAAA,cAGW,gBAAA;EAAA;;;;;KAOD,gBAAA,UAA0B,gBAAA,cAA8B,gBAAA;AAAA,UAInD,eAAA,oBAAmC,gBAAA,GAAmB,gBAAA;EACrE,IAAA,EAAM,UAAA;EACN,SAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,eAAA,QAAuB,gBAAA,CAAiB,UAAA;EAC/E,KAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,eAAA,QAAuB,gBAAA,CAAiB,WAAA;EAChF,KAAA;AAAA;AAAA,UAG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