@openforis/arena-core 2.6.0 → 2.7.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 (67) hide show
  1. package/dist/esm/node/node.js.map +1 -1
  2. package/dist/esm/node/nodes.js +21 -2
  3. package/dist/esm/node/nodes.js.map +1 -1
  4. package/dist/esm/nodeDef/nodeDef.js.map +1 -1
  5. package/dist/esm/nodeDef/nodeDefs.js +9 -0
  6. package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
  7. package/dist/esm/record/_records/recordCompletion.js +4 -1
  8. package/dist/esm/record/_records/recordCompletion.js.map +1 -1
  9. package/dist/esm/record/_records/recordGetters.js +12 -0
  10. package/dist/esm/record/_records/recordGetters.js.map +1 -1
  11. package/dist/esm/record/recordNodesUpdater/index.js +3 -0
  12. package/dist/esm/record/recordNodesUpdater/index.js.map +1 -1
  13. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +87 -0
  14. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -0
  15. package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js +2 -0
  16. package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  17. package/dist/esm/record/recordUpdater.js +1 -0
  18. package/dist/esm/record/recordUpdater.js.map +1 -1
  19. package/dist/esm/record/recordValidator/attributeValidator.js +24 -8
  20. package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
  21. package/dist/esm/record/records.js +2 -1
  22. package/dist/esm/record/records.js.map +1 -1
  23. package/dist/esm/survey/survey.js +1 -0
  24. package/dist/esm/survey/survey.js.map +1 -1
  25. package/dist/esm/survey/surveys/dependencies.js +4 -0
  26. package/dist/esm/survey/surveys/dependencies.js.map +1 -1
  27. package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js +8 -0
  28. package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  29. package/dist/node/node.d.ts +7 -0
  30. package/dist/node/node.js.map +1 -1
  31. package/dist/node/nodes.d.ts +7 -0
  32. package/dist/node/nodes.js +21 -2
  33. package/dist/node/nodes.js.map +1 -1
  34. package/dist/nodeDef/nodeDef.d.ts +4 -0
  35. package/dist/nodeDef/nodeDef.js.map +1 -1
  36. package/dist/nodeDef/nodeDefs.d.ts +9 -0
  37. package/dist/nodeDef/nodeDefs.js +9 -0
  38. package/dist/nodeDef/nodeDefs.js.map +1 -1
  39. package/dist/record/_records/recordCompletion.js +4 -1
  40. package/dist/record/_records/recordCompletion.js.map +1 -1
  41. package/dist/record/_records/recordGetters.d.ts +5 -0
  42. package/dist/record/_records/recordGetters.js +14 -1
  43. package/dist/record/_records/recordGetters.js.map +1 -1
  44. package/dist/record/recordNodesUpdater/index.d.ts +3 -0
  45. package/dist/record/recordNodesUpdater/index.js +3 -0
  46. package/dist/record/recordNodesUpdater/index.js.map +1 -1
  47. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +23 -0
  48. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +93 -0
  49. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -0
  50. package/dist/record/recordNodesUpdater/recordNodesUpdater.js +2 -0
  51. package/dist/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  52. package/dist/record/recordUpdater.js +1 -0
  53. package/dist/record/recordUpdater.js.map +1 -1
  54. package/dist/record/recordValidator/attributeValidator.js +24 -8
  55. package/dist/record/recordValidator/attributeValidator.js.map +1 -1
  56. package/dist/record/records.d.ts +2 -1
  57. package/dist/record/records.js +1 -0
  58. package/dist/record/records.js.map +1 -1
  59. package/dist/survey/survey.d.ts +1 -0
  60. package/dist/survey/survey.js +1 -0
  61. package/dist/survey/survey.js.map +1 -1
  62. package/dist/survey/surveys/dependencies.js +4 -0
  63. package/dist/survey/surveys/dependencies.js.map +1 -1
  64. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +1 -0
  65. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js +8 -0
  66. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  67. package/package.json +1 -1
@@ -70,6 +70,10 @@ export interface NodeDefValidations {
70
70
  count?: NodeDefCountValidations;
71
71
  expressions?: NodeDefExpression[];
72
72
  required?: boolean;
73
+ /**
74
+ * Conditions making a single attribute required (alternative to `required`, which makes it always required).
75
+ */
76
+ requiredIf?: NodeDefExpression[];
73
77
  unique?: boolean;
74
78
  }
75
79
  export interface NodeDefPropsAdvanced {
@@ -1 +1 @@
1
- {"version":3,"file":"nodeDef.js","sourceRoot":"","sources":["../../src/nodeDef/nodeDef.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAKzC,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kBAAkB;IAClB,wCAAyB,CAAA;AAC3B,CAAC,EAfW,WAAW,aAAX,WAAW,GAAX,WAAW,QAetB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAG3B;AAoDY,QAAA,wBAAwB,GAA+D;IAClG,cAAc,EAAE,CAAC,MAAsC,EAAqB,EAAE;QAC5E,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,aAAK,CAAC,EAAE,EAAE,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAO,CAAC,gBAAgB,mBAAM,MAAM,EAAG,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA","sourcesContent":["import { Objects, UUIDs } from '../utils'\nimport { ArenaObject, Factory } from '../common'\nimport { Labels } from '../language'\nimport { ValidationSeverity } from '../validation'\n\nexport enum NodeDefType {\n boolean = 'boolean',\n code = 'code',\n coordinate = 'coordinate',\n date = 'date',\n decimal = 'decimal',\n geo = 'geo',\n entity = 'entity',\n file = 'file',\n integer = 'integer',\n taxon = 'taxon',\n text = 'text',\n time = 'time',\n // layout elements\n formHeader = 'formHeader',\n}\n\nexport enum NodeDefCountType {\n max = 'max',\n min = 'min',\n}\n\nexport interface NodeDefMeta {\n h: string[]\n}\n\nexport interface NodeDefProps {\n cycles?: string[]\n descriptions?: Labels\n key?: boolean\n autoIncrementalKey?: boolean\n labels?: Labels\n multiple?: boolean\n name?: string\n qualifier?: boolean\n readOnly?: boolean\n\n // available only when readOnly is true\n hidden?: boolean\n\n visibleFields?: string[]\n}\n\nexport interface NodeDefLayout {\n hiddenWhenNotRelevant?: boolean\n hiddenInMobile?: boolean\n includedInMultipleEntitySummary?: boolean\n includedInPreviousCycleLink?: boolean\n // code\n codeShown?: boolean\n}\n\nexport interface NodeDefPropsWithLayout<L extends NodeDefLayout> extends NodeDefProps {\n layout?: {\n [cycleKey: string]: L\n }\n}\n\nexport interface NodeDefExpression {\n applyIf?: string\n expression?: string\n messages?: Labels\n severity?: ValidationSeverity\n uuid: string\n}\n\nexport interface NodeDefExpressionFactoryParams {\n applyIf?: string\n expression: string\n severity?: ValidationSeverity\n}\n\nexport const NodeDefExpressionFactory: Factory<NodeDefExpression, NodeDefExpressionFactoryParams> = {\n createInstance: (params: NodeDefExpressionFactoryParams): NodeDefExpression => {\n const result = { uuid: UUIDs.v4() }\n Object.assign(result, Objects.deleteEmptyProps({ ...params }))\n return result\n },\n}\n\nexport type NodeDefCountExpression = string | NodeDefExpression[]\n\nexport interface NodeDefCountValidations {\n max?: NodeDefCountExpression\n min?: NodeDefCountExpression\n}\n\nexport interface NodeDefValidations {\n count?: NodeDefCountValidations\n expressions?: NodeDefExpression[]\n required?: boolean\n unique?: boolean\n}\n\nexport interface NodeDefPropsAdvanced {\n applicable?: NodeDefExpression[]\n defaultValues?: NodeDefExpression[]\n defaultValueEvaluatedOneTime?: boolean\n editableIf?: NodeDefExpression[]\n excludedInClone?: boolean\n formula?: NodeDefExpression[]\n validations?: NodeDefValidations\n visibleIf?: NodeDefExpression[]\n // file attribute\n fileNameExpression?: string\n // enumerate entity\n enumeratingItemsExpression?: string\n // code and taxon attribute\n itemsFilter?: string\n\n // Analysis\n script?: string\n chainUuid?: string\n index?: number\n active?: boolean\n aggregateFunctions?: { [key: string]: object }\n\n isBaseUnit?: boolean\n isSampling?: boolean\n hasAreaBasedEstimated?: boolean\n areaBasedEstimatedOf?: string // uuid of area based estimated node def\n}\n\nexport interface NodeDef<T extends NodeDefType, P extends NodeDefProps = NodeDefProps> extends ArenaObject<P> {\n analysis?: boolean\n dateCreated?: string\n dateModified?: string\n deleted?: boolean\n draft?: boolean\n id?: number\n meta: NodeDefMeta\n parentUuid?: string\n propsAdvanced?: NodeDefPropsAdvanced\n propsAdvancedDraft?: NodeDefPropsAdvanced\n published?: boolean\n temporary?: boolean\n type: T\n virtual?: boolean\n}\n\nexport interface NodeDefMap {\n [key: string]: NodeDef<any>\n}\n"]}
1
+ {"version":3,"file":"nodeDef.js","sourceRoot":"","sources":["../../src/nodeDef/nodeDef.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAKzC,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kBAAkB;IAClB,wCAAyB,CAAA;AAC3B,CAAC,EAfW,WAAW,aAAX,WAAW,GAAX,WAAW,QAetB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAG3B;AAoDY,QAAA,wBAAwB,GAA+D;IAClG,cAAc,EAAE,CAAC,MAAsC,EAAqB,EAAE;QAC5E,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,aAAK,CAAC,EAAE,EAAE,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAO,CAAC,gBAAgB,mBAAM,MAAM,EAAG,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA","sourcesContent":["import { Objects, UUIDs } from '../utils'\nimport { ArenaObject, Factory } from '../common'\nimport { Labels } from '../language'\nimport { ValidationSeverity } from '../validation'\n\nexport enum NodeDefType {\n boolean = 'boolean',\n code = 'code',\n coordinate = 'coordinate',\n date = 'date',\n decimal = 'decimal',\n geo = 'geo',\n entity = 'entity',\n file = 'file',\n integer = 'integer',\n taxon = 'taxon',\n text = 'text',\n time = 'time',\n // layout elements\n formHeader = 'formHeader',\n}\n\nexport enum NodeDefCountType {\n max = 'max',\n min = 'min',\n}\n\nexport interface NodeDefMeta {\n h: string[]\n}\n\nexport interface NodeDefProps {\n cycles?: string[]\n descriptions?: Labels\n key?: boolean\n autoIncrementalKey?: boolean\n labels?: Labels\n multiple?: boolean\n name?: string\n qualifier?: boolean\n readOnly?: boolean\n\n // available only when readOnly is true\n hidden?: boolean\n\n visibleFields?: string[]\n}\n\nexport interface NodeDefLayout {\n hiddenWhenNotRelevant?: boolean\n hiddenInMobile?: boolean\n includedInMultipleEntitySummary?: boolean\n includedInPreviousCycleLink?: boolean\n // code\n codeShown?: boolean\n}\n\nexport interface NodeDefPropsWithLayout<L extends NodeDefLayout> extends NodeDefProps {\n layout?: {\n [cycleKey: string]: L\n }\n}\n\nexport interface NodeDefExpression {\n applyIf?: string\n expression?: string\n messages?: Labels\n severity?: ValidationSeverity\n uuid: string\n}\n\nexport interface NodeDefExpressionFactoryParams {\n applyIf?: string\n expression: string\n severity?: ValidationSeverity\n}\n\nexport const NodeDefExpressionFactory: Factory<NodeDefExpression, NodeDefExpressionFactoryParams> = {\n createInstance: (params: NodeDefExpressionFactoryParams): NodeDefExpression => {\n const result = { uuid: UUIDs.v4() }\n Object.assign(result, Objects.deleteEmptyProps({ ...params }))\n return result\n },\n}\n\nexport type NodeDefCountExpression = string | NodeDefExpression[]\n\nexport interface NodeDefCountValidations {\n max?: NodeDefCountExpression\n min?: NodeDefCountExpression\n}\n\nexport interface NodeDefValidations {\n count?: NodeDefCountValidations\n expressions?: NodeDefExpression[]\n required?: boolean\n /**\n * Conditions making a single attribute required (alternative to `required`, which makes it always required).\n */\n requiredIf?: NodeDefExpression[]\n unique?: boolean\n}\n\nexport interface NodeDefPropsAdvanced {\n applicable?: NodeDefExpression[]\n defaultValues?: NodeDefExpression[]\n defaultValueEvaluatedOneTime?: boolean\n editableIf?: NodeDefExpression[]\n excludedInClone?: boolean\n formula?: NodeDefExpression[]\n validations?: NodeDefValidations\n visibleIf?: NodeDefExpression[]\n // file attribute\n fileNameExpression?: string\n // enumerate entity\n enumeratingItemsExpression?: string\n // code and taxon attribute\n itemsFilter?: string\n\n // Analysis\n script?: string\n chainUuid?: string\n index?: number\n active?: boolean\n aggregateFunctions?: { [key: string]: object }\n\n isBaseUnit?: boolean\n isSampling?: boolean\n hasAreaBasedEstimated?: boolean\n areaBasedEstimatedOf?: string // uuid of area based estimated node def\n}\n\nexport interface NodeDef<T extends NodeDefType, P extends NodeDefProps = NodeDefProps> extends ArenaObject<P> {\n analysis?: boolean\n dateCreated?: string\n dateModified?: string\n deleted?: boolean\n draft?: boolean\n id?: number\n meta: NodeDefMeta\n parentUuid?: string\n propsAdvanced?: NodeDefPropsAdvanced\n propsAdvancedDraft?: NodeDefPropsAdvanced\n published?: boolean\n temporary?: boolean\n type: T\n virtual?: boolean\n}\n\nexport interface NodeDefMap {\n [key: string]: NodeDef<any>\n}\n"]}
@@ -76,6 +76,12 @@ declare const getItemsFilter: (nodeDef: NodeDef<any>) => string | undefined;
76
76
  declare const getValidations: (nodeDef: NodeDef<NodeDefType>) => NodeDefValidations | undefined;
77
77
  declare const getValidationsExpressions: (nodeDef: NodeDef<NodeDefType>) => NodeDefExpression[];
78
78
  declare const isRequired: (nodeDef: NodeDef<NodeDefType>) => boolean;
79
+ declare const getRequiredIf: (nodeDef: NodeDef<NodeDefType>) => NodeDefExpression[];
80
+ declare const isRequiredIfDefined: (nodeDef: NodeDef<NodeDefType>) => boolean;
81
+ /**
82
+ * True if the node def is always required or required when a condition is met (node def level, not record level).
83
+ */
84
+ declare const isRequiredOrConditionallyRequired: (nodeDef: NodeDef<NodeDefType>) => boolean;
79
85
  declare const getCount: (nodeDef: NodeDef<NodeDefType>, countType: NodeDefCountType) => NodeDefCountExpression | undefined;
80
86
  declare const getMinCount: (nodeDef: NodeDef<NodeDefType>) => NodeDefCountExpression | undefined;
81
87
  declare const getMaxCount: (nodeDef: NodeDef<NodeDefType>) => NodeDefCountExpression | undefined;
@@ -178,6 +184,9 @@ export declare const NodeDefs: {
178
184
  getValidations: typeof getValidations;
179
185
  getValidationsExpressions: typeof getValidationsExpressions;
180
186
  isRequired: typeof isRequired;
187
+ getRequiredIf: typeof getRequiredIf;
188
+ isRequiredIfDefined: typeof isRequiredIfDefined;
189
+ isRequiredOrConditionallyRequired: typeof isRequiredOrConditionallyRequired;
181
190
  hasMinOrMaxCount: typeof hasMinOrMaxCount;
182
191
  getCount: typeof getCount;
183
192
  getMaxCount: typeof getMaxCount;
@@ -100,6 +100,12 @@ const getItemsFilter = (nodeDef) => { var _a; return (_a = nodeDef.propsAdvanced
100
100
  const getValidations = (nodeDef) => { var _a; return (_a = nodeDef.propsAdvanced) === null || _a === void 0 ? void 0 : _a.validations; };
101
101
  const getValidationsExpressions = (nodeDef) => { var _a; var _b; return (_b = (_a = getValidations(nodeDef)) === null || _a === void 0 ? void 0 : _a.expressions) !== null && _b !== void 0 ? _b : []; };
102
102
  const isRequired = (nodeDef) => { var _a; var _b; return (_b = (_a = getValidations(nodeDef)) === null || _a === void 0 ? void 0 : _a.required) !== null && _b !== void 0 ? _b : false; };
103
+ const getRequiredIf = (nodeDef) => { var _a; var _b; return (_b = (_a = getValidations(nodeDef)) === null || _a === void 0 ? void 0 : _a.requiredIf) !== null && _b !== void 0 ? _b : []; };
104
+ const isRequiredIfDefined = (nodeDef) => getRequiredIf(nodeDef).length > 0;
105
+ /**
106
+ * True if the node def is always required or required when a condition is met (node def level, not record level).
107
+ */
108
+ const isRequiredOrConditionallyRequired = (nodeDef) => isRequired(nodeDef) || isRequiredIfDefined(nodeDef);
103
109
  // // Min/max count
104
110
  const getCount = (nodeDef, countType) => {
105
111
  var _a;
@@ -214,6 +220,9 @@ exports.NodeDefs = {
214
220
  getValidations,
215
221
  getValidationsExpressions,
216
222
  isRequired,
223
+ getRequiredIf,
224
+ isRequiredIfDefined,
225
+ isRequiredOrConditionallyRequired,
217
226
  // // Min Max
218
227
  hasMinOrMaxCount,
219
228
  getCount,
@@ -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;AAKvB,uCAAuF;AAGvF,MAAM,MAAM,GAAG,CAAC,OAA6B,EAAW,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAA;AAE9E,MAAM,WAAW,GAAG,CAAC,OAA6B,EAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAElF,MAAM,QAAQ,GAAG,CAAC,OAA6B,EAA4B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,MAAM,CAAA;AAE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B;IAC7B,yBAAyB;IACzB,qBAAqB;IACrB,WAAW;IACX,cAAc;IACd,wBAAwB;IACxB,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,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 NodeDef,\n NodeDefCountExpression,\n NodeDefCountType,\n NodeDefExpression,\n NodeDefLayout,\n NodeDefProps,\n NodeDefPropsWithLayout,\n NodeDefType,\n NodeDefValidations,\n} from './nodeDef'\nimport { NodeDefBoolean } from './types/boolean'\nimport { NodeDefCode } from './types/code'\nimport { NodeDefCoordinate } from './types/coordinate'\nimport { NodeDefDate } from './types/date'\nimport { NodeDefDecimal } from './types/decimal'\nimport {\n NodeDefEntity,\n NodeDefEntityLayout,\n NodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n NodeDefPrintOrientation,\n} from './types/entity'\nimport { NodeDefFile, NodeDefFileType } from './types/file'\nimport { NodeDefFormHeader } from './types/formHeader'\nimport { NodeDefInteger } from './types/integer'\nimport { NodeDefTaxon } from './types/taxon'\nimport { NodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { NodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: NodeDef<NodeDefType>): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity => nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefBoolean => nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefDecimal => nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isInteger = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefInteger => nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: NodeDef<NodeDefType>): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): boolean =>\n nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: NodeDef<NodeDefType>): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: NodeDef<NodeDefType, NodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: NodeDef<NodeDefType, NodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: NodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: NodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: NodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: NodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: NodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: NodeDefEntity): NodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: NodeDef<NodeDefType>): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: NodeDef<NodeDefType>): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: NodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: NodeDef<NodeDefType>): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: NodeDef<NodeDefType>): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: NodeDef<NodeDefType>): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: NodeDef<NodeDefType>): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: NodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: NodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: NodeDefCoordinate): boolean => !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: NodeDefCoordinate): 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: NodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: NodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: NodeDefFile): string | undefined => nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: NodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: NodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\n\n// time\nconst isSecondsIncluded = (nodeDef: NodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: NodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: NodeDefTaxon): boolean => !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: NodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: NodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: NodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: NodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: NodeDef<NodeDefType>): NodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: NodeDef<NodeDefType>): boolean => getValidations(nodeDef)?.required ?? false\n\n// // Min/max count\n\nconst getCount = (nodeDef: NodeDef<NodeDefType>, countType: NodeDefCountType): NodeDefCountExpression | 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: NodeDef<NodeDefType>): NodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: NodeDef<NodeDefType>): NodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: NodeDef<NodeDefType>): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDef<any, NodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDef<any, NodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): NodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: NodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: NodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: NodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\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 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 // // 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;AAKvB,uCAAuF;AAGvF,MAAM,MAAM,GAAG,CAAC,OAA6B,EAAW,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAA;AAE9E,MAAM,WAAW,GAAG,CAAC,OAA6B,EAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAElF,MAAM,QAAQ,GAAG,CAAC,OAA6B,EAA4B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,MAAM,CAAA;AAEjH,MAAM,SAAS,GAAG,CAAC,OAA6B,EAA6B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,OAAO,CAAA;AAEpH,MAAM,MAAM,GAAG,CAAC,OAA6B,EAA0B,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,IAAI,CAAA;AAE3G,MAAM,YAAY,GAAG,CAAC,OAA6B,EAAgC,EAAE,CACnF,OAAO,CAAC,IAAI,KAAK,qBAAW,CAAC,UAAU,CAAA;AAEzC,MAAM,MAAM,GAAG,CAAC,OAA6B,EAA0B,EAAE,C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A6B;IAC7B,yBAAyB;IACzB,qBAAqB;IACrB,WAAW;IACX,cAAc;IACd,wBAAwB;IACxB,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 NodeDef,\n NodeDefCountExpression,\n NodeDefCountType,\n NodeDefExpression,\n NodeDefLayout,\n NodeDefProps,\n NodeDefPropsWithLayout,\n NodeDefType,\n NodeDefValidations,\n} from './nodeDef'\nimport { NodeDefBoolean } from './types/boolean'\nimport { NodeDefCode } from './types/code'\nimport { NodeDefCoordinate } from './types/coordinate'\nimport { NodeDefDate } from './types/date'\nimport { NodeDefDecimal } from './types/decimal'\nimport {\n NodeDefEntity,\n NodeDefEntityLayout,\n NodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n NodeDefPrintOrientation,\n} from './types/entity'\nimport { NodeDefFile, NodeDefFileType } from './types/file'\nimport { NodeDefFormHeader } from './types/formHeader'\nimport { NodeDefInteger } from './types/integer'\nimport { NodeDefTaxon } from './types/taxon'\nimport { NodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { NodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: NodeDef<NodeDefType>): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity => nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefBoolean => nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefDecimal => nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isInteger = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefInteger => nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: NodeDef<NodeDefType>): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: NodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): boolean =>\n nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: NodeDef<NodeDefType>): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: NodeDef<NodeDefType>): nodeDef is NodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: NodeDef<NodeDefType, NodeDefProps>): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: NodeDef<NodeDefType, NodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: NodeDef<NodeDefType, NodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: NodeDef<NodeDefType>): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: NodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: NodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: NodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: NodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: NodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: NodeDefEntity): NodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: NodeDef<NodeDefType>): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: NodeDef<NodeDefType>): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: NodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: NodeDef<NodeDefType>): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: NodeDef<NodeDefType>): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: NodeDef<NodeDefType>): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: NodeDef<NodeDefType>): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: NodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: NodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: NodeDefCoordinate): boolean => !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: NodeDefCoordinate): 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: NodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: NodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: NodeDefFile): string | undefined => nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: NodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: NodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\n\n// time\nconst isSecondsIncluded = (nodeDef: NodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: NodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: NodeDefTaxon): boolean => !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: NodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: NodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: NodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: NodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: NodeDef<NodeDefType>): NodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: NodeDef<NodeDefType>): boolean => getValidations(nodeDef)?.required ?? false\n\nconst getRequiredIf = (nodeDef: NodeDef<NodeDefType>): NodeDefExpression[] => getValidations(nodeDef)?.requiredIf ?? []\n\nconst isRequiredIfDefined = (nodeDef: NodeDef<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: NodeDef<NodeDefType>): boolean =>\n isRequired(nodeDef) || isRequiredIfDefined(nodeDef)\n\n// // Min/max count\n\nconst getCount = (nodeDef: NodeDef<NodeDefType>, countType: NodeDefCountType): NodeDefCountExpression | 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: NodeDef<NodeDefType>): NodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: NodeDef<NodeDefType>): NodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: NodeDef<NodeDefType>): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDef<any, NodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDef<any, NodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): NodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as NodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends NodeDefLayout>(nodeDef: NodeDef<any, NodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: NodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: NodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: NodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: NodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\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 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"]}
@@ -11,6 +11,9 @@ const addStats = (statsAcc, statsToAdd) => {
11
11
  statsAcc.total += statsToAdd.total;
12
12
  statsAcc.filled += statsToAdd.filled;
13
13
  };
14
+ const isAttributeRequired = (entity, nodeDef) => nodeDef_1.NodeDefs.isKey(nodeDef) ||
15
+ nodeDef_1.NodeDefs.isRequired(nodeDef) ||
16
+ (nodeDef_1.NodeDefs.isRequiredIfDefined(nodeDef) && node_1.Nodes.isChildRequired(entity, nodeDef.uuid));
14
17
  const getAttributeCompletionStats = (params) => {
15
18
  const { record, entity, nodeDef } = params;
16
19
  if (nodeDef_1.NodeDefs.isMultiple(nodeDef)) {
@@ -20,7 +23,7 @@ const getAttributeCompletionStats = (params) => {
20
23
  const filledNodesCount = (0, recordGetters_1.getChildren)(entity, nodeDef.uuid)(record).filter(node_1.Nodes.isValueNotBlank).length;
21
24
  return { total: minCount, filled: Math.min(filledNodesCount, minCount) };
22
25
  }
23
- if (!nodeDef_1.NodeDefs.isRequired(nodeDef) && !nodeDef_1.NodeDefs.isKey(nodeDef))
26
+ if (!isAttributeRequired(entity, nodeDef))
24
27
  return emptyStats();
25
28
  const node = (0, recordGetters_1.getChildren)(entity, nodeDef.uuid)(record)[0];
26
29
  return { total: 1, filled: node && node_1.Nodes.isValueNotBlank(node) ? 1 : 0 };
@@ -1 +1 @@
1
- {"version":3,"file":"recordCompletion.js","sourceRoot":"","sources":["../../../src/record/_records/recordCompletion.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,2CAA4E;AAC5E,yCAA8C;AAC9C,uCAAqC;AAErC,mDAAsD;AAOtD,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,2BAA2B,GAAG,CAAC,MAIpC,EAAyB,EAAE;IAC1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAE1C,IAAI,kBAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,YAAK,CAAC,mBAAmB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;QAC3E,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC;YAAE,OAAO,UAAU,EAAE,CAAA;QAEhE,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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,MAA+C,EAAU,EAAE;IACpG,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, Nodes } from '../../node'\nimport { NodeDef, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { Survey, Surveys } from '../../survey'\nimport { Numbers } from '../../utils'\nimport { ArenaRecord } from '../record'\nimport { getChildren, 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 getAttributeCompletionStats = (params: {\n record: ArenaRecord\n entity: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n}): EntityCompletionStats => {\n const { record, entity, nodeDef } = params\n\n if (NodeDefs.isMultiple(nodeDef)) {\n const minCount = Nodes.getChildrenMinCount({ parentNode: entity, nodeDef })\n if (Number.isNaN(minCount) || minCount <= 0) return emptyStats()\n\n const filledNodesCount = getChildren(entity, nodeDef.uuid)(record).filter(Nodes.isValueNotBlank).length\n\n return { total: minCount, filled: Math.min(filledNodesCount, minCount) }\n }\n\n if (!NodeDefs.isRequired(nodeDef) && !NodeDefs.isKey(nodeDef)) return emptyStats()\n\n const node = getChildren(entity, nodeDef.uuid)(record)[0]\n return { total: 1, filled: node && Nodes.isValueNotBlank(node) ? 1 : 0 }\n}\n\nconst getChildEntityCompletionStats = (params: {\n survey: Survey\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\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 = Nodes.getChildrenMinCount({ parentNode: parentEntity, nodeDef })\n const minCount = Number.isNaN(minCountRaw) ? 0 : Math.max(minCountRaw, 0)\n // entities added beyond the min count are still expected to be complete\n const expectedCount = Math.max(minCount, childEntities.length)\n if (expectedCount === 0) return emptyStats()\n\n const stats = emptyStats()\n for (let index = 0; index < expectedCount; index++) {\n const childEntity = childEntities[index]\n // a missing repetition (below the min count) counts as a single incomplete unit\n addStats(\n stats,\n childEntity ? getEntityCompletionStats({ survey, record, entity: childEntity }) : { total: 1, filled: 0 }\n )\n }\n return stats\n}\n\nexport const getEntityCompletionStats = (params: {\n survey: Survey\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 })\n\n const stats = emptyStats()\n for (const childDef of childDefs) {\n if (!Nodes.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 Nodes.getChildrenMinCount).\n */\nexport const getEntityCompletionPercent = (params: {\n survey: Survey\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: Survey\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: Survey; 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
+ {"version":3,"file":"recordCompletion.js","sourceRoot":"","sources":["../../../src/record/_records/recordCompletion.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,2CAA4E;AAC5E,yCAA8C;AAC9C,uCAAqC;AAErC,mDAAsD;AAOtD,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,QAA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AAE,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, Nodes } from '../../node'\nimport { NodeDef, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { Survey, Surveys } from '../../survey'\nimport { Numbers } from '../../utils'\nimport { ArenaRecord } from '../record'\nimport { getChildren, 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: NodeDef<NodeDefType, NodeDefProps>): boolean =>\n NodeDefs.isKey(nodeDef) ||\n NodeDefs.isRequired(nodeDef) ||\n (NodeDefs.isRequiredIfDefined(nodeDef) && Nodes.isChildRequired(entity, nodeDef.uuid))\n\nconst getAttributeCompletionStats = (params: {\n record: ArenaRecord\n entity: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n}): EntityCompletionStats => {\n const { record, entity, nodeDef } = params\n\n if (NodeDefs.isMultiple(nodeDef)) {\n const minCount = Nodes.getChildrenMinCount({ parentNode: entity, nodeDef })\n if (Number.isNaN(minCount) || minCount <= 0) return emptyStats()\n\n const filledNodesCount = getChildren(entity, nodeDef.uuid)(record).filter(Nodes.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 && Nodes.isValueNotBlank(node) ? 1 : 0 }\n}\n\nconst getChildEntityCompletionStats = (params: {\n survey: Survey\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\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 = Nodes.getChildrenMinCount({ parentNode: parentEntity, nodeDef })\n const minCount = Number.isNaN(minCountRaw) ? 0 : Math.max(minCountRaw, 0)\n // entities added beyond the min count are still expected to be complete\n const expectedCount = Math.max(minCount, childEntities.length)\n if (expectedCount === 0) return emptyStats()\n\n const stats = emptyStats()\n for (let index = 0; index < expectedCount; index++) {\n const childEntity = childEntities[index]\n // a missing repetition (below the min count) counts as a single incomplete unit\n addStats(\n stats,\n childEntity ? getEntityCompletionStats({ survey, record, entity: childEntity }) : { total: 1, filled: 0 }\n )\n }\n return stats\n}\n\nexport const getEntityCompletionStats = (params: {\n survey: Survey\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 })\n\n const stats = emptyStats()\n for (const childDef of childDefs) {\n if (!Nodes.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 Nodes.getChildrenMinCount).\n */\nexport const getEntityCompletionPercent = (params: {\n survey: Survey\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: Survey\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: Survey; record: ArenaRecord }): number => {\n const { survey, record } = params\n const rootEntity = getRoot(record)\n return rootEntity ? getEntityCompletionPercent({ survey, record, entity: rootEntity }) : 0\n}\n"]}
@@ -27,6 +27,11 @@ export declare const getNodesByDefUuid: (nodeDefUuid: string) => (record: ArenaR
27
27
  export declare const isNodeApplicable: (node: ArenaRecordNode) => (record: ArenaRecord) => boolean;
28
28
  export declare const isNodeEditable: (node: ArenaRecordNode) => (record: ArenaRecord) => boolean;
29
29
  export declare const isNodeVisible: (node: ArenaRecordNode) => (record: ArenaRecord) => boolean;
30
+ /**
31
+ * Whether a value is required for the node: key or always required attribute, or attribute with a "required if"
32
+ * condition met in its parent entity (evaluated condition stored in the parent node meta).
33
+ */
34
+ export declare const isNodeRequired: (nodeDef: NodeDef<NodeDefType>, node: ArenaRecordNode) => (record: ArenaRecord) => boolean;
30
35
  export declare const getDependentCodeAttributes: (node: ArenaRecordNode) => (record: ArenaRecord) => ArenaRecordNode[];
31
36
  export declare const getParentCodeAttribute: (parentNode: ArenaRecordNode, nodeDef: NodeDefCode) => (record: ArenaRecord) => ArenaRecordNode | undefined;
32
37
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInAnalysisStep = exports.getStep = exports.isEmpty = exports.isNodeEmpty = exports.isNodeFilledByUser = exports.getCategoryItemUuid = exports.getAncestorCodePath = exports.getDependentNodePointers = exports.findEntityWithSameKeysInAnotherRecord = exports.findEntityByKeyValues = exports.getNodeIndex = exports.getAttributeSiblings = exports.getEntitySiblings = exports.getEntityKeyValues = exports.getEntityKeyValuesByDefUuid = exports.getEntityKeyNodes = exports.getEntityKeyNodesByDefUuid = exports.findDescendantOrSelf = exports.visitDescendantsAndSelf = exports.isDescendantOf = exports.getDescendant = exports.getDescendantsOrSelf = exports.getAncestorsAndSelf = exports.getAncestor = exports.findAncestor = exports.visitAncestorsAndSelf = exports.getParentCodeAttribute = exports.getDependentCodeAttributes = exports.isNodeVisible = exports.isNodeEditable = exports.isNodeApplicable = exports.getNodesByDefUuid = exports.getParent = exports.getChild = exports.getChildren = exports.getRoot = exports.getNodesByUuids = exports.getNodeByUuid = exports.getNodesArray = exports.getNodes = exports.getCycle = void 0;
3
+ exports.isInAnalysisStep = exports.getStep = exports.isEmpty = exports.isNodeEmpty = exports.isNodeFilledByUser = exports.getCategoryItemUuid = exports.getAncestorCodePath = exports.getDependentNodePointers = exports.findEntityWithSameKeysInAnotherRecord = exports.findEntityByKeyValues = exports.getNodeIndex = exports.getAttributeSiblings = exports.getEntitySiblings = exports.getEntityKeyValues = exports.getEntityKeyValuesByDefUuid = exports.getEntityKeyNodes = exports.getEntityKeyNodesByDefUuid = exports.findDescendantOrSelf = exports.visitDescendantsAndSelf = exports.isDescendantOf = exports.getDescendant = exports.getDescendantsOrSelf = exports.getAncestorsAndSelf = exports.getAncestor = exports.findAncestor = exports.visitAncestorsAndSelf = exports.getParentCodeAttribute = exports.getDependentCodeAttributes = exports.isNodeRequired = exports.isNodeVisible = exports.isNodeEditable = exports.isNodeApplicable = exports.getNodesByDefUuid = exports.getParent = exports.getChild = exports.getChildren = exports.getRoot = exports.getNodesByUuids = exports.getNodeByUuid = exports.getNodesArray = exports.getNodes = exports.getCycle = void 0;
4
4
  const common_1 = require("../../common");
5
5
  const error_1 = require("../../error");
6
6
  const node_1 = require("../../node");
@@ -89,6 +89,19 @@ const isNodeFlagTrue = (isChildFlagTrue) => (node) => (record) => {
89
89
  exports.isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => node_1.Nodes.isChildApplicable(parent, nodeDefUuid));
90
90
  exports.isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => node_1.Nodes.isChildEditable(parent, nodeDefUuid));
91
91
  exports.isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => node_1.Nodes.isChildVisible(parent, nodeDefUuid));
92
+ /**
93
+ * Whether a value is required for the node: key or always required attribute, or attribute with a "required if"
94
+ * condition met in its parent entity (evaluated condition stored in the parent node meta).
95
+ */
96
+ const isNodeRequired = (nodeDef, node) => (record) => {
97
+ if (nodeDef_1.NodeDefs.isKey(nodeDef) || nodeDef_1.NodeDefs.isRequired(nodeDef))
98
+ return true;
99
+ if (!nodeDef_1.NodeDefs.isRequiredIfDefined(nodeDef))
100
+ return false;
101
+ const parent = getParentNode(record, node);
102
+ return !!parent && node_1.Nodes.isChildRequired(parent, nodeDef.uuid);
103
+ };
104
+ exports.isNodeRequired = isNodeRequired;
92
105
  const getDependentCodeAttributes = (node) => (record) => {
93
106
  if (record._nodesIndex) {
94
107
  const nodeUuids = recordNodesIndexReader_1.RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex);
@@ -1 +1 @@
1
- {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AACzD,uCAA0D;AAC1D,qCAA0E;AAC1E,sDAAkD;AAClD,2CAA2G;AAC3G,yCAAoD;AAEpD,uCAA2C;AAC3C,sCAA4D;AAC5D,8CAAsD;AACtD,qEAAiE;AACjE,mEAA+D;AAExD,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAA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AI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,YAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAHlF,QAAA,kBAAkB,GAAlB,kBAAkB,CAGgE;AAExF,MAAM,WAAW,GACtB,CAAC,IAAqB,EAAE,EAAE,CAC1B,CAAC,MAAmB,EAAW,EAAE,CAC/B,CAAC,IAAA,QAAA,kBAAkB,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AAHxB,QAAA,WAAW,GAAX,WAAW,CAGa;AAE9B,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAW,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,CAAA;IAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,QAAA,WAAW,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxD,CAAC,CAAA;AAHY,QAAA,OAAO,GAAP,OAAO,CAGnB;AAEM,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,4BAAmB,GAAA,CAAA;AAA7E,QAAA,OAAO,GAAP,OAAO,CAAsE;AAEnF,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,KAAK,mCAAsB,CAAA;AAA/F,QAAA,gBAAgB,GAAhB,gBAAgB,CAA+E","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\n/**\n * Returns the node with the specified uuid, or undefined if not found.\n * Like the other node getters, it does not throw an error when the node is not found.\n */\nexport const getNodeByUuid =\n (uuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n record.nodes?.[uuid]\n\nexport const getNodesByUuids =\n (uuids: string[]) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[]\n\n/**\n * Returns the root node, or undefined if the record has no nodes.\n */\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid(rootUuid)(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren =\n (parentNode: ArenaRecordNode, childDefUuid?: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids(childrenUuids)(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n }\n\n/**\n * Returns the only child of the parent node with the specified node def, or undefined if not found.\n * Throws an error if more than one child is found.\n */\nexport const getChild =\n (parentNode: ArenaRecordNode, childDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const children = getChildren(parentNode, childDefUuid)(record)\n if (children.length > 1) {\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n throw new SystemError(SystemErrorKeys.record.multipleNodesFound, errorParams)\n }\n return children[0]\n }\n\n// called for every ancestor in the record update loops: keep it a plain lookup\nconst getParentNode = (record: ArenaRecord, node: ArenaRecordNode): ArenaRecordNode | undefined =>\n node.parentUuid ? record.nodes?.[node.parentUuid] : undefined\n\nexport const getParent =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getParentNode(record, node)\n\nexport const getNodesByDefUuid =\n (nodeDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n }\n\nconst isNodeFlagTrue =\n (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n let child = node\n let parent = getParentNode(record, child)\n while (parent) {\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n child = parent\n parent = getParentNode(record, child)\n }\n return true\n }\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\nexport const getDependentCodeAttributes =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n throw new SystemError(SystemErrorKeys.record.nodesIndexNotInitialized)\n }\n\nexport const getParentCodeAttribute =\n (parentNode: ArenaRecordNode, nodeDef: NodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf(parentNode)(record)\n for (const ancestor of ancestors) {\n const children = getChildren(ancestor, parentCodeDefUuid)(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf =\n (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => boolean | void) =>\n (record: ArenaRecord): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParentNode(record, currentNode)\n }\n }\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf(node, (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n })(record)\n return result\n }\n\n/**\n * Returns the specified node, if it has the specified node def, or its ancestor with that node def; undefined if not found.\n */\nexport const getAncestor =\n (node: ArenaRecordNode, ancestorDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let ancestor: ArenaRecordNode | undefined = node\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParentNode(record, ancestor)\n }\n return ancestor\n }\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): Array<ArenaRecordNode> => {\n const ancestors: Array<ArenaRecordNode> = []\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n ancestors.push(currentNode)\n currentNode = getParentNode(record, currentNode)\n }\n return ancestors\n }\n\n// descendants\n\nexport const getDescendantsOrSelf =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(...getChildren(currentAncestor, currentDescendantDefUuid)(record))\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n\n/**\n * Returns the first descendant (or the node itself) with the specified node def, or undefined if not found.\n */\nexport const getDescendant =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getDescendantsOrSelf(node, nodeDefDescendant)(record)[0]\n\nexport const isDescendantOf = (node: ArenaRecordNode, ancestor: ArenaRecordNode): boolean =>\n Nodes.getHierarchy(node).includes(ancestor.uuid)\n\nexport const visitDescendantsAndSelf =\n (\n node: ArenaRecordNode,\n visitor: (node: ArenaRecordNode) => boolean | void,\n traverseMethod: TraverseMethod = TraverseMethod.bfs\n ) =>\n (record: ArenaRecord): void => {\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue<ArenaRecordNode>()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()!\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n\nexport const findDescendantOrSelf =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let found = undefined\n\n visitDescendantsAndSelf(node, (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n })(record)\n return found\n }\n\nconst getClosestAncestorNode =\n (\n node: ArenaRecordNode,\n nodeDef: NodeDef<NodeDefType, NodeDefProps>,\n dependentDef: NodeDef<NodeDefType, NodeDefProps>,\n dependencyType: SurveyDependencyType\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent(node)(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor(node, commonAncestorDefUuid)(record)\n }\n\ntype KeyDefs = NodeDef<NodeDefType, NodeDefProps>[]\n\n/**\n * Returns the key nodes of the entity, indexed by key def uuid; keyDefs, when specified, are used instead of the\n * entity def keys in the cycle.\n */\nexport const getEntityKeyNodesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): NodesMap => {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant(entity, nodeDefKey)(record)\n // missing key nodes are kept as undefined entries\n acc[nodeDefKey.uuid] = nodeKey as ArenaRecordNode\n return acc\n }, {})\n }\n\nexport const getEntityKeyNodes =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntityKeyValuesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): Dictionary<any> => {\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n }\n\nexport const getEntityKeyValues =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntitySiblings =\n (entity: ArenaRecordNode, includeSelf = false) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(entity)(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren(parentEntity, entity.nodeDefUuid)(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n\nexport const getAttributeSiblings =\n (node: ArenaRecordNode, nodeDef: NodeDef<NodeDefType, NodeDefProps>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings(parentEntity)(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren(siblingEntity, nodeDef.uuid)(record))\n return siblingsAcc\n }, [])\n }\n\nexport const getNodeIndex = (node: ArenaRecordNode) => (record: ArenaRecord) => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren(parentEntity, node.nodeDefUuid)(record)\n return siblings.indexOf(node)\n}\n\nexport const findEntityByKeyValues =\n (\n survey: Survey,\n cycle: string,\n parentEntity: ArenaRecordNode,\n entityDefUuid: string,\n keyValuesByDefUuid: Dictionary<any>\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren(parentEntity, entityDefUuid)(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid(\n survey,\n siblingEntity,\n undefined,\n keyDefs\n )(record)\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n\nexport const findEntityWithSameKeysInAnotherRecord =\n (survey: Survey, cycle: string, entityUuid: string, recordOther: ArenaRecord) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf(entity)(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid(survey, ancestor)(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues(\n survey,\n cycle,\n otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid\n )(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n\nexport const getDependentNodePointers =\n (\n survey: Survey,\n node: ArenaRecordNode,\n dependencyType: SurveyDependencyType,\n includeSelf = false,\n filterFn: ((nodePointer: NodePointer) => boolean) | null = null\n ) =>\n (record: ArenaRecord): NodePointer[] => {\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode(node, nodeDef, dependentDef, dependencyType)(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError(SystemErrorKeys.record.dependencyOnRootFound)\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf(commonAncestorNode, nodeDefDependentParent)(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent(node)(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n\nexport const getAncestorCodePath =\n (survey: Survey, parentNode: ArenaRecordNode, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>) =>\n (record: ArenaRecord): string[] => {\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute(parentNode, nodeDef)(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute(parentNode, ancestorCodeDef)(record)\n }\n return codePaths\n }\n\nexport const getCategoryItemUuid =\n (survey: Survey, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>, parentNode: ArenaRecordNode, code: string) =>\n (record: ArenaRecord): string | undefined => {\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath(survey, parentNode, nodeDef)(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n\nexport const isNodeFilledByUser =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !!findDescendantOrSelf(node, (visitedNode) => Nodes.hasUserInputValue(visitedNode))(record)\n\nexport const isNodeEmpty =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !isNodeFilledByUser(node)(record)\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty(rootNode)(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
1
+ {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":";;;AAAA,yCAAyD;AACzD,uCAA0D;AAC1D,qCAA0E;AAC1E,sDAAkD;AAClD,2CAA2G;AAC3G,yCAAoD;AAEpD,uCAA2C;AAC3C,sCAA4D;AAC5D,8CAAsD;AACtD,qEAAiE;AACjE,mEAA+D;AAExD,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,KAAK,mCAAI,qBAAY,GAAA,CAAA;AAAxE,QAAA,QAAQ,GAAR,QAAQ,CAAgE;AAE9E,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAA+B,EAAE,wBAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,GAAA,CAAA;AAAnF,QAAA,QAAQ,GAAR,QAAQ,CAA2E;AAEzF,MAAM,aAAa,GAAG,CAAC,MAAmB,EAAqB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAA,QAAA,QAAQ,EAAC,MAAM,CAAC,CAAC,CAAA;AAA3F,QAAA,aAAa,GAAb,aAAa,CAA8E;AAExG;;;GAGG;AACI,MAAM,aAAa,GACxB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,MAAmB,EAA+B,EAAE,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CAAC,CAAC,IAAA,QAAA,oBAAoB,EAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,YAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAHlF,QAAA,kBAAkB,GAAlB,kBAAkB,CAGgE;AAExF,MAAM,WAAW,GACtB,CAAC,IAAqB,EAAE,EAAE,CAC1B,CAAC,MAAmB,EAAW,EAAE,CAC/B,CAAC,IAAA,QAAA,kBAAkB,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AAHxB,QAAA,WAAW,GAAX,WAAW,CAGa;AAE9B,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAW,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,CAAA;IAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,QAAA,WAAW,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxD,CAAC,CAAA;AAHY,QAAA,OAAO,GAAP,OAAO,CAGnB;AAEM,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,4BAAmB,GAAA,CAAA;AAA7E,QAAA,OAAO,GAAP,OAAO,CAAsE;AAEnF,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,KAAK,mCAAsB,CAAA;AAA/F,QAAA,gBAAgB,GAAhB,gBAAgB,CAA+E","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\n/**\n * Returns the node with the specified uuid, or undefined if not found.\n * Like the other node getters, it does not throw an error when the node is not found.\n */\nexport const getNodeByUuid =\n (uuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n record.nodes?.[uuid]\n\nexport const getNodesByUuids =\n (uuids: string[]) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[]\n\n/**\n * Returns the root node, or undefined if the record has no nodes.\n */\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid(rootUuid)(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren =\n (parentNode: ArenaRecordNode, childDefUuid?: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids(childrenUuids)(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n }\n\n/**\n * Returns the only child of the parent node with the specified node def, or undefined if not found.\n * Throws an error if more than one child is found.\n */\nexport const getChild =\n (parentNode: ArenaRecordNode, childDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const children = getChildren(parentNode, childDefUuid)(record)\n if (children.length > 1) {\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n throw new SystemError(SystemErrorKeys.record.multipleNodesFound, errorParams)\n }\n return children[0]\n }\n\n// called for every ancestor in the record update loops: keep it a plain lookup\nconst getParentNode = (record: ArenaRecord, node: ArenaRecordNode): ArenaRecordNode | undefined =>\n node.parentUuid ? record.nodes?.[node.parentUuid] : undefined\n\nexport const getParent =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getParentNode(record, node)\n\nexport const getNodesByDefUuid =\n (nodeDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n }\n\nconst isNodeFlagTrue =\n (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n let child = node\n let parent = getParentNode(record, child)\n while (parent) {\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n child = parent\n parent = getParentNode(record, child)\n }\n return true\n }\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\n/**\n * Whether a value is required for the node: key or always required attribute, or attribute with a \"required if\"\n * condition met in its parent entity (evaluated condition stored in the parent node meta).\n */\nexport const isNodeRequired =\n (nodeDef: NodeDef<NodeDefType>, node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parent = getParentNode(record, node)\n return !!parent && Nodes.isChildRequired(parent, nodeDef.uuid)\n }\n\nexport const getDependentCodeAttributes =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n throw new SystemError(SystemErrorKeys.record.nodesIndexNotInitialized)\n }\n\nexport const getParentCodeAttribute =\n (parentNode: ArenaRecordNode, nodeDef: NodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf(parentNode)(record)\n for (const ancestor of ancestors) {\n const children = getChildren(ancestor, parentCodeDefUuid)(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf =\n (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => boolean | void) =>\n (record: ArenaRecord): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParentNode(record, currentNode)\n }\n }\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf(node, (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n })(record)\n return result\n }\n\n/**\n * Returns the specified node, if it has the specified node def, or its ancestor with that node def; undefined if not found.\n */\nexport const getAncestor =\n (node: ArenaRecordNode, ancestorDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let ancestor: ArenaRecordNode | undefined = node\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParentNode(record, ancestor)\n }\n return ancestor\n }\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): Array<ArenaRecordNode> => {\n const ancestors: Array<ArenaRecordNode> = []\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n ancestors.push(currentNode)\n currentNode = getParentNode(record, currentNode)\n }\n return ancestors\n }\n\n// descendants\n\nexport const getDescendantsOrSelf =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(...getChildren(currentAncestor, currentDescendantDefUuid)(record))\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n\n/**\n * Returns the first descendant (or the node itself) with the specified node def, or undefined if not found.\n */\nexport const getDescendant =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getDescendantsOrSelf(node, nodeDefDescendant)(record)[0]\n\nexport const isDescendantOf = (node: ArenaRecordNode, ancestor: ArenaRecordNode): boolean =>\n Nodes.getHierarchy(node).includes(ancestor.uuid)\n\nexport const visitDescendantsAndSelf =\n (\n node: ArenaRecordNode,\n visitor: (node: ArenaRecordNode) => boolean | void,\n traverseMethod: TraverseMethod = TraverseMethod.bfs\n ) =>\n (record: ArenaRecord): void => {\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue<ArenaRecordNode>()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()!\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n\nexport const findDescendantOrSelf =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let found = undefined\n\n visitDescendantsAndSelf(node, (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n })(record)\n return found\n }\n\nconst getClosestAncestorNode =\n (\n node: ArenaRecordNode,\n nodeDef: NodeDef<NodeDefType, NodeDefProps>,\n dependentDef: NodeDef<NodeDefType, NodeDefProps>,\n dependencyType: SurveyDependencyType\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent(node)(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor(node, commonAncestorDefUuid)(record)\n }\n\ntype KeyDefs = NodeDef<NodeDefType, NodeDefProps>[]\n\n/**\n * Returns the key nodes of the entity, indexed by key def uuid; keyDefs, when specified, are used instead of the\n * entity def keys in the cycle.\n */\nexport const getEntityKeyNodesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): NodesMap => {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant(entity, nodeDefKey)(record)\n // missing key nodes are kept as undefined entries\n acc[nodeDefKey.uuid] = nodeKey as ArenaRecordNode\n return acc\n }, {})\n }\n\nexport const getEntityKeyNodes =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntityKeyValuesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): Dictionary<any> => {\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n }\n\nexport const getEntityKeyValues =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntitySiblings =\n (entity: ArenaRecordNode, includeSelf = false) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(entity)(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren(parentEntity, entity.nodeDefUuid)(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n\nexport const getAttributeSiblings =\n (node: ArenaRecordNode, nodeDef: NodeDef<NodeDefType, NodeDefProps>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings(parentEntity)(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren(siblingEntity, nodeDef.uuid)(record))\n return siblingsAcc\n }, [])\n }\n\nexport const getNodeIndex = (node: ArenaRecordNode) => (record: ArenaRecord) => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren(parentEntity, node.nodeDefUuid)(record)\n return siblings.indexOf(node)\n}\n\nexport const findEntityByKeyValues =\n (\n survey: Survey,\n cycle: string,\n parentEntity: ArenaRecordNode,\n entityDefUuid: string,\n keyValuesByDefUuid: Dictionary<any>\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren(parentEntity, entityDefUuid)(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid(\n survey,\n siblingEntity,\n undefined,\n keyDefs\n )(record)\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n\nexport const findEntityWithSameKeysInAnotherRecord =\n (survey: Survey, cycle: string, entityUuid: string, recordOther: ArenaRecord) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf(entity)(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid(survey, ancestor)(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues(\n survey,\n cycle,\n otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid\n )(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n\nexport const getDependentNodePointers =\n (\n survey: Survey,\n node: ArenaRecordNode,\n dependencyType: SurveyDependencyType,\n includeSelf = false,\n filterFn: ((nodePointer: NodePointer) => boolean) | null = null\n ) =>\n (record: ArenaRecord): NodePointer[] => {\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode(node, nodeDef, dependentDef, dependencyType)(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError(SystemErrorKeys.record.dependencyOnRootFound)\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf(commonAncestorNode, nodeDefDependentParent)(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent(node)(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n\nexport const getAncestorCodePath =\n (survey: Survey, parentNode: ArenaRecordNode, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>) =>\n (record: ArenaRecord): string[] => {\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute(parentNode, nodeDef)(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute(parentNode, ancestorCodeDef)(record)\n }\n return codePaths\n }\n\nexport const getCategoryItemUuid =\n (survey: Survey, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>, parentNode: ArenaRecordNode, code: string) =>\n (record: ArenaRecord): string | undefined => {\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath(survey, parentNode, nodeDef)(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n\nexport const isNodeFilledByUser =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !!findDescendantOrSelf(node, (visitedNode) => Nodes.hasUserInputValue(visitedNode))(record)\n\nexport const isNodeEmpty =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !isNodeFilledByUser(node)(record)\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty(rootNode)(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
@@ -1,6 +1,7 @@
1
1
  import { addDescendants, addNodeAndDescendants } from './recordNodesCreator';
2
2
  import { updateNodesDependents } from './recordNodesUpdater';
3
3
  import { removeNode, removeNodes } from './recordNodesDeleter';
4
+ import { updateRequiredFlags } from './recordNodeDependentsRequiredUpdater';
4
5
  export { RecordUpdateResult } from './recordUpdateResult';
5
6
  export type { RecordExpressionEvaluationContext } from './recordExpressionEvaluationContext';
6
7
  export type { NodeCreateParams, NodesUpdateParams } from './recordNodesCreator';
@@ -10,6 +11,8 @@ export declare const RecordNodesUpdater: {
10
11
  /** Low-level: adds a node and its descendants to the record without updating dependents and validation (see RecordUpdater.createNodeAndDescendants) */
11
12
  addNodeAndDescendants: typeof addNodeAndDescendants;
12
13
  updateNodesDependents: typeof updateNodesDependents;
14
+ /** Recomputes the "required if" flags of the specified node defs (e.g. after a survey publish); validation is not updated */
15
+ updateRequiredFlags: typeof updateRequiredFlags;
13
16
  /** @deprecated Use addDescendants (or RecordUpdater.createDescendants to update dependents and validation too) */
14
17
  createDescendants: typeof addDescendants;
15
18
  /** @deprecated Use addNodeAndDescendants (or RecordUpdater.createNodeAndDescendants to update dependents and validation too) */
@@ -4,6 +4,7 @@ exports.RecordNodesUpdater = exports.RecordUpdateResult = void 0;
4
4
  const recordNodesCreator_1 = require("./recordNodesCreator");
5
5
  const recordNodesUpdater_1 = require("./recordNodesUpdater");
6
6
  const recordNodesDeleter_1 = require("./recordNodesDeleter");
7
+ const recordNodeDependentsRequiredUpdater_1 = require("./recordNodeDependentsRequiredUpdater");
7
8
  var recordUpdateResult_1 = require("./recordUpdateResult");
8
9
  Object.defineProperty(exports, "RecordUpdateResult", { enumerable: true, get: function () { return recordUpdateResult_1.RecordUpdateResult; } });
9
10
  exports.RecordNodesUpdater = {
@@ -12,6 +13,8 @@ exports.RecordNodesUpdater = {
12
13
  /** Low-level: adds a node and its descendants to the record without updating dependents and validation (see RecordUpdater.createNodeAndDescendants) */
13
14
  addNodeAndDescendants: recordNodesCreator_1.addNodeAndDescendants,
14
15
  updateNodesDependents: recordNodesUpdater_1.updateNodesDependents,
16
+ /** Recomputes the "required if" flags of the specified node defs (e.g. after a survey publish); validation is not updated */
17
+ updateRequiredFlags: recordNodeDependentsRequiredUpdater_1.updateRequiredFlags,
15
18
  /** @deprecated Use addDescendants (or RecordUpdater.createDescendants to update dependents and validation too) */
16
19
  createDescendants: recordNodesCreator_1.addDescendants,
17
20
  /** @deprecated Use addNodeAndDescendants (or RecordUpdater.createNodeAndDescendants to update dependents and validation too) */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record/recordNodesUpdater/index.ts"],"names":[],"mappings":";;;AAAA,6DAA4E;AAC5E,6DAA4D;AAC5D,6DAA8D;AAE9D,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAId,QAAA,kBAAkB,GAAG;IAChC,+IAA+I;IAC/I,cAAc,EAAd,mCAAc;IACd,uJAAuJ;IACvJ,qBAAqB,EAArB,0CAAqB;IACrB,qBAAqB,EAArB,0CAAqB;IACrB,kHAAkH;IAClH,iBAAiB,EAAE,mCAAc;IACjC,gIAAgI;IAChI,wBAAwB,EAAE,0CAAqB;IAC/C,+GAA+G;IAC/G,UAAU,EAAE,+BAAU;IACtB,iHAAiH;IACjH,WAAW,EAAE,gCAAW;CACzB,CAAA","sourcesContent":["import { addDescendants, addNodeAndDescendants } from './recordNodesCreator'\nimport { updateNodesDependents } from './recordNodesUpdater'\nimport { removeNode, removeNodes } from './recordNodesDeleter'\n\nexport { RecordUpdateResult } from './recordUpdateResult'\nexport type { RecordExpressionEvaluationContext } from './recordExpressionEvaluationContext'\nexport type { NodeCreateParams, NodesUpdateParams } from './recordNodesCreator'\n\nexport const RecordNodesUpdater = {\n /** Low-level: adds the descendants of a node to the record without updating dependents and validation (see RecordUpdater.createDescendants) */\n addDescendants,\n /** Low-level: adds a node and its descendants to the record without updating dependents and validation (see RecordUpdater.createNodeAndDescendants) */\n addNodeAndDescendants,\n updateNodesDependents,\n /** @deprecated Use addDescendants (or RecordUpdater.createDescendants to update dependents and validation too) */\n createDescendants: addDescendants,\n /** @deprecated Use addNodeAndDescendants (or RecordUpdater.createNodeAndDescendants to update dependents and validation too) */\n createNodeAndDescendants: addNodeAndDescendants,\n /** @deprecated Use Records.removeNode (or RecordUpdater.deleteNode to update dependents and validation too) */\n deleteNode: removeNode,\n /** @deprecated Use Records.removeNodes (or RecordUpdater.deleteNodes to update dependents and validation too) */\n deleteNodes: removeNodes,\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record/recordNodesUpdater/index.ts"],"names":[],"mappings":";;;AAAA,6DAA4E;AAC5E,6DAA4D;AAC5D,6DAA8D;AAC9D,+FAA2E;AAE3E,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAId,QAAA,kBAAkB,GAAG;IAChC,+IAA+I;IAC/I,cAAc,EAAd,mCAAc;IACd,uJAAuJ;IACvJ,qBAAqB,EAArB,0CAAqB;IACrB,qBAAqB,EAArB,0CAAqB;IACrB,6HAA6H;IAC7H,mBAAmB,EAAnB,yDAAmB;IACnB,kHAAkH;IAClH,iBAAiB,EAAE,mCAAc;IACjC,gIAAgI;IAChI,wBAAwB,EAAE,0CAAqB;IAC/C,+GAA+G;IAC/G,UAAU,EAAE,+BAAU;IACtB,iHAAiH;IACjH,WAAW,EAAE,gCAAW;CACzB,CAAA","sourcesContent":["import { addDescendants, addNodeAndDescendants } from './recordNodesCreator'\nimport { updateNodesDependents } from './recordNodesUpdater'\nimport { removeNode, removeNodes } from './recordNodesDeleter'\nimport { updateRequiredFlags } from './recordNodeDependentsRequiredUpdater'\n\nexport { RecordUpdateResult } from './recordUpdateResult'\nexport type { RecordExpressionEvaluationContext } from './recordExpressionEvaluationContext'\nexport type { NodeCreateParams, NodesUpdateParams } from './recordNodesCreator'\n\nexport const RecordNodesUpdater = {\n /** Low-level: adds the descendants of a node to the record without updating dependents and validation (see RecordUpdater.createDescendants) */\n addDescendants,\n /** Low-level: adds a node and its descendants to the record without updating dependents and validation (see RecordUpdater.createNodeAndDescendants) */\n addNodeAndDescendants,\n updateNodesDependents,\n /** Recomputes the \"required if\" flags of the specified node defs (e.g. after a survey publish); validation is not updated */\n updateRequiredFlags,\n /** @deprecated Use addDescendants (or RecordUpdater.createDescendants to update dependents and validation too) */\n createDescendants: addDescendants,\n /** @deprecated Use addNodeAndDescendants (or RecordUpdater.createNodeAndDescendants to update dependents and validation too) */\n createNodeAndDescendants: addNodeAndDescendants,\n /** @deprecated Use Records.removeNode (or RecordUpdater.deleteNode to update dependents and validation too) */\n deleteNode: removeNode,\n /** @deprecated Use Records.removeNodes (or RecordUpdater.deleteNodes to update dependents and validation too) */\n deleteNodes: removeNodes,\n}\n"]}