@openforis/arena-core 3.2.0 → 3.2.2
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/nodeValueFormatter.js +1 -0
- package/dist/esm/node/nodeValueFormatter.js.map +1 -1
- package/dist/esm/nodeDef/types/entity.js.map +1 -1
- package/dist/esm/record/recordUpdater.js.map +1 -1
- package/dist/esm/survey/index.js.map +1 -1
- package/dist/esm/survey/surveySummary.js.map +1 -1
- package/dist/esm/survey/surveys/surveyGettersSecurity.js.map +1 -1
- package/dist/esm/survey/surveys/surveysGetters.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node/nodeValueFormatter.d.ts +1 -1
- package/dist/node/nodeValueFormatter.js +1 -0
- package/dist/node/nodeValueFormatter.js.map +1 -1
- package/dist/nodeDef/types/entity.d.ts +1 -1
- package/dist/nodeDef/types/entity.js.map +1 -1
- package/dist/record/recordUpdater.d.ts +1 -1
- package/dist/record/recordUpdater.js.map +1 -1
- package/dist/survey/index.d.ts +1 -1
- package/dist/survey/index.js.map +1 -1
- package/dist/survey/surveySummary.d.ts +4 -0
- package/dist/survey/surveySummary.js.map +1 -1
- package/dist/survey/surveys/index.d.ts +3 -3
- package/dist/survey/surveys/surveyGettersSecurity.d.ts +11 -10
- package/dist/survey/surveys/surveyGettersSecurity.js.map +1 -1
- package/dist/survey/surveys/surveysGetters.d.ts +17 -16
- package/dist/survey/surveys/surveysGetters.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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f,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, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\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 {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} 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 ArenaRecordNodesMap,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\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 ArenaCoordinateAdditionalField,\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 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 ArenaRecordSummary,\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 ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\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 {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} 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,Q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UhB,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, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\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 {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} 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 ArenaRecordNodesMap,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\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 ArenaCoordinateAdditionalField,\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 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 ArenaRecordSummary,\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 ArenaSurveyOrSummary,\n ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\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 {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} 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"]}
|
|
@@ -67,6 +67,7 @@ const formatters = {
|
|
|
67
67
|
return quoteLabels ? Strings.quote(value) : value;
|
|
68
68
|
},
|
|
69
69
|
};
|
|
70
|
+
// any: null when the category item or taxon is not found, the raw value for types without a formatter
|
|
70
71
|
const format = (params) => {
|
|
71
72
|
const { nodeDef, value } = params;
|
|
72
73
|
if (Objects.isEmpty(value)) {
|
|
@@ -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,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,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAEtC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACzD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAA;IAE/B,MAAM,IAAI,SAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,YAAY,mCAAI,OAAO,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC/F,yDAAyD;IACzD,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1F,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"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G;AACtG,MAAM,MAAM,GAAG,CAAC,MAAoB,EAAO,EAAE;IAC3C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACjC,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,iCAAM,MAAM,KAAE,KAAK,EAAE,CAAC,IAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAExF,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,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: unknown\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 // a node value, or an array of values for multiple attributes\n value: unknown\n showLabel?: boolean\n quoteLabels?: boolean\n lang?: LanguageCode\n}\n\nconst formatters: { [key in NodeDefType]?: (params: FormatParams) => unknown } = {\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 as string)\n return Dates.format(dateParsed, DateFormats.dateDisplay)\n },\n [NodeDefType.decimal]: (params: FormatParams) => {\n const { value, nodeDef } = params\n return Numbers.formatDecimal(value as number, 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 as string) : value\n },\n}\n\n// any: null when the category item or taxon is not found, the raw value for types without a formatter\nconst format = (params: FormatParams): any => {\n const { nodeDef, value } = params\n if (Objects.isEmpty(value)) {\n return ''\n }\n const formatter = formatters[NodeDefs.getType(nodeDef)]\n const formatValue = (v: unknown) => (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":"entity.js","sourceRoot":"","sources":["../../../../src/nodeDef/types/entity.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,wCAAa,CAAA;IACb,0CAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefLayout, ArenaNodeDefPropsWithLayout, NodeDefType } from '../nodeDef'\n\nexport interface ArenaNodeDefEntityChildPosition {\n h?: number\n i: string\n maxH?: number\n minH?: number\n minW?: number\n moved?: boolean\n static?: boolean\n w?: number\n x: number\n y: number\n}\n\nexport type ArenaNodeDefEntityLayoutChildItem = ArenaNodeDefEntityChildPosition | string\n\nexport type ArenaNodeDefPrintOrientation = 'portrait' | 'landscape'\n\nexport interface ArenaNodeDefEntityProps extends ArenaNodeDefPropsWithLayout<ArenaNodeDefEntityLayout> {\n // Applies only to multiple entities; when true, missing repetitions up to min count are auto-created.\n autoCreateMinCountItems?: boolean\n enumerate?: boolean\n /** When set, printable export uses this orientation for the entity's print section. */\n printOrientation?: ArenaNodeDefPrintOrientation\n}\n\nexport enum NodeDefEntityRenderType {\n form = 'form',\n table = 'table',\n}\n\nexport interface ArenaNodeDefEntityLayout extends ArenaNodeDefLayout {\n columnsNo?: number\n indexChildren?: string[] // sorted children pages uuids\n layoutChildren?: ArenaNodeDefEntityLayoutChildItem[]\n pageUuid?: string\n renderType
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../../src/nodeDef/types/entity.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,wCAAa,CAAA;IACb,0CAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefLayout, ArenaNodeDefPropsWithLayout, NodeDefType } from '../nodeDef'\n\nexport interface ArenaNodeDefEntityChildPosition {\n h?: number\n i: string\n maxH?: number\n minH?: number\n minW?: number\n moved?: boolean\n static?: boolean\n w?: number\n x: number\n y: number\n}\n\nexport type ArenaNodeDefEntityLayoutChildItem = ArenaNodeDefEntityChildPosition | string\n\nexport type ArenaNodeDefPrintOrientation = 'portrait' | 'landscape'\n\nexport interface ArenaNodeDefEntityProps extends ArenaNodeDefPropsWithLayout<ArenaNodeDefEntityLayout> {\n // Applies only to multiple entities; when true, missing repetitions up to min count are auto-created.\n autoCreateMinCountItems?: boolean\n enumerate?: boolean\n /** When set, printable export uses this orientation for the entity's print section. */\n printOrientation?: ArenaNodeDefPrintOrientation\n}\n\nexport enum NodeDefEntityRenderType {\n form = 'form',\n table = 'table',\n}\n\nexport interface ArenaNodeDefEntityLayout extends ArenaNodeDefLayout {\n columnsNo?: number\n indexChildren?: string[] // sorted children pages uuids\n layoutChildren?: ArenaNodeDefEntityLayoutChildItem[]\n pageUuid?: string\n renderType?: NodeDefEntityRenderType\n}\n\nexport type ArenaNodeDefEntity = ArenaNodeDef<NodeDefType.entity, ArenaNodeDefEntityProps>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../../src/record/recordUpdater.ts"],"names":[],"mappings":";;;;;;;;;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ED,MAAM,UAAU,GAAG,CAAO,MAA2D,EAA+B,EAAE;IACpH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAC3B,OAAO,WAAW,iCAAM,MAAM,KAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,IAAG,CAAA;AAC1D,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,+HAA+H;IAC/H,iBAAiB;IACjB,gIAAgI;IAChI,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,kIAAkI;IAClI,UAAU;IACV,qIAAqI;IACrI,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { SystemError, SystemErrorKeys } from '../error'\nimport { ArenaRecordNode, ArenaRecordNodePointer, ArenaRecordNodesMap } from '../node'\nimport { ArenaNodeDef, NodeDefs } from '../nodeDef'\nimport { ArenaSurvey, SurveyDependencyType, Surveys } from '../survey'\nimport { Dates, Objects } from '../utils'\nimport { Validations } from '../validation/validations'\nimport { RecordNodePointers } from './nodePointers'\nimport { ArenaRecord } from './record'\nimport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nimport { ArenaRecordNodeCreateParams, ArenaRecordNodesUpdateParams } from './recordNodesUpdater/recordNodesCreator'\nimport { Records } from './records'\nimport { RecordValidator } from './recordValidator'\n\nconst validationDependencyTypes = [\n SurveyDependencyType.validations,\n SurveyDependencyType.required,\n SurveyDependencyType.minCount,\n SurveyDependencyType.maxCount,\n]\n\nconst getDependentValidationNodePointers = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: ArenaRecordNodesMap\n}): ArenaRecordNodePointer[] => {\n const { survey, record, nodes } = params\n const uniquePointersByKey = new Map<string, ArenaRecordNodePointer>()\n for (const node of Object.values(nodes)) {\n for (const dependencyType of validationDependencyTypes) {\n const nodePointers = Records.getDependentNodePointers(survey, node, dependencyType)(record)\n for (const pointer of nodePointers) {\n const nodeCtxUuid = pointer.nodeCtx.uuid\n const nodeDefUuid = pointer.nodeDef.uuid\n const key = `${nodeCtxUuid ?? ''}:${nodeDefUuid ?? ''}`\n if (!uniquePointersByKey.has(key)) {\n uniquePointersByKey.set(key, pointer)\n }\n }\n }\n }\n return Array.from(uniquePointersByKey.values())\n}\n\nconst _onRecordNodesCreateOrUpdate = async (\n params: ArenaRecordNodesUpdateParams & {\n nodes: ArenaDictionary<ArenaRecordNode>\n additionalNodesToValidate?: ArenaRecordNodesMap\n }\n): Promise<RecordUpdateResult> => {\n const {\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n additionalNodesToValidate,\n dateModified = Dates.nowFormattedForStorage(),\n } = params\n\n const updateResult = await RecordNodesUpdater.updateNodesDependents(params)\n const { nodes: updatedNodes, record: updatedRecord } = updateResult\n\n const dependentValidationNodePointers = getDependentValidationNodePointers({\n survey,\n record: updatedRecord,\n nodes: updatedNodes,\n })\n\n const dependentValidationNodes = RecordNodePointers.getNodesMapFromNodePointers({\n record: updatedRecord,\n nodePointers: dependentValidationNodePointers,\n })\n\n const nodesToValidate = { ...updatedNodes, ...dependentValidationNodes, ...additionalNodesToValidate }\n\n const validationUpdatedNodes = await RecordValidator.validateNodes({\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n record: updatedRecord,\n nodes: nodesToValidate,\n })\n\n const validation = Validations.mergeValidations(validationUpdatedNodes)(Validations.getValidation(updatedRecord))\n updatedRecord.validation = validation\n updatedRecord.dateModified = dateModified\n\n updateResult.validation = validation\n\n return updateResult\n}\n\nconst createDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createNodeAndDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addNodeAndDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createRootEntity = async (\n params: ArenaRecordNodesUpdateParams & {\n createMultipleEntities?: boolean\n }\n): Promise<RecordUpdateResult> => {\n const { survey, createMultipleEntities = true } = params\n\n return createNodeAndDescendants({ ...params, nodeDef: Surveys.getNodeDefRoot({ survey }), createMultipleEntities })\n}\n\nconst updateAttributeValue = async (\n params: ArenaRecordNodesUpdateParams & {\n attributeUuid: string\n value: any\n }\n): Promise<RecordUpdateResult> => {\n const { attributeUuid, record, value, dateModified = Dates.nowFormattedForStorage(), sideEffect = false } = params\n const attribute = Records.getNodeByUuid(attributeUuid)(record)\n if (!attribute) throw new SystemError(SystemErrorKeys.record.nodeNotFound, { uuid: attributeUuid })\n\n let attributeUpdated = sideEffect ? attribute : { ...attribute }\n attributeUpdated.value = value\n attributeUpdated.dateModified = dateModified\n // reset defaultValueApplied flag\n attributeUpdated = Objects.dissocPath({ obj: attributeUpdated, path: ['meta', 'defaultValueApplied'], sideEffect })\n\n const nodesUpdated = { [attributeUuid]: attributeUpdated }\n\n const _record = Records.addNode(attributeUpdated, { sideEffect })(record)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: _record, nodes: nodesUpdated })\n}\n\n/**\n * Returns the key and unique attributes of the siblings of the specified entities:\n * they could have been duplicates of the ones being deleted, so they must be validated again.\n */\nconst getEntityKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n uniqueAttributeDefs: ArenaNodeDef<any>[]\n}): ArenaRecordNode[] => {\n const { survey, record, entity, uniqueAttributeDefs } = params\n return [\n ...Records.getEntityKeyNodes(survey, entity)(record),\n ...uniqueAttributeDefs.flatMap((uniqueDef) => Records.getChildren(entity, uniqueDef.uuid)(record)),\n ].filter(Boolean)\n}\n\nconst getSiblingKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodeUuids: string[]\n}): ArenaRecordNodesMap => {\n const { survey, record, nodeUuids } = params\n const nodeUuidsSet = new Set(nodeUuids)\n const result: ArenaRecordNodesMap = {}\n for (const nodeUuid of nodeUuids) {\n const node = Records.getNodeByUuid(nodeUuid)(record)\n const parentNode = node ? Records.getParent(node)(record) : undefined\n const nodeDef = node ? Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid }) : undefined\n if (!parentNode || !nodeDef || !NodeDefs.isEntity(nodeDef)) continue\n\n const uniqueAttributeDefs = Surveys.getNodeDefChildren({ survey, nodeDef }).filter(\n (childDef) => NodeDefs.getValidations(childDef)?.unique\n )\n const siblings = Records.getChildren(parentNode, nodeDef.uuid)(record).filter((s) => !nodeUuidsSet.has(s.uuid))\n for (const sibling of siblings) {\n for (const attribute of getEntityKeyOrUniqueAttributes({\n survey,\n record,\n entity: sibling,\n uniqueAttributeDefs,\n })) {\n result[attribute.uuid] = attribute\n }\n }\n }\n return result\n}\n\nconst deleteNodes = async (\n params: ArenaRecordNodesUpdateParams & {\n nodeUuids: string[]\n }\n): Promise<RecordUpdateResult> => {\n const { survey, nodeUuids, record: _record, sideEffect = false } = params\n\n // found before removing the nodes: the deleted nodes are no longer reachable from their siblings afterwards\n const siblingKeyOrUniqueAttributes = getSiblingKeyOrUniqueAttributes({ survey, record: _record, nodeUuids })\n\n const updateResult = Records.removeNodes(nodeUuids, { sideEffect })(_record)\n const { record, nodesDeleted } = updateResult\n\n const result = await _onRecordNodesCreateOrUpdate({\n ...params,\n record,\n nodes: nodesDeleted,\n additionalNodesToValidate: siblingKeyOrUniqueAttributes,\n })\n result.nodesDeleted = nodesDeleted\n return result\n}\n\nconst deleteNode = async (params: ArenaRecordNodesUpdateParams & { nodeUuid: string }): Promise<RecordUpdateResult> => {\n const { nodeUuid } = params\n return deleteNodes({ ...params, nodeUuids: [nodeUuid] })\n}\n\nexport const RecordUpdater = {\n /** Creates the descendants of a node and updates dependents (applicability, default values, calculations...) and validation */\n createDescendants,\n /** Creates a node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n createNodeAndDescendants,\n createRootEntity,\n updateAttributeValue,\n /** Deletes the node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNode,\n /** Deletes the nodes and their descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNodes,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../../src/record/recordUpdater.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAAgB,QAAQ,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAe,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,sBAAsB,CAAA;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,yBAAyB,GAAG;IAChC,oBAAoB,CAAC,WAAW;IAChC,oBAAoB,CAAC,QAAQ;IAC7B,oBAAoB,CAAC,QAAQ;IAC7B,oBAAoB,CAAC,QAAQ;CAC9B,CAAA;AAED,MAAM,kCAAkC,GAAG,CAAC,MAI3C,EAA4B,EAAE;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACxC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkC,CAAA;IACrE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,KAAK,MAAM,cAAc,IAAI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AAC,OAAO,CAAC,CAAA;IAC5E,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,CAAA;IAE7C,MAAM,MAAM,GAAG,MAAM,4BAA4B,iCAC5C,MAAM,KACT,MAAM,EACN,KAAK,EAAE,YAAY,EACnB,yBAAyB,EAAE,4BAA4B,IACvD,CAAA;IACF,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,OAAO,MAAM,CAAA;AACf,CAAC,CAAA,CAAA;AAED,MAAM,UAAU,GAAG,CAAO,MAA2D,EAA+B,EAAE;IACpH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAC3B,OAAO,WAAW,iCAAM,MAAM,KAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,IAAG,CAAA;AAC1D,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,+HAA+H;IAC/H,iBAAiB;IACjB,gIAAgI;IAChI,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,kIAAkI;IAClI,UAAU;IACV,qIAAqI;IACrI,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { SystemError, SystemErrorKeys } from '../error'\nimport { ArenaRecordNode, ArenaRecordNodePointer, ArenaRecordNodesMap } from '../node'\nimport { ArenaNodeDef, NodeDefs } from '../nodeDef'\nimport { ArenaSurvey, SurveyDependencyType, Surveys } from '../survey'\nimport { Dates, Objects } from '../utils'\nimport { Validations } from '../validation/validations'\nimport { RecordNodePointers } from './nodePointers'\nimport { ArenaRecord } from './record'\nimport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nimport { ArenaRecordNodeCreateParams, ArenaRecordNodesUpdateParams } from './recordNodesUpdater/recordNodesCreator'\nimport { Records } from './records'\nimport { RecordValidator } from './recordValidator'\n\nconst validationDependencyTypes = [\n SurveyDependencyType.validations,\n SurveyDependencyType.required,\n SurveyDependencyType.minCount,\n SurveyDependencyType.maxCount,\n]\n\nconst getDependentValidationNodePointers = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: ArenaRecordNodesMap\n}): ArenaRecordNodePointer[] => {\n const { survey, record, nodes } = params\n const uniquePointersByKey = new Map<string, ArenaRecordNodePointer>()\n for (const node of Object.values(nodes)) {\n for (const dependencyType of validationDependencyTypes) {\n const nodePointers = Records.getDependentNodePointers(survey, node, dependencyType)(record)\n for (const pointer of nodePointers) {\n const nodeCtxUuid = pointer.nodeCtx.uuid\n const nodeDefUuid = pointer.nodeDef.uuid\n const key = `${nodeCtxUuid ?? ''}:${nodeDefUuid ?? ''}`\n if (!uniquePointersByKey.has(key)) {\n uniquePointersByKey.set(key, pointer)\n }\n }\n }\n }\n return Array.from(uniquePointersByKey.values())\n}\n\nconst _onRecordNodesCreateOrUpdate = async (\n params: ArenaRecordNodesUpdateParams & {\n nodes: ArenaDictionary<ArenaRecordNode>\n additionalNodesToValidate?: ArenaRecordNodesMap\n }\n): Promise<RecordUpdateResult> => {\n const {\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n additionalNodesToValidate,\n dateModified = Dates.nowFormattedForStorage(),\n } = params\n\n const updateResult = await RecordNodesUpdater.updateNodesDependents(params)\n const { nodes: updatedNodes, record: updatedRecord } = updateResult\n\n const dependentValidationNodePointers = getDependentValidationNodePointers({\n survey,\n record: updatedRecord,\n nodes: updatedNodes,\n })\n\n const dependentValidationNodes = RecordNodePointers.getNodesMapFromNodePointers({\n record: updatedRecord,\n nodePointers: dependentValidationNodePointers,\n })\n\n const nodesToValidate = { ...updatedNodes, ...dependentValidationNodes, ...additionalNodesToValidate }\n\n const validationUpdatedNodes = await RecordValidator.validateNodes({\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n record: updatedRecord,\n nodes: nodesToValidate,\n })\n\n const validation = Validations.mergeValidations(validationUpdatedNodes)(Validations.getValidation(updatedRecord))\n updatedRecord.validation = validation\n updatedRecord.dateModified = dateModified\n\n updateResult.validation = validation\n\n return updateResult\n}\n\nconst createDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createNodeAndDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addNodeAndDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createRootEntity = async (\n params: ArenaRecordNodesUpdateParams & {\n createMultipleEntities?: boolean\n }\n): Promise<RecordUpdateResult> => {\n const { survey, createMultipleEntities = true } = params\n\n return createNodeAndDescendants({ ...params, nodeDef: Surveys.getNodeDefRoot({ survey }), createMultipleEntities })\n}\n\nconst updateAttributeValue = async (\n params: ArenaRecordNodesUpdateParams & {\n attributeUuid: string\n // its shape depends on the attribute type (see ArenaRecordNodeValue)\n value: unknown\n }\n): Promise<RecordUpdateResult> => {\n const { attributeUuid, record, value, dateModified = Dates.nowFormattedForStorage(), sideEffect = false } = params\n const attribute = Records.getNodeByUuid(attributeUuid)(record)\n if (!attribute) throw new SystemError(SystemErrorKeys.record.nodeNotFound, { uuid: attributeUuid })\n\n let attributeUpdated = sideEffect ? attribute : { ...attribute }\n attributeUpdated.value = value\n attributeUpdated.dateModified = dateModified\n // reset defaultValueApplied flag\n attributeUpdated = Objects.dissocPath({ obj: attributeUpdated, path: ['meta', 'defaultValueApplied'], sideEffect })\n\n const nodesUpdated = { [attributeUuid]: attributeUpdated }\n\n const _record = Records.addNode(attributeUpdated, { sideEffect })(record)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: _record, nodes: nodesUpdated })\n}\n\n/**\n * Returns the key and unique attributes of the siblings of the specified entities:\n * they could have been duplicates of the ones being deleted, so they must be validated again.\n */\nconst getEntityKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n uniqueAttributeDefs: ArenaNodeDef<any>[]\n}): ArenaRecordNode[] => {\n const { survey, record, entity, uniqueAttributeDefs } = params\n return [\n ...Records.getEntityKeyNodes(survey, entity)(record),\n ...uniqueAttributeDefs.flatMap((uniqueDef) => Records.getChildren(entity, uniqueDef.uuid)(record)),\n ].filter(Boolean)\n}\n\nconst getSiblingKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodeUuids: string[]\n}): ArenaRecordNodesMap => {\n const { survey, record, nodeUuids } = params\n const nodeUuidsSet = new Set(nodeUuids)\n const result: ArenaRecordNodesMap = {}\n for (const nodeUuid of nodeUuids) {\n const node = Records.getNodeByUuid(nodeUuid)(record)\n const parentNode = node ? Records.getParent(node)(record) : undefined\n const nodeDef = node ? Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid }) : undefined\n if (!parentNode || !nodeDef || !NodeDefs.isEntity(nodeDef)) continue\n\n const uniqueAttributeDefs = Surveys.getNodeDefChildren({ survey, nodeDef }).filter(\n (childDef) => NodeDefs.getValidations(childDef)?.unique\n )\n const siblings = Records.getChildren(parentNode, nodeDef.uuid)(record).filter((s) => !nodeUuidsSet.has(s.uuid))\n for (const sibling of siblings) {\n for (const attribute of getEntityKeyOrUniqueAttributes({\n survey,\n record,\n entity: sibling,\n uniqueAttributeDefs,\n })) {\n result[attribute.uuid] = attribute\n }\n }\n }\n return result\n}\n\nconst deleteNodes = async (\n params: ArenaRecordNodesUpdateParams & {\n nodeUuids: string[]\n }\n): Promise<RecordUpdateResult> => {\n const { survey, nodeUuids, record: _record, sideEffect = false } = params\n\n // found before removing the nodes: the deleted nodes are no longer reachable from their siblings afterwards\n const siblingKeyOrUniqueAttributes = getSiblingKeyOrUniqueAttributes({ survey, record: _record, nodeUuids })\n\n const updateResult = Records.removeNodes(nodeUuids, { sideEffect })(_record)\n const { record, nodesDeleted } = updateResult\n\n const result = await _onRecordNodesCreateOrUpdate({\n ...params,\n record,\n nodes: nodesDeleted,\n additionalNodesToValidate: siblingKeyOrUniqueAttributes,\n })\n result.nodesDeleted = nodesDeleted\n return result\n}\n\nconst deleteNode = async (params: ArenaRecordNodesUpdateParams & { nodeUuid: string }): Promise<RecordUpdateResult> => {\n const { nodeUuid } = params\n return deleteNodes({ ...params, nodeUuids: [nodeUuid] })\n}\n\nexport const RecordUpdater = {\n /** Creates the descendants of a node and updates dependents (applicability, default values, calculations...) and validation */\n createDescendants,\n /** Creates a node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n createNodeAndDescendants,\n createRootEntity,\n updateAttributeValue,\n /** Deletes the node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNode,\n /** Deletes the nodes and their descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNodes,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/survey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAkB/D,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,UAAU,CAAA;AAIjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAMzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { NodeDefsFixer } from './nodeDefsFixer'\nexport { SurveyDocImages } from './surveyDocImages'\nexport { SurveyFileFactory, SurveyFileType } from './surveyFileFactory'\nexport { SurveyDocImageFactory } from './surveyDocImageFactory'\nexport type { ArenaSurveyFileFactoryParams } from './surveyFileFactory'\nexport type { ArenaSurveyDocImageFactoryParams } from './surveyDocImageFactory'\n\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDependency,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveySecurity,\n} from './survey'\n\nexport {\n defaultCycle,\n SurveyDependencyType,\n SurveyDocPlace,\n SurveySecurityProp,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n} from './survey'\n\nexport type { ArenaSurveySummary } from './surveySummary'\n\nexport { Surveys } from './surveys'\n\nexport { SurveyFactory } from './factory'\n\nexport type { ArenaSurveyService } from './service'\n\nexport type { ArenaSurveyRefData } from './refData'\n\nexport { SurveyRefDataFactory } from './refData'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/survey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAkB/D,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,UAAU,CAAA;AAIjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAMzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { NodeDefsFixer } from './nodeDefsFixer'\nexport { SurveyDocImages } from './surveyDocImages'\nexport { SurveyFileFactory, SurveyFileType } from './surveyFileFactory'\nexport { SurveyDocImageFactory } from './surveyDocImageFactory'\nexport type { ArenaSurveyFileFactoryParams } from './surveyFileFactory'\nexport type { ArenaSurveyDocImageFactoryParams } from './surveyDocImageFactory'\n\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDependency,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveySecurity,\n} from './survey'\n\nexport {\n defaultCycle,\n SurveyDependencyType,\n SurveyDocPlace,\n SurveySecurityProp,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n} from './survey'\n\nexport type { ArenaSurveyOrSummary, ArenaSurveySummary } from './surveySummary'\n\nexport { Surveys } from './surveys'\n\nexport { SurveyFactory } from './factory'\n\nexport type { ArenaSurveyService } from './service'\n\nexport type { ArenaSurveyRefData } from './refData'\n\nexport { SurveyRefDataFactory } from './refData'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveySummary.js","sourceRoot":"","sources":["../../../src/survey/surveySummary.ts"],"names":[],"mappings":"","sourcesContent":["import type { ArenaAuthGroup } from '../auth'\nimport type { ArenaSurvey } from './survey'\n\n/**\n * Item of the surveys list returned by the server: survey without node defs and reference data, plus list fields.\n */\nexport type ArenaSurveySummary = Omit<\n ArenaSurvey,\n 'authGroups' | 'categories' | 'dependencyGraph' | 'nodeDefs' | 'nodeDefsIndex' | 'refData' | 'taxonomies'\n> & {\n authGroups?: ArenaAuthGroup[]\n defaultLabel?: string\n ownerName?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"surveySummary.js","sourceRoot":"","sources":["../../../src/survey/surveySummary.ts"],"names":[],"mappings":"","sourcesContent":["import type { ArenaAuthGroup } from '../auth'\nimport type { ArenaSurvey } from './survey'\n\n/**\n * Item of the surveys list returned by the server: survey without node defs and reference data, plus list fields.\n */\nexport type ArenaSurveySummary = Omit<\n ArenaSurvey,\n 'authGroups' | 'categories' | 'dependencyGraph' | 'nodeDefs' | 'nodeDefsIndex' | 'refData' | 'taxonomies'\n> & {\n authGroups?: ArenaAuthGroup[]\n defaultLabel?: string\n ownerName?: string\n}\n\n/**\n * A full survey or a survey summary: accepted by the getters that only read the survey props.\n */\nexport type ArenaSurveyOrSummary = ArenaSurvey | ArenaSurveySummary\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveyGettersSecurity.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveyGettersSecurity.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"surveyGettersSecurity.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveyGettersSecurity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAG3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAA4B,EAAuB,EAAE,kBAAC,iCAC7E,sBAAsB,GACtB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,QAAQ,EAC1B,GAAA,CAAA;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAChC,CAAC,IAAwB,EAAE,EAAE,CAC7B,CAAC,MAA4B,EAAW,EAAE,CACxC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;AAE/B,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,MAA4B,EAAW,EAAE,CAC9F,qBAAqB,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAA;AAExF,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,MAA4B,EAAW,EAAE,CAC/F,qBAAqB,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAW,EAAE,CACzE,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACxF,qBAAqB,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACxF,qBAAqB,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhF,MAAM,CAAC,MAAM,0CAA0C,GAAG,CAAC,MAA4B,EAAW,EAAE,CAClG,qBAAqB,CAAC,kBAAkB,CAAC,sCAAsC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACzF,qBAAqB,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import { ArenaSurveySecurity, surveySecurityDefaults, SurveySecurityProp } from '../survey'\nimport type { ArenaSurveyOrSummary } from '../surveySummary'\n\nexport const getSecurity = (survey: ArenaSurveyOrSummary): ArenaSurveySecurity => ({\n ...surveySecurityDefaults,\n ...survey?.props?.security,\n})\n\nexport const isSecurityPropEnabled =\n (prop: SurveySecurityProp) =>\n (survey: ArenaSurveyOrSummary): boolean =>\n !!getSecurity(survey)[prop]\n\nexport const isDataEditorViewNotOwnedRecordsAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.dataEditorViewNotOwnedRecordsAllowed)(survey)\n\nexport const isDataAnalystViewNotOwnedRecordsAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.dataAnalystViewNotOwnedRecordsAllowed)(survey)\n\nexport const isVisibleInMobile = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.visibleInMobile)(survey)\n\nexport const isRecordsDownloadInMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsDownloadInMobile)(survey)\n\nexport const isRecordsUploadFromMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsUploadFromMobile)(survey)\n\nexport const isRecordsWithErrorsUploadFromMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsWithErrorsUploadFromMobile)(survey)\n\nexport const isRecordsMergeWithSameKeysAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsMergeWithSameKeys)(survey)\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAA;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAA;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI7C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAA4B,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAA;AAElF,MAAM,CAAC,MAAM,YAA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4B,EAAmC,EAAE,kDAClG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,eAAe;AAC9B,uEAAuE;AACvE,MAAA,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,IAAI,0CAAE,KAAK,0CAAE,eAAe,mCAC7C,EAAE,GAAA,CAAA;AAEJ,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAGvC,EAA6C,EAAE,CAC9C,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAA;AAEjG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAmB,EAAwB,EAAE,wBAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAEpG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAkC,EAAE,CACvF,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import { AuthGroupName, ArenaUserAuthGroup } from '../../auth'\nimport { ArenaCategory } from '../../category'\nimport type { ArenaAreaOfInterestDescriptor } from '../../geo'\nimport { LanguageCode } from '../../language'\nimport { getLabelOrDefault } from '../../language/labels'\nimport { ArenaSRS, ArenaSRSIndex } from '../../srs'\nimport { ArenaTaxonomy } from '../../taxonomy'\nimport { Arrays, Objects } from '../../utils'\nimport { ArenaSurvey } from '../survey'\nimport type { ArenaSurveyOrSummary } from '../surveySummary'\n\nexport const getName = (survey: ArenaSurveyOrSummary): string => survey.props.name\n\nexport const getLanguages = (survey: ArenaSurveyOrSummary): LanguageCode[] => survey.props.languages\n\nexport const getDefaultLanguage = (survey: ArenaSurveyOrSummary): LanguageCode => getLanguages(survey)[0]\n\nconst getMultilangPropValue =\n (prop: 'labels' | 'descriptions' | 'fieldManualLinks') =>\n (langCode?: LanguageCode) =>\n (survey: ArenaSurveyOrSummary): string | undefined => {\n const languageCode = langCode ?? getDefaultLanguage(survey)\n return survey.props[prop]?.[languageCode]\n }\nexport const getLabel = getMultilangPropValue('labels')\nexport const getDescription = getMultilangPropValue('descriptions')\nexport const getFieldManualLink = getMultilangPropValue('fieldManualLinks')\n\n/**\n * Returns the survey label in the specified language (the default language if not specified), or the survey name\n * when the label is missing or empty.\n */\nexport const getLabelOrName =\n (langCode?: LanguageCode) =>\n (survey: ArenaSurveyOrSummary): string =>\n getLabelOrDefault(survey.props.labels, langCode ?? getDefaultLanguage(survey), getName(survey))\n\nexport const getCategoryByName = (params: { survey: ArenaSurvey; categoryName: string }): ArenaCategory | undefined => {\n const { survey, categoryName } = params\n return survey.categories\n ? Object.values(survey.categories).find((category) => category.props.name === categoryName)\n : undefined\n}\n\nexport const getCategoryByUuid = (params: { survey: ArenaSurvey; categoryUuid: string }): ArenaCategory | undefined => {\n const { survey, categoryUuid } = params\n return survey.categories?.[categoryUuid]\n}\n\nexport const getTaxonomyByName = (params: { survey: ArenaSurvey; taxonomyName: string }): ArenaTaxonomy | undefined => {\n const { survey, taxonomyName } = params\n return survey.taxonomies\n ? Object.values(survey.taxonomies).find((taxonomy) => taxonomy.props.name === taxonomyName)\n : undefined\n}\n\nexport const getTaxonomyByUuid = (params: { survey: ArenaSurvey; taxonomyUuid: string }): ArenaTaxonomy | undefined => {\n const { survey, taxonomyUuid } = params\n return survey.taxonomies?.[taxonomyUuid]\n}\n\nexport const getCycleKeys = (survey: ArenaSurveyOrSummary): string[] => {\n const cycles = survey.props?.cycles ?? {}\n return Object.keys(cycles)\n}\n\nexport const getLastCycleKey = (survey: ArenaSurveyOrSummary): string => Arrays.last(getCycleKeys(survey)) as string\n\nexport const isKeepNonApplicableValues = (survey: ArenaSurveyOrSummary): boolean =>\n survey?.props?.keepNonApplicableValues === true\n\nexport const getDefaultCycleKey = (survey: ArenaSurveyOrSummary) => {\n const defaultCycleKey = survey.props?.defaultCycleKey\n const lastCycleKey = getLastCycleKey(survey)\n return Objects.isEmpty(defaultCycleKey) || Number(defaultCycleKey) > Number(lastCycleKey)\n ? lastCycleKey\n : defaultCycleKey\n}\n\nexport const getSRSs = (survey: ArenaSurveyOrSummary): ArenaSRS[] =>\n survey.props?.srs ??\n // backwards compatibility with Arena: srs stored in info in UI\n (survey as any).info?.props?.srs ??\n []\n\nexport const getSRSIndex = (survey: ArenaSurveyOrSummary): ArenaSRSIndex =>\n getSRSs(survey).reduce((acc: ArenaSRSIndex, srs) => {\n acc[srs.code] = srs\n return acc\n }, {})\n\nexport const getSRSByCode =\n (code: string) =>\n (survey: ArenaSurveyOrSummary): ArenaSRS | undefined =>\n getSRSIndex(survey)[code]\n\nexport const getAreasOfInterest = (survey: ArenaSurveyOrSummary): ArenaAreaOfInterestDescriptor[] =>\n survey?.props?.areasOfInterest ??\n // backwards compatibility with Arena: survey info props stored in info\n (survey as any)?.info?.props?.areasOfInterest ??\n []\n\nexport const getAreaOfInterestByName = (params: {\n survey: ArenaSurveyOrSummary\n name: string\n}): ArenaAreaOfInterestDescriptor | undefined =>\n getAreasOfInterest(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name)\n\nexport const getAuthGroups = (survey: ArenaSurvey): ArenaUserAuthGroup[] => survey?.authGroups ?? []\n\nexport const getAuthGroupAdmin = (survey: ArenaSurvey): ArenaUserAuthGroup | undefined =>\n getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin)\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type { ArenaServiceTypeMap } from './registry';
|
|
|
39
39
|
export { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs';
|
|
40
40
|
export type { ArenaSRS, ArenaSRSIndex } from './srs';
|
|
41
41
|
export { NodeDefsFixer, SurveyDocImages, SurveyDocImageFactory, SurveyDocPlace, SurveyDependencyType, SurveyFactory, SurveyFileFactory, SurveyFileType, SurveyRefDataFactory, SurveySecurityProp, Surveys, surveyDocImagePropKeys, surveySecurityDefaults, defaultCycle, } from './survey';
|
|
42
|
-
export type { ArenaSurvey, ArenaSurveyCycle, ArenaSurveyDependency, ArenaSurveyDependencyGraph, ArenaSurveyDocImage, ArenaSurveyDocImageFactoryParams, ArenaSurveyDocImageProps, ArenaSurveyFile, ArenaSurveyFileFactoryParams, ArenaSurveyFileProps, ArenaSurveyNodeDefsIndex, ArenaSurveyProps, ArenaSurveyRefData, ArenaSurveySecurity, ArenaSurveyService, ArenaSurveySummary, } from './survey';
|
|
42
|
+
export type { ArenaSurvey, ArenaSurveyCycle, ArenaSurveyDependency, ArenaSurveyDependencyGraph, ArenaSurveyDocImage, ArenaSurveyDocImageFactoryParams, ArenaSurveyDocImageProps, ArenaSurveyFile, ArenaSurveyFileFactoryParams, ArenaSurveyFileProps, ArenaSurveyNodeDefsIndex, ArenaSurveyProps, ArenaSurveyRefData, ArenaSurveySecurity, ArenaSurveyService, ArenaSurveyOrSummary, ArenaSurveySummary, } from './survey';
|
|
43
43
|
export { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy';
|
|
44
44
|
export type { ArenaVernacularNameParams, ArenaTaxonomyFactoryParams, ArenaTaxonFactoryParams, ArenaTaxonomy, ArenaVernacularNameProps, ArenaVernacularName, ArenaTaxonProps, ArenaTaxon, ArenaTaxonomyProps, } from './taxonomy';
|
|
45
45
|
export { SurveyBuilder, SurveyObjectBuilders } from './tests/builder/surveyBuilder';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,+BASe;AARb,kGAAA,UAAU,OAAA;AACV,qGAAA,aAAa,OAAA;AACb,+GAAA,uBAAuB,OAAA;AACvB,kGA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AARnB,6GAAA,eAAe,OAAA;AACf,+GAAA,iBAAiB,OAAA;AACjB,qHAAA,uBAAuB,OAAA;AACvB,+GAAA,iBAAiB,OAAA;AACjB,yGAAA,WAAW,OAAA;AACX,gHAAA,kBAAkB,OAAA;AAClB,uGAAA,SAAS,OAAA;AACT,gHAAA,kBAAkB,OAAA","sourcesContent":["export type { 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, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\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 {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} 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 ArenaRecordNodesMap,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\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 ArenaCoordinateAdditionalField,\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 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 ArenaRecordSummary,\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 ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\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 {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} 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,+BASe;AAR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mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AACL,iGAAA,QAAQ,OAAA;AAWV,2CASqB;AARnB,6GAAA,eAAe,OAAA;AACf,+GAAA,iBAAiB,OAAA;AACjB,qHAAA,uBAAuB,OAAA;AACvB,+GAAA,iBAAiB,OAAA;AACjB,yGAAA,WAAW,OAAA;AACX,gHAAA,kBAAkB,OAAA;AAClB,uGAAA,SAAS,OAAA;AACT,gHAAA,kBAAkB,OAAA","sourcesContent":["export type { 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, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\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 {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} 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 ArenaRecordNodesMap,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\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 ArenaCoordinateAdditionalField,\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 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 ArenaRecordSummary,\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 ArenaSurveyOrSummary,\n ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\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 {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} 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"]}
|
|
@@ -70,6 +70,7 @@ const formatters = {
|
|
|
70
70
|
return quoteLabels ? utils_1.Strings.quote(value) : value;
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
|
+
// any: null when the category item or taxon is not found, the raw value for types without a formatter
|
|
73
74
|
const format = (params) => {
|
|
74
75
|
const { nodeDef, value } = params;
|
|
75
76
|
if (utils_1.Objects.isEmpty(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeValueFormatter.js","sourceRoot":"","sources":["../../src/node/nodeValueFormatter.ts"],"names":[],"mappings":";;;AAAA,0CAA8D;AAE9D,wCAA0G;AAC1G,sCAAgD;AAChD,0CAAkC;AAClC,oCAAwE;AAExE,6CAA+C;AAE/C,MAAM,mBAAmB,GAAG,CAAC,MAI5B,EAAiC,EAAE;;;IAClC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAEtC,MAAM,QAAQ,GAAG,6BAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACzD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAA;IAE/B,MAAM,IAAI,SAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,YAAY,mCAAI,gBAAO,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC/F,yDAAyD;IACzD,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,eAAO,CAAC,UAAU,CAAC,wBAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1F,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"nodeValueFormatter.js","sourceRoot":"","sources":["../../src/node/nodeValueFormatter.ts"],"names":[],"mappings":";;;AAAA,0CAA8D;AAE9D,wCAA0G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,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,iCAAM,MAAM,KAAE,KAAK,EAAE,CAAC,IAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAExF,OAAO,kBAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,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;AAEY,QAAA,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: unknown\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 // a node value, or an array of values for multiple attributes\n value: unknown\n showLabel?: boolean\n quoteLabels?: boolean\n lang?: LanguageCode\n}\n\nconst formatters: { [key in NodeDefType]?: (params: FormatParams) => unknown } = {\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 as string)\n return Dates.format(dateParsed, DateFormats.dateDisplay)\n },\n [NodeDefType.decimal]: (params: FormatParams) => {\n const { value, nodeDef } = params\n return Numbers.formatDecimal(value as number, 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 as string) : value\n },\n}\n\n// any: null when the category item or taxon is not found, the raw value for types without a formatter\nconst format = (params: FormatParams): any => {\n const { nodeDef, value } = params\n if (Objects.isEmpty(value)) {\n return ''\n }\n const formatter = formatters[NodeDefs.getType(nodeDef)]\n const formatValue = (v: unknown) => (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"]}
|
|
@@ -28,6 +28,6 @@ export interface ArenaNodeDefEntityLayout extends ArenaNodeDefLayout {
|
|
|
28
28
|
indexChildren?: string[];
|
|
29
29
|
layoutChildren?: ArenaNodeDefEntityLayoutChildItem[];
|
|
30
30
|
pageUuid?: string;
|
|
31
|
-
renderType
|
|
31
|
+
renderType?: NodeDefEntityRenderType;
|
|
32
32
|
}
|
|
33
33
|
export type ArenaNodeDefEntity = ArenaNodeDef<NodeDefType.entity, ArenaNodeDefEntityProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/nodeDef/types/entity.ts"],"names":[],"mappings":";;;AA2BA,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,wCAAa,CAAA;IACb,0CAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QAGlC","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefLayout, ArenaNodeDefPropsWithLayout, NodeDefType } from '../nodeDef'\n\nexport interface ArenaNodeDefEntityChildPosition {\n h?: number\n i: string\n maxH?: number\n minH?: number\n minW?: number\n moved?: boolean\n static?: boolean\n w?: number\n x: number\n y: number\n}\n\nexport type ArenaNodeDefEntityLayoutChildItem = ArenaNodeDefEntityChildPosition | string\n\nexport type ArenaNodeDefPrintOrientation = 'portrait' | 'landscape'\n\nexport interface ArenaNodeDefEntityProps extends ArenaNodeDefPropsWithLayout<ArenaNodeDefEntityLayout> {\n // Applies only to multiple entities; when true, missing repetitions up to min count are auto-created.\n autoCreateMinCountItems?: boolean\n enumerate?: boolean\n /** When set, printable export uses this orientation for the entity's print section. */\n printOrientation?: ArenaNodeDefPrintOrientation\n}\n\nexport enum NodeDefEntityRenderType {\n form = 'form',\n table = 'table',\n}\n\nexport interface ArenaNodeDefEntityLayout extends ArenaNodeDefLayout {\n columnsNo?: number\n indexChildren?: string[] // sorted children pages uuids\n layoutChildren?: ArenaNodeDefEntityLayoutChildItem[]\n pageUuid?: string\n renderType
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../../src/nodeDef/types/entity.ts"],"names":[],"mappings":";;;AA2BA,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,wCAAa,CAAA;IACb,0CAAe,CAAA;AACjB,CAAC,EAHW,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QAGlC","sourcesContent":["import { ArenaNodeDef, ArenaNodeDefLayout, ArenaNodeDefPropsWithLayout, NodeDefType } from '../nodeDef'\n\nexport interface ArenaNodeDefEntityChildPosition {\n h?: number\n i: string\n maxH?: number\n minH?: number\n minW?: number\n moved?: boolean\n static?: boolean\n w?: number\n x: number\n y: number\n}\n\nexport type ArenaNodeDefEntityLayoutChildItem = ArenaNodeDefEntityChildPosition | string\n\nexport type ArenaNodeDefPrintOrientation = 'portrait' | 'landscape'\n\nexport interface ArenaNodeDefEntityProps extends ArenaNodeDefPropsWithLayout<ArenaNodeDefEntityLayout> {\n // Applies only to multiple entities; when true, missing repetitions up to min count are auto-created.\n autoCreateMinCountItems?: boolean\n enumerate?: boolean\n /** When set, printable export uses this orientation for the entity's print section. */\n printOrientation?: ArenaNodeDefPrintOrientation\n}\n\nexport enum NodeDefEntityRenderType {\n form = 'form',\n table = 'table',\n}\n\nexport interface ArenaNodeDefEntityLayout extends ArenaNodeDefLayout {\n columnsNo?: number\n indexChildren?: string[] // sorted children pages uuids\n layoutChildren?: ArenaNodeDefEntityLayoutChildItem[]\n pageUuid?: string\n renderType?: NodeDefEntityRenderType\n}\n\nexport type ArenaNodeDefEntity = ArenaNodeDef<NodeDefType.entity, ArenaNodeDefEntityProps>\n"]}
|
|
@@ -7,7 +7,7 @@ declare const createRootEntity: (params: ArenaRecordNodesUpdateParams & {
|
|
|
7
7
|
}) => Promise<RecordUpdateResult>;
|
|
8
8
|
declare const updateAttributeValue: (params: ArenaRecordNodesUpdateParams & {
|
|
9
9
|
attributeUuid: string;
|
|
10
|
-
value:
|
|
10
|
+
value: unknown;
|
|
11
11
|
}) => Promise<RecordUpdateResult>;
|
|
12
12
|
declare const deleteNodes: (params: ArenaRecordNodesUpdateParams & {
|
|
13
13
|
nodeUuids: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../src/record/recordUpdater.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAuD;AAEvD,wCAAmD;AACnD,sCAAsE;AACtE,oCAAyC;AACzC,2DAAuD;AACvD,iDAAmD;AAEnD,6DAA6E;AAE7E,uCAAmC;AACnC,uDAAmD;AAEnD,MAAM,yBAAyB,GAAG;IAChC,6BAAoB,CAAC,WAAW;IAChC,6BAAoB,CAAC,QAAQ;IAC7B,6BAAoB,CAAC,QAAQ;IAC7B,6BAAoB,CAAC,QAAQ;CAC9B,CAAA;AAED,MAAM,kCAAkC,GAAG,CAAC,MAI3C,EAA4B,EAAE;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACxC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkC,CAAA;IACrE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,KAAK,MAAM,cAAc,IAAI,yBAAyB,EAAE,CAAC;YACvD,MAAM,YAAY,GAAG,iBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;YAC3F,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACnC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;gBACxC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;gBACxC,MAAM,GAAG,GAAG,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAA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H,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAA;IAC3B,OAAO,WAAW,iCAAM,MAAM,KAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,IAAG,CAAA;AAC1D,CAAC,CAAA,CAAA;AAEY,QAAA,aAAa,GAAG;IAC3B,+HAA+H;IAC/H,iBAAiB;IACjB,gIAAgI;IAChI,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,kIAAkI;IAClI,UAAU;IACV,qIAAqI;IACrI,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { SystemError, SystemErrorKeys } from '../error'\nimport { ArenaRecordNode, ArenaRecordNodePointer, ArenaRecordNodesMap } from '../node'\nimport { ArenaNodeDef, NodeDefs } from '../nodeDef'\nimport { ArenaSurvey, SurveyDependencyType, Surveys } from '../survey'\nimport { Dates, Objects } from '../utils'\nimport { Validations } from '../validation/validations'\nimport { RecordNodePointers } from './nodePointers'\nimport { ArenaRecord } from './record'\nimport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nimport { ArenaRecordNodeCreateParams, ArenaRecordNodesUpdateParams } from './recordNodesUpdater/recordNodesCreator'\nimport { Records } from './records'\nimport { RecordValidator } from './recordValidator'\n\nconst validationDependencyTypes = [\n SurveyDependencyType.validations,\n SurveyDependencyType.required,\n SurveyDependencyType.minCount,\n SurveyDependencyType.maxCount,\n]\n\nconst getDependentValidationNodePointers = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: ArenaRecordNodesMap\n}): ArenaRecordNodePointer[] => {\n const { survey, record, nodes } = params\n const uniquePointersByKey = new Map<string, ArenaRecordNodePointer>()\n for (const node of Object.values(nodes)) {\n for (const dependencyType of validationDependencyTypes) {\n const nodePointers = Records.getDependentNodePointers(survey, node, dependencyType)(record)\n for (const pointer of nodePointers) {\n const nodeCtxUuid = pointer.nodeCtx.uuid\n const nodeDefUuid = pointer.nodeDef.uuid\n const key = `${nodeCtxUuid ?? ''}:${nodeDefUuid ?? ''}`\n if (!uniquePointersByKey.has(key)) {\n uniquePointersByKey.set(key, pointer)\n }\n }\n }\n }\n return Array.from(uniquePointersByKey.values())\n}\n\nconst _onRecordNodesCreateOrUpdate = async (\n params: ArenaRecordNodesUpdateParams & {\n nodes: ArenaDictionary<ArenaRecordNode>\n additionalNodesToValidate?: ArenaRecordNodesMap\n }\n): Promise<RecordUpdateResult> => {\n const {\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n additionalNodesToValidate,\n dateModified = Dates.nowFormattedForStorage(),\n } = params\n\n const updateResult = await RecordNodesUpdater.updateNodesDependents(params)\n const { nodes: updatedNodes, record: updatedRecord } = updateResult\n\n const dependentValidationNodePointers = getDependentValidationNodePointers({\n survey,\n record: updatedRecord,\n nodes: updatedNodes,\n })\n\n const dependentValidationNodes = RecordNodePointers.getNodesMapFromNodePointers({\n record: updatedRecord,\n nodePointers: dependentValidationNodePointers,\n })\n\n const nodesToValidate = { ...updatedNodes, ...dependentValidationNodes, ...additionalNodesToValidate }\n\n const validationUpdatedNodes = await RecordValidator.validateNodes({\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n record: updatedRecord,\n nodes: nodesToValidate,\n })\n\n const validation = Validations.mergeValidations(validationUpdatedNodes)(Validations.getValidation(updatedRecord))\n updatedRecord.validation = validation\n updatedRecord.dateModified = dateModified\n\n updateResult.validation = validation\n\n return updateResult\n}\n\nconst createDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createNodeAndDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addNodeAndDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createRootEntity = async (\n params: ArenaRecordNodesUpdateParams & {\n createMultipleEntities?: boolean\n }\n): Promise<RecordUpdateResult> => {\n const { survey, createMultipleEntities = true } = params\n\n return createNodeAndDescendants({ ...params, nodeDef: Surveys.getNodeDefRoot({ survey }), createMultipleEntities })\n}\n\nconst updateAttributeValue = async (\n params: ArenaRecordNodesUpdateParams & {\n attributeUuid: string\n value: any\n }\n): Promise<RecordUpdateResult> => {\n const { attributeUuid, record, value, dateModified = Dates.nowFormattedForStorage(), sideEffect = false } = params\n const attribute = Records.getNodeByUuid(attributeUuid)(record)\n if (!attribute) throw new SystemError(SystemErrorKeys.record.nodeNotFound, { uuid: attributeUuid })\n\n let attributeUpdated = sideEffect ? attribute : { ...attribute }\n attributeUpdated.value = value\n attributeUpdated.dateModified = dateModified\n // reset defaultValueApplied flag\n attributeUpdated = Objects.dissocPath({ obj: attributeUpdated, path: ['meta', 'defaultValueApplied'], sideEffect })\n\n const nodesUpdated = { [attributeUuid]: attributeUpdated }\n\n const _record = Records.addNode(attributeUpdated, { sideEffect })(record)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: _record, nodes: nodesUpdated })\n}\n\n/**\n * Returns the key and unique attributes of the siblings of the specified entities:\n * they could have been duplicates of the ones being deleted, so they must be validated again.\n */\nconst getEntityKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n uniqueAttributeDefs: ArenaNodeDef<any>[]\n}): ArenaRecordNode[] => {\n const { survey, record, entity, uniqueAttributeDefs } = params\n return [\n ...Records.getEntityKeyNodes(survey, entity)(record),\n ...uniqueAttributeDefs.flatMap((uniqueDef) => Records.getChildren(entity, uniqueDef.uuid)(record)),\n ].filter(Boolean)\n}\n\nconst getSiblingKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodeUuids: string[]\n}): ArenaRecordNodesMap => {\n const { survey, record, nodeUuids } = params\n const nodeUuidsSet = new Set(nodeUuids)\n const result: ArenaRecordNodesMap = {}\n for (const nodeUuid of nodeUuids) {\n const node = Records.getNodeByUuid(nodeUuid)(record)\n const parentNode = node ? Records.getParent(node)(record) : undefined\n const nodeDef = node ? Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid }) : undefined\n if (!parentNode || !nodeDef || !NodeDefs.isEntity(nodeDef)) continue\n\n const uniqueAttributeDefs = Surveys.getNodeDefChildren({ survey, nodeDef }).filter(\n (childDef) => NodeDefs.getValidations(childDef)?.unique\n )\n const siblings = Records.getChildren(parentNode, nodeDef.uuid)(record).filter((s) => !nodeUuidsSet.has(s.uuid))\n for (const sibling of siblings) {\n for (const attribute of getEntityKeyOrUniqueAttributes({\n survey,\n record,\n entity: sibling,\n uniqueAttributeDefs,\n })) {\n result[attribute.uuid] = attribute\n }\n }\n }\n return result\n}\n\nconst deleteNodes = async (\n params: ArenaRecordNodesUpdateParams & {\n nodeUuids: string[]\n }\n): Promise<RecordUpdateResult> => {\n const { survey, nodeUuids, record: _record, sideEffect = false } = params\n\n // found before removing the nodes: the deleted nodes are no longer reachable from their siblings afterwards\n const siblingKeyOrUniqueAttributes = getSiblingKeyOrUniqueAttributes({ survey, record: _record, nodeUuids })\n\n const updateResult = Records.removeNodes(nodeUuids, { sideEffect })(_record)\n const { record, nodesDeleted } = updateResult\n\n const result = await _onRecordNodesCreateOrUpdate({\n ...params,\n record,\n nodes: nodesDeleted,\n additionalNodesToValidate: siblingKeyOrUniqueAttributes,\n })\n result.nodesDeleted = nodesDeleted\n return result\n}\n\nconst deleteNode = async (params: ArenaRecordNodesUpdateParams & { nodeUuid: string }): Promise<RecordUpdateResult> => {\n const { nodeUuid } = params\n return deleteNodes({ ...params, nodeUuids: [nodeUuid] })\n}\n\nexport const RecordUpdater = {\n /** Creates the descendants of a node and updates dependents (applicability, default values, calculations...) and validation */\n createDescendants,\n /** Creates a node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n createNodeAndDescendants,\n createRootEntity,\n updateAttributeValue,\n /** Deletes the node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNode,\n /** Deletes the nodes and their descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNodes,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../src/record/recordUpdater.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oCAAuD;AAEvD,wCAAmD;AACnD,sCAAsE;AACtE,oCAAyC;AACzC,2DAAuD;AACvD,iDAAmD;AAEnD,6DAA6E;AAE7E,uCAAmC;AACnC,uDAAmD;AAEnD,MAAM,yBAAyB,GAAG;IAChC,6BAAoB,CAAC,WAAW;IAChC,6BAAoB,CAAC,QAAQ;IAC7B,6BAAoB,CAAC,QAAQ;IAC7B,6BAAoB,CAAC,QAAQ;CAC9B,CAAA;AAED,MAAM,kCAAkC,GAAG,CAAC,MAI3C,EAA4B,EAAE;IAC7B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACxC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkC,CAAA;IACrE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,KAAK,MAAM,cAAc,IAAI,yBAAyB,EAAE,CAAC;YACvD,MAAM,YAAY,GAAG,iBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;YAC3F,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;gBACnC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;gBACxC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;gBACxC,MAAM,GAAG,GAAG,GAAG,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,EAAE,IAAI,WAAW,aAAX,WAAW,cAAX,WAAW,GAA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AA;IAC3B,OAAO,WAAW,iCAAM,MAAM,KAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,IAAG,CAAA;AAC1D,CAAC,CAAA,CAAA;AAEY,QAAA,aAAa,GAAG;IAC3B,+HAA+H;IAC/H,iBAAiB;IACjB,gIAAgI;IAChI,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,kIAAkI;IAClI,UAAU;IACV,qIAAqI;IACrI,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { SystemError, SystemErrorKeys } from '../error'\nimport { ArenaRecordNode, ArenaRecordNodePointer, ArenaRecordNodesMap } from '../node'\nimport { ArenaNodeDef, NodeDefs } from '../nodeDef'\nimport { ArenaSurvey, SurveyDependencyType, Surveys } from '../survey'\nimport { Dates, Objects } from '../utils'\nimport { Validations } from '../validation/validations'\nimport { RecordNodePointers } from './nodePointers'\nimport { ArenaRecord } from './record'\nimport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nimport { ArenaRecordNodeCreateParams, ArenaRecordNodesUpdateParams } from './recordNodesUpdater/recordNodesCreator'\nimport { Records } from './records'\nimport { RecordValidator } from './recordValidator'\n\nconst validationDependencyTypes = [\n SurveyDependencyType.validations,\n SurveyDependencyType.required,\n SurveyDependencyType.minCount,\n SurveyDependencyType.maxCount,\n]\n\nconst getDependentValidationNodePointers = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodes: ArenaRecordNodesMap\n}): ArenaRecordNodePointer[] => {\n const { survey, record, nodes } = params\n const uniquePointersByKey = new Map<string, ArenaRecordNodePointer>()\n for (const node of Object.values(nodes)) {\n for (const dependencyType of validationDependencyTypes) {\n const nodePointers = Records.getDependentNodePointers(survey, node, dependencyType)(record)\n for (const pointer of nodePointers) {\n const nodeCtxUuid = pointer.nodeCtx.uuid\n const nodeDefUuid = pointer.nodeDef.uuid\n const key = `${nodeCtxUuid ?? ''}:${nodeDefUuid ?? ''}`\n if (!uniquePointersByKey.has(key)) {\n uniquePointersByKey.set(key, pointer)\n }\n }\n }\n }\n return Array.from(uniquePointersByKey.values())\n}\n\nconst _onRecordNodesCreateOrUpdate = async (\n params: ArenaRecordNodesUpdateParams & {\n nodes: ArenaDictionary<ArenaRecordNode>\n additionalNodesToValidate?: ArenaRecordNodesMap\n }\n): Promise<RecordUpdateResult> => {\n const {\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n additionalNodesToValidate,\n dateModified = Dates.nowFormattedForStorage(),\n } = params\n\n const updateResult = await RecordNodesUpdater.updateNodesDependents(params)\n const { nodes: updatedNodes, record: updatedRecord } = updateResult\n\n const dependentValidationNodePointers = getDependentValidationNodePointers({\n survey,\n record: updatedRecord,\n nodes: updatedNodes,\n })\n\n const dependentValidationNodes = RecordNodePointers.getNodesMapFromNodePointers({\n record: updatedRecord,\n nodePointers: dependentValidationNodePointers,\n })\n\n const nodesToValidate = { ...updatedNodes, ...dependentValidationNodes, ...additionalNodesToValidate }\n\n const validationUpdatedNodes = await RecordValidator.validateNodes({\n user,\n survey,\n categoryItemProvider,\n taxonProvider,\n areaOfInterestProvider,\n record: updatedRecord,\n nodes: nodesToValidate,\n })\n\n const validation = Validations.mergeValidations(validationUpdatedNodes)(Validations.getValidation(updatedRecord))\n updatedRecord.validation = validation\n updatedRecord.dateModified = dateModified\n\n updateResult.validation = validation\n\n return updateResult\n}\n\nconst createDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createNodeAndDescendants = async (params: ArenaRecordNodeCreateParams): Promise<RecordUpdateResult> => {\n const { record: updatedRecord, nodes: createdNodes } = await RecordNodesUpdater.addNodeAndDescendants(params)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: updatedRecord, nodes: createdNodes })\n}\n\nconst createRootEntity = async (\n params: ArenaRecordNodesUpdateParams & {\n createMultipleEntities?: boolean\n }\n): Promise<RecordUpdateResult> => {\n const { survey, createMultipleEntities = true } = params\n\n return createNodeAndDescendants({ ...params, nodeDef: Surveys.getNodeDefRoot({ survey }), createMultipleEntities })\n}\n\nconst updateAttributeValue = async (\n params: ArenaRecordNodesUpdateParams & {\n attributeUuid: string\n // its shape depends on the attribute type (see ArenaRecordNodeValue)\n value: unknown\n }\n): Promise<RecordUpdateResult> => {\n const { attributeUuid, record, value, dateModified = Dates.nowFormattedForStorage(), sideEffect = false } = params\n const attribute = Records.getNodeByUuid(attributeUuid)(record)\n if (!attribute) throw new SystemError(SystemErrorKeys.record.nodeNotFound, { uuid: attributeUuid })\n\n let attributeUpdated = sideEffect ? attribute : { ...attribute }\n attributeUpdated.value = value\n attributeUpdated.dateModified = dateModified\n // reset defaultValueApplied flag\n attributeUpdated = Objects.dissocPath({ obj: attributeUpdated, path: ['meta', 'defaultValueApplied'], sideEffect })\n\n const nodesUpdated = { [attributeUuid]: attributeUpdated }\n\n const _record = Records.addNode(attributeUpdated, { sideEffect })(record)\n\n return _onRecordNodesCreateOrUpdate({ ...params, record: _record, nodes: nodesUpdated })\n}\n\n/**\n * Returns the key and unique attributes of the siblings of the specified entities:\n * they could have been duplicates of the ones being deleted, so they must be validated again.\n */\nconst getEntityKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entity: ArenaRecordNode\n uniqueAttributeDefs: ArenaNodeDef<any>[]\n}): ArenaRecordNode[] => {\n const { survey, record, entity, uniqueAttributeDefs } = params\n return [\n ...Records.getEntityKeyNodes(survey, entity)(record),\n ...uniqueAttributeDefs.flatMap((uniqueDef) => Records.getChildren(entity, uniqueDef.uuid)(record)),\n ].filter(Boolean)\n}\n\nconst getSiblingKeyOrUniqueAttributes = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n nodeUuids: string[]\n}): ArenaRecordNodesMap => {\n const { survey, record, nodeUuids } = params\n const nodeUuidsSet = new Set(nodeUuids)\n const result: ArenaRecordNodesMap = {}\n for (const nodeUuid of nodeUuids) {\n const node = Records.getNodeByUuid(nodeUuid)(record)\n const parentNode = node ? Records.getParent(node)(record) : undefined\n const nodeDef = node ? Surveys.getNodeDefByUuid({ survey, uuid: node.nodeDefUuid }) : undefined\n if (!parentNode || !nodeDef || !NodeDefs.isEntity(nodeDef)) continue\n\n const uniqueAttributeDefs = Surveys.getNodeDefChildren({ survey, nodeDef }).filter(\n (childDef) => NodeDefs.getValidations(childDef)?.unique\n )\n const siblings = Records.getChildren(parentNode, nodeDef.uuid)(record).filter((s) => !nodeUuidsSet.has(s.uuid))\n for (const sibling of siblings) {\n for (const attribute of getEntityKeyOrUniqueAttributes({\n survey,\n record,\n entity: sibling,\n uniqueAttributeDefs,\n })) {\n result[attribute.uuid] = attribute\n }\n }\n }\n return result\n}\n\nconst deleteNodes = async (\n params: ArenaRecordNodesUpdateParams & {\n nodeUuids: string[]\n }\n): Promise<RecordUpdateResult> => {\n const { survey, nodeUuids, record: _record, sideEffect = false } = params\n\n // found before removing the nodes: the deleted nodes are no longer reachable from their siblings afterwards\n const siblingKeyOrUniqueAttributes = getSiblingKeyOrUniqueAttributes({ survey, record: _record, nodeUuids })\n\n const updateResult = Records.removeNodes(nodeUuids, { sideEffect })(_record)\n const { record, nodesDeleted } = updateResult\n\n const result = await _onRecordNodesCreateOrUpdate({\n ...params,\n record,\n nodes: nodesDeleted,\n additionalNodesToValidate: siblingKeyOrUniqueAttributes,\n })\n result.nodesDeleted = nodesDeleted\n return result\n}\n\nconst deleteNode = async (params: ArenaRecordNodesUpdateParams & { nodeUuid: string }): Promise<RecordUpdateResult> => {\n const { nodeUuid } = params\n return deleteNodes({ ...params, nodeUuids: [nodeUuid] })\n}\n\nexport const RecordUpdater = {\n /** Creates the descendants of a node and updates dependents (applicability, default values, calculations...) and validation */\n createDescendants,\n /** Creates a node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n createNodeAndDescendants,\n createRootEntity,\n updateAttributeValue,\n /** Deletes the node and its descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNode,\n /** Deletes the nodes and their descendants and updates dependents (applicability, default values, calculations...) and validation */\n deleteNodes,\n}\n"]}
|
package/dist/survey/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { ArenaSurveyFileFactoryParams } from './surveyFileFactory';
|
|
|
6
6
|
export type { ArenaSurveyDocImageFactoryParams } from './surveyDocImageFactory';
|
|
7
7
|
export type { ArenaSurvey, ArenaSurveyCycle, ArenaSurveyDependencyGraph, ArenaSurveyDependency, ArenaSurveyDocImage, ArenaSurveyDocImageProps, ArenaSurveyFile, ArenaSurveyFileProps, ArenaSurveyNodeDefsIndex, ArenaSurveyProps, ArenaSurveySecurity, } from './survey';
|
|
8
8
|
export { defaultCycle, SurveyDependencyType, SurveyDocPlace, SurveySecurityProp, surveyDocImagePropKeys, surveySecurityDefaults, } from './survey';
|
|
9
|
-
export type { ArenaSurveySummary } from './surveySummary';
|
|
9
|
+
export type { ArenaSurveyOrSummary, ArenaSurveySummary } from './surveySummary';
|
|
10
10
|
export { Surveys } from './surveys';
|
|
11
11
|
export { SurveyFactory } from './factory';
|
|
12
12
|
export type { ArenaSurveyService } from './service';
|
package/dist/survey/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/survey/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,yDAAuE;AAA9D,sHAAA,iBAAiB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAC1C,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAkB9B,mCAOiB;AANf,sGAAA,YAAY,OAAA;AACZ,8GAAA,oBAAoB,OAAA;AACpB,wGAAA,cAAc,OAAA;AACd,4GAAA,kBAAkB,OAAA;AAClB,gHAAA,sBAAsB,OAAA;AACtB,gHAAA,sBAAsB,OAAA;AAKxB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,qCAAyC;AAAhC,wGAAA,aAAa,OAAA;AAMtB,qCAAgD;AAAvC,+GAAA,oBAAoB,OAAA","sourcesContent":["export { NodeDefsFixer } from './nodeDefsFixer'\nexport { SurveyDocImages } from './surveyDocImages'\nexport { SurveyFileFactory, SurveyFileType } from './surveyFileFactory'\nexport { SurveyDocImageFactory } from './surveyDocImageFactory'\nexport type { ArenaSurveyFileFactoryParams } from './surveyFileFactory'\nexport type { ArenaSurveyDocImageFactoryParams } from './surveyDocImageFactory'\n\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDependency,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveySecurity,\n} from './survey'\n\nexport {\n defaultCycle,\n SurveyDependencyType,\n SurveyDocPlace,\n SurveySecurityProp,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n} from './survey'\n\nexport type { ArenaSurveySummary } from './surveySummary'\n\nexport { Surveys } from './surveys'\n\nexport { SurveyFactory } from './factory'\n\nexport type { ArenaSurveyService } from './service'\n\nexport type { ArenaSurveyRefData } from './refData'\n\nexport { SurveyRefDataFactory } from './refData'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/survey/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AACtB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AACxB,yDAAuE;AAA9D,sHAAA,iBAAiB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAC1C,iEAA+D;AAAtD,8HAAA,qBAAqB,OAAA;AAkB9B,mCAOiB;AANf,sGAAA,YAAY,OAAA;AACZ,8GAAA,oBAAoB,OAAA;AACpB,wGAAA,cAAc,OAAA;AACd,4GAAA,kBAAkB,OAAA;AAClB,gHAAA,sBAAsB,OAAA;AACtB,gHAAA,sBAAsB,OAAA;AAKxB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,qCAAyC;AAAhC,wGAAA,aAAa,OAAA;AAMtB,qCAAgD;AAAvC,+GAAA,oBAAoB,OAAA","sourcesContent":["export { NodeDefsFixer } from './nodeDefsFixer'\nexport { SurveyDocImages } from './surveyDocImages'\nexport { SurveyFileFactory, SurveyFileType } from './surveyFileFactory'\nexport { SurveyDocImageFactory } from './surveyDocImageFactory'\nexport type { ArenaSurveyFileFactoryParams } from './surveyFileFactory'\nexport type { ArenaSurveyDocImageFactoryParams } from './surveyDocImageFactory'\n\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDependency,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveySecurity,\n} from './survey'\n\nexport {\n defaultCycle,\n SurveyDependencyType,\n SurveyDocPlace,\n SurveySecurityProp,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n} from './survey'\n\nexport type { ArenaSurveyOrSummary, ArenaSurveySummary } from './surveySummary'\n\nexport { Surveys } from './surveys'\n\nexport { SurveyFactory } from './factory'\n\nexport type { ArenaSurveyService } from './service'\n\nexport type { ArenaSurveyRefData } from './refData'\n\nexport { SurveyRefDataFactory } from './refData'\n"]}
|
|
@@ -8,3 +8,7 @@ export type ArenaSurveySummary = Omit<ArenaSurvey, 'authGroups' | 'categories' |
|
|
|
8
8
|
defaultLabel?: string;
|
|
9
9
|
ownerName?: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* A full survey or a survey summary: accepted by the getters that only read the survey props.
|
|
13
|
+
*/
|
|
14
|
+
export type ArenaSurveyOrSummary = ArenaSurvey | ArenaSurveySummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveySummary.js","sourceRoot":"","sources":["../../src/survey/surveySummary.ts"],"names":[],"mappings":"","sourcesContent":["import type { ArenaAuthGroup } from '../auth'\nimport type { ArenaSurvey } from './survey'\n\n/**\n * Item of the surveys list returned by the server: survey without node defs and reference data, plus list fields.\n */\nexport type ArenaSurveySummary = Omit<\n ArenaSurvey,\n 'authGroups' | 'categories' | 'dependencyGraph' | 'nodeDefs' | 'nodeDefsIndex' | 'refData' | 'taxonomies'\n> & {\n authGroups?: ArenaAuthGroup[]\n defaultLabel?: string\n ownerName?: string\n}\n"]}
|
|
1
|
+
{"version":3,"file":"surveySummary.js","sourceRoot":"","sources":["../../src/survey/surveySummary.ts"],"names":[],"mappings":"","sourcesContent":["import type { ArenaAuthGroup } from '../auth'\nimport type { ArenaSurvey } from './survey'\n\n/**\n * Item of the surveys list returned by the server: survey without node defs and reference data, plus list fields.\n */\nexport type ArenaSurveySummary = Omit<\n ArenaSurvey,\n 'authGroups' | 'categories' | 'dependencyGraph' | 'nodeDefs' | 'nodeDefsIndex' | 'refData' | 'taxonomies'\n> & {\n authGroups?: ArenaAuthGroup[]\n defaultLabel?: string\n ownerName?: string\n}\n\n/**\n * A full survey or a survey summary: accepted by the getters that only read the survey props.\n */\nexport type ArenaSurveyOrSummary = ArenaSurvey | ArenaSurveySummary\n"]}
|
|
@@ -8,10 +8,10 @@ export declare const Surveys: {
|
|
|
8
8
|
getName: typeof getName;
|
|
9
9
|
getLanguages: typeof getLanguages;
|
|
10
10
|
getDefaultLanguage: typeof getDefaultLanguage;
|
|
11
|
-
getLabel: (langCode?: import("../..").LanguageCode) => (survey: import("..").
|
|
11
|
+
getLabel: (langCode?: import("../..").LanguageCode) => (survey: import("..").ArenaSurveyOrSummary) => string | undefined;
|
|
12
12
|
getLabelOrName: typeof getLabelOrName;
|
|
13
|
-
getDescription: (langCode?: import("../..").LanguageCode) => (survey: import("..").
|
|
14
|
-
getFieldManualLink: (langCode?: import("../..").LanguageCode) => (survey: import("..").
|
|
13
|
+
getDescription: (langCode?: import("../..").LanguageCode) => (survey: import("..").ArenaSurveyOrSummary) => string | undefined;
|
|
14
|
+
getFieldManualLink: (langCode?: import("../..").LanguageCode) => (survey: import("..").ArenaSurveyOrSummary) => string | undefined;
|
|
15
15
|
getCycleKeys: typeof getCycleKeys;
|
|
16
16
|
getLastCycleKey: typeof getLastCycleKey;
|
|
17
17
|
getDefaultCycleKey: typeof getDefaultCycleKey;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
1
|
+
import { ArenaSurveySecurity, SurveySecurityProp } from '../survey';
|
|
2
|
+
import type { ArenaSurveyOrSummary } from '../surveySummary';
|
|
3
|
+
export declare const getSecurity: (survey: ArenaSurveyOrSummary) => ArenaSurveySecurity;
|
|
4
|
+
export declare const isSecurityPropEnabled: (prop: SurveySecurityProp) => (survey: ArenaSurveyOrSummary) => boolean;
|
|
5
|
+
export declare const isDataEditorViewNotOwnedRecordsAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
6
|
+
export declare const isDataAnalystViewNotOwnedRecordsAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
7
|
+
export declare const isVisibleInMobile: (survey: ArenaSurveyOrSummary) => boolean;
|
|
8
|
+
export declare const isRecordsDownloadInMobileAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
9
|
+
export declare const isRecordsUploadFromMobileAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
10
|
+
export declare const isRecordsWithErrorsUploadFromMobileAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
11
|
+
export declare const isRecordsMergeWithSameKeysAllowed: (survey: ArenaSurveyOrSummary) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveyGettersSecurity.js","sourceRoot":"","sources":["../../../src/survey/surveys/surveyGettersSecurity.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"surveyGettersSecurity.js","sourceRoot":"","sources":["../../../src/survey/surveys/surveyGettersSecurity.ts"],"names":[],"mappings":";;;AAAA,sCAA2F;AAGpF,MAAM,WAAW,GAAG,CAAC,MAA4B,EAAuB,EAAE,kBAAC,iCAC7E,+BAAsB,GACtB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,QAAQ,EAC1B,GAAA,CAAA;AAHW,QAAA,WAAW,GAAX,WAAW,CAGtB;AAEK,MAAM,qBAAqB,GAChC,CAAC,IAAwB,EAAE,EAAE,CAC7B,CAAC,MAA4B,EAAW,EAAE,CACxC,CAAC,CAAC,IAAA,QAAA,WAAW,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;AAHlB,QAAA,qBAAqB,GAArB,qBAAqB,CAGH;AAExB,MAAM,sCAAsC,GAAG,CAAC,MAA4B,EAAW,EAAE,CAC9F,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAA;AAD3E,QAAA,sCAAsC,GAAtC,sCAAsC,CACqC;AAEjF,MAAM,uCAAuC,GAAG,CAAC,MAA4B,EAAW,EAAE,CAC/F,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,qCAAqC,CAAC,CAAC,MAAM,CAAC,CAAA;AAD5E,QAAA,uCAAuC,GAAvC,uCAAuC,CACqC;AAElF,MAAM,iBAAiB,GAAG,CAAC,MAA4B,EAAW,EAAE,CACzE,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AADtD,QAAA,iBAAiB,GAAjB,iBAAiB,CACqC;AAE5D,MAAM,gCAAgC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACxF,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAA;AADnE,QAAA,gCAAgC,GAAhC,gCAAgC,CACmC;AAEzE,MAAM,gCAAgC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACxF,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAA;AADnE,QAAA,gCAAgC,GAAhC,gCAAgC,CACmC;AAEzE,MAAM,0CAA0C,GAAG,CAAC,MAA4B,EAAW,EAAE,CAClG,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,sCAAsC,CAAC,CAAC,MAAM,CAAC,CAAA;AAD7E,QAAA,0CAA0C,GAA1C,0CAA0C,CACmC;AAEnF,MAAM,iCAAiC,GAAG,CAAC,MAA4B,EAAW,EAAE,CACzF,IAAA,QAAA,qBAAqB,EAAC,2BAAkB,CAAC,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAA;AADpE,QAAA,iCAAiC,GAAjC,iCAAiC,CACmC","sourcesContent":["import { ArenaSurveySecurity, surveySecurityDefaults, SurveySecurityProp } from '../survey'\nimport type { ArenaSurveyOrSummary } from '../surveySummary'\n\nexport const getSecurity = (survey: ArenaSurveyOrSummary): ArenaSurveySecurity => ({\n ...surveySecurityDefaults,\n ...survey?.props?.security,\n})\n\nexport const isSecurityPropEnabled =\n (prop: SurveySecurityProp) =>\n (survey: ArenaSurveyOrSummary): boolean =>\n !!getSecurity(survey)[prop]\n\nexport const isDataEditorViewNotOwnedRecordsAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.dataEditorViewNotOwnedRecordsAllowed)(survey)\n\nexport const isDataAnalystViewNotOwnedRecordsAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.dataAnalystViewNotOwnedRecordsAllowed)(survey)\n\nexport const isVisibleInMobile = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.visibleInMobile)(survey)\n\nexport const isRecordsDownloadInMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsDownloadInMobile)(survey)\n\nexport const isRecordsUploadFromMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsUploadFromMobile)(survey)\n\nexport const isRecordsWithErrorsUploadFromMobileAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsWithErrorsUploadFromMobile)(survey)\n\nexport const isRecordsMergeWithSameKeysAllowed = (survey: ArenaSurveyOrSummary): boolean =>\n isSecurityPropEnabled(SurveySecurityProp.allowRecordsMergeWithSameKeys)(survey)\n"]}
|
|
@@ -5,17 +5,18 @@ import { LanguageCode } from '../../language';
|
|
|
5
5
|
import { ArenaSRS, ArenaSRSIndex } from '../../srs';
|
|
6
6
|
import { ArenaTaxonomy } from '../../taxonomy';
|
|
7
7
|
import { ArenaSurvey } from '../survey';
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
8
|
+
import type { ArenaSurveyOrSummary } from '../surveySummary';
|
|
9
|
+
export declare const getName: (survey: ArenaSurveyOrSummary) => string;
|
|
10
|
+
export declare const getLanguages: (survey: ArenaSurveyOrSummary) => LanguageCode[];
|
|
11
|
+
export declare const getDefaultLanguage: (survey: ArenaSurveyOrSummary) => LanguageCode;
|
|
12
|
+
export declare const getLabel: (langCode?: LanguageCode) => (survey: ArenaSurveyOrSummary) => string | undefined;
|
|
13
|
+
export declare const getDescription: (langCode?: LanguageCode) => (survey: ArenaSurveyOrSummary) => string | undefined;
|
|
14
|
+
export declare const getFieldManualLink: (langCode?: LanguageCode) => (survey: ArenaSurveyOrSummary) => string | undefined;
|
|
14
15
|
/**
|
|
15
16
|
* Returns the survey label in the specified language (the default language if not specified), or the survey name
|
|
16
17
|
* when the label is missing or empty.
|
|
17
18
|
*/
|
|
18
|
-
export declare const getLabelOrName: (langCode?: LanguageCode) => (survey:
|
|
19
|
+
export declare const getLabelOrName: (langCode?: LanguageCode) => (survey: ArenaSurveyOrSummary) => string;
|
|
19
20
|
export declare const getCategoryByName: (params: {
|
|
20
21
|
survey: ArenaSurvey;
|
|
21
22
|
categoryName: string;
|
|
@@ -32,16 +33,16 @@ export declare const getTaxonomyByUuid: (params: {
|
|
|
32
33
|
survey: ArenaSurvey;
|
|
33
34
|
taxonomyUuid: string;
|
|
34
35
|
}) => ArenaTaxonomy | undefined;
|
|
35
|
-
export declare const getCycleKeys: (survey:
|
|
36
|
-
export declare const getLastCycleKey: (survey:
|
|
37
|
-
export declare const isKeepNonApplicableValues: (survey:
|
|
38
|
-
export declare const getDefaultCycleKey: (survey:
|
|
39
|
-
export declare const getSRSs: (survey:
|
|
40
|
-
export declare const getSRSIndex: (survey:
|
|
41
|
-
export declare const getSRSByCode: (code: string) => (survey:
|
|
42
|
-
export declare const getAreasOfInterest: (survey:
|
|
36
|
+
export declare const getCycleKeys: (survey: ArenaSurveyOrSummary) => string[];
|
|
37
|
+
export declare const getLastCycleKey: (survey: ArenaSurveyOrSummary) => string;
|
|
38
|
+
export declare const isKeepNonApplicableValues: (survey: ArenaSurveyOrSummary) => boolean;
|
|
39
|
+
export declare const getDefaultCycleKey: (survey: ArenaSurveyOrSummary) => string | undefined;
|
|
40
|
+
export declare const getSRSs: (survey: ArenaSurveyOrSummary) => ArenaSRS[];
|
|
41
|
+
export declare const getSRSIndex: (survey: ArenaSurveyOrSummary) => ArenaSRSIndex;
|
|
42
|
+
export declare const getSRSByCode: (code: string) => (survey: ArenaSurveyOrSummary) => ArenaSRS | undefined;
|
|
43
|
+
export declare const getAreasOfInterest: (survey: ArenaSurveyOrSummary) => ArenaAreaOfInterestDescriptor[];
|
|
43
44
|
export declare const getAreaOfInterestByName: (params: {
|
|
44
|
-
survey:
|
|
45
|
+
survey: ArenaSurveyOrSummary;
|
|
45
46
|
name: string;
|
|
46
47
|
}) => ArenaAreaOfInterestDescriptor | undefined;
|
|
47
48
|
export declare const getAuthGroups: (survey: ArenaSurvey) => ArenaUserAuthGroup[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAI9D,kDAAyD;AAGzD,uCAA6C;
|
|
1
|
+
{"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAI9D,kDAAyD;AAGzD,uCAA6C;AAItC,MAAM,OAAO,GAAG,CAAC,MAA4B,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAA;AAArE,QAAA,OAAO,GAAP,OAAO,CAA8D;AAE3E,MAAM,YAAY,GAAG,CAAC,MAA4B,EAAkB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAA;AAAvF,QAAA,YAAY,GAAZ,YAAY,CAA2E;AAE7F,MAAM,kBAAkB,GAAG,CAAC,MAA4B,EAAgB,EAAE,CAAC,IAAA,QAAA,YAAY,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAA5F,QAAA,kBAAkB,GAAlB,kBAAkB,CAA0E;AAEzG,MAAM,qBAAqB,GACzB,CAAC,IAAoD,EAAE,EAAE,CACzD,CAAC,QAAuB,EAAE,EAAE,CAC5B,CAAC,MAA4B,EAAsB,EAAE;;IACnD,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAA,QAAA,kBAAkB,EAAC,MAAM,CAAC,CAAA;IAC3D,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,0C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EAAuE;AACvE,MAAA,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,IAAI,0CAAE,KAAK,0CAAE,eAAe,mCAC7C,EAAE,GAAA,CAAA;AAJS,QAAA,kBAAkB,GAAlB,kBAAkB,CAI3B;AAEG,MAAM,uBAAuB,GAAG,CAAC,MAGvC,EAA6C,EAAE,CAC9C,IAAA,QAAA,kBAAkB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAA;AAJpF,QAAA,uBAAuB,GAAvB,uBAAuB,CAI6D;AAE1F,MAAM,aAAa,GAAG,CAAC,MAAmB,EAAwB,EAAE,wBAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAAvF,QAAA,aAAa,GAAb,aAAa,CAA0E;AAE7F,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAkC,EAAE,CACvF,IAAA,QAAA,aAAa,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,oBAAa,CAAC,WAAW,CAAC,CAAA;AAD5E,QAAA,iBAAiB,GAAjB,iBAAiB,CAC2D","sourcesContent":["import { AuthGroupName, ArenaUserAuthGroup } from '../../auth'\nimport { ArenaCategory } from '../../category'\nimport type { ArenaAreaOfInterestDescriptor } from '../../geo'\nimport { LanguageCode } from '../../language'\nimport { getLabelOrDefault } from '../../language/labels'\nimport { ArenaSRS, ArenaSRSIndex } from '../../srs'\nimport { ArenaTaxonomy } from '../../taxonomy'\nimport { Arrays, Objects } from '../../utils'\nimport { ArenaSurvey } from '../survey'\nimport type { ArenaSurveyOrSummary } from '../surveySummary'\n\nexport const getName = (survey: ArenaSurveyOrSummary): string => survey.props.name\n\nexport const getLanguages = (survey: ArenaSurveyOrSummary): LanguageCode[] => survey.props.languages\n\nexport const getDefaultLanguage = (survey: ArenaSurveyOrSummary): LanguageCode => getLanguages(survey)[0]\n\nconst getMultilangPropValue =\n (prop: 'labels' | 'descriptions' | 'fieldManualLinks') =>\n (langCode?: LanguageCode) =>\n (survey: ArenaSurveyOrSummary): string | undefined => {\n const languageCode = langCode ?? getDefaultLanguage(survey)\n return survey.props[prop]?.[languageCode]\n }\nexport const getLabel = getMultilangPropValue('labels')\nexport const getDescription = getMultilangPropValue('descriptions')\nexport const getFieldManualLink = getMultilangPropValue('fieldManualLinks')\n\n/**\n * Returns the survey label in the specified language (the default language if not specified), or the survey name\n * when the label is missing or empty.\n */\nexport const getLabelOrName =\n (langCode?: LanguageCode) =>\n (survey: ArenaSurveyOrSummary): string =>\n getLabelOrDefault(survey.props.labels, langCode ?? getDefaultLanguage(survey), getName(survey))\n\nexport const getCategoryByName = (params: { survey: ArenaSurvey; categoryName: string }): ArenaCategory | undefined => {\n const { survey, categoryName } = params\n return survey.categories\n ? Object.values(survey.categories).find((category) => category.props.name === categoryName)\n : undefined\n}\n\nexport const getCategoryByUuid = (params: { survey: ArenaSurvey; categoryUuid: string }): ArenaCategory | undefined => {\n const { survey, categoryUuid } = params\n return survey.categories?.[categoryUuid]\n}\n\nexport const getTaxonomyByName = (params: { survey: ArenaSurvey; taxonomyName: string }): ArenaTaxonomy | undefined => {\n const { survey, taxonomyName } = params\n return survey.taxonomies\n ? Object.values(survey.taxonomies).find((taxonomy) => taxonomy.props.name === taxonomyName)\n : undefined\n}\n\nexport const getTaxonomyByUuid = (params: { survey: ArenaSurvey; taxonomyUuid: string }): ArenaTaxonomy | undefined => {\n const { survey, taxonomyUuid } = params\n return survey.taxonomies?.[taxonomyUuid]\n}\n\nexport const getCycleKeys = (survey: ArenaSurveyOrSummary): string[] => {\n const cycles = survey.props?.cycles ?? {}\n return Object.keys(cycles)\n}\n\nexport const getLastCycleKey = (survey: ArenaSurveyOrSummary): string => Arrays.last(getCycleKeys(survey)) as string\n\nexport const isKeepNonApplicableValues = (survey: ArenaSurveyOrSummary): boolean =>\n survey?.props?.keepNonApplicableValues === true\n\nexport const getDefaultCycleKey = (survey: ArenaSurveyOrSummary) => {\n const defaultCycleKey = survey.props?.defaultCycleKey\n const lastCycleKey = getLastCycleKey(survey)\n return Objects.isEmpty(defaultCycleKey) || Number(defaultCycleKey) > Number(lastCycleKey)\n ? lastCycleKey\n : defaultCycleKey\n}\n\nexport const getSRSs = (survey: ArenaSurveyOrSummary): ArenaSRS[] =>\n survey.props?.srs ??\n // backwards compatibility with Arena: srs stored in info in UI\n (survey as any).info?.props?.srs ??\n []\n\nexport const getSRSIndex = (survey: ArenaSurveyOrSummary): ArenaSRSIndex =>\n getSRSs(survey).reduce((acc: ArenaSRSIndex, srs) => {\n acc[srs.code] = srs\n return acc\n }, {})\n\nexport const getSRSByCode =\n (code: string) =>\n (survey: ArenaSurveyOrSummary): ArenaSRS | undefined =>\n getSRSIndex(survey)[code]\n\nexport const getAreasOfInterest = (survey: ArenaSurveyOrSummary): ArenaAreaOfInterestDescriptor[] =>\n survey?.props?.areasOfInterest ??\n // backwards compatibility with Arena: survey info props stored in info\n (survey as any)?.info?.props?.areasOfInterest ??\n []\n\nexport const getAreaOfInterestByName = (params: {\n survey: ArenaSurveyOrSummary\n name: string\n}): ArenaAreaOfInterestDescriptor | undefined =>\n getAreasOfInterest(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name)\n\nexport const getAuthGroups = (survey: ArenaSurvey): ArenaUserAuthGroup[] => survey?.authGroups ?? []\n\nexport const getAuthGroupAdmin = (survey: ArenaSurvey): ArenaUserAuthGroup | undefined =>\n getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin)\n"]}
|