@opengis/surveyor 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +4 -3
  2. package/dist/chunks/{AppIcon-CO70tpMX.js → AppIcon-CCLzEE-_.js} +1 -1
  3. package/dist/chunks/{AppealDetailField-DNRGpnyD.js → AppealDetailField-CI-1qhs3.js} +2 -2
  4. package/dist/chunks/{AppealStatusBadge-BlAaNUSK.js → AppealStatusBadge-CzzI6x8I.js} +2 -2
  5. package/dist/chunks/{AppealStatusBadge-Cu-UzdzA.js → AppealStatusBadge-DYBe9hqP.js} +1 -1
  6. package/dist/chunks/{ApplicationHistorySection-Cwq0-Frd.js → ApplicationHistorySection-CPCU_DXH.js} +4 -4
  7. package/dist/chunks/{BaseModal-SQXvRRNW.js → BaseModal-DnwqlJhc.js} +21 -11
  8. package/dist/chunks/{FormFilePicker-DxPQlxgy.js → FormFilePicker-Dss6pGmO.js} +2 -2
  9. package/dist/chunks/{MapLayerMenu-AUeTqgEp.js → MapLayerMenu-DjYCxEc3.js} +1 -1
  10. package/dist/chunks/{RegistryForm-wG-c8GKf.js → RegistryForm-CEUqFmsF.js} +1 -1
  11. package/dist/chunks/{RegistryFormModal-R_iZYqGE.js → RegistryFormModal-C-Z4MMHi.js} +3 -3
  12. package/dist/chunks/{RegistryToolbar-322DKUXi.js → RegistryToolbar-CI1MRqzw.js} +6 -6
  13. package/dist/chunks/{SurveyorTeleport-CnSF0Ptl.js → SurveyorTeleport-BLEO6we9.js} +1 -1
  14. package/dist/chunks/{UserAccessBadge-DyZDv7Oo.js → UserAccessBadge-D8JfgGfN.js} +1 -1
  15. package/dist/chunks/{UserTypeBadge-LvnMuKGo.js → UserTypeBadge-YIwwoCho.js} +1 -1
  16. package/dist/chunks/{VerifiedBadge-bk0n-rlC.js → VerifiedBadge-B__Vs_ce.js} +2 -2
  17. package/dist/chunks/{card-X9UVFgdR.js → card-BElHsAFl.js} +241 -208
  18. package/dist/chunks/{card-DWpAv92l.js → card-CU2THiBT.js} +4 -4
  19. package/dist/chunks/{card-6z-m7UkM.js → card-CUDo4kUH.js} +10 -10
  20. package/dist/chunks/{card-Dlp8_KhV.js → card-DL7yHB1C.js} +5 -5
  21. package/dist/chunks/{card-CWqi1K-x.js → card-UG1mWhcg.js} +4 -4
  22. package/dist/chunks/{card-C3y-j2TA.js → card-sDIYR6YI.js} +6 -6
  23. package/dist/chunks/certificates-BnseQylH.js +209 -0
  24. package/dist/chunks/certificates-DKi9CSfc.js +236 -0
  25. package/dist/chunks/{create-DR8tXNYj.js → create-DVZv77Uw.js} +9 -9
  26. package/dist/chunks/{forgot-DoG6vXhq.js → forgot-BVzXMKGA.js} +2 -2
  27. package/dist/chunks/{login-BWGylcSU.js → login-BCib_dtl.js} +2 -2
  28. package/dist/chunks/{map-DvwFkxAS.js → map-CNX1_COE.js} +940 -831
  29. package/dist/chunks/{map-layers-sT-gTiD_.js → map-layers-CCJ7G7ZK.js} +5 -5
  30. package/dist/chunks/{organizations-ByVE2f0c.js → organizations-BuMFRKjw.js} +6 -6
  31. package/dist/chunks/{profile-CkwMFh82.js → profile-BI_RIHN1.js} +3 -3
  32. package/dist/chunks/{registration-3GLgq-ae.js → registration-6nn7GgDS.js} +2 -2
  33. package/dist/chunks/{requests-BTpLXrNj.js → requests-DQRmDemb.js} +4 -4
  34. package/dist/chunks/{requests-rWq8ok3C.js → requests-Dh5jxF06.js} +5 -5
  35. package/dist/chunks/{reset-CP9LsLkC.js → reset-D2uXDfB6.js} +2 -2
  36. package/dist/chunks/{useEntityPath-C5Owtidc.js → useEntityPath-n7hCq8zh.js} +1 -1
  37. package/dist/chunks/{users-U1P6xCP4.js → users-LbXn1F2y.js} +6 -6
  38. package/dist/index.css +1 -1
  39. package/dist/index.js +40 -40
  40. package/package.json +1 -1
  41. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -41
  42. package/server/modules/surveyor/services/createApplication.ts +2 -3
  43. package/server/modules/surveyor/services/registerSurveyor.ts +3 -4
  44. package/server/modules/surveyor/services/requestPasswordReset.ts +1 -0
  45. package/server/modules/surveyor/services/resetSurveyorPassword.ts +1 -0
  46. package/server/modules/surveyor/utils/certificateStatus.ts +15 -0
  47. package/server/modules/surveyor/utils/mail.ts +49 -20
  48. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -79
  49. package/server/plugins/convertVector.ts +1 -1
  50. package/server/resources/surveyor-admin/certificates.ts +27 -1
  51. package/dist/chunks/certificates-Cwch72-o.js +0 -425
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { t as r } from "./chunks/_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as i } from "./chunks/auth-acuaYbYM.js";
4
4
  import { i as a, r as o } from "./chunks/profile-aXlo4qqA.js";
5
5
  import { i as s, o as c, s as l, t as u } from "./chunks/organizations-DbVDoURw.js";
6
- import { t as d } from "./chunks/AppIcon-CO70tpMX.js";
6
+ import { t as d } from "./chunks/AppIcon-CCLzEE-_.js";
7
7
  import { t as f } from "./chunks/list-search-D5VdmGdV.js";
8
8
  import { Fragment as p, computed as m, createApp as h, createBlock as g, createCommentVNode as _, createElementBlock as v, createElementVNode as y, createTextVNode as b, createVNode as x, defineAsyncComponent as S, defineComponent as C, inject as w, normalizeClass as T, onBeforeUnmount as E, onMounted as D, openBlock as O, provide as ee, ref as k, renderList as te, renderSlot as A, resolveDynamicComponent as j, toDisplayString as M, vModelText as ne, watch as re, withCtx as N, withDirectives as ie } from "vue";
9
9
  import { RouterView as P, createRouter as ae, createWebHistory as oe, useRoute as se, useRouter as F } from "vue-router";
@@ -57,13 +57,13 @@ function z(e, t, n, r, i, a) {
57
57
  var B = /*#__PURE__*/ r(I, [
58
58
  ["render", z],
59
59
  ["__scopeId", "data-v-ee198999"],
60
- ["__file", "C:/softpro/surveyor/src/wrappers/SurveyorEmbedShell.vue"]
60
+ ["__file", "D:/Softpro/surveyor/src/wrappers/SurveyorEmbedShell.vue"]
61
61
  ]), V = /*@__PURE__*/ C({
62
62
  __name: "Map",
63
63
  setup(e, { expose: t }) {
64
64
  t();
65
65
  let n = {
66
- MapPage: S(() => import("./chunks/map-DvwFkxAS.js")),
66
+ MapPage: S(() => import("./chunks/map-CNX1_COE.js")),
67
67
  SurveyorEmbedShell: B
68
68
  };
69
69
  return Object.defineProperty(n, "__isScriptSetup", {
@@ -83,7 +83,7 @@ function H(e, t, n, r, i, a) {
83
83
  _: 1
84
84
  });
85
85
  }
86
- var U = /*#__PURE__*/ r(V, [["render", H], ["__file", "C:/softpro/surveyor/src/wrappers/Map.vue"]]), W = /*@__PURE__*/ C({
86
+ var U = /*#__PURE__*/ r(V, [["render", H], ["__file", "D:/Softpro/surveyor/src/wrappers/Map.vue"]]), W = /*@__PURE__*/ C({
87
87
  __name: "BaseEntityWrapper",
88
88
  props: {
89
89
  list: {
@@ -134,13 +134,13 @@ var U = /*#__PURE__*/ r(V, [["render", H], ["__file", "C:/softpro/surveyor/src/w
134
134
  function G(e, t, n, r, i, a) {
135
135
  return O(), g(j(r.activeComponent), { key: r.activeKey || "list" });
136
136
  }
137
- var K = /*#__PURE__*/ r(W, [["render", G], ["__file", "C:/softpro/surveyor/src/wrappers/BaseEntityWrapper.vue"]]), ce = /*@__PURE__*/ C({
137
+ var K = /*#__PURE__*/ r(W, [["render", G], ["__file", "D:/Softpro/surveyor/src/wrappers/BaseEntityWrapper.vue"]]), ce = /*@__PURE__*/ C({
138
138
  __name: "Requests",
139
139
  setup(e, { expose: t }) {
140
140
  t();
141
141
  let n = {
142
- Index: S(() => import("./chunks/requests-BTpLXrNj.js")),
143
- Card: S(() => import("./chunks/card-6z-m7UkM.js")),
142
+ Index: S(() => import("./chunks/requests-DQRmDemb.js")),
143
+ Card: S(() => import("./chunks/card-CUDo4kUH.js")),
144
144
  BaseEntityWrapper: K,
145
145
  SurveyorEmbedShell: B
146
146
  };
@@ -162,13 +162,13 @@ function le(e, t, n, r, i, a) {
162
162
  _: 1
163
163
  });
164
164
  }
165
- var ue = /*#__PURE__*/ r(ce, [["render", le], ["__file", "C:/softpro/surveyor/src/wrappers/Requests.vue"]]), de = /*@__PURE__*/ C({
165
+ var ue = /*#__PURE__*/ r(ce, [["render", le], ["__file", "D:/Softpro/surveyor/src/wrappers/Requests.vue"]]), de = /*@__PURE__*/ C({
166
166
  __name: "Organisations",
167
167
  setup(e, { expose: t }) {
168
168
  t();
169
169
  let n = {
170
- Index: S(() => import("./chunks/organizations-ByVE2f0c.js")),
171
- Card: S(() => import("./chunks/card-X9UVFgdR.js")),
170
+ Index: S(() => import("./chunks/organizations-BuMFRKjw.js")),
171
+ Card: S(() => import("./chunks/card-BElHsAFl.js")),
172
172
  BaseEntityWrapper: K,
173
173
  SurveyorEmbedShell: B
174
174
  };
@@ -190,13 +190,13 @@ function fe(e, t, n, r, i, a) {
190
190
  _: 1
191
191
  });
192
192
  }
193
- var pe = /*#__PURE__*/ r(de, [["render", fe], ["__file", "C:/softpro/surveyor/src/wrappers/Organisations.vue"]]), me = /*@__PURE__*/ C({
193
+ var pe = /*#__PURE__*/ r(de, [["render", fe], ["__file", "D:/Softpro/surveyor/src/wrappers/Organisations.vue"]]), me = /*@__PURE__*/ C({
194
194
  __name: "Certificates",
195
195
  setup(e, { expose: t }) {
196
196
  t();
197
197
  let n = {
198
- Index: S(() => import("./chunks/certificates-Cwch72-o.js")),
199
- Card: S(() => import("./chunks/card-C3y-j2TA.js")),
198
+ Index: S(() => import("./chunks/certificates-DKi9CSfc.js")),
199
+ Card: S(() => import("./chunks/card-sDIYR6YI.js")),
200
200
  BaseEntityWrapper: K,
201
201
  SurveyorEmbedShell: B
202
202
  };
@@ -218,13 +218,13 @@ function he(e, t, n, r, i, a) {
218
218
  _: 1
219
219
  });
220
220
  }
221
- var ge = /*#__PURE__*/ r(me, [["render", he], ["__file", "C:/softpro/surveyor/src/wrappers/Certificates.vue"]]), _e = /*@__PURE__*/ C({
221
+ var ge = /*#__PURE__*/ r(me, [["render", he], ["__file", "D:/Softpro/surveyor/src/wrappers/Certificates.vue"]]), _e = /*@__PURE__*/ C({
222
222
  __name: "Users",
223
223
  setup(e, { expose: t }) {
224
224
  t();
225
225
  let n = {
226
- Index: S(() => import("./chunks/users-U1P6xCP4.js")),
227
- Card: S(() => import("./chunks/card-DWpAv92l.js")),
226
+ Index: S(() => import("./chunks/users-LbXn1F2y.js")),
227
+ Card: S(() => import("./chunks/card-CU2THiBT.js")),
228
228
  BaseEntityWrapper: K,
229
229
  SurveyorEmbedShell: B
230
230
  };
@@ -246,13 +246,13 @@ function ve(e, t, n, r, i, a) {
246
246
  _: 1
247
247
  });
248
248
  }
249
- var ye = /*#__PURE__*/ r(_e, [["render", ve], ["__file", "C:/softpro/surveyor/src/wrappers/Users.vue"]]), be = /*@__PURE__*/ C({
249
+ var ye = /*#__PURE__*/ r(_e, [["render", ve], ["__file", "D:/Softpro/surveyor/src/wrappers/Users.vue"]]), be = /*@__PURE__*/ C({
250
250
  __name: "MapLayers",
251
251
  setup(e, { expose: t }) {
252
252
  t();
253
253
  let n = {
254
- Index: S(() => import("./chunks/map-layers-sT-gTiD_.js")),
255
- Card: S(() => import("./chunks/card-CWqi1K-x.js")),
254
+ Index: S(() => import("./chunks/map-layers-CCJ7G7ZK.js")),
255
+ Card: S(() => import("./chunks/card-UG1mWhcg.js")),
256
256
  BaseEntityWrapper: K,
257
257
  SurveyorEmbedShell: B
258
258
  };
@@ -274,14 +274,14 @@ function xe(e, t, n, r, i, a) {
274
274
  _: 1
275
275
  });
276
276
  }
277
- var Se = /*#__PURE__*/ r(be, [["render", xe], ["__file", "C:/softpro/surveyor/src/wrappers/MapLayers.vue"]]), Ce = /*@__PURE__*/ C({
277
+ var Se = /*#__PURE__*/ r(be, [["render", xe], ["__file", "D:/Softpro/surveyor/src/wrappers/MapLayers.vue"]]), Ce = /*@__PURE__*/ C({
278
278
  __name: "CabinetRequests",
279
279
  setup(e, { expose: t }) {
280
280
  t();
281
281
  let n = {
282
- Index: S(() => import("./chunks/requests-rWq8ok3C.js")),
283
- Create: S(() => import("./chunks/create-DR8tXNYj.js")),
284
- Card: S(() => import("./chunks/card-Dlp8_KhV.js")),
282
+ Index: S(() => import("./chunks/requests-Dh5jxF06.js")),
283
+ Create: S(() => import("./chunks/create-DVZv77Uw.js")),
284
+ Card: S(() => import("./chunks/card-DL7yHB1C.js")),
285
285
  BaseEntityWrapper: K,
286
286
  SurveyorEmbedShell: B
287
287
  };
@@ -309,12 +309,12 @@ function we(e, t, n, r, i, a) {
309
309
  _: 1
310
310
  });
311
311
  }
312
- var Te = /*#__PURE__*/ r(Ce, [["render", we], ["__file", "C:/softpro/surveyor/src/wrappers/CabinetRequests.vue"]]), Ee = /*@__PURE__*/ C({
312
+ var Te = /*#__PURE__*/ r(Ce, [["render", we], ["__file", "D:/Softpro/surveyor/src/wrappers/CabinetRequests.vue"]]), Ee = /*@__PURE__*/ C({
313
313
  __name: "CabinetProfile",
314
314
  setup(e, { expose: t }) {
315
315
  t();
316
316
  let n = {
317
- Profile: S(() => import("./chunks/profile-CkwMFh82.js")),
317
+ Profile: S(() => import("./chunks/profile-BI_RIHN1.js")),
318
318
  SurveyorEmbedShell: B
319
319
  };
320
320
  return Object.defineProperty(n, "__isScriptSetup", {
@@ -331,7 +331,7 @@ function De(e, t, n, r, i, a) {
331
331
  _: 1
332
332
  });
333
333
  }
334
- var Oe = /*#__PURE__*/ r(Ee, [["render", De], ["__file", "C:/softpro/surveyor/src/wrappers/CabinetProfile.vue"]]), ke = /*@__PURE__*/ C({
334
+ var Oe = /*#__PURE__*/ r(Ee, [["render", De], ["__file", "D:/Softpro/surveyor/src/wrappers/CabinetProfile.vue"]]), ke = /*@__PURE__*/ C({
335
335
  __name: "SurveyorRoot",
336
336
  setup(r, { expose: i }) {
337
337
  i(), ee(t, !0);
@@ -355,7 +355,7 @@ function Me(e, t, n, r, i, a) {
355
355
  class: "surveyor-root min-h-screen bg-slate-50 text-slate-800 antialiased"
356
356
  }, [A(e.$slots, "default"), y("div", { id: r.SURVEYOR_PORTAL_ID }, null, 8, je)], 8, Ae);
357
357
  }
358
- var q = /*#__PURE__*/ r(ke, [["render", Me], ["__file", "C:/softpro/surveyor/shared/surveyor/SurveyorRoot.vue"]]), Ne = /*@__PURE__*/ C({
358
+ var q = /*#__PURE__*/ r(ke, [["render", Me], ["__file", "D:/Softpro/surveyor/shared/surveyor/SurveyorRoot.vue"]]), Ne = /*@__PURE__*/ C({
359
359
  __name: "Cabinet",
360
360
  setup(e, { expose: t }) {
361
361
  t();
@@ -379,7 +379,7 @@ function Pe(e, t, n, r, i, a) {
379
379
  _: 1
380
380
  });
381
381
  }
382
- var J = /*#__PURE__*/ r(Ne, [["render", Pe], ["__file", "C:/softpro/surveyor/src/wrappers/Cabinet.vue"]]), Fe = /*@__PURE__*/ C({
382
+ var J = /*#__PURE__*/ r(Ne, [["render", Pe], ["__file", "D:/Softpro/surveyor/src/wrappers/Cabinet.vue"]]), Fe = /*@__PURE__*/ C({
383
383
  __name: "OrgSwitcher",
384
384
  props: {
385
385
  organizations: {
@@ -461,7 +461,7 @@ function Xe(e, t, n, r, i, a) {
461
461
  })) : _("", !0)
462
462
  ], 10, Ke))), 128))])])) : _("", !0)], 512)) : _("", !0);
463
463
  }
464
- var Ze = /*#__PURE__*/ r(Fe, [["render", Xe], ["__file", "C:/softpro/surveyor/cabinet/src/components/OrgSwitcher.vue"]]), Qe = /*@__PURE__*/ C({
464
+ var Ze = /*#__PURE__*/ r(Fe, [["render", Xe], ["__file", "D:/Softpro/surveyor/cabinet/src/components/OrgSwitcher.vue"]]), Qe = /*@__PURE__*/ C({
465
465
  __name: "CabinetTopNav",
466
466
  setup(e, { expose: t }) {
467
467
  t();
@@ -603,7 +603,7 @@ function lt(e, t, n, r, i, a) {
603
603
  ])) : _("", !0)], 512)
604
604
  ])]);
605
605
  }
606
- var ut = /*#__PURE__*/ r(Qe, [["render", lt], ["__file", "C:/softpro/surveyor/cabinet/src/layouts/CabinetTopNav.vue"]]), dt = /*@__PURE__*/ C({
606
+ var ut = /*#__PURE__*/ r(Qe, [["render", lt], ["__file", "D:/Softpro/surveyor/cabinet/src/layouts/CabinetTopNav.vue"]]), dt = /*@__PURE__*/ C({
607
607
  __name: "CabinetLayout",
608
608
  setup(e, { expose: t }) {
609
609
  t(), D(() => {
@@ -630,7 +630,7 @@ var X = [
630
630
  {
631
631
  path: "/login",
632
632
  name: "login",
633
- component: () => import("./chunks/login-BWGylcSU.js"),
633
+ component: () => import("./chunks/login-BCib_dtl.js"),
634
634
  meta: {
635
635
  public: !0,
636
636
  title: "Вхід"
@@ -639,7 +639,7 @@ var X = [
639
639
  {
640
640
  path: "/registration/:token",
641
641
  name: "registration-complete",
642
- component: () => import("./chunks/registration-3GLgq-ae.js"),
642
+ component: () => import("./chunks/registration-6nn7GgDS.js"),
643
643
  meta: {
644
644
  public: !0,
645
645
  title: "Завершення реєстрації"
@@ -648,7 +648,7 @@ var X = [
648
648
  {
649
649
  path: "/password/forgot",
650
650
  name: "password-forgot",
651
- component: () => import("./chunks/forgot-DoG6vXhq.js"),
651
+ component: () => import("./chunks/forgot-BVzXMKGA.js"),
652
652
  meta: {
653
653
  public: !0,
654
654
  title: "Відновлення пароля"
@@ -657,7 +657,7 @@ var X = [
657
657
  {
658
658
  path: "/password/reset/:token",
659
659
  name: "password-reset",
660
- component: () => import("./chunks/reset-CP9LsLkC.js"),
660
+ component: () => import("./chunks/reset-D2uXDfB6.js"),
661
661
  meta: {
662
662
  public: !0,
663
663
  title: "Новий пароль"
@@ -665,7 +665,7 @@ var X = [
665
665
  },
666
666
  {
667
667
  path: "/",
668
- component: /* @__PURE__ */ r(dt, [["render", pt], ["__file", "C:/softpro/surveyor/cabinet/src/layouts/CabinetLayout.vue"]]),
668
+ component: /* @__PURE__ */ r(dt, [["render", pt], ["__file", "D:/Softpro/surveyor/cabinet/src/layouts/CabinetLayout.vue"]]),
669
669
  children: [
670
670
  {
671
671
  path: "",
@@ -674,7 +674,7 @@ var X = [
674
674
  {
675
675
  path: "requests",
676
676
  name: "requests",
677
- component: () => import("./chunks/requests-rWq8ok3C.js"),
677
+ component: () => import("./chunks/requests-Dh5jxF06.js"),
678
678
  meta: {
679
679
  title: "Звернення",
680
680
  label: "Звернення на видачу та прийом матеріалів",
@@ -684,7 +684,7 @@ var X = [
684
684
  {
685
685
  path: "requests/new",
686
686
  name: "request-create",
687
- component: () => import("./chunks/create-DR8tXNYj.js"),
687
+ component: () => import("./chunks/create-DVZv77Uw.js"),
688
688
  meta: {
689
689
  title: "Нове звернення",
690
690
  section: "requests"
@@ -693,7 +693,7 @@ var X = [
693
693
  {
694
694
  path: "requests/:number",
695
695
  name: "request-detail",
696
- component: () => import("./chunks/card-Dlp8_KhV.js"),
696
+ component: () => import("./chunks/card-DL7yHB1C.js"),
697
697
  meta: {
698
698
  title: "Звернення",
699
699
  section: "requests"
@@ -702,7 +702,7 @@ var X = [
702
702
  {
703
703
  path: "profile",
704
704
  name: "profile",
705
- component: () => import("./chunks/profile-CkwMFh82.js"),
705
+ component: () => import("./chunks/profile-BI_RIHN1.js"),
706
706
  meta: {
707
707
  title: "Профайл",
708
708
  label: "Профайл",
@@ -772,7 +772,7 @@ var mt = /*@__PURE__*/ C({
772
772
  function gt(e, t, n, r, i, a) {
773
773
  return O(), v("div", ht, null, 512);
774
774
  }
775
- var _t = /*#__PURE__*/ r(mt, [["render", gt], ["__file", "C:/softpro/surveyor/src/wrappers/CabinetHost.vue"]]), Q = {
775
+ var _t = /*#__PURE__*/ r(mt, [["render", gt], ["__file", "D:/Softpro/surveyor/src/wrappers/CabinetHost.vue"]]), Q = {
776
776
  map: "/map",
777
777
  requests: "/requests",
778
778
  organizations: "/organizations",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/surveyor",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "description": "Surveyor admin and geodesist cabinet UI for embedded host applications",
@@ -1,41 +1,41 @@
1
- import { randomBytes } from "node:crypto";
2
- import type { AppContext, User } from "@opengis/fcore";
3
- import { NotFoundError, hashPassword } from "@opengis/fcore";
4
- import { admin } from "../utils/shared.js";
5
- import { sendAdminPasswordChangedEmail } from "../utils/mail.js";
6
-
7
- /** Змінює пароль зареєстрованого геодезиста адміністратором та повідомляє його листом. */
8
- export async function changeSurveyorPasswordByAdmin(
9
- { id, user, ctx }: {
10
- id: string;
11
- user: User | undefined;
12
- ctx: AppContext;
13
- }
14
- ) {
15
- const uid = admin(user);
16
- const password = randomBytes(16).toString("hex");
17
- const passwordHash = await hashPassword(password);
18
- const surveyor = await ctx.pg.query<{ surveyor_id: string; email: string }>(
19
- `UPDATE surveyor.surveyors
20
- SET password_hash = $2,
21
- password_changed_at = now(),
22
- updated_by = $3,
23
- updated_at = now()
24
- WHERE surveyor_id = $1
25
- AND registered_at IS NOT NULL
26
- RETURNING surveyor_id, email`,
27
- [id, passwordHash, uid]
28
- );
29
- if (!surveyor.rows[0]) {
30
- throw new NotFoundError("Registered surveyor not found");
31
- }
32
- await ctx.audit.write({
33
- module: "surveyor",
34
- resource: "surveyors",
35
- resourceId: id,
36
- action: "changePasswordByAdmin",
37
- userId: uid,
38
- });
39
- await sendAdminPasswordChangedEmail({ email: surveyor.rows[0].email, password });
40
- return { success: true };
41
- }
1
+ import { randomBytes } from "node:crypto";
2
+ import type { AppContext, User } from "@opengis/fcore";
3
+ import { NotFoundError, hashPassword } from "@opengis/fcore";
4
+ import { admin } from "../utils/shared.js";
5
+ import { sendAdminPasswordChangedEmail } from "../utils/mail.js";
6
+
7
+ /** Змінює пароль зареєстрованого геодезиста адміністратором та повідомляє його листом. */
8
+ export async function changeSurveyorPasswordByAdmin(
9
+ { id, user, ctx }: {
10
+ id: string;
11
+ user: User | undefined;
12
+ ctx: AppContext;
13
+ }
14
+ ) {
15
+ const uid = admin(user);
16
+ const password = randomBytes(16).toString("hex");
17
+ const passwordHash = await hashPassword(password);
18
+ const surveyor = await ctx.pg.query<{ surveyor_id: string; email: string }>(
19
+ `UPDATE surveyor.surveyors
20
+ SET password_hash = $2,
21
+ password_changed_at = now(),
22
+ updated_by = $3,
23
+ updated_at = now()
24
+ WHERE surveyor_id = $1
25
+ AND registered_at IS NOT NULL
26
+ RETURNING surveyor_id, email`,
27
+ [id, passwordHash, uid]
28
+ );
29
+ if (!surveyor.rows[0]) {
30
+ throw new NotFoundError("Registered surveyor not found");
31
+ }
32
+ await ctx.audit.write({
33
+ module: "surveyor",
34
+ resource: "surveyors",
35
+ resourceId: id,
36
+ action: "changePasswordByAdmin",
37
+ userId: uid,
38
+ });
39
+ await sendAdminPasswordChangedEmail({ email: surveyor.rows[0].email, password });
40
+ return { success: true };
41
+ }
@@ -8,6 +8,7 @@ import {
8
8
  type Db,
9
9
  } from "../utils/shared.js";
10
10
  import { limit, polygon, type CreateInput } from "../utils/application.js";
11
+ import { certificateStatusSql } from "../utils/certificateStatus.js";
11
12
 
12
13
  /**
13
14
  * Створює заявку після перевірки сертифіката, членства, адреси, площі та перетинів.
@@ -36,9 +37,7 @@ export async function createApplication(
36
37
  WHERE s.surveyor_id = $1
37
38
  AND os.org_id = $2
38
39
  AND os.enabled = true
39
- AND c.certificate_stopping IS NULL
40
- AND c.certificate_suspension IS NULL
41
- AND c.isvalid IS NOT FALSE`,
40
+ AND ${certificateStatusSql("c")} = 'valid'`,
42
41
  [surveyorId, orgId]
43
42
  );
44
43
  if (!profile.rowCount) {
@@ -3,6 +3,7 @@ import { ConflictError, NotFoundError } from "@opengis/fcore";
3
3
  import { admin, type Db } from "../utils/shared.js";
4
4
  import { token, tokenHash } from "../utils/registration.js";
5
5
  import { sendActivationEmail } from "../utils/mail.js";
6
+ import { certificateStatusSql } from "../utils/certificateStatus.js";
6
7
 
7
8
  export type RegisterInput = {
8
9
  organization_id: string;
@@ -38,11 +39,9 @@ export async function registerSurveyor(
38
39
  middle_name: string | null;
39
40
  }>(
40
41
  `SELECT first_name, last_name, middle_name
41
- FROM surveyor.certificates
42
+ FROM surveyor.certificates AS c
42
43
  WHERE certificate_id = $1
43
- AND certificate_stopping IS NULL
44
- AND certificate_suspension IS NULL
45
- AND isvalid IS NOT FALSE`,
44
+ AND ${certificateStatusSql("c")} = 'valid'`,
46
45
  [certId]
47
46
  );
48
47
  if (!cert.rows[0]) {
@@ -38,6 +38,7 @@ export async function requestPasswordReset(
38
38
  await sendPasswordResetEmail({ email: surveyor.email, token: rawToken });
39
39
  } catch (err) {
40
40
  ctx.logger.error({ err, surveyorId: surveyor.surveyor_id }, "Failed to send password reset email");
41
+ throw err;
41
42
  }
42
43
  await ctx.audit.write({
43
44
  module: "surveyor",
@@ -48,6 +48,7 @@ export async function resetSurveyorPassword(
48
48
  await sendPasswordChangedEmail({ email: surveyor.email });
49
49
  } catch (err) {
50
50
  ctx.logger.error({ err, surveyorId: surveyor.surveyor_id }, "Failed to send password changed email");
51
+ throw err;
51
52
  }
52
53
  return { success: true };
53
54
  }
@@ -0,0 +1,15 @@
1
+ export type CertificateStatus = "valid" | "stopped" | "suspended" | "invalid";
2
+
3
+ /**
4
+ * SQL-вираз статусу сертифіката. Порожній рядок у certificate_stopping означає, що дію не припинено.
5
+ * Лише статус `valid` дозволяє реєстрацію геодезиста та подання заяв.
6
+ * @param alias Аліас таблиці surveyor.certificates у запиті.
7
+ */
8
+ export function certificateStatusSql(alias: string) {
9
+ return `CASE
10
+ WHEN nullif(trim(${alias}.certificate_stopping), '') IS NOT NULL THEN 'stopped'
11
+ WHEN ${alias}.certificate_suspension IS NOT NULL THEN 'suspended'
12
+ WHEN ${alias}.isvalid IS FALSE THEN 'invalid'
13
+ ELSE 'valid'
14
+ END`;
15
+ }
@@ -25,29 +25,56 @@ function mailSetting(name: string): string {
25
25
  return value;
26
26
  }
27
27
 
28
- function mailDisabled(): boolean {
29
- return process.env["mail.disable"]?.trim().toLowerCase() === "true";
28
+ function assertMailEnabled(): void {
29
+ if (process.env["mail.disable"]?.trim().toLowerCase() === "true") {
30
+ throw new FCoreError("MAIL_DISABLED", "Email sending is disabled", 503);
31
+ }
30
32
  }
31
33
 
32
34
  function activationLink(token: string): URL {
33
35
  return tokenLink("activation_url", token);
34
36
  }
35
37
 
38
+ function isHttpUrl(url: URL): boolean {
39
+ return ["http:", "https:"].includes(url.protocol) && !url.username && !url.password;
40
+ }
41
+
42
+ /** Домен для посилань, заданих шляхом (`/cabinet/registration/{token}`). */
43
+ function baseUrl(): URL {
44
+ const value = mailSetting("base_url").trim();
45
+ try {
46
+ const url = new URL(value);
47
+ if (!isHttpUrl(url)) {
48
+ throw new Error();
49
+ }
50
+ return url;
51
+ } catch {
52
+ throw new FCoreError("MAIL_NOT_CONFIGURED", "mail.base_url must be an HTTP(S) URL", 500);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Будує посилання з mail.<setting>: повний HTTP(S) URL або шлях від кореня, який доповнюється mail.base_url.
58
+ * Лист потребує абсолютного посилання, тому шлях без mail.base_url вважається помилкою конфігурації.
59
+ */
36
60
  function tokenLink(setting: "activation_url" | "password_reset_url", token: string): URL {
37
61
  const template = mailSetting(setting).trim();
62
+ // "//host/..." — це вже інший домен, тому шляхом вважаємо лише "/..." без другого слеша.
63
+ const isPath = template.startsWith("/") && !template.startsWith("//");
64
+ const base = isPath ? baseUrl() : undefined;
38
65
  try {
39
66
  if (!template.includes("{token}")) {
40
67
  throw new Error();
41
68
  }
42
- const url = new URL(template.replaceAll("{token}", encodeURIComponent(token)));
43
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) {
69
+ const url = new URL(template.replaceAll("{token}", encodeURIComponent(token)), base);
70
+ if (!isHttpUrl(url)) {
44
71
  throw new Error();
45
72
  }
46
73
  return url;
47
74
  } catch {
48
75
  throw new FCoreError(
49
76
  "MAIL_NOT_CONFIGURED",
50
- `mail.${setting} must be an HTTP(S) URL containing {token}`,
77
+ `mail.${setting} must be an HTTP(S) URL or a path starting with / containing {token}`,
51
78
  500
52
79
  );
53
80
  }
@@ -60,7 +87,7 @@ async function sendEmail(
60
87
  template: MailTemplate;
61
88
  data: Record<string, string>;
62
89
  }
63
- ): Promise<boolean> {
90
+ ): Promise<true> {
64
91
  let html: string;
65
92
  try {
66
93
  const source = await readFile(new URL(`./templates/${template}.hbs`, import.meta.url), "utf8");
@@ -76,7 +103,7 @@ async function sendEmail(
76
103
  }
77
104
 
78
105
  const from = mailSetting("from");
79
- const transport = nodemailer.createTransport({
106
+ const options = {
80
107
  service: mailSetting("service").trim(),
81
108
  auth: { user: mailSetting("auth.user"), pass: mailSetting("auth.pass") },
82
109
  requireTLS: true,
@@ -85,29 +112,31 @@ async function sendEmail(
85
112
  socketTimeout: 20_000,
86
113
  logger: false,
87
114
  debug: false,
88
- });
115
+ };
89
116
 
117
+ let transport: ReturnType<typeof nodemailer.createTransport> | undefined;
90
118
  try {
119
+ transport = nodemailer.createTransport(options);
91
120
  const result = await transport.sendMail({ from, to: email, subject, html });
92
- if (!result.accepted.length) {
121
+ if (!result.accepted?.length || result.rejected?.length) {
93
122
  throw new Error();
94
123
  }
95
124
  return true;
96
125
  } catch {
97
126
  throw new FCoreError("MAIL_SEND_FAILED", "Failed to send email", 502);
98
127
  } finally {
99
- transport.close();
128
+ transport?.close();
100
129
  }
101
130
  }
102
131
 
103
132
  /**
104
133
  * Надсилає лист реєстрації зі старого шаблону та одноразовим посиланням активації.
105
- * @returns Чи прийняв поштовий сервер лист; false, якщо mail.disable=true.
134
+ * @returns true, якщо поштовий сервер прийняв лист; інакше викидає помилку.
106
135
  */
107
136
  export async function sendActivationEmail(
108
137
  { email, token }: { email: string; token: string }
109
- ): Promise<boolean> {
110
- if (mailDisabled()) return false;
138
+ ): Promise<true> {
139
+ assertMailEnabled();
111
140
  const url = activationLink(token);
112
141
  return sendEmail({
113
142
  email,
@@ -119,12 +148,12 @@ export async function sendActivationEmail(
119
148
 
120
149
  /**
121
150
  * Надсилає одноразове посилання відновлення пароля (mail.password_reset_url).
122
- * @returns Чи прийняв поштовий сервер лист; false, якщо mail.disable=true.
151
+ * @returns true, якщо поштовий сервер прийняв лист; інакше викидає помилку.
123
152
  */
124
153
  export async function sendPasswordResetEmail(
125
154
  { email, token }: { email: string; token: string }
126
- ): Promise<boolean> {
127
- if (mailDisabled()) return false;
155
+ ): Promise<true> {
156
+ assertMailEnabled();
128
157
  const url = tokenLink("password_reset_url", token);
129
158
  return sendEmail({
130
159
  email,
@@ -135,8 +164,8 @@ export async function sendPasswordResetEmail(
135
164
  }
136
165
 
137
166
  /** Повідомляє геодезиста про зміну пароля через шаблон ds.surveyor_send_mail.pt. */
138
- export async function sendPasswordChangedEmail({ email }: { email: string }): Promise<boolean> {
139
- if (mailDisabled()) return false;
167
+ export async function sendPasswordChangedEmail({ email }: { email: string }): Promise<true> {
168
+ assertMailEnabled();
140
169
  const url = activationLink("");
141
170
  return sendEmail({
142
171
  email,
@@ -149,8 +178,8 @@ export async function sendPasswordChangedEmail({ email }: { email: string }): Pr
149
178
  /** Надсилає логін і згенерований адміністратором пароль. */
150
179
  export async function sendAdminPasswordChangedEmail(
151
180
  { email, password }: { email: string; password: string }
152
- ): Promise<boolean> {
153
- if (mailDisabled()) return false;
181
+ ): Promise<true> {
182
+ assertMailEnabled();
154
183
  const url = activationLink("");
155
184
  return sendEmail({
156
185
  email,