@openforis/arena-core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/nodePointer.js.map +1 -1
- package/dist/esm/node/nodeValueFormatter.js.map +1 -1
- package/dist/esm/node/nodeValues.js.map +1 -1
- package/dist/esm/nodeDef/factory.js.map +1 -1
- package/dist/esm/nodeDef/index.js.map +1 -1
- package/dist/esm/nodeDef/nodeDef.js.map +1 -1
- package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
- package/dist/esm/nodeDef/service.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/esm/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/esm/record/_records/recordCompletion.js.map +1 -1
- package/dist/esm/record/_records/recordGetters.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/countValidator.js.map +1 -1
- package/dist/esm/survey/survey.js.map +1 -1
- package/dist/esm/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/esm/survey/surveys/dependencies.js.map +1 -1
- package/dist/esm/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/esm/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node/nodePointer.d.ts +2 -2
- package/dist/node/nodePointer.js.map +1 -1
- package/dist/node/nodeValueFormatter.d.ts +2 -2
- package/dist/node/nodeValueFormatter.js.map +1 -1
- package/dist/node/nodeValues.d.ts +3 -3
- package/dist/node/nodeValues.js.map +1 -1
- package/dist/nodeDef/factory.d.ts +3 -3
- package/dist/nodeDef/factory.js.map +1 -1
- package/dist/nodeDef/index.d.ts +1 -1
- package/dist/nodeDef/index.js.map +1 -1
- package/dist/nodeDef/nodeDef.d.ts +2 -0
- package/dist/nodeDef/nodeDef.js.map +1 -1
- package/dist/nodeDef/nodeDefs.d.ts +50 -50
- package/dist/nodeDef/nodeDefs.js.map +1 -1
- package/dist/nodeDef/service.d.ts +7 -7
- package/dist/nodeDef/service.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/context.d.ts +3 -4
- package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/node/identifier.d.ts +2 -2
- package/dist/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/record/_records/nodeDefSelfReferences.d.ts +2 -2
- package/dist/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/record/_records/recordCompletion.js.map +1 -1
- package/dist/record/_records/recordGetters.d.ts +4 -4
- package/dist/record/_records/recordGetters.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/record/recordValidator/attributeKeyValidator.d.ts +3 -3
- package/dist/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeTypeValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeUniqueValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/record/recordValidator/countValidator.d.ts +2 -2
- package/dist/record/recordValidator/countValidator.js.map +1 -1
- package/dist/survey/survey.d.ts +2 -2
- package/dist/survey/survey.js.map +1 -1
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.d.ts +3 -3
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/survey/surveys/dependencies.d.ts +4 -4
- package/dist/survey/surveys/dependencies.js.map +1 -1
- package/dist/survey/surveys/nodeDefs.d.ts +28 -28
- package/dist/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/tests/builder/recordBuilder/nodeBuilder.d.ts +2 -2
- package/dist/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +3 -3
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributeValidator.js","sourceRoot":"","sources":["../../../src/record/recordValidator/attributeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qCAA2F;AAC3F,2CAA8G;AAC9G,yCAAmD;AACnD,gDAA0D;AAC1D,uCAAqC;AACrC,iDAMyB;AAEzB,kDAAoD;AAEpD,4EAAwE;AACxE,+GAGgE;AAChE,mHAA8F;AAC9F,wCAAoC;AACpC,4DAAwD;AACxD,mEAAuG;AACvG,qEAAiE;AACjE,yEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,qDAAyB,EAAE,CAAA;AAkC3D,MAAM,wBAAwB,GAAG,CAC/B,MAAsF,EACrB,EAAE;IACnE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAA;IAElE,MAAM,YAAY,GAAG,gBAAO,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;IACtF,MAAM,yBAAyB,GAAG,gBAAO,CAAC,gCAAgC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAA;IAC7G,IAAI,CAAC,yBAAyB;QAAE,OAAO,SAAS,CAAA;IAEhD,MAAM,sBAAsB,GAAG,iBAAO,CAAC,WAAW,CAAC,SAAS,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;IACrG,IAAI,CAAC,sBAAsB;QAAE,OAAO,SAAS,CAAA;IAE7C,MAAM,4BAA4B,GAAG,iBAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;IACtF,IAAI,CAAC,4BAA4B;QAAE,OAAO,SAAS,CAAA;IAEnD,MAAM,QAAQ,GAAG,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EACV,SAAS,EAAE,IAAI,EACf,oBAAoB;YACpB,mBAAmB,IACnB,CACH,CAAA;QAED,IAAI,MAAA,kBAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,0CAAE,MAAM,EAAE,CAAC;YAC7C,WAAW,CACT,qCAAqC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC,CAC1G,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,wCAAwC,GAAG,CAC/C,MAA4C,EACZ,EAAE;IAClC,MAAM,eAAe,GAAsB,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAA0B,EAAE,CAAA;IACvD,6EAA6E;IAC7E,MAAM,eAAe,GAAG,IAAA,6CAAqB,GAAE,CAAA;IAE/C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAA;QACpC,iEAAiE;QACjE,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChE,qEAAqE;YACrE,MAAM,wBAAwB,mCAAQ,MAAM,KAAE,SAAS,EAAE,cAAc,EAAE,eAAe,GAAE,CAAA;YAC1F,qBAAqB,CAAC,QAAQ,CAAC,GAAG,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,CAAA,CAAC,UAAU;QAChG,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAChC,wCAAwC;CACzC,CAAA","sourcesContent":["import { ArenaDictionary } from '../../common'\nimport { ArenaLabels } from '../../language'\nimport { ArenaRecordNode, RecordNodeKeys, RecordNodes, RecordNodeValues } from '../../node'\nimport { ArenaNodeDef, ArenaNodeDefExpression, ArenaNodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ArenaValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ArenaValidationFields } from '../../validation/validation'\nimport { RecordNodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\nimport {\n RecordExpressionEvaluationContexts,\n RecordExpressionEvaluationParams,\n} from '../recordNodesUpdater/recordExpressionEvaluationContext'\nimport { evaluateRequiredIf } from '../recordNodesUpdater/recordNodeDependentsRequiredUpdater'\nimport { Records } from '../records'\nimport { RecordValidations } from '../recordValidations'\nimport { AttributeKeyValidator, createEntityKeysCache, EntityKeysCache } from './attributeKeyValidator'\nimport { AttributeTypeValidator } from './attributeTypeValidator'\nimport { AttributeUniqueValidator } from './attributeUniqueValidator'\n\nconst expressionEvaluator = new RecordExpressionEvaluator()\n\n// the params of the record expression evaluator (validation expressions, required if)\nexport type ArenaRecordValidatorParams = RecordExpressionEvaluationParams\n\nexport interface ArenaAttributeValidatorParams extends ArenaRecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface ArenaAttributesValidatorParams extends ArenaRecordValidatorParams {\n nodes: ArenaDictionary<ArenaRecordNode>\n}\n\nexport interface ArenaSortedAttributesValidatorParams extends ArenaRecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\n\ntype SiblingKeyNodesGroup = {\n items: SiblingKeyNodeItem[]\n // items whose key node is not validated anyway (not in the nodes to validate): only these are compared by value\n itemsToCompare?: SiblingKeyNodeItem[]\n // entity of the first key attribute validated in this group: its key nodes with errors are not added\n // until a key attribute of another entity is validated\n firstEntityUuid?: string\n allItemsWithErrorsAdded?: boolean\n}\n\n// sibling key nodes are cached by ancestor multiple entity parent and def uuid during the same validation call:\n// when many entities are added to the same parent entity (e.g. data import), computing them for every updated\n// key attribute would take a time that grows quadratically with the number of entities\ntype SiblingKeyNodesCache = Map<string, SiblingKeyNodesGroup>\n\nconst _getSiblingNodeKeysGroup = (\n params: ArenaAttributeValidatorParams & { siblingKeyNodesCache: SiblingKeyNodesCache }\n): { entityUuid: string; group: SiblingKeyNodesGroup } | undefined => {\n const { survey, record, attribute, siblingKeyNodesCache } = params\n\n const attributeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const ancestorMultipleEntityDef = Surveys.getNodeDefAncestorMultipleEntity({ survey, nodeDef: attributeDef })\n if (!ancestorMultipleEntityDef) return undefined\n\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return undefined\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return undefined\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let group = siblingKeyNodesCache.get(cacheKey)\n if (!group) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n const items: SiblingKeyNodeItem[] = []\n for (const entity of entities) {\n const keyNodes = Records.getEntityKeyNodes(survey, entity, undefined, keyDefs)(record)\n for (const keyNode of keyNodes) {\n if (!keyNode) continue\n const nodeValidation =\n record.validation && RecordValidations.getValidationNode({ nodeUuid: keyNode.uuid })(record.validation)\n items.push({ entityUuid: entity.uuid, keyNode, hasErrors: !!nodeValidation && !nodeValidation.valid })\n }\n }\n group = { items }\n siblingKeyNodesCache.set(cacheKey, group)\n }\n return { entityUuid: ancestorMultipleEntity.uuid, group }\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: ArenaSurvey\n expression: ArenaNodeDefExpression\n defaultMessage?: string\n}): ArenaLabels => {\n const { survey, expression, defaultMessage } = params\n const messages: ArenaLabels = { ...expression.messages }\n\n const languages = Surveys.getLanguages(survey)\n const defaultMessageDefined = Objects.isNotEmpty(defaultMessage)\n\n for (const lang of languages) {\n const customMessage = messages[lang]\n if (Objects.isEmpty(customMessage) && defaultMessageDefined) {\n messages[lang] = defaultMessage\n }\n }\n\n return messages\n}\n\nconst _isValueRequired = async (\n params: ArenaAttributeValidatorParams & { nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps> }\n): Promise<boolean> => {\n const { record, attribute, nodeDef } = params\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parentNode = Records.getParent(attribute)(record)\n if (!parentNode) return false\n // evaluated here (not read from the parent node meta flag) so validation doesn't depend on up to date node meta\n // (e.g. records created before the \"required if\" condition was defined)\n return evaluateRequiredIf({ ...params, nodeCtx: parentNode, nodeDef })\n}\n\nconst _validateRequired =\n (params: ArenaAttributeValidatorParams & { nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps> }) =>\n async (_field: string, node: any): Promise<ArenaValidationResult> => {\n const valid = !RecordNodes.isValueBlank(node) || !(await _isValueRequired(params))\n return valid\n ? ValidationResultFactory.createInstance()\n : ValidationResultFactory.createInstance({\n key: 'record.attribute.valueRequired',\n severity: ValidationSeverity.error,\n valid,\n })\n }\n\n/**\n * Evaluates the validation expressions.\n */\nconst _validateNodeValidations =\n (params: ArenaRecordValidatorParams & { nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps> }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ArenaValidationResult> => {\n const { survey, nodeDef } = params\n if (RecordNodes.isValueBlank(node)) return ValidationResultFactory.createInstance()\n\n const validations = NodeDefs.getValidations(nodeDef)\n if (!validations?.expressions?.length) return ValidationResultFactory.createInstance()\n\n const applicableExpressionsEval = await expressionEvaluator.evalApplicableExpressions({\n ...RecordExpressionEvaluationContexts.extractEvaluationParams(params),\n nodeCtx: node,\n expressions: validations.expressions,\n stopAtFirstFound: false,\n })\n\n let validationResult = ValidationResultFactory.createInstance()\n\n for (const { expression, value: valid } of applicableExpressionsEval) {\n if (!valid) {\n const messages = _getValidationMessagesWithDefault({\n survey,\n expression,\n defaultMessage: expression.expression,\n })\n\n validationResult = ValidationResultFactory.createInstance({\n valid: false,\n key: 'record.attribute.customValidation',\n severity: expression.severity,\n messages,\n })\n break\n }\n }\n\n return validationResult\n }\n\nconst validateAttribute = async (params: ArenaAttributeValidatorParams & { entityKeysCache?: EntityKeysCache }) => {\n const { survey, record, attribute } = params\n if (Records.isNodeApplicable(attribute)(record)) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const validatorParams = { ...params, nodeDef }\n return new Validator().validate(attribute, {\n [RecordNodeKeys.value]: [\n _validateRequired(validatorParams),\n AttributeTypeValidator.validateValueType(validatorParams),\n _validateNodeValidations(validatorParams),\n AttributeKeyValidator.validateAttributeKey(validatorParams),\n AttributeUniqueValidator.validateAttributeUnique(validatorParams),\n ],\n })\n }\n return ValidationFactory.createInstance()\n}\n\nconst findSiblingKeyNodesToValidate = (\n params: ArenaAttributeValidatorParams & {\n nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache: SiblingKeyNodesCache\n nodeUuidsToValidate: Set<string>\n }\n): ArenaRecordNode[] => {\n const { survey, nodeDef, nodeParent: parentNode, attribute, nodeUuidsToValidate } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && RecordNodes.isDefaultValueApplied(attribute))\n ) {\n // when a new node is created and the key is autoincremental, its value will be unique\n // and the validation of sibling key attributes is not necessary\n return []\n }\n // when a key attribute is updated, a sibling key attribute with the same value\n // or a sibling attribute with a validation error (duplicate key) should be re-validated\n const siblingNodeKeysGroup = _getSiblingNodeKeysGroup(params)\n if (!siblingNodeKeysGroup) return []\n\n const { entityUuid, group } = siblingNodeKeysGroup\n // key nodes in the nodes to validate are validated anyway: no need to compare their value\n group.itemsToCompare ??= group.items.filter((item) => !nodeUuidsToValidate.has(item.keyNode.uuid))\n\n const result: ArenaRecordNode[] = []\n for (const { entityUuid: itemEntityUuid, keyNode } of group.itemsToCompare) {\n if (\n itemEntityUuid !== entityUuid &&\n RecordNodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })\n ) {\n result.push(keyNode)\n }\n }\n return result.concat(_findSiblingKeyNodesWithErrorsNotAdded({ group, entityUuid }))\n}\n\n// key nodes with errors (in entities other than the attribute's one) are added only once per group\nconst _findSiblingKeyNodesWithErrorsNotAdded = (params: {\n group: SiblingKeyNodesGroup\n entityUuid: string\n}): ArenaRecordNode[] => {\n const { group, entityUuid } = params\n if (group.firstEntityUuid === undefined) {\n group.firstEntityUuid = entityUuid\n return group.items.filter((item) => item.hasErrors && item.entityUuid !== entityUuid).map((item) => item.keyNode)\n }\n if (group.allItemsWithErrorsAdded || group.firstEntityUuid === entityUuid) return []\n group.allItemsWithErrorsAdded = true\n const { firstEntityUuid } = group\n return group.items.filter((item) => item.hasErrors && item.entityUuid === firstEntityUuid).map((item) => item.keyNode)\n}\n\n// attribute siblings (same attribute def in the sibling entities) added to the nodes to validate,\n// by parent entity def and parent of the parent entity\ntype AttributeSiblingsAddedCache = Map<string, { firstParentEntity: ArenaRecordNode; allSiblingsAdded?: boolean }>\n\nconst findUniqueAttributeSiblingsToValidate = (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n nodeParent?: ArenaRecordNode\n attributeSiblingsAddedCache: AttributeSiblingsAddedCache\n}): ArenaRecordNode[] => {\n const { record, node, nodeDef, nodeParent, attributeSiblingsAddedCache } = params\n if (!nodeParent) return []\n const nodeParentParent = Records.getParent(nodeParent)(record)\n if (!nodeParentParent) return []\n // the siblings of the attribute are the attributes in the other parent entities:\n // after visiting attributes in 2 different parent entities, all the attributes of the group have been added\n const cacheKey = `${nodeParentParent.uuid}_${nodeParent.nodeDefUuid}_${nodeDef.uuid}`\n const cached = attributeSiblingsAddedCache.get(cacheKey)\n if (!cached) {\n attributeSiblingsAddedCache.set(cacheKey, { firstParentEntity: nodeParent })\n return Records.getAttributeSiblings(node, nodeDef)(record)\n }\n if (cached.allSiblingsAdded || cached.firstParentEntity.uuid === nodeParent.uuid) return []\n cached.allSiblingsAdded = true\n return Records.getChildren(cached.firstParentEntity, nodeDef.uuid)(record)\n}\n\nconst findSortedNodesToValidate = (params: ArenaSortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result: ArenaRecordNode[] = []\n const resultUuids = new Set<string>()\n const addToResult = (nodes: ArenaRecordNode[]) => {\n for (const node of nodes) {\n if (!resultUuids.has(node.uuid)) {\n resultUuids.add(node.uuid)\n result.push(node)\n }\n }\n }\n // every attribute in nodesArray is validated (it's included in its own dependents)\n const nodeUuidsToValidate = new Set(nodesArray.map((node) => node.uuid))\n const siblingKeyNodesCache: SiblingKeyNodesCache = new Map()\n const attributeSiblingsAddedCache: AttributeSiblingsAddedCache = new Map()\n for (const node of nodesArray) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (!NodeDefs.isAttribute(nodeDef)) {\n continue\n }\n // Get dependents and attribute itself\n const nodePointersAttributeAndDependents = [\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.validations, true)(record),\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.required)(record),\n ]\n\n const nodeParent = Records.getParent(node)(record)\n\n addToResult(\n RecordNodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents })\n )\n addToResult(\n findSiblingKeyNodesToValidate({\n ...params,\n nodeDef,\n nodeParent,\n attribute: node,\n siblingKeyNodesCache,\n nodeUuidsToValidate,\n })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n addToResult(\n findUniqueAttributeSiblingsToValidate({ record, node, nodeDef, nodeParent, attributeSiblingsAddedCache })\n )\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: ArenaSortedAttributesValidatorParams\n): Promise<ArenaValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ArenaValidationFields = {}\n // the record doesn't change during the validation: entity keys can be cached\n const entityKeysCache = createEntityKeysCache()\n\n for (const nodeToValidate of nodesToValidate) {\n const nodeUuid = nodeToValidate.uuid\n // Validate only attributes not deleted and not validated already\n if (!nodeToValidate.deleted && !validationsByNodeUuid[nodeUuid]) {\n // sequential: avoid concurrent item/taxon lookups on large node sets\n const attributeValidatorParams = { ...params, attribute: nodeToValidate, entityKeysCache }\n validationsByNodeUuid[nodeUuid] = await validateAttribute(attributeValidatorParams) // NOSONAR\n }\n }\n return validationsByNodeUuid\n}\n\nexport const AttributeValidator = {\n validateSelfAndDependentSortedAttributes,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attributeValidator.js","sourceRoot":"","sources":["../../../src/record/recordValidator/attributeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,qCAA2F;AAC3F,2CAAiF;AACjF,yCAAmD;AACnD,gDAA0D;AAC1D,uCAAqC;AACrC,iDAMyB;AAEzB,kDAAoD;AAEpD,4EAAwE;AACxE,+GAGgE;AAChE,mHAA8F;AAC9F,wCAAoC;AACpC,4DAAwD;AACxD,mEAAuG;AACvG,qEAAiE;AACjE,yEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,qDAAyB,EAAE,CAAA;AAkC3D,MAAM,wBAAwB,GAAG,CAC/B,MAAsF,EACrB,EAAE;IACnE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAA;IAElE,MAAM,YAAY,GA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AAA;QACpC,iEAAiE;QACjE,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChE,qEAAqE;YACrE,MAAM,wBAAwB,mCAAQ,MAAM,KAAE,SAAS,EAAE,cAAc,EAAE,eAAe,GAAE,CAAA;YAC1F,qBAAqB,CAAC,QAAQ,CAAC,GAAG,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,CAAA,CAAC,UAAU;QAChG,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAChC,wCAAwC;CACzC,CAAA","sourcesContent":["import { ArenaDictionary } from '../../common'\nimport { ArenaLabels } from '../../language'\nimport { ArenaRecordNode, RecordNodeKeys, RecordNodes, RecordNodeValues } from '../../node'\nimport { ArenaAnyNodeDef, ArenaNodeDefExpression, NodeDefs } from '../../nodeDef'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ArenaValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ArenaValidationFields } from '../../validation/validation'\nimport { RecordNodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\nimport {\n RecordExpressionEvaluationContexts,\n RecordExpressionEvaluationParams,\n} from '../recordNodesUpdater/recordExpressionEvaluationContext'\nimport { evaluateRequiredIf } from '../recordNodesUpdater/recordNodeDependentsRequiredUpdater'\nimport { Records } from '../records'\nimport { RecordValidations } from '../recordValidations'\nimport { AttributeKeyValidator, createEntityKeysCache, EntityKeysCache } from './attributeKeyValidator'\nimport { AttributeTypeValidator } from './attributeTypeValidator'\nimport { AttributeUniqueValidator } from './attributeUniqueValidator'\n\nconst expressionEvaluator = new RecordExpressionEvaluator()\n\n// the params of the record expression evaluator (validation expressions, required if)\nexport type ArenaRecordValidatorParams = RecordExpressionEvaluationParams\n\nexport interface ArenaAttributeValidatorParams extends ArenaRecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface ArenaAttributesValidatorParams extends ArenaRecordValidatorParams {\n nodes: ArenaDictionary<ArenaRecordNode>\n}\n\nexport interface ArenaSortedAttributesValidatorParams extends ArenaRecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\n\ntype SiblingKeyNodesGroup = {\n items: SiblingKeyNodeItem[]\n // items whose key node is not validated anyway (not in the nodes to validate): only these are compared by value\n itemsToCompare?: SiblingKeyNodeItem[]\n // entity of the first key attribute validated in this group: its key nodes with errors are not added\n // until a key attribute of another entity is validated\n firstEntityUuid?: string\n allItemsWithErrorsAdded?: boolean\n}\n\n// sibling key nodes are cached by ancestor multiple entity parent and def uuid during the same validation call:\n// when many entities are added to the same parent entity (e.g. data import), computing them for every updated\n// key attribute would take a time that grows quadratically with the number of entities\ntype SiblingKeyNodesCache = Map<string, SiblingKeyNodesGroup>\n\nconst _getSiblingNodeKeysGroup = (\n params: ArenaAttributeValidatorParams & { siblingKeyNodesCache: SiblingKeyNodesCache }\n): { entityUuid: string; group: SiblingKeyNodesGroup } | undefined => {\n const { survey, record, attribute, siblingKeyNodesCache } = params\n\n const attributeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const ancestorMultipleEntityDef = Surveys.getNodeDefAncestorMultipleEntity({ survey, nodeDef: attributeDef })\n if (!ancestorMultipleEntityDef) return undefined\n\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return undefined\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return undefined\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let group = siblingKeyNodesCache.get(cacheKey)\n if (!group) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n const items: SiblingKeyNodeItem[] = []\n for (const entity of entities) {\n const keyNodes = Records.getEntityKeyNodes(survey, entity, undefined, keyDefs)(record)\n for (const keyNode of keyNodes) {\n if (!keyNode) continue\n const nodeValidation =\n record.validation && RecordValidations.getValidationNode({ nodeUuid: keyNode.uuid })(record.validation)\n items.push({ entityUuid: entity.uuid, keyNode, hasErrors: !!nodeValidation && !nodeValidation.valid })\n }\n }\n group = { items }\n siblingKeyNodesCache.set(cacheKey, group)\n }\n return { entityUuid: ancestorMultipleEntity.uuid, group }\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: ArenaSurvey\n expression: ArenaNodeDefExpression\n defaultMessage?: string\n}): ArenaLabels => {\n const { survey, expression, defaultMessage } = params\n const messages: ArenaLabels = { ...expression.messages }\n\n const languages = Surveys.getLanguages(survey)\n const defaultMessageDefined = Objects.isNotEmpty(defaultMessage)\n\n for (const lang of languages) {\n const customMessage = messages[lang]\n if (Objects.isEmpty(customMessage) && defaultMessageDefined) {\n messages[lang] = defaultMessage\n }\n }\n\n return messages\n}\n\nconst _isValueRequired = async (\n params: ArenaAttributeValidatorParams & { nodeDef: ArenaAnyNodeDef }\n): Promise<boolean> => {\n const { record, attribute, nodeDef } = params\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parentNode = Records.getParent(attribute)(record)\n if (!parentNode) return false\n // evaluated here (not read from the parent node meta flag) so validation doesn't depend on up to date node meta\n // (e.g. records created before the \"required if\" condition was defined)\n return evaluateRequiredIf({ ...params, nodeCtx: parentNode, nodeDef })\n}\n\nconst _validateRequired =\n (params: ArenaAttributeValidatorParams & { nodeDef: ArenaAnyNodeDef }) =>\n async (_field: string, node: any): Promise<ArenaValidationResult> => {\n const valid = !RecordNodes.isValueBlank(node) || !(await _isValueRequired(params))\n return valid\n ? ValidationResultFactory.createInstance()\n : ValidationResultFactory.createInstance({\n key: 'record.attribute.valueRequired',\n severity: ValidationSeverity.error,\n valid,\n })\n }\n\n/**\n * Evaluates the validation expressions.\n */\nconst _validateNodeValidations =\n (params: ArenaRecordValidatorParams & { nodeDef: ArenaAnyNodeDef }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ArenaValidationResult> => {\n const { survey, nodeDef } = params\n if (RecordNodes.isValueBlank(node)) return ValidationResultFactory.createInstance()\n\n const validations = NodeDefs.getValidations(nodeDef)\n if (!validations?.expressions?.length) return ValidationResultFactory.createInstance()\n\n const applicableExpressionsEval = await expressionEvaluator.evalApplicableExpressions({\n ...RecordExpressionEvaluationContexts.extractEvaluationParams(params),\n nodeCtx: node,\n expressions: validations.expressions,\n stopAtFirstFound: false,\n })\n\n let validationResult = ValidationResultFactory.createInstance()\n\n for (const { expression, value: valid } of applicableExpressionsEval) {\n if (!valid) {\n const messages = _getValidationMessagesWithDefault({\n survey,\n expression,\n defaultMessage: expression.expression,\n })\n\n validationResult = ValidationResultFactory.createInstance({\n valid: false,\n key: 'record.attribute.customValidation',\n severity: expression.severity,\n messages,\n })\n break\n }\n }\n\n return validationResult\n }\n\nconst validateAttribute = async (params: ArenaAttributeValidatorParams & { entityKeysCache?: EntityKeysCache }) => {\n const { survey, record, attribute } = params\n if (Records.isNodeApplicable(attribute)(record)) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const validatorParams = { ...params, nodeDef }\n return new Validator().validate(attribute, {\n [RecordNodeKeys.value]: [\n _validateRequired(validatorParams),\n AttributeTypeValidator.validateValueType(validatorParams),\n _validateNodeValidations(validatorParams),\n AttributeKeyValidator.validateAttributeKey(validatorParams),\n AttributeUniqueValidator.validateAttributeUnique(validatorParams),\n ],\n })\n }\n return ValidationFactory.createInstance()\n}\n\nconst findSiblingKeyNodesToValidate = (\n params: ArenaAttributeValidatorParams & {\n nodeDef: ArenaAnyNodeDef\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache: SiblingKeyNodesCache\n nodeUuidsToValidate: Set<string>\n }\n): ArenaRecordNode[] => {\n const { survey, nodeDef, nodeParent: parentNode, attribute, nodeUuidsToValidate } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && RecordNodes.isDefaultValueApplied(attribute))\n ) {\n // when a new node is created and the key is autoincremental, its value will be unique\n // and the validation of sibling key attributes is not necessary\n return []\n }\n // when a key attribute is updated, a sibling key attribute with the same value\n // or a sibling attribute with a validation error (duplicate key) should be re-validated\n const siblingNodeKeysGroup = _getSiblingNodeKeysGroup(params)\n if (!siblingNodeKeysGroup) return []\n\n const { entityUuid, group } = siblingNodeKeysGroup\n // key nodes in the nodes to validate are validated anyway: no need to compare their value\n group.itemsToCompare ??= group.items.filter((item) => !nodeUuidsToValidate.has(item.keyNode.uuid))\n\n const result: ArenaRecordNode[] = []\n for (const { entityUuid: itemEntityUuid, keyNode } of group.itemsToCompare) {\n if (\n itemEntityUuid !== entityUuid &&\n RecordNodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })\n ) {\n result.push(keyNode)\n }\n }\n return result.concat(_findSiblingKeyNodesWithErrorsNotAdded({ group, entityUuid }))\n}\n\n// key nodes with errors (in entities other than the attribute's one) are added only once per group\nconst _findSiblingKeyNodesWithErrorsNotAdded = (params: {\n group: SiblingKeyNodesGroup\n entityUuid: string\n}): ArenaRecordNode[] => {\n const { group, entityUuid } = params\n if (group.firstEntityUuid === undefined) {\n group.firstEntityUuid = entityUuid\n return group.items.filter((item) => item.hasErrors && item.entityUuid !== entityUuid).map((item) => item.keyNode)\n }\n if (group.allItemsWithErrorsAdded || group.firstEntityUuid === entityUuid) return []\n group.allItemsWithErrorsAdded = true\n const { firstEntityUuid } = group\n return group.items.filter((item) => item.hasErrors && item.entityUuid === firstEntityUuid).map((item) => item.keyNode)\n}\n\n// attribute siblings (same attribute def in the sibling entities) added to the nodes to validate,\n// by parent entity def and parent of the parent entity\ntype AttributeSiblingsAddedCache = Map<string, { firstParentEntity: ArenaRecordNode; allSiblingsAdded?: boolean }>\n\nconst findUniqueAttributeSiblingsToValidate = (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: ArenaAnyNodeDef\n nodeParent?: ArenaRecordNode\n attributeSiblingsAddedCache: AttributeSiblingsAddedCache\n}): ArenaRecordNode[] => {\n const { record, node, nodeDef, nodeParent, attributeSiblingsAddedCache } = params\n if (!nodeParent) return []\n const nodeParentParent = Records.getParent(nodeParent)(record)\n if (!nodeParentParent) return []\n // the siblings of the attribute are the attributes in the other parent entities:\n // after visiting attributes in 2 different parent entities, all the attributes of the group have been added\n const cacheKey = `${nodeParentParent.uuid}_${nodeParent.nodeDefUuid}_${nodeDef.uuid}`\n const cached = attributeSiblingsAddedCache.get(cacheKey)\n if (!cached) {\n attributeSiblingsAddedCache.set(cacheKey, { firstParentEntity: nodeParent })\n return Records.getAttributeSiblings(node, nodeDef)(record)\n }\n if (cached.allSiblingsAdded || cached.firstParentEntity.uuid === nodeParent.uuid) return []\n cached.allSiblingsAdded = true\n return Records.getChildren(cached.firstParentEntity, nodeDef.uuid)(record)\n}\n\nconst findSortedNodesToValidate = (params: ArenaSortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result: ArenaRecordNode[] = []\n const resultUuids = new Set<string>()\n const addToResult = (nodes: ArenaRecordNode[]) => {\n for (const node of nodes) {\n if (!resultUuids.has(node.uuid)) {\n resultUuids.add(node.uuid)\n result.push(node)\n }\n }\n }\n // every attribute in nodesArray is validated (it's included in its own dependents)\n const nodeUuidsToValidate = new Set(nodesArray.map((node) => node.uuid))\n const siblingKeyNodesCache: SiblingKeyNodesCache = new Map()\n const attributeSiblingsAddedCache: AttributeSiblingsAddedCache = new Map()\n for (const node of nodesArray) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (!NodeDefs.isAttribute(nodeDef)) {\n continue\n }\n // Get dependents and attribute itself\n const nodePointersAttributeAndDependents = [\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.validations, true)(record),\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.required)(record),\n ]\n\n const nodeParent = Records.getParent(node)(record)\n\n addToResult(\n RecordNodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents })\n )\n addToResult(\n findSiblingKeyNodesToValidate({\n ...params,\n nodeDef,\n nodeParent,\n attribute: node,\n siblingKeyNodesCache,\n nodeUuidsToValidate,\n })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n addToResult(\n findUniqueAttributeSiblingsToValidate({ record, node, nodeDef, nodeParent, attributeSiblingsAddedCache })\n )\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: ArenaSortedAttributesValidatorParams\n): Promise<ArenaValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ArenaValidationFields = {}\n // the record doesn't change during the validation: entity keys can be cached\n const entityKeysCache = createEntityKeysCache()\n\n for (const nodeToValidate of nodesToValidate) {\n const nodeUuid = nodeToValidate.uuid\n // Validate only attributes not deleted and not validated already\n if (!nodeToValidate.deleted && !validationsByNodeUuid[nodeUuid]) {\n // sequential: avoid concurrent item/taxon lookups on large node sets\n const attributeValidatorParams = { ...params, attribute: nodeToValidate, entityKeysCache }\n validationsByNodeUuid[nodeUuid] = await validateAttribute(attributeValidatorParams) // NOSONAR\n }\n }\n return validationsByNodeUuid\n}\n\nexport const AttributeValidator = {\n validateSelfAndDependentSortedAttributes,\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ArenaRecordNode } from '../../node';
|
|
2
|
-
import {
|
|
2
|
+
import { ArenaAnyNodeDef } from '../../nodeDef';
|
|
3
3
|
import { ArenaValidation } from '../../validation';
|
|
4
4
|
import { ArenaRecord } from '../record';
|
|
5
5
|
import { ArenaSurvey } from '../../survey';
|
|
6
6
|
import { ArenaValidationFields } from '../../validation/validation';
|
|
7
7
|
declare const validateChildrenCount: (params: {
|
|
8
8
|
parentNode: ArenaRecordNode;
|
|
9
|
-
nodeDefChild:
|
|
9
|
+
nodeDefChild: ArenaAnyNodeDef;
|
|
10
10
|
count: number;
|
|
11
11
|
}) => ArenaValidation;
|
|
12
12
|
declare const validateChildrenCountNodesArray: (params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countValidator.js","sourceRoot":"","sources":["../../../src/record/recordValidator/countValidator.ts"],"names":[],"mappings":";;;AAAA,qCAAiF;AACjF,2CAAsF;AACtF,wCAAoC;AACpC,iDAAkH;AAElH,yCAAmD;AACnD,4DAAwD;AAGxD,MAAM,sBAAsB,GAAG,CAAC,MAK/B,EAAmB,EAAE;IACpB,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAExE,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,8BAAiB,CAAC,cAAc,CAAC;YACtC,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE;gBACN,oCAAuB,CAAC,cAAc,CAAC;oBACrC,GAAG,EAAE,4BAA4B;oBACjC,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACxC,QAAQ,EAAE,+BAAkB,CAAC,KAAK;iBACnC,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,8BAAiB,CAAC,cAAc,CAAC;QACtC,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE;YACN,oCAAuB,CAAC,cAAc,CAAC;gBACrC,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,kCA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AE,GAAG,WAAW,CAAA;YACxC,6BAA6B;YAC7B,MAAM,0BAA0B,GAAG,qCAAiB,CAAC,6BAA6B,CAAC;gBACjF,cAAc,EAAE,OAAO,CAAC,IAAI;gBAC5B,gBAAgB,EAAE,OAAO,CAAC,IAAI;aAC/B,CAAC,CAAA;YACF,IAAI,CAAC,CAAC,0BAA0B,IAAI,cAAc,CAAC,EAAE,CAAC;gBACpD,mDAAmD;gBACnD,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;gBAC/E,cAAc,CAAC,0BAA0B,CAAC,GAAG,qBAAqB,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,MAInC,EAAyB,EAAE,CAAC,+BAA+B,iCAAM,MAAM,KAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAG,CAAA;AAEvG,QAAA,cAAc,GAAG;IAC5B,qBAAqB;IACrB,+BAA+B;IAC/B,0BAA0B;CAC3B,CAAA","sourcesContent":["import { ArenaRecordNode, ArenaRecordNodePointer, RecordNodes } from '../../node'\nimport { ArenaNodeDef, ArenaNodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { Records } from '../records'\nimport { ArenaValidation, ValidationFactory, ValidationResultFactory, ValidationSeverity } from '../../validation'\nimport { ArenaRecord } from '../record'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { RecordValidations } from '../recordValidations'\nimport { ArenaValidationFields } from '../../validation/validation'\n\nconst createValidationResult = (params: {\n nodeDefUuid: string\n isMinCountValidation: boolean\n minCount: number\n maxCount: number\n}): ArenaValidation => {\n const { nodeDefUuid, isMinCountValidation, minCount, maxCount } = params\n\n if (minCount === maxCount) {\n return ValidationFactory.createInstance({\n valid: false,\n errors: [\n ValidationResultFactory.createInstance({\n key: 'record.nodes.count.invalid',\n params: { nodeDefUuid, count: minCount },\n severity: ValidationSeverity.error,\n }),\n ],\n })\n }\n return ValidationFactory.createInstance({\n valid: false,\n errors: [\n ValidationResultFactory.createInstance({\n key: isMinCountValidation ? 'record.nodes.count.minNotReached' : 'record.nodes.count.maxExceeded',\n params: { nodeDefUuid, ...(isMinCountValidation ? { minCount } : { maxCount }) },\n severity: ValidationSeverity.error,\n }),\n ],\n })\n}\n\nconst validateChildrenCount = (params: {\n parentNode: ArenaRecordNode\n nodeDefChild: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n count: number\n}): ArenaValidation => {\n const { parentNode, nodeDefChild, count } = params\n\n const minCount = RecordNodes.getChildrenMinCount({ parentNode, nodeDef: nodeDefChild })\n const maxCount = RecordNodes.getChildrenMaxCount({ parentNode, nodeDef: nodeDefChild })\n\n const minCountValid = Number.isNaN(minCount) || count >= minCount\n const maxCountValid = Number.isNaN(maxCount) || count <= maxCount\n\n return minCountValid && maxCountValid\n ? ValidationFactory.createInstance()\n : createValidationResult({\n nodeDefUuid: nodeDefChild.uuid,\n isMinCountValidation: !minCountValid,\n minCount,\n maxCount,\n })\n}\n\nconst _countChildren = (params: {\n record: ArenaRecord\n parentNode: ArenaRecordNode\n childDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n}) => {\n const { record, parentNode, childDef } = params\n const children = Records.getChildren(parentNode, childDef.uuid)(record)\n const nonEmptyChildren = NodeDefs.isAttribute(childDef)\n ? children.filter((child) => !RecordNodes.isValueBlank(child))\n : children\n return nonEmptyChildren.length\n}\n\nconst isNodePointerToBeValidated = (nodePointer: ArenaRecordNodePointer) =>\n NodeDefs.hasMinOrMaxCount(nodePointer.nodeDef)\n\nconst validateNodePointer = (params: {\n record: ArenaRecord\n nodeCtx: ArenaRecordNode\n nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n}) => {\n const { record, nodeCtx, nodeDef } = params\n // Check children count only for applicable nodes\n if (RecordNodes.isChildApplicable(nodeCtx, nodeDef.uuid)) {\n const count = _countChildren({ record, parentNode: nodeCtx, childDef: nodeDef })\n return validateChildrenCount({ parentNode: nodeCtx, nodeDefChild: nodeDef, count })\n }\n return ValidationFactory.createInstance()\n}\n\nconst getNodePointersToValidate = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n node: ArenaRecordNode\n}): ArenaRecordNodePointer[] => {\n const { survey, record, node } = params\n const nodePointersToValidate: ArenaRecordNodePointer[] = []\n\n const nodeDef = Surveys.getNodeDefByUuid({ uuid: node.nodeDefUuid, survey })\n\n const nodeParent = Records.getParent(node)(record)\n if (nodeParent) {\n // always validate the node itself\n const nodePointer = { nodeCtx: nodeParent, nodeDef }\n if (isNodePointerToBeValidated(nodePointer)) {\n nodePointersToValidate.push(nodePointer)\n }\n }\n if (NodeDefs.isEntity(nodeDef) && !node.deleted) {\n // validate the count of every node def children\n const childDefs = Surveys.getNodeDefChildren({ survey, nodeDef })\n for (const childDef of childDefs) {\n const nodePointer = { nodeCtx: node, nodeDef: childDef }\n if (isNodePointerToBeValidated(nodePointer)) {\n nodePointersToValidate.push(nodePointer)\n }\n }\n }\n return nodePointersToValidate\n}\n\nconst validateChildrenCountNodesArray = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodesArray: ArenaRecordNode[]\n}): ArenaValidationFields => {\n const { survey, record, nodesArray } = params\n const validationsAcc: ArenaValidationFields = {}\n for (const node of nodesArray) {\n const nodePointersToValidate = getNodePointersToValidate({ survey, record, node })\n\n for (const nodePointer of nodePointersToValidate) {\n const { nodeCtx, nodeDef } = nodePointer\n // check if validated already\n const validationChildrenCountKey = RecordValidations.getValidationChildrenCountKey({\n nodeParentUuid: nodeCtx.uuid,\n nodeDefChildUuid: nodeDef.uuid,\n })\n if (!(validationChildrenCountKey in validationsAcc)) {\n // validate the children count of this node pointer\n const validationNodePointer = validateNodePointer({ record, nodeCtx, nodeDef })\n validationsAcc[validationChildrenCountKey] = validationNodePointer\n }\n }\n }\n return validationsAcc\n}\n\nconst validateChildrenCountNodes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: { [key: string]: ArenaRecordNode }\n}): ArenaValidationFields => validateChildrenCountNodesArray({ ...params, nodesArray: Object.values(params.nodes) })\n\nexport const CountValidator = {\n validateChildrenCount,\n validateChildrenCountNodesArray,\n validateChildrenCountNodes,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"countValidator.js","sourceRoot":"","sources":["../../../src/record/recordValidator/countValidator.ts"],"names":[],"mappings":";;;AAAA,qCAAiF;AACjF,2CAAyD;AACzD,wCAAoC;AACpC,iDAAkH;AAElH,yCAAmD;AACnD,4DAAwD;AAGxD,MAAM,sBAAsB,GAAG,CAAC,MAK/B,EAAmB,EAAE;IACpB,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAExE,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,8BAAiB,CAAC,cAAc,CAAC;YACtC,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE;gBACN,oCAAuB,CAAC,cAAc,CAAC;oBACrC,GAAG,EAAE,4BAA4B;oBACjC,MAAM,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACxC,QAAQ,EAAE,+BAAkB,CAAC,KAAK;iBACnC,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,8BAAiB,CAAC,cAAc,CAAC;QACtC,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE;YACN,oCAAuB,CAAC,cAAc,CAAC;gBACrC,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,gCAAgC;gBACjG,MAAM,kBAAI,WAAW,IAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAE;gBAChF,QAAQ,EAAE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C,CAAA;YACF,IAAI,CAAC,CAAC,0BAA0B,IAAI,cAAc,CAAC,EAAE,CAAC;gBACpD,mDAAmD;gBACnD,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;gBAC/E,cAAc,CAAC,0BAA0B,CAAC,GAAG,qBAAqB,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,MAInC,EAAyB,EAAE,CAAC,+BAA+B,iCAAM,MAAM,KAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAG,CAAA;AAEvG,QAAA,cAAc,GAAG;IAC5B,qBAAqB;IACrB,+BAA+B;IAC/B,0BAA0B;CAC3B,CAAA","sourcesContent":["import { ArenaRecordNode, ArenaRecordNodePointer, RecordNodes } from '../../node'\nimport { ArenaAnyNodeDef, NodeDefs } from '../../nodeDef'\nimport { Records } from '../records'\nimport { ArenaValidation, ValidationFactory, ValidationResultFactory, ValidationSeverity } from '../../validation'\nimport { ArenaRecord } from '../record'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { RecordValidations } from '../recordValidations'\nimport { ArenaValidationFields } from '../../validation/validation'\n\nconst createValidationResult = (params: {\n nodeDefUuid: string\n isMinCountValidation: boolean\n minCount: number\n maxCount: number\n}): ArenaValidation => {\n const { nodeDefUuid, isMinCountValidation, minCount, maxCount } = params\n\n if (minCount === maxCount) {\n return ValidationFactory.createInstance({\n valid: false,\n errors: [\n ValidationResultFactory.createInstance({\n key: 'record.nodes.count.invalid',\n params: { nodeDefUuid, count: minCount },\n severity: ValidationSeverity.error,\n }),\n ],\n })\n }\n return ValidationFactory.createInstance({\n valid: false,\n errors: [\n ValidationResultFactory.createInstance({\n key: isMinCountValidation ? 'record.nodes.count.minNotReached' : 'record.nodes.count.maxExceeded',\n params: { nodeDefUuid, ...(isMinCountValidation ? { minCount } : { maxCount }) },\n severity: ValidationSeverity.error,\n }),\n ],\n })\n}\n\nconst validateChildrenCount = (params: {\n parentNode: ArenaRecordNode\n nodeDefChild: ArenaAnyNodeDef\n count: number\n}): ArenaValidation => {\n const { parentNode, nodeDefChild, count } = params\n\n const minCount = RecordNodes.getChildrenMinCount({ parentNode, nodeDef: nodeDefChild })\n const maxCount = RecordNodes.getChildrenMaxCount({ parentNode, nodeDef: nodeDefChild })\n\n const minCountValid = Number.isNaN(minCount) || count >= minCount\n const maxCountValid = Number.isNaN(maxCount) || count <= maxCount\n\n return minCountValid && maxCountValid\n ? ValidationFactory.createInstance()\n : createValidationResult({\n nodeDefUuid: nodeDefChild.uuid,\n isMinCountValidation: !minCountValid,\n minCount,\n maxCount,\n })\n}\n\nconst _countChildren = (params: { record: ArenaRecord; parentNode: ArenaRecordNode; childDef: ArenaAnyNodeDef }) => {\n const { record, parentNode, childDef } = params\n const children = Records.getChildren(parentNode, childDef.uuid)(record)\n const nonEmptyChildren = NodeDefs.isAttribute(childDef)\n ? children.filter((child) => !RecordNodes.isValueBlank(child))\n : children\n return nonEmptyChildren.length\n}\n\nconst isNodePointerToBeValidated = (nodePointer: ArenaRecordNodePointer) =>\n NodeDefs.hasMinOrMaxCount(nodePointer.nodeDef)\n\nconst validateNodePointer = (params: { record: ArenaRecord; nodeCtx: ArenaRecordNode; nodeDef: ArenaAnyNodeDef }) => {\n const { record, nodeCtx, nodeDef } = params\n // Check children count only for applicable nodes\n if (RecordNodes.isChildApplicable(nodeCtx, nodeDef.uuid)) {\n const count = _countChildren({ record, parentNode: nodeCtx, childDef: nodeDef })\n return validateChildrenCount({ parentNode: nodeCtx, nodeDefChild: nodeDef, count })\n }\n return ValidationFactory.createInstance()\n}\n\nconst getNodePointersToValidate = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n node: ArenaRecordNode\n}): ArenaRecordNodePointer[] => {\n const { survey, record, node } = params\n const nodePointersToValidate: ArenaRecordNodePointer[] = []\n\n const nodeDef = Surveys.getNodeDefByUuid({ uuid: node.nodeDefUuid, survey })\n\n const nodeParent = Records.getParent(node)(record)\n if (nodeParent) {\n // always validate the node itself\n const nodePointer = { nodeCtx: nodeParent, nodeDef }\n if (isNodePointerToBeValidated(nodePointer)) {\n nodePointersToValidate.push(nodePointer)\n }\n }\n if (NodeDefs.isEntity(nodeDef) && !node.deleted) {\n // validate the count of every node def children\n const childDefs = Surveys.getNodeDefChildren({ survey, nodeDef })\n for (const childDef of childDefs) {\n const nodePointer = { nodeCtx: node, nodeDef: childDef }\n if (isNodePointerToBeValidated(nodePointer)) {\n nodePointersToValidate.push(nodePointer)\n }\n }\n }\n return nodePointersToValidate\n}\n\nconst validateChildrenCountNodesArray = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodesArray: ArenaRecordNode[]\n}): ArenaValidationFields => {\n const { survey, record, nodesArray } = params\n const validationsAcc: ArenaValidationFields = {}\n for (const node of nodesArray) {\n const nodePointersToValidate = getNodePointersToValidate({ survey, record, node })\n\n for (const nodePointer of nodePointersToValidate) {\n const { nodeCtx, nodeDef } = nodePointer\n // check if validated already\n const validationChildrenCountKey = RecordValidations.getValidationChildrenCountKey({\n nodeParentUuid: nodeCtx.uuid,\n nodeDefChildUuid: nodeDef.uuid,\n })\n if (!(validationChildrenCountKey in validationsAcc)) {\n // validate the children count of this node pointer\n const validationNodePointer = validateNodePointer({ record, nodeCtx, nodeDef })\n validationsAcc[validationChildrenCountKey] = validationNodePointer\n }\n }\n }\n return validationsAcc\n}\n\nconst validateChildrenCountNodes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: { [key: string]: ArenaRecordNode }\n}): ArenaValidationFields => validateChildrenCountNodesArray({ ...params, nodesArray: Object.values(params.nodes) })\n\nexport const CountValidator = {\n validateChildrenCount,\n validateChildrenCountNodesArray,\n validateChildrenCountNodes,\n}\n"]}
|
package/dist/survey/survey.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ArenaAuthGroup } from '../auth';
|
|
|
3
3
|
import { ArenaLabels, LanguageCode } from '../language';
|
|
4
4
|
import type { ArenaAreaOfInterestDescriptor } from '../geo';
|
|
5
5
|
import { ArenaSRS } from '../srs';
|
|
6
|
-
import {
|
|
6
|
+
import { ArenaAnyNodeDef } from '../nodeDef';
|
|
7
7
|
import { ArenaCategory } from '../category';
|
|
8
8
|
import { ArenaTaxonomy } from '../taxonomy';
|
|
9
9
|
import { ArenaSurveyRefData } from './refData/refData';
|
|
@@ -120,7 +120,7 @@ export interface ArenaSurvey extends ArenaObject<ArenaSurveyProps> {
|
|
|
120
120
|
dependencyGraph?: ArenaSurveyDependencyGraph;
|
|
121
121
|
draft: boolean;
|
|
122
122
|
nodeDefs?: {
|
|
123
|
-
[nodeDefUuid: string]:
|
|
123
|
+
[nodeDefUuid: string]: ArenaAnyNodeDef;
|
|
124
124
|
};
|
|
125
125
|
ownerUuid: string;
|
|
126
126
|
published: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey.js","sourceRoot":"","sources":["../../src/survey/survey.ts"],"names":[],"mappings":";;;AAWa,QAAA,YAAY,GAAG,GAAG,CAAA;AAM/B,IAAY,oBAcX;AAdD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,uDAA+B,CAAA;IAC/B,6CAAqB,CAAA;IACrB,6DAAqC,CAAA;IACrC,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,iDAAyB,CAAA;IACzB,6CAAqB,CAAA;IACrB,mDAA2B,CAAA;IAC3B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EAdW,oBAAoB,aAApB,oBAAoB,GAApB,oBAAoB,QAc/B;AAWD,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,mGAA6E,CAAA;IAC7E,qGAA+E,CAAA;IAC/E,yDAAmC,CAAA;IACnC,mFAA6D,CAAA;IAC7D,mFAA6D,CAAA;IAC7D,uGAAiF,CAAA;IACjF,qFAA+D,CAAA;AACjE,CAAC,EARW,kBAAkB,aAAlB,kBAAkB,GAAlB,kBAAkB,QAQ7B;AAMY,QAAA,sBAAsB,GAAwB;IACzD,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,EAAE,IAAI;IAC/D,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,EAAE,IAAI;IAChE,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,IAAI;IAC1C,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,sCAAsC,CAAC,EAAE,IAAI;IACjE,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,EAAE,IAAI;CACzD,CAAA;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,aAAd,cAAc,GAAd,cAAc,QAGzB;AAEY,QAAA,sBAAsB,GAAG;IACpC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ArenaObject, ArenaDictionary } from '../common'\nimport { ArenaAuthGroup } from '../auth'\nimport { ArenaLabels, LanguageCode } from '../language'\nimport type { ArenaAreaOfInterestDescriptor } from '../geo'\nimport { ArenaSRS } from '../srs'\n\nimport {
|
|
1
|
+
{"version":3,"file":"survey.js","sourceRoot":"","sources":["../../src/survey/survey.ts"],"names":[],"mappings":";;;AAWa,QAAA,YAAY,GAAG,GAAG,CAAA;AAM/B,IAAY,oBAcX;AAdD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,uDAA+B,CAAA;IAC/B,6CAAqB,CAAA;IACrB,6DAAqC,CAAA;IACrC,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,iDAAyB,CAAA;IACzB,6CAAqB,CAAA;IACrB,mDAA2B,CAAA;IAC3B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EAdW,oBAAoB,aAApB,oBAAoB,GAApB,oBAAoB,QAc/B;AAWD,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,mGAA6E,CAAA;IAC7E,qGAA+E,CAAA;IAC/E,yDAAmC,CAAA;IACnC,mFAA6D,CAAA;IAC7D,mFAA6D,CAAA;IAC7D,uGAAiF,CAAA;IACjF,qFAA+D,CAAA;AACjE,CAAC,EARW,kBAAkB,aAAlB,kBAAkB,GAAlB,kBAAkB,QAQ7B;AAMY,QAAA,sBAAsB,GAAwB;IACzD,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,EAAE,IAAI;IAC/D,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,EAAE,IAAI;IAChE,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,IAAI;IAC1C,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,sCAAsC,CAAC,EAAE,IAAI;IACjE,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,EAAE,IAAI;CACzD,CAAA;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,aAAd,cAAc,GAAd,cAAc,QAGzB;AAEY,QAAA,sBAAsB,GAAG;IACpC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ArenaObject, ArenaDictionary } from '../common'\nimport { ArenaAuthGroup } from '../auth'\nimport { ArenaLabels, LanguageCode } from '../language'\nimport type { ArenaAreaOfInterestDescriptor } from '../geo'\nimport { ArenaSRS } from '../srs'\n\nimport { ArenaAnyNodeDef } from '../nodeDef'\nimport { ArenaCategory } from '../category'\nimport { ArenaTaxonomy } from '../taxonomy'\nimport { ArenaSurveyRefData } from './refData/refData'\n\nexport const defaultCycle = '0'\n\nexport interface ArenaSurveyDependency {\n [nodeDefUuid: string]: string[] | boolean\n}\n\nexport enum SurveyDependencyType {\n applicable = 'applicable',\n defaultValues = 'defaultValues',\n editable = 'editable',\n enumeratingItems = 'enumeratingItems',\n fileName = 'fileName',\n formula = 'formula',\n maxCount = 'maxCount',\n minCount = 'minCount',\n parentCode = 'parentCode',\n required = 'required',\n validations = 'validations',\n visible = 'visible',\n onUpdate = 'onUpdate', // dependencies updated on every record update, stored as dictionary of booleans\n}\n\nexport type ArenaSurveyDependencyGraph = {\n [key in SurveyDependencyType]: ArenaSurveyDependency\n}\n\nexport interface ArenaSurveyCycle {\n dateEnd?: string\n dateStart: string\n}\n\nexport enum SurveySecurityProp {\n dataEditorViewNotOwnedRecordsAllowed = 'dataEditorViewNotOwnedRecordsAllowed',\n dataAnalystViewNotOwnedRecordsAllowed = 'dataAnalystViewNotOwnedRecordsAllowed',\n visibleInMobile = 'visibleInMobile',\n allowRecordsDownloadInMobile = 'allowRecordsDownloadInMobile',\n allowRecordsUploadFromMobile = 'allowRecordsUploadFromMobile',\n allowRecordsWithErrorsUploadFromMobile = 'allowRecordsWithErrorsUploadFromMobile',\n allowRecordsMergeWithSameKeys = 'allowRecordsMergeWithSameKeys',\n}\n\nexport type ArenaSurveySecurity = {\n [key in SurveySecurityProp]?: boolean\n}\n\nexport const surveySecurityDefaults: ArenaSurveySecurity = {\n [SurveySecurityProp.dataEditorViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.dataAnalystViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.visibleInMobile]: true,\n [SurveySecurityProp.allowRecordsDownloadInMobile]: true,\n [SurveySecurityProp.allowRecordsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsWithErrorsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsMergeWithSameKeys]: true,\n}\n\nexport enum SurveyDocPlace {\n header = 'header',\n footer = 'footer',\n}\n\nexport const surveyDocImagePropKeys = {\n documentPlace: 'documentPlace',\n applyIf: 'applyIf',\n} as const\n\nexport type ArenaSurveyDocImageProps = ArenaSurveyFileProps & {\n documentPlace?: SurveyDocPlace\n applyIf?: string\n}\n\nexport type ArenaSurveyFileProps = {\n deleted?: boolean\n labels?: ArenaLabels\n name?: string\n nodeUuid?: string\n recordUuid?: string\n size?: number | null\n temporary?: boolean\n type?: string\n}\n\nexport type ArenaSurveyFile = {\n uuid: string\n props: ArenaSurveyFileProps\n content?: Buffer | null\n dateCreated: string\n}\n\nexport type ArenaSurveyDocImage = ArenaSurveyFile & {\n props: ArenaSurveyDocImageProps\n}\n\nexport type SurveyDocOptions = {\n headerOnFirstPageOnly?: boolean // default: true\n}\n\nexport interface ArenaSurveyProps {\n areasOfInterest?: ArenaAreaOfInterestDescriptor[]\n collectUri?: string\n cycles: {\n [key: string]: ArenaSurveyCycle\n }\n defaultCycleKey?: string\n descriptions?: ArenaLabels\n fieldManualLinks?: ArenaLabels\n // when true, values of attributes becoming non-applicable are kept during data entry (default: cleared)\n keepNonApplicableValues?: boolean\n labels?: ArenaLabels\n languages: LanguageCode[]\n name: string\n preloadedMapLayers?: ArenaSurveyFile[]\n preloadedMapLayersEnabled?: boolean\n security?: ArenaSurveySecurity\n srs: ArenaSRS[]\n surveyDocImages?: ArenaSurveyDocImage[]\n surveyDocOptions?: SurveyDocOptions\n}\n\nexport interface ArenaSurveyNodeDefsIndex {\n rootDefUuid?: string\n childDefUuidPresenceByParentUuid?: { [parentUuid: string]: { [nodeDefUuid: string]: boolean } }\n nodeDefUuidByName?: ArenaDictionary<string>\n qualifierPresenceByUuid?: { [nodeDefUuid: string]: boolean }\n}\n\nexport interface ArenaSurvey extends ArenaObject<ArenaSurveyProps> {\n authGroups: Array<ArenaAuthGroup>\n dateCreated?: string\n dateModified?: string\n datePublished?: string\n dependencyGraph?: ArenaSurveyDependencyGraph\n draft: boolean\n nodeDefs?: { [nodeDefUuid: string]: ArenaAnyNodeDef }\n ownerUuid: string\n published: boolean\n readonly id?: number\n template: boolean\n uuid: string\n /**\n * Categories indexed by uuid.\n */\n categories?: { [categoryUuid: string]: ArenaCategory }\n /**\n * Taxonomies indexed by uuid.\n */\n taxonomies?: { [taxonomyUuid: string]: ArenaTaxonomy }\n /**\n * Reference data cache (category items and taxa).\n */\n refData?: ArenaSurveyRefData\n\n nodeDefsIndex?: ArenaSurveyNodeDefsIndex\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArenaAnyNodeDef, ArenaNodeDef } from '../../../nodeDef';
|
|
2
2
|
import { ArenaSurvey } from '../../survey';
|
|
3
|
-
export declare const getNodeDefsArray: (survey: ArenaSurvey) => Array<
|
|
4
|
-
export declare const calculateNodeDefChildren: (nodeDef:
|
|
3
|
+
export declare const getNodeDefsArray: (survey: ArenaSurvey) => Array<ArenaAnyNodeDef>;
|
|
4
|
+
export declare const calculateNodeDefChildren: (nodeDef: ArenaAnyNodeDef) => (survey: ArenaSurvey) => ArenaNodeDef<any>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDefsReader.js","sourceRoot":"","sources":["../../../../src/survey/surveys/_nodeDefs/nodeDefsReader.ts"],"names":[],"mappings":";;;AAGO,MAAM,gBAAgB,GAAG,CAAC,MAAmB,
|
|
1
|
+
{"version":3,"file":"nodeDefsReader.js","sourceRoot":"","sources":["../../../../src/survey/surveys/_nodeDefs/nodeDefsReader.ts"],"names":[],"mappings":";;;AAGO,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAA0B,EAAE,kBAAC,MAAM,CAAC,MAAM,OAAC,MAAM,CAAC,QAAQ,mCAAI,EAAE,CAAC,GAAA,CAAA;AAAxG,QAAA,gBAAgB,GAAhB,gBAAgB,CAAwF;AAE9G,MAAM,wBAAwB,GACnC,CAAC,OAAwB,EAAE,EAAE,CAC7B,CAAC,MAAmB,EAAuB,EAAE,CAC3C,IAAA,QAAA,gBAAgB,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAHtF,QAAA,wBAAwB,GAAxB,wBAAwB,CAG8D","sourcesContent":["import { ArenaAnyNodeDef, ArenaNodeDef } from '../../../nodeDef'\nimport { ArenaSurvey } from '../../survey'\n\nexport const getNodeDefsArray = (survey: ArenaSurvey): Array<ArenaAnyNodeDef> => Object.values(survey.nodeDefs ?? {})\n\nexport const calculateNodeDefChildren =\n (nodeDef: ArenaAnyNodeDef) =>\n (survey: ArenaSurvey): ArenaNodeDef<any>[] =>\n getNodeDefsArray(survey).filter((nodeDefCurrent) => nodeDefCurrent.parentUuid === nodeDef.uuid)\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArenaAnyNodeDef } from '../../nodeDef';
|
|
2
2
|
import { ArenaSurvey, SurveyDependencyType } from '../survey';
|
|
3
3
|
export declare const getNodeDefDependents: (params: {
|
|
4
4
|
survey: ArenaSurvey;
|
|
5
5
|
nodeDefUuid: string;
|
|
6
6
|
dependencyType?: SurveyDependencyType;
|
|
7
|
-
}) =>
|
|
7
|
+
}) => ArenaAnyNodeDef[];
|
|
8
8
|
export declare const getOnUpdateDependents: (params: {
|
|
9
9
|
survey: ArenaSurvey;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => ArenaAnyNodeDef[];
|
|
11
11
|
export declare const addNodeDefDependencies: (params: {
|
|
12
|
-
nodeDef:
|
|
12
|
+
nodeDef: ArenaAnyNodeDef;
|
|
13
13
|
survey: ArenaSurvey;
|
|
14
14
|
sideEffect?: boolean;
|
|
15
15
|
}) => Promise<ArenaSurvey>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","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AAC,cAAc,CAAC,CAAC,CAAC,CAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAA4B,CAAA;IAC3G,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAC1C,CAAC,kBAAkB,EAAE,IAAI,EAAE,EAAE,CAC3B,gCAAgC,CAAC,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EACrG,MAAM,CACP,CAAA;IACD,uCAAY,MAAM,KAAE,eAAe,EAAE,aAAa,IAAE;AACtD,CAAC,CAAA;AAdY,QAAA,yBAAyB,GAAzB,yBAAyB,CAcrC;AAED;;;;;GAKG;AACI,MAAM,4BAA4B,GAAG,CAAO,MAAmB,EAAwB,EAAE;IAC9F,iIAAiI;IACjI,MAAM,UAAU,GAAG,IAAI,CAAA;IAEvB,sCAAsC;IACtC,IAAI,aAAa,mCAAqB,MAAM,KAAE,eAAe,EAAE,kBAAkB,EAAE,GAAE,CAAA;IACrF,KAAK,MAAM,OAAO,IAAI,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,gDAAgD;QAChD,aAAa,GAAG,MAAM,IAAA,QAAA,sBAAsB,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA,CAAC,UAAU;IACzG,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA,CAAA;AAXY,QAAA,4BAA4B,GAA5B,4BAA4B,CAWxC","sourcesContent":["import * as SurveyNodeDefs from './nodeDefs'\nimport {\n ArenaNodeDef,\n ArenaNodeDefCode,\n ArenaNodeDefEntity,\n ArenaNodeDefExpression,\n ArenaNodeDefFile,\n ArenaNodeDefProps,\n NodeDefs,\n NodeDefType,\n} from '../../nodeDef'\nimport { NodeDefExpressionEvaluator } from '../../nodeDefExpressionEvaluator'\n\nimport { ArenaSurvey, ArenaSurveyDependencyGraph, SurveyDependencyType } from '../survey'\nimport { Arrays, Objects } from '../../utils'\nimport { NodeDefExpressionFactory } from '../../nodeDef/nodeDef'\nimport { ArenaDictionary } from '../../common'\n\nconst functionsRequiringOnUpdateDependency = ['recordDateLastModified']\n\nconst isContextParentByDependencyType = {\n [SurveyDependencyType.applicable]: true,\n [SurveyDependencyType.defaultValues]: true,\n [SurveyDependencyType.editable]: true,\n [SurveyDependencyType.enumeratingItems]: true,\n [SurveyDependencyType.fileName]: true,\n [SurveyDependencyType.formula]: false,\n [SurveyDependencyType.maxCount]: true,\n [SurveyDependencyType.minCount]: true,\n [SurveyDependencyType.onUpdate]: true,\n [SurveyDependencyType.parentCode]: false,\n [SurveyDependencyType.required]: true,\n [SurveyDependencyType.validations]: true,\n [SurveyDependencyType.visible]: true,\n}\n\nconst selfReferenceAllowedByDependencyType = {\n [SurveyDependencyType.applicable]: false,\n [SurveyDependencyType.defaultValues]: false,\n [SurveyDependencyType.editable]: false,\n [SurveyDependencyType.enumeratingItems]: false,\n [SurveyDependencyType.fileName]: false,\n [SurveyDependencyType.formula]: false,\n [SurveyDependencyType.maxCount]: false,\n [SurveyDependencyType.minCount]: false,\n [SurveyDependencyType.onUpdate]: false,\n [SurveyDependencyType.parentCode]: false,\n [SurveyDependencyType.required]: false,\n [SurveyDependencyType.validations]: true,\n [SurveyDependencyType.visible]: false,\n}\n\nconst newDependencyGraph = () => ({\n [SurveyDependencyType.applicable]: {},\n [SurveyDependencyType.defaultValues]: {},\n [SurveyDependencyType.editable]: {},\n [SurveyDependencyType.enumeratingItems]: {},\n [SurveyDependencyType.fileName]: {},\n [SurveyDependencyType.formula]: {},\n [SurveyDependencyType.maxCount]: {},\n [SurveyDependencyType.minCount]: {},\n [SurveyDependencyType.onUpdate]: {},\n [SurveyDependencyType.parentCode]: {},\n [SurveyDependencyType.required]: {},\n [SurveyDependencyType.validations]: {},\n [SurveyDependencyType.visible]: {},\n})\n\nconst getDependencyGraph = (survey: ArenaSurvey): ArenaSurveyDependencyGraph =>\n survey.dependencyGraph ?? newDependencyGraph()\n\nconst getDependencies = (params: {\n graphs: ArenaSurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n}): Array<string> => {\n const { graphs, type, nodeDefUuid } = params\n return type === SurveyDependencyType.onUpdate ? [] : ((graphs?.[type]?.[nodeDefUuid] ?? []) as string[])\n}\n\nexport const getNodeDefDependents = (params: {\n survey: ArenaSurvey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): ArenaNodeDef<NodeDefType, ArenaNodeDefProps>[] => {\n const { survey, nodeDefUuid, dependencyType } = params\n const dependencyGraph = getDependencyGraph(survey)\n\n const dependentUuids = new Set<string>()\n\n const dependencyTypes: SurveyDependencyType[] = dependencyType\n ? [dependencyType]\n : Object.values(SurveyDependencyType)\n\n for (const depType of dependencyTypes) {\n const dependentUuidsTemp = getDependencies({ graphs: dependencyGraph, type: depType, nodeDefUuid })\n for (const dependentUuid of dependentUuidsTemp) {\n dependentUuids.add(dependentUuid)\n }\n }\n return dependentUuids.size > 0 ? SurveyNodeDefs.findNodeDefsByUuids({ survey, uuids: [...dependentUuids] }) : []\n}\n\nexport const getOnUpdateDependents = (params: { survey: ArenaSurvey }) => {\n const { survey } = params\n const dependencyGraph = getDependencyGraph(survey)\n const sourceDefUuids = Object.keys(dependencyGraph[SurveyDependencyType.onUpdate] ?? {})\n return sourceDefUuids.length > 0 ? SurveyNodeDefs.findNodeDefsByUuids({ survey, uuids: sourceDefUuids }) : []\n}\n\n// UPDATE\n\nconst addDependency = (params: {\n graphs: ArenaSurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n nodeDefDepUuid: string\n sideEffect: boolean\n}): ArenaSurveyDependencyGraph => {\n const { graphs, type, nodeDefUuid, nodeDefDepUuid, sideEffect = false } = params\n const deps = getDependencies({ graphs, type, nodeDefUuid })\n // dependencies of a node def can be added again (e.g. when it is updated): keep each dependent only once\n if (deps.includes(nodeDefDepUuid)) return graphs\n const depsUpdated = Arrays.addItem(nodeDefDepUuid, { sideEffect })(deps)\n return Objects.assocPath({ obj: graphs, path: [type, nodeDefUuid], value: depsUpdated, sideEffect })\n}\n\nconst addDependencies = async (params: {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<NodeDefType>\n type: SurveyDependencyType\n graphs: ArenaSurveyDependencyGraph\n expressions: ArenaNodeDefExpression[]\n sideEffect?: boolean\n}): Promise<ArenaSurveyDependencyGraph> => {\n const { survey, nodeDef, type, expressions, graphs: graphsParam, sideEffect = false } = params\n\n if (!expressions || expressions.length === 0) return graphsParam\n\n let graphsUpdated = sideEffect ? graphsParam : { ...graphsParam }\n\n const isContextParent = isContextParentByDependencyType[type]\n const selfReferenceAllowed = selfReferenceAllowedByDependencyType[type]\n\n const findReferencedNodeDefs = async (\n expression: string | undefined\n ): Promise<{ [key: string]: ArenaNodeDef<NodeDefType> }> => {\n if (!expression) return {}\n\n const referencedNodeDefUuids = await new NodeDefExpressionEvaluator().findReferencedNodeDefUuids({\n expression,\n survey,\n nodeDef,\n isContextParent,\n selfReferenceAllowed,\n })\n const referencedNodeDefsByUuid: ArenaDictionary<ArenaNodeDef<any>> = {}\n for (const uuid of referencedNodeDefUuids) {\n referencedNodeDefsByUuid[uuid] = SurveyNodeDefs.getNodeDefByUuid({ survey, uuid })\n }\n return referencedNodeDefsByUuid\n }\n\n const referencedNodeDefsArray = await Promise.all(\n expressions.flatMap((nodeDefExpr) => [\n findReferencedNodeDefs(nodeDefExpr.expression),\n findReferencedNodeDefs(nodeDefExpr.applyIf),\n ])\n )\n const referencedNodeDefs: ArenaDictionary<ArenaNodeDef<any>> = Object.assign({}, ...referencedNodeDefsArray)\n\n for (const nodeDefRef of Object.values(referencedNodeDefs)) {\n graphsUpdated = addDependency({\n graphs: graphsUpdated,\n type,\n nodeDefUuid: nodeDefRef.uuid,\n nodeDefDepUuid: nodeDef.uuid,\n sideEffect,\n })\n }\n\n return graphsUpdated\n}\n\nexport const addNodeDefDependencies = async (params: {\n nodeDef: ArenaNodeDef<NodeDefType>\n survey: ArenaSurvey\n sideEffect?: boolean\n}): Promise<ArenaSurvey> => {\n const { nodeDef, survey, sideEffect = false } = params\n const graphs = getDependencyGraph(survey)\n let graphsUpdated = sideEffect ? graphs : { ...graphs }\n\n const _addDependencies = async (type: SurveyDependencyType, expressions: ArenaNodeDefExpression[]) => {\n let _graphUpdated = await addDependencies({\n survey,\n nodeDef,\n type,\n expressions,\n graphs: graphsUpdated,\n sideEffect,\n })\n // add onUpdate dependencies\n if (\n expressions.some((expression) =>\n functionsRequiringOnUpdateDependency.some(\n (functionName) => expression.applyIf?.includes(functionName) || expression.expression?.includes(functionName)\n )\n )\n ) {\n _graphUpdated = Objects.assocPath({\n obj: _graphUpdated,\n path: [SurveyDependencyType.onUpdate, nodeDef.uuid],\n value: true,\n sideEffect,\n })\n }\n return _graphUpdated\n }\n graphsUpdated = await _addDependencies(SurveyDependencyType.applicable, NodeDefs.getApplicable(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.defaultValues, NodeDefs.getDefaultValues(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.editable, NodeDefs.getEditableIf(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.required, NodeDefs.getRequiredIf(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.validations, NodeDefs.getValidationsExpressions(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.visible, NodeDefs.getVisibleIf(nodeDef))\n const maxCount = NodeDefs.getMaxCount(nodeDef)\n if (Array.isArray(maxCount)) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.maxCount, maxCount)\n }\n const minCount = NodeDefs.getMinCount(nodeDef)\n if (Array.isArray(minCount)) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.minCount, minCount)\n }\n // file name expression\n if (NodeDefs.getType(nodeDef) === NodeDefType.file) {\n const fileNameExpression = NodeDefs.getFileNameExpression(nodeDef as ArenaNodeDefFile)\n if (fileNameExpression) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.fileName, [\n NodeDefExpressionFactory.createInstance({ expression: fileNameExpression }),\n ])\n }\n }\n if (NodeDefs.isEntity(nodeDef)) {\n const enumeratingItemsExpression = NodeDefs.getEnumeratingItemsExpression(nodeDef as ArenaNodeDefEntity)\n if (enumeratingItemsExpression) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.enumeratingItems, [\n NodeDefExpressionFactory.createInstance({ expression: enumeratingItemsExpression }),\n ])\n }\n }\n // parent code\n if (NodeDefs.getType(nodeDef) === NodeDefType.code) {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef as ArenaNodeDefCode)\n if (parentCodeDefUuid) {\n graphsUpdated = addDependency({\n graphs: graphsUpdated,\n type: SurveyDependencyType.parentCode,\n nodeDefUuid: parentCodeDefUuid,\n nodeDefDepUuid: nodeDef.uuid,\n sideEffect,\n })\n }\n }\n if (sideEffect) {\n survey.dependencyGraph = graphsUpdated\n return survey\n }\n return { ...survey, dependencyGraph: graphsUpdated }\n}\n\n// DELETE\n\nconst _removeNodeDefDependenciesOfType = (params: {\n graphs: ArenaSurveyDependencyGraph\n dependencyType: SurveyDependencyType\n nodeDefUuid: string\n}): ArenaSurveyDependencyGraph => {\n const { graphs, nodeDefUuid, dependencyType } = params\n\n const graphsUpdated = { ...graphs }\n let graphUpdated = { ...graphsUpdated[dependencyType] }\n // dissoc nodeDefUuid dependency as dependent\n graphUpdated = Objects.dissoc({ obj: graphUpdated, prop: nodeDefUuid })\n\n if (dependencyType !== SurveyDependencyType.onUpdate) {\n // dissoc nodeDefUuid dependency from sources (if any)\n for (const [key, dependentUuids] of Object.entries(graphUpdated)) {\n graphUpdated[key] = Arrays.removeItem(nodeDefUuid)(dependentUuids as string[])\n }\n }\n\n graphsUpdated[dependencyType] = graphUpdated\n return graphsUpdated\n}\n\nexport const removeNodeDefDependencies = (params: {\n survey: ArenaSurvey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): ArenaSurvey => {\n const { survey, nodeDefUuid, dependencyType = null } = params\n const graphs = getDependencyGraph(survey)\n const dependencyTypes = dependencyType ? [dependencyType] : (Object.keys(graphs) as SurveyDependencyType[])\n const graphsUpdated = dependencyTypes.reduce(\n (dependencyGraphAcc, type) =>\n _removeNodeDefDependenciesOfType({ graphs: dependencyGraphAcc, dependencyType: type, nodeDefUuid }),\n graphs\n )\n return { ...survey, dependencyGraph: graphsUpdated }\n}\n\n/**\n * Builds the dependency graph of the survey.\n *\n * @param survey - The survey.\n * @returns A copy of the survey with the dependency graph (the survey passed in is not modified).\n */\nexport const buildAndAssocDependencyGraph = async (survey: ArenaSurvey): Promise<ArenaSurvey> => {\n // the new graph is built from scratch with side effect (to avoid re-creating objects): it belongs only to the copy of the survey\n const sideEffect = true\n\n // add dependencies for every node def\n let surveyUpdated: ArenaSurvey = { ...survey, dependencyGraph: newDependencyGraph() }\n for (const nodeDef of SurveyNodeDefs.getNodeDefsArray(survey)) {\n // sequential: each iteration updates the survey\n surveyUpdated = await addNodeDefDependencies({ nodeDef, survey: surveyUpdated, sideEffect }) // NOSONAR\n }\n return surveyUpdated\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/survey/surveys/dependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,cAAc,uCAAkB;AAC5C,2CASsB;AACtB,iFAA6E;AAE7E,sCAAyF;AACzF,uCAA6C;AAC7C,mDAAgE;AAGhE,MAAM,oCAAoC,GAAG,CAAC,wBAAwB,CAAC,CAAA;AAEvE,MAAM,+BAA+B,GAAG;IACtC,CAAC,6BAAoB,CAAC,UAAU,CAAC,EAAE,IAAI;IACvC,CAAC,6BAAoB,CAAC,aAAa,CAAC,EAAE,IAAI;IAC1C,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,gBAAgB,CAAC,EAAE,IAAI;IAC7C,CAAC,6BA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IAAI,CAAA;IAEvB,sCAAsC;IACtC,IAAI,aAAa,mCAAqB,MAAM,KAAE,eAAe,EAAE,kBAAkB,EAAE,GAAE,CAAA;IACrF,KAAK,MAAM,OAAO,IAAI,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9D,gDAAgD;QAChD,aAAa,GAAG,MAAM,IAAA,QAAA,sBAAsB,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA,CAAC,UAAU;IACzG,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA,CAAA;AAXY,QAAA,4BAA4B,GAA5B,4BAA4B,CAWxC","sourcesContent":["import * as SurveyNodeDefs from './nodeDefs'\nimport {\n ArenaAnyNodeDef,\n ArenaNodeDef,\n ArenaNodeDefCode,\n ArenaNodeDefEntity,\n ArenaNodeDefExpression,\n ArenaNodeDefFile,\n NodeDefs,\n NodeDefType,\n} from '../../nodeDef'\nimport { NodeDefExpressionEvaluator } from '../../nodeDefExpressionEvaluator'\n\nimport { ArenaSurvey, ArenaSurveyDependencyGraph, SurveyDependencyType } from '../survey'\nimport { Arrays, Objects } from '../../utils'\nimport { NodeDefExpressionFactory } from '../../nodeDef/nodeDef'\nimport { ArenaDictionary } from '../../common'\n\nconst functionsRequiringOnUpdateDependency = ['recordDateLastModified']\n\nconst isContextParentByDependencyType = {\n [SurveyDependencyType.applicable]: true,\n [SurveyDependencyType.defaultValues]: true,\n [SurveyDependencyType.editable]: true,\n [SurveyDependencyType.enumeratingItems]: true,\n [SurveyDependencyType.fileName]: true,\n [SurveyDependencyType.formula]: false,\n [SurveyDependencyType.maxCount]: true,\n [SurveyDependencyType.minCount]: true,\n [SurveyDependencyType.onUpdate]: true,\n [SurveyDependencyType.parentCode]: false,\n [SurveyDependencyType.required]: true,\n [SurveyDependencyType.validations]: true,\n [SurveyDependencyType.visible]: true,\n}\n\nconst selfReferenceAllowedByDependencyType = {\n [SurveyDependencyType.applicable]: false,\n [SurveyDependencyType.defaultValues]: false,\n [SurveyDependencyType.editable]: false,\n [SurveyDependencyType.enumeratingItems]: false,\n [SurveyDependencyType.fileName]: false,\n [SurveyDependencyType.formula]: false,\n [SurveyDependencyType.maxCount]: false,\n [SurveyDependencyType.minCount]: false,\n [SurveyDependencyType.onUpdate]: false,\n [SurveyDependencyType.parentCode]: false,\n [SurveyDependencyType.required]: false,\n [SurveyDependencyType.validations]: true,\n [SurveyDependencyType.visible]: false,\n}\n\nconst newDependencyGraph = () => ({\n [SurveyDependencyType.applicable]: {},\n [SurveyDependencyType.defaultValues]: {},\n [SurveyDependencyType.editable]: {},\n [SurveyDependencyType.enumeratingItems]: {},\n [SurveyDependencyType.fileName]: {},\n [SurveyDependencyType.formula]: {},\n [SurveyDependencyType.maxCount]: {},\n [SurveyDependencyType.minCount]: {},\n [SurveyDependencyType.onUpdate]: {},\n [SurveyDependencyType.parentCode]: {},\n [SurveyDependencyType.required]: {},\n [SurveyDependencyType.validations]: {},\n [SurveyDependencyType.visible]: {},\n})\n\nconst getDependencyGraph = (survey: ArenaSurvey): ArenaSurveyDependencyGraph =>\n survey.dependencyGraph ?? newDependencyGraph()\n\nconst getDependencies = (params: {\n graphs: ArenaSurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n}): Array<string> => {\n const { graphs, type, nodeDefUuid } = params\n return type === SurveyDependencyType.onUpdate ? [] : ((graphs?.[type]?.[nodeDefUuid] ?? []) as string[])\n}\n\nexport const getNodeDefDependents = (params: {\n survey: ArenaSurvey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): ArenaAnyNodeDef[] => {\n const { survey, nodeDefUuid, dependencyType } = params\n const dependencyGraph = getDependencyGraph(survey)\n\n const dependentUuids = new Set<string>()\n\n const dependencyTypes: SurveyDependencyType[] = dependencyType\n ? [dependencyType]\n : Object.values(SurveyDependencyType)\n\n for (const depType of dependencyTypes) {\n const dependentUuidsTemp = getDependencies({ graphs: dependencyGraph, type: depType, nodeDefUuid })\n for (const dependentUuid of dependentUuidsTemp) {\n dependentUuids.add(dependentUuid)\n }\n }\n return dependentUuids.size > 0 ? SurveyNodeDefs.findNodeDefsByUuids({ survey, uuids: [...dependentUuids] }) : []\n}\n\nexport const getOnUpdateDependents = (params: { survey: ArenaSurvey }) => {\n const { survey } = params\n const dependencyGraph = getDependencyGraph(survey)\n const sourceDefUuids = Object.keys(dependencyGraph[SurveyDependencyType.onUpdate] ?? {})\n return sourceDefUuids.length > 0 ? SurveyNodeDefs.findNodeDefsByUuids({ survey, uuids: sourceDefUuids }) : []\n}\n\n// UPDATE\n\nconst addDependency = (params: {\n graphs: ArenaSurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n nodeDefDepUuid: string\n sideEffect: boolean\n}): ArenaSurveyDependencyGraph => {\n const { graphs, type, nodeDefUuid, nodeDefDepUuid, sideEffect = false } = params\n const deps = getDependencies({ graphs, type, nodeDefUuid })\n // dependencies of a node def can be added again (e.g. when it is updated): keep each dependent only once\n if (deps.includes(nodeDefDepUuid)) return graphs\n const depsUpdated = Arrays.addItem(nodeDefDepUuid, { sideEffect })(deps)\n return Objects.assocPath({ obj: graphs, path: [type, nodeDefUuid], value: depsUpdated, sideEffect })\n}\n\nconst addDependencies = async (params: {\n survey: ArenaSurvey\n nodeDef: ArenaAnyNodeDef\n type: SurveyDependencyType\n graphs: ArenaSurveyDependencyGraph\n expressions: ArenaNodeDefExpression[]\n sideEffect?: boolean\n}): Promise<ArenaSurveyDependencyGraph> => {\n const { survey, nodeDef, type, expressions, graphs: graphsParam, sideEffect = false } = params\n\n if (!expressions || expressions.length === 0) return graphsParam\n\n let graphsUpdated = sideEffect ? graphsParam : { ...graphsParam }\n\n const isContextParent = isContextParentByDependencyType[type]\n const selfReferenceAllowed = selfReferenceAllowedByDependencyType[type]\n\n const findReferencedNodeDefs = async (\n expression: string | undefined\n ): Promise<{ [key: string]: ArenaAnyNodeDef }> => {\n if (!expression) return {}\n\n const referencedNodeDefUuids = await new NodeDefExpressionEvaluator().findReferencedNodeDefUuids({\n expression,\n survey,\n nodeDef,\n isContextParent,\n selfReferenceAllowed,\n })\n const referencedNodeDefsByUuid: ArenaDictionary<ArenaNodeDef<any>> = {}\n for (const uuid of referencedNodeDefUuids) {\n referencedNodeDefsByUuid[uuid] = SurveyNodeDefs.getNodeDefByUuid({ survey, uuid })\n }\n return referencedNodeDefsByUuid\n }\n\n const referencedNodeDefsArray = await Promise.all(\n expressions.flatMap((nodeDefExpr) => [\n findReferencedNodeDefs(nodeDefExpr.expression),\n findReferencedNodeDefs(nodeDefExpr.applyIf),\n ])\n )\n const referencedNodeDefs: ArenaDictionary<ArenaNodeDef<any>> = Object.assign({}, ...referencedNodeDefsArray)\n\n for (const nodeDefRef of Object.values(referencedNodeDefs)) {\n graphsUpdated = addDependency({\n graphs: graphsUpdated,\n type,\n nodeDefUuid: nodeDefRef.uuid,\n nodeDefDepUuid: nodeDef.uuid,\n sideEffect,\n })\n }\n\n return graphsUpdated\n}\n\nexport const addNodeDefDependencies = async (params: {\n nodeDef: ArenaAnyNodeDef\n survey: ArenaSurvey\n sideEffect?: boolean\n}): Promise<ArenaSurvey> => {\n const { nodeDef, survey, sideEffect = false } = params\n const graphs = getDependencyGraph(survey)\n let graphsUpdated = sideEffect ? graphs : { ...graphs }\n\n const _addDependencies = async (type: SurveyDependencyType, expressions: ArenaNodeDefExpression[]) => {\n let _graphUpdated = await addDependencies({\n survey,\n nodeDef,\n type,\n expressions,\n graphs: graphsUpdated,\n sideEffect,\n })\n // add onUpdate dependencies\n if (\n expressions.some((expression) =>\n functionsRequiringOnUpdateDependency.some(\n (functionName) => expression.applyIf?.includes(functionName) || expression.expression?.includes(functionName)\n )\n )\n ) {\n _graphUpdated = Objects.assocPath({\n obj: _graphUpdated,\n path: [SurveyDependencyType.onUpdate, nodeDef.uuid],\n value: true,\n sideEffect,\n })\n }\n return _graphUpdated\n }\n graphsUpdated = await _addDependencies(SurveyDependencyType.applicable, NodeDefs.getApplicable(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.defaultValues, NodeDefs.getDefaultValues(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.editable, NodeDefs.getEditableIf(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.required, NodeDefs.getRequiredIf(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.validations, NodeDefs.getValidationsExpressions(nodeDef))\n graphsUpdated = await _addDependencies(SurveyDependencyType.visible, NodeDefs.getVisibleIf(nodeDef))\n const maxCount = NodeDefs.getMaxCount(nodeDef)\n if (Array.isArray(maxCount)) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.maxCount, maxCount)\n }\n const minCount = NodeDefs.getMinCount(nodeDef)\n if (Array.isArray(minCount)) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.minCount, minCount)\n }\n // file name expression\n if (NodeDefs.getType(nodeDef) === NodeDefType.file) {\n const fileNameExpression = NodeDefs.getFileNameExpression(nodeDef as ArenaNodeDefFile)\n if (fileNameExpression) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.fileName, [\n NodeDefExpressionFactory.createInstance({ expression: fileNameExpression }),\n ])\n }\n }\n if (NodeDefs.isEntity(nodeDef)) {\n const enumeratingItemsExpression = NodeDefs.getEnumeratingItemsExpression(nodeDef as ArenaNodeDefEntity)\n if (enumeratingItemsExpression) {\n graphsUpdated = await _addDependencies(SurveyDependencyType.enumeratingItems, [\n NodeDefExpressionFactory.createInstance({ expression: enumeratingItemsExpression }),\n ])\n }\n }\n // parent code\n if (NodeDefs.getType(nodeDef) === NodeDefType.code) {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef as ArenaNodeDefCode)\n if (parentCodeDefUuid) {\n graphsUpdated = addDependency({\n graphs: graphsUpdated,\n type: SurveyDependencyType.parentCode,\n nodeDefUuid: parentCodeDefUuid,\n nodeDefDepUuid: nodeDef.uuid,\n sideEffect,\n })\n }\n }\n if (sideEffect) {\n survey.dependencyGraph = graphsUpdated\n return survey\n }\n return { ...survey, dependencyGraph: graphsUpdated }\n}\n\n// DELETE\n\nconst _removeNodeDefDependenciesOfType = (params: {\n graphs: ArenaSurveyDependencyGraph\n dependencyType: SurveyDependencyType\n nodeDefUuid: string\n}): ArenaSurveyDependencyGraph => {\n const { graphs, nodeDefUuid, dependencyType } = params\n\n const graphsUpdated = { ...graphs }\n let graphUpdated = { ...graphsUpdated[dependencyType] }\n // dissoc nodeDefUuid dependency as dependent\n graphUpdated = Objects.dissoc({ obj: graphUpdated, prop: nodeDefUuid })\n\n if (dependencyType !== SurveyDependencyType.onUpdate) {\n // dissoc nodeDefUuid dependency from sources (if any)\n for (const [key, dependentUuids] of Object.entries(graphUpdated)) {\n graphUpdated[key] = Arrays.removeItem(nodeDefUuid)(dependentUuids as string[])\n }\n }\n\n graphsUpdated[dependencyType] = graphUpdated\n return graphsUpdated\n}\n\nexport const removeNodeDefDependencies = (params: {\n survey: ArenaSurvey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): ArenaSurvey => {\n const { survey, nodeDefUuid, dependencyType = null } = params\n const graphs = getDependencyGraph(survey)\n const dependencyTypes = dependencyType ? [dependencyType] : (Object.keys(graphs) as SurveyDependencyType[])\n const graphsUpdated = dependencyTypes.reduce(\n (dependencyGraphAcc, type) =>\n _removeNodeDefDependenciesOfType({ graphs: dependencyGraphAcc, dependencyType: type, nodeDefUuid }),\n graphs\n )\n return { ...survey, dependencyGraph: graphsUpdated }\n}\n\n/**\n * Builds the dependency graph of the survey.\n *\n * @param survey - The survey.\n * @returns A copy of the survey with the dependency graph (the survey passed in is not modified).\n */\nexport const buildAndAssocDependencyGraph = async (survey: ArenaSurvey): Promise<ArenaSurvey> => {\n // the new graph is built from scratch with side effect (to avoid re-creating objects): it belongs only to the copy of the survey\n const sideEffect = true\n\n // add dependencies for every node def\n let surveyUpdated: ArenaSurvey = { ...survey, dependencyGraph: newDependencyGraph() }\n for (const nodeDef of SurveyNodeDefs.getNodeDefsArray(survey)) {\n // sequential: each iteration updates the survey\n surveyUpdated = await addNodeDefDependencies({ nodeDef, survey: surveyUpdated, sideEffect }) // NOSONAR\n }\n return surveyUpdated\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArenaSurvey } from '../survey';
|
|
2
|
-
import { ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefEntity
|
|
2
|
+
import { ArenaAnyNodeDef, ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefEntity } from '../../nodeDef';
|
|
3
3
|
import * as NodeDefsReader from './_nodeDefs/nodeDefsReader';
|
|
4
4
|
import * as NodeDefsIndex from './_nodeDefs/nodeDefsIndex';
|
|
5
5
|
import { TraverseMethod } from '../../common';
|
|
@@ -7,62 +7,62 @@ export declare const getNodeDefsArray: typeof NodeDefsReader.getNodeDefsArray;
|
|
|
7
7
|
export declare const findNodeDefByUuid: (params: {
|
|
8
8
|
survey: ArenaSurvey;
|
|
9
9
|
uuid: string;
|
|
10
|
-
}) =>
|
|
10
|
+
}) => ArenaAnyNodeDef | undefined;
|
|
11
11
|
export declare const getNodeDefByUuid: (params: {
|
|
12
12
|
survey: ArenaSurvey;
|
|
13
13
|
uuid: string;
|
|
14
|
-
}) =>
|
|
14
|
+
}) => ArenaAnyNodeDef;
|
|
15
15
|
export declare const findNodeDefByName: (params: {
|
|
16
16
|
survey: ArenaSurvey;
|
|
17
17
|
name: string;
|
|
18
|
-
}) =>
|
|
18
|
+
}) => ArenaAnyNodeDef | undefined;
|
|
19
19
|
export declare const getNodeDefByName: (params: {
|
|
20
20
|
survey: ArenaSurvey;
|
|
21
21
|
name: string;
|
|
22
|
-
}) =>
|
|
22
|
+
}) => ArenaAnyNodeDef;
|
|
23
23
|
export declare const getNodeDefsByUuids: (params: {
|
|
24
24
|
survey: ArenaSurvey;
|
|
25
25
|
uuids: string[];
|
|
26
|
-
}) =>
|
|
26
|
+
}) => ArenaAnyNodeDef[];
|
|
27
27
|
export declare const findNodeDefsByUuids: (params: {
|
|
28
28
|
survey: ArenaSurvey;
|
|
29
29
|
uuids: string[];
|
|
30
|
-
}) =>
|
|
30
|
+
}) => ArenaAnyNodeDef[];
|
|
31
31
|
export declare const getNodeDefParent: (params: {
|
|
32
32
|
survey: ArenaSurvey;
|
|
33
|
-
nodeDef:
|
|
33
|
+
nodeDef: ArenaAnyNodeDef;
|
|
34
34
|
}) => ArenaNodeDefEntity | undefined;
|
|
35
35
|
export declare const getNodeDefAncestorMultipleEntity: (params: {
|
|
36
36
|
survey: ArenaSurvey;
|
|
37
|
-
nodeDef:
|
|
37
|
+
nodeDef: ArenaAnyNodeDef;
|
|
38
38
|
}) => ArenaNodeDefEntity | undefined;
|
|
39
39
|
export declare const isNodeDefAncestor: (params: {
|
|
40
|
-
nodeDefAncestor:
|
|
41
|
-
nodeDefDescendant:
|
|
40
|
+
nodeDefAncestor: ArenaAnyNodeDef;
|
|
41
|
+
nodeDefDescendant: ArenaAnyNodeDef;
|
|
42
42
|
}) => boolean;
|
|
43
43
|
export declare const getNodeDefRoot: (params: {
|
|
44
44
|
survey: ArenaSurvey;
|
|
45
45
|
}) => ArenaNodeDefEntity;
|
|
46
46
|
export declare const getNodeDefSource: (params: {
|
|
47
47
|
survey: ArenaSurvey;
|
|
48
|
-
nodeDef:
|
|
49
|
-
}) =>
|
|
48
|
+
nodeDef: ArenaAnyNodeDef;
|
|
49
|
+
}) => ArenaAnyNodeDef | undefined;
|
|
50
50
|
export declare const getNodeDefChildren: (params: {
|
|
51
51
|
survey: ArenaSurvey;
|
|
52
|
-
nodeDef:
|
|
52
|
+
nodeDef: ArenaAnyNodeDef;
|
|
53
53
|
includeAnalysis?: boolean;
|
|
54
54
|
includeLayoutElements?: boolean;
|
|
55
|
-
}) =>
|
|
55
|
+
}) => ArenaAnyNodeDef[];
|
|
56
56
|
export declare const getQualifierDefs: (params: {
|
|
57
57
|
survey: ArenaSurvey;
|
|
58
|
-
}) =>
|
|
58
|
+
}) => ArenaAnyNodeDef[];
|
|
59
59
|
export declare const getNodeDefChildrenSorted: (params: {
|
|
60
60
|
survey: ArenaSurvey;
|
|
61
|
-
nodeDef:
|
|
61
|
+
nodeDef: ArenaAnyNodeDef;
|
|
62
62
|
cycle: string;
|
|
63
63
|
includeAnalysis?: boolean;
|
|
64
64
|
includeLayoutElements?: boolean;
|
|
65
|
-
}) =>
|
|
65
|
+
}) => ArenaAnyNodeDef[];
|
|
66
66
|
export declare const visitAncestorsAndSelfNodeDef: (params: {
|
|
67
67
|
survey: ArenaSurvey;
|
|
68
68
|
nodeDef: ArenaNodeDef<any>;
|
|
@@ -100,7 +100,7 @@ export declare const getNodeDefAncestorCodes: (params: {
|
|
|
100
100
|
}) => ArenaNodeDefCode[];
|
|
101
101
|
export declare const isNodeDefParentCode: (params: {
|
|
102
102
|
survey: ArenaSurvey;
|
|
103
|
-
nodeDef:
|
|
103
|
+
nodeDef: ArenaAnyNodeDef;
|
|
104
104
|
}) => boolean;
|
|
105
105
|
export declare const getNodeDefCategoryLevelIndex: (params: {
|
|
106
106
|
survey: ArenaSurvey;
|
|
@@ -116,32 +116,32 @@ export declare const getDependentEnumeratedEntityDefs: (params: {
|
|
|
116
116
|
}) => ArenaNodeDefEntity[];
|
|
117
117
|
export declare const getNodeDefKeys: (params: {
|
|
118
118
|
survey: ArenaSurvey;
|
|
119
|
-
nodeDef:
|
|
119
|
+
nodeDef: ArenaAnyNodeDef;
|
|
120
120
|
cycle?: string;
|
|
121
|
-
}) =>
|
|
121
|
+
}) => ArenaAnyNodeDef[];
|
|
122
122
|
export declare const getRootKeys: (params: {
|
|
123
123
|
survey: ArenaSurvey;
|
|
124
124
|
cycle?: string;
|
|
125
|
-
}) =>
|
|
125
|
+
}) => ArenaAnyNodeDef[];
|
|
126
126
|
export declare const getNodeDefEnumerator: (params: {
|
|
127
127
|
survey: ArenaSurvey;
|
|
128
128
|
entityDef: ArenaNodeDefEntity;
|
|
129
129
|
}) => ArenaNodeDefCode | undefined;
|
|
130
130
|
export declare const isNodeDefEnumerator: (params: {
|
|
131
131
|
survey: ArenaSurvey;
|
|
132
|
-
nodeDef:
|
|
132
|
+
nodeDef: ArenaAnyNodeDef;
|
|
133
133
|
}) => boolean;
|
|
134
134
|
export declare const getDescendantsInSingleEntities: (params: {
|
|
135
135
|
survey: ArenaSurvey;
|
|
136
136
|
cycle?: string;
|
|
137
|
-
nodeDef:
|
|
138
|
-
predicate?: (visitedNodeDef:
|
|
137
|
+
nodeDef: ArenaAnyNodeDef;
|
|
138
|
+
predicate?: (visitedNodeDef: ArenaAnyNodeDef) => boolean;
|
|
139
139
|
includeAnalysis?: boolean;
|
|
140
|
-
}) =>
|
|
140
|
+
}) => ArenaAnyNodeDef[];
|
|
141
141
|
export declare const getNodeDefsIncludedInMultipleEntitySummary: (params: {
|
|
142
142
|
survey: ArenaSurvey;
|
|
143
143
|
cycle: string;
|
|
144
|
-
nodeDef:
|
|
145
|
-
}) =>
|
|
144
|
+
nodeDef: ArenaAnyNodeDef;
|
|
145
|
+
}) => ArenaAnyNodeDef[];
|
|
146
146
|
declare const buildAndAssocNodeDefsIndex: typeof NodeDefsIndex.buildAndAssocNodeDefsIndex, addNodeDefToIndex: typeof NodeDefsIndex.addNodeDefToIndex, updateNodeDefUuidByNameIndex: typeof NodeDefsIndex.updateNodeDefUuidByNameIndex, deleteNodeDefIndex: typeof NodeDefsIndex.deleteNodeDefIndex;
|
|
147
147
|
export { buildAndAssocNodeDefsIndex, addNodeDefToIndex, updateNodeDefUuidByNameIndex, deleteNodeDefIndex };
|