@openforis/arena-core 2.6.0 → 2.8.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.
Files changed (78) hide show
  1. package/dist/esm/index.js.map +1 -1
  2. package/dist/esm/node/node.js.map +1 -1
  3. package/dist/esm/node/nodes.js +21 -2
  4. package/dist/esm/node/nodes.js.map +1 -1
  5. package/dist/esm/nodeDef/index.js.map +1 -1
  6. package/dist/esm/nodeDef/nodeDef.js.map +1 -1
  7. package/dist/esm/nodeDef/nodeDefs.js +14 -0
  8. package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
  9. package/dist/esm/nodeDef/types/geo.js +2 -0
  10. package/dist/esm/nodeDef/types/geo.js.map +1 -0
  11. package/dist/esm/record/_records/recordCompletion.js +4 -1
  12. package/dist/esm/record/_records/recordCompletion.js.map +1 -1
  13. package/dist/esm/record/_records/recordGetters.js +12 -0
  14. package/dist/esm/record/_records/recordGetters.js.map +1 -1
  15. package/dist/esm/record/recordNodesUpdater/index.js +3 -0
  16. package/dist/esm/record/recordNodesUpdater/index.js.map +1 -1
  17. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +87 -0
  18. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -0
  19. package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js +2 -0
  20. package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  21. package/dist/esm/record/recordUpdater.js +1 -0
  22. package/dist/esm/record/recordUpdater.js.map +1 -1
  23. package/dist/esm/record/recordValidator/attributeValidator.js +24 -8
  24. package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
  25. package/dist/esm/record/records.js +2 -1
  26. package/dist/esm/record/records.js.map +1 -1
  27. package/dist/esm/survey/survey.js +1 -0
  28. package/dist/esm/survey/survey.js.map +1 -1
  29. package/dist/esm/survey/surveys/dependencies.js +4 -0
  30. package/dist/esm/survey/surveys/dependencies.js.map +1 -1
  31. package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js +8 -0
  32. package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/node/node.d.ts +7 -0
  36. package/dist/node/node.js.map +1 -1
  37. package/dist/node/nodes.d.ts +7 -0
  38. package/dist/node/nodes.js +21 -2
  39. package/dist/node/nodes.js.map +1 -1
  40. package/dist/nodeDef/index.d.ts +1 -0
  41. package/dist/nodeDef/index.js.map +1 -1
  42. package/dist/nodeDef/nodeDef.d.ts +4 -0
  43. package/dist/nodeDef/nodeDef.js.map +1 -1
  44. package/dist/nodeDef/nodeDefs.d.ts +14 -0
  45. package/dist/nodeDef/nodeDefs.js +14 -0
  46. package/dist/nodeDef/nodeDefs.js.map +1 -1
  47. package/dist/nodeDef/types/geo.d.ts +5 -0
  48. package/dist/nodeDef/types/geo.js +3 -0
  49. package/dist/nodeDef/types/geo.js.map +1 -0
  50. package/dist/record/_records/recordCompletion.js +4 -1
  51. package/dist/record/_records/recordCompletion.js.map +1 -1
  52. package/dist/record/_records/recordGetters.d.ts +5 -0
  53. package/dist/record/_records/recordGetters.js +14 -1
  54. package/dist/record/_records/recordGetters.js.map +1 -1
  55. package/dist/record/recordNodesUpdater/index.d.ts +3 -0
  56. package/dist/record/recordNodesUpdater/index.js +3 -0
  57. package/dist/record/recordNodesUpdater/index.js.map +1 -1
  58. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +23 -0
  59. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +93 -0
  60. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -0
  61. package/dist/record/recordNodesUpdater/recordNodesUpdater.js +2 -0
  62. package/dist/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  63. package/dist/record/recordUpdater.js +1 -0
  64. package/dist/record/recordUpdater.js.map +1 -1
  65. package/dist/record/recordValidator/attributeValidator.js +24 -8
  66. package/dist/record/recordValidator/attributeValidator.js.map +1 -1
  67. package/dist/record/records.d.ts +2 -1
  68. package/dist/record/records.js +1 -0
  69. package/dist/record/records.js.map +1 -1
  70. package/dist/survey/survey.d.ts +1 -0
  71. package/dist/survey/survey.js +1 -0
  72. package/dist/survey/survey.js.map +1 -1
  73. package/dist/survey/surveys/dependencies.js +4 -0
  74. package/dist/survey/surveys/dependencies.js.map +1 -1
  75. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +1 -0
  76. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js +8 -0
  77. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  78. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"attributeValidator.js","sourceRoot":"","sources":["../../../src/record/recordValidator/attributeValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,qCAAyE;AACzE,2CAA+F;AAG/F,yCAA8C;AAC9C,gDAA0D;AAC1D,uCAAqC;AACrC,iDAMyB;AAEzB,kDAA8C;AAE9C,4EAAwE;AACxE,wCAAoC;AACpC,4DAAwD;AACxD,mEAAuG;AACvG,qEAAiE;AACjE,yEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,qDAAyB,EAAE,CAAA;AA6B3D,MAAM,mBAAmB,GAAG,CAC1B,MAAkF,EAC5D,EAAE;IACxB,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,EAAE,CAAC;Q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,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 { User } from '../../auth'\nimport { Dictionary } from '../../common'\nimport { Labels } from '../../language'\nimport { ArenaRecordNode, NodeKeys, Nodes, NodeValues } from '../../node'\nimport { NodeDef, NodeDefExpression, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ValidationFields } from '../../validation/validation'\nimport { NodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\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\nexport interface RecordValidatorParams {\n user: User\n survey: Survey\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n record: ArenaRecord\n}\n\nexport interface AttributeValidatorParams extends RecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface AttributesValidatorParams extends RecordValidatorParams {\n nodes: Dictionary<ArenaRecordNode>\n}\n\nexport interface SortedAttributesValidatorParams extends RecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\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, SiblingKeyNodeItem[]>\n\nconst _getSiblingNodeKeys = (\n params: AttributeValidatorParams & { siblingKeyNodesCache?: SiblingKeyNodesCache }\n): SiblingKeyNodeItem[] => {\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) {\n return []\n }\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return []\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return []\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let items = siblingKeyNodesCache?.get(cacheKey)\n if (!items) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n items = []\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 siblingKeyNodesCache?.set(cacheKey, items)\n }\n return items.filter((item) => item.entityUuid !== ancestorMultipleEntity.uuid)\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: Survey\n expression: NodeDefExpression\n defaultMessage?: string\n}): Labels => {\n const { survey, expression, defaultMessage } = params\n const messages: Labels = { ...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 _validateRequired =\n (params: { nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n (_field: string, node: any): Promise<ValidationResult> => {\n const { nodeDef } = params\n const valid = (!NodeDefs.isKey(nodeDef) && !NodeDefs.isRequired(nodeDef)) || !Nodes.isValueBlank(node)\n return Promise.resolve(\n valid\n ? ValidationResultFactory.createInstance()\n : ValidationResultFactory.createInstance({\n key: 'record.attribute.valueRequired',\n severity: ValidationSeverity.error,\n valid,\n })\n )\n }\n\n/**\n * Evaluates the validation expressions.\n */\nconst _validateNodeValidations =\n (params: { user: User; survey: Survey; record: ArenaRecord; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ValidationResult> => {\n const { user, survey, record, nodeDef } = params\n if (Nodes.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 user,\n survey,\n record,\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: AttributeValidatorParams & { 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 [NodeKeys.value]: [\n _validateRequired({ nodeDef }),\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: AttributeValidatorParams & {\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache?: SiblingKeyNodesCache\n }\n) => {\n const { survey, nodeDef, nodeParent: parentNode, attribute } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && Nodes.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 siblingNodeKeys = _getSiblingNodeKeys(params)\n const siblingNodeKeysWithSameValue: ArenaRecordNode[] = []\n const siblingNodeKeysWithErrors: ArenaRecordNode[] = []\n siblingNodeKeys.forEach(({ keyNode, hasErrors }) => {\n if (NodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })) {\n siblingNodeKeysWithSameValue.push(keyNode)\n }\n if (hasErrors) {\n siblingNodeKeysWithErrors.push(keyNode)\n }\n })\n return [...siblingNodeKeysWithSameValue, ...siblingNodeKeysWithErrors]\n}\n\nconst findSortedNodesToValidate = (params: SortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result = []\n const siblingKeyNodesCache: SiblingKeyNodesCache = 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 = Records.getDependentNodePointers(\n survey,\n node,\n SurveyDependencyType.validations,\n true\n )(record)\n\n const nodeParent = Records.getParent(node)(record)\n\n result.push(\n ...NodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents }),\n ...findSiblingKeyNodesToValidate({ ...params, nodeDef, nodeParent, attribute: node, siblingKeyNodesCache })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n result.push(...Records.getAttributeSiblings(node, nodeDef)(record))\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: SortedAttributesValidatorParams\n): Promise<ValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ValidationFields = {}\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":";;;;;;;;;;;;AAGA,qCAAyE;AACzE,2CAA+F;AAG/F,yCAA8C;AAC9C,gDAA0D;AAC1D,uCAAqC;AACrC,iDAMyB;AAEzB,kDAA8C;AAE9C,4EAAwE;AACxE,mHAA8F;AAC9F,wCAAoC;AACpC,4DAAwD;AACxD,mEAAuG;AACvG,qEAAiE;AACjE,yEAAqE;AAErE,MAAM,mBAAmB,GAAG,IAAI,qDAAyB,EAAE,CAAA;AA6B3D,MAAM,mBAAmB,GAAG,CAC1B,MAAkF,EAC5D,EAAE;IACxB,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,EAAE,CAAC;QAC/B,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,sBAAsB,GAAG,iBAAO,CAAC,WAAW,CAAC,SAAS,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;IACrG,IAAI,CAAC,sBAAsB;QAAE,OAAO,EAAE,CAAA;IAEtC,MAAM,4BAA4B,GAAG,iBAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;IACtF,IAAI,CAAC,4BAA4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OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,wCAAwC,GAAG,CAC/C,MAAuC,EACZ,EAAE;IAC7B,MAAM,eAAe,GAAsB,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAqB,EAAE,CAAA;IAClD,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 { User } from '../../auth'\nimport { Dictionary } from '../../common'\nimport { Labels } from '../../language'\nimport { ArenaRecordNode, NodeKeys, Nodes, NodeValues } from '../../node'\nimport { NodeDef, NodeDefExpression, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ValidationFields } from '../../validation/validation'\nimport { NodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\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\nexport interface RecordValidatorParams {\n user: User\n survey: Survey\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n record: ArenaRecord\n}\n\nexport interface AttributeValidatorParams extends RecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface AttributesValidatorParams extends RecordValidatorParams {\n nodes: Dictionary<ArenaRecordNode>\n}\n\nexport interface SortedAttributesValidatorParams extends RecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\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, SiblingKeyNodeItem[]>\n\nconst _getSiblingNodeKeys = (\n params: AttributeValidatorParams & { siblingKeyNodesCache?: SiblingKeyNodesCache }\n): SiblingKeyNodeItem[] => {\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) {\n return []\n }\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return []\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return []\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let items = siblingKeyNodesCache?.get(cacheKey)\n if (!items) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n items = []\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 siblingKeyNodesCache?.set(cacheKey, items)\n }\n return items.filter((item) => item.entityUuid !== ancestorMultipleEntity.uuid)\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: Survey\n expression: NodeDefExpression\n defaultMessage?: string\n}): Labels => {\n const { survey, expression, defaultMessage } = params\n const messages: Labels = { ...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: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }\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: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_field: string, node: any): Promise<ValidationResult> => {\n const valid = !Nodes.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: { user: User; survey: Survey; record: ArenaRecord; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ValidationResult> => {\n const { user, survey, record, nodeDef } = params\n if (Nodes.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 user,\n survey,\n record,\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: AttributeValidatorParams & { 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 [NodeKeys.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: AttributeValidatorParams & {\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache?: SiblingKeyNodesCache\n }\n) => {\n const { survey, nodeDef, nodeParent: parentNode, attribute } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && Nodes.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 siblingNodeKeys = _getSiblingNodeKeys(params)\n const siblingNodeKeysWithSameValue: ArenaRecordNode[] = []\n const siblingNodeKeysWithErrors: ArenaRecordNode[] = []\n siblingNodeKeys.forEach(({ keyNode, hasErrors }) => {\n if (NodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })) {\n siblingNodeKeysWithSameValue.push(keyNode)\n }\n if (hasErrors) {\n siblingNodeKeysWithErrors.push(keyNode)\n }\n })\n return [...siblingNodeKeysWithSameValue, ...siblingNodeKeysWithErrors]\n}\n\nconst findSortedNodesToValidate = (params: SortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result = []\n const siblingKeyNodesCache: SiblingKeyNodesCache = 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 result.push(\n ...NodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents }),\n ...findSiblingKeyNodesToValidate({ ...params, nodeDef, nodeParent, attribute: node, siblingKeyNodesCache })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n result.push(...Records.getAttributeSiblings(node, nodeDef)(record))\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: SortedAttributesValidatorParams\n): Promise<ValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ValidationFields = {}\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,4 +1,4 @@
1
- import { getCycle, getRoot, getNodes, getNodesArray, getNodeByUuid, getNodesByUuids, getNodesByDefUuid, getChild, getChildren, getParent, getParentCodeAttribute, getAncestorCodePath, getDependentCodeAttributes, getAncestor, getEntityKeyNodes, getEntityKeyNodesByDefUuid, getEntityKeyValues, getEntityKeyValuesByDefUuid, getEntitySiblings, getAttributeSiblings, getNodeIndex, visitAncestorsAndSelf, getAncestorsAndSelf, getDescendant, getDescendantsOrSelf, isDescendantOf, visitDescendantsAndSelf, getDependentNodePointers, findEntityByKeyValues, findEntityWithSameKeysInAnotherRecord, getCategoryItemUuid, isNodeEmpty, isNodeFilledByUser, isEmpty, getStep, isInAnalysisStep } from './_records/recordGetters';
1
+ import { getCycle, getRoot, getNodes, getNodesArray, getNodeByUuid, getNodesByUuids, getNodesByDefUuid, getChild, getChildren, getParent, getParentCodeAttribute, getAncestorCodePath, getDependentCodeAttributes, getAncestor, getEntityKeyNodes, getEntityKeyNodesByDefUuid, getEntityKeyValues, getEntityKeyValuesByDefUuid, getEntitySiblings, getAttributeSiblings, getNodeIndex, isNodeRequired, visitAncestorsAndSelf, getAncestorsAndSelf, getDescendant, getDescendantsOrSelf, isDescendantOf, visitDescendantsAndSelf, getDependentNodePointers, findEntityByKeyValues, findEntityWithSameKeysInAnotherRecord, getCategoryItemUuid, isNodeEmpty, isNodeFilledByUser, isEmpty, getStep, isInAnalysisStep } from './_records/recordGetters';
2
2
  import { addNode, addNodes } from './_records/recordUpdater';
3
3
  import { getEnumeratingCategoryItems, findDependentEnumeratedEntityDefsNotEmpty } from './_records/recordUtils';
4
4
  import { getEntityCompletionPercent, getEntityCompletionStats, getEntityOwnCompletionPercent, getRecordCompletionPercent } from './_records/recordCompletion';
@@ -29,6 +29,7 @@ export declare const Records: {
29
29
  isNodeApplicable: (node: import("..").ArenaRecordNode) => (record: import("./record").ArenaRecord) => boolean;
30
30
  isNodeEditable: (node: import("..").ArenaRecordNode) => (record: import("./record").ArenaRecord) => boolean;
31
31
  isNodeVisible: (node: import("..").ArenaRecordNode) => (record: import("./record").ArenaRecord) => boolean;
32
+ isNodeRequired: typeof isNodeRequired;
32
33
  visitAncestorsAndSelf: typeof visitAncestorsAndSelf;
33
34
  getAncestorsAndSelf: typeof getAncestorsAndSelf;
34
35
  getDescendant: typeof getDescendant;
@@ -33,6 +33,7 @@ exports.Records = {
33
33
  isNodeApplicable: recordGetters_1.isNodeApplicable,
34
34
  isNodeEditable: recordGetters_1.isNodeEditable,
35
35
  isNodeVisible: recordGetters_1.isNodeVisible,
36
+ isNodeRequired: recordGetters_1.isNodeRequired,
36
37
  visitAncestorsAndSelf: recordGetters_1.visitAncestorsAndSelf,
37
38
  getAncestorsAndSelf: recordGetters_1.getAncestorsAndSelf,
38
39
  getDescendant: recordGetters_1.getDescendant,
@@ -1 +1 @@
1
- {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/record/records.ts"],"names":[],"mappings":";;;AAAA,4DAwCiC;AACjC,4DAA4D;AAC5D,wDAA+G;AAC/G,kEAKoC;AACpC,4EAWyC;AACzC,gFAAiF;AAEpE,QAAA,OAAO,GAAG;IACrB,OAAO;IACP,QAAQ,EAAR,wBAAQ;IACR,OAAO,EAAP,uBAAO;IACP,QAAQ,EAAR,wBAAQ;IACR,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,eAAe,EAAf,+BAAe;IACf,iBAAiB,EAAjB,iCAAiB;IACjB,QAAQ,EAAR,wBAAQ;IACR,WAAW,EAAX,2BAAW;IACX,SAAS,EAAT,yBAAS;IACT,sBAAsB,EAAtB,sCAAsB;IACtB,mBAAmB,EAAnB,mCAAmB;IACnB,0BAA0B,EAA1B,0CAA0B;IAC1B,WAAW,EAAX,2BAAW;IACX,iBAAiB,EAAjB,iCAAiB;IACjB,0BAA0B,EAA1B,0CAA0B;IAC1B,kBAAkB,EAAlB,kCAAkB;IAClB,2BAA2B,EAA3B,2CAA2B;IAC3B,iBAAiB,EAAjB,iCAAiB;IACjB,oBAAoB,EAApB,oCAAoB;IACpB,YAAY,EAAZ,4BAAY;IACZ,gBAAgB,EAAhB,gCAAgB;IAChB,cAAc,EAAd,8BAAc;IACd,aAAa,EAAb,6BAAa;IACb,qBAAqB,EAArB,qCAAqB;IACrB,mBAAmB,EAAnB,mCAAmB;IACnB,aAAa,EAAb,6BAAa;IACb,oBAAoB,EAApB,oCAAoB;IACpB,cAAc,EAAd,8BAAc;IACd,uBAAuB,EAAvB,uCAAuB;IACvB,wBAAwB,EAAxB,wCAAwB;IACxB,qBAAqB,EAArB,qCAAqB;IACrB,qCAAqC,EAArC,qDAAqC;IACrC,mBAAmB,EAAnB,mCAAmB;IACnB,WAAW,EAAX,2BAAW;IACX,kBAAkB,EAAlB,kCAAkB;IAClB,OAAO,EAAP,uBAAO;IACP,OAAO,EAAP,uBAAO;IACP,gBAAgB,EAAhB,gCAAgB;IAChB,0BAA0B,EAA1B,6CAA0B;IAC1B,wBAAwB,EAAxB,2CAAwB;IACxB,6BAA6B,EAA7B,gDAA6B;IAC7B,0BAA0B,EAA1B,6CAA0B;IAC1B,2BAA2B,EAA3B,mDAA2B;IAC3B,eAAe,EAAf,uCAAe;IACf,6BAA6B,EAA7B,qDAA6B;IAC7B,iBAAiB,EAAjB,yCAAiB;IACjB,oBAAoB,EAApB,4CAAoB;IACpB,uBAAuB,EAAvB,+CAAuB;IACvB,gBAAgB,EAAhB,wCAAgB;IAChB,gCAAgC,EAAhC,wDAAgC;IAChC,sBAAsB,EAAtB,8CAAsB;IACtB,6BAA6B,EAA7B,qDAA6B;IAC7B,SAAS;IACT,OAAO,EAAP,uBAAO;IACP,QAAQ,EAAR,wBAAQ;IACR,gIAAgI;IAChI,UAAU,EAAV,+BAAU;IACV,oIAAoI;IACpI,WAAW,EAAX,gCAAW;IACX,uGAAuG;IACvG,UAAU,EAAE,+BAAU;IACtB,yGAAyG;IACzG,WAAW,EAAE,gCAAW;IACxB,QAAQ;IACR,2BAA2B,EAA3B,yCAA2B;IAC3B,yCAAyC,EAAzC,uDAAyC;CAC1C,CAAA","sourcesContent":["import {\n getCycle,\n getRoot,\n getNodes,\n getNodesArray,\n getNodeByUuid,\n getNodesByUuids,\n getNodesByDefUuid,\n getChild,\n getChildren,\n getParent,\n getParentCodeAttribute,\n getAncestorCodePath,\n getDependentCodeAttributes,\n getAncestor,\n getEntityKeyNodes,\n getEntityKeyNodesByDefUuid,\n getEntityKeyValues,\n getEntityKeyValuesByDefUuid,\n getEntitySiblings,\n getAttributeSiblings,\n getNodeIndex,\n isNodeApplicable,\n isNodeEditable,\n isNodeVisible,\n visitAncestorsAndSelf,\n getAncestorsAndSelf,\n getDescendant,\n getDescendantsOrSelf,\n isDescendantOf,\n visitDescendantsAndSelf,\n getDependentNodePointers,\n findEntityByKeyValues,\n findEntityWithSameKeysInAnotherRecord,\n getCategoryItemUuid,\n isNodeEmpty,\n isNodeFilledByUser,\n isEmpty,\n getStep,\n isInAnalysisStep,\n} from './_records/recordGetters'\nimport { addNode, addNodes } from './_records/recordUpdater'\nimport { getEnumeratingCategoryItems, findDependentEnumeratedEntityDefsNotEmpty } from './_records/recordUtils'\nimport {\n getEntityCompletionPercent,\n getEntityCompletionStats,\n getEntityOwnCompletionPercent,\n getRecordCompletionPercent,\n} from './_records/recordCompletion'\nimport {\n getDescendantPageNodeDefUuids,\n getEntitySubtreeStatus,\n getMultiplePageEntitiesStatus,\n getNodeDefChildrenInOwnPage,\n getPageNodeDefs,\n getPageValidationStatus,\n getRecordPagesValidationProgress,\n nodeBelongsToOwnPage,\n nodeBelongsToPage,\n pageHasOwnErrors,\n} from './_records/recordPagesValidation'\nimport { removeNode, removeNodes } from './recordNodesUpdater/recordNodesDeleter'\n\nexport const Records = {\n // READ\n getCycle,\n getRoot,\n getNodes,\n getNodesArray,\n getNodeByUuid,\n getNodesByUuids,\n getNodesByDefUuid,\n getChild,\n getChildren,\n getParent,\n getParentCodeAttribute,\n getAncestorCodePath,\n getDependentCodeAttributes,\n getAncestor,\n getEntityKeyNodes,\n getEntityKeyNodesByDefUuid,\n getEntityKeyValues,\n getEntityKeyValuesByDefUuid,\n getEntitySiblings,\n getAttributeSiblings,\n getNodeIndex,\n isNodeApplicable,\n isNodeEditable,\n isNodeVisible,\n visitAncestorsAndSelf,\n getAncestorsAndSelf,\n getDescendant,\n getDescendantsOrSelf,\n isDescendantOf,\n visitDescendantsAndSelf,\n getDependentNodePointers,\n findEntityByKeyValues,\n findEntityWithSameKeysInAnotherRecord,\n getCategoryItemUuid,\n isNodeEmpty,\n isNodeFilledByUser,\n isEmpty,\n getStep,\n isInAnalysisStep,\n getEntityCompletionPercent,\n getEntityCompletionStats,\n getEntityOwnCompletionPercent,\n getRecordCompletionPercent,\n getNodeDefChildrenInOwnPage,\n getPageNodeDefs,\n getDescendantPageNodeDefUuids,\n nodeBelongsToPage,\n nodeBelongsToOwnPage,\n getPageValidationStatus,\n pageHasOwnErrors,\n getRecordPagesValidationProgress,\n getEntitySubtreeStatus,\n getMultiplePageEntitiesStatus,\n // UPDATE\n addNode,\n addNodes,\n /** Low-level: removes the node and its descendants without updating dependents and validation (see RecordUpdater.deleteNode) */\n removeNode,\n /** Low-level: removes the nodes and their descendants without updating dependents and validation (see RecordUpdater.deleteNodes) */\n removeNodes,\n /** @deprecated Use removeNode (or RecordUpdater.deleteNode to update dependents and validation too) */\n deleteNode: removeNode,\n /** @deprecated Use removeNodes (or RecordUpdater.deleteNodes to update dependents and validation too) */\n deleteNodes: removeNodes,\n // Utils\n getEnumeratingCategoryItems,\n findDependentEnumeratedEntityDefsNotEmpty,\n}\n\nexport type { RecordUpdateOptions } from './_records/recordUpdateOptions'\nexport type {\n EntitySubtreeStatus,\n PageValidationStatus,\n PagesValidationProgress,\n} from './_records/recordPagesValidation'\n"]}
1
+ {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/record/records.ts"],"names":[],"mappings":";;;AAAA,4DAyCiC;AACjC,4DAA4D;AAC5D,wDAA+G;AAC/G,kEAKoC;AACpC,4EAWyC;AACzC,gFAAiF;AAEpE,QAAA,OAAO,GAAG;IACrB,OAAO;IACP,QAAQ,EAAR,wBAAQ;IACR,OAAO,EAAP,uBAAO;IACP,QAAQ,EAAR,wBAAQ;IACR,aAAa,EAAb,6BAAa;IACb,aAAa,EAAb,6BAAa;IACb,eAAe,EAAf,+BAAe;IACf,iBAAiB,EAAjB,iCAAiB;IACjB,QAAQ,EAAR,wBAAQ;IACR,WAAW,EAAX,2BAAW;IACX,SAAS,EAAT,yBAAS;IACT,sBAAsB,EAAtB,sCAAsB;IACtB,mBAAmB,EAAnB,mCAAmB;IACnB,0BAA0B,EAA1B,0CAA0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AAQ;IACR,gIAAgI;IAChI,UAAU,EAAV,+BAAU;IACV,oIAAoI;IACpI,WAAW,EAAX,gCAAW;IACX,uGAAuG;IACvG,UAAU,EAAE,+BAAU;IACtB,yGAAyG;IACzG,WAAW,EAAE,gCAAW;IACxB,QAAQ;IACR,2BAA2B,EAA3B,yCAA2B;IAC3B,yCAAyC,EAAzC,uDAAyC;CAC1C,CAAA","sourcesContent":["import {\n getCycle,\n getRoot,\n getNodes,\n getNodesArray,\n getNodeByUuid,\n getNodesByUuids,\n getNodesByDefUuid,\n getChild,\n getChildren,\n getParent,\n getParentCodeAttribute,\n getAncestorCodePath,\n getDependentCodeAttributes,\n getAncestor,\n getEntityKeyNodes,\n getEntityKeyNodesByDefUuid,\n getEntityKeyValues,\n getEntityKeyValuesByDefUuid,\n getEntitySiblings,\n getAttributeSiblings,\n getNodeIndex,\n isNodeApplicable,\n isNodeEditable,\n isNodeVisible,\n isNodeRequired,\n visitAncestorsAndSelf,\n getAncestorsAndSelf,\n getDescendant,\n getDescendantsOrSelf,\n isDescendantOf,\n visitDescendantsAndSelf,\n getDependentNodePointers,\n findEntityByKeyValues,\n findEntityWithSameKeysInAnotherRecord,\n getCategoryItemUuid,\n isNodeEmpty,\n isNodeFilledByUser,\n isEmpty,\n getStep,\n isInAnalysisStep,\n} from './_records/recordGetters'\nimport { addNode, addNodes } from './_records/recordUpdater'\nimport { getEnumeratingCategoryItems, findDependentEnumeratedEntityDefsNotEmpty } from './_records/recordUtils'\nimport {\n getEntityCompletionPercent,\n getEntityCompletionStats,\n getEntityOwnCompletionPercent,\n getRecordCompletionPercent,\n} from './_records/recordCompletion'\nimport {\n getDescendantPageNodeDefUuids,\n getEntitySubtreeStatus,\n getMultiplePageEntitiesStatus,\n getNodeDefChildrenInOwnPage,\n getPageNodeDefs,\n getPageValidationStatus,\n getRecordPagesValidationProgress,\n nodeBelongsToOwnPage,\n nodeBelongsToPage,\n pageHasOwnErrors,\n} from './_records/recordPagesValidation'\nimport { removeNode, removeNodes } from './recordNodesUpdater/recordNodesDeleter'\n\nexport const Records = {\n // READ\n getCycle,\n getRoot,\n getNodes,\n getNodesArray,\n getNodeByUuid,\n getNodesByUuids,\n getNodesByDefUuid,\n getChild,\n getChildren,\n getParent,\n getParentCodeAttribute,\n getAncestorCodePath,\n getDependentCodeAttributes,\n getAncestor,\n getEntityKeyNodes,\n getEntityKeyNodesByDefUuid,\n getEntityKeyValues,\n getEntityKeyValuesByDefUuid,\n getEntitySiblings,\n getAttributeSiblings,\n getNodeIndex,\n isNodeApplicable,\n isNodeEditable,\n isNodeVisible,\n isNodeRequired,\n visitAncestorsAndSelf,\n getAncestorsAndSelf,\n getDescendant,\n getDescendantsOrSelf,\n isDescendantOf,\n visitDescendantsAndSelf,\n getDependentNodePointers,\n findEntityByKeyValues,\n findEntityWithSameKeysInAnotherRecord,\n getCategoryItemUuid,\n isNodeEmpty,\n isNodeFilledByUser,\n isEmpty,\n getStep,\n isInAnalysisStep,\n getEntityCompletionPercent,\n getEntityCompletionStats,\n getEntityOwnCompletionPercent,\n getRecordCompletionPercent,\n getNodeDefChildrenInOwnPage,\n getPageNodeDefs,\n getDescendantPageNodeDefUuids,\n nodeBelongsToPage,\n nodeBelongsToOwnPage,\n getPageValidationStatus,\n pageHasOwnErrors,\n getRecordPagesValidationProgress,\n getEntitySubtreeStatus,\n getMultiplePageEntitiesStatus,\n // UPDATE\n addNode,\n addNodes,\n /** Low-level: removes the node and its descendants without updating dependents and validation (see RecordUpdater.deleteNode) */\n removeNode,\n /** Low-level: removes the nodes and their descendants without updating dependents and validation (see RecordUpdater.deleteNodes) */\n removeNodes,\n /** @deprecated Use removeNode (or RecordUpdater.deleteNode to update dependents and validation too) */\n deleteNode: removeNode,\n /** @deprecated Use removeNodes (or RecordUpdater.deleteNodes to update dependents and validation too) */\n deleteNodes: removeNodes,\n // Utils\n getEnumeratingCategoryItems,\n findDependentEnumeratedEntityDefsNotEmpty,\n}\n\nexport type { RecordUpdateOptions } from './_records/recordUpdateOptions'\nexport type {\n EntitySubtreeStatus,\n PageValidationStatus,\n PagesValidationProgress,\n} from './_records/recordPagesValidation'\n"]}
@@ -20,6 +20,7 @@ export declare enum SurveyDependencyType {
20
20
  maxCount = "maxCount",
21
21
  minCount = "minCount",
22
22
  parentCode = "parentCode",
23
+ required = "required",
23
24
  validations = "validations",
24
25
  visible = "visible",
25
26
  onUpdate = "onUpdate"
@@ -13,6 +13,7 @@ var SurveyDependencyType;
13
13
  SurveyDependencyType["maxCount"] = "maxCount";
14
14
  SurveyDependencyType["minCount"] = "minCount";
15
15
  SurveyDependencyType["parentCode"] = "parentCode";
16
+ SurveyDependencyType["required"] = "required";
16
17
  SurveyDependencyType["validations"] = "validations";
17
18
  SurveyDependencyType["visible"] = "visible";
18
19
  SurveyDependencyType["onUpdate"] = "onUpdate";
@@ -1 +1 @@
1
- {"version":3,"file":"survey.js","sourceRoot":"","sources":["../../src/survey/survey.ts"],"names":[],"mappings":";;;AAUa,QAAA,YAAY,GAAG,GAAG,CAAA;AAM/B,IAAY,oBAaX;AAbD,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,mDAA2B,CAAA;IAC3B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EAbW,oBAAoB,aAApB,oBAAoB,GAApB,oBAAoB,QAa/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,GAAmB;IACpD,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, Dictionary } from '../common'\nimport { AuthGroup } from '../auth'\nimport { Labels, LanguageCode } from '../language'\nimport { SRS } from '../srs'\n\nimport { NodeDef, NodeDefType } from '../nodeDef'\nimport { Category } from '../category'\nimport { Taxonomy } from '../taxonomy'\nimport { SurveyRefData } from './refData/refData'\n\nexport const defaultCycle = '0'\n\nexport interface SurveyDependency {\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 validations = 'validations',\n visible = 'visible',\n onUpdate = 'onUpdate', // dependencies updated on every record update, stored as dictionary of booleans\n}\n\nexport type SurveyDependencyGraph = {\n [key in SurveyDependencyType]: SurveyDependency\n}\n\nexport interface SurveyCycle {\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 SurveySecurity = {\n [key in SurveySecurityProp]?: boolean\n}\n\nexport const surveySecurityDefaults: SurveySecurity = {\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 SurveyDocImageProps = SurveyFileProps & {\n documentPlace?: SurveyDocPlace\n applyIf?: string\n}\n\nexport type SurveyFileProps = {\n deleted?: boolean\n labels?: Labels\n name?: string\n nodeUuid?: string\n recordUuid?: string\n size?: number | null\n temporary?: boolean\n type?: string\n}\n\nexport type SurveyFile = {\n uuid: string\n props: SurveyFileProps\n content?: Buffer | null\n dateCreated: string\n}\n\nexport type SurveyDocImage = SurveyFile & {\n props: SurveyDocImageProps\n}\n\nexport type SurveyDocOptions = {\n headerOnFirstPageOnly?: boolean // default: true\n}\n\nexport interface SurveyProps {\n collectUri?: string\n cycles: {\n [key: string]: SurveyCycle\n }\n defaultCycleKey?: string\n descriptions?: Labels\n fieldManualLinks?: Labels\n // when true, values of attributes becoming non-applicable are kept during data entry (default: cleared)\n keepNonApplicableValues?: boolean\n labels?: Labels\n languages: LanguageCode[]\n name: string\n preloadedMapLayers?: SurveyFile[]\n preloadedMapLayersEnabled?: boolean\n security?: SurveySecurity\n srs: SRS[]\n surveyDocImages?: SurveyDocImage[]\n surveyDocOptions?: SurveyDocOptions\n}\n\nexport interface SurveyNodeDefsIndex {\n rootDefUuid?: string\n childDefUuidPresenceByParentUuid?: { [parentUuid: string]: { [nodeDefUuid: string]: boolean } }\n nodeDefUuidByName?: Dictionary<string>\n qualifierPresenceByUuid?: { [nodeDefUuid: string]: boolean }\n}\n\nexport interface Survey extends ArenaObject<SurveyProps> {\n authGroups: Array<AuthGroup>\n dateCreated?: string\n dateModified?: string\n datePublished?: string\n dependencyGraph?: SurveyDependencyGraph\n draft: boolean\n nodeDefs?: { [nodeDefUuid: string]: NodeDef<NodeDefType> }\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]: Category }\n /**\n * Taxonomies indexed by uuid.\n */\n taxonomies?: { [taxonomyUuid: string]: Taxonomy }\n /**\n * Reference data cache (category items and taxa).\n */\n refData?: SurveyRefData\n\n nodeDefsIndex?: SurveyNodeDefsIndex\n}\n"]}
1
+ {"version":3,"file":"survey.js","sourceRoot":"","sources":["../../src/survey/survey.ts"],"names":[],"mappings":";;;AAUa,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,GAAmB;IACpD,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, Dictionary } from '../common'\nimport { AuthGroup } from '../auth'\nimport { Labels, LanguageCode } from '../language'\nimport { SRS } from '../srs'\n\nimport { NodeDef, NodeDefType } from '../nodeDef'\nimport { Category } from '../category'\nimport { Taxonomy } from '../taxonomy'\nimport { SurveyRefData } from './refData/refData'\n\nexport const defaultCycle = '0'\n\nexport interface SurveyDependency {\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 SurveyDependencyGraph = {\n [key in SurveyDependencyType]: SurveyDependency\n}\n\nexport interface SurveyCycle {\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 SurveySecurity = {\n [key in SurveySecurityProp]?: boolean\n}\n\nexport const surveySecurityDefaults: SurveySecurity = {\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 SurveyDocImageProps = SurveyFileProps & {\n documentPlace?: SurveyDocPlace\n applyIf?: string\n}\n\nexport type SurveyFileProps = {\n deleted?: boolean\n labels?: Labels\n name?: string\n nodeUuid?: string\n recordUuid?: string\n size?: number | null\n temporary?: boolean\n type?: string\n}\n\nexport type SurveyFile = {\n uuid: string\n props: SurveyFileProps\n content?: Buffer | null\n dateCreated: string\n}\n\nexport type SurveyDocImage = SurveyFile & {\n props: SurveyDocImageProps\n}\n\nexport type SurveyDocOptions = {\n headerOnFirstPageOnly?: boolean // default: true\n}\n\nexport interface SurveyProps {\n collectUri?: string\n cycles: {\n [key: string]: SurveyCycle\n }\n defaultCycleKey?: string\n descriptions?: Labels\n fieldManualLinks?: Labels\n // when true, values of attributes becoming non-applicable are kept during data entry (default: cleared)\n keepNonApplicableValues?: boolean\n labels?: Labels\n languages: LanguageCode[]\n name: string\n preloadedMapLayers?: SurveyFile[]\n preloadedMapLayersEnabled?: boolean\n security?: SurveySecurity\n srs: SRS[]\n surveyDocImages?: SurveyDocImage[]\n surveyDocOptions?: SurveyDocOptions\n}\n\nexport interface SurveyNodeDefsIndex {\n rootDefUuid?: string\n childDefUuidPresenceByParentUuid?: { [parentUuid: string]: { [nodeDefUuid: string]: boolean } }\n nodeDefUuidByName?: Dictionary<string>\n qualifierPresenceByUuid?: { [nodeDefUuid: string]: boolean }\n}\n\nexport interface Survey extends ArenaObject<SurveyProps> {\n authGroups: Array<AuthGroup>\n dateCreated?: string\n dateModified?: string\n datePublished?: string\n dependencyGraph?: SurveyDependencyGraph\n draft: boolean\n nodeDefs?: { [nodeDefUuid: string]: NodeDef<NodeDefType> }\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]: Category }\n /**\n * Taxonomies indexed by uuid.\n */\n taxonomies?: { [taxonomyUuid: string]: Taxonomy }\n /**\n * Reference data cache (category items and taxa).\n */\n refData?: SurveyRefData\n\n nodeDefsIndex?: SurveyNodeDefsIndex\n}\n"]}
@@ -61,6 +61,7 @@ const isContextParentByDependencyType = {
61
61
  [survey_1.SurveyDependencyType.minCount]: true,
62
62
  [survey_1.SurveyDependencyType.onUpdate]: true,
63
63
  [survey_1.SurveyDependencyType.parentCode]: false,
64
+ [survey_1.SurveyDependencyType.required]: true,
64
65
  [survey_1.SurveyDependencyType.validations]: true,
65
66
  [survey_1.SurveyDependencyType.visible]: true,
66
67
  };
@@ -75,6 +76,7 @@ const selfReferenceAllowedByDependencyType = {
75
76
  [survey_1.SurveyDependencyType.minCount]: false,
76
77
  [survey_1.SurveyDependencyType.onUpdate]: false,
77
78
  [survey_1.SurveyDependencyType.parentCode]: false,
79
+ [survey_1.SurveyDependencyType.required]: false,
78
80
  [survey_1.SurveyDependencyType.validations]: true,
79
81
  [survey_1.SurveyDependencyType.visible]: false,
80
82
  };
@@ -89,6 +91,7 @@ const newDependencyGraph = () => ({
89
91
  [survey_1.SurveyDependencyType.minCount]: {},
90
92
  [survey_1.SurveyDependencyType.onUpdate]: {},
91
93
  [survey_1.SurveyDependencyType.parentCode]: {},
94
+ [survey_1.SurveyDependencyType.required]: {},
92
95
  [survey_1.SurveyDependencyType.validations]: {},
93
96
  [survey_1.SurveyDependencyType.visible]: {},
94
97
  });
@@ -196,6 +199,7 @@ const addNodeDefDependencies = (params) => __awaiter(void 0, void 0, void 0, fun
196
199
  graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.applicable, nodeDef_1.NodeDefs.getApplicable(nodeDef));
197
200
  graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.defaultValues, nodeDef_1.NodeDefs.getDefaultValues(nodeDef));
198
201
  graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.editable, nodeDef_1.NodeDefs.getEditableIf(nodeDef));
202
+ graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.required, nodeDef_1.NodeDefs.getRequiredIf(nodeDef));
199
203
  graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.validations, nodeDef_1.NodeDefs.getValidationsExpressions(nodeDef));
200
204
  graphsUpdated = yield _addDependencies(survey_1.SurveyDependencyType.visible, nodeDef_1.NodeDefs.getVisibleIf(nodeDef));
201
205
  const maxCount = nodeDef_1.NodeDefs.getMaxCount(nodeDef);
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/survey/surveys/dependencies.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,cAAc,uCAAkB;AAC5C,2CASsB;AACtB,iFAA6E;AAE7E,sCAA+E;AAC/E,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,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,OAAO,CAAC,EAAE,KAAK;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,UAAU,CAAC,EAAE,KAAK;IACxC,CAAC,6BAAoB,CAAC,WAAW,CAAC,EAAE,IAAI;IACxC,CAAC,6BAAoB,CAAC,OAAO,CAAC,EAAE,IAAI;CACrC,CAAA;AAED,MAAM,oCAAoC,GAAG;IAC3C,CAAC,6BAAoB,CAAC,UAAU,CAAC,EAAE,KAAK;IACxC,CAAC,6B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,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,MAAc,EAAmB,EAAE;IACpF,iIAAiI;IACjI,MAAM,UAAU,GAAG,IAAI,CAAA;IAEvB,sCAAsC;IACtC,IAAI,aAAa,mCAAgB,MAAM,KAAE,eAAe,EAAE,kBAAkB,EAAE,GAAE,CAAA;IAChF,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 NodeDef,\n NodeDefCode,\n NodeDefEntity,\n NodeDefExpression,\n NodeDefFile,\n NodeDefProps,\n NodeDefs,\n NodeDefType,\n} from '../../nodeDef'\nimport { NodeDefExpressionEvaluator } from '../../nodeDefExpressionEvaluator'\n\nimport { Survey, SurveyDependencyGraph, SurveyDependencyType } from '../survey'\nimport { Arrays, Objects } from '../../utils'\nimport { NodeDefExpressionFactory } from '../../nodeDef/nodeDef'\nimport { Dictionary } 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.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.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.validations]: {},\n [SurveyDependencyType.visible]: {},\n})\n\nconst getDependencyGraph = (survey: Survey): SurveyDependencyGraph => survey.dependencyGraph ?? newDependencyGraph()\n\nconst getDependencies = (params: {\n graphs: SurveyDependencyGraph\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: Survey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): NodeDef<NodeDefType, NodeDefProps>[] => {\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: Survey }) => {\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: SurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n nodeDefDepUuid: string\n sideEffect: boolean\n}): SurveyDependencyGraph => {\n const { graphs, type, nodeDefUuid, nodeDefDepUuid, sideEffect = false } = params\n const deps = getDependencies({ graphs, type, nodeDefUuid })\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: Survey\n nodeDef: NodeDef<NodeDefType>\n type: SurveyDependencyType\n graphs: SurveyDependencyGraph\n expressions: NodeDefExpression[]\n sideEffect?: boolean\n}): Promise<SurveyDependencyGraph> => {\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]: NodeDef<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: Dictionary<NodeDef<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: Dictionary<NodeDef<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: NodeDef<NodeDefType>\n survey: Survey\n sideEffect?: boolean\n}): Promise<Survey> => {\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: NodeDefExpression[]) => {\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.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 NodeDefFile)\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 NodeDefEntity)\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 NodeDefCode)\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: SurveyDependencyGraph\n dependencyType: SurveyDependencyType\n nodeDefUuid: string\n}): SurveyDependencyGraph => {\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: Survey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): Survey => {\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: Survey): Promise<Survey> => {\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: Survey = { ...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,sCAA+E;AAC/E,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,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,OAAO,CAAC,EAAE,KAAK;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,UAAU,CAAC,EAAE,KAAK;IACxC,CAAC,6BAAoB,CAAC,QAAQ,CAAC,EAAE,IAAI;IACrC,CAAC,6BAAoB,CAAC,WAAW,CAAC,EAAE,IAAI;IACxC,CAAC,6BAAoB,CAAC,OAAO,CAAC,EAAE,IAAI;CACrC,CAAA;AAED,MAAM,oCAAoC,GAAG;IAC3C,CAAC,6BAAoB,CAAC,UAAU,CAAC,EAAE,KAAK;IACxC,CAAC,6BAA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,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACzC,MAAM,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,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,MAAc,EAAmB,EAAE;IACpF,iIAAiI;IACjI,MAAM,UAAU,GAAG,IAAI,CAAA;IAEvB,sCAAsC;IACtC,IAAI,aAAa,mCAAgB,MAAM,KAAE,eAAe,EAAE,kBAAkB,EAAE,GAAE,CAAA;IAChF,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 NodeDef,\n NodeDefCode,\n NodeDefEntity,\n NodeDefExpression,\n NodeDefFile,\n NodeDefProps,\n NodeDefs,\n NodeDefType,\n} from '../../nodeDef'\nimport { NodeDefExpressionEvaluator } from '../../nodeDefExpressionEvaluator'\n\nimport { Survey, SurveyDependencyGraph, SurveyDependencyType } from '../survey'\nimport { Arrays, Objects } from '../../utils'\nimport { NodeDefExpressionFactory } from '../../nodeDef/nodeDef'\nimport { Dictionary } 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: Survey): SurveyDependencyGraph => survey.dependencyGraph ?? newDependencyGraph()\n\nconst getDependencies = (params: {\n graphs: SurveyDependencyGraph\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: Survey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): NodeDef<NodeDefType, NodeDefProps>[] => {\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: Survey }) => {\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: SurveyDependencyGraph\n type: SurveyDependencyType\n nodeDefUuid: string\n nodeDefDepUuid: string\n sideEffect: boolean\n}): SurveyDependencyGraph => {\n const { graphs, type, nodeDefUuid, nodeDefDepUuid, sideEffect = false } = params\n const deps = getDependencies({ graphs, type, nodeDefUuid })\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: Survey\n nodeDef: NodeDef<NodeDefType>\n type: SurveyDependencyType\n graphs: SurveyDependencyGraph\n expressions: NodeDefExpression[]\n sideEffect?: boolean\n}): Promise<SurveyDependencyGraph> => {\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]: NodeDef<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: Dictionary<NodeDef<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: Dictionary<NodeDef<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: NodeDef<NodeDefType>\n survey: Survey\n sideEffect?: boolean\n}): Promise<Survey> => {\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: NodeDefExpression[]) => {\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 NodeDefFile)\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 NodeDefEntity)\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 NodeDefCode)\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: SurveyDependencyGraph\n dependencyType: SurveyDependencyType\n nodeDefUuid: string\n}): SurveyDependencyGraph => {\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: Survey\n nodeDefUuid: string\n dependencyType?: SurveyDependencyType\n}): Survey => {\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: Survey): Promise<Survey> => {\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: Survey = { ...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"]}
@@ -21,5 +21,6 @@ export declare abstract class NodeDefBuilder {
21
21
  visibleIf(...expressions: (string | NodeDefExpression)[]): this;
22
22
  maxCount(countExpr: NodeDefCountExpression): this;
23
23
  minCount(countExpr: NodeDefCountExpression): this;
24
+ requiredIf(...expressions: (string | NodeDefExpression)[]): this;
24
25
  required(): this;
25
26
  }
@@ -54,6 +54,14 @@ class NodeDefBuilder {
54
54
  sideEffect: true,
55
55
  });
56
56
  }
57
+ requiredIf(...expressions) {
58
+ return utils_1.Objects.assocPath({
59
+ obj: this,
60
+ path: ['propsAdvanced', 'validations', 'requiredIf'],
61
+ value: expressions.map((expression) => typeof expression === 'string' ? nodeDef_2.NodeDefExpressionFactory.createInstance({ expression }) : expression),
62
+ sideEffect: true,
63
+ });
64
+ }
57
65
  required() {
58
66
  return utils_1.Objects.assocPath({
59
67
  obj: this,
@@ -1 +1 @@
1
- {"version":3,"file":"nodeDefBuilder.js","sourceRoot":"","sources":["../../../../src/tests/builder/surveyBuilder/nodeDefBuilder.ts"],"names":[],"mappings":";;;AACA,8CAOyB;AACzB,sDAA8G;AAC9G,0CAAwC;AAExC;IAKE,YAAY,IAAY,EAAE,IAAiB;QACzC,IAAI,CAAC,IAA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C,CAAC,CAAC,CAAC,UAAU,CACtG,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,SAAiC;QACxC,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;YACtD,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ,CAAC,SAAiC;QACxC,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;YACtD,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,UAAU,CAAC;YAClD,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["import { Survey } from '../../../survey'\nimport {\n NodeDef,\n NodeDefFactory,\n NodeDefEntity,\n NodeDefProps,\n NodeDefPropsAdvanced,\n NodeDefType,\n} from '../../../nodeDef'\nimport { NodeDefCountExpression, NodeDefExpression, NodeDefExpressionFactory } from '../../../nodeDef/nodeDef'\nimport { Objects } from '../../../utils'\n\nexport abstract class NodeDefBuilder {\n protected props: NodeDefProps\n protected propsAdvanced: NodeDefPropsAdvanced\n protected type: NodeDefType\n\n constructor(name: string, type: NodeDefType) {\n this.type = type\n this.props = {\n name,\n }\n this.propsAdvanced = {}\n }\n\n protected createNodeDef(params: { nodeDefParent?: NodeDefEntity } = {}): NodeDef<NodeDefType, NodeDefProps> {\n const nodeDef = NodeDefFactory.createInstance({\n nodeDefParent: params.nodeDefParent,\n type: this.type,\n props: this.props,\n propsAdvanced: this.propsAdvanced,\n })\n nodeDef.temporary = false\n return nodeDef\n }\n\n abstract build(params: { survey: Survey; nodeDefParent?: NodeDefEntity }): { [uuid: string]: NodeDef<NodeDefType> }\n\n multiple(): this {\n this.props.multiple = true\n return this\n }\n\n applyIf(expression: string): this {\n this.propsAdvanced.applicable = [NodeDefExpressionFactory.createInstance({ expression })]\n return this\n }\n\n editableIf(...expressions: (string | NodeDefExpression)[]): this {\n this.propsAdvanced.editableIf = expressions.map((expression) =>\n typeof expression === 'string' ? NodeDefExpressionFactory.createInstance({ expression }) : expression\n )\n return this\n }\n\n visibleIf(...expressions: (string | NodeDefExpression)[]): this {\n this.propsAdvanced.visibleIf = expressions.map((expression) =>\n typeof expression === 'string' ? NodeDefExpressionFactory.createInstance({ expression }) : expression\n )\n return this\n }\n\n maxCount(countExpr: NodeDefCountExpression): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'count', 'max'],\n value: countExpr,\n sideEffect: true,\n })\n }\n\n minCount(countExpr: NodeDefCountExpression): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'count', 'min'],\n value: countExpr,\n sideEffect: true,\n })\n }\n\n required(): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'required'],\n value: true,\n sideEffect: true,\n })\n }\n}\n"]}
1
+ {"version":3,"file":"nodeDefBuilder.js","sourceRoot":"","sources":["../../../../src/tests/builder/surveyBuilder/nodeDefBuilder.ts"],"names":[],"mappings":";;;AACA,8CAOyB;AACzB,sDAA8G;AAC9G,0CAAwC;AAExC;IAKE,YAAY,IAAY,EAAE,IAAiB;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG;YACX,IAAI;SACL,CAAA;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;IACzB,CAAC;IAES,aAAa,CAAC,MAAM,G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E,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;YACtD,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ,CAAC,SAAiC;QACxC,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;YACtD,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,UAAU,CAAC,GAAG,WAA2C;QACvD,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,YAAY,CAAC;YACpD,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACpC,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,kCAAwB,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CACtG;YACD,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,eAAO,CAAC,SAAS,CAAC;YACvB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,UAAU,CAAC;YAClD,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["import { Survey } from '../../../survey'\nimport {\n NodeDef,\n NodeDefFactory,\n NodeDefEntity,\n NodeDefProps,\n NodeDefPropsAdvanced,\n NodeDefType,\n} from '../../../nodeDef'\nimport { NodeDefCountExpression, NodeDefExpression, NodeDefExpressionFactory } from '../../../nodeDef/nodeDef'\nimport { Objects } from '../../../utils'\n\nexport abstract class NodeDefBuilder {\n protected props: NodeDefProps\n protected propsAdvanced: NodeDefPropsAdvanced\n protected type: NodeDefType\n\n constructor(name: string, type: NodeDefType) {\n this.type = type\n this.props = {\n name,\n }\n this.propsAdvanced = {}\n }\n\n protected createNodeDef(params: { nodeDefParent?: NodeDefEntity } = {}): NodeDef<NodeDefType, NodeDefProps> {\n const nodeDef = NodeDefFactory.createInstance({\n nodeDefParent: params.nodeDefParent,\n type: this.type,\n props: this.props,\n propsAdvanced: this.propsAdvanced,\n })\n nodeDef.temporary = false\n return nodeDef\n }\n\n abstract build(params: { survey: Survey; nodeDefParent?: NodeDefEntity }): { [uuid: string]: NodeDef<NodeDefType> }\n\n multiple(): this {\n this.props.multiple = true\n return this\n }\n\n applyIf(expression: string): this {\n this.propsAdvanced.applicable = [NodeDefExpressionFactory.createInstance({ expression })]\n return this\n }\n\n editableIf(...expressions: (string | NodeDefExpression)[]): this {\n this.propsAdvanced.editableIf = expressions.map((expression) =>\n typeof expression === 'string' ? NodeDefExpressionFactory.createInstance({ expression }) : expression\n )\n return this\n }\n\n visibleIf(...expressions: (string | NodeDefExpression)[]): this {\n this.propsAdvanced.visibleIf = expressions.map((expression) =>\n typeof expression === 'string' ? NodeDefExpressionFactory.createInstance({ expression }) : expression\n )\n return this\n }\n\n maxCount(countExpr: NodeDefCountExpression): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'count', 'max'],\n value: countExpr,\n sideEffect: true,\n })\n }\n\n minCount(countExpr: NodeDefCountExpression): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'count', 'min'],\n value: countExpr,\n sideEffect: true,\n })\n }\n\n requiredIf(...expressions: (string | NodeDefExpression)[]): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'requiredIf'],\n value: expressions.map((expression) =>\n typeof expression === 'string' ? NodeDefExpressionFactory.createInstance({ expression }) : expression\n ),\n sideEffect: true,\n })\n }\n\n required(): this {\n return Objects.assocPath({\n obj: this,\n path: ['propsAdvanced', 'validations', 'required'],\n value: true,\n sideEffect: true,\n })\n }\n}\n"]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "OpenForis",
5
5
  "email": "openforis.arena@gmail.com"
6
6
  },
7
- "version": "2.6.0",
7
+ "version": "2.8.0",
8
8
  "description": "Arena core module",
9
9
  "repository": {
10
10
  "type": "git",