@openforis/arena-core 2.16.14 → 2.17.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.
@@ -7,7 +7,6 @@ declare const getSurveyUuid: (authGroup: AuthGroup) => string | undefined;
7
7
  declare const getRecordSteps: (authGroup?: AuthGroup) => {
8
8
  [key: string]: RecordStepPermission;
9
9
  } | undefined;
10
- declare const getRecordEditLevel: (step: string) => (authGroup?: AuthGroup) => RecordStepPermission;
11
10
  declare const getDefaultAuthGroups: (surveyUuid: string) => AuthGroup[];
12
11
  declare const getPermissions: (group: AuthGroup) => import("./permission").Permission[];
13
12
  declare const sortGroups: (groups: AuthGroup[]) => AuthGroup[];
@@ -17,7 +16,6 @@ export declare const AuthGroups: {
17
16
  isSurveyManager: typeof isSurveyManager;
18
17
  getSurveyUuid: typeof getSurveyUuid;
19
18
  getRecordSteps: typeof getRecordSteps;
20
- getRecordEditLevel: typeof getRecordEditLevel;
21
19
  getDefaultAuthGroups: typeof getDefaultAuthGroups;
22
20
  getPermissions: typeof getPermissions;
23
21
  sortGroups: typeof sortGroups;
@@ -8,12 +8,6 @@ const isSurveyManager = (authGroup) => (authGroup === null || authGroup === void
8
8
  const isSurveyGroup = (authGroup) => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup);
9
9
  const getSurveyUuid = (authGroup) => authGroup === null || authGroup === void 0 ? void 0 : authGroup.surveyUuid;
10
10
  const getRecordSteps = (authGroup) => authGroup === null || authGroup === void 0 ? void 0 : authGroup.recordSteps;
11
- const getRecordEditLevel = (step) => (authGroup) => {
12
- const steps = getRecordSteps(authGroup);
13
- if (!steps)
14
- throw new Error('No steps');
15
- return steps[step];
16
- };
17
11
  const getDefaultAuthGroups = (surveyUuid) => (0, authGroup_1.createDefaultAuthGroups)().map((group) => (Object.assign(Object.assign({}, group), { uuid: utils_1.UUIDs.v4(), surveyUuid })));
18
12
  const getPermissions = (group) => { var _a; return (_a = authGroup_1.permissionsByGroupName[group.name]) !== null && _a !== void 0 ? _a : []; };
19
13
  const sortGroups = (groups) => {
@@ -31,7 +25,6 @@ exports.AuthGroups = {
31
25
  isSurveyManager,
32
26
  getSurveyUuid,
33
27
  getRecordSteps,
34
- getRecordEditLevel,
35
28
  getDefaultAuthGroups,
36
29
  getPermissions,
37
30
  sortGroups,
@@ -1 +1 @@
1
- {"version":3,"file":"authGroups.js","sourceRoot":"","sources":["../../src/auth/authGroups.ts"],"names":[],"mappings":";;;AAAA,oCAAgC;AAChC,2CAMoB;AAGpB,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,yBAAa,CAAC,WAAW,CAAA;AAEtG,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,yBAAa,CAAC,aAAa,CAAA;AAE1G,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;AAEjH,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAsB,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAA;AAEzF,MAAM,cAAc,GAAG,CAAC,SAAqB,EAAuD,EAAE,CACpG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAA;AAExB,MAAM,kBAAkB,GACtB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,SAAqB,EAAwB,EAAE;IAC9C,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,CAAA;IACvC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;IAEvC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC,CAAA;AAEH,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE,CAC/D,IAAA,mCAAuB,GAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCAAM,KAAK,KAAE,IAAI,EAAE,aAAK,CAAC,EAAE,EAAE,EAAE,UAAU,IAAG,CAAC,CAAA;AAExF,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,EAAE,wBAAC,kCAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,GAAA,CAAA;AAErF,MAAM,UAAU,GAAG,CAAC,MAAmB,EAAE,EAAE;IACzC,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IAChC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,4BAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,UAAU,GAAG,4BAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,OAAO,UAAU,GAAG,UAAU,CAAA;IAChC,CAAC,CAAC,CAAA;IACF,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAEY,QAAA,UAAU,GAAG;IACxB,aAAa;IACb,aAAa;IACb,eAAe;IACf,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,cAAc;IACd,UAAU;CACX,CAAA","sourcesContent":["import { UUIDs } from '../utils'\nimport {\n AuthGroup,\n AuthGroupName,\n createDefaultAuthGroups,\n permissionsByGroupName,\n sortedGroupNames,\n} from './authGroup'\nimport { RecordStepPermission } from './permission'\n\nconst isSystemAdmin = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.systemAdmin\n\nconst isSurveyManager = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.surveyManager\n\nconst isSurveyGroup = (authGroup: AuthGroup): boolean => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup)\n\nconst getSurveyUuid = (authGroup: AuthGroup): string | undefined => authGroup?.surveyUuid\n\nconst getRecordSteps = (authGroup?: AuthGroup): { [key: string]: RecordStepPermission } | undefined =>\n authGroup?.recordSteps\n\nconst getRecordEditLevel =\n (step: string) =>\n (authGroup?: AuthGroup): RecordStepPermission => {\n const steps = getRecordSteps(authGroup)\n if (!steps) throw new Error('No steps')\n\n return steps[step]\n }\n\nconst getDefaultAuthGroups = (surveyUuid: string): AuthGroup[] =>\n createDefaultAuthGroups().map((group) => ({ ...group, uuid: UUIDs.v4(), surveyUuid }))\n\nconst getPermissions = (group: AuthGroup) => permissionsByGroupName[group.name] ?? []\n\nconst sortGroups = (groups: AuthGroup[]) => {\n const sortedGroups = [...groups]\n sortedGroups.sort((group1, group2) => {\n const sortOrder1 = sortedGroupNames.indexOf(group1.name)\n const sortOrder2 = sortedGroupNames.indexOf(group2.name)\n return sortOrder1 - sortOrder2\n })\n return sortedGroups\n}\n\nexport const AuthGroups = {\n isSystemAdmin,\n isSurveyGroup,\n isSurveyManager,\n getSurveyUuid,\n getRecordSteps,\n getRecordEditLevel,\n getDefaultAuthGroups,\n getPermissions,\n sortGroups,\n}\n"]}
1
+ {"version":3,"file":"authGroups.js","sourceRoot":"","sources":["../../src/auth/authGroups.ts"],"names":[],"mappings":";;;AAAA,oCAAgC;AAChC,2CAMoB;AAGpB,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,yBAAa,CAAC,WAAW,CAAA;AAEtG,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,yBAAa,CAAC,aAAa,CAAA;AAE1G,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;AAEjH,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAsB,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAA;AAEzF,MAAM,cAAc,GAAG,CAAC,SAAqB,EAAuD,EAAE,CACpG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAA;AAExB,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE,CAC/D,IAAA,mCAAuB,GAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCAAM,KAAK,KAAE,IAAI,EAAE,aAAK,CAAC,EAAE,EAAE,EAAE,UAAU,IAAG,CAAC,CAAA;AAExF,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,EAAE,wBAAC,kCAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,GAAA,CAAA;AAErF,MAAM,UAAU,GAAG,CAAC,MAAmB,EAAE,EAAE;IACzC,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IAChC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,4BAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,UAAU,GAAG,4BAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,OAAO,UAAU,GAAG,UAAU,CAAA;IAChC,CAAC,CAAC,CAAA;IACF,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAEY,QAAA,UAAU,GAAG;IACxB,aAAa;IACb,aAAa;IACb,eAAe;IACf,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,UAAU;CACX,CAAA","sourcesContent":["import { UUIDs } from '../utils'\nimport {\n AuthGroup,\n AuthGroupName,\n createDefaultAuthGroups,\n permissionsByGroupName,\n sortedGroupNames,\n} from './authGroup'\nimport { RecordStepPermission } from './permission'\n\nconst isSystemAdmin = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.systemAdmin\n\nconst isSurveyManager = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.surveyManager\n\nconst isSurveyGroup = (authGroup: AuthGroup): boolean => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup)\n\nconst getSurveyUuid = (authGroup: AuthGroup): string | undefined => authGroup?.surveyUuid\n\nconst getRecordSteps = (authGroup?: AuthGroup): { [key: string]: RecordStepPermission } | undefined =>\n authGroup?.recordSteps\n\nconst getDefaultAuthGroups = (surveyUuid: string): AuthGroup[] =>\n createDefaultAuthGroups().map((group) => ({ ...group, uuid: UUIDs.v4(), surveyUuid }))\n\nconst getPermissions = (group: AuthGroup) => permissionsByGroupName[group.name] ?? []\n\nconst sortGroups = (groups: AuthGroup[]) => {\n const sortedGroups = [...groups]\n sortedGroups.sort((group1, group2) => {\n const sortOrder1 = sortedGroupNames.indexOf(group1.name)\n const sortOrder2 = sortedGroupNames.indexOf(group2.name)\n return sortOrder1 - sortOrder2\n })\n return sortedGroups\n}\n\nexport const AuthGroups = {\n isSystemAdmin,\n isSurveyGroup,\n isSurveyManager,\n getSurveyUuid,\n getRecordSteps,\n getDefaultAuthGroups,\n getPermissions,\n sortGroups,\n}\n"]}
@@ -5,12 +5,6 @@ const isSurveyManager = (authGroup) => (authGroup === null || authGroup === void
5
5
  const isSurveyGroup = (authGroup) => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup);
6
6
  const getSurveyUuid = (authGroup) => authGroup === null || authGroup === void 0 ? void 0 : authGroup.surveyUuid;
7
7
  const getRecordSteps = (authGroup) => authGroup === null || authGroup === void 0 ? void 0 : authGroup.recordSteps;
8
- const getRecordEditLevel = (step) => (authGroup) => {
9
- const steps = getRecordSteps(authGroup);
10
- if (!steps)
11
- throw new Error('No steps');
12
- return steps[step];
13
- };
14
8
  const getDefaultAuthGroups = (surveyUuid) => createDefaultAuthGroups().map((group) => (Object.assign(Object.assign({}, group), { uuid: UUIDs.v4(), surveyUuid })));
15
9
  const getPermissions = (group) => { var _a; return (_a = permissionsByGroupName[group.name]) !== null && _a !== void 0 ? _a : []; };
16
10
  const sortGroups = (groups) => {
@@ -28,7 +22,6 @@ export const AuthGroups = {
28
22
  isSurveyManager,
29
23
  getSurveyUuid,
30
24
  getRecordSteps,
31
- getRecordEditLevel,
32
25
  getDefaultAuthGroups,
33
26
  getPermissions,
34
27
  sortGroups,
@@ -1 +1 @@
1
- {"version":3,"file":"authGroups.js","sourceRoot":"","sources":["../../../src/auth/authGroups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAEL,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAGpB,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,aAAa,CAAC,WAAW,CAAA;AAEtG,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,aAAa,CAAC,aAAa,CAAA;AAE1G,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;AAEjH,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAsB,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAA;AAEzF,MAAM,cAAc,GAAG,CAAC,SAAqB,EAAuD,EAAE,CACpG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAA;AAExB,MAAM,kBAAkB,GACtB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,SAAqB,EAAwB,EAAE;IAC9C,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,CAAA;IACvC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;IAEvC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC,CAAA;AAEH,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE,CAC/D,uBAAuB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCAAM,KAAK,KAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,UAAU,IAAG,CAAC,CAAA;AAExF,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,EAAE,wBAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,GAAA,CAAA;AAErF,MAAM,UAAU,GAAG,CAAC,MAAmB,EAAE,EAAE;IACzC,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IAChC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,OAAO,UAAU,GAAG,UAAU,CAAA;IAChC,CAAC,CAAC,CAAA;IACF,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa;IACb,aAAa;IACb,eAAe;IACf,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,cAAc;IACd,UAAU;CACX,CAAA","sourcesContent":["import { UUIDs } from '../utils'\nimport {\n AuthGroup,\n AuthGroupName,\n createDefaultAuthGroups,\n permissionsByGroupName,\n sortedGroupNames,\n} from './authGroup'\nimport { RecordStepPermission } from './permission'\n\nconst isSystemAdmin = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.systemAdmin\n\nconst isSurveyManager = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.surveyManager\n\nconst isSurveyGroup = (authGroup: AuthGroup): boolean => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup)\n\nconst getSurveyUuid = (authGroup: AuthGroup): string | undefined => authGroup?.surveyUuid\n\nconst getRecordSteps = (authGroup?: AuthGroup): { [key: string]: RecordStepPermission } | undefined =>\n authGroup?.recordSteps\n\nconst getRecordEditLevel =\n (step: string) =>\n (authGroup?: AuthGroup): RecordStepPermission => {\n const steps = getRecordSteps(authGroup)\n if (!steps) throw new Error('No steps')\n\n return steps[step]\n }\n\nconst getDefaultAuthGroups = (surveyUuid: string): AuthGroup[] =>\n createDefaultAuthGroups().map((group) => ({ ...group, uuid: UUIDs.v4(), surveyUuid }))\n\nconst getPermissions = (group: AuthGroup) => permissionsByGroupName[group.name] ?? []\n\nconst sortGroups = (groups: AuthGroup[]) => {\n const sortedGroups = [...groups]\n sortedGroups.sort((group1, group2) => {\n const sortOrder1 = sortedGroupNames.indexOf(group1.name)\n const sortOrder2 = sortedGroupNames.indexOf(group2.name)\n return sortOrder1 - sortOrder2\n })\n return sortedGroups\n}\n\nexport const AuthGroups = {\n isSystemAdmin,\n isSurveyGroup,\n isSurveyManager,\n getSurveyUuid,\n getRecordSteps,\n getRecordEditLevel,\n getDefaultAuthGroups,\n getPermissions,\n sortGroups,\n}\n"]}
1
+ {"version":3,"file":"authGroups.js","sourceRoot":"","sources":["../../../src/auth/authGroups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAEL,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,aAAa,CAAA;AAGpB,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,aAAa,CAAC,WAAW,CAAA;AAEtG,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,aAAa,CAAC,aAAa,CAAA;AAE1G,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;AAEjH,MAAM,aAAa,GAAG,CAAC,SAAoB,EAAsB,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAA;AAEzF,MAAM,cAAc,GAAG,CAAC,SAAqB,EAAuD,EAAE,CACpG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAA;AAExB,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE,CAC/D,uBAAuB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCAAM,KAAK,KAAE,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,UAAU,IAAG,CAAC,CAAA;AAExF,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,EAAE,wBAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,GAAA,CAAA;AAErF,MAAM,UAAU,GAAG,CAAC,MAAmB,EAAE,EAAE;IACzC,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC,CAAA;IAChC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACxD,OAAO,UAAU,GAAG,UAAU,CAAA;IAChC,CAAC,CAAC,CAAA;IACF,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,aAAa;IACb,aAAa;IACb,eAAe;IACf,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,UAAU;CACX,CAAA","sourcesContent":["import { UUIDs } from '../utils'\nimport {\n AuthGroup,\n AuthGroupName,\n createDefaultAuthGroups,\n permissionsByGroupName,\n sortedGroupNames,\n} from './authGroup'\nimport { RecordStepPermission } from './permission'\n\nconst isSystemAdmin = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.systemAdmin\n\nconst isSurveyManager = (authGroup: AuthGroup): boolean => authGroup?.name === AuthGroupName.surveyManager\n\nconst isSurveyGroup = (authGroup: AuthGroup): boolean => !isSystemAdmin(authGroup) && !isSurveyManager(authGroup)\n\nconst getSurveyUuid = (authGroup: AuthGroup): string | undefined => authGroup?.surveyUuid\n\nconst getRecordSteps = (authGroup?: AuthGroup): { [key: string]: RecordStepPermission } | undefined =>\n authGroup?.recordSteps\n\nconst getDefaultAuthGroups = (surveyUuid: string): AuthGroup[] =>\n createDefaultAuthGroups().map((group) => ({ ...group, uuid: UUIDs.v4(), surveyUuid }))\n\nconst getPermissions = (group: AuthGroup) => permissionsByGroupName[group.name] ?? []\n\nconst sortGroups = (groups: AuthGroup[]) => {\n const sortedGroups = [...groups]\n sortedGroups.sort((group1, group2) => {\n const sortOrder1 = sortedGroupNames.indexOf(group1.name)\n const sortOrder2 = sortedGroupNames.indexOf(group2.name)\n return sortOrder1 - sortOrder2\n })\n return sortedGroups\n}\n\nexport const AuthGroups = {\n isSystemAdmin,\n isSurveyGroup,\n isSurveyManager,\n getSurveyUuid,\n getRecordSteps,\n getDefaultAuthGroups,\n getPermissions,\n sortGroups,\n}\n"]}
@@ -16,6 +16,8 @@ export const distanceToPolygonBoundary = (point, polygon, srsIndex = DEFAULT_SRS
16
16
  try {
17
17
  // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),
18
18
  // consistent with the inside/outside check (geodesic would measure to great-circle edges)
19
+ // shortcut: polygons crossing the antimeridian (longitudes jumping from 180 to -180) are measured wrong,
20
+ // split them in 2 polygons (one for each side) if such areas of interest are needed
19
21
  return pointToPolygonDistance([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' });
20
22
  }
21
23
  catch (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"distanceToPolygonBoundary.js","sourceRoot":"","sources":["../../../../src/geo/points/distanceToPolygonBoundary.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,iBAAiB,EAAY,MAAM,WAAW,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAY,EACZ,OAAuB,EACvB,QAAQ,GAAa,iBAAiB,EACvB,EAAE;IACjB,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9B,IAAI,CAAC;QACH,+GAA+G;QAC/G,0FAA0F;QAC1F,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IACjH,CAAC;eAAO,CAAC;QACP,2BAA2B;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA","sourcesContent":["import pointToPolygonDistance from '@turf/point-to-polygon-distance'\n\nimport { DEFAULT_SRS_INDEX, SRSIndex } from '../../srs'\nimport { AreaOfInterest } from '../areaOfInterest'\nimport { Point } from '../point'\nimport { toLatLong } from './toLatLong'\n\n/**\n * Returns the distance (in meters) between a point and the boundary of a polygon: negative inside, positive outside.\n *\n * @param {!Point} point - The point.\n * @param {!AreaOfInterest} polygon - Polygon or multi polygon in WGS84.\n * @param {!SRSIndex} srsIndex - SRSs indexed by SRS code.\n * @returns {number|null} - The signed distance in meters, or null if the point or the polygon are not valid.\n */\nexport const distanceToPolygonBoundary = (\n point: Point,\n polygon: AreaOfInterest,\n srsIndex: SRSIndex = DEFAULT_SRS_INDEX\n): number | null => {\n const pointLatLong = toLatLong(point, srsIndex)\n if (!pointLatLong) return null\n try {\n // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),\n // consistent with the inside/outside check (geodesic would measure to great-circle edges)\n return pointToPolygonDistance([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' })\n } catch {\n // invalid polygon geometry\n return null\n }\n}\n"]}
1
+ {"version":3,"file":"distanceToPolygonBoundary.js","sourceRoot":"","sources":["../../../../src/geo/points/distanceToPolygonBoundary.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,iBAAiB,EAAY,MAAM,WAAW,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAY,EACZ,OAAuB,EACvB,QAAQ,GAAa,iBAAiB,EACvB,EAAE;IACjB,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9B,IAAI,CAAC;QACH,+GAA+G;QAC/G,0FAA0F;QAC1F,yGAAyG;QACzG,oFAAoF;QACpF,OAAO,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IACjH,CAAC;eAAO,CAAC;QACP,2BAA2B;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA","sourcesContent":["import pointToPolygonDistance from '@turf/point-to-polygon-distance'\n\nimport { DEFAULT_SRS_INDEX, SRSIndex } from '../../srs'\nimport { AreaOfInterest } from '../areaOfInterest'\nimport { Point } from '../point'\nimport { toLatLong } from './toLatLong'\n\n/**\n * Returns the distance (in meters) between a point and the boundary of a polygon: negative inside, positive outside.\n *\n * @param {!Point} point - The point.\n * @param {!AreaOfInterest} polygon - Polygon or multi polygon in WGS84.\n * @param {!SRSIndex} srsIndex - SRSs indexed by SRS code.\n * @returns {number|null} - The signed distance in meters, or null if the point or the polygon are not valid.\n */\nexport const distanceToPolygonBoundary = (\n point: Point,\n polygon: AreaOfInterest,\n srsIndex: SRSIndex = DEFAULT_SRS_INDEX\n): number | null => {\n const pointLatLong = toLatLong(point, srsIndex)\n if (!pointLatLong) return null\n try {\n // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),\n // consistent with the inside/outside check (geodesic would measure to great-circle edges)\n // shortcut: polygons crossing the antimeridian (longitudes jumping from 180 to -180) are measured wrong,\n // split them in 2 polygons (one for each side) if such areas of interest are needed\n return pointToPolygonDistance([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' })\n } catch {\n // invalid polygon geometry\n return null\n }\n}\n"]}
@@ -22,6 +22,8 @@ const distanceToPolygonBoundary = (point, polygon, srsIndex = srs_1.DEFAULT_SRS_
22
22
  try {
23
23
  // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),
24
24
  // consistent with the inside/outside check (geodesic would measure to great-circle edges)
25
+ // shortcut: polygons crossing the antimeridian (longitudes jumping from 180 to -180) are measured wrong,
26
+ // split them in 2 polygons (one for each side) if such areas of interest are needed
25
27
  return (0, point_to_polygon_distance_1.default)([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' });
26
28
  }
27
29
  catch (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"distanceToPolygonBoundary.js","sourceRoot":"","sources":["../../../src/geo/points/distanceToPolygonBoundary.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAoE;AAEpE,mCAAuD;AAGvD,2CAAuC;AAEvC;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,CACvC,KAAY,EACZ,OAAuB,EACvB,QAAQ,GAAa,uBAAiB,EACvB,EAAE;IACjB,MAAM,YAAY,GAAG,IAAA,qBAAS,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9B,IAAI,CAAC;QACH,+GAA+G;QAC/G,0FAA0F;QAC1F,OAAO,IAAA,mCAAsB,EAAC,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IACjH,CAAC;eAAO,CAAC;QACP,2BAA2B;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAfY,QAAA,yBAAyB,GAAzB,yBAAyB,CAerC","sourcesContent":["import pointToPolygonDistance from '@turf/point-to-polygon-distance'\n\nimport { DEFAULT_SRS_INDEX, SRSIndex } from '../../srs'\nimport { AreaOfInterest } from '../areaOfInterest'\nimport { Point } from '../point'\nimport { toLatLong } from './toLatLong'\n\n/**\n * Returns the distance (in meters) between a point and the boundary of a polygon: negative inside, positive outside.\n *\n * @param {!Point} point - The point.\n * @param {!AreaOfInterest} polygon - Polygon or multi polygon in WGS84.\n * @param {!SRSIndex} srsIndex - SRSs indexed by SRS code.\n * @returns {number|null} - The signed distance in meters, or null if the point or the polygon are not valid.\n */\nexport const distanceToPolygonBoundary = (\n point: Point,\n polygon: AreaOfInterest,\n srsIndex: SRSIndex = DEFAULT_SRS_INDEX\n): number | null => {\n const pointLatLong = toLatLong(point, srsIndex)\n if (!pointLatLong) return null\n try {\n // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),\n // consistent with the inside/outside check (geodesic would measure to great-circle edges)\n return pointToPolygonDistance([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' })\n } catch {\n // invalid polygon geometry\n return null\n }\n}\n"]}
1
+ {"version":3,"file":"distanceToPolygonBoundary.js","sourceRoot":"","sources":["../../../src/geo/points/distanceToPolygonBoundary.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAoE;AAEpE,mCAAuD;AAGvD,2CAAuC;AAEvC;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,CACvC,KAAY,EACZ,OAAuB,EACvB,QAAQ,GAAa,uBAAiB,EACvB,EAAE;IACjB,MAAM,YAAY,GAAG,IAAA,qBAAS,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC/C,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9B,IAAI,CAAC;QACH,+GAA+G;QAC/G,0FAA0F;QAC1F,yGAAyG;QACzG,oFAAoF;QACpF,OAAO,IAAA,mCAAsB,EAAC,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;IACjH,CAAC;eAAO,CAAC;QACP,2BAA2B;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAjBY,QAAA,yBAAyB,GAAzB,yBAAyB,CAiBrC","sourcesContent":["import pointToPolygonDistance from '@turf/point-to-polygon-distance'\n\nimport { DEFAULT_SRS_INDEX, SRSIndex } from '../../srs'\nimport { AreaOfInterest } from '../areaOfInterest'\nimport { Point } from '../point'\nimport { toLatLong } from './toLatLong'\n\n/**\n * Returns the distance (in meters) between a point and the boundary of a polygon: negative inside, positive outside.\n *\n * @param {!Point} point - The point.\n * @param {!AreaOfInterest} polygon - Polygon or multi polygon in WGS84.\n * @param {!SRSIndex} srsIndex - SRSs indexed by SRS code.\n * @returns {number|null} - The signed distance in meters, or null if the point or the polygon are not valid.\n */\nexport const distanceToPolygonBoundary = (\n point: Point,\n polygon: AreaOfInterest,\n srsIndex: SRSIndex = DEFAULT_SRS_INDEX\n): number | null => {\n const pointLatLong = toLatLong(point, srsIndex)\n if (!pointLatLong) return null\n try {\n // turf expects [longitude, latitude]; planar: polygon edges are straight lines (as in GeoJSON and on the map),\n // consistent with the inside/outside check (geodesic would measure to great-circle edges)\n // shortcut: polygons crossing the antimeridian (longitudes jumping from 180 to -180) are measured wrong,\n // split them in 2 polygons (one for each side) if such areas of interest are needed\n return pointToPolygonDistance([pointLatLong.x, pointLatLong.y], polygon, { units: 'meters', method: 'planar' })\n } catch {\n // invalid polygon geometry\n return null\n }\n}\n"]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "OpenForis",
5
5
  "email": "openforis.arena@gmail.com"
6
6
  },
7
- "version": "2.16.14",
7
+ "version": "2.17.0",
8
8
  "description": "Arena core module",
9
9
  "repository": {
10
10
  "type": "git",