@openforis/arena-core 2.14.0 → 2.16.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 (69) hide show
  1. package/dist/dataExport/ArenaExportFile.d.ts +50 -0
  2. package/dist/dataExport/ArenaExportFile.js +48 -0
  3. package/dist/dataExport/ArenaExportFile.js.map +1 -0
  4. package/dist/dataExport/index.d.ts +1 -0
  5. package/dist/dataExport/index.js +3 -1
  6. package/dist/dataExport/index.js.map +1 -1
  7. package/dist/error/systemErrorKeys.d.ts +1 -0
  8. package/dist/error/systemErrorKeys.js +1 -0
  9. package/dist/error/systemErrorKeys.js.map +1 -1
  10. package/dist/esm/dataExport/ArenaExportFile.js +45 -0
  11. package/dist/esm/dataExport/ArenaExportFile.js.map +1 -0
  12. package/dist/esm/dataExport/index.js +1 -0
  13. package/dist/esm/dataExport/index.js.map +1 -1
  14. package/dist/esm/error/systemErrorKeys.js +1 -0
  15. package/dist/esm/error/systemErrorKeys.js.map +1 -1
  16. package/dist/esm/geo/areaOfInterest.js.map +1 -1
  17. package/dist/esm/geo/index.js.map +1 -1
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/nodeDefExpressionEvaluator/areaOfInterestProvider.js +2 -0
  21. package/dist/esm/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -0
  22. package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
  23. package/dist/esm/nodeDefExpressionEvaluator/functions.js +45 -8
  24. package/dist/esm/nodeDefExpressionEvaluator/functions.js.map +1 -1
  25. package/dist/esm/nodeDefExpressionEvaluator/index.js.map +1 -1
  26. package/dist/esm/record/recordExpressionEvaluator/context.js.map +1 -1
  27. package/dist/esm/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
  28. package/dist/esm/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
  29. package/dist/esm/record/recordValidator/attributeValidator.js +2 -1
  30. package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
  31. package/dist/esm/survey/survey.js.map +1 -1
  32. package/dist/esm/survey/surveys/index.js +3 -2
  33. package/dist/esm/survey/surveys/index.js.map +1 -1
  34. package/dist/esm/survey/surveys/surveysGetters.js +3 -2
  35. package/dist/esm/survey/surveys/surveysGetters.js.map +1 -1
  36. package/dist/geo/areaOfInterest.d.ts +14 -1
  37. package/dist/geo/areaOfInterest.js.map +1 -1
  38. package/dist/geo/index.d.ts +1 -1
  39. package/dist/geo/index.js.map +1 -1
  40. package/dist/index.d.ts +3 -3
  41. package/dist/index.js +4 -3
  42. package/dist/index.js.map +1 -1
  43. package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.d.ts +11 -0
  44. package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.js +3 -0
  45. package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -0
  46. package/dist/nodeDefExpressionEvaluator/context.d.ts +2 -0
  47. package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
  48. package/dist/nodeDefExpressionEvaluator/functions.js +44 -7
  49. package/dist/nodeDefExpressionEvaluator/functions.js.map +1 -1
  50. package/dist/nodeDefExpressionEvaluator/index.d.ts +1 -0
  51. package/dist/nodeDefExpressionEvaluator/index.js.map +1 -1
  52. package/dist/record/recordExpressionEvaluator/context.d.ts +2 -0
  53. package/dist/record/recordExpressionEvaluator/context.js.map +1 -1
  54. package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.d.ts +2 -0
  55. package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
  56. package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.d.ts +2 -0
  57. package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
  58. package/dist/record/recordValidator/attributeValidator.d.ts +2 -0
  59. package/dist/record/recordValidator/attributeValidator.js +2 -1
  60. package/dist/record/recordValidator/attributeValidator.js.map +1 -1
  61. package/dist/survey/survey.d.ts +2 -2
  62. package/dist/survey/survey.js.map +1 -1
  63. package/dist/survey/surveys/index.d.ts +3 -2
  64. package/dist/survey/surveys/index.js +2 -1
  65. package/dist/survey/surveys/index.js.map +1 -1
  66. package/dist/survey/surveys/surveysGetters.d.ts +6 -2
  67. package/dist/survey/surveys/surveysGetters.js +6 -4
  68. package/dist/survey/surveys/surveysGetters.js.map +1 -1
  69. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/record/recordExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../../auth'\nimport { ExpressionContext } from '../../expression'\nimport { ArenaRecordNode } from '../../node'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey } from '../../survey'\nimport { ArenaRecord } from '../record'\n\nexport interface RecordExpressionContext extends ExpressionContext {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n nodeContext: ArenaRecordNode\n nodeCurrent?: ArenaRecordNode\n item?: any\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/record/recordExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../../auth'\nimport { ExpressionContext } from '../../expression'\nimport { ArenaRecordNode } from '../../node'\nimport { AreaOfInterestProvider } from '../../nodeDefExpressionEvaluator/areaOfInterestProvider'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey } from '../../survey'\nimport { ArenaRecord } from '../record'\n\nexport interface RecordExpressionContext extends ExpressionContext {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n nodeContext: ArenaRecordNode\n nodeCurrent?: ArenaRecordNode\n item?: any\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n areaOfInterestProvider?: AreaOfInterestProvider\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"recordExpressionEvaluator.js","sourceRoot":"","sources":["../../../../src/record/recordExpressionEvaluator/recordExpressionEvaluator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAGpF,OAAO,EAAqB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAU,OAAO,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAW1D,MAAM,OAAO,yBAA0B,SAAQ,6BAAsD;IACnG;QACE,KAAK,CAAC,yBAAyB,EAAE;YAC/B,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,yBAAyB;YAC1D,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,mBAAmB;SAC/C,CAAC,CAAA;IACJ,CAAC;IAEK,cAAc,CAClB,MAIC;;YAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;YACpD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YAC5E,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC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,IAAI,CAAC,cAAc,iCAAM,MAAM,KAAE,IAAI,EAAE,OAAO,EAAE,KAAK,QAAE,UAAU,CAAC,UAAU,mCAAI,EAAE,IAAG;aACnG,CAAC,IAAA,CAAC,CACJ,CAAA;QACH,CAAC;KAAA;IAEK,wBAAwB,CAC5B,MAGC;;;YAED,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,yBAAyB,iCAAM,MAAM,KAAE,gBAAgB,EAAE,IAAI,IAAG,CAAA;YACxG,aAAO,oBAAoB,CAAC,CAAC,CAAC,mCAAI,IAAI,CAAA;QACxC,CAAC;KAAA;CACF","sourcesContent":["import type { ArenaRecord } from '../record'\nimport { User } from '../../auth'\nimport { CategoryItem } from '../../category'\nimport { ExpressionNodeType, JavascriptExpressionEvaluator } from '../../expression'\nimport { LanguageCode } from '../../language'\nimport { ArenaRecordNode } from '../../node'\nimport { NodeDefExpression, NodeDefs } from '../../nodeDef'\nimport { Survey, Surveys } from '../../survey'\nimport { Taxon } from '../../taxonomy'\nimport { Objects } from '../../utils'\nimport { Records } from '../records'\nimport { RecordExpressionContext } from './context'\nimport { recordExpressionFunctions } from './functions'\nimport { RecordIdentifierEvaluator } from './node/identifier'\nimport { RecordThisEvaluator } from './node/thisEvaluator'\n\ntype ExpressionEvaluateParams = {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n timezoneOffset?: number\n lang?: LanguageCode\n}\n\nexport class RecordExpressionEvaluator extends JavascriptExpressionEvaluator<RecordExpressionContext> {\n constructor() {\n super(recordExpressionFunctions, {\n [ExpressionNodeType.Identifier]: RecordIdentifierEvaluator,\n [ExpressionNodeType.This]: RecordThisEvaluator,\n })\n }\n\n async evalExpression(\n params: ExpressionEvaluateParams & {\n node: ArenaRecordNode\n query: string\n item?: CategoryItem | Taxon\n }\n ): Promise<any> {\n const { survey, record, node, query, item } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n const nodeContext = NodeDefs.isEntity(nodeDef) ? node : Records.getParent(node)(record)\n if (!nodeContext) return null\n const context: RecordExpressionContext = { ...params, nodeContext, nodeCurrent: node, object: nodeContext, item }\n return this.evaluate(query, context)\n }\n\n private async _getApplicableExpressions(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n stopAtFirstFound?: boolean\n }\n ): Promise<NodeDefExpression[]> {\n const { nodeCtx, expressions, stopAtFirstFound = false } = params\n const applicableExpressions: NodeDefExpression[] = []\n\n for (const expression of expressions) {\n const applyIfExpr = expression.applyIf\n\n if (\n Objects.isEmpty(applyIfExpr) ||\n (await this.evalExpression({ ...params, node: nodeCtx, query: applyIfExpr ?? '' }))\n ) {\n applicableExpressions.push(expression)\n\n if (stopAtFirstFound) {\n break\n }\n }\n }\n return applicableExpressions\n }\n\n async evalApplicableExpressions(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n stopAtFirstFound?: boolean\n }\n ): Promise<{ expression: NodeDefExpression; value: any }[]> {\n const { nodeCtx } = params\n const applicableExpressions = await this._getApplicableExpressions(params)\n\n return Promise.all(\n applicableExpressions.map(async (expression) => ({\n expression,\n value: await this.evalExpression({ ...params, node: nodeCtx, query: expression.expression ?? '' }),\n }))\n )\n }\n\n async evalApplicableExpression(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n }\n ): Promise<{ expression: NodeDefExpression; value: any } | null> {\n const expressionsEvaluated = await this.evalApplicableExpressions({ ...params, stopAtFirstFound: true })\n return expressionsEvaluated[0] ?? null\n }\n}\n"]}
1
+ {"version":3,"file":"recordExpressionEvaluator.js","sourceRoot":"","sources":["../../../../src/record/recordExpressionEvaluator/recordExpressionEvaluator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAGpF,OAAO,EAAqB,QAAQ,EAAE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AC,mCAAI,IAAI,CAAA;QACxC,CAAC;KAAA;CACF","sourcesContent":["import type { ArenaRecord } from '../record'\nimport { User } from '../../auth'\nimport { CategoryItem } from '../../category'\nimport { ExpressionNodeType, JavascriptExpressionEvaluator } from '../../expression'\nimport { LanguageCode } from '../../language'\nimport { ArenaRecordNode } from '../../node'\nimport { NodeDefExpression, NodeDefs } from '../../nodeDef'\nimport { Survey, Surveys } from '../../survey'\nimport { Taxon } from '../../taxonomy'\nimport { Objects } from '../../utils'\nimport { Records } from '../records'\nimport { AreaOfInterestProvider } from '../../nodeDefExpressionEvaluator/areaOfInterestProvider'\nimport { RecordExpressionContext } from './context'\nimport { recordExpressionFunctions } from './functions'\nimport { RecordIdentifierEvaluator } from './node/identifier'\nimport { RecordThisEvaluator } from './node/thisEvaluator'\n\ntype ExpressionEvaluateParams = {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n timezoneOffset?: number\n lang?: LanguageCode\n areaOfInterestProvider?: AreaOfInterestProvider\n}\n\nexport class RecordExpressionEvaluator extends JavascriptExpressionEvaluator<RecordExpressionContext> {\n constructor() {\n super(recordExpressionFunctions, {\n [ExpressionNodeType.Identifier]: RecordIdentifierEvaluator,\n [ExpressionNodeType.This]: RecordThisEvaluator,\n })\n }\n\n async evalExpression(\n params: ExpressionEvaluateParams & {\n node: ArenaRecordNode\n query: string\n item?: CategoryItem | Taxon\n }\n ): Promise<any> {\n const { survey, record, node, query, item } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n const nodeContext = NodeDefs.isEntity(nodeDef) ? node : Records.getParent(node)(record)\n if (!nodeContext) return null\n const context: RecordExpressionContext = { ...params, nodeContext, nodeCurrent: node, object: nodeContext, item }\n return this.evaluate(query, context)\n }\n\n private async _getApplicableExpressions(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n stopAtFirstFound?: boolean\n }\n ): Promise<NodeDefExpression[]> {\n const { nodeCtx, expressions, stopAtFirstFound = false } = params\n const applicableExpressions: NodeDefExpression[] = []\n\n for (const expression of expressions) {\n const applyIfExpr = expression.applyIf\n\n if (\n Objects.isEmpty(applyIfExpr) ||\n (await this.evalExpression({ ...params, node: nodeCtx, query: applyIfExpr ?? '' }))\n ) {\n applicableExpressions.push(expression)\n\n if (stopAtFirstFound) {\n break\n }\n }\n }\n return applicableExpressions\n }\n\n async evalApplicableExpressions(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n stopAtFirstFound?: boolean\n }\n ): Promise<{ expression: NodeDefExpression; value: any }[]> {\n const { nodeCtx } = params\n const applicableExpressions = await this._getApplicableExpressions(params)\n\n return Promise.all(\n applicableExpressions.map(async (expression) => ({\n expression,\n value: await this.evalExpression({ ...params, node: nodeCtx, query: expression.expression ?? '' }),\n }))\n )\n }\n\n async evalApplicableExpression(\n params: ExpressionEvaluateParams & {\n nodeCtx: ArenaRecordNode\n expressions: NodeDefExpression[]\n }\n ): Promise<{ expression: NodeDefExpression; value: any } | null> {\n const expressionsEvaluated = await this.evalApplicableExpressions({ ...params, stopAtFirstFound: true })\n return expressionsEvaluated[0] ?? null\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"recordExpressionEvaluationContext.js","sourceRoot":"","sources":["../../../../src/record/recordNodesUpdater/recordExpressionEvaluationContext.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../../auth'\nimport { LanguageCode } from '../../language'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey } from '../../survey'\nimport type { ArenaRecord } from '../record'\n\nexport interface RecordExpressionEvaluationContext {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n timezoneOffset?: number\n lang?: LanguageCode\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n sideEffect?: boolean\n}\n"]}
1
+ {"version":3,"file":"recordExpressionEvaluationContext.js","sourceRoot":"","sources":["../../../../src/record/recordNodesUpdater/recordExpressionEvaluationContext.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../../auth'\nimport { LanguageCode } from '../../language'\nimport { AreaOfInterestProvider } from '../../nodeDefExpressionEvaluator/areaOfInterestProvider'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey } from '../../survey'\nimport type { ArenaRecord } from '../record'\n\nexport interface RecordExpressionEvaluationContext {\n user: User\n survey: Survey\n record: ArenaRecord\n prevCycleRecord?: ArenaRecord\n timezoneOffset?: number\n lang?: LanguageCode\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n areaOfInterestProvider?: AreaOfInterestProvider\n sideEffect?: boolean\n}\n"]}
@@ -95,7 +95,7 @@ const _validateRequired = (params) => (_field, node) => __awaiter(void 0, void 0
95
95
  */
96
96
  const _validateNodeValidations = (params) => (_propName, node) => __awaiter(void 0, void 0, void 0, function* () {
97
97
  var _a;
98
- const { user, survey, record, nodeDef } = params;
98
+ const { user, survey, record, nodeDef, areaOfInterestProvider } = params;
99
99
  if (Nodes.isValueBlank(node))
100
100
  return ValidationResultFactory.createInstance();
101
101
  const validations = NodeDefs.getValidations(nodeDef);
@@ -105,6 +105,7 @@ const _validateNodeValidations = (params) => (_propName, node) => __awaiter(void
105
105
  user,
106
106
  survey,
107
107
  record,
108
+ areaOfInterestProvider,
108
109
  nodeCtx: node,
109
110
  expressions: validations.expressions,
110
111
  stopAtFirstFound: false,
@@ -1 +1 @@
1
- {"version":3,"file":"attributeValidator.js","sourceRoot":"","sources":["../../../../src/record/recordValidator/attributeValidator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;A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KAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,IAAG,CAC5G,CAAA;QAED,IAAI,MAAA,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,0CAAE,MAAM,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,wCAAwC,GAAG,CAC/C,MAAuC,EACZ,EAAE;IAC7B,MAAM,eAAe,GAAsB,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAqB,EAAE,CAAA;IAClD,6EAA6E;IAC7E,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAA;IAE/C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAA;QACpC,iEAAiE;QACjE,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChE,qEAAqE;YACrE,MAAM,wBAAwB,mCAAQ,MAAM,KAAE,SAAS,EAAE,cAAc,EAAE,eAAe,GAAE,CAAA;YAC1F,qBAAqB,CAAC,QAAQ,CAAC,GAAG,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,CAAA,CAAC,UAAU;QAChG,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,wCAAwC;CACzC,CAAA","sourcesContent":["import { User } from '../../auth'\nimport { Dictionary } from '../../common'\nimport { Labels } from '../../language'\nimport { ArenaRecordNode, NodeKeys, Nodes, NodeValues } from '../../node'\nimport { NodeDef, NodeDefExpression, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ValidationFields } from '../../validation/validation'\nimport { NodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\nimport { evaluateRequiredIf } from '../recordNodesUpdater/recordNodeDependentsRequiredUpdater'\nimport { Records } from '../records'\nimport { RecordValidations } from '../recordValidations'\nimport { AttributeKeyValidator, createEntityKeysCache, EntityKeysCache } from './attributeKeyValidator'\nimport { AttributeTypeValidator } from './attributeTypeValidator'\nimport { AttributeUniqueValidator } from './attributeUniqueValidator'\n\nconst expressionEvaluator = new RecordExpressionEvaluator()\n\nexport interface RecordValidatorParams {\n user: User\n survey: Survey\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n record: ArenaRecord\n}\n\nexport interface AttributeValidatorParams extends RecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface AttributesValidatorParams extends RecordValidatorParams {\n nodes: Dictionary<ArenaRecordNode>\n}\n\nexport interface SortedAttributesValidatorParams extends RecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\n\n// sibling key nodes are cached by ancestor multiple entity parent and def uuid during the same validation call:\n// when many entities are added to the same parent entity (e.g. data import), computing them for every updated\n// key attribute would take a time that grows quadratically with the number of entities\ntype SiblingKeyNodesCache = Map<string, SiblingKeyNodeItem[]>\n\nconst _getSiblingNodeKeys = (\n params: AttributeValidatorParams & { siblingKeyNodesCache?: SiblingKeyNodesCache }\n): SiblingKeyNodeItem[] => {\n const { survey, record, attribute, siblingKeyNodesCache } = params\n\n const attributeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const ancestorMultipleEntityDef = Surveys.getNodeDefAncestorMultipleEntity({ survey, nodeDef: attributeDef })\n if (!ancestorMultipleEntityDef) {\n return []\n }\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return []\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return []\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let items = siblingKeyNodesCache?.get(cacheKey)\n if (!items) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n items = []\n for (const entity of entities) {\n const keyNodes = Records.getEntityKeyNodes(survey, entity, undefined, keyDefs)(record)\n for (const keyNode of keyNodes) {\n if (!keyNode) continue\n const nodeValidation =\n record.validation && RecordValidations.getValidationNode({ nodeUuid: keyNode.uuid })(record.validation)\n items.push({ entityUuid: entity.uuid, keyNode, hasErrors: !!nodeValidation && !nodeValidation.valid })\n }\n }\n siblingKeyNodesCache?.set(cacheKey, items)\n }\n return items.filter((item) => item.entityUuid !== ancestorMultipleEntity.uuid)\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: Survey\n expression: NodeDefExpression\n defaultMessage?: string\n}): Labels => {\n const { survey, expression, defaultMessage } = params\n const messages: Labels = { ...expression.messages }\n\n const languages = Surveys.getLanguages(survey)\n const defaultMessageDefined = Objects.isNotEmpty(defaultMessage)\n\n for (const lang of languages) {\n const customMessage = messages[lang]\n if (Objects.isEmpty(customMessage) && defaultMessageDefined) {\n messages[lang] = defaultMessage\n }\n }\n\n return messages\n}\n\nconst _isValueRequired = async (\n params: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }\n): Promise<boolean> => {\n const { record, attribute, nodeDef } = params\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parentNode = Records.getParent(attribute)(record)\n if (!parentNode) return false\n // evaluated here (not read from the parent node meta flag) so validation doesn't depend on up to date node meta\n // (e.g. records created before the \"required if\" condition was defined)\n return evaluateRequiredIf({ ...params, nodeCtx: parentNode, nodeDef })\n}\n\nconst _validateRequired =\n (params: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_field: string, node: any): Promise<ValidationResult> => {\n const valid = !Nodes.isValueBlank(node) || !(await _isValueRequired(params))\n return valid\n ? ValidationResultFactory.createInstance()\n : ValidationResultFactory.createInstance({\n key: 'record.attribute.valueRequired',\n severity: ValidationSeverity.error,\n valid,\n })\n }\n\n/**\n * Evaluates the validation expressions.\n */\nconst _validateNodeValidations =\n (params: { user: User; survey: Survey; record: ArenaRecord; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ValidationResult> => {\n const { user, survey, record, nodeDef } = params\n if (Nodes.isValueBlank(node)) return ValidationResultFactory.createInstance()\n\n const validations = NodeDefs.getValidations(nodeDef)\n if (!validations?.expressions?.length) return ValidationResultFactory.createInstance()\n\n const applicableExpressionsEval = await expressionEvaluator.evalApplicableExpressions({\n user,\n survey,\n record,\n nodeCtx: node,\n expressions: validations.expressions,\n stopAtFirstFound: false,\n })\n\n let validationResult = ValidationResultFactory.createInstance()\n\n for (const { expression, value: valid } of applicableExpressionsEval) {\n if (!valid) {\n const messages = _getValidationMessagesWithDefault({\n survey,\n expression,\n defaultMessage: expression.expression,\n })\n\n validationResult = ValidationResultFactory.createInstance({\n valid: false,\n key: 'record.attribute.customValidation',\n severity: expression.severity,\n messages,\n })\n break\n }\n }\n\n return validationResult\n }\n\nconst validateAttribute = async (params: AttributeValidatorParams & { entityKeysCache?: EntityKeysCache }) => {\n const { survey, record, attribute } = params\n if (Records.isNodeApplicable(attribute)(record)) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const validatorParams = { ...params, nodeDef }\n return new Validator().validate(attribute, {\n [NodeKeys.value]: [\n _validateRequired(validatorParams),\n AttributeTypeValidator.validateValueType(validatorParams),\n _validateNodeValidations(validatorParams),\n AttributeKeyValidator.validateAttributeKey(validatorParams),\n AttributeUniqueValidator.validateAttributeUnique(validatorParams),\n ],\n })\n }\n return ValidationFactory.createInstance()\n}\n\nconst findSiblingKeyNodesToValidate = (\n params: AttributeValidatorParams & {\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache?: SiblingKeyNodesCache\n }\n) => {\n const { survey, nodeDef, nodeParent: parentNode, attribute } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && Nodes.isDefaultValueApplied(attribute))\n ) {\n // when a new node is created and the key is autoincremental, its value will be unique\n // and the validation of sibling key attributes is not necessary\n return []\n }\n // when a key attribute is updated, a sibling key attribute with the same value\n // or a sibling attribute with a validation error (duplicate key) should be re-validated\n const siblingNodeKeys = _getSiblingNodeKeys(params)\n const siblingNodeKeysWithSameValue: ArenaRecordNode[] = []\n const siblingNodeKeysWithErrors: ArenaRecordNode[] = []\n siblingNodeKeys.forEach(({ keyNode, hasErrors }) => {\n if (NodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })) {\n siblingNodeKeysWithSameValue.push(keyNode)\n }\n if (hasErrors) {\n siblingNodeKeysWithErrors.push(keyNode)\n }\n })\n return [...siblingNodeKeysWithSameValue, ...siblingNodeKeysWithErrors]\n}\n\nconst findSortedNodesToValidate = (params: SortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result = []\n const siblingKeyNodesCache: SiblingKeyNodesCache = new Map()\n for (const node of nodesArray) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (!NodeDefs.isAttribute(nodeDef)) {\n continue\n }\n // Get dependents and attribute itself\n const nodePointersAttributeAndDependents = [\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.validations, true)(record),\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.required)(record),\n ]\n\n const nodeParent = Records.getParent(node)(record)\n\n result.push(\n ...NodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents }),\n ...findSiblingKeyNodesToValidate({ ...params, nodeDef, nodeParent, attribute: node, siblingKeyNodesCache })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n result.push(...Records.getAttributeSiblings(node, nodeDef)(record))\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: SortedAttributesValidatorParams\n): Promise<ValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ValidationFields = {}\n // the record doesn't change during the validation: entity keys can be cached\n const entityKeysCache = createEntityKeysCache()\n\n for (const nodeToValidate of nodesToValidate) {\n const nodeUuid = nodeToValidate.uuid\n // Validate only attributes not deleted and not validated already\n if (!nodeToValidate.deleted && !validationsByNodeUuid[nodeUuid]) {\n // sequential: avoid concurrent item/taxon lookups on large node sets\n const attributeValidatorParams = { ...params, attribute: nodeToValidate, entityKeysCache }\n validationsByNodeUuid[nodeUuid] = await validateAttribute(attributeValidatorParams) // NOSONAR\n }\n }\n return validationsByNodeUuid\n}\n\nexport const AttributeValidator = {\n validateSelfAndDependentSortedAttributes,\n}\n"]}
1
+ {"version":3,"file":"attributeValidator.js","sourceRoot":"","sources":["../../../../src/record/recordValidator/attributeValidator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MA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E,CAAC,EACtG,GAAG,6BAA6B,iCAAM,MAAM,KAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,IAAG,CAC5G,CAAA;QAED,IAAI,MAAA,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,0CAAE,MAAM,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,wCAAwC,GAAG,CAC/C,MAAuC,EACZ,EAAE;IAC7B,MAAM,eAAe,GAAsB,yBAAyB,CAAC,MAAM,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAqB,EAAE,CAAA;IAClD,6EAA6E;IAC7E,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAA;IAE/C,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAA;QACpC,iEAAiE;QACjE,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChE,qEAAqE;YACrE,MAAM,wBAAwB,mCAAQ,MAAM,KAAE,SAAS,EAAE,cAAc,EAAE,eAAe,GAAE,CAAA;YAC1F,qBAAqB,CAAC,QAAQ,CAAC,GAAG,MAAM,iBAAiB,CAAC,wBAAwB,CAAC,CAAA,CAAC,UAAU;QAChG,CAAC;IACH,CAAC;IACD,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,wCAAwC;CACzC,CAAA","sourcesContent":["import { User } from '../../auth'\nimport { Dictionary } from '../../common'\nimport { Labels } from '../../language'\nimport { ArenaRecordNode, NodeKeys, Nodes, NodeValues } from '../../node'\nimport { NodeDef, NodeDefExpression, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { AreaOfInterestProvider } from '../../nodeDefExpressionEvaluator/areaOfInterestProvider'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { TaxonProvider } from '../../nodeDefExpressionEvaluator/taxonProvider'\nimport { Survey, Surveys } from '../../survey'\nimport { SurveyDependencyType } from '../../survey/survey'\nimport { Objects } from '../../utils'\nimport {\n ValidationFactory,\n ValidationResult,\n ValidationResultFactory,\n ValidationSeverity,\n Validator,\n} from '../../validation'\nimport { ValidationFields } from '../../validation/validation'\nimport { NodePointers } from '../nodePointers'\nimport { ArenaRecord } from '../record'\nimport { RecordExpressionEvaluator } from '../recordExpressionEvaluator'\nimport { evaluateRequiredIf } from '../recordNodesUpdater/recordNodeDependentsRequiredUpdater'\nimport { Records } from '../records'\nimport { RecordValidations } from '../recordValidations'\nimport { AttributeKeyValidator, createEntityKeysCache, EntityKeysCache } from './attributeKeyValidator'\nimport { AttributeTypeValidator } from './attributeTypeValidator'\nimport { AttributeUniqueValidator } from './attributeUniqueValidator'\n\nconst expressionEvaluator = new RecordExpressionEvaluator()\n\nexport interface RecordValidatorParams {\n user: User\n survey: Survey\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n areaOfInterestProvider?: AreaOfInterestProvider\n record: ArenaRecord\n}\n\nexport interface AttributeValidatorParams extends RecordValidatorParams {\n attribute: ArenaRecordNode\n}\n\nexport interface AttributesValidatorParams extends RecordValidatorParams {\n nodes: Dictionary<ArenaRecordNode>\n}\n\nexport interface SortedAttributesValidatorParams extends RecordValidatorParams {\n nodesArray: ArenaRecordNode[]\n}\n\ntype SiblingKeyNodeItem = { entityUuid: string; keyNode: ArenaRecordNode; hasErrors: boolean }\n\n// sibling key nodes are cached by ancestor multiple entity parent and def uuid during the same validation call:\n// when many entities are added to the same parent entity (e.g. data import), computing them for every updated\n// key attribute would take a time that grows quadratically with the number of entities\ntype SiblingKeyNodesCache = Map<string, SiblingKeyNodeItem[]>\n\nconst _getSiblingNodeKeys = (\n params: AttributeValidatorParams & { siblingKeyNodesCache?: SiblingKeyNodesCache }\n): SiblingKeyNodeItem[] => {\n const { survey, record, attribute, siblingKeyNodesCache } = params\n\n const attributeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const ancestorMultipleEntityDef = Surveys.getNodeDefAncestorMultipleEntity({ survey, nodeDef: attributeDef })\n if (!ancestorMultipleEntityDef) {\n return []\n }\n const ancestorMultipleEntity = Records.getAncestor(attribute, ancestorMultipleEntityDef.uuid)(record)\n if (!ancestorMultipleEntity) return []\n\n const ancestorMultipleEntityParent = Records.getParent(ancestorMultipleEntity)(record)\n if (!ancestorMultipleEntityParent) return []\n\n const cacheKey = `${ancestorMultipleEntityParent.uuid}_${ancestorMultipleEntityDef.uuid}`\n let items = siblingKeyNodesCache?.get(cacheKey)\n if (!items) {\n const keyDefs = Surveys.getNodeDefKeys({ survey, nodeDef: ancestorMultipleEntityDef })\n const entities = Records.getEntitySiblings(ancestorMultipleEntity, true)(record)\n items = []\n for (const entity of entities) {\n const keyNodes = Records.getEntityKeyNodes(survey, entity, undefined, keyDefs)(record)\n for (const keyNode of keyNodes) {\n if (!keyNode) continue\n const nodeValidation =\n record.validation && RecordValidations.getValidationNode({ nodeUuid: keyNode.uuid })(record.validation)\n items.push({ entityUuid: entity.uuid, keyNode, hasErrors: !!nodeValidation && !nodeValidation.valid })\n }\n }\n siblingKeyNodesCache?.set(cacheKey, items)\n }\n return items.filter((item) => item.entityUuid !== ancestorMultipleEntity.uuid)\n}\n\nconst _getValidationMessagesWithDefault = (params: {\n survey: Survey\n expression: NodeDefExpression\n defaultMessage?: string\n}): Labels => {\n const { survey, expression, defaultMessage } = params\n const messages: Labels = { ...expression.messages }\n\n const languages = Surveys.getLanguages(survey)\n const defaultMessageDefined = Objects.isNotEmpty(defaultMessage)\n\n for (const lang of languages) {\n const customMessage = messages[lang]\n if (Objects.isEmpty(customMessage) && defaultMessageDefined) {\n messages[lang] = defaultMessage\n }\n }\n\n return messages\n}\n\nconst _isValueRequired = async (\n params: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }\n): Promise<boolean> => {\n const { record, attribute, nodeDef } = params\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parentNode = Records.getParent(attribute)(record)\n if (!parentNode) return false\n // evaluated here (not read from the parent node meta flag) so validation doesn't depend on up to date node meta\n // (e.g. records created before the \"required if\" condition was defined)\n return evaluateRequiredIf({ ...params, nodeCtx: parentNode, nodeDef })\n}\n\nconst _validateRequired =\n (params: AttributeValidatorParams & { nodeDef: NodeDef<NodeDefType, NodeDefProps> }) =>\n async (_field: string, node: any): Promise<ValidationResult> => {\n const valid = !Nodes.isValueBlank(node) || !(await _isValueRequired(params))\n return valid\n ? ValidationResultFactory.createInstance()\n : ValidationResultFactory.createInstance({\n key: 'record.attribute.valueRequired',\n severity: ValidationSeverity.error,\n valid,\n })\n }\n\n/**\n * Evaluates the validation expressions.\n */\nconst _validateNodeValidations =\n (params: {\n user: User\n survey: Survey\n record: ArenaRecord\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n areaOfInterestProvider?: AreaOfInterestProvider\n }) =>\n async (_propName: string, node: ArenaRecordNode): Promise<ValidationResult> => {\n const { user, survey, record, nodeDef, areaOfInterestProvider } = params\n if (Nodes.isValueBlank(node)) return ValidationResultFactory.createInstance()\n\n const validations = NodeDefs.getValidations(nodeDef)\n if (!validations?.expressions?.length) return ValidationResultFactory.createInstance()\n\n const applicableExpressionsEval = await expressionEvaluator.evalApplicableExpressions({\n user,\n survey,\n record,\n areaOfInterestProvider,\n nodeCtx: node,\n expressions: validations.expressions,\n stopAtFirstFound: false,\n })\n\n let validationResult = ValidationResultFactory.createInstance()\n\n for (const { expression, value: valid } of applicableExpressionsEval) {\n if (!valid) {\n const messages = _getValidationMessagesWithDefault({\n survey,\n expression,\n defaultMessage: expression.expression,\n })\n\n validationResult = ValidationResultFactory.createInstance({\n valid: false,\n key: 'record.attribute.customValidation',\n severity: expression.severity,\n messages,\n })\n break\n }\n }\n\n return validationResult\n }\n\nconst validateAttribute = async (params: AttributeValidatorParams & { entityKeysCache?: EntityKeysCache }) => {\n const { survey, record, attribute } = params\n if (Records.isNodeApplicable(attribute)(record)) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: attribute.nodeDefUuid })\n const validatorParams = { ...params, nodeDef }\n return new Validator().validate(attribute, {\n [NodeKeys.value]: [\n _validateRequired(validatorParams),\n AttributeTypeValidator.validateValueType(validatorParams),\n _validateNodeValidations(validatorParams),\n AttributeKeyValidator.validateAttributeKey(validatorParams),\n AttributeUniqueValidator.validateAttributeUnique(validatorParams),\n ],\n })\n }\n return ValidationFactory.createInstance()\n}\n\nconst findSiblingKeyNodesToValidate = (\n params: AttributeValidatorParams & {\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n nodeParent?: ArenaRecordNode\n siblingKeyNodesCache?: SiblingKeyNodesCache\n }\n) => {\n const { survey, nodeDef, nodeParent: parentNode, attribute } = params\n if (\n !NodeDefs.isKey(nodeDef) ||\n !parentNode ||\n (NodeDefs.isAutoIncrementalKey(nodeDef) && attribute.created && Nodes.isDefaultValueApplied(attribute))\n ) {\n // when a new node is created and the key is autoincremental, its value will be unique\n // and the validation of sibling key attributes is not necessary\n return []\n }\n // when a key attribute is updated, a sibling key attribute with the same value\n // or a sibling attribute with a validation error (duplicate key) should be re-validated\n const siblingNodeKeys = _getSiblingNodeKeys(params)\n const siblingNodeKeysWithSameValue: ArenaRecordNode[] = []\n const siblingNodeKeysWithErrors: ArenaRecordNode[] = []\n siblingNodeKeys.forEach(({ keyNode, hasErrors }) => {\n if (NodeValues.isValueEqual({ survey, nodeDef, parentNode, value: keyNode.value, valueSearch: attribute.value })) {\n siblingNodeKeysWithSameValue.push(keyNode)\n }\n if (hasErrors) {\n siblingNodeKeysWithErrors.push(keyNode)\n }\n })\n return [...siblingNodeKeysWithSameValue, ...siblingNodeKeysWithErrors]\n}\n\nconst findSortedNodesToValidate = (params: SortedAttributesValidatorParams): ArenaRecordNode[] => {\n const { survey, record, nodesArray } = params\n\n const result = []\n const siblingKeyNodesCache: SiblingKeyNodesCache = new Map()\n for (const node of nodesArray) {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (!NodeDefs.isAttribute(nodeDef)) {\n continue\n }\n // Get dependents and attribute itself\n const nodePointersAttributeAndDependents = [\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.validations, true)(record),\n ...Records.getDependentNodePointers(survey, node, SurveyDependencyType.required)(record),\n ]\n\n const nodeParent = Records.getParent(node)(record)\n\n result.push(\n ...NodePointers.getNodesFromNodePointers({ record, nodePointers: nodePointersAttributeAndDependents }),\n ...findSiblingKeyNodesToValidate({ ...params, nodeDef, nodeParent, attribute: node, siblingKeyNodesCache })\n )\n\n if (NodeDefs.getValidations(nodeDef)?.unique) {\n result.push(...Records.getAttributeSiblings(node, nodeDef)(record))\n }\n }\n\n return result\n}\n\nconst validateSelfAndDependentSortedAttributes = async (\n params: SortedAttributesValidatorParams\n): Promise<ValidationFields> => {\n const nodesToValidate: ArenaRecordNode[] = findSortedNodesToValidate(params)\n const validationsByNodeUuid: ValidationFields = {}\n // the record doesn't change during the validation: entity keys can be cached\n const entityKeysCache = createEntityKeysCache()\n\n for (const nodeToValidate of nodesToValidate) {\n const nodeUuid = nodeToValidate.uuid\n // Validate only attributes not deleted and not validated already\n if (!nodeToValidate.deleted && !validationsByNodeUuid[nodeUuid]) {\n // sequential: avoid concurrent item/taxon lookups on large node sets\n const attributeValidatorParams = { ...params, attribute: nodeToValidate, entityKeysCache }\n validationsByNodeUuid[nodeUuid] = await validateAttribute(attributeValidatorParams) // NOSONAR\n }\n }\n return validationsByNodeUuid\n}\n\nexport const AttributeValidator = {\n validateSelfAndDependentSortedAttributes,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"survey.js","sourceRoot":"","sources":["../../../src/survey/survey.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAM/B,MAAM,CAAN,IAAY,oBAcX;AAdD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,uDAA+B,CAAA;IAC/B,6CAAqB,CAAA;IACrB,6DAAqC,CAAA;IACrC,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,iDAAyB,CAAA;IACzB,6CAAqB,CAAA;IACrB,mDAA2B,CAAA;IAC3B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EAdW,oBAAoB,KAApB,oBAAoB,QAc/B;AAWD,MAAM,CAAN,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,mGAA6E,CAAA;IAC7E,qGAA+E,CAAA;IAC/E,yDAAmC,CAAA;IACnC,mFAA6D,CAAA;IAC7D,mFAA6D,CAAA;IAC7D,uGAAiF,CAAA;IACjF,qFAA+D,CAAA;AACjE,CAAC,EARW,kBAAkB,KAAlB,kBAAkB,QAQ7B;AAMD,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,EAAE,IAAI;IAC/D,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,EAAE,IAAI;IAChE,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,IAAI;IAC1C,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,sCAAsC,CAAC,EAAE,IAAI;IACjE,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,EAAE,IAAI;CACzD,CAAA;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ArenaObject, Dictionary } from '../common'\nimport { AuthGroup } from '../auth'\nimport { Labels, LanguageCode } from '../language'\nimport type { AreaOfInterest } from '../geo'\nimport { SRS } from '../srs'\n\nimport { NodeDef, NodeDefType } from '../nodeDef'\nimport { Category } from '../category'\nimport { Taxonomy } from '../taxonomy'\nimport { SurveyRefData } from './refData/refData'\n\nexport const defaultCycle = '0'\n\nexport interface SurveyDependency {\n [nodeDefUuid: string]: string[] | boolean\n}\n\nexport enum SurveyDependencyType {\n applicable = 'applicable',\n defaultValues = 'defaultValues',\n editable = 'editable',\n enumeratingItems = 'enumeratingItems',\n fileName = 'fileName',\n formula = 'formula',\n maxCount = 'maxCount',\n minCount = 'minCount',\n parentCode = 'parentCode',\n required = 'required',\n validations = 'validations',\n visible = 'visible',\n onUpdate = 'onUpdate', // dependencies updated on every record update, stored as dictionary of booleans\n}\n\nexport type SurveyDependencyGraph = {\n [key in SurveyDependencyType]: SurveyDependency\n}\n\nexport interface SurveyCycle {\n dateEnd?: string\n dateStart: string\n}\n\nexport enum SurveySecurityProp {\n dataEditorViewNotOwnedRecordsAllowed = 'dataEditorViewNotOwnedRecordsAllowed',\n dataAnalystViewNotOwnedRecordsAllowed = 'dataAnalystViewNotOwnedRecordsAllowed',\n visibleInMobile = 'visibleInMobile',\n allowRecordsDownloadInMobile = 'allowRecordsDownloadInMobile',\n allowRecordsUploadFromMobile = 'allowRecordsUploadFromMobile',\n allowRecordsWithErrorsUploadFromMobile = 'allowRecordsWithErrorsUploadFromMobile',\n allowRecordsMergeWithSameKeys = 'allowRecordsMergeWithSameKeys',\n}\n\nexport type SurveySecurity = {\n [key in SurveySecurityProp]?: boolean\n}\n\nexport const surveySecurityDefaults: SurveySecurity = {\n [SurveySecurityProp.dataEditorViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.dataAnalystViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.visibleInMobile]: true,\n [SurveySecurityProp.allowRecordsDownloadInMobile]: true,\n [SurveySecurityProp.allowRecordsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsWithErrorsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsMergeWithSameKeys]: true,\n}\n\nexport enum SurveyDocPlace {\n header = 'header',\n footer = 'footer',\n}\n\nexport const surveyDocImagePropKeys = {\n documentPlace: 'documentPlace',\n applyIf: 'applyIf',\n} as const\n\nexport type SurveyDocImageProps = SurveyFileProps & {\n documentPlace?: SurveyDocPlace\n applyIf?: string\n}\n\nexport type SurveyFileProps = {\n deleted?: boolean\n labels?: Labels\n name?: string\n nodeUuid?: string\n recordUuid?: string\n size?: number | null\n temporary?: boolean\n type?: string\n}\n\nexport type SurveyFile = {\n uuid: string\n props: SurveyFileProps\n content?: Buffer | null\n dateCreated: string\n}\n\nexport type SurveyDocImage = SurveyFile & {\n props: SurveyDocImageProps\n}\n\nexport type SurveyDocOptions = {\n headerOnFirstPageOnly?: boolean // default: true\n}\n\nexport interface SurveyProps {\n areaOfInterest?: AreaOfInterest\n collectUri?: string\n cycles: {\n [key: string]: SurveyCycle\n }\n defaultCycleKey?: string\n descriptions?: Labels\n fieldManualLinks?: Labels\n // when true, values of attributes becoming non-applicable are kept during data entry (default: cleared)\n keepNonApplicableValues?: boolean\n labels?: Labels\n languages: LanguageCode[]\n name: string\n preloadedMapLayers?: SurveyFile[]\n preloadedMapLayersEnabled?: boolean\n security?: SurveySecurity\n srs: SRS[]\n surveyDocImages?: SurveyDocImage[]\n surveyDocOptions?: SurveyDocOptions\n}\n\nexport interface SurveyNodeDefsIndex {\n rootDefUuid?: string\n childDefUuidPresenceByParentUuid?: { [parentUuid: string]: { [nodeDefUuid: string]: boolean } }\n nodeDefUuidByName?: Dictionary<string>\n qualifierPresenceByUuid?: { [nodeDefUuid: string]: boolean }\n}\n\nexport interface Survey extends ArenaObject<SurveyProps> {\n authGroups: Array<AuthGroup>\n dateCreated?: string\n dateModified?: string\n datePublished?: string\n dependencyGraph?: SurveyDependencyGraph\n draft: boolean\n nodeDefs?: { [nodeDefUuid: string]: NodeDef<NodeDefType> }\n ownerUuid: string\n published: boolean\n readonly id?: number\n template: boolean\n uuid: string\n /**\n * Categories indexed by uuid.\n */\n categories?: { [categoryUuid: string]: Category }\n /**\n * Taxonomies indexed by uuid.\n */\n taxonomies?: { [taxonomyUuid: string]: Taxonomy }\n /**\n * Reference data cache (category items and taxa).\n */\n refData?: SurveyRefData\n\n nodeDefsIndex?: SurveyNodeDefsIndex\n}\n"]}
1
+ {"version":3,"file":"survey.js","sourceRoot":"","sources":["../../../src/survey/survey.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;AAM/B,MAAM,CAAN,IAAY,oBAcX;AAdD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,uDAA+B,CAAA;IAC/B,6CAAqB,CAAA;IACrB,6DAAqC,CAAA;IACrC,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,iDAAyB,CAAA;IACzB,6CAAqB,CAAA;IACrB,mDAA2B,CAAA;IAC3B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACvB,CAAC,EAdW,oBAAoB,KAApB,oBAAoB,QAc/B;AAWD,MAAM,CAAN,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,mGAA6E,CAAA;IAC7E,qGAA+E,CAAA;IAC/E,yDAAmC,CAAA;IACnC,mFAA6D,CAAA;IAC7D,mFAA6D,CAAA;IAC7D,uGAAiF,CAAA;IACjF,qFAA+D,CAAA;AACjE,CAAC,EARW,kBAAkB,KAAlB,kBAAkB,QAQ7B;AAMD,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,EAAE,IAAI;IAC/D,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,EAAE,IAAI;IAChE,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,IAAI;IAC1C,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,EAAE,IAAI;IACvD,CAAC,kBAAkB,CAAC,sCAAsC,CAAC,EAAE,IAAI;IACjE,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,EAAE,IAAI;CACzD,CAAA;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,SAAS;CACV,CAAA","sourcesContent":["import { ArenaObject, Dictionary } from '../common'\nimport { AuthGroup } from '../auth'\nimport { Labels, LanguageCode } from '../language'\nimport type { AreaOfInterestDescriptor } from '../geo'\nimport { SRS } from '../srs'\n\nimport { NodeDef, NodeDefType } from '../nodeDef'\nimport { Category } from '../category'\nimport { Taxonomy } from '../taxonomy'\nimport { SurveyRefData } from './refData/refData'\n\nexport const defaultCycle = '0'\n\nexport interface SurveyDependency {\n [nodeDefUuid: string]: string[] | boolean\n}\n\nexport enum SurveyDependencyType {\n applicable = 'applicable',\n defaultValues = 'defaultValues',\n editable = 'editable',\n enumeratingItems = 'enumeratingItems',\n fileName = 'fileName',\n formula = 'formula',\n maxCount = 'maxCount',\n minCount = 'minCount',\n parentCode = 'parentCode',\n required = 'required',\n validations = 'validations',\n visible = 'visible',\n onUpdate = 'onUpdate', // dependencies updated on every record update, stored as dictionary of booleans\n}\n\nexport type SurveyDependencyGraph = {\n [key in SurveyDependencyType]: SurveyDependency\n}\n\nexport interface SurveyCycle {\n dateEnd?: string\n dateStart: string\n}\n\nexport enum SurveySecurityProp {\n dataEditorViewNotOwnedRecordsAllowed = 'dataEditorViewNotOwnedRecordsAllowed',\n dataAnalystViewNotOwnedRecordsAllowed = 'dataAnalystViewNotOwnedRecordsAllowed',\n visibleInMobile = 'visibleInMobile',\n allowRecordsDownloadInMobile = 'allowRecordsDownloadInMobile',\n allowRecordsUploadFromMobile = 'allowRecordsUploadFromMobile',\n allowRecordsWithErrorsUploadFromMobile = 'allowRecordsWithErrorsUploadFromMobile',\n allowRecordsMergeWithSameKeys = 'allowRecordsMergeWithSameKeys',\n}\n\nexport type SurveySecurity = {\n [key in SurveySecurityProp]?: boolean\n}\n\nexport const surveySecurityDefaults: SurveySecurity = {\n [SurveySecurityProp.dataEditorViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.dataAnalystViewNotOwnedRecordsAllowed]: true,\n [SurveySecurityProp.visibleInMobile]: true,\n [SurveySecurityProp.allowRecordsDownloadInMobile]: true,\n [SurveySecurityProp.allowRecordsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsWithErrorsUploadFromMobile]: true,\n [SurveySecurityProp.allowRecordsMergeWithSameKeys]: true,\n}\n\nexport enum SurveyDocPlace {\n header = 'header',\n footer = 'footer',\n}\n\nexport const surveyDocImagePropKeys = {\n documentPlace: 'documentPlace',\n applyIf: 'applyIf',\n} as const\n\nexport type SurveyDocImageProps = SurveyFileProps & {\n documentPlace?: SurveyDocPlace\n applyIf?: string\n}\n\nexport type SurveyFileProps = {\n deleted?: boolean\n labels?: Labels\n name?: string\n nodeUuid?: string\n recordUuid?: string\n size?: number | null\n temporary?: boolean\n type?: string\n}\n\nexport type SurveyFile = {\n uuid: string\n props: SurveyFileProps\n content?: Buffer | null\n dateCreated: string\n}\n\nexport type SurveyDocImage = SurveyFile & {\n props: SurveyDocImageProps\n}\n\nexport type SurveyDocOptions = {\n headerOnFirstPageOnly?: boolean // default: true\n}\n\nexport interface SurveyProps {\n areasOfInterest?: AreaOfInterestDescriptor[]\n collectUri?: string\n cycles: {\n [key: string]: SurveyCycle\n }\n defaultCycleKey?: string\n descriptions?: Labels\n fieldManualLinks?: Labels\n // when true, values of attributes becoming non-applicable are kept during data entry (default: cleared)\n keepNonApplicableValues?: boolean\n labels?: Labels\n languages: LanguageCode[]\n name: string\n preloadedMapLayers?: SurveyFile[]\n preloadedMapLayersEnabled?: boolean\n security?: SurveySecurity\n srs: SRS[]\n surveyDocImages?: SurveyDocImage[]\n surveyDocOptions?: SurveyDocOptions\n}\n\nexport interface SurveyNodeDefsIndex {\n rootDefUuid?: string\n childDefUuidPresenceByParentUuid?: { [parentUuid: string]: { [nodeDefUuid: string]: boolean } }\n nodeDefUuidByName?: Dictionary<string>\n qualifierPresenceByUuid?: { [nodeDefUuid: string]: boolean }\n}\n\nexport interface Survey extends ArenaObject<SurveyProps> {\n authGroups: Array<AuthGroup>\n dateCreated?: string\n dateModified?: string\n datePublished?: string\n dependencyGraph?: SurveyDependencyGraph\n draft: boolean\n nodeDefs?: { [nodeDefUuid: string]: NodeDef<NodeDefType> }\n ownerUuid: string\n published: boolean\n readonly id?: number\n template: boolean\n uuid: string\n /**\n * Categories indexed by uuid.\n */\n categories?: { [categoryUuid: string]: Category }\n /**\n * Taxonomies indexed by uuid.\n */\n taxonomies?: { [taxonomyUuid: string]: Taxonomy }\n /**\n * Reference data cache (category items and taxa).\n */\n refData?: SurveyRefData\n\n nodeDefsIndex?: SurveyNodeDefsIndex\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { addNodeDefDependencies, buildAndAssocDependencyGraph, getNodeDefDependents, getOnUpdateDependents, removeNodeDefDependencies, } from './dependencies';
2
2
  import { addNodeDefToIndex, buildAndAssocNodeDefsIndex, deleteNodeDefIndex, findNodeDefByName, findNodeDefByUuid, findNodeDefsByUuids, getDependentCodeAttributeDefs, getDependentEnumeratedEntityDefs, getDescendantsInSingleEntities, getNodeDefsArray, getNodeDefAncestorCodes, getNodeDefAncestorMultipleEntity, getNodeDefByName, getNodeDefByUuid, getNodeDefCategoryLevelIndex, getNodeDefChildren, getNodeDefChildrenSorted, getNodeDefEnumerator, getNodeDefKeys, getNodeDefParent, getNodeDefParentCode, getNodeDefRoot, getNodeDefSource, getNodeDefsByUuids, getNodeDefsIncludedInMultipleEntitySummary, getQualifierDefs, getRootKeys, isNodeDefAncestor, isNodeDefEnumerator, isNodeDefParentCode, updateNodeDefUuidByNameIndex, visitAncestorsAndSelfNodeDef, visitDescendantsAndSelfNodeDef, visitNodeDefs, } from './nodeDefs';
3
3
  import { getCategoryItemByCodePaths, getCategoryItemByUuid, getCategoryItemUuidByCode, getCategoryItems, getCategoryItemsByNodeDef, getCategoryItemsInLevel, getTaxonByCode, getTaxonByUuid, getTaxonVernacularNameUuid, includesTaxonVernacularName, } from './refsData';
4
- import { getCategoryByName, getCategoryByUuid, getCycleKeys, getDefaultCycleKey, getDefaultLanguage, getDescription, getFieldManualLink, getLabel, getLabelOrName, getLanguages, getLastCycleKey, getName, getSRSByCode, getSRSIndex, getAreaOfInterest, getSRSs, getTaxonomyByName, getTaxonomyByUuid, getAuthGroups, getAuthGroupAdmin, isKeepNonApplicableValues, } from './surveysGetters';
4
+ import { getCategoryByName, getCategoryByUuid, getCycleKeys, getDefaultCycleKey, getDefaultLanguage, getDescription, getFieldManualLink, getLabel, getLabelOrName, getLanguages, getLastCycleKey, getName, getSRSByCode, getSRSIndex, getAreasOfInterest, getAreaOfInterestByName, getSRSs, getTaxonomyByName, getTaxonomyByUuid, getAuthGroups, getAuthGroupAdmin, isKeepNonApplicableValues, } from './surveysGetters';
5
5
  import { getSecurity, isDataAnalystViewNotOwnedRecordsAllowed, isDataEditorViewNotOwnedRecordsAllowed, isRecordsDownloadInMobileAllowed, isRecordsMergeWithSameKeysAllowed, isRecordsUploadFromMobileAllowed, isRecordsWithErrorsUploadFromMobileAllowed, isVisibleInMobile, } from './surveyGettersSecurity';
6
6
  import { findApplicableDependentEnumeratedEntityDefs, getEnumeratingCategoryItems } from './surveysUtils';
7
7
  export const Surveys = {
@@ -18,7 +18,8 @@ export const Surveys = {
18
18
  getSRSs,
19
19
  getSRSByCode,
20
20
  getSRSIndex,
21
- getAreaOfInterest,
21
+ getAreasOfInterest,
22
+ getAreaOfInterestByName,
22
23
  getCategoryByName,
23
24
  getCategoryByUuid,
24
25
  getTaxonomyByName,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/survey/surveys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,6BAA6B,EAC7B,gCAAgC,EAChC,8BAA8B,EAC9B,gBAAgB,EAChB,uBAAuB,EACvB,gCAAgC,EAChC,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,0CAA0C,EAC1C,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,EAC9B,aAAa,GACd,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,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Ac;IACd,cAAc;IACd,0BAA0B;IAC1B,2BAA2B;IAE3B,gBAAgB;IAChB,oBAAoB;IACpB,uBAAuB;IACvB,mBAAmB;IACnB,4BAA4B;IAC5B,6BAA6B;IAC7B,gCAAgC;IAEhC,eAAe;IACf,4BAA4B;IAC5B,sBAAsB;IACtB,oBAAoB;IACpB,qBAAqB;IACrB,yBAAyB;IAEzB,QAAQ;IACR,0BAA0B;IAC1B,iBAAiB;IACjB,4BAA4B;IAC5B,kBAAkB;IAElB,WAAW;IACX,WAAW;IACX,uCAAuC;IACvC,sCAAsC;IACtC,iBAAiB;IACjB,gCAAgC;IAChC,gCAAgC;IAChC,0CAA0C;IAC1C,iCAAiC;IAEjC,QAAQ;IACR,2BAA2B;IAC3B,2CAA2C;CAC5C,CAAA","sourcesContent":["import {\n addNodeDefDependencies,\n buildAndAssocDependencyGraph,\n getNodeDefDependents,\n getOnUpdateDependents,\n removeNodeDefDependencies,\n} from './dependencies'\n\nimport {\n addNodeDefToIndex,\n buildAndAssocNodeDefsIndex,\n deleteNodeDefIndex,\n findNodeDefByName,\n findNodeDefByUuid,\n findNodeDefsByUuids,\n getDependentCodeAttributeDefs,\n getDependentEnumeratedEntityDefs,\n getDescendantsInSingleEntities,\n getNodeDefsArray,\n getNodeDefAncestorCodes,\n getNodeDefAncestorMultipleEntity,\n getNodeDefByName,\n getNodeDefByUuid,\n getNodeDefCategoryLevelIndex,\n getNodeDefChildren,\n getNodeDefChildrenSorted,\n getNodeDefEnumerator,\n getNodeDefKeys,\n getNodeDefParent,\n getNodeDefParentCode,\n getNodeDefRoot,\n getNodeDefSource,\n getNodeDefsByUuids,\n getNodeDefsIncludedInMultipleEntitySummary,\n getQualifierDefs,\n getRootKeys,\n isNodeDefAncestor,\n isNodeDefEnumerator,\n isNodeDefParentCode,\n updateNodeDefUuidByNameIndex,\n visitAncestorsAndSelfNodeDef,\n visitDescendantsAndSelfNodeDef,\n visitNodeDefs,\n} from './nodeDefs'\n\nimport {\n getCategoryItemByCodePaths,\n getCategoryItemByUuid,\n getCategoryItemUuidByCode,\n getCategoryItems,\n getCategoryItemsByNodeDef,\n getCategoryItemsInLevel,\n getTaxonByCode,\n getTaxonByUuid,\n getTaxonVernacularNameUuid,\n includesTaxonVernacularName,\n} from './refsData'\n\nimport {\n getCategoryByName,\n getCategoryByUuid,\n getCycleKeys,\n getDefaultCycleKey,\n getDefaultLanguage,\n getDescription,\n getFieldManualLink,\n getLabel,\n getLabelOrName,\n getLanguages,\n getLastCycleKey,\n getName,\n getSRSByCode,\n getSRSIndex,\n getAreaOfInterest,\n getSRSs,\n getTaxonomyByName,\n getTaxonomyByUuid,\n getAuthGroups,\n getAuthGroupAdmin,\n isKeepNonApplicableValues,\n} from './surveysGetters'\n\nimport {\n getSecurity,\n isDataAnalystViewNotOwnedRecordsAllowed,\n isDataEditorViewNotOwnedRecordsAllowed,\n isRecordsDownloadInMobileAllowed,\n isRecordsMergeWithSameKeysAllowed,\n isRecordsUploadFromMobileAllowed,\n isRecordsWithErrorsUploadFromMobileAllowed,\n isVisibleInMobile,\n} from './surveyGettersSecurity'\n\nimport { findApplicableDependentEnumeratedEntityDefs, getEnumeratingCategoryItems } from './surveysUtils'\n\nexport const Surveys = {\n getName,\n getLanguages,\n getDefaultLanguage,\n getLabel,\n getLabelOrName,\n getDescription,\n getFieldManualLink,\n getCycleKeys,\n getLastCycleKey,\n getDefaultCycleKey,\n getSRSs,\n getSRSByCode,\n getSRSIndex,\n getAreaOfInterest,\n getCategoryByName,\n getCategoryByUuid,\n getTaxonomyByName,\n getTaxonomyByUuid,\n getAuthGroups,\n getAuthGroupAdmin,\n isKeepNonApplicableValues,\n\n findNodeDefByName,\n findNodeDefByUuid,\n findNodeDefsByUuids,\n getNodeDefsArray,\n getNodeDefByName,\n getNodeDefsByUuids,\n getNodeDefByUuid,\n getNodeDefChildren,\n getNodeDefChildrenSorted,\n getNodeDefParent,\n getNodeDefAncestorMultipleEntity,\n getNodeDefRoot,\n getNodeDefSource,\n isNodeDefAncestor,\n getNodeDefKeys,\n getRootKeys,\n getNodeDefsIncludedInMultipleEntitySummary,\n getQualifierDefs,\n isNodeDefEnumerator,\n getNodeDefEnumerator,\n visitAncestorsAndSelfNodeDef,\n visitDescendantsAndSelfNodeDef,\n visitNodeDefs,\n getDescendantsInSingleEntities,\n\n // ref data\n getCategoryItemByCodePaths,\n getCategoryItemByUuid,\n getCategoryItemUuidByCode,\n getCategoryItems,\n getCategoryItemsByNodeDef,\n getCategoryItemsInLevel,\n getTaxonByCode,\n getTaxonByUuid,\n getTaxonVernacularNameUuid,\n includesTaxonVernacularName,\n\n // node def code\n getNodeDefParentCode,\n getNodeDefAncestorCodes,\n isNodeDefParentCode,\n getNodeDefCategoryLevelIndex,\n getDependentCodeAttributeDefs,\n getDependentEnumeratedEntityDefs,\n\n // dependencies\n buildAndAssocDependencyGraph,\n addNodeDefDependencies,\n getNodeDefDependents,\n getOnUpdateDependents,\n removeNodeDefDependencies,\n\n // index\n buildAndAssocNodeDefsIndex,\n addNodeDefToIndex,\n updateNodeDefUuidByNameIndex,\n deleteNodeDefIndex,\n\n // security\n getSecurity,\n isDataAnalystViewNotOwnedRecordsAllowed,\n isDataEditorViewNotOwnedRecordsAllowed,\n isVisibleInMobile,\n isRecordsDownloadInMobileAllowed,\n isRecordsUploadFromMobileAllowed,\n isRecordsWithErrorsUploadFromMobileAllowed,\n isRecordsMergeWithSameKeysAllowed,\n\n // utils\n getEnumeratingCategoryItems,\n findApplicableDependentEnumeratedEntityDefs,\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/survey/surveys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB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ACR,cAAc;IACd,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,eAAe;IACf,kBAAkB;IAClB,OAAO;IACP,YAAY;IACZ,WAAW;IACX,kBAAkB;IAClB,uBAAuB;IACvB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,yBAAyB;IAEzB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,gBAAgB;IAChB,gCAAgC;IAChC,cAAc;IACd,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,WAAW;IACX,0CAA0C;IAC1C,gBAAgB;IAChB,mBAAmB;IACnB,oBAAoB;IACpB,4BAA4B;IAC5B,8BAA8B;IAC9B,aAAa;IACb,8BAA8B;IAE9B,WAAW;IACX,0BAA0B;IAC1B,qBAAqB;IACrB,yBAAyB;IACzB,gBAAgB;IAChB,yBAAyB;IACzB,uBAAuB;IACvB,cAAc;IACd,cAAc;IACd,0BAA0B;IAC1B,2BAA2B;IAE3B,gBAAgB;IAChB,oBAAoB;IACpB,uBAAuB;IACvB,mBAAmB;IACnB,4BAA4B;IAC5B,6BAA6B;IAC7B,gCAAgC;IAEhC,eAAe;IACf,4BAA4B;IAC5B,sBAAsB;IACtB,oBAAoB;IACpB,qBAAqB;IACrB,yBAAyB;IAEzB,QAAQ;IACR,0BAA0B;IAC1B,iBAAiB;IACjB,4BAA4B;IAC5B,kBAAkB;IAElB,WAAW;IACX,WAAW;IACX,uCAAuC;IACvC,sCAAsC;IACtC,iBAAiB;IACjB,gCAAgC;IAChC,gCAAgC;IAChC,0CAA0C;IAC1C,iCAAiC;IAEjC,QAAQ;IACR,2BAA2B;IAC3B,2CAA2C;CAC5C,CAAA","sourcesContent":["import {\n addNodeDefDependencies,\n buildAndAssocDependencyGraph,\n getNodeDefDependents,\n getOnUpdateDependents,\n removeNodeDefDependencies,\n} from './dependencies'\n\nimport {\n addNodeDefToIndex,\n buildAndAssocNodeDefsIndex,\n deleteNodeDefIndex,\n findNodeDefByName,\n findNodeDefByUuid,\n findNodeDefsByUuids,\n getDependentCodeAttributeDefs,\n getDependentEnumeratedEntityDefs,\n getDescendantsInSingleEntities,\n getNodeDefsArray,\n getNodeDefAncestorCodes,\n getNodeDefAncestorMultipleEntity,\n getNodeDefByName,\n getNodeDefByUuid,\n getNodeDefCategoryLevelIndex,\n getNodeDefChildren,\n getNodeDefChildrenSorted,\n getNodeDefEnumerator,\n getNodeDefKeys,\n getNodeDefParent,\n getNodeDefParentCode,\n getNodeDefRoot,\n getNodeDefSource,\n getNodeDefsByUuids,\n getNodeDefsIncludedInMultipleEntitySummary,\n getQualifierDefs,\n getRootKeys,\n isNodeDefAncestor,\n isNodeDefEnumerator,\n isNodeDefParentCode,\n updateNodeDefUuidByNameIndex,\n visitAncestorsAndSelfNodeDef,\n visitDescendantsAndSelfNodeDef,\n visitNodeDefs,\n} from './nodeDefs'\n\nimport {\n getCategoryItemByCodePaths,\n getCategoryItemByUuid,\n getCategoryItemUuidByCode,\n getCategoryItems,\n getCategoryItemsByNodeDef,\n getCategoryItemsInLevel,\n getTaxonByCode,\n getTaxonByUuid,\n getTaxonVernacularNameUuid,\n includesTaxonVernacularName,\n} from './refsData'\n\nimport {\n getCategoryByName,\n getCategoryByUuid,\n getCycleKeys,\n getDefaultCycleKey,\n getDefaultLanguage,\n getDescription,\n getFieldManualLink,\n getLabel,\n getLabelOrName,\n getLanguages,\n getLastCycleKey,\n getName,\n getSRSByCode,\n getSRSIndex,\n getAreasOfInterest,\n getAreaOfInterestByName,\n getSRSs,\n getTaxonomyByName,\n getTaxonomyByUuid,\n getAuthGroups,\n getAuthGroupAdmin,\n isKeepNonApplicableValues,\n} from './surveysGetters'\n\nimport {\n getSecurity,\n isDataAnalystViewNotOwnedRecordsAllowed,\n isDataEditorViewNotOwnedRecordsAllowed,\n isRecordsDownloadInMobileAllowed,\n isRecordsMergeWithSameKeysAllowed,\n isRecordsUploadFromMobileAllowed,\n isRecordsWithErrorsUploadFromMobileAllowed,\n isVisibleInMobile,\n} from './surveyGettersSecurity'\n\nimport { findApplicableDependentEnumeratedEntityDefs, getEnumeratingCategoryItems } from './surveysUtils'\n\nexport const Surveys = {\n getName,\n getLanguages,\n getDefaultLanguage,\n getLabel,\n getLabelOrName,\n getDescription,\n getFieldManualLink,\n getCycleKeys,\n getLastCycleKey,\n getDefaultCycleKey,\n getSRSs,\n getSRSByCode,\n getSRSIndex,\n getAreasOfInterest,\n getAreaOfInterestByName,\n getCategoryByName,\n getCategoryByUuid,\n getTaxonomyByName,\n getTaxonomyByUuid,\n getAuthGroups,\n getAuthGroupAdmin,\n isKeepNonApplicableValues,\n\n findNodeDefByName,\n findNodeDefByUuid,\n findNodeDefsByUuids,\n getNodeDefsArray,\n getNodeDefByName,\n getNodeDefsByUuids,\n getNodeDefByUuid,\n getNodeDefChildren,\n getNodeDefChildrenSorted,\n getNodeDefParent,\n getNodeDefAncestorMultipleEntity,\n getNodeDefRoot,\n getNodeDefSource,\n isNodeDefAncestor,\n getNodeDefKeys,\n getRootKeys,\n getNodeDefsIncludedInMultipleEntitySummary,\n getQualifierDefs,\n isNodeDefEnumerator,\n getNodeDefEnumerator,\n visitAncestorsAndSelfNodeDef,\n visitDescendantsAndSelfNodeDef,\n visitNodeDefs,\n getDescendantsInSingleEntities,\n\n // ref data\n getCategoryItemByCodePaths,\n getCategoryItemByUuid,\n getCategoryItemUuidByCode,\n getCategoryItems,\n getCategoryItemsByNodeDef,\n getCategoryItemsInLevel,\n getTaxonByCode,\n getTaxonByUuid,\n getTaxonVernacularNameUuid,\n includesTaxonVernacularName,\n\n // node def code\n getNodeDefParentCode,\n getNodeDefAncestorCodes,\n isNodeDefParentCode,\n getNodeDefCategoryLevelIndex,\n getDependentCodeAttributeDefs,\n getDependentEnumeratedEntityDefs,\n\n // dependencies\n buildAndAssocDependencyGraph,\n addNodeDefDependencies,\n getNodeDefDependents,\n getOnUpdateDependents,\n removeNodeDefDependencies,\n\n // index\n buildAndAssocNodeDefsIndex,\n addNodeDefToIndex,\n updateNodeDefUuidByNameIndex,\n deleteNodeDefIndex,\n\n // security\n getSecurity,\n isDataAnalystViewNotOwnedRecordsAllowed,\n isDataEditorViewNotOwnedRecordsAllowed,\n isVisibleInMobile,\n isRecordsDownloadInMobileAllowed,\n isRecordsUploadFromMobileAllowed,\n isRecordsWithErrorsUploadFromMobileAllowed,\n isRecordsMergeWithSameKeysAllowed,\n\n // utils\n getEnumeratingCategoryItems,\n findApplicableDependentEnumeratedEntityDefs,\n}\n"]}
@@ -63,9 +63,10 @@ export const getSRSIndex = (survey) => getSRSs(survey).reduce((acc, srs) => {
63
63
  return acc;
64
64
  }, {});
65
65
  export const getSRSByCode = (code) => (survey) => getSRSIndex(survey)[code];
66
- export const getAreaOfInterest = (survey) => { var _a, _b, _c; var _d, _e; return (_e = (_d = (_a = survey === null || survey === void 0 ? void 0 : survey.props) === null || _a === void 0 ? void 0 : _a.areaOfInterest) !== null && _d !== void 0 ? _d :
66
+ export const getAreasOfInterest = (survey) => { var _a, _b, _c; var _d, _e; return (_e = (_d = (_a = survey === null || survey === void 0 ? void 0 : survey.props) === null || _a === void 0 ? void 0 : _a.areasOfInterest) !== null && _d !== void 0 ? _d :
67
67
  // backwards compatibility with Arena: survey info props stored in info
68
- (_c = (_b = survey === null || survey === void 0 ? void 0 : survey.info) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.areaOfInterest) !== null && _e !== void 0 ? _e : undefined; };
68
+ (_c = (_b = survey === null || survey === void 0 ? void 0 : survey.info) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.areasOfInterest) !== null && _e !== void 0 ? _e : []; };
69
+ export const getAreaOfInterestByName = (params) => getAreasOfInterest(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name);
69
70
  export const getAuthGroups = (survey) => { var _a; return (_a = survey === null || survey === void 0 ? void 0 : survey.authGroups) !== null && _a !== void 0 ? _a : []; };
70
71
  export const getAuthGroupAdmin = (survey) => getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin);
71
72
  //# sourceMappingURL=surveysGetters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG7C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAA;AAEpE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAkB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAA;AAEtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAgB,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAE3F,MAAM,qBAAqB,GACzB,CAAC,IAAoD,EAAE,EAAE,CACzD,CAAC,QAAuB,EAAE,EAAE,CAC5B,CAAC,MAAc,EAAsB,EAAE;;IACrC,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC3D,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,0CAAG,YAAY,CAAC,CAAA;AAC3C,CAAC,CAAA;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC,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AK,0CAAE,GAAG;AACjB,+DAA+D;AAC/D,MAAA,MAAC,MAAc,CAAC,IAAI,0CAAE,KAAK,0CAAE,GAAG,mCAChC,EAAE,GAAA,CAAA;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAY,EAAE,CACtD,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,GAAG,EAAE,EAAE;IAC5C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACnB,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AAER,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,MAAc,EAAmB,EAAE,CAClC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAA8B,EAAE,kDAC9E,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,cAAc;AAC7B,uEAAuE;AACvE,MAAA,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,IAAI,0CAAE,KAAK,0CAAE,cAAc,mCAC5C,SAAS,GAAA,CAAA;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAmB,EAAE,wBAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAA6B,EAAE,CAC7E,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import { AuthGroupName, UserAuthGroup } from '../../auth'\nimport { Category } from '../../category'\nimport type { AreaOfInterest } from '../../geo'\nimport { LanguageCode } from '../../language'\nimport { getLabelOrDefault } from '../../language/labels'\nimport { SRS, SRSIndex } from '../../srs'\nimport { Taxonomy } from '../../taxonomy'\nimport { Arrays, Objects } from '../../utils'\nimport { Survey } from '../survey'\n\nexport const getName = (survey: Survey): string => survey.props.name\n\nexport const getLanguages = (survey: Survey): LanguageCode[] => survey.props.languages\n\nexport const getDefaultLanguage = (survey: Survey): LanguageCode => getLanguages(survey)[0]\n\nconst getMultilangPropValue =\n (prop: 'labels' | 'descriptions' | 'fieldManualLinks') =>\n (langCode?: LanguageCode) =>\n (survey: Survey): string | undefined => {\n const languageCode = langCode ?? getDefaultLanguage(survey)\n return survey.props[prop]?.[languageCode]\n }\nexport const getLabel = getMultilangPropValue('labels')\nexport const getDescription = getMultilangPropValue('descriptions')\nexport const getFieldManualLink = getMultilangPropValue('fieldManualLinks')\n\n/**\n * Returns the survey label in the specified language (the default language if not specified), or the survey name\n * when the label is missing or empty.\n */\nexport const getLabelOrName =\n (langCode?: LanguageCode) =>\n (survey: Survey): string =>\n getLabelOrDefault(survey.props.labels, langCode ?? getDefaultLanguage(survey), getName(survey))\n\nexport const getCategoryByName = (params: { survey: Survey; categoryName: string }): Category | undefined => {\n const { survey, categoryName } = params\n return survey.categories\n ? Object.values(survey.categories).find((category) => category.props.name === categoryName)\n : undefined\n}\n\nexport const getCategoryByUuid = (params: { survey: Survey; categoryUuid: string }): Category | undefined => {\n const { survey, categoryUuid } = params\n return survey.categories?.[categoryUuid]\n}\n\nexport const getTaxonomyByName = (params: { survey: Survey; taxonomyName: string }): Taxonomy | undefined => {\n const { survey, taxonomyName } = params\n return survey.taxonomies\n ? Object.values(survey.taxonomies).find((taxonomy) => taxonomy.props.name === taxonomyName)\n : undefined\n}\n\nexport const getTaxonomyByUuid = (params: { survey: Survey; taxonomyUuid: string }): Taxonomy | undefined => {\n const { survey, taxonomyUuid } = params\n return survey.taxonomies?.[taxonomyUuid]\n}\n\nexport const getCycleKeys = (survey: Survey): string[] => {\n const cycles = survey.props?.cycles ?? {}\n return Object.keys(cycles)\n}\n\nexport const getLastCycleKey = (survey: Survey): string => Arrays.last(getCycleKeys(survey)) as string\n\nexport const isKeepNonApplicableValues = (survey: Survey): boolean => survey?.props?.keepNonApplicableValues === true\n\nexport const getDefaultCycleKey = (survey: Survey) => {\n const defaultCycleKey = survey.props?.defaultCycleKey\n const lastCycleKey = getLastCycleKey(survey)\n return Objects.isEmpty(defaultCycleKey) || Number(defaultCycleKey) > Number(lastCycleKey)\n ? lastCycleKey\n : defaultCycleKey\n}\n\nexport const getSRSs = (survey: Survey): SRS[] =>\n survey.props?.srs ??\n // backwards compatibility with Arena: srs stored in info in UI\n (survey as any).info?.props?.srs ??\n []\n\nexport const getSRSIndex = (survey: Survey): SRSIndex =>\n getSRSs(survey).reduce((acc: SRSIndex, srs) => {\n acc[srs.code] = srs\n return acc\n }, {})\n\nexport const getSRSByCode =\n (code: string) =>\n (survey: Survey): SRS | undefined =>\n getSRSIndex(survey)[code]\n\nexport const getAreaOfInterest = (survey: Survey): AreaOfInterest | undefined =>\n survey?.props?.areaOfInterest ??\n // backwards compatibility with Arena: survey info props stored in info\n (survey as any)?.info?.props?.areaOfInterest ??\n undefined\n\nexport const getAuthGroups = (survey: Survey): UserAuthGroup[] => survey?.authGroups ?? []\n\nexport const getAuthGroupAdmin = (survey: Survey): UserAuthGroup | undefined =>\n getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin)\n"]}
1
+ {"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG7C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,K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MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAA8B,EAAE,kDAC/E,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,eAAe;AAC9B,uEAAuE;AACvE,MAAA,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,IAAI,0CAAE,KAAK,0CAAE,eAAe,mCAC7C,EAAE,GAAA,CAAA;AAEJ,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAGvC,EAAwC,EAAE,CACzC,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAA;AAEjG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAmB,EAAE,wBAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAA6B,EAAE,CAC7E,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import { AuthGroupName, UserAuthGroup } from '../../auth'\nimport { Category } from '../../category'\nimport type { AreaOfInterestDescriptor } from '../../geo'\nimport { LanguageCode } from '../../language'\nimport { getLabelOrDefault } from '../../language/labels'\nimport { SRS, SRSIndex } from '../../srs'\nimport { Taxonomy } from '../../taxonomy'\nimport { Arrays, Objects } from '../../utils'\nimport { Survey } from '../survey'\n\nexport const getName = (survey: Survey): string => survey.props.name\n\nexport const getLanguages = (survey: Survey): LanguageCode[] => survey.props.languages\n\nexport const getDefaultLanguage = (survey: Survey): LanguageCode => getLanguages(survey)[0]\n\nconst getMultilangPropValue =\n (prop: 'labels' | 'descriptions' | 'fieldManualLinks') =>\n (langCode?: LanguageCode) =>\n (survey: Survey): string | undefined => {\n const languageCode = langCode ?? getDefaultLanguage(survey)\n return survey.props[prop]?.[languageCode]\n }\nexport const getLabel = getMultilangPropValue('labels')\nexport const getDescription = getMultilangPropValue('descriptions')\nexport const getFieldManualLink = getMultilangPropValue('fieldManualLinks')\n\n/**\n * Returns the survey label in the specified language (the default language if not specified), or the survey name\n * when the label is missing or empty.\n */\nexport const getLabelOrName =\n (langCode?: LanguageCode) =>\n (survey: Survey): string =>\n getLabelOrDefault(survey.props.labels, langCode ?? getDefaultLanguage(survey), getName(survey))\n\nexport const getCategoryByName = (params: { survey: Survey; categoryName: string }): Category | undefined => {\n const { survey, categoryName } = params\n return survey.categories\n ? Object.values(survey.categories).find((category) => category.props.name === categoryName)\n : undefined\n}\n\nexport const getCategoryByUuid = (params: { survey: Survey; categoryUuid: string }): Category | undefined => {\n const { survey, categoryUuid } = params\n return survey.categories?.[categoryUuid]\n}\n\nexport const getTaxonomyByName = (params: { survey: Survey; taxonomyName: string }): Taxonomy | undefined => {\n const { survey, taxonomyName } = params\n return survey.taxonomies\n ? Object.values(survey.taxonomies).find((taxonomy) => taxonomy.props.name === taxonomyName)\n : undefined\n}\n\nexport const getTaxonomyByUuid = (params: { survey: Survey; taxonomyUuid: string }): Taxonomy | undefined => {\n const { survey, taxonomyUuid } = params\n return survey.taxonomies?.[taxonomyUuid]\n}\n\nexport const getCycleKeys = (survey: Survey): string[] => {\n const cycles = survey.props?.cycles ?? {}\n return Object.keys(cycles)\n}\n\nexport const getLastCycleKey = (survey: Survey): string => Arrays.last(getCycleKeys(survey)) as string\n\nexport const isKeepNonApplicableValues = (survey: Survey): boolean => survey?.props?.keepNonApplicableValues === true\n\nexport const getDefaultCycleKey = (survey: Survey) => {\n const defaultCycleKey = survey.props?.defaultCycleKey\n const lastCycleKey = getLastCycleKey(survey)\n return Objects.isEmpty(defaultCycleKey) || Number(defaultCycleKey) > Number(lastCycleKey)\n ? lastCycleKey\n : defaultCycleKey\n}\n\nexport const getSRSs = (survey: Survey): SRS[] =>\n survey.props?.srs ??\n // backwards compatibility with Arena: srs stored in info in UI\n (survey as any).info?.props?.srs ??\n []\n\nexport const getSRSIndex = (survey: Survey): SRSIndex =>\n getSRSs(survey).reduce((acc: SRSIndex, srs) => {\n acc[srs.code] = srs\n return acc\n }, {})\n\nexport const getSRSByCode =\n (code: string) =>\n (survey: Survey): SRS | undefined =>\n getSRSIndex(survey)[code]\n\nexport const getAreasOfInterest = (survey: Survey): AreaOfInterestDescriptor[] =>\n survey?.props?.areasOfInterest ??\n // backwards compatibility with Arena: survey info props stored in info\n (survey as any)?.info?.props?.areasOfInterest ??\n []\n\nexport const getAreaOfInterestByName = (params: {\n survey: Survey\n name: string\n}): AreaOfInterestDescriptor | undefined =>\n getAreasOfInterest(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name)\n\nexport const getAuthGroups = (survey: Survey): UserAuthGroup[] => survey?.authGroups ?? []\n\nexport const getAuthGroupAdmin = (survey: Survey): UserAuthGroup | undefined =>\n getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin)\n"]}
@@ -1,5 +1,18 @@
1
1
  import type { MultiPolygon, Polygon } from 'geojson';
2
+ import type { Labels } from '../language';
2
3
  /**
3
- * Area of interest of a survey: GeoJSON polygon or multi polygon geometry in WGS84 (EPSG:4326).
4
+ * Area of interest geometry: GeoJSON polygon or multi polygon in WGS84 (EPSG:4326).
4
5
  */
5
6
  export type AreaOfInterest = Polygon | MultiPolygon;
7
+ /**
8
+ * Area of interest defined in a survey; the geometry is stored in a separate file (fetched by AreaOfInterestProvider).
9
+ */
10
+ export interface AreaOfInterestDescriptor {
11
+ name: string;
12
+ labels?: Labels;
13
+ fileUuid: string;
14
+ fileName: string;
15
+ size: number;
16
+ polygons: number;
17
+ vertices: number;
18
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"areaOfInterest.js","sourceRoot":"","sources":["../../src/geo/areaOfInterest.ts"],"names":[],"mappings":"","sourcesContent":["import type { MultiPolygon, Polygon } from 'geojson'\n\n/**\n * Area of interest of a survey: GeoJSON polygon or multi polygon geometry in WGS84 (EPSG:4326).\n */\nexport type AreaOfInterest = Polygon | MultiPolygon\n"]}
1
+ {"version":3,"file":"areaOfInterest.js","sourceRoot":"","sources":["../../src/geo/areaOfInterest.ts"],"names":[],"mappings":"","sourcesContent":["import type { MultiPolygon, Polygon } from 'geojson'\n\nimport type { Labels } from '../language'\n\n/**\n * Area of interest geometry: GeoJSON polygon or multi polygon in WGS84 (EPSG:4326).\n */\nexport type AreaOfInterest = Polygon | MultiPolygon\n\n/**\n * Area of interest defined in a survey; the geometry is stored in a separate file (fetched by AreaOfInterestProvider).\n */\nexport interface AreaOfInterestDescriptor {\n // identifier used in expressions\n name: string\n labels?: Labels\n fileUuid: string\n fileName: string\n size: number\n polygons: number\n vertices: number\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type { AreaOfInterest } from './areaOfInterest';
1
+ export type { AreaOfInterest, AreaOfInterestDescriptor } from './areaOfInterest';
2
2
  export type { Point } from './point';
3
3
  export { PointFactory } from './pointFactory';
4
4
  export { Points } from './points';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geo/index.ts"],"names":[],"mappings":";;;AAGA,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,mCAAiC;AAAxB,gGAAA,MAAM,OAAA","sourcesContent":["export type { AreaOfInterest } from './areaOfInterest'\nexport type { Point } from './point'\n\nexport { PointFactory } from './pointFactory'\n\nexport { Points } from './points'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/geo/index.ts"],"names":[],"mappings":";;;AAGA,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,mCAAiC;AAAxB,gGAAA,MAAM,OAAA","sourcesContent":["export type { AreaOfInterest, AreaOfInterestDescriptor } from './areaOfInterest'\nexport type { Point } from './point'\n\nexport { PointFactory } from './pointFactory'\n\nexport { Points } from './points'\n"]}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { Chain, ChainProps, ChainService, ChainNodeDef, ChainNodeDefProps,
9
9
  export { TraverseMethod } from './common';
10
10
  export type { ArenaObject, ArenaService, Dictionary, Factory, I18n } from './common';
11
11
  export type { FlatDataExportOptions, ArenaExportInfoFactoryParams, ArenaExportInfo } from './dataExport';
12
- export { FlatDataExportDefaultOptions, FlatDataExportOption, FlatDataFiles, FlatDataExportModel, FlatDataExportColumnDataType, ArenaExportInfoFactory, ArenaExportType, UniqueFileNamesGenerator, } from './dataExport';
12
+ export { FlatDataExportDefaultOptions, FlatDataExportOption, FlatDataFiles, FlatDataExportModel, FlatDataExportColumnDataType, ArenaExportFile, ArenaExportInfoFactory, ArenaExportType, UniqueFileNamesGenerator, } from './dataExport';
13
13
  export { DataQueryMode, DataQuerySummaries } from './dataQuery';
14
14
  export type { DataQuery, DataQuerySummary, DataQuerySummaryProps } from './dataQuery';
15
15
  export { SystemError, SystemErrorKeys } from './error';
@@ -18,7 +18,7 @@ export type { ArrayExpression, BinaryExpression, CallExpression, CompoundExpress
18
18
  export { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp';
19
19
  export type { ExtraPropDef, ExtraPropDefs } from './extraProp';
20
20
  export { PointFactory, Points } from './geo';
21
- export type { AreaOfInterest, Point } from './geo';
21
+ export type { AreaOfInterest, AreaOfInterestDescriptor, Point } from './geo';
22
22
  export { JobBase, JobEventType, JobStatus } from './job';
23
23
  export type { Job, JobContext, JobEvent, JobSerialized, JobTxClient } from './job';
24
24
  export { LanguageCode, Languages, LanguagesISO639part2 } from './language';
@@ -30,7 +30,7 @@ export { NodeFactory, NodeKeys, NodeMetaKeys, Nodes, NodeValueFormatter, NodeVal
30
30
  export type { ArenaRecordNode, Node, NodeMeta, NodePointer, NodeRefData, NodeService, NodesMap, NodeValueCode, NodeValueCoordinate, NodeValueFile, NodeValueTaxon, } from './node';
31
31
  export { NodeDefCountType, NodeDefType, NodeDefFactory, NodeDefs, NodeDefEntityRenderType, NodeDefFileType, NodeDefTextInputType, NodeDefTextRenderType, FormHeaderColor, } from './nodeDef';
32
32
  export { NodeDefExpressionEvaluator, NodeDefExpressionValidator } from './nodeDefExpressionEvaluator';
33
- export type { CategoryItemProvider, TaxonProvider } from './nodeDefExpressionEvaluator';
33
+ export type { AreaOfInterestProvider, CategoryItemProvider, TaxonProvider } from './nodeDefExpressionEvaluator';
34
34
  export type { NodeDef, NodeDefLayout, NodeDefMeta, NodeDefProps, NodeDefPropsWithLayout, NodeDefBoolean, NodeDefBooleanProps, NodeDefCode, NodeDefCodeLayout, NodeDefCodeProps, NodeDefCoordinate, NodeDefCoordinateProps, NodeDefDate, NodeDefDecimal, NodeDefDecimalProps, NodeDefEntity, NodeDefEntityChildPosition, NodeDefEntityLayout, NodeDefEntityProps, NodeDefPrintOrientation, NodeDefFile, NodeDefFileProps, NodeDefGeo, NodeDefGeoProps, NodeDefFormHeader, NodeDefFormHeaderProps, NodeDefInteger, NodeDefPropsAdvanced, NodeDefTaxon, NodeDefTaxonProps, NodeDefText, NodeDefTextProps, NodeDefTextLayout, NodeDefTime, NodeDefTimeProps, NodeDefExpression, NodeDefMap, NodeDefService, NodeDefValidations, } from './nodeDef';
35
35
  export { NodePointers, RecordCloner, RecordFactory, RecordFixer, Records, RECORD_STEP_DEFAULT, RecordExpressionEvaluator, RecordNodesUpdater, RecordPrettyPrinter, RecordUpdater, RecordUpdateResult, RecordValidator, RecordValidations, } from './record';
36
36
  export type { AttributeValidatorParams, AttributesValidatorParams, NodeCreateParams, NodesUpdateParams, ArenaRecord, Record, RecordExpressionContext, RecordExpressionEvaluationContext, RecordService, RecordUpdateOptions, RecordValidatorParams, SortedAttributesValidatorParams, } from './record';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeFactory = exports.Messages = exports.MessageTargetUserType = exports.MessageStatus = exports.MessagePropsKey = exports.MessageNotificationType = exports.LanguagesISO639part2 = exports.Languages = exports.LanguageCode = exports.JobStatus = exports.JobEventType = exports.JobBase = exports.Points = exports.PointFactory = exports.ExtraPropsDataGenerator = exports.ExtraPropDataType = exports.JavascriptExpressionParser = exports.JavascriptExpressionEvaluator = exports.ExpressionVariable = exports.ExpressionNodeEvaluator = exports.ExpressionNodeType = exports.SystemErrorKeys = exports.SystemError = exports.DataQuerySummaries = exports.DataQueryMode = exports.UniqueFileNamesGenerator = exports.ArenaExportType = exports.ArenaExportInfoFactory = exports.FlatDataExportColumnDataType = exports.FlatDataExportModel = exports.FlatDataFiles = exports.FlatDataExportOption = exports.FlatDataExportDefaultOptions = exports.TraverseMethod = exports.ChainNodeDefFactory = exports.ChainStatusExec = exports.ChainFactory = exports.CategoryItems = exports.Categories = exports.CategoryLevelFactory = exports.CategoryItemFactory = exports.CategoryImportColumnType = exports.CategoryFactory = exports.Users = exports.UserFactory = exports.UserTitle = exports.Permission = exports.UserStatus = exports.AuthGroupName = exports.Authorizer = void 0;
4
- exports.Taxonomies = exports.Taxa = exports.defaultCycle = exports.surveySecurityDefaults = exports.surveyDocImagePropKeys = exports.Surveys = exports.SurveySecurityProp = exports.SurveyRefDataFactory = exports.SurveyFileType = exports.SurveyFileFactory = exports.SurveyFactory = exports.SurveyDependencyType = exports.SurveyDocPlace = exports.SurveyDocImageFactory = exports.SurveyDocImages = exports.NodeDefsFixer = exports.SRSFactory = exports.DEFAULT_SRS_INDEX = exports.DEFAULT_SRS = exports.ServiceType = exports.ServiceRegistry = exports.RecordValidations = exports.RecordValidator = exports.RecordUpdateResult = exports.RecordUpdater = exports.RecordPrettyPrinter = exports.RecordNodesUpdater = exports.RecordExpressionEvaluator = exports.RECORD_STEP_DEFAULT = exports.Records = exports.RecordFixer = exports.RecordFactory = exports.RecordCloner = exports.NodePointers = exports.NodeDefExpressionValidator = exports.NodeDefExpressionEvaluator = exports.FormHeaderColor = exports.NodeDefTextRenderType = exports.NodeDefTextInputType = exports.NodeDefFileType = exports.NodeDefEntityRenderType = exports.NodeDefs = exports.NodeDefFactory = exports.NodeDefType = exports.NodeDefCountType = exports.NodeValues = exports.NodeValueFormatter = exports.Nodes = exports.NodeMetaKeys = exports.NodeKeys = void 0;
5
- exports.ValidatorErrorKeys = exports.Validator = exports.ValidationSeverity = exports.Validations = exports.ValidationResults = exports.ValidationResultFactory = exports.ValidationFactory = exports.FieldValidators = exports.Versions = exports.UUIDs = exports.UnitOfTime = exports.Strings = exports.RetryProcessor = exports.Queue = exports.Promises = exports.Objects = exports.Numbers = exports.FileProcessor = exports.FileNames = exports.Dates = exports.DateFormats = exports.Arrays = exports.RecordNodeBuilders = exports.RecordBuilder = exports.SurveyObjectBuilders = exports.SurveyBuilder = exports.VernacularNameFactory = exports.TaxonGenerator = exports.TaxonFactory = exports.TaxonomyFactory = void 0;
3
+ exports.Messages = exports.MessageTargetUserType = exports.MessageStatus = exports.MessagePropsKey = exports.MessageNotificationType = exports.LanguagesISO639part2 = exports.Languages = exports.LanguageCode = exports.JobStatus = exports.JobEventType = exports.JobBase = exports.Points = exports.PointFactory = exports.ExtraPropsDataGenerator = exports.ExtraPropDataType = exports.JavascriptExpressionParser = exports.JavascriptExpressionEvaluator = exports.ExpressionVariable = exports.ExpressionNodeEvaluator = exports.ExpressionNodeType = exports.SystemErrorKeys = exports.SystemError = exports.DataQuerySummaries = exports.DataQueryMode = exports.UniqueFileNamesGenerator = exports.ArenaExportType = exports.ArenaExportInfoFactory = exports.ArenaExportFile = exports.FlatDataExportColumnDataType = exports.FlatDataExportModel = exports.FlatDataFiles = exports.FlatDataExportOption = exports.FlatDataExportDefaultOptions = exports.TraverseMethod = exports.ChainNodeDefFactory = exports.ChainStatusExec = exports.ChainFactory = exports.CategoryItems = exports.Categories = exports.CategoryLevelFactory = exports.CategoryItemFactory = exports.CategoryImportColumnType = exports.CategoryFactory = exports.Users = exports.UserFactory = exports.UserTitle = exports.Permission = exports.UserStatus = exports.AuthGroupName = exports.Authorizer = void 0;
4
+ exports.Taxa = exports.defaultCycle = exports.surveySecurityDefaults = exports.surveyDocImagePropKeys = exports.Surveys = exports.SurveySecurityProp = exports.SurveyRefDataFactory = exports.SurveyFileType = exports.SurveyFileFactory = exports.SurveyFactory = exports.SurveyDependencyType = exports.SurveyDocPlace = exports.SurveyDocImageFactory = exports.SurveyDocImages = exports.NodeDefsFixer = exports.SRSFactory = exports.DEFAULT_SRS_INDEX = exports.DEFAULT_SRS = exports.ServiceType = exports.ServiceRegistry = exports.RecordValidations = exports.RecordValidator = exports.RecordUpdateResult = exports.RecordUpdater = exports.RecordPrettyPrinter = exports.RecordNodesUpdater = exports.RecordExpressionEvaluator = exports.RECORD_STEP_DEFAULT = exports.Records = exports.RecordFixer = exports.RecordFactory = exports.RecordCloner = exports.NodePointers = exports.NodeDefExpressionValidator = exports.NodeDefExpressionEvaluator = exports.FormHeaderColor = exports.NodeDefTextRenderType = exports.NodeDefTextInputType = exports.NodeDefFileType = exports.NodeDefEntityRenderType = exports.NodeDefs = exports.NodeDefFactory = exports.NodeDefType = exports.NodeDefCountType = exports.NodeValues = exports.NodeValueFormatter = exports.Nodes = exports.NodeMetaKeys = exports.NodeKeys = exports.NodeFactory = void 0;
5
+ exports.ValidatorErrorKeys = exports.Validator = exports.ValidationSeverity = exports.Validations = exports.ValidationResults = exports.ValidationResultFactory = exports.ValidationFactory = exports.FieldValidators = exports.Versions = exports.UUIDs = exports.UnitOfTime = exports.Strings = exports.RetryProcessor = exports.Queue = exports.Promises = exports.Objects = exports.Numbers = exports.FileProcessor = exports.FileNames = exports.Dates = exports.DateFormats = exports.Arrays = exports.RecordNodeBuilders = exports.RecordBuilder = exports.SurveyObjectBuilders = exports.SurveyBuilder = exports.VernacularNameFactory = exports.TaxonGenerator = exports.TaxonFactory = exports.TaxonomyFactory = exports.Taxonomies = void 0;
6
6
  var auth_1 = require("./auth");
7
7
  Object.defineProperty(exports, "Authorizer", { enumerable: true, get: function () { return auth_1.Authorizer; } });
8
8
  Object.defineProperty(exports, "AuthGroupName", { enumerable: true, get: function () { return auth_1.AuthGroupName; } });
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "FlatDataExportOption", { enumerable: true, get:
31
31
  Object.defineProperty(exports, "FlatDataFiles", { enumerable: true, get: function () { return dataExport_1.FlatDataFiles; } });
32
32
  Object.defineProperty(exports, "FlatDataExportModel", { enumerable: true, get: function () { return dataExport_1.FlatDataExportModel; } });
33
33
  Object.defineProperty(exports, "FlatDataExportColumnDataType", { enumerable: true, get: function () { return dataExport_1.FlatDataExportColumnDataType; } });
34
+ Object.defineProperty(exports, "ArenaExportFile", { enumerable: true, get: function () { return dataExport_1.ArenaExportFile; } });
34
35
  Object.defineProperty(exports, "ArenaExportInfoFactory", { enumerable: true, get: function () { return dataExport_1.ArenaExportInfoFactory; } });
35
36
  Object.defineProperty(exports, "ArenaExportType", { enumerable: true, get: function () { return dataExport_1.ArenaExportType; } });
36
37
  Object.defineProperty(exports, "UniqueFileNamesGenerator", { enumerable: true, get: function () { return dataExport_1.UniqueFileNamesGenerator; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,+BAAyG;AAAhG,kGAAA,UAAU,OAAA;AAAE,qGAAA,aAAa,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,6FAAA,KAAK,OAAA;AAwBzF,uCAAiH;AAAxG,2GAAA,eAAe,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,gHAAA,oBAAoB,OAAA;AAe7F,uCAAsD;AAA7C,sGAAA,UAAU,OAAA;AAAE,yGAAA,aAAa,OAAA;AAElC,iCAA4E;AAAnE,qGAAA,YAAY,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,4GAAA,mB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gGAAA,IAAI,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,2GAAA,eAAe,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAe/F,+DAAmF;AAA1E,8GAAA,aAAa,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAC5C,+DAAiF;AAAxE,8GAAA,aAAa,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AAE1C,iCAegB;AAdd,+FAAA,MAAM,OAAA;AACN,oGAAA,WAAW,OAAA;AACX,8FAAA,KAAK,OAAA;AACL,kGAAA,SAAS,OAAA;AACT,sGAAA,aAAa,OAAA;AACb,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,iGAAA,QAAQ,OAAA;AACR,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AACL,iGAAA,QAAQ,OAAA;AAKV,2CASqB;AARnB,6GAAA,eAAe,OAAA;AACf,+GAAA,iBAAiB,OAAA;AACjB,qHAAA,uBAAuB,OAAA;AACvB,+GAAA,iBAAiB,OAAA;AACjB,yGAAA,WAAW,OAAA;AACX,gHAAA,kBAAkB,OAAA;AAClB,uGAAA,SAAS,OAAA;AACT,gHAAA,kBAAkB,OAAA","sourcesContent":["export type { AppInfo } from './app'\n\nexport { Authorizer, AuthGroupName, UserStatus, Permission, UserTitle, UserFactory, Users } from './auth'\nexport type {\n AuthGroup,\n User,\n UserAuthGroup,\n UserAuthGroupProps,\n AuthToken,\n UserAuthTokenPayload,\n UserAuthTokenService,\n UserPrefs,\n UserPrefSurveys,\n UserProps,\n UserAuthRefreshToken,\n UserAuthRefreshTokenProps,\n UserAuthRefreshTokenPayload,\n UserService,\n UserTokenPayload,\n DownloadAuthTokenPayload,\n UserGroup,\n UserGroupProps,\n UserGroupQualifier,\n UserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryImportColumnType, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n CategoryItemProps,\n Category,\n CategoryItem,\n CategoryLevel,\n CategoryLevelProps,\n CategoryImportSummary,\n CategoryImportSummaryColumn,\n CategoryItemService,\n CategoryLevelService,\n CategoryProps,\n CategoryService,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n Chain,\n ChainProps,\n ChainService,\n ChainNodeDef,\n ChainNodeDefProps,\n ChainNodeDefService,\n ChainNodeDefAggregate,\n ChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, Dictionary, Factory, I18n } from './common'\n\nexport type { FlatDataExportOptions, ArenaExportInfoFactoryParams, ArenaExportInfo } from './dataExport'\nexport {\n FlatDataExportDefaultOptions,\n FlatDataExportOption,\n FlatDataFiles,\n FlatDataExportModel,\n FlatDataExportColumnDataType,\n ArenaExportInfoFactory,\n ArenaExportType,\n UniqueFileNamesGenerator,\n} from './dataExport'\n\nexport { DataQueryMode, DataQuerySummaries } from './dataQuery'\nexport type { DataQuery, DataQuerySummary, DataQuerySummaryProps } from './dataQuery'\n\nexport { SystemError, SystemErrorKeys } from './error'\n\nexport {\n ExpressionNodeType,\n ExpressionNodeEvaluator,\n ExpressionVariable,\n JavascriptExpressionEvaluator,\n JavascriptExpressionParser,\n} from './expression'\nexport type {\n ArrayExpression,\n BinaryExpression,\n CallExpression,\n CompoundExpression,\n ConditionalExpression,\n ExpressionContext,\n ExpressionEvaluator,\n ExpressionFunction,\n ExpressionFunctions,\n AnyExpressionNode,\n ExpressionNode,\n ExpressionNodeEvaluatorConstructor,\n MemberExpression,\n IdentifierExpression,\n LiteralExpression,\n SequenceExpression,\n ThisExpression,\n UnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ExtraPropDef, ExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type { AreaOfInterest, Point } from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { Job, JobContext, JobEvent, JobSerialized, JobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { Labels } from './language'\n\nexport type { Logger } from './logger'\n\nexport type { Message } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport { NodeFactory, NodeKeys, NodeMetaKeys, Nodes, NodeValueFormatter, NodeValues } from './node'\nexport type {\n ArenaRecordNode,\n Node,\n NodeMeta,\n NodePointer,\n NodeRefData,\n NodeService,\n NodesMap,\n NodeValueCode,\n NodeValueCoordinate,\n NodeValueFile,\n NodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefType,\n NodeDefFactory,\n NodeDefs,\n NodeDefEntityRenderType,\n NodeDefFileType,\n NodeDefTextInputType,\n NodeDefTextRenderType,\n FormHeaderColor,\n} from './nodeDef'\n\nexport { NodeDefExpressionEvaluator, NodeDefExpressionValidator } from './nodeDefExpressionEvaluator'\nexport type { CategoryItemProvider, TaxonProvider } from './nodeDefExpressionEvaluator'\n\nexport type {\n NodeDef,\n NodeDefLayout,\n NodeDefMeta,\n NodeDefProps,\n NodeDefPropsWithLayout,\n NodeDefBoolean,\n NodeDefBooleanProps,\n NodeDefCode,\n NodeDefCodeLayout,\n NodeDefCodeProps,\n NodeDefCoordinate,\n NodeDefCoordinateProps,\n NodeDefDate,\n NodeDefDecimal,\n NodeDefDecimalProps,\n NodeDefEntity,\n NodeDefEntityChildPosition,\n NodeDefEntityLayout,\n NodeDefEntityProps,\n NodeDefPrintOrientation,\n NodeDefFile,\n NodeDefFileProps,\n NodeDefGeo,\n NodeDefGeoProps,\n NodeDefFormHeader,\n NodeDefFormHeaderProps,\n NodeDefInteger,\n NodeDefPropsAdvanced,\n NodeDefTaxon,\n NodeDefTaxonProps,\n NodeDefText,\n NodeDefTextProps,\n NodeDefTextLayout,\n NodeDefTime,\n NodeDefTimeProps,\n NodeDefExpression,\n NodeDefMap,\n NodeDefService,\n NodeDefValidations,\n} from './nodeDef'\n\nexport {\n NodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n AttributeValidatorParams,\n AttributesValidatorParams,\n NodeCreateParams,\n NodesUpdateParams,\n ArenaRecord,\n Record,\n RecordExpressionContext,\n RecordExpressionEvaluationContext,\n RecordService,\n RecordUpdateOptions,\n RecordValidatorParams,\n SortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { SRS, SRSIndex } from './srs'\n\nexport {\n NodeDefsFixer,\n SurveyDocImages,\n SurveyDocImageFactory,\n SurveyDocPlace,\n SurveyDependencyType,\n SurveyFactory,\n SurveyFileFactory,\n SurveyFileType,\n SurveyRefDataFactory,\n SurveySecurityProp,\n Surveys,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n defaultCycle,\n} from './survey'\nexport type {\n Survey,\n SurveyCycle,\n SurveyDependency,\n SurveyDependencyGraph,\n SurveyDocImage,\n SurveyDocImageFactoryParams,\n SurveyDocImageProps,\n SurveyFile,\n SurveyFileFactoryParams,\n SurveyFileProps,\n SurveyProps,\n SurveyRefData,\n SurveySecurity,\n SurveyService,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n VernacularNameParams,\n TaxonomyFactoryParams,\n TaxonFactoryParams,\n Taxonomy,\n TaxonomyService,\n VernacularNameProps,\n VernacularName,\n TaxonProps,\n Taxon,\n TaxonomyProps,\n TaxonService,\n} from './taxonomy'\n\nexport { SurveyBuilder, SurveyObjectBuilders } from './tests/builder/surveyBuilder'\nexport { RecordBuilder, RecordNodeBuilders } from './tests/builder/recordBuilder'\n\nexport {\n Arrays,\n DateFormats,\n Dates,\n FileNames,\n FileProcessor,\n Numbers,\n Objects,\n Promises,\n Queue,\n RetryProcessor,\n Strings,\n UnitOfTime,\n UUIDs,\n Versions,\n} from './utils'\n\nexport type { FileProcessorConstructorArgs, MutationOptions, ParsedVersion } from './utils'\n\nexport {\n FieldValidators,\n ValidationFactory,\n ValidationResultFactory,\n ValidationResults,\n Validations,\n ValidationSeverity,\n Validator,\n ValidatorErrorKeys,\n} from './validation'\nexport type {\n DissocFieldValidationOptions,\n FieldValidator,\n Validation,\n ValidationFields,\n ValidationResult,\n ValidationCounts,\n} from './validation'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,+BAAyG;AAAhG,kGAAA,UAAU,OAAA;AAAE,qGAAA,aAAa,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,6FAAA,KAAK,OAAA;AAwBzF,uCAAiH;AAAxG,2GAAA,eAAe,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,gHAAA,oBAAoB,OAAA;AAe7F,uCAAsD;AAA7C,sGAAA,UAAU,OAAA;AAAE,yGAAA,aAAa,OAAA;AAElC,iCAA4E;AAAnE,qGAAA,YAAY,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAY3D,mCAAyC;AAAhC,wGAAA,cAAc,OAAA;AAIvB,2CAUqB;AATnB,0HAAA,4BAA4B,OAAA;AAC5B,kHAAA,oBAAoB,OAAA;AACpB,2GAA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c,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAe/F,+DAAmF;AAA1E,8GAAA,aAAa,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAC5C,+DAAiF;AAAxE,8GAAA,aAAa,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AAE1C,iCAegB;AAdd,+FAAA,MAAM,OAAA;AACN,oGAAA,WAAW,OAAA;AACX,8FAAA,KAAK,OAAA;AACL,kGAAA,SAAS,OAAA;AACT,sGAAA,aAAa,OAAA;AACb,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,iGAAA,QAAQ,OAAA;AACR,8FAAA,KAAK,OAAA;AACL,uGAAA,cAAc,OAAA;AACd,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AACL,iGAAA,QAAQ,OAAA;AAKV,2CASqB;AARnB,6GAAA,eAAe,OAAA;AACf,+GAAA,iBAAiB,OAAA;AACjB,qHAAA,uBAAuB,OAAA;AACvB,+GAAA,iBAAiB,OAAA;AACjB,yGAAA,WAAW,OAAA;AACX,gHAAA,kBAAkB,OAAA;AAClB,uGAAA,SAAS,OAAA;AACT,gHAAA,kBAAkB,OAAA","sourcesContent":["export type { AppInfo } from './app'\n\nexport { Authorizer, AuthGroupName, UserStatus, Permission, UserTitle, UserFactory, Users } from './auth'\nexport type {\n AuthGroup,\n User,\n UserAuthGroup,\n UserAuthGroupProps,\n AuthToken,\n UserAuthTokenPayload,\n UserAuthTokenService,\n UserPrefs,\n UserPrefSurveys,\n UserProps,\n UserAuthRefreshToken,\n UserAuthRefreshTokenProps,\n UserAuthRefreshTokenPayload,\n UserService,\n UserTokenPayload,\n DownloadAuthTokenPayload,\n UserGroup,\n UserGroupProps,\n UserGroupQualifier,\n UserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryImportColumnType, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n CategoryItemProps,\n Category,\n CategoryItem,\n CategoryLevel,\n CategoryLevelProps,\n CategoryImportSummary,\n CategoryImportSummaryColumn,\n CategoryItemService,\n CategoryLevelService,\n CategoryProps,\n CategoryService,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n Chain,\n ChainProps,\n ChainService,\n ChainNodeDef,\n ChainNodeDefProps,\n ChainNodeDefService,\n ChainNodeDefAggregate,\n ChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, Dictionary, Factory, I18n } from './common'\n\nexport type { FlatDataExportOptions, ArenaExportInfoFactoryParams, ArenaExportInfo } from './dataExport'\nexport {\n FlatDataExportDefaultOptions,\n FlatDataExportOption,\n FlatDataFiles,\n FlatDataExportModel,\n FlatDataExportColumnDataType,\n ArenaExportFile,\n ArenaExportInfoFactory,\n ArenaExportType,\n UniqueFileNamesGenerator,\n} from './dataExport'\n\nexport { DataQueryMode, DataQuerySummaries } from './dataQuery'\nexport type { DataQuery, DataQuerySummary, DataQuerySummaryProps } from './dataQuery'\n\nexport { SystemError, SystemErrorKeys } from './error'\n\nexport {\n ExpressionNodeType,\n ExpressionNodeEvaluator,\n ExpressionVariable,\n JavascriptExpressionEvaluator,\n JavascriptExpressionParser,\n} from './expression'\nexport type {\n ArrayExpression,\n BinaryExpression,\n CallExpression,\n CompoundExpression,\n ConditionalExpression,\n ExpressionContext,\n ExpressionEvaluator,\n ExpressionFunction,\n ExpressionFunctions,\n AnyExpressionNode,\n ExpressionNode,\n ExpressionNodeEvaluatorConstructor,\n MemberExpression,\n IdentifierExpression,\n LiteralExpression,\n SequenceExpression,\n ThisExpression,\n UnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ExtraPropDef, ExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type { AreaOfInterest, AreaOfInterestDescriptor, Point } from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { Job, JobContext, JobEvent, JobSerialized, JobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { Labels } from './language'\n\nexport type { Logger } from './logger'\n\nexport type { Message } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport { NodeFactory, NodeKeys, NodeMetaKeys, Nodes, NodeValueFormatter, NodeValues } from './node'\nexport type {\n ArenaRecordNode,\n Node,\n NodeMeta,\n NodePointer,\n NodeRefData,\n NodeService,\n NodesMap,\n NodeValueCode,\n NodeValueCoordinate,\n NodeValueFile,\n NodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefType,\n NodeDefFactory,\n NodeDefs,\n NodeDefEntityRenderType,\n NodeDefFileType,\n NodeDefTextInputType,\n NodeDefTextRenderType,\n FormHeaderColor,\n} from './nodeDef'\n\nexport { NodeDefExpressionEvaluator, NodeDefExpressionValidator } from './nodeDefExpressionEvaluator'\nexport type { AreaOfInterestProvider, CategoryItemProvider, TaxonProvider } from './nodeDefExpressionEvaluator'\n\nexport type {\n NodeDef,\n NodeDefLayout,\n NodeDefMeta,\n NodeDefProps,\n NodeDefPropsWithLayout,\n NodeDefBoolean,\n NodeDefBooleanProps,\n NodeDefCode,\n NodeDefCodeLayout,\n NodeDefCodeProps,\n NodeDefCoordinate,\n NodeDefCoordinateProps,\n NodeDefDate,\n NodeDefDecimal,\n NodeDefDecimalProps,\n NodeDefEntity,\n NodeDefEntityChildPosition,\n NodeDefEntityLayout,\n NodeDefEntityProps,\n NodeDefPrintOrientation,\n NodeDefFile,\n NodeDefFileProps,\n NodeDefGeo,\n NodeDefGeoProps,\n NodeDefFormHeader,\n NodeDefFormHeaderProps,\n NodeDefInteger,\n NodeDefPropsAdvanced,\n NodeDefTaxon,\n NodeDefTaxonProps,\n NodeDefText,\n NodeDefTextProps,\n NodeDefTextLayout,\n NodeDefTime,\n NodeDefTimeProps,\n NodeDefExpression,\n NodeDefMap,\n NodeDefService,\n NodeDefValidations,\n} from './nodeDef'\n\nexport {\n NodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n AttributeValidatorParams,\n AttributesValidatorParams,\n NodeCreateParams,\n NodesUpdateParams,\n ArenaRecord,\n Record,\n RecordExpressionContext,\n RecordExpressionEvaluationContext,\n RecordService,\n RecordUpdateOptions,\n RecordValidatorParams,\n SortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { SRS, SRSIndex } from './srs'\n\nexport {\n NodeDefsFixer,\n SurveyDocImages,\n SurveyDocImageFactory,\n SurveyDocPlace,\n SurveyDependencyType,\n SurveyFactory,\n SurveyFileFactory,\n SurveyFileType,\n SurveyRefDataFactory,\n SurveySecurityProp,\n Surveys,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n defaultCycle,\n} from './survey'\nexport type {\n Survey,\n SurveyCycle,\n SurveyDependency,\n SurveyDependencyGraph,\n SurveyDocImage,\n SurveyDocImageFactoryParams,\n SurveyDocImageProps,\n SurveyFile,\n SurveyFileFactoryParams,\n SurveyFileProps,\n SurveyProps,\n SurveyRefData,\n SurveySecurity,\n SurveyService,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n VernacularNameParams,\n TaxonomyFactoryParams,\n TaxonFactoryParams,\n Taxonomy,\n TaxonomyService,\n VernacularNameProps,\n VernacularName,\n TaxonProps,\n Taxon,\n TaxonomyProps,\n TaxonService,\n} from './taxonomy'\n\nexport { SurveyBuilder, SurveyObjectBuilders } from './tests/builder/surveyBuilder'\nexport { RecordBuilder, RecordNodeBuilders } from './tests/builder/recordBuilder'\n\nexport {\n Arrays,\n DateFormats,\n Dates,\n FileNames,\n FileProcessor,\n Numbers,\n Objects,\n Promises,\n Queue,\n RetryProcessor,\n Strings,\n UnitOfTime,\n UUIDs,\n Versions,\n} from './utils'\n\nexport type { FileProcessorConstructorArgs, MutationOptions, ParsedVersion } from './utils'\n\nexport {\n FieldValidators,\n ValidationFactory,\n ValidationResultFactory,\n ValidationResults,\n Validations,\n ValidationSeverity,\n Validator,\n ValidatorErrorKeys,\n} from './validation'\nexport type {\n DissocFieldValidationOptions,\n FieldValidator,\n Validation,\n ValidationFields,\n ValidationResult,\n ValidationCounts,\n} from './validation'\n"]}
@@ -0,0 +1,11 @@
1
+ import type { AreaOfInterest } from '../geo';
2
+ import { Survey } from '../survey';
3
+ /**
4
+ * Fetches the geometry of the areas of interest of a survey: they are stored outside the survey (e.g. in files).
5
+ */
6
+ export interface AreaOfInterestProvider {
7
+ getAreaOfInterest: (params: {
8
+ survey: Survey;
9
+ name: string;
10
+ }) => Promise<AreaOfInterest | undefined>;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=areaOfInterestProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"areaOfInterestProvider.js","sourceRoot":"","sources":["../../src/nodeDefExpressionEvaluator/areaOfInterestProvider.ts"],"names":[],"mappings":"","sourcesContent":["import type { AreaOfInterest } from '../geo'\nimport { Survey } from '../survey'\n\n/**\n * Fetches the geometry of the areas of interest of a survey: they are stored outside the survey (e.g. in files).\n */\nexport interface AreaOfInterestProvider {\n getAreaOfInterest: (params: { survey: Survey; name: string }) => Promise<AreaOfInterest | undefined>\n}\n"]}
@@ -3,6 +3,7 @@ import { ExpressionContext } from '../expression';
3
3
  import { NodeDef } from '../nodeDef';
4
4
  import { NodeDefProps, NodeDefType } from '../nodeDef/nodeDef';
5
5
  import { Survey } from '../survey';
6
+ import { AreaOfInterestProvider } from './areaOfInterestProvider';
6
7
  import { CategoryItemProvider } from './categoryItemProvider';
7
8
  import { TaxonProvider } from './taxonProvider';
8
9
  export interface NodeDefExpressionContext extends ExpressionContext {
@@ -19,4 +20,5 @@ export interface NodeDefExpressionContext extends ExpressionContext {
19
20
  memberProperty?: boolean;
20
21
  categoryItemProvider?: CategoryItemProvider;
21
22
  taxonProvider?: TaxonProvider;
23
+ areaOfInterestProvider?: AreaOfInterestProvider;
22
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../auth'\nimport { ExpressionContext } from '../expression'\nimport { NodeDef } from '../nodeDef'\nimport { NodeDefProps, NodeDefType } from '../nodeDef/nodeDef'\nimport { Survey } from '../survey'\nimport { CategoryItemProvider } from './categoryItemProvider'\nimport { TaxonProvider } from './taxonProvider'\n\nexport interface NodeDefExpressionContext extends ExpressionContext {\n survey: Survey\n user?: User\n nodeDefCurrent: NodeDef<NodeDefType, NodeDefProps>\n nodeDefContext?: NodeDef<NodeDefType, NodeDefProps>\n /**\n * Unique UUIDs of node definitions being visited during expression evaluation.\n */\n referencedNodeDefUuids?: Set<string>\n selfReferenceAllowed?: boolean\n // true when the expression is used to filter code or taxon items\n itemsFilter?: boolean\n // true when evaluating the property of a member expression (e.g. \"length\" in \"text_attr.length\")\n memberProperty?: boolean\n\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { User } from '../auth'\nimport { ExpressionContext } from '../expression'\nimport { NodeDef } from '../nodeDef'\nimport { NodeDefProps, NodeDefType } from '../nodeDef/nodeDef'\nimport { Survey } from '../survey'\nimport { AreaOfInterestProvider } from './areaOfInterestProvider'\nimport { CategoryItemProvider } from './categoryItemProvider'\nimport { TaxonProvider } from './taxonProvider'\n\nexport interface NodeDefExpressionContext extends ExpressionContext {\n survey: Survey\n user?: User\n nodeDefCurrent: NodeDef<NodeDefType, NodeDefProps>\n nodeDefContext?: NodeDef<NodeDefType, NodeDefProps>\n /**\n * Unique UUIDs of node definitions being visited during expression evaluation.\n */\n referencedNodeDefUuids?: Set<string>\n selfReferenceAllowed?: boolean\n // true when the expression is used to filter code or taxon items\n itemsFilter?: boolean\n // true when evaluating the property of a member expression (e.g. \"length\" in \"text_attr.length\")\n memberProperty?: boolean\n\n categoryItemProvider?: CategoryItemProvider\n taxonProvider?: TaxonProvider\n areaOfInterestProvider?: AreaOfInterestProvider\n}\n"]}