@openforis/arena-core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/nodePointer.js.map +1 -1
- package/dist/esm/node/nodeValueFormatter.js.map +1 -1
- package/dist/esm/node/nodeValues.js.map +1 -1
- package/dist/esm/nodeDef/factory.js.map +1 -1
- package/dist/esm/nodeDef/index.js.map +1 -1
- package/dist/esm/nodeDef/nodeDef.js.map +1 -1
- package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
- package/dist/esm/nodeDef/service.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/esm/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/esm/record/_records/recordCompletion.js.map +1 -1
- package/dist/esm/record/_records/recordGetters.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js +1 -1
- package/dist/esm/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/esm/record/recordValidator/countValidator.js.map +1 -1
- package/dist/esm/survey/survey.js.map +1 -1
- package/dist/esm/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/esm/survey/surveys/dependencies.js.map +1 -1
- package/dist/esm/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/esm/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/esm/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node/nodePointer.d.ts +2 -2
- package/dist/node/nodePointer.js.map +1 -1
- package/dist/node/nodeValueFormatter.d.ts +2 -2
- package/dist/node/nodeValueFormatter.js.map +1 -1
- package/dist/node/nodeValues.d.ts +3 -3
- package/dist/node/nodeValues.js.map +1 -1
- package/dist/nodeDef/factory.d.ts +3 -3
- package/dist/nodeDef/factory.js.map +1 -1
- package/dist/nodeDef/index.d.ts +1 -1
- package/dist/nodeDef/index.js.map +1 -1
- package/dist/nodeDef/nodeDef.d.ts +2 -0
- package/dist/nodeDef/nodeDef.js.map +1 -1
- package/dist/nodeDef/nodeDefs.d.ts +50 -50
- package/dist/nodeDef/nodeDefs.js.map +1 -1
- package/dist/nodeDef/service.d.ts +7 -7
- package/dist/nodeDef/service.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/context.d.ts +3 -4
- package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/node/identifier.d.ts +2 -2
- package/dist/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
- package/dist/record/_records/nodeDefSelfReferences.d.ts +2 -2
- package/dist/record/_records/nodeDefSelfReferences.js.map +1 -1
- package/dist/record/_records/recordCompletion.js.map +1 -1
- package/dist/record/_records/recordGetters.d.ts +4 -4
- package/dist/record/_records/recordGetters.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.d.ts +2 -2
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/record/recordValidator/attributeKeyValidator.d.ts +3 -3
- package/dist/record/recordValidator/attributeKeyValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeTypeValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeTypeValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeUniqueValidator.d.ts +2 -2
- package/dist/record/recordValidator/attributeUniqueValidator.js.map +1 -1
- package/dist/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/record/recordValidator/countValidator.d.ts +2 -2
- package/dist/record/recordValidator/countValidator.js.map +1 -1
- package/dist/survey/survey.d.ts +2 -2
- package/dist/survey/survey.js.map +1 -1
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.d.ts +3 -3
- package/dist/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
- package/dist/survey/surveys/dependencies.d.ts +4 -4
- package/dist/survey/surveys/dependencies.js.map +1 -1
- package/dist/survey/surveys/nodeDefs.d.ts +28 -28
- package/dist/survey/surveys/nodeDefs.js.map +1 -1
- package/dist/tests/builder/recordBuilder/nodeBuilder.d.ts +2 -2
- package/dist/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +3 -3
- package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.d.ts +2 -2
- package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,KAAK,GACN,MAAM,QAAQ,CAAA;AAwBf,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAejH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAY5E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAsBrB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,o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,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEjF,OAAO,EACL,MAAM,EACN,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACT,MAAM,SAAS,CAAA;AAIhB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAc,CAAA","sourcesContent":["export type { ArenaAppInfo } from './app'\n\nexport {\n Authorizer,\n AuthGroupName,\n createDefaultAuthGroups,\n UserStatus,\n Permission,\n UserTitle,\n UserFactory,\n Users,\n} from './auth'\nexport type {\n ArenaAuthGroup,\n ArenaUser,\n ArenaUserAuthGroup,\n ArenaUserAuthGroupProps,\n ArenaAuthToken,\n ArenaUserAuthTokenPayload,\n ArenaUserAuthTokenService,\n ArenaUserPrefs,\n ArenaUserPrefSurveys,\n ArenaUserProps,\n ArenaUserAuthRefreshToken,\n ArenaUserAuthRefreshTokenProps,\n ArenaUserAuthRefreshTokenPayload,\n ArenaUserService,\n ArenaUserTokenPayload,\n ArenaDownloadAuthTokenPayload,\n ArenaUserGroup,\n ArenaUserGroupProps,\n ArenaUserGroupQualifier,\n ArenaUserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryImportColumnType, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryImportSummary,\n ArenaCategoryImportSummaryColumn,\n ArenaCategoryItemService,\n ArenaCategoryLevelService,\n ArenaCategoryProps,\n ArenaCategoryService,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainService,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\n ArenaChainNodeDefService,\n ArenaChainNodeDefAggregate,\n ArenaChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, ArenaDictionary, ArenaFactory, ArenaI18n } from './common'\n\nexport type { ArenaFlatDataExportOptions, 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 { ArenaDataQuery, ArenaDataQuerySummary, ArenaDataQuerySummaryProps } 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 ArenaArrayExpression,\n ArenaBinaryExpression,\n ArenaCallExpression,\n ArenaCompoundExpression,\n ArenaConditionalExpression,\n ArenaExpressionContext,\n ArenaExpressionEvaluator,\n ArenaExpressionFunction,\n ArenaExpressionFunctions,\n ArenaAnyExpressionNode,\n ArenaExpressionNode,\n ArenaExpressionNodeEvaluatorConstructor,\n ArenaMemberExpression,\n ArenaIdentifierExpression,\n ArenaLiteralExpression,\n ArenaSequenceExpression,\n ArenaThisExpression,\n ArenaUnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ArenaExtraPropDef, ArenaExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type { ArenaAreaOfInterest, ArenaAreaOfInterestDescriptor, ArenaPoint } from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { ArenaJob, ArenaJobContext, ArenaJobEvent, ArenaJobSerialized, ArenaJobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { ArenaLabels } from './language'\n\nexport type { ArenaLogger } from './logger'\n\nexport type { ArenaMessage } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport {\n RecordNodeFactory,\n RecordNodeKeys,\n RecordNodeMetaKeys,\n RecordNodes,\n RecordNodeValueFormatter,\n RecordNodeValues,\n} from './node'\nexport type {\n ArenaRecordNode,\n ArenaRecordNodeMeta,\n ArenaRecordNodePointer,\n ArenaRecordNodeRefData,\n ArenaRecordNodeService,\n ArenaRecordNodesMap,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefExpressionFactory,\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 {\n ArenaAreaOfInterestProvider,\n ArenaCategoryItemProvider,\n ArenaTaxonProvider,\n} from './nodeDefExpressionEvaluator'\n\nexport type {\n ArenaNodeDef,\n ArenaNodeDefLayout,\n ArenaNodeDefMeta,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n ArenaNodeDefBoolean,\n ArenaNodeDefBooleanProps,\n ArenaNodeDefCode,\n ArenaNodeDefCodeLayout,\n ArenaNodeDefCodeProps,\n ArenaNodeDefCoordinate,\n ArenaNodeDefCoordinateProps,\n ArenaNodeDefDate,\n ArenaNodeDefDecimal,\n ArenaNodeDefDecimalProps,\n ArenaNodeDefEntity,\n ArenaNodeDefEntityChildPosition,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n ArenaNodeDefEntityProps,\n ArenaNodeDefPrintOrientation,\n ArenaNodeDefFile,\n ArenaNodeDefFileProps,\n ArenaNodeDefGeo,\n ArenaNodeDefGeoProps,\n ArenaNodeDefFormHeader,\n ArenaNodeDefFormHeaderProps,\n ArenaNodeDefInteger,\n ArenaNodeDefPropsAdvanced,\n ArenaNodeDefTaxon,\n ArenaNodeDefTaxonProps,\n ArenaNodeDefText,\n ArenaNodeDefTextProps,\n ArenaNodeDefTextLayout,\n ArenaNodeDefTime,\n ArenaNodeDefTimeProps,\n ArenaNodeDefCountExpression,\n ArenaNodeDefExpression,\n ArenaNodeDefExpressionFactoryParams,\n ArenaNodeDefMap,\n ArenaNodeDefService,\n ArenaNodeDefValidations,\n} from './nodeDef'\n\nexport {\n RecordNodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n ArenaAttributeValidatorParams,\n ArenaAttributesValidatorParams,\n ArenaRecordNodeCreateParams,\n ArenaRecordNodesUpdateParams,\n ArenaRecord,\n ArenaRecordExpressionContext,\n ArenaRecordExpressionEvaluationContext,\n ArenaRecordService,\n ArenaRecordStep,\n ArenaRecordUpdateOptions,\n ArenaRecordValidatorParams,\n ArenaSortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ArenaServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { ArenaSRS, ArenaSRSIndex } 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 ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependency,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageFactoryParams,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileFactoryParams,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveyRefData,\n ArenaSurveySecurity,\n ArenaSurveyService,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaTaxonomyService,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\n ArenaTaxonService,\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 { ArenaFileProcessorConstructorArgs, ArenaMutationOptions, ArenaParsedVersion } 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 ArenaDissocFieldValidationOptions,\n ArenaFieldValidator,\n ArenaValidation,\n ArenaValidationFields,\n ArenaValidationResult,\n ArenaValidationCounts,\n} from './validation'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,KAAK,GACN,MAAM,QAAQ,CAAA;AAwBf,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAejH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAY5E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAsBrB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,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H,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEjF,OAAO,EACL,MAAM,EACN,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACT,MAAM,SAAS,CAAA;AAIhB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAc,CAAA","sourcesContent":["export type { ArenaAppInfo } from './app'\n\nexport {\n Authorizer,\n AuthGroupName,\n createDefaultAuthGroups,\n UserStatus,\n Permission,\n UserTitle,\n UserFactory,\n Users,\n} from './auth'\nexport type {\n ArenaAuthGroup,\n ArenaUser,\n ArenaUserAuthGroup,\n ArenaUserAuthGroupProps,\n ArenaAuthToken,\n ArenaUserAuthTokenPayload,\n ArenaUserAuthTokenService,\n ArenaUserPrefs,\n ArenaUserPrefSurveys,\n ArenaUserProps,\n ArenaUserAuthRefreshToken,\n ArenaUserAuthRefreshTokenProps,\n ArenaUserAuthRefreshTokenPayload,\n ArenaUserService,\n ArenaUserTokenPayload,\n ArenaDownloadAuthTokenPayload,\n ArenaUserGroup,\n ArenaUserGroupProps,\n ArenaUserGroupQualifier,\n ArenaUserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryImportColumnType, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryImportSummary,\n ArenaCategoryImportSummaryColumn,\n ArenaCategoryItemService,\n ArenaCategoryLevelService,\n ArenaCategoryProps,\n ArenaCategoryService,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainService,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\n ArenaChainNodeDefService,\n ArenaChainNodeDefAggregate,\n ArenaChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, ArenaDictionary, ArenaFactory, ArenaI18n } from './common'\n\nexport type { ArenaFlatDataExportOptions, 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 { ArenaDataQuery, ArenaDataQuerySummary, ArenaDataQuerySummaryProps } 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 ArenaArrayExpression,\n ArenaBinaryExpression,\n ArenaCallExpression,\n ArenaCompoundExpression,\n ArenaConditionalExpression,\n ArenaExpressionContext,\n ArenaExpressionEvaluator,\n ArenaExpressionFunction,\n ArenaExpressionFunctions,\n ArenaAnyExpressionNode,\n ArenaExpressionNode,\n ArenaExpressionNodeEvaluatorConstructor,\n ArenaMemberExpression,\n ArenaIdentifierExpression,\n ArenaLiteralExpression,\n ArenaSequenceExpression,\n ArenaThisExpression,\n ArenaUnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ArenaExtraPropDef, ArenaExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type { ArenaAreaOfInterest, ArenaAreaOfInterestDescriptor, ArenaPoint } from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { ArenaJob, ArenaJobContext, ArenaJobEvent, ArenaJobSerialized, ArenaJobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { ArenaLabels } from './language'\n\nexport type { ArenaLogger } from './logger'\n\nexport type { ArenaMessage } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport {\n RecordNodeFactory,\n RecordNodeKeys,\n RecordNodeMetaKeys,\n RecordNodes,\n RecordNodeValueFormatter,\n RecordNodeValues,\n} from './node'\nexport type {\n ArenaRecordNode,\n ArenaRecordNodeMeta,\n ArenaRecordNodePointer,\n ArenaRecordNodeRefData,\n ArenaRecordNodeService,\n ArenaRecordNodesMap,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefExpressionFactory,\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 {\n ArenaAreaOfInterestProvider,\n ArenaCategoryItemProvider,\n ArenaTaxonProvider,\n} from './nodeDefExpressionEvaluator'\n\nexport type {\n ArenaNodeDef,\n ArenaAnyNodeDef,\n ArenaNodeDefLayout,\n ArenaNodeDefMeta,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n ArenaNodeDefBoolean,\n ArenaNodeDefBooleanProps,\n ArenaNodeDefCode,\n ArenaNodeDefCodeLayout,\n ArenaNodeDefCodeProps,\n ArenaNodeDefCoordinate,\n ArenaNodeDefCoordinateProps,\n ArenaNodeDefDate,\n ArenaNodeDefDecimal,\n ArenaNodeDefDecimalProps,\n ArenaNodeDefEntity,\n ArenaNodeDefEntityChildPosition,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n ArenaNodeDefEntityProps,\n ArenaNodeDefPrintOrientation,\n ArenaNodeDefFile,\n ArenaNodeDefFileProps,\n ArenaNodeDefGeo,\n ArenaNodeDefGeoProps,\n ArenaNodeDefFormHeader,\n ArenaNodeDefFormHeaderProps,\n ArenaNodeDefInteger,\n ArenaNodeDefPropsAdvanced,\n ArenaNodeDefTaxon,\n ArenaNodeDefTaxonProps,\n ArenaNodeDefText,\n ArenaNodeDefTextProps,\n ArenaNodeDefTextLayout,\n ArenaNodeDefTime,\n ArenaNodeDefTimeProps,\n ArenaNodeDefCountExpression,\n ArenaNodeDefExpression,\n ArenaNodeDefExpressionFactoryParams,\n ArenaNodeDefMap,\n ArenaNodeDefService,\n ArenaNodeDefValidations,\n} from './nodeDef'\n\nexport {\n RecordNodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n ArenaAttributeValidatorParams,\n ArenaAttributesValidatorParams,\n ArenaRecordNodeCreateParams,\n ArenaRecordNodesUpdateParams,\n ArenaRecord,\n ArenaRecordExpressionContext,\n ArenaRecordExpressionEvaluationContext,\n ArenaRecordService,\n ArenaRecordStep,\n ArenaRecordUpdateOptions,\n ArenaRecordValidatorParams,\n ArenaSortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ArenaServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { ArenaSRS, ArenaSRSIndex } 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 ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependency,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageFactoryParams,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileFactoryParams,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveyRefData,\n ArenaSurveySecurity,\n ArenaSurveyService,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaTaxonomyService,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\n ArenaTaxonService,\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 { ArenaFileProcessorConstructorArgs, ArenaMutationOptions, ArenaParsedVersion } 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 ArenaDissocFieldValidationOptions,\n ArenaFieldValidator,\n ArenaValidation,\n ArenaValidationFields,\n ArenaValidationResult,\n ArenaValidationCounts,\n} from './validation'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodePointer.js","sourceRoot":"","sources":["../../../src/node/nodePointer.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaRecordNode } from './node'\nimport {
|
|
1
|
+
{"version":3,"file":"nodePointer.js","sourceRoot":"","sources":["../../../src/node/nodePointer.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaRecordNode } from './node'\nimport { ArenaAnyNodeDef } from '../nodeDef'\n\nexport interface ArenaRecordNodePointer {\n nodeCtx: ArenaRecordNode\n nodeDef: ArenaAnyNodeDef\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeValueFormatter.js","sourceRoot":"","sources":["../../../src/node/nodeValueFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"nodeValueFormatter.js","sourceRoot":"","sources":["../../../src/node/nodeValueFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,EAA0D,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC1G,OAAO,EAAe,OAAO,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,mBAAmB,GAAG,CAAC,MAI5B,EAAiC,EAAE;;;IAClC,MAAM,EAAE,MAAM,EAAE,IAAI,EA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CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;AACtH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,MAAM;CACP,CAAA","sourcesContent":["import { ArenaCategoryItem, CategoryItems } from '../category'\nimport { LanguageCode } from '../language'\nimport { ArenaAnyNodeDef, ArenaNodeDefCode, ArenaNodeDefDecimal, NodeDefs, NodeDefType } from '../nodeDef'\nimport { ArenaSurvey, Surveys } from '../survey'\nimport { Taxa } from '../taxonomy'\nimport { DateFormats, Dates, Numbers, Objects, Strings } from '../utils'\nimport { ArenaRecordNode } from './node'\nimport { RecordNodeValues } from './nodeValues'\n\nconst extractCategoryItem = (params: {\n survey: ArenaSurvey\n node?: ArenaRecordNode\n value: any\n}): ArenaCategoryItem | undefined => {\n const { survey, node, value } = params\n\n const itemUuid = RecordNodeValues.getValueItemUuid(value)\n if (!itemUuid) return undefined\n\n const item = node?.refData?.categoryItem ?? Surveys.getCategoryItemByUuid({ survey, itemUuid })\n // check the validity of the reference data category item\n return item?.props && Objects.isNotEmpty(CategoryItems.getCode(item)) ? item : undefined\n}\n\ntype FormatParams = {\n survey: ArenaSurvey\n cycle: string\n nodeDef: ArenaAnyNodeDef\n node?: ArenaRecordNode\n value: any\n showLabel?: boolean\n quoteLabels?: boolean\n lang?: LanguageCode\n}\n\nconst formatters: { [key in NodeDefType]?: (params: FormatParams) => any } = {\n [NodeDefType.code]: (params: FormatParams) => {\n const { survey, cycle, nodeDef, node, value, showLabel, quoteLabels, lang } = params\n\n if (!showLabel) {\n // item code already inside value, no need to get category item\n const itemCode = RecordNodeValues.getValueCode(value)\n if (!Objects.isEmpty(itemCode)) return itemCode\n }\n const categoryItem = extractCategoryItem({ survey, node, value })\n if (!categoryItem) return null\n\n if (showLabel) {\n let result\n if (NodeDefs.isCodeShown(cycle)(nodeDef as ArenaNodeDefCode)) {\n result = CategoryItems.getLabelWithCode(categoryItem, lang!)\n } else {\n result = CategoryItems.getLabel(categoryItem, lang!, true)\n }\n return quoteLabels ? Strings.quote(result) : result\n }\n return CategoryItems.getCode(categoryItem)\n },\n [NodeDefType.date]: (params: FormatParams) => {\n const { value } = params\n const dateParsed = Dates.parseISO(value)\n return Dates.format(dateParsed, DateFormats.dateDisplay)\n },\n [NodeDefType.decimal]: (params: FormatParams) => {\n const { value, nodeDef } = params\n return Numbers.formatDecimal(value, NodeDefs.getMaxNumberDecimalDigits(nodeDef as ArenaNodeDefDecimal))\n },\n [NodeDefType.integer]: (params: FormatParams) => {\n const { value } = params\n return Numbers.formatInteger(Number(value))\n },\n [NodeDefType.taxon]: (params: FormatParams) => {\n const { survey, value, showLabel } = params\n const taxonUuid = RecordNodeValues.getValueTaxonUuid(value)\n if (!taxonUuid) return null\n const taxon = Surveys.getTaxonByUuid({ survey, taxonUuid })\n if (!taxon) return null\n return showLabel ? Taxa.getScientificName(taxon) : Taxa.getCode(taxon)\n },\n [NodeDefType.text]: (params: FormatParams) => {\n const { value, quoteLabels } = params\n return quoteLabels ? Strings.quote(value) : value\n },\n}\n\nconst format = (params: FormatParams) => {\n const { nodeDef, value } = params\n if (Objects.isEmpty(value)) {\n return ''\n }\n const formatter = formatters[NodeDefs.getType(nodeDef)]\n const formatValue = (v: any) => (formatter ? formatter({ ...params, value: v }) : v)\n\n return NodeDefs.isMultiple(nodeDef) && Array.isArray(value) ? value.map(formatValue).join(', ') : formatValue(value)\n}\n\nexport const RecordNodeValueFormatter = {\n format,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeValues.js","sourceRoot":"","sources":["../../../src/node/nodeValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAc,YAAY,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EA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AAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5E,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,SAA2C,CAAA;QAEjE,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAA;QAE3B,OAAO,YAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB;IAChB,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IAEd,gBAAgB;IAChB,WAAW;IAEX,aAAa;IACb,eAAe;IAEf,OAAO;IACP,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAEhB,OAAO;IACP,WAAW;IACX,YAAY;IACZ,UAAU;IAEV,OAAO;IACP,WAAW;IACX,qBAAqB;IACrB,WAAW;IACX,WAAW;IAEX,QAAQ;IACR,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,iBAAiB;IACjB,sBAAsB;IACtB,qBAAqB;IACrB,0BAA0B;IAE1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,cAAc;IAEd,QAAQ;IACR,YAAY;CACb,CAAA","sourcesContent":["import { CategoryItems } from '../category'\nimport { ArenaPoint, PointFactory } from '../geo'\nimport { ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefProps, NodeDefType } from '../nodeDef'\nimport { ArenaRecord, Records } from '../record'\nimport { ArenaSurvey, Surveys } from '../survey'\nimport { DateFormats, Dates, Objects } from '../utils'\nimport { ArenaRecordNode } from './node'\nimport { ArenaRecordNodeValueCoordinate } from './nodeValue/coordinate'\nimport {\n ValuePropsCode,\n ValuePropsCoordinate,\n ValuePropsDate,\n ValuePropsFile,\n ValuePropsTaxon,\n ValuePropsTime,\n} from './nodeValueProps'\n\n/**\n * Props of node value indexed by node def type.\n * The node definitions here are only the ones of \"composite\" attributes.\n */\nexport const ValuePropsByType: { [key in NodeDefType]: { [key: string]: string } | null } = {\n [NodeDefType.boolean]: null,\n [NodeDefType.code]: ValuePropsCode,\n [NodeDefType.coordinate]: ValuePropsCoordinate,\n [NodeDefType.date]: ValuePropsDate,\n [NodeDefType.decimal]: null,\n [NodeDefType.geo]: null,\n [NodeDefType.entity]: null,\n [NodeDefType.file]: ValuePropsFile,\n [NodeDefType.integer]: null,\n [NodeDefType.taxon]: ValuePropsTaxon,\n [NodeDefType.time]: ValuePropsTime,\n [NodeDefType.text]: null,\n // layout elements\n [NodeDefType.formHeader]: null,\n}\n\nconst getValuePropRaw = (params: { value: any; prop: string; defaultValue?: any }): any => {\n const { value, prop, defaultValue } = params\n const valueProp = value?.[prop]\n return valueProp === undefined ? defaultValue : valueProp\n}\n\nconst getNodeValuePropRaw = (params: { node: ArenaRecordNode; prop: string; defaultValue?: any }): any => {\n const { node, prop, defaultValue } = params\n return getValuePropRaw({ value: node.value, prop, defaultValue })\n}\n\n// Code\nconst newCodeValue = (params: { itemUuid: string }) => {\n const { itemUuid } = params\n return { [ValuePropsCode[ValuePropsCode.itemUuid]]: itemUuid }\n}\n\nconst getItemUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsCode[ValuePropsCode.itemUuid] })\n\nconst getValueCode = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsCode[ValuePropsCode.code] })\n\nconst getValueItemUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsCode[ValuePropsCode.itemUuid] })\n\nconst getDateTimePart = (params: { node: ArenaRecordNode; index: number; separator: string }): number => {\n const { node, index, separator } = params\n return Number((node.value ?? '').split(separator)[index]?.trim())\n}\n\n// Date\nconst getDatePart =\n (index: number) =>\n (node: ArenaRecordNode): number =>\n getDateTimePart({ node, index, separator: '-' })\nconst getDateYear = getDatePart(0)\nconst getDateMonth = getDatePart(1)\nconst getDateDay = getDatePart(2)\n\nconst _datePropGetters: { [key in ValuePropsDate]: (node: ArenaRecordNode) => number } = {\n [ValuePropsDate.day]: getDateDay,\n [ValuePropsDate.month]: getDateMonth,\n [ValuePropsDate.year]: getDateYear,\n}\n\n// File\nconst getFileName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileName })\nconst getFileNameCalculated = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileNameCalculated })\nconst getFileSize = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileSize })\nconst getFileUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileUuid })\n\n// Taxon\nconst getTaxonUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.taxonUuid] })\nconst getValueTaxonUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.taxonUuid] })\nconst getScientificName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.scientificName] })\nconst getValueScientificName = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.scientificName] })\nconst getVernacularName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularName] })\nconst getValueVernacularName = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularName] })\nconst getVernacularNameUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularNameUuid] })\nconst getValueVernacularNameUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularNameUuid] })\n\n// Time\nconst _getTimePart =\n (index: number) =>\n (node: ArenaRecordNode): number =>\n getDateTimePart({ node, index, separator: ':' })\nconst getTimeHour = _getTimePart(0)\nconst getTimeMinute = _getTimePart(1)\nconst getTimeSeconds = (node: ArenaRecordNode): number => {\n const parts = (node.value ?? '').split(':')\n return parts.length > 2 ? _getTimePart(2)(node) : 0\n}\n\nconst _timePropGetters: { [key in ValuePropsTime]: any } = {\n [ValuePropsTime.hour]: getTimeHour,\n [ValuePropsTime.minute]: getTimeMinute,\n [ValuePropsTime.seconds]: getTimeSeconds,\n}\n\nconst _valuePropGetters: { [key in NodeDefType]?: (prop: string) => (node: ArenaRecordNode) => number } = {\n [NodeDefType.date]: (prop: string) => _datePropGetters[ValuePropsDate[prop as keyof typeof ValuePropsDate]],\n [NodeDefType.time]: (prop: string) => _timePropGetters[ValuePropsTime[prop as keyof typeof ValuePropsTime]],\n}\n\nconst isValueProp = (params: { nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>; prop: string }): boolean => {\n const { nodeDef, prop } = params\n return Object.values(ValuePropsByType[nodeDef.type] ?? {}).includes(prop)\n}\n\nconst getNodeValueProp = (params: {\n nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>\n node: ArenaRecordNode\n prop: string\n}): any => {\n const { nodeDef, node, prop } = params\n const propGetter: any = _valuePropGetters[nodeDef.type]\n return propGetter ? propGetter(prop)(node) : getNodeValuePropRaw({ node, prop })\n}\n\n// value compare\n\nconst singlePropValueEqualComparator = (params: NodeValuesCompareParams): boolean => {\n const { value, valueSearch } = params\n return value === valueSearch || String(value) === String(valueSearch)\n}\n\nconst extractCategoryItemUuidFromValue = (params: NodeValuesCompareParams): string | undefined => {\n const { survey, nodeDef, record, parentNode, value } = params\n const valueItemUuid = getValueItemUuid(value)\n if (valueItemUuid) {\n return valueItemUuid\n }\n // find itemUuid by code\n const valueCode = getValueCode(value)\n if (Objects.isEmpty(valueCode)) return undefined\n\n const nodeDefCode = nodeDef as ArenaNodeDefCode\n const code = valueCode!\n const categoryUuid = nodeDefCode.props?.categoryUuid\n const levelIndex = Surveys.getNodeDefCategoryLevelIndex({ survey, nodeDef: nodeDefCode })\n if (levelIndex === 0) {\n return Surveys.getCategoryItemUuidByCode({ survey, categoryUuid, parentItemUuid: undefined, code })\n }\n if (!record || !parentNode) return undefined\n\n const parentCodeAttribute = Records.getParentCodeAttribute(parentNode, nodeDef as ArenaNodeDefCode)(record)\n if (!parentCodeAttribute) return undefined\n\n const parentItemUuid = getItemUuid(parentCodeAttribute)\n if (!parentItemUuid) return undefined\n\n return Surveys.getCategoryItemUuidByCode({\n survey,\n categoryUuid,\n parentItemUuid,\n code,\n })\n}\n\nconst extractCategoryItemCodeFromValue = (params: { survey: ArenaSurvey; value: any }): string | undefined => {\n const { survey, value } = params\n const itemUuid = getValueItemUuid(value)\n if (itemUuid) {\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid })\n return item ? CategoryItems.getCode(item) : undefined\n }\n return getValueCode(value)\n}\n\ntype DateTimeFormats = { formatsSource: DateFormats[]; formatTo: DateFormats }\n\nconst dateFormats: DateTimeFormats = {\n formatsSource: [DateFormats.dateDisplay, DateFormats.dateStorage],\n formatTo: DateFormats.dateStorage,\n}\n\nconst timeFormats: DateTimeFormats = {\n formatsSource: [DateFormats.timeStorage, DateFormats.timeWithSeconds],\n formatTo: DateFormats.timeWithSeconds,\n}\n\nconst toDateTime = (params: DateTimeFormats & { value: any }) => {\n const { formatsSource, formatTo, value } = params\n if (value instanceof Date) {\n return Dates.format(value, formatTo)\n }\n const formatFrom = formatsSource.find((format) => Dates.isValidDateInFormat(value, format))\n return formatFrom ? Dates.convertDate({ dateStr: value, formatFrom, formatTo }) : null\n}\n\nconst dateTimeComparator =\n (formats: DateTimeFormats) =>\n (paramsComparator: NodeValuesCompareParams): boolean => {\n const { value, valueSearch } = paramsComparator\n const dateTime = toDateTime({ ...formats, value })\n const dateTimeSearch = toDateTime({ ...formats, value: valueSearch })\n return !!dateTime && !!dateTimeSearch && dateTime === dateTimeSearch\n }\n\nconst valueComparatorByNodeDefType: { [key in NodeDefType]?: (params: NodeValuesCompareParams) => boolean } = {\n [NodeDefType.boolean]: singlePropValueEqualComparator,\n [NodeDefType.code]: (params: NodeValuesCompareParams): boolean => {\n const { survey, record, value, valueSearch, strict } = params\n if (!strict || !record) {\n // compare just codes (record not available, tricky to find the \"correct\" category item without knowing its parent item)\n const code = extractCategoryItemCodeFromValue({ survey, value })\n const codeSearch = extractCategoryItemCodeFromValue({ survey, value: valueSearch })\n return !!code && !!codeSearch && code === codeSearch\n }\n const itemUuid = extractCategoryItemUuidFromValue(params)\n const itemUuidSearch = extractCategoryItemUuidFromValue({\n ...params,\n value: valueSearch,\n })\n return !!itemUuidSearch && !!itemUuid && itemUuidSearch === itemUuid\n },\n [NodeDefType.coordinate]: (params: NodeValuesCompareParams) => {\n const { value, valueSearch } = params\n return Objects.isEqual(value, valueSearch)\n },\n [NodeDefType.date]: dateTimeComparator(dateFormats),\n [NodeDefType.decimal]: singlePropValueEqualComparator,\n [NodeDefType.integer]: singlePropValueEqualComparator,\n [NodeDefType.taxon]: ({ value, valueSearch }) => {\n if (value === valueSearch) return true\n if (!value) return false\n if (!valueSearch) return false\n return value[ValuePropsTaxon.taxonUuid] === valueSearch[ValuePropsTaxon.taxonUuid]\n },\n [NodeDefType.text]: singlePropValueEqualComparator,\n [NodeDefType.time]: dateTimeComparator(timeFormats),\n}\n\ninterface NodeValuesCompareParams {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<NodeDefType, any>\n value: any\n valueSearch: any\n record?: ArenaRecord\n parentNode?: ArenaRecordNode\n strict?: boolean\n}\n\nconst isValueEqual = (params: NodeValuesCompareParams): boolean => {\n const { survey, nodeDef, value, valueSearch, record = undefined, parentNode = undefined, strict = false } = params\n if (value === valueSearch) return true\n if (Objects.isEmpty(value) || Objects.isEmpty(valueSearch)) return false\n\n const valueComparator = valueComparatorByNodeDefType[nodeDef.type]\n if (!valueComparator) {\n return Objects.isEqual(value, valueSearch)\n }\n return valueComparator({ survey, nodeDef, record, parentNode, value, valueSearch, strict })\n}\n\nconst primitiveTypes = new Set(['string', 'number', 'boolean', 'undefined', 'bigint'])\n\n// token of a primitive value, equal for strictly equal (===) values only (distinguishes \"1\" from 1);\n// undefined for non primitive values and NaN (not equal to itself)\nconst toPrimitiveToken = (value: any): string | undefined =>\n (value === null || primitiveTypes.has(typeof value)) && !Number.isNaN(value)\n ? `${typeof value}:${String(value)}`\n : undefined\n\nconst dateTimeKeyExtractor =\n (formats: DateTimeFormats) =>\n ({ value }: { value: any }): string | undefined =>\n toDateTime({ ...formats, value }) || undefined\n\nconst valueEqualityKeyByNodeDefType: {\n [key in NodeDefType]?: (params: { survey: ArenaSurvey; value: any }) => string | undefined\n} = {\n [NodeDefType.boolean]: ({ value }) => String(value),\n [NodeDefType.code]: ({ survey, value }) => {\n const code = extractCategoryItemCodeFromValue({ survey, value })\n return code ? toPrimitiveToken(code) : undefined\n },\n [NodeDefType.date]: dateTimeKeyExtractor(dateFormats),\n [NodeDefType.decimal]: ({ value }) => String(value),\n [NodeDefType.integer]: ({ value }) => String(value),\n [NodeDefType.taxon]: ({ value }) => toPrimitiveToken(value[ValuePropsTaxon.taxonUuid]),\n [NodeDefType.text]: ({ value }) => String(value),\n [NodeDefType.time]: dateTimeKeyExtractor(timeFormats),\n}\n\n/**\n * Returns a key such that two values have the same key if and only if they are equal according to isValueEqual\n * (not strict, without record), or undefined if such a key cannot be built for the value (e.g. NaN, empty objects, code values\n * without code, invalid dates, coordinates): such values must be compared with isValueEqual.\n * Not exported in RecordNodeValues: internal, used to look up duplicate values without comparing every pair of values.\n */\nexport const getValueEqualityKey = (params: {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<NodeDefType, any>\n value: any\n}): string | undefined => {\n const { survey, nodeDef, value } = params\n if (Objects.isEmpty(value)) {\n // empty values are equal only if identical (===)\n const token = toPrimitiveToken(value)\n return token === undefined ? undefined : `empty:${token}`\n }\n const keyExtractor = valueEqualityKeyByNodeDefType[nodeDef.type]\n const key = keyExtractor?.({ survey, value })\n return key === undefined ? undefined : `value:${key}`\n}\n\nconst getValueAsPoint = (params: { survey: ArenaSurvey; node: ArenaRecordNode }): ArenaPoint | null => {\n const { survey, node } = params\n const nodeValue = node?.value\n\n if (!nodeValue) return null\n\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (nodeDef.type === NodeDefType.coordinate) {\n const { x, y, srs } = nodeValue as ArenaRecordNodeValueCoordinate\n\n const srsObject = Surveys.getSRSByCode(srs)(survey)\n if (!srsObject) return null\n\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n\nexport const RecordNodeValues = {\n ValuePropsByType,\n ValuePropsCode,\n ValuePropsCoordinate,\n ValuePropsDate,\n ValuePropsFile,\n ValuePropsTaxon,\n ValuePropsTime,\n\n getNodeValueProp,\n isValueProp,\n\n // coordinate\n getValueAsPoint,\n\n // code\n newCodeValue,\n getItemUuid,\n getValueCode,\n getValueItemUuid,\n\n // date\n getDateYear,\n getDateMonth,\n getDateDay,\n\n // file\n getFileName,\n getFileNameCalculated,\n getFileSize,\n getFileUuid,\n\n // taxon\n getTaxonUuid,\n getValueTaxonUuid,\n getScientificName,\n getValueScientificName,\n getVernacularName,\n getValueVernacularName,\n getVernacularNameUuid,\n getValueVernacularNameUuid,\n\n // time\n getTimeHour,\n getTimeMinute,\n getTimeSeconds,\n\n // utils\n isValueEqual,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeValues.js","sourceRoot":"","sources":["../../../src/node/nodeValues.ts"],"names":[],"m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AJ,IAAI,CAAE,KAAK,CAAA;IAE7B,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAE3B,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;IAC5E,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,SAA2C,CAAA;QAEjE,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAA;QAE3B,OAAO,YAAY,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB;IAChB,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,cAAc;IACd,eAAe;IACf,cAAc;IAEd,gBAAgB;IAChB,WAAW;IAEX,aAAa;IACb,eAAe;IAEf,OAAO;IACP,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAEhB,OAAO;IACP,WAAW;IACX,YAAY;IACZ,UAAU;IAEV,OAAO;IACP,WAAW;IACX,qBAAqB;IACrB,WAAW;IACX,WAAW;IAEX,QAAQ;IACR,YAAY;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,iBAAiB;IACjB,sBAAsB;IACtB,qBAAqB;IACrB,0BAA0B;IAE1B,OAAO;IACP,WAAW;IACX,aAAa;IACb,cAAc;IAEd,QAAQ;IACR,YAAY;CACb,CAAA","sourcesContent":["import { CategoryItems } from '../category'\nimport { ArenaPoint, PointFactory } from '../geo'\nimport { ArenaAnyNodeDef, ArenaNodeDef, ArenaNodeDefCode, NodeDefType } from '../nodeDef'\nimport { ArenaRecord, Records } from '../record'\nimport { ArenaSurvey, Surveys } from '../survey'\nimport { DateFormats, Dates, Objects } from '../utils'\nimport { ArenaRecordNode } from './node'\nimport { ArenaRecordNodeValueCoordinate } from './nodeValue/coordinate'\nimport {\n ValuePropsCode,\n ValuePropsCoordinate,\n ValuePropsDate,\n ValuePropsFile,\n ValuePropsTaxon,\n ValuePropsTime,\n} from './nodeValueProps'\n\n/**\n * Props of node value indexed by node def type.\n * The node definitions here are only the ones of \"composite\" attributes.\n */\nexport const ValuePropsByType: { [key in NodeDefType]: { [key: string]: string } | null } = {\n [NodeDefType.boolean]: null,\n [NodeDefType.code]: ValuePropsCode,\n [NodeDefType.coordinate]: ValuePropsCoordinate,\n [NodeDefType.date]: ValuePropsDate,\n [NodeDefType.decimal]: null,\n [NodeDefType.geo]: null,\n [NodeDefType.entity]: null,\n [NodeDefType.file]: ValuePropsFile,\n [NodeDefType.integer]: null,\n [NodeDefType.taxon]: ValuePropsTaxon,\n [NodeDefType.time]: ValuePropsTime,\n [NodeDefType.text]: null,\n // layout elements\n [NodeDefType.formHeader]: null,\n}\n\nconst getValuePropRaw = (params: { value: any; prop: string; defaultValue?: any }): any => {\n const { value, prop, defaultValue } = params\n const valueProp = value?.[prop]\n return valueProp === undefined ? defaultValue : valueProp\n}\n\nconst getNodeValuePropRaw = (params: { node: ArenaRecordNode; prop: string; defaultValue?: any }): any => {\n const { node, prop, defaultValue } = params\n return getValuePropRaw({ value: node.value, prop, defaultValue })\n}\n\n// Code\nconst newCodeValue = (params: { itemUuid: string }) => {\n const { itemUuid } = params\n return { [ValuePropsCode[ValuePropsCode.itemUuid]]: itemUuid }\n}\n\nconst getItemUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsCode[ValuePropsCode.itemUuid] })\n\nconst getValueCode = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsCode[ValuePropsCode.code] })\n\nconst getValueItemUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsCode[ValuePropsCode.itemUuid] })\n\nconst getDateTimePart = (params: { node: ArenaRecordNode; index: number; separator: string }): number => {\n const { node, index, separator } = params\n return Number((node.value ?? '').split(separator)[index]?.trim())\n}\n\n// Date\nconst getDatePart =\n (index: number) =>\n (node: ArenaRecordNode): number =>\n getDateTimePart({ node, index, separator: '-' })\nconst getDateYear = getDatePart(0)\nconst getDateMonth = getDatePart(1)\nconst getDateDay = getDatePart(2)\n\nconst _datePropGetters: { [key in ValuePropsDate]: (node: ArenaRecordNode) => number } = {\n [ValuePropsDate.day]: getDateDay,\n [ValuePropsDate.month]: getDateMonth,\n [ValuePropsDate.year]: getDateYear,\n}\n\n// File\nconst getFileName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileName })\nconst getFileNameCalculated = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileNameCalculated })\nconst getFileSize = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileSize })\nconst getFileUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsFile.fileUuid })\n\n// Taxon\nconst getTaxonUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.taxonUuid] })\nconst getValueTaxonUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.taxonUuid] })\nconst getScientificName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.scientificName] })\nconst getValueScientificName = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.scientificName] })\nconst getVernacularName = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularName] })\nconst getValueVernacularName = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularName] })\nconst getVernacularNameUuid = (node: ArenaRecordNode): string | undefined =>\n getNodeValuePropRaw({ node, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularNameUuid] })\nconst getValueVernacularNameUuid = (value: any): string | undefined =>\n getValuePropRaw({ value, prop: ValuePropsTaxon[ValuePropsTaxon.vernacularNameUuid] })\n\n// Time\nconst _getTimePart =\n (index: number) =>\n (node: ArenaRecordNode): number =>\n getDateTimePart({ node, index, separator: ':' })\nconst getTimeHour = _getTimePart(0)\nconst getTimeMinute = _getTimePart(1)\nconst getTimeSeconds = (node: ArenaRecordNode): number => {\n const parts = (node.value ?? '').split(':')\n return parts.length > 2 ? _getTimePart(2)(node) : 0\n}\n\nconst _timePropGetters: { [key in ValuePropsTime]: any } = {\n [ValuePropsTime.hour]: getTimeHour,\n [ValuePropsTime.minute]: getTimeMinute,\n [ValuePropsTime.seconds]: getTimeSeconds,\n}\n\nconst _valuePropGetters: { [key in NodeDefType]?: (prop: string) => (node: ArenaRecordNode) => number } = {\n [NodeDefType.date]: (prop: string) => _datePropGetters[ValuePropsDate[prop as keyof typeof ValuePropsDate]],\n [NodeDefType.time]: (prop: string) => _timePropGetters[ValuePropsTime[prop as keyof typeof ValuePropsTime]],\n}\n\nconst isValueProp = (params: { nodeDef: ArenaAnyNodeDef; prop: string }): boolean => {\n const { nodeDef, prop } = params\n return Object.values(ValuePropsByType[nodeDef.type] ?? {}).includes(prop)\n}\n\nconst getNodeValueProp = (params: { nodeDef: ArenaAnyNodeDef; node: ArenaRecordNode; prop: string }): any => {\n const { nodeDef, node, prop } = params\n const propGetter: any = _valuePropGetters[nodeDef.type]\n return propGetter ? propGetter(prop)(node) : getNodeValuePropRaw({ node, prop })\n}\n\n// value compare\n\nconst singlePropValueEqualComparator = (params: NodeValuesCompareParams): boolean => {\n const { value, valueSearch } = params\n return value === valueSearch || String(value) === String(valueSearch)\n}\n\nconst extractCategoryItemUuidFromValue = (params: NodeValuesCompareParams): string | undefined => {\n const { survey, nodeDef, record, parentNode, value } = params\n const valueItemUuid = getValueItemUuid(value)\n if (valueItemUuid) {\n return valueItemUuid\n }\n // find itemUuid by code\n const valueCode = getValueCode(value)\n if (Objects.isEmpty(valueCode)) return undefined\n\n const nodeDefCode = nodeDef as ArenaNodeDefCode\n const code = valueCode!\n const categoryUuid = nodeDefCode.props?.categoryUuid\n const levelIndex = Surveys.getNodeDefCategoryLevelIndex({ survey, nodeDef: nodeDefCode })\n if (levelIndex === 0) {\n return Surveys.getCategoryItemUuidByCode({ survey, categoryUuid, parentItemUuid: undefined, code })\n }\n if (!record || !parentNode) return undefined\n\n const parentCodeAttribute = Records.getParentCodeAttribute(parentNode, nodeDef as ArenaNodeDefCode)(record)\n if (!parentCodeAttribute) return undefined\n\n const parentItemUuid = getItemUuid(parentCodeAttribute)\n if (!parentItemUuid) return undefined\n\n return Surveys.getCategoryItemUuidByCode({\n survey,\n categoryUuid,\n parentItemUuid,\n code,\n })\n}\n\nconst extractCategoryItemCodeFromValue = (params: { survey: ArenaSurvey; value: any }): string | undefined => {\n const { survey, value } = params\n const itemUuid = getValueItemUuid(value)\n if (itemUuid) {\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid })\n return item ? CategoryItems.getCode(item) : undefined\n }\n return getValueCode(value)\n}\n\ntype DateTimeFormats = { formatsSource: DateFormats[]; formatTo: DateFormats }\n\nconst dateFormats: DateTimeFormats = {\n formatsSource: [DateFormats.dateDisplay, DateFormats.dateStorage],\n formatTo: DateFormats.dateStorage,\n}\n\nconst timeFormats: DateTimeFormats = {\n formatsSource: [DateFormats.timeStorage, DateFormats.timeWithSeconds],\n formatTo: DateFormats.timeWithSeconds,\n}\n\nconst toDateTime = (params: DateTimeFormats & { value: any }) => {\n const { formatsSource, formatTo, value } = params\n if (value instanceof Date) {\n return Dates.format(value, formatTo)\n }\n const formatFrom = formatsSource.find((format) => Dates.isValidDateInFormat(value, format))\n return formatFrom ? Dates.convertDate({ dateStr: value, formatFrom, formatTo }) : null\n}\n\nconst dateTimeComparator =\n (formats: DateTimeFormats) =>\n (paramsComparator: NodeValuesCompareParams): boolean => {\n const { value, valueSearch } = paramsComparator\n const dateTime = toDateTime({ ...formats, value })\n const dateTimeSearch = toDateTime({ ...formats, value: valueSearch })\n return !!dateTime && !!dateTimeSearch && dateTime === dateTimeSearch\n }\n\nconst valueComparatorByNodeDefType: { [key in NodeDefType]?: (params: NodeValuesCompareParams) => boolean } = {\n [NodeDefType.boolean]: singlePropValueEqualComparator,\n [NodeDefType.code]: (params: NodeValuesCompareParams): boolean => {\n const { survey, record, value, valueSearch, strict } = params\n if (!strict || !record) {\n // compare just codes (record not available, tricky to find the \"correct\" category item without knowing its parent item)\n const code = extractCategoryItemCodeFromValue({ survey, value })\n const codeSearch = extractCategoryItemCodeFromValue({ survey, value: valueSearch })\n return !!code && !!codeSearch && code === codeSearch\n }\n const itemUuid = extractCategoryItemUuidFromValue(params)\n const itemUuidSearch = extractCategoryItemUuidFromValue({\n ...params,\n value: valueSearch,\n })\n return !!itemUuidSearch && !!itemUuid && itemUuidSearch === itemUuid\n },\n [NodeDefType.coordinate]: (params: NodeValuesCompareParams) => {\n const { value, valueSearch } = params\n return Objects.isEqual(value, valueSearch)\n },\n [NodeDefType.date]: dateTimeComparator(dateFormats),\n [NodeDefType.decimal]: singlePropValueEqualComparator,\n [NodeDefType.integer]: singlePropValueEqualComparator,\n [NodeDefType.taxon]: ({ value, valueSearch }) => {\n if (value === valueSearch) return true\n if (!value) return false\n if (!valueSearch) return false\n return value[ValuePropsTaxon.taxonUuid] === valueSearch[ValuePropsTaxon.taxonUuid]\n },\n [NodeDefType.text]: singlePropValueEqualComparator,\n [NodeDefType.time]: dateTimeComparator(timeFormats),\n}\n\ninterface NodeValuesCompareParams {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<NodeDefType, any>\n value: any\n valueSearch: any\n record?: ArenaRecord\n parentNode?: ArenaRecordNode\n strict?: boolean\n}\n\nconst isValueEqual = (params: NodeValuesCompareParams): boolean => {\n const { survey, nodeDef, value, valueSearch, record = undefined, parentNode = undefined, strict = false } = params\n if (value === valueSearch) return true\n if (Objects.isEmpty(value) || Objects.isEmpty(valueSearch)) return false\n\n const valueComparator = valueComparatorByNodeDefType[nodeDef.type]\n if (!valueComparator) {\n return Objects.isEqual(value, valueSearch)\n }\n return valueComparator({ survey, nodeDef, record, parentNode, value, valueSearch, strict })\n}\n\nconst primitiveTypes = new Set(['string', 'number', 'boolean', 'undefined', 'bigint'])\n\n// token of a primitive value, equal for strictly equal (===) values only (distinguishes \"1\" from 1);\n// undefined for non primitive values and NaN (not equal to itself)\nconst toPrimitiveToken = (value: any): string | undefined =>\n (value === null || primitiveTypes.has(typeof value)) && !Number.isNaN(value)\n ? `${typeof value}:${String(value)}`\n : undefined\n\nconst dateTimeKeyExtractor =\n (formats: DateTimeFormats) =>\n ({ value }: { value: any }): string | undefined =>\n toDateTime({ ...formats, value }) || undefined\n\nconst valueEqualityKeyByNodeDefType: {\n [key in NodeDefType]?: (params: { survey: ArenaSurvey; value: any }) => string | undefined\n} = {\n [NodeDefType.boolean]: ({ value }) => String(value),\n [NodeDefType.code]: ({ survey, value }) => {\n const code = extractCategoryItemCodeFromValue({ survey, value })\n return code ? toPrimitiveToken(code) : undefined\n },\n [NodeDefType.date]: dateTimeKeyExtractor(dateFormats),\n [NodeDefType.decimal]: ({ value }) => String(value),\n [NodeDefType.integer]: ({ value }) => String(value),\n [NodeDefType.taxon]: ({ value }) => toPrimitiveToken(value[ValuePropsTaxon.taxonUuid]),\n [NodeDefType.text]: ({ value }) => String(value),\n [NodeDefType.time]: dateTimeKeyExtractor(timeFormats),\n}\n\n/**\n * Returns a key such that two values have the same key if and only if they are equal according to isValueEqual\n * (not strict, without record), or undefined if such a key cannot be built for the value (e.g. NaN, empty objects, code values\n * without code, invalid dates, coordinates): such values must be compared with isValueEqual.\n * Not exported in RecordNodeValues: internal, used to look up duplicate values without comparing every pair of values.\n */\nexport const getValueEqualityKey = (params: {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<NodeDefType, any>\n value: any\n}): string | undefined => {\n const { survey, nodeDef, value } = params\n if (Objects.isEmpty(value)) {\n // empty values are equal only if identical (===)\n const token = toPrimitiveToken(value)\n return token === undefined ? undefined : `empty:${token}`\n }\n const keyExtractor = valueEqualityKeyByNodeDefType[nodeDef.type]\n const key = keyExtractor?.({ survey, value })\n return key === undefined ? undefined : `value:${key}`\n}\n\nconst getValueAsPoint = (params: { survey: ArenaSurvey; node: ArenaRecordNode }): ArenaPoint | null => {\n const { survey, node } = params\n const nodeValue = node?.value\n\n if (!nodeValue) return null\n\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid })\n if (nodeDef.type === NodeDefType.coordinate) {\n const { x, y, srs } = nodeValue as ArenaRecordNodeValueCoordinate\n\n const srsObject = Surveys.getSRSByCode(srs)(survey)\n if (!srsObject) return null\n\n return PointFactory.createInstance({ srs, x, y })\n }\n return null\n}\n\nexport const RecordNodeValues = {\n ValuePropsByType,\n ValuePropsCode,\n ValuePropsCoordinate,\n ValuePropsDate,\n ValuePropsFile,\n ValuePropsTaxon,\n ValuePropsTime,\n\n getNodeValueProp,\n isValueProp,\n\n // coordinate\n getValueAsPoint,\n\n // code\n newCodeValue,\n getItemUuid,\n getValueCode,\n getValueItemUuid,\n\n // date\n getDateYear,\n getDateMonth,\n getDateDay,\n\n // file\n getFileName,\n getFileNameCalculated,\n getFileSize,\n getFileUuid,\n\n // taxon\n getTaxonUuid,\n getValueTaxonUuid,\n getScientificName,\n getValueScientificName,\n getVernacularName,\n getValueVernacularName,\n getVernacularNameUuid,\n getValueVernacularNameUuid,\n\n // time\n getTimeHour,\n getTimeMinute,\n getTimeSeconds,\n\n // utils\n isValueEqual,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/nodeDef/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAYhC,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;IACX,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,KAAK;CACf,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/nodeDef/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAYhC,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;IACX,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,KAAK;CACf,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAwD;IACjF,cAAc,EAAE,CAAC,MAA4B,EAAmB,EAAE;QAChE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,mCAC9F,YAAY,GACZ,MAAM,CACV,CAAA;QAED,OAAO;YACL,QAAQ;YACR,KAAK;YACL,IAAI,EAAE;gBACJ,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;aACtE;YACD,UAAU,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI;YAC/B,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE;YAClB,aAAa;YACb,SAAS;YACT,SAAS;YACT,IAAI;YACJ,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YAChB,OAAO;SACR,CAAA;IACH,CAAC;CACF,CAAA","sourcesContent":["import { ArenaFactory } from '../common'\nimport { UUIDs } from '../utils'\nimport { ArenaAnyNodeDef, NodeDefType, ArenaNodeDefProps, ArenaNodeDefPropsAdvanced } from './nodeDef'\n\nexport type NodeDefFactoryParams = {\n analysis?: boolean\n nodeDefParent?: ArenaAnyNodeDef\n props?: ArenaNodeDefProps\n propsAdvanced?: ArenaNodeDefPropsAdvanced\n type: NodeDefType\n virtual?: boolean\n}\n\nconst defaultProps = {\n analysis: false,\n draft: true,\n nodeDefParent: null,\n published: false,\n temporary: true,\n virtual: false,\n}\n\nexport const NodeDefFactory: ArenaFactory<ArenaAnyNodeDef, NodeDefFactoryParams> = {\n createInstance: (params: NodeDefFactoryParams): ArenaAnyNodeDef => {\n const { analysis, draft, nodeDefParent, props, propsAdvanced, published, temporary, type, virtual } = {\n ...defaultProps,\n ...params,\n }\n\n return {\n analysis,\n draft,\n meta: {\n h: nodeDefParent ? [...nodeDefParent.meta.h, nodeDefParent.uuid] : [],\n },\n parentUuid: nodeDefParent?.uuid,\n props: props ?? {},\n propsAdvanced,\n published,\n temporary,\n type,\n uuid: UUIDs.v4(),\n virtual,\n }\n },\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodeDef/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodeDef/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAgB1C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwBrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAK9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAQpD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["export { NodeDefFactory } from './factory'\n\nexport type {\n ArenaNodeDef,\n ArenaAnyNodeDef,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n ArenaNodeDefMeta,\n ArenaNodeDefPropsAdvanced,\n ArenaNodeDefExpression,\n ArenaNodeDefLayout,\n ArenaNodeDefValidations,\n ArenaNodeDefMap,\n ArenaNodeDefCountExpression,\n ArenaNodeDefExpressionFactoryParams,\n} from './nodeDef'\nexport { NodeDefCountType, NodeDefExpressionFactory, NodeDefType } from './nodeDef'\nexport { NodeDefs } from './nodeDefs'\n\nexport type { ArenaNodeDefService } from './service'\n\n// ==== node def types\nexport type { ArenaNodeDefBoolean, ArenaNodeDefBooleanProps } from './types/boolean'\n\nexport type { ArenaNodeDefCode, ArenaNodeDefCodeLayout, ArenaNodeDefCodeProps } from './types/code'\n\nexport type { ArenaNodeDefCoordinate, ArenaNodeDefCoordinateProps } from './types/coordinate'\n\nexport type { ArenaNodeDefDate } from './types/date'\n\nexport type { ArenaNodeDefDecimal, ArenaNodeDefDecimalProps } from './types/decimal'\n\nexport type {\n ArenaNodeDefEntity,\n ArenaNodeDefEntityChildPosition,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n ArenaNodeDefEntityProps,\n ArenaNodeDefPrintOrientation,\n} from './types/entity'\n\nexport { NodeDefEntityRenderType } from './types/entity'\n\nexport { NodeDefFileType } from './types/file'\nexport type { ArenaNodeDefFile, ArenaNodeDefFileProps } from './types/file'\n\nexport type { ArenaNodeDefGeo, ArenaNodeDefGeoProps } from './types/geo'\n\nexport { FormHeaderColor } from './types/formHeader'\nexport type { ArenaNodeDefFormHeader, ArenaNodeDefFormHeaderProps } from './types/formHeader'\n\nexport type { ArenaNodeDefInteger } from './types/integer'\n\nexport type { ArenaNodeDefTaxon, ArenaNodeDefTaxonProps } from './types/taxon'\n\nexport type { ArenaNodeDefText, ArenaNodeDefTextProps, ArenaNodeDefTextLayout } from './types/text'\nexport { NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\n\nexport type { ArenaNodeDefTime, ArenaNodeDefTimeProps } from './types/time'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDef.js","sourceRoot":"","sources":["../../../src/nodeDef/nodeDef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAKzC,MAAM,CAAN,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kBAAkB;IAClB,wCAAyB,CAAA;AAC3B,CAAC,EAfW,WAAW,KAAX,WAAW,QAetB;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAqDD,MAAM,CAAC,MAAM,wBAAwB,GAA8E;IACjH,cAAc,EAAE,CAAC,MAA2C,EAA0B,EAAE;QACtF,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,mBAAM,MAAM,EAAG,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA","sourcesContent":["import { Objects, UUIDs } from '../utils'\nimport { ArenaObject, ArenaFactory } from '../common'\nimport { ArenaLabels } from '../language'\nimport { ValidationSeverity } from '../validation'\n\nexport enum NodeDefType {\n boolean = 'boolean',\n code = 'code',\n coordinate = 'coordinate',\n date = 'date',\n decimal = 'decimal',\n geo = 'geo',\n entity = 'entity',\n file = 'file',\n integer = 'integer',\n taxon = 'taxon',\n text = 'text',\n time = 'time',\n // layout elements\n formHeader = 'formHeader',\n}\n\nexport enum NodeDefCountType {\n max = 'max',\n min = 'min',\n}\n\nexport interface ArenaNodeDefMeta {\n h: string[]\n}\n\nexport interface ArenaNodeDefProps {\n cycles?: string[]\n descriptions?: ArenaLabels\n key?: boolean\n autoIncrementalKey?: boolean\n labels?: ArenaLabels\n multiple?: boolean\n name?: string\n qualifier?: boolean\n readOnly?: boolean\n\n // available only when readOnly is true\n hidden?: boolean\n\n visibleFields?: string[]\n}\n\nexport interface ArenaNodeDefLayout {\n hiddenWhenNotRelevant?: boolean\n hiddenInMobile?: boolean\n includedInMultipleEntitySummary?: boolean\n includedInPreviousCycleLink?: boolean\n // code\n codeShown?: boolean\n}\n\nexport interface ArenaNodeDefPropsWithLayout<L extends ArenaNodeDefLayout> extends ArenaNodeDefProps {\n layout?: {\n [cycleKey: string]: L\n }\n}\n\nexport interface ArenaNodeDefExpression {\n applyIf?: string\n expression?: string\n messages?: ArenaLabels\n severity?: ValidationSeverity\n uuid: string\n}\n\nexport interface ArenaNodeDefExpressionFactoryParams {\n applyIf?: string\n expression?: string\n messages?: ArenaLabels\n severity?: ValidationSeverity\n}\n\nexport const NodeDefExpressionFactory: ArenaFactory<ArenaNodeDefExpression, ArenaNodeDefExpressionFactoryParams> = {\n createInstance: (params: ArenaNodeDefExpressionFactoryParams): ArenaNodeDefExpression => {\n const result = { uuid: UUIDs.v4() }\n Object.assign(result, Objects.deleteEmptyProps({ ...params }))\n return result\n },\n}\n\nexport type ArenaNodeDefCountExpression = string | ArenaNodeDefExpression[]\n\nexport interface NodeDefCountValidations {\n max?: ArenaNodeDefCountExpression\n min?: ArenaNodeDefCountExpression\n}\n\nexport interface ArenaNodeDefValidations {\n count?: NodeDefCountValidations\n expressions?: ArenaNodeDefExpression[]\n required?: boolean\n /**\n * Conditions making a single attribute required (alternative to `required`, which makes it always required).\n */\n requiredIf?: ArenaNodeDefExpression[]\n unique?: boolean\n}\n\nexport interface ArenaNodeDefPropsAdvanced {\n applicable?: ArenaNodeDefExpression[]\n defaultValues?: ArenaNodeDefExpression[]\n defaultValueEvaluatedOneTime?: boolean\n editableIf?: ArenaNodeDefExpression[]\n excludedInClone?: boolean\n formula?: ArenaNodeDefExpression[]\n validations?: ArenaNodeDefValidations\n visibleIf?: ArenaNodeDefExpression[]\n // file attribute\n fileNameExpression?: string\n // enumerate entity\n enumeratingItemsExpression?: string\n // code and taxon attribute\n itemsFilter?: string\n\n // Analysis\n script?: string\n chainUuid?: string\n index?: number\n active?: boolean\n aggregateFunctions?: { [key: string]: object }\n\n isBaseUnit?: boolean\n isSampling?: boolean\n hasAreaBasedEstimated?: boolean\n areaBasedEstimatedOf?: string // uuid of area based estimated node def\n}\n\nexport interface ArenaNodeDef<\n T extends NodeDefType,\n P extends ArenaNodeDefProps = ArenaNodeDefProps,\n> extends ArenaObject<P> {\n analysis?: boolean\n dateCreated?: string\n dateModified?: string\n deleted?: boolean\n draft?: boolean\n id?: number\n meta: ArenaNodeDefMeta\n parentUuid?: string\n propsAdvanced?: ArenaNodeDefPropsAdvanced\n propsAdvancedDraft?: ArenaNodeDefPropsAdvanced\n published?: boolean\n temporary?: boolean\n type: T\n virtual?: boolean\n}\n\nexport interface ArenaNodeDefMap {\n [key: string]: ArenaNodeDef<any>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeDef.js","sourceRoot":"","sources":["../../../src/nodeDef/nodeDef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAKzC,MAAM,CAAN,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kBAAkB;IAClB,wCAAyB,CAAA;AAC3B,CAAC,EAfW,WAAW,KAAX,WAAW,QAetB;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,+BAAW,CAAA;AACb,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAqDD,MAAM,CAAC,MAAM,wBAAwB,GAA8E;IACjH,cAAc,EAAE,CAAC,MAA2C,EAA0B,EAAE;QACtF,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,mBAAM,MAAM,EAAG,CAAC,CAAA;QAC9D,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA","sourcesContent":["import { Objects, UUIDs } from '../utils'\nimport { ArenaObject, ArenaFactory } from '../common'\nimport { ArenaLabels } from '../language'\nimport { ValidationSeverity } from '../validation'\n\nexport enum NodeDefType {\n boolean = 'boolean',\n code = 'code',\n coordinate = 'coordinate',\n date = 'date',\n decimal = 'decimal',\n geo = 'geo',\n entity = 'entity',\n file = 'file',\n integer = 'integer',\n taxon = 'taxon',\n text = 'text',\n time = 'time',\n // layout elements\n formHeader = 'formHeader',\n}\n\nexport enum NodeDefCountType {\n max = 'max',\n min = 'min',\n}\n\nexport interface ArenaNodeDefMeta {\n h: string[]\n}\n\nexport interface ArenaNodeDefProps {\n cycles?: string[]\n descriptions?: ArenaLabels\n key?: boolean\n autoIncrementalKey?: boolean\n labels?: ArenaLabels\n multiple?: boolean\n name?: string\n qualifier?: boolean\n readOnly?: boolean\n\n // available only when readOnly is true\n hidden?: boolean\n\n visibleFields?: string[]\n}\n\nexport interface ArenaNodeDefLayout {\n hiddenWhenNotRelevant?: boolean\n hiddenInMobile?: boolean\n includedInMultipleEntitySummary?: boolean\n includedInPreviousCycleLink?: boolean\n // code\n codeShown?: boolean\n}\n\nexport interface ArenaNodeDefPropsWithLayout<L extends ArenaNodeDefLayout> extends ArenaNodeDefProps {\n layout?: {\n [cycleKey: string]: L\n }\n}\n\nexport interface ArenaNodeDefExpression {\n applyIf?: string\n expression?: string\n messages?: ArenaLabels\n severity?: ValidationSeverity\n uuid: string\n}\n\nexport interface ArenaNodeDefExpressionFactoryParams {\n applyIf?: string\n expression?: string\n messages?: ArenaLabels\n severity?: ValidationSeverity\n}\n\nexport const NodeDefExpressionFactory: ArenaFactory<ArenaNodeDefExpression, ArenaNodeDefExpressionFactoryParams> = {\n createInstance: (params: ArenaNodeDefExpressionFactoryParams): ArenaNodeDefExpression => {\n const result = { uuid: UUIDs.v4() }\n Object.assign(result, Objects.deleteEmptyProps({ ...params }))\n return result\n },\n}\n\nexport type ArenaNodeDefCountExpression = string | ArenaNodeDefExpression[]\n\nexport interface NodeDefCountValidations {\n max?: ArenaNodeDefCountExpression\n min?: ArenaNodeDefCountExpression\n}\n\nexport interface ArenaNodeDefValidations {\n count?: NodeDefCountValidations\n expressions?: ArenaNodeDefExpression[]\n required?: boolean\n /**\n * Conditions making a single attribute required (alternative to `required`, which makes it always required).\n */\n requiredIf?: ArenaNodeDefExpression[]\n unique?: boolean\n}\n\nexport interface ArenaNodeDefPropsAdvanced {\n applicable?: ArenaNodeDefExpression[]\n defaultValues?: ArenaNodeDefExpression[]\n defaultValueEvaluatedOneTime?: boolean\n editableIf?: ArenaNodeDefExpression[]\n excludedInClone?: boolean\n formula?: ArenaNodeDefExpression[]\n validations?: ArenaNodeDefValidations\n visibleIf?: ArenaNodeDefExpression[]\n // file attribute\n fileNameExpression?: string\n // enumerate entity\n enumeratingItemsExpression?: string\n // code and taxon attribute\n itemsFilter?: string\n\n // Analysis\n script?: string\n chainUuid?: string\n index?: number\n active?: boolean\n aggregateFunctions?: { [key: string]: object }\n\n isBaseUnit?: boolean\n isSampling?: boolean\n hasAreaBasedEstimated?: boolean\n areaBasedEstimatedOf?: string // uuid of area based estimated node def\n}\n\nexport interface ArenaNodeDef<\n T extends NodeDefType,\n P extends ArenaNodeDefProps = ArenaNodeDefProps,\n> extends ArenaObject<P> {\n analysis?: boolean\n dateCreated?: string\n dateModified?: string\n deleted?: boolean\n draft?: boolean\n id?: number\n meta: ArenaNodeDefMeta\n parentUuid?: string\n propsAdvanced?: ArenaNodeDefPropsAdvanced\n propsAdvancedDraft?: ArenaNodeDefPropsAdvanced\n published?: boolean\n temporary?: boolean\n type: T\n virtual?: boolean\n}\n\n/** Node definition of any type. */\nexport type ArenaAnyNodeDef = ArenaNodeDef<NodeDefType>\n\nexport interface ArenaNodeDefMap {\n [key: string]: ArenaNodeDef<any>\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDefs.js","sourceRoot":"","sources":["../../../src/nodeDef/nodeDefs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAGL,gBAAgB,EAKhB,WAAW,GAEZ,MAAM,WAAW,CAAA;AAMlB,OAAO,EAIL,uBAAuB,GAExB,MAAM,gBAAgB,CAAA;AAMvB,OAAO,EAAoB,qBAAqB,EAAwB,MAAM,cAAc,CAAA;AAG5F,MAA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IACjC,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,gBAAgB;IAChB,iCAAiC;IACjC,6BAA6B;IAC7B,uBAAuB;IACvB,WAAW;IACX,2BAA2B;IAC3B,0BAA0B;IAC1B,cAAc;IACd,cAAc;IACd,yBAAyB;IACzB,UAAU;IACV,aAAa;IACb,mBAAmB;IACnB,iCAAiC;IACjC,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,WAAW;IACX,WAAW;IACX,WAAW;IACX,uBAAuB;IACvB,eAAe;IACf,WAAW;IACX,gBAAgB;CACjB,CAAA","sourcesContent":["import { LanguageCode } from '../language'\nimport { getLabelOrDefault } from '../language/labels'\nimport { ValuePropsCoordinate } from '../node/nodeValueProps'\nimport { defaultCycle } from '../survey'\nimport { Objects } from '../utils'\nimport {\n ArenaNodeDef,\n ArenaNodeDefCountExpression,\n NodeDefCountType,\n ArenaNodeDefExpression,\n ArenaNodeDefLayout,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n NodeDefType,\n ArenaNodeDefValidations,\n} from './nodeDef'\nimport { ArenaNodeDefBoolean } from './types/boolean'\nimport { ArenaNodeDefCode } from './types/code'\nimport { ArenaNodeDefCoordinate } from './types/coordinate'\nimport { ArenaNodeDefDate } from './types/date'\nimport { ArenaNodeDefDecimal } from './types/decimal'\nimport {\n ArenaNodeDefEntity,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n ArenaNodeDefPrintOrientation,\n} from './types/entity'\nimport { ArenaNodeDefFile, NodeDefFileType } from './types/file'\nimport { ArenaNodeDefFormHeader } from './types/formHeader'\nimport { ArenaNodeDefGeo } from './types/geo'\nimport { ArenaNodeDefInteger } from './types/integer'\nimport { ArenaNodeDefTaxon } from './types/taxon'\nimport { ArenaNodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { ArenaNodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefBoolean =>\n nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefDecimal =>\n nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isGeo = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefGeo => nodeDef.type === NodeDefType.geo\n\nconst isInteger = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefInteger =>\n nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): boolean =>\n nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: ArenaNodeDef<NodeDefType>): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: ArenaNodeDef<NodeDefType>): nodeDef is ArenaNodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: ArenaNodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: ArenaNodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: ArenaNodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: ArenaNodeDefEntity): ArenaNodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: ArenaNodeDef<NodeDefType>): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: ArenaNodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: ArenaNodeDef<NodeDefType>): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: ArenaNodeDefCoordinate): boolean =>\n !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: ArenaNodeDefCoordinate): string[] => {\n const result = []\n if (nodeDef.props.includeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.accuracy])\n if (nodeDef.props.includeAltitude) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitude])\n if (nodeDef.props.includeAltitudeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitudeAccuracy])\n return result\n}\n\n// decimal\nconst getMaxNumberDecimalDigits = (nodeDef: ArenaNodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: ArenaNodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: ArenaNodeDefFile): string | undefined =>\n nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: ArenaNodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\nconst isScreenCaptureInMapAllowed = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.screenCaptureInMapAllowed\n\n// geo\nconst isPositionTracking = (nodeDef: ArenaNodeDefGeo): boolean => !!nodeDef.props.positionTracking\n\n// time\nconst isSecondsIncluded = (nodeDef: ArenaNodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: ArenaNodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: ArenaNodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: ArenaNodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: ArenaNodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getValidations(nodeDef)?.required ?? false\n\nconst getRequiredIf = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.requiredIf ?? []\n\nconst isRequiredIfDefined = (nodeDef: ArenaNodeDef<NodeDefType>): boolean => getRequiredIf(nodeDef).length > 0\n\n/**\n * True if the node def is always required or required when a condition is met (node def level, not record level).\n */\nconst isRequiredOrConditionallyRequired = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n isRequired(nodeDef) || isRequiredIfDefined(nodeDef)\n\n// // Min/max count\n\nconst getCount = (\n nodeDef: ArenaNodeDef<NodeDefType>,\n countType: NodeDefCountType\n): ArenaNodeDefCountExpression | undefined => {\n const countValidations = getValidations(nodeDef)?.count\n if (!countValidations) return undefined\n return countType === NodeDefCountType.max ? countValidations.max : countValidations.min\n}\n\nconst getMinCount = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: ArenaNodeDef<NodeDefType>): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: ArenaNodeDef<NodeDefType>): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): ArenaNodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: ArenaNodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: ArenaNodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: ArenaNodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\n isGeo,\n isInteger,\n isTaxon,\n isText,\n isTime,\n isMultiple,\n isMultipleEntity,\n isSingle,\n isSingleEntity,\n isAttribute,\n isSingleAttribute,\n isMultipleAttribute,\n isKey,\n isAutoIncrementalKey,\n isQualifier,\n isReadOnly,\n isHidden,\n isEnumerate,\n getEnumeratingItemsExpression,\n isAutoCreateMinCountItems,\n getPrintOrientation,\n isAnalysis,\n isRoot,\n getType,\n isLayoutElement,\n getName,\n getLabelOrName,\n getDescription,\n getDefaultValues,\n isDefaultValueEvaluatedOneTime,\n getApplicable,\n getVisibleFields,\n isFieldVisible,\n isInCycle,\n isExcludedInClone,\n getEditableIf,\n isAlwaysEditable,\n getVisibleIf,\n isAlwaysVisible,\n\n getCategoryUuid,\n getParentCodeDefUuid,\n isAllowOnlyDeviceCoordinate,\n getCoordinateAdditionalFields,\n getMaxNumberDecimalDigits,\n getFileNameExpression,\n getFileType,\n getFileMaxSize,\n isGeotagInformationShown,\n isScreenCaptureInMapAllowed,\n isPositionTracking,\n isSecondsIncluded,\n getTaxonomyUuid,\n isVernacularNameSelectionKept,\n isVernacularNameAlwaysIncludedIfSingle,\n getTextTransform,\n getTextInputType,\n getItemsFilter,\n\n // layout\n getLayoutProps,\n getLayoutRenderType,\n isLayoutRenderTypeForm,\n isLayoutRenderTypeTable,\n getChildrenEntitiesInOwnPageUuids,\n getLayoutChildren,\n getPageUuid,\n isDisplayInOwnPage,\n isHiddenInMobile,\n isIncludedInMultipleEntitySummary,\n isIncludedInPreviousCycleLink,\n isHiddenWhenNotRelevant,\n isCodeShown,\n isLayoutRenderTypeHyperlink,\n isLayoutRenderTypeMarkdown,\n // validations\n getValidations,\n getValidationsExpressions,\n isRequired,\n getRequiredIf,\n isRequiredIfDefined,\n isRequiredOrConditionallyRequired,\n // // Min Max\n hasMinOrMaxCount,\n getCount,\n getMaxCount,\n getMinCount,\n // Analysis\n getAreaBasedEstimatedOf,\n getIndexInChain,\n // Metadata\n getMetaHierarchy,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodeDefs.js","sourceRoot":"","sources":["../../../src/nodeDef/nodeDefs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAIL,gBAAgB,EAIhB,WAAW,GAEZ,MAAM,WAAW,CAAA;AAMlB,OAAO,EAIL,uBAAuB,GAExB,MAAM,gBAAgB,CAAA;AAMvB,OAAO,EAAoB,qBAAqB,EAAwB,MAAM,cAAc,CAAA;AAG5F,MAAM,MAAM,GAAG,CAAC,OAAwB,EAAW,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAA;AAEzE,MAAM,WAAW,GAAG,CAAC,OAAwB,EAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAE7E,MAAM,QAAQ,GAAG,CAAC,OAAwB,EAAiC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM,CAAA;AAEjH,MAAM,SAAS,GAAG,CAAC,OAAwB,EAAkC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAA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A","sourcesContent":["import { LanguageCode } from '../language'\nimport { getLabelOrDefault } from '../language/labels'\nimport { ValuePropsCoordinate } from '../node/nodeValueProps'\nimport { defaultCycle } from '../survey'\nimport { Objects } from '../utils'\nimport {\n ArenaAnyNodeDef,\n ArenaNodeDef,\n ArenaNodeDefCountExpression,\n NodeDefCountType,\n ArenaNodeDefExpression,\n ArenaNodeDefLayout,\n ArenaNodeDefPropsWithLayout,\n NodeDefType,\n ArenaNodeDefValidations,\n} from './nodeDef'\nimport { ArenaNodeDefBoolean } from './types/boolean'\nimport { ArenaNodeDefCode } from './types/code'\nimport { ArenaNodeDefCoordinate } from './types/coordinate'\nimport { ArenaNodeDefDate } from './types/date'\nimport { ArenaNodeDefDecimal } from './types/decimal'\nimport {\n ArenaNodeDefEntity,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n NodeDefEntityRenderType,\n ArenaNodeDefPrintOrientation,\n} from './types/entity'\nimport { ArenaNodeDefFile, NodeDefFileType } from './types/file'\nimport { ArenaNodeDefFormHeader } from './types/formHeader'\nimport { ArenaNodeDefGeo } from './types/geo'\nimport { ArenaNodeDefInteger } from './types/integer'\nimport { ArenaNodeDefTaxon } from './types/taxon'\nimport { ArenaNodeDefText, NodeDefTextRenderType, NodeDefTextInputType } from './types/text'\nimport { ArenaNodeDefTime } from './types/time'\n\nconst isRoot = (nodeDef: ArenaAnyNodeDef): boolean => !nodeDef.parentUuid\n\nconst isAttribute = (nodeDef: ArenaAnyNodeDef): boolean => !isEntity(nodeDef)\n\nconst isEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity => nodeDef.type === NodeDefType.entity\n\nconst isBoolean = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefBoolean => nodeDef.type === NodeDefType.boolean\n\nconst isCode = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefCode => nodeDef.type === NodeDefType.code\n\nconst isCoordinate = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefCoordinate =>\n nodeDef.type === NodeDefType.coordinate\n\nconst isDate = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefDate => nodeDef.type === NodeDefType.date\n\nconst isDecimal = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefDecimal => nodeDef.type === NodeDefType.decimal\n\nconst isFile = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefFile => nodeDef.type === NodeDefType.file\n\nconst isGeo = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefGeo => nodeDef.type === NodeDefType.geo\n\nconst isInteger = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefInteger => nodeDef.type === NodeDefType.integer\n\nconst isTaxon = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefTaxon => nodeDef.type === NodeDefType.taxon\n\nconst isText = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefText => nodeDef.type === NodeDefType.text\n\nconst isTime = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefTime => nodeDef.type === NodeDefType.time\n\nconst isMultiple = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.multiple ?? false\n\nconst isSingle = (nodeDef: ArenaAnyNodeDef): boolean => !isMultiple(nodeDef)\n\nconst isSingleEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isSingle(nodeDef)\n\nconst isSingleAttribute = (nodeDef: ArenaAnyNodeDef): boolean => isAttribute(nodeDef) && isSingle(nodeDef)\n\nconst isMultipleEntity = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefEntity =>\n isEntity(nodeDef) && isMultiple(nodeDef)\n\nconst isMultipleAttribute = (nodeDef: ArenaAnyNodeDef): boolean => isAttribute(nodeDef) && isMultiple(nodeDef)\n\nconst isKey = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.key ?? false\n\nconst isAutoIncrementalKey = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.autoIncrementalKey ?? false\n\nconst isAnalysis = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.analysis ?? false\n\nconst getType = (nodeDef: ArenaAnyNodeDef): NodeDefType => nodeDef.type\n\nconst isLayoutElement = (nodeDef: ArenaAnyNodeDef): nodeDef is ArenaNodeDefFormHeader =>\n nodeDef.type === NodeDefType.formHeader\n\nconst getName = (nodeDef: ArenaAnyNodeDef): string => nodeDef.props.name ?? ''\n\nconst getLabelOrName = (nodeDef: ArenaAnyNodeDef, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.labels, lang, getName(nodeDef))\n\nconst getDescription = (nodeDef: ArenaAnyNodeDef, lang: LanguageCode): string =>\n getLabelOrDefault(nodeDef.props.descriptions, lang)\n\nconst isQualifier = (nodeDef: ArenaAnyNodeDef): boolean => nodeDef.props.qualifier ?? false\n\nconst isReadOnly = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.readOnly ?? false\n\nconst isHidden = (nodeDef: ArenaNodeDef<any>): boolean => nodeDef.props.hidden ?? false\n\nconst isEnumerate = (nodeDef: ArenaNodeDefEntity): boolean => nodeDef.props.enumerate ?? false\n\nconst getEnumeratingItemsExpression = (nodeDef: ArenaNodeDefEntity): string | undefined =>\n nodeDef.propsAdvanced?.enumeratingItemsExpression\n\nconst isAutoCreateMinCountItems = (nodeDef: ArenaNodeDefEntity): boolean =>\n isMultipleEntity(nodeDef) && (nodeDef.props.autoCreateMinCountItems ?? false)\n\nconst getPrintOrientation = (nodeDef: ArenaNodeDefEntity): ArenaNodeDefPrintOrientation | undefined =>\n nodeDef.props.printOrientation\n\nconst getDefaultValues = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] =>\n nodeDef.propsAdvanced?.defaultValues ?? []\n\nconst isDefaultValueEvaluatedOneTime = (nodeDef: ArenaAnyNodeDef): boolean =>\n !!nodeDef.propsAdvanced?.defaultValueEvaluatedOneTime\n\nconst getApplicable = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.applicable ?? []\n\nconst getVisibleFields = (nodeDef: ArenaAnyNodeDef): string[] | undefined => nodeDef.props.visibleFields\n\nconst isFieldVisible = (field: string) => (nodeDef: ArenaNodeDef<any>) => {\n const visibleFields = getVisibleFields(nodeDef)\n return !visibleFields || visibleFields.includes(field)\n}\n\nconst isInCycle =\n (cycle: string) =>\n (nodeDef: ArenaAnyNodeDef): boolean => {\n const cycles = nodeDef.props.cycles ?? [defaultCycle]\n return cycles.includes(cycle)\n }\n\nconst isExcludedInClone = (nodeDef: ArenaAnyNodeDef): boolean => !!nodeDef.propsAdvanced?.excludedInClone\n\nconst getEditableIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.editableIf ?? []\n\nconst isAlwaysEditable = (nodeDef: ArenaAnyNodeDef): boolean => getEditableIf(nodeDef).length === 0\n\nconst getVisibleIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => nodeDef.propsAdvanced?.visibleIf ?? []\n\nconst isAlwaysVisible = (nodeDef: ArenaAnyNodeDef): boolean => getVisibleIf(nodeDef).length === 0\n\n// code\nconst getCategoryUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.categoryUuid\nconst getParentCodeDefUuid = (nodeDef: ArenaNodeDefCode): string | undefined => nodeDef.props.parentCodeDefUuid\n\n// coordinate\nconst isAllowOnlyDeviceCoordinate = (nodeDef: ArenaNodeDefCoordinate): boolean =>\n !!nodeDef.props.allowOnlyDeviceCoordinate\n\nconst getCoordinateAdditionalFields = (nodeDef: ArenaNodeDefCoordinate): string[] => {\n const result = []\n if (nodeDef.props.includeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.accuracy])\n if (nodeDef.props.includeAltitude) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitude])\n if (nodeDef.props.includeAltitudeAccuracy) result.push(ValuePropsCoordinate[ValuePropsCoordinate.altitudeAccuracy])\n return result\n}\n\n// decimal\nconst getMaxNumberDecimalDigits = (nodeDef: ArenaNodeDefDecimal) => {\n const decimalDigits = nodeDef.props.maxNumberDecimalDigits\n return Objects.isEmpty(decimalDigits) ? Number.NaN : Number(decimalDigits)\n}\n\n// file\nconst getFileType = (nodeDef: ArenaNodeDefFile): NodeDefFileType | undefined => nodeDef.props.fileType\nconst getFileNameExpression = (nodeDef: ArenaNodeDefFile): string | undefined =>\n nodeDef.propsAdvanced?.fileNameExpression\nconst getFileMaxSize = (nodeDef: ArenaNodeDefFile): number | undefined => nodeDef.props.maxFileSize\nconst isGeotagInformationShown = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.geotagInformationShown\nconst isScreenCaptureInMapAllowed = (nodeDef: ArenaNodeDefFile): boolean => !!nodeDef.props.screenCaptureInMapAllowed\n\n// geo\nconst isPositionTracking = (nodeDef: ArenaNodeDefGeo): boolean => !!nodeDef.props.positionTracking\n\n// time\nconst isSecondsIncluded = (nodeDef: ArenaNodeDefTime): boolean => !!nodeDef.props.includeSeconds\n\n// taxon\nconst getTaxonomyUuid = (nodeDef: ArenaNodeDefTaxon): string | undefined => nodeDef.props.taxonomyUuid\n\nconst isVernacularNameSelectionKept = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameSelectionKept\n\nconst isVernacularNameAlwaysIncludedIfSingle = (nodeDef: ArenaNodeDefTaxon): boolean =>\n !!nodeDef.props.vernacularNameAlwaysIncludedIfSingle\n\n// text\nconst getTextTransform = (nodeDef: ArenaNodeDefText): string | undefined => nodeDef.props?.textTransform\nconst getTextInputType = (nodeDef: ArenaNodeDefText): NodeDefTextInputType | undefined => nodeDef.props?.textInputType\n\n// code and taxon\nconst getItemsFilter = (nodeDef: ArenaNodeDef<any>): string | undefined => nodeDef.propsAdvanced?.itemsFilter\n\n// Validations\nconst getValidations = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefValidations | undefined =>\n nodeDef.propsAdvanced?.validations\n\nconst getValidationsExpressions = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] =>\n getValidations(nodeDef)?.expressions ?? []\n\nconst isRequired = (nodeDef: ArenaAnyNodeDef): boolean => getValidations(nodeDef)?.required ?? false\n\nconst getRequiredIf = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefExpression[] => getValidations(nodeDef)?.requiredIf ?? []\n\nconst isRequiredIfDefined = (nodeDef: ArenaAnyNodeDef): boolean => getRequiredIf(nodeDef).length > 0\n\n/**\n * True if the node def is always required or required when a condition is met (node def level, not record level).\n */\nconst isRequiredOrConditionallyRequired = (nodeDef: ArenaAnyNodeDef): boolean =>\n isRequired(nodeDef) || isRequiredIfDefined(nodeDef)\n\n// // Min/max count\n\nconst getCount = (nodeDef: ArenaAnyNodeDef, countType: NodeDefCountType): ArenaNodeDefCountExpression | undefined => {\n const countValidations = getValidations(nodeDef)?.count\n if (!countValidations) return undefined\n return countType === NodeDefCountType.max ? countValidations.max : countValidations.min\n}\n\nconst getMinCount = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.min)\n\nconst getMaxCount = (nodeDef: ArenaAnyNodeDef): ArenaNodeDefCountExpression | undefined =>\n getCount(nodeDef, NodeDefCountType.max)\n\nconst hasMinOrMaxCount = (nodeDef: ArenaAnyNodeDef): boolean =>\n Objects.isNotEmpty(getMinCount(nodeDef)) || Objects.isNotEmpty(getMaxCount(nodeDef))\n\n// layout\nconst getLayoutProps =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): any =>\n nodeDef?.props?.layout?.[cycle] ?? {}\n\nconst getLayoutRenderType =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<any>>): string | undefined =>\n getLayoutProps(cycle)(nodeDef).renderType\n\nconst isLayoutRenderTypeForm =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.form\n\nconst isLayoutRenderTypeTable =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefEntityRenderType.table\n\nconst isLayoutRenderTypeHyperlink =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.hyperlink\n\nconst isLayoutRenderTypeMarkdown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefText): boolean =>\n getLayoutRenderType(cycle)(nodeDef) === NodeDefTextRenderType.markdown\n\nconst getChildrenEntitiesInOwnPageUuids =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).indexChildren ?? []\n\nconst getLayoutChildren =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): ArenaNodeDefEntityLayoutChildItem[] =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).layoutChildren ?? []\n\nconst getPageUuid =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): string | undefined =>\n (getLayoutProps(cycle)(nodeDef) as ArenaNodeDefEntityLayout).pageUuid\n\nconst isDisplayInOwnPage =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefEntity): boolean =>\n !!getPageUuid(cycle)(nodeDef)\n\nconst isHiddenInMobile =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenInMobile ?? false\n\nconst isIncludedInMultipleEntitySummary =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInMultipleEntitySummary ?? false\n\nconst isIncludedInPreviousCycleLink =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).includedInPreviousCycleLink ?? true\n\nconst isHiddenWhenNotRelevant =\n (cycle = defaultCycle) =>\n <L extends ArenaNodeDefLayout>(nodeDef: ArenaNodeDef<any, ArenaNodeDefPropsWithLayout<L>>): boolean =>\n getLayoutProps(cycle)(nodeDef).hiddenWhenNotRelevant ?? false\n\nconst isCodeShown =\n (cycle = defaultCycle) =>\n (nodeDef: ArenaNodeDefCode): boolean =>\n !!(getLayoutProps(cycle)(nodeDef).codeShown ?? true)\n\n// Analysis\nconst getAreaBasedEstimatedOf = (nodeDef: ArenaNodeDef<any>): string | undefined =>\n nodeDef.propsAdvancedDraft?.areaBasedEstimatedOf ?? nodeDef.propsAdvanced?.areaBasedEstimatedOf\n\nconst getIndexInChain = (nodeDef: ArenaNodeDef<any>): number | undefined => nodeDef.propsAdvanced?.index\n\n// Metadata\nconst getMetaHierarchy = (nodeDef: ArenaNodeDef<any>): string[] => nodeDef.meta?.h ?? []\n\nexport const NodeDefs = {\n isEntity,\n isBoolean,\n isCode,\n isCoordinate,\n isDate,\n isDecimal,\n isFile,\n isGeo,\n isInteger,\n isTaxon,\n isText,\n isTime,\n isMultiple,\n isMultipleEntity,\n isSingle,\n isSingleEntity,\n isAttribute,\n isSingleAttribute,\n isMultipleAttribute,\n isKey,\n isAutoIncrementalKey,\n isQualifier,\n isReadOnly,\n isHidden,\n isEnumerate,\n getEnumeratingItemsExpression,\n isAutoCreateMinCountItems,\n getPrintOrientation,\n isAnalysis,\n isRoot,\n getType,\n isLayoutElement,\n getName,\n getLabelOrName,\n getDescription,\n getDefaultValues,\n isDefaultValueEvaluatedOneTime,\n getApplicable,\n getVisibleFields,\n isFieldVisible,\n isInCycle,\n isExcludedInClone,\n getEditableIf,\n isAlwaysEditable,\n getVisibleIf,\n isAlwaysVisible,\n\n getCategoryUuid,\n getParentCodeDefUuid,\n isAllowOnlyDeviceCoordinate,\n getCoordinateAdditionalFields,\n getMaxNumberDecimalDigits,\n getFileNameExpression,\n getFileType,\n getFileMaxSize,\n isGeotagInformationShown,\n isScreenCaptureInMapAllowed,\n isPositionTracking,\n isSecondsIncluded,\n getTaxonomyUuid,\n isVernacularNameSelectionKept,\n isVernacularNameAlwaysIncludedIfSingle,\n getTextTransform,\n getTextInputType,\n getItemsFilter,\n\n // layout\n getLayoutProps,\n getLayoutRenderType,\n isLayoutRenderTypeForm,\n isLayoutRenderTypeTable,\n getChildrenEntitiesInOwnPageUuids,\n getLayoutChildren,\n getPageUuid,\n isDisplayInOwnPage,\n isHiddenInMobile,\n isIncludedInMultipleEntitySummary,\n isIncludedInPreviousCycleLink,\n isHiddenWhenNotRelevant,\n isCodeShown,\n isLayoutRenderTypeHyperlink,\n isLayoutRenderTypeMarkdown,\n // validations\n getValidations,\n getValidationsExpressions,\n isRequired,\n getRequiredIf,\n isRequiredIfDefined,\n isRequiredOrConditionallyRequired,\n // // Min Max\n hasMinOrMaxCount,\n getCount,\n getMaxCount,\n getMinCount,\n // Analysis\n getAreaBasedEstimatedOf,\n getIndexInChain,\n // Metadata\n getMetaHierarchy,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/nodeDef/service.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaChainNodeDef } from '../chain'\nimport { ArenaService } from '../common'\nimport {
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/nodeDef/service.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaChainNodeDef } from '../chain'\nimport { ArenaService } from '../common'\nimport { ArenaAnyNodeDef } from './nodeDef'\n\nexport interface ArenaNodeDefService extends ArenaService {\n // ==== CREATE\n create(options: {\n chainNodeDef?: ArenaChainNodeDef\n cycle: string\n nodeDef: ArenaAnyNodeDef\n surveyId: number\n user: ArenaUser\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== READ\n getMany(options: {\n advanced?: boolean\n cycle?: string\n deleted?: boolean\n draft?: boolean\n limit?: number\n offset?: number\n surveyId: number\n user: ArenaUser\n validate?: boolean\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== UPDATE\n update(options: {\n cycle: string\n nodeDef: ArenaAnyNodeDef\n user: ArenaUser\n surveyId: number\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n\n // ==== DELETE\n delete(options: {\n cycle: string\n nodeDefUuid: string\n user: ArenaUser\n surveyId: number\n }): Promise<{ [nodeDefUuid: string]: ArenaAnyNodeDef }>\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaExpressionContext } from '../expression'\nimport {
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/nodeDefExpressionEvaluator/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaUser } from '../auth'\nimport { ArenaExpressionContext } from '../expression'\nimport { ArenaAnyNodeDef } from '../nodeDef'\nimport { ArenaSurvey } from '../survey'\nimport { ArenaAreaOfInterestProvider } from './areaOfInterestProvider'\nimport { ArenaCategoryItemProvider } from './categoryItemProvider'\nimport { ArenaTaxonProvider } from './taxonProvider'\n\nexport interface NodeDefExpressionContext extends ArenaExpressionContext {\n survey: ArenaSurvey\n user?: ArenaUser\n nodeDefCurrent: ArenaAnyNodeDef\n nodeDefContext?: ArenaAnyNodeDef\n /**\n * Unique UUIDs of node definitions being visited during expression evaluation.\n */\n referencedNodeDefUuids?: Set<string>\n selfReferenceAllowed?: boolean\n // true when the expression is used to filter code or taxon items\n itemsFilter?: boolean\n // true when evaluating the property of a member expression (e.g. \"length\" in \"text_attr.length\")\n memberProperty?: boolean\n\n categoryItemProvider?: ArenaCategoryItemProvider\n taxonProvider?: ArenaTaxonProvider\n areaOfInterestProvider?: ArenaAreaOfInterestProvider\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../src/nodeDefExpressionEvaluator/node/identifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AACjF,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAErG,OAAO,EAAE,kBAAkB,EAA6B,MAAM,kBAAkB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,MAE9B,EAA4D,EAAE;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAA;IAExD,IAAI,CAAC,oBAAoB;QAAE,OAAO,SAAS,CAAA;IAE3C,IAAI,QAAQ,CAAC,WAAW,CAAC,oB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,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtD,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;oBAChD,MAAM,gBAAgB,CAAA;gBACxB,CAAC;gBACD,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefProps, NodeDefType } from '../../nodeDef/nodeDef'\nimport { getNodeDefChildren, getNodeDefParent, getNodeDefSource } from '../../survey/surveys/nodeDefs'\nimport { NodeDefs } from '../../nodeDef/nodeDefs'\nimport { Objects, Queue } from '../../utils'\nimport { IdentifierEvaluator } from '../../expression/javascript/node/identifier'\nimport { getGlobalObjectProperty, isForbiddenPropertyName } from '../../expression/javascript/global'\nimport { NodeDefExpressionContext } from '../context'\nimport { ExpressionVariable, ArenaIdentifierExpression } from '../../expression'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ValidatorErrorKeys } from '../../validation'\nimport { NodeNativeProperties } from './nodeDefExpressionNativeProperties'\nimport { RecordNodeValues } from '../../node/nodeValues'\n\n/**\n * Determines the actual context node def\n * - attribute def => parent entity def\n * - virtual entity def => source node def\n * - entity def => entity def itself\n */\nconst findActualContextNode = (params: {\n context: NodeDefExpressionContext\n}): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined => {\n const { context } = params\n const { survey, object: nodeDefObjectContext } = context\n\n if (!nodeDefObjectContext) return undefined\n\n if (NodeDefs.isAttribute(nodeDefObjectContext)) {\n return getNodeDefParent({ survey, nodeDef: nodeDefObjectContext })\n }\n if (nodeDefObjectContext.virtual) {\n return getNodeDefSource({ survey, nodeDef: nodeDefObjectContext })\n }\n return nodeDefObjectContext\n}\n\nexport class NodeDefIdentifierEvaluator extends IdentifierEvaluator<NodeDefExpressionContext> {\n evaluate(expressionNode: ArenaIdentifierExpression): Promise<any> {\n try {\n return Promise.resolve(this.evaluateIdentifier(expressionNode))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private evaluateIdentifier(expressionNode: ArenaIdentifierExpression): any {\n const { context } = this\n const { nodeDefContext, object: objectContext, itemsFilter, memberProperty } = context\n const { name: exprName } = expressionNode\n\n if (isForbiddenPropertyName(exprName)) {\n this.throwIdentifierNotFound(expressionNode)\n }\n\n if (exprName === ExpressionVariable.CONTEXT) {\n if (nodeDefContext) {\n this.addReferencedNodeDefUuid(nodeDefContext.uuid)\n }\n return nodeDefContext\n }\n\n // global objects (e.g. Math, String)\n const globalObjectProperty = getGlobalObjectProperty(exprName, objectContext)\n if (globalObjectProperty !== null) {\n return globalObjectProperty\n }\n\n if (itemsFilter) {\n const prop = objectContext?.props?.[exprName] ?? objectContext?.props?.extra?.[exprName]\n if (!Objects.isEmpty(prop)) {\n return prop\n }\n }\n\n // check if identifier is a composite attribute value prop\n if (\n NodeDefs.isAttribute(objectContext) &&\n RecordNodeValues.isValueProp({ nodeDef: objectContext, prop: exprName })\n ) {\n return objectContext\n }\n\n if (memberProperty) {\n // property of a member expression (e.g. text_attr.length or text_attr.toUpperCase()): native properties first\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n return this.getReferencedNodeDef(expressionNode)\n }\n // identifier not in a member expression: node defs first, so that node defs named like native properties\n // (e.g. \"name\", \"type\", \"trim\") are always found (and registered as dependencies)\n const referencedNodeDef = this.findReferencedNodeDef(expressionNode)\n if (referencedNodeDef) return referencedNodeDef\n\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n\n return this.throwIdentifierNotFound(expressionNode)\n }\n\n /**\n * Finds the identifier among the native properties or functions of the context object\n * (e.g. String.length or String.toUpperCase()).\n */\n private findNativeProperty(expressionNode: ArenaIdentifierExpression): { value: any } | null {\n const { object: objectContext } = this.context\n const { name: exprName } = expressionNode\n\n const globalOrNativeProperty = this.findGlobalOrNativeProperty(expressionNode)\n if (globalOrNativeProperty) {\n return globalOrNativeProperty\n }\n if (NodeNativeProperties.hasNativeProperty({ nodeDefOrValue: objectContext, propName: exprName })) {\n return {\n value: NodeNativeProperties.evalNodeDefProperty({ nodeDefOrValue: objectContext, propName: exprName }),\n }\n }\n return null\n }\n\n private findReferencedNodeDef(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined {\n const { nodeDefCurrent, selfReferenceAllowed } = this.context\n const referencedNodeDef = this.findIdentifierAmongReachableNodeDefs(expressionNode)\n if (!referencedNodeDef) return undefined\n\n if (!selfReferenceAllowed && referencedNodeDef.uuid === nodeDefCurrent?.uuid) {\n throw new SystemError(ValidatorErrorKeys.expressions.cannotUseCurrentNode, { name: expressionNode.name })\n }\n this.addReferencedNodeDefUuid(referencedNodeDef.uuid)\n return referencedNodeDef\n }\n\n private getReferencedNodeDef(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> {\n return this.findReferencedNodeDef(expressionNode) ?? this.throwIdentifierNotFound(expressionNode)\n }\n\n private throwIdentifierNotFound(expressionNode: ArenaIdentifierExpression): never {\n throw new SystemError(SystemErrorKeys.expression.identifierNotFound, {\n name: expressionNode.name,\n contextObject: this.context.object?.props?.name,\n })\n }\n\n private addReferencedNodeDefUuid(uuid: string) {\n const { context } = this\n const { referencedNodeDefUuids = new Set() } = context\n context.referencedNodeDefUuids = referencedNodeDefUuids.add(uuid)\n }\n\n /**\n * Tries to find the specified identifier among the node defs that can be \"reached\" from the context node def.\n */\n protected findIdentifierAmongReachableNodeDefs(\n expressionNode: ArenaIdentifierExpression\n ): ArenaNodeDef<NodeDefType, ArenaNodeDefProps> | undefined {\n const { object: contextObject } = this.context\n\n if (!contextObject) return undefined\n\n // stop at the first match, without visiting all the reachable node defs\n for (const reachableNodeDef of this.iterateReachableNodeDefs()) {\n if (reachableNodeDef.props.name === expressionNode.name) {\n return reachableNodeDef\n }\n }\n return undefined\n }\n\n /**\n * Iterates over the reachable node defs, i.e. the actual context node def, the children of its ancestors\n * (including the ones inside single entities) and the ancestors themselves, yielding every node def only once.\n */\n private *iterateReachableNodeDefs(): Generator<ArenaNodeDef<NodeDefType, ArenaNodeDefProps>> {\n const { context } = this\n const { survey, includeAnalysis } = context\n\n const reachableNodeDefUuids = new Set<string>()\n const visitedUuids = new Set<string>()\n\n const queue = new Queue<ArenaNodeDef<NodeDefType>>()\n\n const actualContextNode = findActualContextNode({ context })\n if (actualContextNode) {\n queue.enqueue(actualContextNode)\n reachableNodeDefUuids.add(actualContextNode.uuid)\n yield actualContextNode\n }\n\n while (!queue.isEmpty()) {\n const entityDefCurrent = queue.dequeue()!\n const entityDefCurrentChildren = getNodeDefChildren({ survey, nodeDef: entityDefCurrent, includeAnalysis })\n for (const childDef of entityDefCurrentChildren) {\n if (!reachableNodeDefUuids.has(childDef.uuid)) {\n reachableNodeDefUuids.add(childDef.uuid)\n yield childDef\n }\n }\n // visit nodes inside single entities\n queue.enqueueItems(entityDefCurrentChildren.filter(NodeDefs.isSingleEntity))\n\n // avoid visiting 2 times the same entity definition when traversing single entities\n if (!visitedUuids.has(entityDefCurrent.uuid)) {\n const entityDefCurrentParent = getNodeDefParent({ survey, nodeDef: entityDefCurrent })\n if (entityDefCurrentParent) {\n queue.enqueue(entityDefCurrentParent)\n }\n if (!reachableNodeDefUuids.has(entityDefCurrent.uuid)) {\n reachableNodeDefUuids.add(entityDefCurrent.uuid)\n yield entityDefCurrent\n }\n visitedUuids.add(entityDefCurrent.uuid)\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../src/nodeDefExpressionEvaluator/node/identifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,OAAO,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e,EAAE,CAAC,CAAA;YAC3G,KAAK,MAAM,QAAQ,IAAI,wBAAwB,EAAE,CAAC;gBAChD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9C,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;oBACxC,MAAM,QAAQ,CAAA;gBAChB,CAAC;YACH,CAAC;YACD,qCAAqC;YACrC,KAAK,CAAC,YAAY,CAAC,wBAAwB,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAA;YAE5E,oFAAoF;YACpF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7C,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAA;gBACtF,IAAI,sBAAsB,EAAE,CAAC;oBAC3B,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;gBACvC,CAAC;gBACD,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtD,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;oBAChD,MAAM,gBAAgB,CAAA;gBACxB,CAAC;gBACD,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ArenaAnyNodeDef } from '../../nodeDef/nodeDef'\nimport { getNodeDefChildren, getNodeDefParent, getNodeDefSource } from '../../survey/surveys/nodeDefs'\nimport { NodeDefs } from '../../nodeDef/nodeDefs'\nimport { Objects, Queue } from '../../utils'\nimport { IdentifierEvaluator } from '../../expression/javascript/node/identifier'\nimport { getGlobalObjectProperty, isForbiddenPropertyName } from '../../expression/javascript/global'\nimport { NodeDefExpressionContext } from '../context'\nimport { ExpressionVariable, ArenaIdentifierExpression } from '../../expression'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ValidatorErrorKeys } from '../../validation'\nimport { NodeNativeProperties } from './nodeDefExpressionNativeProperties'\nimport { RecordNodeValues } from '../../node/nodeValues'\n\n/**\n * Determines the actual context node def\n * - attribute def => parent entity def\n * - virtual entity def => source node def\n * - entity def => entity def itself\n */\nconst findActualContextNode = (params: { context: NodeDefExpressionContext }): ArenaAnyNodeDef | undefined => {\n const { context } = params\n const { survey, object: nodeDefObjectContext } = context\n\n if (!nodeDefObjectContext) return undefined\n\n if (NodeDefs.isAttribute(nodeDefObjectContext)) {\n return getNodeDefParent({ survey, nodeDef: nodeDefObjectContext })\n }\n if (nodeDefObjectContext.virtual) {\n return getNodeDefSource({ survey, nodeDef: nodeDefObjectContext })\n }\n return nodeDefObjectContext\n}\n\nexport class NodeDefIdentifierEvaluator extends IdentifierEvaluator<NodeDefExpressionContext> {\n evaluate(expressionNode: ArenaIdentifierExpression): Promise<any> {\n try {\n return Promise.resolve(this.evaluateIdentifier(expressionNode))\n } catch (error) {\n return Promise.reject(error)\n }\n }\n\n private evaluateIdentifier(expressionNode: ArenaIdentifierExpression): any {\n const { context } = this\n const { nodeDefContext, object: objectContext, itemsFilter, memberProperty } = context\n const { name: exprName } = expressionNode\n\n if (isForbiddenPropertyName(exprName)) {\n this.throwIdentifierNotFound(expressionNode)\n }\n\n if (exprName === ExpressionVariable.CONTEXT) {\n if (nodeDefContext) {\n this.addReferencedNodeDefUuid(nodeDefContext.uuid)\n }\n return nodeDefContext\n }\n\n // global objects (e.g. Math, String)\n const globalObjectProperty = getGlobalObjectProperty(exprName, objectContext)\n if (globalObjectProperty !== null) {\n return globalObjectProperty\n }\n\n if (itemsFilter) {\n const prop = objectContext?.props?.[exprName] ?? objectContext?.props?.extra?.[exprName]\n if (!Objects.isEmpty(prop)) {\n return prop\n }\n }\n\n // check if identifier is a composite attribute value prop\n if (\n NodeDefs.isAttribute(objectContext) &&\n RecordNodeValues.isValueProp({ nodeDef: objectContext, prop: exprName })\n ) {\n return objectContext\n }\n\n if (memberProperty) {\n // property of a member expression (e.g. text_attr.length or text_attr.toUpperCase()): native properties first\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n return this.getReferencedNodeDef(expressionNode)\n }\n // identifier not in a member expression: node defs first, so that node defs named like native properties\n // (e.g. \"name\", \"type\", \"trim\") are always found (and registered as dependencies)\n const referencedNodeDef = this.findReferencedNodeDef(expressionNode)\n if (referencedNodeDef) return referencedNodeDef\n\n const nativeProperty = this.findNativeProperty(expressionNode)\n if (nativeProperty) return nativeProperty.value\n\n return this.throwIdentifierNotFound(expressionNode)\n }\n\n /**\n * Finds the identifier among the native properties or functions of the context object\n * (e.g. String.length or String.toUpperCase()).\n */\n private findNativeProperty(expressionNode: ArenaIdentifierExpression): { value: any } | null {\n const { object: objectContext } = this.context\n const { name: exprName } = expressionNode\n\n const globalOrNativeProperty = this.findGlobalOrNativeProperty(expressionNode)\n if (globalOrNativeProperty) {\n return globalOrNativeProperty\n }\n if (NodeNativeProperties.hasNativeProperty({ nodeDefOrValue: objectContext, propName: exprName })) {\n return {\n value: NodeNativeProperties.evalNodeDefProperty({ nodeDefOrValue: objectContext, propName: exprName }),\n }\n }\n return null\n }\n\n private findReferencedNodeDef(expressionNode: ArenaIdentifierExpression): ArenaAnyNodeDef | undefined {\n const { nodeDefCurrent, selfReferenceAllowed } = this.context\n const referencedNodeDef = this.findIdentifierAmongReachableNodeDefs(expressionNode)\n if (!referencedNodeDef) return undefined\n\n if (!selfReferenceAllowed && referencedNodeDef.uuid === nodeDefCurrent?.uuid) {\n throw new SystemError(ValidatorErrorKeys.expressions.cannotUseCurrentNode, { name: expressionNode.name })\n }\n this.addReferencedNodeDefUuid(referencedNodeDef.uuid)\n return referencedNodeDef\n }\n\n private getReferencedNodeDef(expressionNode: ArenaIdentifierExpression): ArenaAnyNodeDef {\n return this.findReferencedNodeDef(expressionNode) ?? this.throwIdentifierNotFound(expressionNode)\n }\n\n private throwIdentifierNotFound(expressionNode: ArenaIdentifierExpression): never {\n throw new SystemError(SystemErrorKeys.expression.identifierNotFound, {\n name: expressionNode.name,\n contextObject: this.context.object?.props?.name,\n })\n }\n\n private addReferencedNodeDefUuid(uuid: string) {\n const { context } = this\n const { referencedNodeDefUuids = new Set() } = context\n context.referencedNodeDefUuids = referencedNodeDefUuids.add(uuid)\n }\n\n /**\n * Tries to find the specified identifier among the node defs that can be \"reached\" from the context node def.\n */\n protected findIdentifierAmongReachableNodeDefs(\n expressionNode: ArenaIdentifierExpression\n ): ArenaAnyNodeDef | undefined {\n const { object: contextObject } = this.context\n\n if (!contextObject) return undefined\n\n // stop at the first match, without visiting all the reachable node defs\n for (const reachableNodeDef of this.iterateReachableNodeDefs()) {\n if (reachableNodeDef.props.name === expressionNode.name) {\n return reachableNodeDef\n }\n }\n return undefined\n }\n\n /**\n * Iterates over the reachable node defs, i.e. the actual context node def, the children of its ancestors\n * (including the ones inside single entities) and the ancestors themselves, yielding every node def only once.\n */\n private *iterateReachableNodeDefs(): Generator<ArenaAnyNodeDef> {\n const { context } = this\n const { survey, includeAnalysis } = context\n\n const reachableNodeDefUuids = new Set<string>()\n const visitedUuids = new Set<string>()\n\n const queue = new Queue<ArenaAnyNodeDef>()\n\n const actualContextNode = findActualContextNode({ context })\n if (actualContextNode) {\n queue.enqueue(actualContextNode)\n reachableNodeDefUuids.add(actualContextNode.uuid)\n yield actualContextNode\n }\n\n while (!queue.isEmpty()) {\n const entityDefCurrent = queue.dequeue()!\n const entityDefCurrentChildren = getNodeDefChildren({ survey, nodeDef: entityDefCurrent, includeAnalysis })\n for (const childDef of entityDefCurrentChildren) {\n if (!reachableNodeDefUuids.has(childDef.uuid)) {\n reachableNodeDefUuids.add(childDef.uuid)\n yield childDef\n }\n }\n // visit nodes inside single entities\n queue.enqueueItems(entityDefCurrentChildren.filter(NodeDefs.isSingleEntity))\n\n // avoid visiting 2 times the same entity definition when traversing single entities\n if (!visitedUuids.has(entityDefCurrent.uuid)) {\n const entityDefCurrentParent = getNodeDefParent({ survey, nodeDef: entityDefCurrent })\n if (entityDefCurrentParent) {\n queue.enqueue(entityDefCurrentParent)\n }\n if (!reachableNodeDefUuids.has(entityDefCurrent.uuid)) {\n reachableNodeDefUuids.add(entityDefCurrent.uuid)\n yield entityDefCurrent\n }\n visitedUuids.add(entityDefCurrent.uuid)\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeDefSelfReferences.js","sourceRoot":"","sources":["../../../../src/record/_records/nodeDefSelfReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"nodeDefSelfReferences.js","sourceRoot":"","sources":["../../../../src/record/_records/nodeDefSelfReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,MAIlC,EAAW,EAAE;IACZ,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAA;IACzD,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAClC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,E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;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAC,MAA0E,EAAW,EAAE;IACnH,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAA;IAC1C,uGAAuG;IACvG,IAAI,cAAc,KAAK,oBAAoB,CAAC,WAAW;QAAE,OAAO,KAAK,CAAA;IACrE,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,OAAO,QAAQ,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,KAAK,CACtD,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAC1B,8BAA8B,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QACpD,8BAA8B,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAChE,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,oBAAoB;CACrB,CAAA","sourcesContent":["import { ArenaAnyExpressionNode, ExpressionNodeType } from '../../expression'\nimport { parseExpression } from '../../expression/javascript/evaluator'\nimport { ArenaAnyNodeDef, NodeDefs } from '../../nodeDef'\nimport { SurveyDependencyType } from '../../survey/survey'\n\n/**\n * True if the identifier is used as (or inside) the property of a member expression (e.g. \"dbh\" in\n * \"parent(tree).tree.dbh\" or in \"tree[dbh > 10]\"): there it can refer to nodes outside the context entity.\n */\nconst isReferencedThroughMember = (params: {\n expressionNode: unknown\n name: string\n inMemberProperty: boolean\n}): boolean => {\n const { expressionNode, name, inMemberProperty } = params\n if (!expressionNode || typeof expressionNode !== 'object') return false\n if (Array.isArray(expressionNode)) {\n return expressionNode.some((item) => isReferencedThroughMember({ expressionNode: item, name, inMemberProperty }))\n }\n // parsed expression nodes (or their array or object properties)\n const node = expressionNode as ArenaAnyExpressionNode\n if (node.type === ExpressionNodeType.Identifier) {\n return inMemberProperty && node.name === name\n }\n if (node.type === ExpressionNodeType.Member) {\n const { object, property } = node\n return (\n isReferencedThroughMember({ expressionNode: object, name, inMemberProperty }) ||\n isReferencedThroughMember({ expressionNode: property, name, inMemberProperty: true })\n )\n }\n return Object.values(expressionNode).some((child) =>\n isReferencedThroughMember({ expressionNode: child, name, inMemberProperty })\n )\n}\n\nconst isExpressionSelfReferenceLocal = (params: { expression: string | undefined; name: string }): boolean => {\n const { expression, name } = params\n if (!expression) return true\n try {\n return !isReferencedThroughMember({ expressionNode: parseExpression(expression), name, inMemberProperty: false })\n } catch {\n // invalid expression: be conservative\n return false\n }\n}\n\n/**\n * Returns true if the node def references itself in its expressions of the specified dependency type only\n * as a plain identifier (e.g. \"dbh > 0\" in a validation of \"dbh\"): such a reference is resolved among the\n * children of the node's parent entity, so only the node and its siblings depend on it, not every node with\n * the same node def in the record.\n */\nconst isSelfReferenceLocal = (params: { nodeDef: ArenaAnyNodeDef; dependencyType: SurveyDependencyType }): boolean => {\n const { nodeDef, dependencyType } = params\n // self references by plain identifier are allowed only in validation expressions (see dependencies.ts)\n if (dependencyType !== SurveyDependencyType.validations) return false\n const name = NodeDefs.getName(nodeDef)\n return NodeDefs.getValidationsExpressions(nodeDef).every(\n ({ expression, applyIf }) =>\n isExpressionSelfReferenceLocal({ expression, name }) &&\n isExpressionSelfReferenceLocal({ expression: applyIf, name })\n )\n}\n\nexport const NodeDefSelfReferences = {\n isSelfReferenceLocal,\n}\n"]}
|