@openforis/arena-core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/nodePointer.js.map +1 -1
- package/dist/esm/node/nodeValueFormatter.js.map +1 -1
- package/dist/esm/node/nodeValues.js.map +1 -1
- package/dist/esm/nodeDef/factory.js.map +1 -1
- package/dist/esm/nodeDef/index.js.map +1 -1
- package/dist/esm/nodeDef/nodeDef.js.map +1 -1
- package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
- package/dist/esm/nodeDef/service.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/esm/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/esm/record/_records/recordCompletion.js.map +1 -1
- package/dist/esm/record/_records/recordGetters.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/countValidator.js.map +1 -1
- package/dist/esm/survey/survey.js.map +1 -1
- package/dist/esm/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/esm/survey/surveys/dependencies.js.map +1 -1
- package/dist/esm/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/esm/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node/nodePointer.d.ts +2 -2
- package/dist/node/nodePointer.js.map +1 -1
- package/dist/node/nodeValueFormatter.d.ts +2 -2
- package/dist/node/nodeValueFormatter.js.map +1 -1
- package/dist/node/nodeValues.d.ts +3 -3
- package/dist/node/nodeValues.js.map +1 -1
- package/dist/nodeDef/factory.d.ts +3 -3
- package/dist/nodeDef/factory.js.map +1 -1
- package/dist/nodeDef/index.d.ts +1 -1
- package/dist/nodeDef/index.js.map +1 -1
- package/dist/nodeDef/nodeDef.d.ts +2 -0
- package/dist/nodeDef/nodeDef.js.map +1 -1
- package/dist/nodeDef/nodeDefs.d.ts +50 -50
- package/dist/nodeDef/nodeDefs.js.map +1 -1
- package/dist/nodeDef/service.d.ts +7 -7
- package/dist/nodeDef/service.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/context.d.ts +3 -4
- package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/node/identifier.d.ts +2 -2
- package/dist/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/record/_records/nodeDefSelfReferences.d.ts +2 -2
- package/dist/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/record/_records/recordCompletion.js.map +1 -1
- package/dist/record/_records/recordGetters.d.ts +4 -4
- package/dist/record/_records/recordGetters.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/record/recordValidator/attributeKeyValidator.d.ts +3 -3
- package/dist/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeTypeValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeUniqueValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/record/recordValidator/countValidator.d.ts +2 -2
- package/dist/record/recordValidator/countValidator.js.map +1 -1
- package/dist/survey/survey.d.ts +2 -2
- package/dist/survey/survey.js.map +1 -1
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.d.ts +3 -3
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/survey/surveys/dependencies.d.ts +4 -4
- package/dist/survey/surveys/dependencies.js.map +1 -1
- package/dist/survey/surveys/nodeDefs.d.ts +28 -28
- package/dist/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/tests/builder/recordBuilder/nodeBuilder.d.ts +2 -2
- package/dist/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +3 -3
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDefs.js","sourceRoot":"","sources":["../../src/nodeDef/nodeDefs.ts"],"names":[],"mappings":";;;AACA,+CAAsD;AACtD,2DAA6D;AAC7D,sCAAwC;AACxC,oCAAkC;AAClC,uCAUkB;AAMlB,2CAMuB;AAMvB,uCAA4F;AAG5F,MAAM,MAAM,GAAG,CAAC,OAAkC,EAAW,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAA;AAEnF,MAAM,WAAW,GAAG,CAAC,OAAkC,EAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAEvF,MAAM,QAAQ,GAAG,CAAC,OAAkC,EAAiC,EAAE,CACrF,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,MAAM,CAAA;AAErC,MAAM,SAAS,GAAG,CAAC,OAAkC,EAAkC,EAAE,CACvF,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,OAAO,CAAA;AAEtC,MAAM,MAAM,GAAG,CAAC,OAAkC,EAA+B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,IAAI,CAAA;AAErH,MAAM,YAAY,GAAG,CAAC,OAAkC,EAAqC,EAAE,CAC7F,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,UAAU,CAAA;AAEzC,MAAM,MAAM,GAAG,CAAC,OAAkC,EAA+B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,IAAI,CAAA;AAErH,MAAM,SAAS,GAAG,CAAC,OAAkC,EAAkC,EAAE,CACvF,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,OAAO,CAAA;AAEtC,MAAM,MAAM,GAAG,CAAC,OAAkC,EAA+B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,IAAI,CAAA;AAErH,MAAM,K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Z,eAAe;IAEf,eAAe;IACf,oBAAoB;IACpB,2BAA2B;IAC3B,6BAA6B;IAC7B,yBAAyB;IACzB,qBAAqB;IACrB,WAAW;IACX,cAAc;IACd,wBAAwB;IACxB,2BAA2B;IAC3B,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,6BAA6B;IAC7B,sCAAsC;IACtC,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IAEd,SAAS;IACT,cAAc;IACd,mBAAmB;IACnB,sBAAsB;IACtB,uBAAuB;IACvB,iCAAiC;IACjC,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,gBAAgB;IAChB,iCAAiC;IACjC,6BAA6B;IAC7B,uBAAuB;IACvB,WAAW;IACX,2BAA2B;IAC3B,0BAA0B;IAC1B,cAAc;IACd,cAAc;IACd,yBAAyB;IACzB,UAAU;IACV,aAAa;IACb,mBAAmB;IACnB,iCAAiC;IACjC,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,WAAW;IACX,WAAW;IACX,WAAW;IACX,uBAAuB;IACvB,eAAe;IACf,WAAW;IACX,gBAAgB;CACjB,CAAA","sourcesContent":["import { LanguageCode } from '../language'\nimport { getLabelOrDefault } from '../language/labels'\nimport { ValuePropsCoordinate } from '../node/nodeValueProps'\nimport { defaultCycle } from '../survey'\nimport { Objects } from '../utils'\nimport {\n ArenaNodeDef,\n ArenaNodeDefCountExpression,\n NodeDefCountType,\n ArenaNodeDefExpression,\n ArenaNodeDefLayout,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n NodeDefType,\n ArenaNodeDefValidations,\n} from './nodeDef'\nimport { ArenaNodeDefBoolean } from './types/boolean'\nimport { ArenaNodeDefCode } from './types/code'\nimport { ArenaNodeDefCoordinate } from './types/coordinate'\nimport { ArenaNodeDefDate } from './types/date'\nimport { ArenaNodeDefDecimal } from './types/decimal'\nimport {\n ArenaNodeDefEntity,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n ArenaNodeDefPrintOrientation,\n} from './types/entity'\nimport { ArenaNodeDefFile, NodeDefFileType } from './types/file'\nimport { ArenaNodeDefFormHeader } from './types/formHeader'\nimport { ArenaNodeDefGeo } from './types/geo'\nimport { ArenaNodeDefInteger } from './types/integer'\nimport { ArenaNodeDefTaxon } from './types/taxon'\nimport { ArenaNodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { ArenaNodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefBoolean =>\n nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefDecimal =>\n nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isGeo = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefGeo => nodeDef.type === NodeDefType.geo\n\nconst isInteger = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefInteger =>\n nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): boolean =>\n nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: ArenaNodeDef<NodeDefType>): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: ArenaNodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: ArenaNodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: ArenaNodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: ArenaNodeDefEntity): ArenaNodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: ArenaNodeDef<NodeDefType>): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: ArenaNodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: ArenaNodeDef<NodeDefType>): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: ArenaNodeDefCoordinate): boolean =>\n !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: ArenaNodeDefCoordinate): string[] => {\n const result = []\n if (nodeDef.props.includeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.accuracy])\n if (nodeDef.props.includeAltitude) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitude])\n if (nodeDef.props.includeAltitudeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitudeAccuracy])\n return result\n}\n\n// decimal\nconst getMaxNumberDecimalDigits = (nodeDef: ArenaNodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: ArenaNodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: ArenaNodeDefFile): string | undefined =>\n nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: ArenaNodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\nconst isScreenCaptureInMapAllowed = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.screenCaptureInMapAllowed\n\n// geo\nconst isPositionTracking = (nodeDef: ArenaNodeDefGeo): boolean => !!nodeDef.props.positionTracking\n\n// time\nconst isSecondsIncluded = (nodeDef: ArenaNodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: ArenaNodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: ArenaNodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: ArenaNodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: ArenaNodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getValidations(nodeDef)?.required ?? false\n\nconst getRequiredIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.requiredIf ?? []\n\nconst isRequiredIfDefined = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getRequiredIf(nodeDef).length > 0\n\n/**\n * True if the node def is always required or required when a condition is met (node def level, not record level).\n */\nconst isRequiredOrConditionallyRequired = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n isRequired(nodeDef) || isRequiredIfDefined(nodeDef)\n\n// // Min/max count\n\nconst getCount = (\n nodeDef: ArenaNodeDef<NodeDefType>,\n countType: NodeDefCountType\n): ArenaNodeDefCountExpression | undefined => {\n const countValidations = getValidations(nodeDef)?.count\n if (!countValidations) return undefined\n return countType === NodeDefCountType.max ? countValidations.max : countValidations.min\n}\n\nconst getMinCount = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): ArenaNodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: ArenaNodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: ArenaNodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: ArenaNodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\n isGeo,\n isInteger,\n isTaxon,\n isText,\n isTime,\n isMultiple,\n isMultipleEntity,\n isSingle,\n isSingleEntity,\n isAttribute,\n isSingleAttribute,\n isMultipleAttribute,\n isKey,\n isAutoIncrementalKey,\n isQualifier,\n isReadOnly,\n isHidden,\n isEnumerate,\n getEnumeratingItemsExpression,\n isAutoCreateMinCountItems,\n getPrintOrientation,\n isAnalysis,\n isRoot,\n getType,\n isLayoutElement,\n getName,\n getLabelOrName,\n getDescription,\n getDefaultValues,\n isDefaultValueEvaluatedOneTime,\n getApplicable,\n getVisibleFields,\n isFieldVisible,\n isInCycle,\n isExcludedInClone,\n getEditableIf,\n isAlwaysEditable,\n getVisibleIf,\n isAlwaysVisible,\n\n getCategoryUuid,\n getParentCodeDefUuid,\n isAllowOnlyDeviceCoordinate,\n getCoordinateAdditionalFields,\n getMaxNumberDecimalDigits,\n getFileNameExpression,\n getFileType,\n getFileMaxSize,\n isGeotagInformationShown,\n isScreenCaptureInMapAllowed,\n isPositionTracking,\n isSecondsIncluded,\n getTaxonomyUuid,\n isVernacularNameSelectionKept,\n isVernacularNameAlwaysIncludedIfSingle,\n getTextTransform,\n getTextInputType,\n getItemsFilter,\n\n // layout\n getLayoutProps,\n getLayoutRenderType,\n isLayoutRenderTypeForm,\n isLayoutRenderTypeTable,\n getChildrenEntitiesInOwnPageUuids,\n getLayoutChildren,\n getPageUuid,\n isDisplayInOwnPage,\n isHiddenInMobile,\n isIncludedInMultipleEntitySummary,\n isIncludedInPreviousCycleLink,\n isHiddenWhenNotRelevant,\n isCodeShown,\n isLayoutRenderTypeHyperlink,\n isLayoutRenderTypeMarkdown,\n // validations\n getValidations,\n getValidationsExpressions,\n isRequired,\n getRequiredIf,\n isRequiredIfDefined,\n isRequiredOrConditionallyRequired,\n // // Min Max\n hasMinOrMaxCount,\n getCount,\n getMaxCount,\n getMinCount,\n // Analysis\n getAreaBasedEstimatedOf,\n getIndexInChain,\n // Metadata\n getMetaHierarchy,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeDefs.js","sourceRoot":"","sources":["../../src/nodeDef/nodeDefs.ts"],"names":[],"mappings":";;;AACA,+CAAsD;AACtD,2DAA6D;AAC7D,sCAAwC;AACxC,oCAAkC;AAClC,uCAUkB;AAMlB,2CAMuB;AAMvB,uCAA4F;AAG5F,MAAM,MAAM,GAAG,CAAC,OAAwB,EAAW,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAA;AAEzE,MAAM,WAAW,GAAG,CAAC,OAAwB,EAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAE7E,MAAM,QAAQ,GAAG,CAAC,OAAwB,EAAiC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,MAAM,CAAA;AAEjH,MAAM,SAAS,GAAG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ChB,QAAQ;IACR,WAAW;IACX,WAAW;IACX,WAAW;IACX,uBAAuB;IACvB,eAAe;IACf,WAAW;IACX,gBAAgB;CACjB,CAAA","sourcesContent":["import { LanguageCode } from '../language'\nimport { getLabelOrDefault } from '../language/labels'\nimport { ValuePropsCoordinate } from '../node/nodeValueProps'\nimport { defaultCycle } from '../survey'\nimport { Objects } from '../utils'\nimport {\n ArenaAnyNodeDef,\n ArenaNodeDef,\n ArenaNodeDefCountExpression,\n NodeDefCountType,\n ArenaNodeDefExpression,\n ArenaNodeDefLayout,\n ArenaNodeDefPropsWithLayout,\n NodeDefType,\n ArenaNodeDefValidations,\n} from './nodeDef'\nimport { ArenaNodeDefBoolean } from './types/boolean'\nimport { ArenaNodeDefCode } from './types/code'\nimport { ArenaNodeDefCoordinate } from './types/coordinate'\nimport { ArenaNodeDefDate } from './types/date'\nimport { ArenaNodeDefDecimal } from './types/decimal'\nimport {\n ArenaNodeDefEntity,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n ArenaNodeDefPrintOrientation,\n} from './types/entity'\nimport { ArenaNodeDefFile, NodeDefFileType } from './types/file'\nimport { ArenaNodeDefFormHeader } from './types/formHeader'\nimport { ArenaNodeDefGeo } from './types/geo'\nimport { ArenaNodeDefInteger } from './types/integer'\nimport { ArenaNodeDefTaxon } from './types/taxon'\nimport { ArenaNodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { ArenaNodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: ArenaAnyNodeDef): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: ArenaAnyNodeDef): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity => nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefBoolean => nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefDecimal => nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isGeo = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefGeo => nodeDef.type === NodeDefType.geo\n\nconst isInteger = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefInteger => nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: ArenaAnyNodeDef): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: ArenaAnyNodeDef): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: ArenaAnyNodeDef): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: ArenaAnyNodeDef): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: ArenaAnyNodeDef): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: ArenaAnyNodeDef, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: ArenaAnyNodeDef, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: ArenaNodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: ArenaNodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: ArenaNodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: ArenaNodeDefEntity): ArenaNodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: ArenaAnyNodeDef): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: ArenaAnyNodeDef): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: ArenaNodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: ArenaAnyNodeDef): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: ArenaAnyNodeDef): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: ArenaAnyNodeDef): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: ArenaAnyNodeDef): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: ArenaNodeDefCoordinate): boolean =>\n !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: ArenaNodeDefCoordinate): string[] => {\n const result = []\n if (nodeDef.props.includeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.accuracy])\n if (nodeDef.props.includeAltitude) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitude])\n if (nodeDef.props.includeAltitudeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitudeAccuracy])\n return result\n}\n\n// decimal\nconst getMaxNumberDecimalDigits = (nodeDef: ArenaNodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: ArenaNodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: ArenaNodeDefFile): string | undefined =>\n nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: ArenaNodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\nconst isScreenCaptureInMapAllowed = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.screenCaptureInMapAllowed\n\n// geo\nconst isPositionTracking = (nodeDef: ArenaNodeDefGeo): boolean => !!nodeDef.props.positionTracking\n\n// time\nconst isSecondsIncluded = (nodeDef: ArenaNodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: ArenaNodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: ArenaNodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: ArenaNodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: ArenaNodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: ArenaAnyNodeDef): boolean => getValidations(nodeDef)?.required ?? false\n\nconst getRequiredIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => getValidations(nodeDef)?.requiredIf ?? []\n\nconst isRequiredIfDefined = (nodeDef: ArenaAnyNodeDef): boolean => getRequiredIf(nodeDef).length > 0\n\n/**\n * True if the node def is always required or required when a condition is met (node def level, not record level).\n */\nconst isRequiredOrConditionallyRequired = (nodeDef: ArenaAnyNodeDef): boolean =>\n isRequired(nodeDef) || isRequiredIfDefined(nodeDef)\n\n// // Min/max count\n\nconst getCount = (nodeDef: ArenaAnyNodeDef, countType: NodeDefCountType): ArenaNodeDefCountExpression | undefined => {\n const countValidations = getValidations(nodeDef)?.count\n if (!countValidations) return undefined\n return countType === NodeDefCountType.max ? countValidations.max : countValidations.min\n}\n\nconst getMinCount = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: ArenaAnyNodeDef): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): ArenaNodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: ArenaNodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: ArenaNodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: ArenaNodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\n isGeo,\n isInteger,\n isTaxon,\n isText,\n isTime,\n isMultiple,\n isMultipleEntity,\n isSingle,\n isSingleEntity,\n isAttribute,\n isSingleAttribute,\n isMultipleAttribute,\n isKey,\n isAutoIncrementalKey,\n isQualifier,\n isReadOnly,\n isHidden,\n isEnumerate,\n getEnumeratingItemsExpression,\n isAutoCreateMinCountItems,\n getPrintOrientation,\n isAnalysis,\n isRoot,\n getType,\n isLayoutElement,\n getName,\n getLabelOrName,\n getDescription,\n getDefaultValues,\n isDefaultValueEvaluatedOneTime,\n getApplicable,\n getVisibleFields,\n isFieldVisible,\n isInCycle,\n isExcludedInClone,\n getEditableIf,\n isAlwaysEditable,\n getVisibleIf,\n isAlwaysVisible,\n\n getCategoryUuid,\n getParentCodeDefUuid,\n isAllowOnlyDeviceCoordinate,\n getCoordinateAdditionalFields,\n getMaxNumberDecimalDigits,\n getFileNameExpression,\n getFileType,\n getFileMaxSize,\n isGeotagInformationShown,\n isScreenCaptureInMapAllowed,\n isPositionTracking,\n isSecondsIncluded,\n getTaxonomyUuid,\n isVernacularNameSelectionKept,\n isVernacularNameAlwaysIncludedIfSingle,\n getTextTransform,\n getTextInputType,\n getItemsFilter,\n\n // layout\n getLayoutProps,\n getLayoutRenderType,\n isLayoutRenderTypeForm,\n isLayoutRenderTypeTable,\n getChildrenEntitiesInOwnPageUuids,\n getLayoutChildren,\n getPageUuid,\n isDisplayInOwnPage,\n isHiddenInMobile,\n isIncludedInMultipleEntitySummary,\n isIncludedInPreviousCycleLink,\n isHiddenWhenNotRelevant,\n isCodeShown,\n isLayoutRenderTypeHyperlink,\n isLayoutRenderTypeMarkdown,\n // validations\n getValidations,\n getValidationsExpressions,\n isRequired,\n getRequiredIf,\n isRequiredIfDefined,\n isRequiredOrConditionallyRequired,\n // // Min Max\n hasMinOrMaxCount,\n getCount,\n getMaxCount,\n getMinCount,\n // Analysis\n getAreaBasedEstimatedOf,\n getIndexInChain,\n // Metadata\n getMetaHierarchy,\n}\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ArenaUser } from '../auth';
|
|
2
2
|
import { ArenaChainNodeDef } from '../chain';
|
|
3
3
|
import { ArenaService } from '../common';
|
|
4
|
-
import {
|
|
4
|
+
import { ArenaAnyNodeDef } from './nodeDef';
|
|
5
5
|
export interface ArenaNodeDefService extends ArenaService {
|
|
6
6
|
create(options: {
|
|
7
7
|
chainNodeDef?: ArenaChainNodeDef;
|
|
8
8
|
cycle: string;
|
|
9
|
-
nodeDef:
|
|
9
|
+
nodeDef: ArenaAnyNodeDef;
|
|
10
10
|
surveyId: number;
|
|
11
11
|
user: ArenaUser;
|
|
12
12
|
}): Promise<{
|
|
13
|
-
[nodeDefUuid: string]:
|
|
13
|
+
[nodeDefUuid: string]: ArenaAnyNodeDef;
|
|
14
14
|
}>;
|
|
15
15
|
getMany(options: {
|
|
16
16
|
advanced?: boolean;
|
|
@@ -23,15 +23,15 @@ export interface ArenaNodeDefService extends ArenaService {
|
|
|
23
23
|
user: ArenaUser;
|
|
24
24
|
validate?: boolean;
|
|
25
25
|
}): Promise<{
|
|
26
|
-
[nodeDefUuid: string]:
|
|
26
|
+
[nodeDefUuid: string]: ArenaAnyNodeDef;
|
|
27
27
|
}>;
|
|
28
28
|
update(options: {
|
|
29
29
|
cycle: string;
|
|
30
|
-
nodeDef:
|
|
30
|
+
nodeDef: ArenaAnyNodeDef;
|
|
31
31
|
user: ArenaUser;
|
|
32
32
|
surveyId: number;
|
|
33
33
|
}): Promise<{
|
|
34
|
-
[nodeDefUuid: string]:
|
|
34
|
+
[nodeDefUuid: string]: ArenaAnyNodeDef;
|
|
35
35
|
}>;
|
|
36
36
|
delete(options: {
|
|
37
37
|
cycle: string;
|
|
@@ -39,6 +39,6 @@ export interface ArenaNodeDefService extends ArenaService {
|
|
|
39
39
|
user: ArenaUser;
|
|
40
40
|
surveyId: number;
|
|
41
41
|
}): Promise<{
|
|
42
|
-
[nodeDefUuid: string]:
|
|
42
|
+
[nodeDefUuid: string]: ArenaAnyNodeDef;
|
|
43
43
|
}>;
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/nodeDef/service.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaChainNodeDef } from '../chain'\nimport { ArenaService } from '../common'\nimport {
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/nodeDef/service.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaChainNodeDef } from '../chain'\nimport { ArenaService } from '../common'\nimport { ArenaAnyNodeDef } from './nodeDef'\n\nexport interface ArenaNodeDefService extends ArenaService {\n // ==== CREATE\n create(options: {\n chainNodeDef?: ArenaChainNodeDef\n cycle: string\n nodeDef: ArenaAnyNodeDef\n surveyId: number\n user: ArenaUser\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== READ\n getMany(options: {\n advanced?: boolean\n cycle?: string\n deleted?: boolean\n draft?: boolean\n limit?: number\n offset?: number\n surveyId: number\n user: ArenaUser\n validate?: boolean\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== UPDATE\n update(options: {\n cycle: string\n nodeDef: ArenaAnyNodeDef\n user: ArenaUser\n surveyId: number\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== DELETE\n delete(options: {\n cycle: string\n nodeDefUuid: string\n user: ArenaUser\n surveyId: number\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ArenaUser } from '../auth';
|
|
2
2
|
import { ArenaExpressionContext } from '../expression';
|
|
3
|
-
import {
|
|
4
|
-
import { ArenaNodeDefProps, NodeDefType } from '../nodeDef/nodeDef';
|
|
3
|
+
import { ArenaAnyNodeDef } from '../nodeDef';
|
|
5
4
|
import { ArenaSurvey } from '../survey';
|
|
6
5
|
import { ArenaAreaOfInterestProvider } from './areaOfInterestProvider';
|
|
7
6
|
import { ArenaCategoryItemProvider } from './categoryItemProvider';
|
|
@@ -9,8 +8,8 @@ import { ArenaTaxonProvider } from './taxonProvider';
|
|
|
9
8
|
export interface NodeDefExpressionContext extends ArenaExpressionContext {
|
|
10
9
|
survey: ArenaSurvey;
|
|
11
10
|
user?: ArenaUser;
|
|
12
|
-
nodeDefCurrent:
|
|
13
|
-
nodeDefContext?:
|
|
11
|
+
nodeDefCurrent: ArenaAnyNodeDef;
|
|
12
|
+
nodeDefContext?: ArenaAnyNodeDef;
|
|
14
13
|
/**
|
|
15
14
|
* Unique UUIDs of node definitions being visited during expression evaluation.
|
|
16
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaExpressionContext } from '../expression'\nimport {
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaExpressionContext } from '../expression'\nimport { ArenaAnyNodeDef } from '../nodeDef'\nimport { ArenaSurvey } from '../survey'\nimport { ArenaAreaOfInterestProvider } from './areaOfInterestProvider'\nimport { ArenaCategoryItemProvider } from './categoryItemProvider'\nimport { ArenaTaxonProvider } from './taxonProvider'\n\nexport interface NodeDefExpressionContext extends ArenaExpressionContext {\n survey: ArenaSurvey\n user?: ArenaUser\n nodeDefCurrent: ArenaAnyNodeDef\n nodeDefContext?: ArenaAnyNodeDef\n /**\n * Unique UUIDs of node definitions being visited during expression evaluation.\n */\n referencedNodeDefUuids?: Set<string>\n selfReferenceAllowed?: boolean\n // true when the expression is used to filter code or taxon items\n itemsFilter?: boolean\n // true when evaluating the property of a member expression (e.g. \"length\" in \"text_attr.length\")\n memberProperty?: boolean\n\n categoryItemProvider?: ArenaCategoryItemProvider\n taxonProvider?: ArenaTaxonProvider\n areaOfInterestProvider?: ArenaAreaOfInterestProvider\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArenaAnyNodeDef } from '../../nodeDef/nodeDef';
|
|
2
2
|
import { IdentifierEvaluator } from '../../expression/javascript/node/identifier';
|
|
3
3
|
import { NodeDefExpressionContext } from '../context';
|
|
4
4
|
import { ArenaIdentifierExpression } from '../../expression';
|
|
@@ -17,7 +17,7 @@ export declare class NodeDefIdentifierEvaluator extends IdentifierEvaluator<Node
|
|
|
17
17
|
/**
|
|
18
18
|
* Tries to find the specified identifier among the node defs that can be "reached" from the context node def.
|
|
19
19
|
*/
|
|
20
|
-
protected findIdentifierAmongReachableNodeDefs(expressionNode: ArenaIdentifierExpression):
|
|
20
|
+
protected findIdentifierAmongReachableNodeDefs(expressionNode: ArenaIdentifierExpression): ArenaAnyNodeDef | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* Iterates over the reachable node defs, i.e. the actual context node def, the children of its ancestors
|
|
23
23
|
* (including the ones inside single entities) and the ancestors themselves, yielding every node def only once.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../src/nodeDefExpressionEvaluator/node/identifier.ts"],"names":[],"mappings":";;;AACA,4DAAsG;AACtG,qDAAiD;AACjD,uCAA4C;AAC5C,4EAAiF;AACjF,+DAAqG;AAErG,iDAAgF;AAChF,uCAA0D;AAC1D,iDAAqD;AACrD,2FAA0E;AAC1E,sDAAwD;AAExD;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,MAE9B,EAA4D,EAAE;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAA;IAExD,IAAI,CAAC,oBAAoB;QAAE,OAAO,SAAS,CAAA;IAE3C,IAAI,mBAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAA,2BAAgB,EAAC,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,IAAI,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,IAAA,2BAA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Y,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefProps, NodeDefType } from '../../nodeDef/nodeDef'\nimport { getNodeDefChildren, getNodeDefParent, getNodeDefSource } from '../../survey/surveys/nodeDefs'\nimport { NodeDefs } from '../../nodeDef/nodeDefs'\nimport { Objects, Queue } from '../../utils'\nimport { IdentifierEvaluator } from '../../expression/javascript/node/identifier'\nimport { getGlobalObjectProperty, isForbiddenPropertyName } from '../../expression/javascript/global'\nimport { NodeDefExpressionContext } from '../context'\nimport { ExpressionVariable, ArenaIdentifierExpression } from '../../expression'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ValidatorErrorKeys } from '../../validation'\nimport { NodeNativeProperties } from './nodeDefExpressionNativeProperties'\nimport { RecordNodeValues } from '../../node/nodeValues'\n\n/**\n * Determines the actual context node def\n * - attribute def => parent entity def\n * - virtual entity def => source node def\n * - entity def => entity def itself\n */\nconst findActualContextNode = (params: {\n context: NodeDefExpressionContext\n}): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined => {\n const { context } = params\n const { survey, object: nodeDefObjectContext } = context\n\n if (!nodeDefObjectContext) return undefined\n\n if (NodeDefs.isAttribute(nodeDefObjectContext)) {\n return getNodeDefParent({ survey, nodeDef: nodeDefObjectContext })\n }\n if (nodeDefObjectContext.virtual) {\n return getNodeDefSource({ survey, nodeDef: nodeDefObjectContext })\n }\n return nodeDefObjectContext\n}\n\nexport class NodeDefIdentifierEvaluator extends IdentifierEvaluator<NodeDefExpressionContext> {\n evaluate(expressionNode: ArenaIdentifierExpression): Promise<any> {\n try {\n return Promise.resolve(this.evaluateIdentifier(expressionNode))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private evaluateIdentifier(expressionNode: ArenaIdentifierExpression): any {\n const { context } = this\n const { nodeDefContext, object: objectContext, itemsFilter, memberProperty } = context\n const { name: exprName } = expressionNode\n\n if (isForbiddenPropertyName(exprName)) {\n this.throwIdentifierNotFound(expressionNode)\n }\n\n if (exprName === ExpressionVariable.CONTEXT) {\n if (nodeDefContext) {\n this.addReferencedNodeDefUuid(nodeDefContext.uuid)\n }\n return nodeDefContext\n }\n\n // global objects (e.g. Math, String)\n const globalObjectProperty = getGlobalObjectProperty(exprName, objectContext)\n if (globalObjectProperty !== null) {\n return globalObjectProperty\n }\n\n if (itemsFilter) {\n const prop = objectContext?.props?.[exprName] ?? objectContext?.props?.extra?.[exprName]\n if (!Objects.isEmpty(prop)) {\n return prop\n }\n }\n\n // check if identifier is a composite attribute value prop\n if (\n NodeDefs.isAttribute(objectContext) &&\n RecordNodeValues.isValueProp({ nodeDef: objectContext, prop: exprName })\n ) {\n return objectContext\n }\n\n if (memberProperty) {\n // property of a member expression (e.g. text_attr.length or text_attr.toUpperCase()): native properties first\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n return this.getReferencedNodeDef(expressionNode)\n }\n // identifier not in a member expression: node defs first, so that node defs named like native properties\n // (e.g. \"name\", \"type\", \"trim\") are always found (and registered as dependencies)\n const referencedNodeDef = this.findReferencedNodeDef(expressionNode)\n if (referencedNodeDef) return referencedNodeDef\n\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n\n return this.throwIdentifierNotFound(expressionNode)\n }\n\n /**\n * Finds the identifier among the native properties or functions of the context object\n * (e.g. String.length or String.toUpperCase()).\n */\n private findNativeProperty(expressionNode: ArenaIdentifierExpression): { value: any } | null {\n const { object: objectContext } = this.context\n const { name: exprName } = expressionNode\n\n const globalOrNativeProperty = this.findGlobalOrNativeProperty(expressionNode)\n if (globalOrNativeProperty) {\n return globalOrNativeProperty\n }\n if (NodeNativeProperties.hasNativeProperty({ nodeDefOrValue: objectContext, propName: exprName })) {\n return {\n value: NodeNativeProperties.evalNodeDefProperty({ nodeDefOrValue: objectContext, propName: exprName }),\n }\n }\n return null\n }\n\n private findReferencedNodeDef(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined {\n const { nodeDefCurrent, selfReferenceAllowed } = this.context\n const referencedNodeDef = this.findIdentifierAmongReachableNodeDefs(expressionNode)\n if (!referencedNodeDef) return undefined\n\n if (!selfReferenceAllowed && referencedNodeDef.uuid === nodeDefCurrent?.uuid) {\n throw new SystemError(ValidatorErrorKeys.expressions.cannotUseCurrentNode, { name: expressionNode.name })\n }\n this.addReferencedNodeDefUuid(referencedNodeDef.uuid)\n return referencedNodeDef\n }\n\n private getReferencedNodeDef(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> {\n return this.findReferencedNodeDef(expressionNode) ?? this.throwIdentifierNotFound(expressionNode)\n }\n\n private throwIdentifierNotFound(expressionNode: ArenaIdentifierExpression): never {\n throw new SystemError(SystemErrorKeys.expression.identifierNotFound, {\n name: expressionNode.name,\n contextObject: this.context.object?.props?.name,\n })\n }\n\n private addReferencedNodeDefUuid(uuid: string) {\n const { context } = this\n const { referencedNodeDefUuids = new Set() } = context\n context.referencedNodeDefUuids = referencedNodeDefUuids.add(uuid)\n }\n\n /**\n * Tries to find the specified identifier among the node defs that can be \"reached\" from the context node def.\n */\n protected findIdentifierAmongReachableNodeDefs(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined {\n const { object: contextObject } = this.context\n\n if (!contextObject) return undefined\n\n // stop at the first match, without visiting all the reachable node defs\n for (const reachableNodeDef of this.iterateReachableNodeDefs()) {\n if (reachableNodeDef.props.name === expressionNode.name) {\n return reachableNodeDef\n }\n }\n return undefined\n }\n\n /**\n * Iterates over the reachable node defs, i.e. the actual context node def, the children of its ancestors\n * (including the ones inside single entities) and the ancestors themselves, yielding every node def only once.\n */\n private *iterateReachableNodeDefs(): Generator<ArenaNodeDef<NodeDefType, ArenaNodeDefProps>> {\n const { context } = this\n const { survey, includeAnalysis } = context\n\n const reachableNodeDefUuids = new Set<string>()\n const visitedUuids = new Set<string>()\n\n const queue = new Queue<ArenaNodeDef<NodeDefType>>()\n\n const actualContextNode = findActualContextNode({ context })\n if (actualContextNode) {\n queue.enqueue(actualContextNode)\n reachableNodeDefUuids.add(actualContextNode.uuid)\n yield actualContextNode\n }\n\n while (!queue.isEmpty()) {\n const entityDefCurrent = queue.dequeue()!\n const entityDefCurrentChildren = getNodeDefChildren({ survey, nodeDef: entityDefCurrent, includeAnalysis })\n for (const childDef of entityDefCurrentChildren) {\n if (!reachableNodeDefUuids.has(childDef.uuid)) {\n reachableNodeDefUuids.add(childDef.uuid)\n yield childDef\n }\n }\n // visit nodes inside single entities\n queue.enqueueItems(entityDefCurrentChildren.filter(NodeDefs.isSingleEntity))\n\n // avoid visiting 2 times the same entity definition when traversing single entities\n if (!visitedUuids.has(entityDefCurrent.uuid)) {\n const entityDefCurrentParent = getNodeDefParent({ survey, nodeDef: entityDefCurrent })\n if (entityDefCurrentParent) {\n queue.enqueue(entityDefCurrentParent)\n }\n if (!reachableNodeDefUuids.has(entityDefCurrent.uuid)) {\n reachableNodeDefUuids.add(entityDefCurrent.uuid)\n yield entityDefCurrent\n }\n visitedUuids.add(entityDefCurrent.uuid)\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../src/nodeDefExpressionEvaluator/node/identifier.ts"],"names":[],"mappings":";;;AACA,4DAAsG;AACtG,qDAAiD;AACjD,uCAA4C;AAC5C,4EAAiF;AACjF,+DAAqG;AAErG,iDAAgF;AAChF,uCAA0D;AAC1D,iDAAqD;AACrD,2FAA0E;AAC1E,sDAAwD;AAExD;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,MAA6C,EAA+B,EAAE;IAC3G,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,E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AA;gBACtF,IAAI,sBAAsB,EAAE,CAAC;oBAC3B,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;gBACvC,CAAC;gBACD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtD,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;oBAChD,MAAM,gBAAgB,CAAA;gBACxB,CAAC;gBACD,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ArenaAnyNodeDef } from '../../nodeDef/nodeDef'\nimport { getNodeDefChildren, getNodeDefParent, getNodeDefSource } from '../../survey/surveys/nodeDefs'\nimport { NodeDefs } from '../../nodeDef/nodeDefs'\nimport { Objects, Queue } from '../../utils'\nimport { IdentifierEvaluator } from '../../expression/javascript/node/identifier'\nimport { getGlobalObjectProperty, isForbiddenPropertyName } from '../../expression/javascript/global'\nimport { NodeDefExpressionContext } from '../context'\nimport { ExpressionVariable, ArenaIdentifierExpression } from '../../expression'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ValidatorErrorKeys } from '../../validation'\nimport { NodeNativeProperties } from './nodeDefExpressionNativeProperties'\nimport { RecordNodeValues } from '../../node/nodeValues'\n\n/**\n * Determines the actual context node def\n * - attribute def => parent entity def\n * - virtual entity def => source node def\n * - entity def => entity def itself\n */\nconst findActualContextNode = (params: { context: NodeDefExpressionContext }): ArenaAnyNodeDef | undefined => {\n const { context } = params\n const { survey, object: nodeDefObjectContext } = context\n\n if (!nodeDefObjectContext) return undefined\n\n if (NodeDefs.isAttribute(nodeDefObjectContext)) {\n return getNodeDefParent({ survey, nodeDef: nodeDefObjectContext })\n }\n if (nodeDefObjectContext.virtual) {\n return getNodeDefSource({ survey, nodeDef: nodeDefObjectContext })\n }\n return nodeDefObjectContext\n}\n\nexport class NodeDefIdentifierEvaluator extends IdentifierEvaluator<NodeDefExpressionContext> {\n evaluate(expressionNode: ArenaIdentifierExpression): Promise<any> {\n try {\n return Promise.resolve(this.evaluateIdentifier(expressionNode))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private evaluateIdentifier(expressionNode: ArenaIdentifierExpression): any {\n const { context } = this\n const { nodeDefContext, object: objectContext, itemsFilter, memberProperty } = context\n const { name: exprName } = expressionNode\n\n if (isForbiddenPropertyName(exprName)) {\n this.throwIdentifierNotFound(expressionNode)\n }\n\n if (exprName === ExpressionVariable.CONTEXT) {\n if (nodeDefContext) {\n this.addReferencedNodeDefUuid(nodeDefContext.uuid)\n }\n return nodeDefContext\n }\n\n // global objects (e.g. Math, String)\n const globalObjectProperty = getGlobalObjectProperty(exprName, objectContext)\n if (globalObjectProperty !== null) {\n return globalObjectProperty\n }\n\n if (itemsFilter) {\n const prop = objectContext?.props?.[exprName] ?? objectContext?.props?.extra?.[exprName]\n if (!Objects.isEmpty(prop)) {\n return prop\n }\n }\n\n // check if identifier is a composite attribute value prop\n if (\n NodeDefs.isAttribute(objectContext) &&\n RecordNodeValues.isValueProp({ nodeDef: objectContext, prop: exprName })\n ) {\n return objectContext\n }\n\n if (memberProperty) {\n // property of a member expression (e.g. text_attr.length or text_attr.toUpperCase()): native properties first\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n return this.getReferencedNodeDef(expressionNode)\n }\n // identifier not in a member expression: node defs first, so that node defs named like native properties\n // (e.g. \"name\", \"type\", \"trim\") are always found (and registered as dependencies)\n const referencedNodeDef = this.findReferencedNodeDef(expressionNode)\n if (referencedNodeDef) return referencedNodeDef\n\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n\n return this.throwIdentifierNotFound(expressionNode)\n }\n\n /**\n * Finds the identifier among the native properties or functions of the context object\n * (e.g. String.length or String.toUpperCase()).\n */\n private findNativeProperty(expressionNode: ArenaIdentifierExpression): { value: any } | null {\n const { object: objectContext } = this.context\n const { name: exprName } = expressionNode\n\n const globalOrNativeProperty = this.findGlobalOrNativeProperty(expressionNode)\n if (globalOrNativeProperty) {\n return globalOrNativeProperty\n }\n if (NodeNativeProperties.hasNativeProperty({ nodeDefOrValue: objectContext, propName: exprName })) {\n return {\n value: NodeNativeProperties.evalNodeDefProperty({ nodeDefOrValue: objectContext, propName: exprName }),\n }\n }\n return null\n }\n\n private findReferencedNodeDef(expressionNode: ArenaIdentifierExpression): ArenaAnyNodeDef | undefined {\n const { nodeDefCurrent, selfReferenceAllowed } = this.context\n const referencedNodeDef = this.findIdentifierAmongReachableNodeDefs(expressionNode)\n if (!referencedNodeDef) return undefined\n\n if (!selfReferenceAllowed && referencedNodeDef.uuid === nodeDefCurrent?.uuid) {\n throw new SystemError(ValidatorErrorKeys.expressions.cannotUseCurrentNode, { name: expressionNode.name })\n }\n this.addReferencedNodeDefUuid(referencedNodeDef.uuid)\n return referencedNodeDef\n }\n\n private getReferencedNodeDef(expressionNode: ArenaIdentifierExpression): ArenaAnyNodeDef {\n return this.findReferencedNodeDef(expressionNode) ?? this.throwIdentifierNotFound(expressionNode)\n }\n\n private throwIdentifierNotFound(expressionNode: ArenaIdentifierExpression): never {\n throw new SystemError(SystemErrorKeys.expression.identifierNotFound, {\n name: expressionNode.name,\n contextObject: this.context.object?.props?.name,\n })\n }\n\n private addReferencedNodeDefUuid(uuid: string) {\n const { context } = this\n const { referencedNodeDefUuids = new Set() } = context\n context.referencedNodeDefUuids = referencedNodeDefUuids.add(uuid)\n }\n\n /**\n * Tries to find the specified identifier among the node defs that can be \"reached\" from the context node def.\n */\n protected findIdentifierAmongReachableNodeDefs(\n expressionNode: ArenaIdentifierExpression\n ): ArenaAnyNodeDef | undefined {\n const { object: contextObject } = this.context\n\n if (!contextObject) return undefined\n\n // stop at the first match, without visiting all the reachable node defs\n for (const reachableNodeDef of this.iterateReachableNodeDefs()) {\n if (reachableNodeDef.props.name === expressionNode.name) {\n return reachableNodeDef\n }\n }\n return undefined\n }\n\n /**\n * Iterates over the reachable node defs, i.e. the actual context node def, the children of its ancestors\n * (including the ones inside single entities) and the ancestors themselves, yielding every node def only once.\n */\n private *iterateReachableNodeDefs(): Generator<ArenaAnyNodeDef> {\n const { context } = this\n const { survey, includeAnalysis } = context\n\n const reachableNodeDefUuids = new Set<string>()\n const visitedUuids = new Set<string>()\n\n const queue = new Queue<ArenaAnyNodeDef>()\n\n const actualContextNode = findActualContextNode({ context })\n if (actualContextNode) {\n queue.enqueue(actualContextNode)\n reachableNodeDefUuids.add(actualContextNode.uuid)\n yield actualContextNode\n }\n\n while (!queue.isEmpty()) {\n const entityDefCurrent = queue.dequeue()!\n const entityDefCurrentChildren = getNodeDefChildren({ survey, nodeDef: entityDefCurrent, includeAnalysis })\n for (const childDef of entityDefCurrentChildren) {\n if (!reachableNodeDefUuids.has(childDef.uuid)) {\n reachableNodeDefUuids.add(childDef.uuid)\n yield childDef\n }\n }\n // visit nodes inside single entities\n queue.enqueueItems(entityDefCurrentChildren.filter(NodeDefs.isSingleEntity))\n\n // avoid visiting 2 times the same entity definition when traversing single entities\n if (!visitedUuids.has(entityDefCurrent.uuid)) {\n const entityDefCurrentParent = getNodeDefParent({ survey, nodeDef: entityDefCurrent })\n if (entityDefCurrentParent) {\n queue.enqueue(entityDefCurrentParent)\n }\n if (!reachableNodeDefUuids.has(entityDefCurrent.uuid)) {\n reachableNodeDefUuids.add(entityDefCurrent.uuid)\n yield entityDefCurrent\n }\n visitedUuids.add(entityDefCurrent.uuid)\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArenaAnyNodeDef } from '../../nodeDef';
|
|
2
2
|
import { SurveyDependencyType } from '../../survey/survey';
|
|
3
3
|
/**
|
|
4
4
|
* Returns true if the node def references itself in its expressions of the specified dependency type only
|
|
@@ -7,7 +7,7 @@ import { SurveyDependencyType } from '../../survey/survey';
|
|
|
7
7
|
* the same node def in the record.
|
|
8
8
|
*/
|
|
9
9
|
declare const isSelfReferenceLocal: (params: {
|
|
10
|
-
nodeDef:
|
|
10
|
+
nodeDef: ArenaAnyNodeDef;
|
|
11
11
|
dependencyType: SurveyDependencyType;
|
|
12
12
|
}) => boolean;
|
|
13
13
|
export declare const NodeDefSelfReferences: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDefSelfReferences.js","sourceRoot":"","sources":["../../../src/record/_records/nodeDefSelfReferences.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAC7E,qEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"nodeDefSelfReferences.js","sourceRoot":"","sources":["../../../src/record/_records/nodeDefSelfReferences.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAC7E,qEAAuE;AACvE,2CAAyD;AACzD,gDAA0D;AAE1D;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,MAIlC,EAAW,EAAE;IACZ,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAA;IACzD,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAClC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAA;IACnH,CAAC;IACD,gEAAgE;IAChE,MAAM,IAAI,GAAG,cAAwC,CAAA;IACrD,IAAI,IAAI,CAAC,IAAI,KAAK,+BAAkB,CAAC,UAAU,EAAE,CAAC;QAChD,OAAO,gBAAgB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAA;IAC/C,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,+BAAkB,CAAC,MAAM,EAAE,C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,CACtD,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAC1B,8BAA8B,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QACpD,8BAA8B,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAChE,CAAA;AACH,CAAC,CAAA;AAEY,QAAA,qBAAqB,GAAG;IACnC,oBAAoB;CACrB,CAAA","sourcesContent":["import { ArenaAnyExpressionNode, ExpressionNodeType } from '../../expression'\nimport { parseExpression } from '../../expression/javascript/evaluator'\nimport { ArenaAnyNodeDef, NodeDefs } from '../../nodeDef'\nimport { SurveyDependencyType } from '../../survey/survey'\n\n/**\n * True if the identifier is used as (or inside) the property of a member expression (e.g. \"dbh\" in\n * \"parent(tree).tree.dbh\" or in \"tree[dbh > 10]\"): there it can refer to nodes outside the context entity.\n */\nconst isReferencedThroughMember = (params: {\n expressionNode: unknown\n name: string\n inMemberProperty: boolean\n}): boolean => {\n const { expressionNode, name, inMemberProperty } = params\n if (!expressionNode || typeof expressionNode !== 'object') return false\n if (Array.isArray(expressionNode)) {\n return expressionNode.some((item) => isReferencedThroughMember({ expressionNode: item, name, inMemberProperty }))\n }\n // parsed expression nodes (or their array or object properties)\n const node = expressionNode as ArenaAnyExpressionNode\n if (node.type === ExpressionNodeType.Identifier) {\n return inMemberProperty && node.name === name\n }\n if (node.type === ExpressionNodeType.Member) {\n const { object, property } = node\n return (\n isReferencedThroughMember({ expressionNode: object, name, inMemberProperty }) ||\n isReferencedThroughMember({ expressionNode: property, name, inMemberProperty: true })\n )\n }\n return Object.values(expressionNode).some((child) =>\n isReferencedThroughMember({ expressionNode: child, name, inMemberProperty })\n )\n}\n\nconst isExpressionSelfReferenceLocal = (params: { expression: string | undefined; name: string }): boolean => {\n const { expression, name } = params\n if (!expression) return true\n try {\n return !isReferencedThroughMember({ expressionNode: parseExpression(expression), name, inMemberProperty: false })\n } catch {\n // invalid expression: be conservative\n return false\n }\n}\n\n/**\n * Returns true if the node def references itself in its expressions of the specified dependency type only\n * as a plain identifier (e.g. \"dbh > 0\" in a validation of \"dbh\"): such a reference is resolved among the\n * children of the node's parent entity, so only the node and its siblings depend on it, not every node with\n * the same node def in the record.\n */\nconst isSelfReferenceLocal = (params: { nodeDef: ArenaAnyNodeDef; dependencyType: SurveyDependencyType }): boolean => {\n const { nodeDef, dependencyType } = params\n // self references by plain identifier are allowed only in validation expressions (see dependencies.ts)\n if (dependencyType !== SurveyDependencyType.validations) return false\n const name = NodeDefs.getName(nodeDef)\n return NodeDefs.getValidationsExpressions(nodeDef).every(\n ({ expression, applyIf }) =>\n isExpressionSelfReferenceLocal({ expression, name }) &&\n isExpressionSelfReferenceLocal({ expression: applyIf, name })\n )\n}\n\nexport const NodeDefSelfReferences = {\n isSelfReferenceLocal,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordCompletion.js","sourceRoot":"","sources":["../../../src/record/_records/recordCompletion.ts"],"names":[],"mappings":";;;AAAA,qCAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"recordCompletion.js","sourceRoot":"","sources":["../../../src/record/_records/recordCompletion.ts"],"names":[],"mappings":";;;AAAA,qCAAyD;AACzD,2CAAyD;AACzD,yCAAmD;AACnD,uCAAqC;AAErC,mDAAgE;AAOhE,MAAM,UAAU,GAAG,GAA0B,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AAEzE,MAAM,QAAQ,GAAG,CAAC,QAA+B,EAAE,UAAiC,EAAQ,EAAE;IAC5F,QAAQ,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;IAClC,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,MAAuB,EAAE,OAAwB,EAAW,EAAE,CACzF,kBAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;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E,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;IAC/B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,GAAG,CAAA;IAC1B,OAAO,eAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAA;AAC5D,CAAC,CAAA;AAED;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAI1C,EAAU,EAAE,CAAC,mBAAmB,CAAC,IAAA,QAAA,wBAAwB,EAAC,MAAM,CAAC,CAAC,CAAA;AAJtD,QAAA,0BAA0B,GAA1B,0BAA0B,CAI4B;AAEnE;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,MAI7C,EAAU,EAAE,CAAC,mBAAmB,CAAC,IAAA,QAAA,wBAAwB,kCAAM,MAAM,KAAE,qBAAqB,EAAE,KAAK,IAAG,CAAC,CAAA;AAJ3F,QAAA,6BAA6B,GAA7B,6BAA6B,CAI8D;AAExG;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAAoD,EAAU,EAAE;IACzG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IACjC,MAAM,UAAU,GAAG,IAAA,uBAAO,EAAC,MAAM,CAAC,CAAA;IAClC,OAAO,UAAU,CAAC,CAAC,CAAC,IAAA,QAAA,0BAA0B,EAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC5F,CAAC,CAAA;AAJY,QAAA,0BAA0B,GAA1B,0BAA0B,CAItC","sourcesContent":["import { ArenaRecordNode, RecordNodes } from '../../node'\nimport { ArenaAnyNodeDef, NodeDefs } from '../../nodeDef'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { Numbers } from '../../utils'\nimport { ArenaRecord } from '../record'\nimport { getChildren, getCycle, getRoot } from './recordGetters'\n\nexport interface EntityCompletionStats {\n total: number\n filled: number\n}\n\nconst emptyStats = (): EntityCompletionStats => ({ total: 0, filled: 0 })\n\nconst addStats = (statsAcc: EntityCompletionStats, statsToAdd: EntityCompletionStats): void => {\n statsAcc.total += statsToAdd.total\n statsAcc.filled += statsToAdd.filled\n}\n\nconst isAttributeRequired = (entity: ArenaRecordNode, nodeDef: ArenaAnyNodeDef): boolean =>\n NodeDefs.isKey(nodeDef) ||\n NodeDefs.isRequired(nodeDef) ||\n (NodeDefs.isRequiredIfDefined(nodeDef) && RecordNodes.isChildRequired(entity, nodeDef.uuid))\n\nconst getAttributeCompletionStats = (params: {\n record: ArenaRecord\n entity: ArenaRecordNode\n nodeDef: ArenaAnyNodeDef\n}): EntityCompletionStats => {\n const { record, entity, nodeDef } = params\n\n if (NodeDefs.isMultiple(nodeDef)) {\n const minCount = RecordNodes.getChildrenMinCount({ parentNode: entity, nodeDef })\n if (Number.isNaN(minCount) || minCount <= 0) return emptyStats()\n\n const filledNodesCount = getChildren(entity, nodeDef.uuid)(record).filter(RecordNodes.isValueNotBlank).length\n\n return { total: minCount, filled: Math.min(filledNodesCount, minCount) }\n }\n\n if (!isAttributeRequired(entity, nodeDef)) return emptyStats()\n\n const node = getChildren(entity, nodeDef.uuid)(record)[0]\n return { total: 1, filled: node && RecordNodes.isValueNotBlank(node) ? 1 : 0 }\n}\n\nconst getChildEntityCompletionStats = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n nodeDef: ArenaAnyNodeDef\n}): EntityCompletionStats => {\n const { survey, record, parentEntity, nodeDef } = params\n const childEntities = getChildren(parentEntity, nodeDef.uuid)(record)\n\n if (NodeDefs.isSingle(nodeDef)) {\n const childEntity = childEntities[0]\n return childEntity ? getEntityCompletionStats({ survey, record, entity: childEntity }) : emptyStats()\n }\n\n const minCountRaw = RecordNodes.getChildrenMinCount({ parentNode: parentEntity, nodeDef })\n const minCount = Number.isNaN(minCountRaw) ? 0 : Math.max(minCountRaw, 0)\n\n const stats = emptyStats()\n // entities added beyond the min count are still expected to be complete\n for (const childEntity of childEntities) {\n addStats(stats, getEntityCompletionStats({ survey, record, entity: childEntity }))\n }\n // a missing repetition (below the min count) counts as a single incomplete unit\n stats.total += Math.max(minCount - childEntities.length, 0)\n return stats\n}\n\nexport const getEntityCompletionStats = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n includeNestedEntities?: boolean\n}): EntityCompletionStats => {\n const { survey, record, entity, includeNestedEntities = true } = params\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const childDefs = Surveys.getNodeDefChildren({ survey, nodeDef: entityDef }).filter(\n NodeDefs.isInCycle(getCycle(record))\n )\n\n const stats = emptyStats()\n for (const childDef of childDefs) {\n if (!RecordNodes.isChildApplicable(entity, childDef.uuid)) continue\n\n if (NodeDefs.isEntity(childDef)) {\n if (!includeNestedEntities) continue\n addStats(stats, getChildEntityCompletionStats({ survey, record, parentEntity: entity, nodeDef: childDef }))\n } else {\n addStats(stats, getAttributeCompletionStats({ record, entity, nodeDef: childDef }))\n }\n }\n return stats\n}\n\nconst toCompletionPercent = (stats: EntityCompletionStats): number => {\n const { total, filled } = stats\n if (total <= 0) return 100\n return Numbers.roundToPrecision((filled / total) * 100, 2)\n}\n\n/**\n * Returns the percentage of completion of the given entity (0-100), considering every descendant recursively.\n * A required or key attribute is considered filled when it has a non empty value; multiple attributes and\n * entities are considered filled based on their min count (see RecordNodes.getChildrenMinCount).\n */\nexport const getEntityCompletionPercent = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n}): number => toCompletionPercent(getEntityCompletionStats(params))\n\n/**\n * Returns the percentage of completion of the given entity (0-100), considering only its own attributes\n * (nested entities are ignored).\n */\nexport const getEntityOwnCompletionPercent = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n}): number => toCompletionPercent(getEntityCompletionStats({ ...params, includeNestedEntities: false }))\n\n/**\n * Returns the percentage of completion of the given record (0-100), i.e. the completion of its root entity.\n */\nexport const getRecordCompletionPercent = (params: { survey: ArenaSurvey; record: ArenaRecord }): number => {\n const { survey, record } = params\n const rootEntity = getRoot(record)\n return rootEntity ? getEntityCompletionPercent({ survey, record, entity: rootEntity }) : 0\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArenaDictionary, TraverseMethod } from '../../common';
|
|
2
2
|
import { ArenaRecordNode, ArenaRecordNodePointer, ArenaRecordNodesMap } from '../../node';
|
|
3
|
-
import { ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefCodeProps,
|
|
3
|
+
import { ArenaAnyNodeDef, ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefCodeProps, NodeDefType } from '../../nodeDef';
|
|
4
4
|
import { ArenaSurvey, SurveyDependencyType } from '../../survey/survey';
|
|
5
5
|
import { ArenaRecord, RecordNodesIndex } from '../record';
|
|
6
6
|
export declare const getCycle: (record: ArenaRecord) => string;
|
|
@@ -36,7 +36,7 @@ export declare const isNodeVisible: (node: ArenaRecordNode) => (record: ArenaRec
|
|
|
36
36
|
* Whether a value is required for the node: key or always required attribute, or attribute with a "required if"
|
|
37
37
|
* condition met in its parent entity (evaluated condition stored in the parent node meta).
|
|
38
38
|
*/
|
|
39
|
-
export declare const isNodeRequired: (nodeDef:
|
|
39
|
+
export declare const isNodeRequired: (nodeDef: ArenaAnyNodeDef, node: ArenaRecordNode) => (record: ArenaRecord) => boolean;
|
|
40
40
|
export declare const getDependentCodeAttributes: (node: ArenaRecordNode) => (record: ArenaRecord) => ArenaRecordNode[];
|
|
41
41
|
export declare const getParentCodeAttribute: (parentNode: ArenaRecordNode, nodeDef: ArenaNodeDefCode) => (record: ArenaRecord) => ArenaRecordNode | undefined;
|
|
42
42
|
/**
|
|
@@ -63,7 +63,7 @@ export declare const getDescendant: (node: ArenaRecordNode, nodeDefDescendant: A
|
|
|
63
63
|
export declare const isDescendantOf: (node: ArenaRecordNode, ancestor: ArenaRecordNode) => boolean;
|
|
64
64
|
export declare const visitDescendantsAndSelf: (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => boolean | void, traverseMethod?: TraverseMethod) => (record: ArenaRecord) => void;
|
|
65
65
|
export declare const findDescendantOrSelf: (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) => (record: ArenaRecord) => ArenaRecordNode | undefined;
|
|
66
|
-
type KeyDefs =
|
|
66
|
+
type KeyDefs = ArenaAnyNodeDef[];
|
|
67
67
|
/**
|
|
68
68
|
* Returns the key nodes of the entity, indexed by key def uuid; keyDefs, when specified, are used instead of the
|
|
69
69
|
* entity def keys in the cycle.
|
|
@@ -73,7 +73,7 @@ export declare const getEntityKeyNodes: (survey: ArenaSurvey, entity: ArenaRecor
|
|
|
73
73
|
export declare const getEntityKeyValuesByDefUuid: (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) => (record: ArenaRecord) => ArenaDictionary<any>;
|
|
74
74
|
export declare const getEntityKeyValues: (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) => (record: ArenaRecord) => any[];
|
|
75
75
|
export declare const getEntitySiblings: (entity: ArenaRecordNode, includeSelf?: boolean) => (record: ArenaRecord) => ArenaRecordNode[];
|
|
76
|
-
export declare const getAttributeSiblings: (node: ArenaRecordNode, nodeDef:
|
|
76
|
+
export declare const getAttributeSiblings: (node: ArenaRecordNode, nodeDef: ArenaAnyNodeDef) => (record: ArenaRecord) => ArenaRecordNode[];
|
|
77
77
|
export declare const getNodeIndex: (node: ArenaRecordNode) => (record: ArenaRecord) => number;
|
|
78
78
|
export declare const findEntityByKeyValues: (survey: ArenaSurvey, cycle: string, parentEntity: ArenaRecordNode, entityDefUuid: string, keyValuesByDefUuid: ArenaDictionary<any>) => (record: ArenaRecord) => ArenaRecordNode | undefined;
|
|
79
79
|
export declare const findEntityWithSameKeysInAnotherRecord: (survey: ArenaSurvey, cycle: string, entityUuid: string, recordOther: ArenaRecord) => (record: ArenaRecord) => ArenaRecordNode | undefined;
|