Members
Methods
# static buidlUpdate(updateDto, isAiGenerated, existingInvestigation) → {MongoUpdateFields}
Builds investigation update data for the new API format.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
updateDto |
IUpdateInvestigationDto
|
The update data in the new format, including string/number fields and step updates. |
|
isAiGenerated |
boolean
|
false | Whether the update is AI-generated, which sets aiGeneratedValue fields. |
existingInvestigation |
IInvestigationModel
|
null
|
null | Optional existing investigation to preserve values when fields are null. |
A MongoDB update object containing field paths for direct database updates.
MongoUpdateFields
# static build(createDto, aiAssistantFlow, investigationStatus) → {Partial.<IInvestigation>}
Builds investigation data for creation with global options.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
createDto |
ICreateInvestigationDto
|
The validated request data. |
|
aiAssistantFlow |
boolean
|
false | Whether this is an AI-assisted creation (default: false). |
investigationStatus |
InvestigationStatus
|
The investigation status (default: DRAFT_INCOMPLETE). |
A clean investigation object ready for database storage.
Partial.<IInvestigation>
# static buildArrayFields(builder, dto, aiAssistantFlow)
Builds editable array fields for an investigation.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data, including arrays. |
aiAssistantFlow |
boolean
|
Whether this is an AI-assisted creation. |
# static buildEditableFieldsWithMapping(builder, dto, fieldMappings, hasValueFunction, aiAssistantFlow)
Type-safe helper to build editable fields using field mappings.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data. |
fieldMappings |
Array.<IFieldMapping>
|
An array of mappings between DTO fields and investigation fields. |
hasValueFunction |
function
|
A function to check if a value is valid for inclusion. |
aiAssistantFlow |
boolean
|
Whether this is an AI-assisted creation. |
# static buildEditableStepsFromSimpleSteps(simpleSteps, aiAssistantFlow, existingSteps) → {Array.<IInvestigationBaseStepModel>}
Converts simple step definitions into editable step models. Supports both simple values and {value, aiGeneratedValue} format. Preserves existing values when update fields are null/undefined.
Parameters:
| Name | Type | Description |
|---|---|---|
simpleSteps |
Array
|
Steps received from API (can be IStep[] or new format with {value, aiGeneratedValue}). |
aiAssistantFlow |
boolean
|
Whether the data should be marked as AI-generated. |
existingSteps |
Array.<IInvestigationBaseStepModel>
|
Optional existing steps to preserve values from. |
Editable steps ready for persistence.
Array.<IInvestigationBaseStepModel>
# static buildMetadata(builder, dto, _aiAssistantFlow)
Builds metadata and initializes observers for an investigation.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data. |
_aiAssistantFlow |
boolean
|
Indicates if this is part of an AI-assisted creation (not used in this method). |
# static buildNumberFields(builder, dto, aiAssistantFlow)
Builds editable number fields for an investigation.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data. |
aiAssistantFlow |
boolean
|
Whether this is an AI-assisted creation. |
# static buildStepsField(builder, dto, aiAssistantFlow)
Builds the steps field for an investigation, with special handling for an array of IEditableField<IStep>.
Converts simple steps from API input into EditableField-wrapped steps for database storage.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data, including steps. |
aiAssistantFlow |
boolean
|
Whether this is an AI-assisted creation. |
# static buildStringFields(builder, dto, aiAssistantFlow)
Builds editable string fields for an investigation.
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
Partial.<IInvestigation>
|
Partial investigation object to populate. |
dto |
ICreateInvestigationDto
|
The data transfer object containing investigation creation data. |
aiAssistantFlow |
boolean
|
Whether this is an AI-assisted creation. |
# static buildUpdateContradiction(detectedContradictionResult, investigation) → {Record.<string, unknown>}
Builds investigation update data for contradiction detection.
Parameters:
| Name | Type | Description |
|---|---|---|
detectedContradictionResult |
IAssistantContradictionDetectionFormat
|
An array of detected contradictions to apply to investigation fields. |
investigation |
IInvestigationModel
|
The current investigation to update. |
A MongoDB update object with contradiction flags and metadata for affected fields.
Record.<string, unknown>
# static checkArrayFieldContradiction(investigation, detectedContradiction) → {Record.<string, unknown>}
Checks for contradictions in array fields of an investigation.
Parameters:
| Name | Type | Description |
|---|---|---|
investigation |
IInvestigationModel
|
The investigation to check for contradictions. |
detectedContradiction |
Array.<IDetectedContradiction>
|
null
|
undefined
|
The detected contradictions. |
An object containing MongoDB update fields for setting or resetting contradictions.
Record.<string, unknown>
# static convertSimpleObjectsToEditableObjects(simpleObjects, aiAssistantFlow) → {Array.<IObjectBase>}
Converts an array of ISimpleObject to an array of IObjectBase with an EditableField structure.
Parameters:
| Name | Type | Description |
|---|---|---|
simpleObjects |
Array.<ISimpleObject>
|
The array of simple objects to convert. |
aiAssistantFlow |
boolean
|
Whether this conversion is part of an AI-assisted creation. |
An array of IObjectBase objects with EditableField-wrapped properties.
Array.<IObjectBase>
# static createContradictionResetFields(fieldPath) → {Record.<string, unknown>}
Creates MongoDB update fields for resetting contradiction properties.
Parameters:
| Name | Type | Description |
|---|---|---|
fieldPath |
string
|
The MongoDB dot notation path (e.g., "steps.0.title", "objects.1.name"). |
An object containing MongoDB update fields for resetting contradictions.
Record.<string, unknown>
# static createContradictionSetFields(fieldPath, contradiction) → {Record.<string, unknown>}
Creates MongoDB update fields for setting contradiction properties.
Parameters:
| Name | Type | Description |
|---|---|---|
fieldPath |
string
|
The MongoDB dot notation path (e.g., "steps.0.title", "objects.1.name"). |
contradiction |
IDetectedContradiction
|
The detected contradiction object. |
An object containing MongoDB update fields for setting the contradiction.
Record.<string, unknown>
# static createEditableField(value, aiAssistantFlow, aiGeneratedValue) → {IEditableField.<unknown>}
Creates a standard EditableField structure based on aiAssistantFlow.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
value |
unknown
|
The value to store in the EditableField. |
|
aiAssistantFlow |
boolean
|
Whether this is part of an AI-assisted creation. |
|
aiGeneratedValue |
unknown
|
null
|
null | Optional AI-generated value to store separately. |
An EditableField object containing the provided value.
IEditableField.<unknown>
# static createEditableStep(simpleStep, aiAssistantFlow, existingStep) → {IInvestigationBaseStepModel}
Creates an editable step model from a simple step. Supports both simple values and {value, aiGeneratedValue} format for backward compatibility. Preserves existing values when update fields are null/undefined.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
simpleStep |
object
|
null
|
Step data from the API payload. |
|
aiAssistantFlow |
boolean
|
Whether the data should be marked as AI-generated. |
|
existingStep |
IInvestigationBaseStepModel
|
null
|
null | Optional existing step to preserve values from. |
Editable step structure.
IInvestigationBaseStepModel
# static createVector3EditableField(vector) → {IEditableField.<number>|null}
Creates a Vector3 EditableField structure.
Parameters:
| Name | Type | Description |
|---|---|---|
vector |
object
|
The vector data containing x, y, and z coordinates. |
A Vector3 object with an EditableField structure, or null if not applicable.
IEditableField.<number>
|
null
# static extractEditablePayload(input) → {object}
Extracts value and aiGeneratedValue from a payload that can be either a simple value or {value, aiGeneratedValue} object.
Parameters:
| Name | Type | Description |
|---|---|---|
input |
unknown
|
The input value (can be simple value or object with value/aiGeneratedValue). |
Object with value, aiGeneratedValue, and hasAiGeneratedValue flag.
object
# static mapObjectToMongoFormat(obj, isAiGenerated, existingObject) → {IObjectBase}
Maps an API object format to a MongoDB schema format. Supports both simple values and {value, aiGeneratedValue} format. Preserves existing values when update fields are null/undefined.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
obj |
IUpdateObjectDto
|
The object in API format. |
|
isAiGenerated |
boolean
|
false | Whether the update is AI-generated, which sets aiGeneratedValue fields. |
existingObject |
IObjectBase
|
null
|
null | Optional existing object to preserve values from. |
The object in MongoDB format with an EditableField structure.
IObjectBase