@openforis/arena-core 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dataExport/ArenaExportFile.d.ts +50 -0
- package/dist/dataExport/ArenaExportFile.js +48 -0
- package/dist/dataExport/ArenaExportFile.js.map +1 -0
- package/dist/dataExport/index.d.ts +1 -0
- package/dist/dataExport/index.js +3 -1
- package/dist/dataExport/index.js.map +1 -1
- package/dist/error/systemErrorKeys.d.ts +1 -0
- package/dist/error/systemErrorKeys.js +1 -0
- package/dist/error/systemErrorKeys.js.map +1 -1
- package/dist/esm/dataExport/ArenaExportFile.js +45 -0
- package/dist/esm/dataExport/ArenaExportFile.js.map +1 -0
- package/dist/esm/dataExport/index.js +1 -0
- package/dist/esm/dataExport/index.js.map +1 -1
- package/dist/esm/error/systemErrorKeys.js +1 -0
- package/dist/esm/error/systemErrorKeys.js.map +1 -1
- package/dist/esm/geo/areaOfInterest.js.map +1 -1
- package/dist/esm/geo/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/areaOfInterestProvider.js +2 -0
- package/dist/esm/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -0
- package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/functions.js +45 -8
- package/dist/esm/nodeDefExpressionEvaluator/functions.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/index.js.map +1 -1
- package/dist/esm/record/recordExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
- package/dist/esm/record/recordValidator/attributeValidator.js +2 -1
- package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/esm/survey/survey.js.map +1 -1
- package/dist/esm/survey/surveys/index.js +3 -2
- package/dist/esm/survey/surveys/index.js.map +1 -1
- package/dist/esm/survey/surveys/surveysGetters.js +3 -2
- package/dist/esm/survey/surveys/surveysGetters.js.map +1 -1
- package/dist/geo/areaOfInterest.d.ts +14 -1
- package/dist/geo/areaOfInterest.js.map +1 -1
- package/dist/geo/index.d.ts +1 -1
- package/dist/geo/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.d.ts +11 -0
- package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.js +3 -0
- package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -0
- package/dist/nodeDefExpressionEvaluator/context.d.ts +2 -0
- package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/functions.js +44 -7
- package/dist/nodeDefExpressionEvaluator/functions.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/index.d.ts +1 -0
- package/dist/nodeDefExpressionEvaluator/index.js.map +1 -1
- package/dist/record/recordExpressionEvaluator/context.d.ts +2 -0
- package/dist/record/recordExpressionEvaluator/context.js.map +1 -1
- package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.d.ts +2 -0
- package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.d.ts +2 -0
- package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
- package/dist/record/recordValidator/attributeValidator.d.ts +2 -0
- package/dist/record/recordValidator/attributeValidator.js +2 -1
- package/dist/record/recordValidator/attributeValidator.js.map +1 -1
- package/dist/survey/survey.d.ts +2 -2
- package/dist/survey/survey.js.map +1 -1
- package/dist/survey/surveys/index.d.ts +3 -2
- package/dist/survey/surveys/index.js +2 -1
- package/dist/survey/surveys/index.js.map +1 -1
- package/dist/survey/surveys/surveysGetters.d.ts +6 -2
- package/dist/survey/surveys/surveysGetters.js +6 -4
- package/dist/survey/surveys/surveysGetters.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAuthGroupAdmin = exports.getAuthGroups = exports.
|
|
3
|
+
exports.getAuthGroupAdmin = exports.getAuthGroups = exports.getAreaOfInterestByName = exports.getAreasOfInterest = exports.getSRSByCode = exports.getSRSIndex = exports.getSRSs = exports.getDefaultCycleKey = exports.isKeepNonApplicableValues = exports.getLastCycleKey = exports.getCycleKeys = exports.getTaxonomyByUuid = exports.getTaxonomyByName = exports.getCategoryByUuid = exports.getCategoryByName = exports.getLabelOrName = exports.getFieldManualLink = exports.getDescription = exports.getLabel = exports.getDefaultLanguage = exports.getLanguages = exports.getName = void 0;
|
|
4
4
|
const auth_1 = require("../../auth");
|
|
5
5
|
const labels_1 = require("../../language/labels");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
@@ -81,10 +81,12 @@ const getSRSIndex = (survey) => (0, exports.getSRSs)(survey).reduce((acc, srs) =
|
|
|
81
81
|
exports.getSRSIndex = getSRSIndex;
|
|
82
82
|
const getSRSByCode = (code) => (survey) => (0, exports.getSRSIndex)(survey)[code];
|
|
83
83
|
exports.getSRSByCode = getSRSByCode;
|
|
84
|
-
const
|
|
84
|
+
const getAreasOfInterest = (survey) => { var _a, _b, _c; var _d, _e; return (_e = (_d = (_a = survey === null || survey === void 0 ? void 0 : survey.props) === null || _a === void 0 ? void 0 : _a.areasOfInterest) !== null && _d !== void 0 ? _d :
|
|
85
85
|
// backwards compatibility with Arena: survey info props stored in info
|
|
86
|
-
(_c = (_b = survey === null || survey === void 0 ? void 0 : survey.info) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.
|
|
87
|
-
exports.
|
|
86
|
+
(_c = (_b = survey === null || survey === void 0 ? void 0 : survey.info) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.areasOfInterest) !== null && _e !== void 0 ? _e : []; };
|
|
87
|
+
exports.getAreasOfInterest = getAreasOfInterest;
|
|
88
|
+
const getAreaOfInterestByName = (params) => (0, exports.getAreasOfInterest)(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name);
|
|
89
|
+
exports.getAreaOfInterestByName = getAreaOfInterestByName;
|
|
88
90
|
const getAuthGroups = (survey) => { var _a; return (_a = survey === null || survey === void 0 ? void 0 : survey.authGroups) !== null && _a !== void 0 ? _a : []; };
|
|
89
91
|
exports.getAuthGroups = getAuthGroups;
|
|
90
92
|
const getAuthGroupAdmin = (survey) => (0, exports.getAuthGroups)(survey).find((authGroup) => authGroup.name === auth_1.AuthGroupName.surveyAdmin);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surveysGetters.js","sourceRoot":"","sources":["../../../src/survey/surveys/surveysGetters.ts"],"names":[],"mappings":";;;AAAA,qCAAyD;AAIzD,kDAAyD;AAGzD,uCAA6C;AAGtC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAA;AAAvD,QAAA,OAAO,GAAP,OAAO,CAAgD;AAE7D,MAAM,YAAY,GAAG,CAAC,MAAc,EAAkB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAA;AAAzE,QAAA,YAAY,GAAZ,YAAY,CAA6D;AAE/E,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAgB,EAAE,CAAC,IAAA,QAAA,YAAY,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AAA9E,QAAA,kBAAkB,GAAlB,kBAAkB,CAA4D;AAE3F,MAAM,qBAAqB,GACzB,CAAC,IAAoD,EAAE,EAAE,CACzD,CAAC,QAAuB,EAAE,EAAE,CAC5B,CAAC,MAAc,EAAsB,EAAE;;IACrC,MAAM,YAAY,GAAG,QAAQ,aAAR,QAAQ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JpF,QAAA,uBAAuB,GAAvB,uBAAuB,CAI6D;AAE1F,MAAM,aAAa,GAAG,CAAC,MAAc,EAAmB,EAAE,wBAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAA7E,QAAA,aAAa,GAAb,aAAa,CAAgE;AAEnF,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAA6B,EAAE,CAC7E,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, UserAuthGroup } from '../../auth'\nimport { Category } from '../../category'\nimport type { AreaOfInterestDescriptor } from '../../geo'\nimport { LanguageCode } from '../../language'\nimport { getLabelOrDefault } from '../../language/labels'\nimport { SRS, SRSIndex } from '../../srs'\nimport { Taxonomy } from '../../taxonomy'\nimport { Arrays, Objects } from '../../utils'\nimport { Survey } from '../survey'\n\nexport const getName = (survey: Survey): string => survey.props.name\n\nexport const getLanguages = (survey: Survey): LanguageCode[] => survey.props.languages\n\nexport const getDefaultLanguage = (survey: Survey): LanguageCode => getLanguages(survey)[0]\n\nconst getMultilangPropValue =\n (prop: 'labels' | 'descriptions' | 'fieldManualLinks') =>\n (langCode?: LanguageCode) =>\n (survey: Survey): string | undefined => {\n const languageCode = langCode ?? getDefaultLanguage(survey)\n return survey.props[prop]?.[languageCode]\n }\nexport const getLabel = getMultilangPropValue('labels')\nexport const getDescription = getMultilangPropValue('descriptions')\nexport const getFieldManualLink = getMultilangPropValue('fieldManualLinks')\n\n/**\n * Returns the survey label in the specified language (the default language if not specified), or the survey name\n * when the label is missing or empty.\n */\nexport const getLabelOrName =\n (langCode?: LanguageCode) =>\n (survey: Survey): string =>\n getLabelOrDefault(survey.props.labels, langCode ?? getDefaultLanguage(survey), getName(survey))\n\nexport const getCategoryByName = (params: { survey: Survey; categoryName: string }): Category | undefined => {\n const { survey, categoryName } = params\n return survey.categories\n ? Object.values(survey.categories).find((category) => category.props.name === categoryName)\n : undefined\n}\n\nexport const getCategoryByUuid = (params: { survey: Survey; categoryUuid: string }): Category | undefined => {\n const { survey, categoryUuid } = params\n return survey.categories?.[categoryUuid]\n}\n\nexport const getTaxonomyByName = (params: { survey: Survey; taxonomyName: string }): Taxonomy | undefined => {\n const { survey, taxonomyName } = params\n return survey.taxonomies\n ? Object.values(survey.taxonomies).find((taxonomy) => taxonomy.props.name === taxonomyName)\n : undefined\n}\n\nexport const getTaxonomyByUuid = (params: { survey: Survey; taxonomyUuid: string }): Taxonomy | undefined => {\n const { survey, taxonomyUuid } = params\n return survey.taxonomies?.[taxonomyUuid]\n}\n\nexport const getCycleKeys = (survey: Survey): string[] => {\n const cycles = survey.props?.cycles ?? {}\n return Object.keys(cycles)\n}\n\nexport const getLastCycleKey = (survey: Survey): string => Arrays.last(getCycleKeys(survey)) as string\n\nexport const isKeepNonApplicableValues = (survey: Survey): boolean => survey?.props?.keepNonApplicableValues === true\n\nexport const getDefaultCycleKey = (survey: Survey) => {\n const defaultCycleKey = survey.props?.defaultCycleKey\n const lastCycleKey = getLastCycleKey(survey)\n return Objects.isEmpty(defaultCycleKey) || Number(defaultCycleKey) > Number(lastCycleKey)\n ? lastCycleKey\n : defaultCycleKey\n}\n\nexport const getSRSs = (survey: Survey): SRS[] =>\n survey.props?.srs ??\n // backwards compatibility with Arena: srs stored in info in UI\n (survey as any).info?.props?.srs ??\n []\n\nexport const getSRSIndex = (survey: Survey): SRSIndex =>\n getSRSs(survey).reduce((acc: SRSIndex, srs) => {\n acc[srs.code] = srs\n return acc\n }, {})\n\nexport const getSRSByCode =\n (code: string) =>\n (survey: Survey): SRS | undefined =>\n getSRSIndex(survey)[code]\n\nexport const getAreasOfInterest = (survey: Survey): AreaOfInterestDescriptor[] =>\n survey?.props?.areasOfInterest ??\n // backwards compatibility with Arena: survey info props stored in info\n (survey as any)?.info?.props?.areasOfInterest ??\n []\n\nexport const getAreaOfInterestByName = (params: {\n survey: Survey\n name: string\n}): AreaOfInterestDescriptor | undefined =>\n getAreasOfInterest(params.survey).find((areaOfInterest) => areaOfInterest.name === params.name)\n\nexport const getAuthGroups = (survey: Survey): UserAuthGroup[] => survey?.authGroups ?? []\n\nexport const getAuthGroupAdmin = (survey: Survey): UserAuthGroup | undefined =>\n getAuthGroups(survey).find((authGroup) => authGroup.name === AuthGroupName.surveyAdmin)\n"]}
|