@opengis/surveyor 0.0.1 → 0.0.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +175 -33
  3. package/dist/chunks/{AppIcon-C-4QykTP.js → AppIcon-CIR6y5uE.js} +1 -1
  4. package/dist/chunks/{AppealDetailField-DNRGpnyD.js → AppealDetailField-CI-1qhs3.js} +2 -2
  5. package/dist/chunks/{AppealStatusBadge-CefimzY3.js → AppealStatusBadge-CSXnfarR.js} +2 -2
  6. package/dist/chunks/{AppealStatusBadge-Cu-UzdzA.js → AppealStatusBadge-DYBe9hqP.js} +1 -1
  7. package/dist/chunks/{ApplicationHistorySection-PwToBfej.js → ApplicationHistorySection-C0wwhwA4.js} +4 -4
  8. package/dist/chunks/{BaseModal-DrTTkLmR.js → BaseModal-C7PVYz0m.js} +1 -1
  9. package/dist/chunks/{FormFilePicker-CKVdZJU9.js → FormFilePicker-C3XQw50i.js} +2 -2
  10. package/dist/chunks/{MapLayerMenu-AUeTqgEp.js → MapLayerMenu-DjYCxEc3.js} +1 -1
  11. package/dist/chunks/{RegistryForm-pvIcFR-V.js → RegistryForm-CEUqFmsF.js} +2 -2
  12. package/dist/chunks/{RegistryFormModal-BjGu7Upv.js → RegistryFormModal-DfY4z_7r.js} +3 -3
  13. package/dist/chunks/{RegistryToolbar-CiUgsjpU.js → RegistryToolbar-BV4mYVAc.js} +8 -8
  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-B6droMOf.js → VerifiedBadge-Bba8WnuB.js} +2 -2
  17. package/dist/chunks/{applications-CsCsndMV.js → applications-BB9JRcgl.js} +1 -1
  18. package/dist/chunks/{buildSchema-nkA4Y0YG.js → buildSchema-CccjX9TJ.js} +1 -1
  19. package/dist/chunks/{card-BZn5CDw9.js → card-B-ftozcq.js} +12 -12
  20. package/dist/chunks/{card-9LaB42Ol.js → card-BctFHFZe.js} +7 -7
  21. package/dist/chunks/{card--DHsMNBd.js → card-CKD1N0QD.js} +6 -6
  22. package/dist/chunks/{card-CNqXSyqX.js → card-CiNZxAd5.js} +8 -8
  23. package/dist/chunks/{card-DCyBFoDZ.js → card-DUtDfwMk.js} +6 -6
  24. package/dist/chunks/card-fL26_Gvc.js +1189 -0
  25. package/dist/chunks/{certificates-DueBDDvc.js → certificates-BSd1i0un.js} +7 -7
  26. package/dist/chunks/{create-l28e-bWl.js → create-DxMC_IL1.js} +10 -10
  27. package/dist/chunks/{filterQuery-B9XNx1f1.js → filterQuery-CvfZrkTC.js} +1 -1
  28. package/dist/chunks/{form-CdGS1nVO.js → form-Bh6i5n1U.js} +1 -1
  29. package/dist/chunks/{form-QTkkzwbC.js → form-DDjELqZ9.js} +1 -1
  30. package/dist/chunks/{map-BW3iOhQg.js → map-Z57iMvFb.js} +11 -11
  31. package/dist/chunks/{map-layers-qxWjos2V.js → map-layers-DnmkOEld.js} +7 -7
  32. package/dist/chunks/{organizations-CZOINYMq.js → organizations-BO1_JETm.js} +8 -8
  33. package/dist/chunks/{organizations-BtuMZ5s_.js → organizations-BbYipLwk.js} +1 -1
  34. package/dist/chunks/{profile-DxZHxGum.js → profile-ByahbF4B.js} +1 -1
  35. package/dist/chunks/{profile-CuxlkEev.js → profile-Dwwn_4Pr.js} +3 -3
  36. package/dist/chunks/{requests-DQJIhz00.js → requests-BCin936Z.js} +6 -6
  37. package/dist/chunks/{requests-Bt8fEdRc.js → requests-CFv5wwAN.js} +7 -7
  38. package/dist/chunks/{resendSurveyorRegistration-DopjOHaM.js → resendSurveyorRegistration-BHTTVIw1.js} +1 -1
  39. package/dist/chunks/{resources-Cl_EvaIy.js → resources-2e8RFqWR.js} +1 -1
  40. package/dist/chunks/{surveyorAccount-BceNQypZ.js → surveyorAccount-C7UiiIYg.js} +1 -1
  41. package/dist/chunks/{users-DlaogjC_.js → users-DtTYsgMb.js} +8 -8
  42. package/dist/index.css +1 -1
  43. package/dist/index.js +165 -88
  44. package/package.json +86 -77
  45. package/plugin.d.ts +15 -0
  46. package/plugin.js +8 -10
  47. package/server/app.ts +2 -1
  48. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -41
  49. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -79
  50. package/server/resources/surveyor-admin/application_comments.ts +3 -3
  51. package/server/suggests/index.ts +17 -0
  52. package/README.npm.md +0 -51
  53. package/dist/chunks/card-CgGOgGyd.js +0 -973
  54. package/server/embed.ts +0 -49
@@ -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
+ }
@@ -1,79 +1,79 @@
1
- <!DOCTYPE html>
2
- <html lang="uk">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Пароль змінено</title>
8
- <style>
9
- body {
10
- font-family: Arial, sans-serif;
11
- color: #333;
12
- background-color: #f4f4f4;
13
- padding: 20px;
14
- }
15
-
16
- .email-container {
17
- max-width: 600px;
18
- margin: 0 auto;
19
- background-color: #ffffff;
20
- padding: 20px;
21
- border-radius: 5px;
22
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
23
- }
24
-
25
- h1 {
26
- font-size: 20px;
27
- color: #000;
28
- margin-bottom: 20px;
29
- }
30
-
31
- p {
32
- line-height: 1.6;
33
- margin: 10px 0;
34
- }
35
-
36
- .credentials {
37
- font-weight: bold;
38
- margin-top: 10px;
39
- }
40
-
41
- a {
42
- color: #007bff;
43
- text-decoration: none;
44
- }
45
-
46
- a:hover {
47
- text-decoration: underline;
48
- }
49
-
50
- .footer {
51
- font-size: 12px;
52
- color: #777;
53
- margin-top: 20px;
54
- text-align: center;
55
- }
56
- </style>
57
- </head>
58
-
59
- <body>
60
- <div class="email-container">
61
- <h1>Адміністратор порталу змінив Вам пароль до
62
- <a target="_blank" href="{{protocol}}://{{host}}">кабінету геодезиста</a>
63
- </h1>
64
- <p class="credentials">
65
- Логін: <strong>{{login}}</strong><br>
66
- Пароль: <strong>{{password}}</strong>
67
- </p>
68
- <p>
69
- Ви можете увійти на сайт, натиснувши на цьому посиланні або скопіювавши його в адресний рядок вашого
70
- браузера:<br>
71
- <a target="_blank" href="{{protocol}}://{{host}}">{{protocol}}://{{host}}</a>
72
- </p>
73
- <div class="footer">
74
- Це автоматично створений лист, будь ласка, не відповідайте на нього.
75
- </div>
76
- </div>
77
- </body>
78
-
79
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="uk">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Пароль змінено</title>
8
+ <style>
9
+ body {
10
+ font-family: Arial, sans-serif;
11
+ color: #333;
12
+ background-color: #f4f4f4;
13
+ padding: 20px;
14
+ }
15
+
16
+ .email-container {
17
+ max-width: 600px;
18
+ margin: 0 auto;
19
+ background-color: #ffffff;
20
+ padding: 20px;
21
+ border-radius: 5px;
22
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
23
+ }
24
+
25
+ h1 {
26
+ font-size: 20px;
27
+ color: #000;
28
+ margin-bottom: 20px;
29
+ }
30
+
31
+ p {
32
+ line-height: 1.6;
33
+ margin: 10px 0;
34
+ }
35
+
36
+ .credentials {
37
+ font-weight: bold;
38
+ margin-top: 10px;
39
+ }
40
+
41
+ a {
42
+ color: #007bff;
43
+ text-decoration: none;
44
+ }
45
+
46
+ a:hover {
47
+ text-decoration: underline;
48
+ }
49
+
50
+ .footer {
51
+ font-size: 12px;
52
+ color: #777;
53
+ margin-top: 20px;
54
+ text-align: center;
55
+ }
56
+ </style>
57
+ </head>
58
+
59
+ <body>
60
+ <div class="email-container">
61
+ <h1>Адміністратор порталу змінив Вам пароль до
62
+ <a target="_blank" href="{{protocol}}://{{host}}">кабінету геодезиста</a>
63
+ </h1>
64
+ <p class="credentials">
65
+ Логін: <strong>{{login}}</strong><br>
66
+ Пароль: <strong>{{password}}</strong>
67
+ </p>
68
+ <p>
69
+ Ви можете увійти на сайт, натиснувши на цьому посиланні або скопіювавши його в адресний рядок вашого
70
+ браузера:<br>
71
+ <a target="_blank" href="{{protocol}}://{{host}}">{{protocol}}://{{host}}</a>
72
+ </p>
73
+ <div class="footer">
74
+ Це автоматично створений лист, будь ласка, не відповідайте на нього.
75
+ </div>
76
+ </div>
77
+ </body>
78
+
79
+ </html>
@@ -1,5 +1,5 @@
1
1
  import type { ResourceContract } from "@opengis/fcore";
2
- import { userLookup } from "../helpers/user_lookup.js";
2
+ import { actorLookup } from "../helpers/actor_lookup.js";
3
3
 
4
4
  // Internal read-only target for application relations; direct CRUD is disabled.
5
5
  export default {
@@ -16,9 +16,9 @@ export default {
16
16
  resource: { type: "string", read: true, write: false },
17
17
  resource_id: { type: "text", read: true, write: false },
18
18
  body: { type: "text", read: true, write: false },
19
- created_by: { type: "string", read: true, write: false, lookup: userLookup },
19
+ created_by: { type: "string", read: true, write: false, lookup: actorLookup },
20
20
  created_at: { type: "timestamp", read: true, write: false },
21
- updated_by: { type: "string", read: true, write: false, lookup: userLookup },
21
+ updated_by: { type: "string", read: true, write: false, lookup: actorLookup },
22
22
  updated_at: { type: "timestamp", read: true, write: false },
23
23
  },
24
24
  } satisfies ResourceContract;
@@ -0,0 +1,17 @@
1
+ import type { SuggestContract } from "@opengis/fcore";
2
+
3
+ const suggests: SuggestContract[] = [
4
+ {
5
+ name: "gis-layers",
6
+ module: "admin",
7
+ key: "id",
8
+ query: `
9
+ SELECT style_id as id, style_name as text FROM gis.style
10
+ WHERE style_name ILIKE '%' || :search || '%'
11
+ union all
12
+ SELECT dataset_id as id, dataset_name as text FROM gis.dataset
13
+ WHERE dataset_name ILIKE '%' || :search || '%'
14
+ `,
15
+ }
16
+ ];
17
+ export default suggests;
package/README.npm.md DELETED
@@ -1,51 +0,0 @@
1
- # @opengis/surveyor
2
-
3
- Embedded Surveyor UI (admin registries, map, geodesist cabinet) and Fastify backend plugin.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm i @opengis/surveyor
9
- ```
10
-
11
- Peers: `vue`, `vue-router`, `lucide-vue-next`, `@opengis/core`, `@opengis/form`, `@opengis/filter`.
12
-
13
- Screen components load their pages via `defineAsyncComponent` (separate chunks under `dist/chunks/`), similar to `@opengis/gis`.
14
-
15
- ## Host frontend
16
-
17
- ```js
18
- import '@opengis/core/dist/index.css'
19
- import '@opengis/form/dist/index.css'
20
- import '@opengis/surveyor/style.css'
21
- import v3Core from '@opengis/core'
22
- import { createSurveyorPlugin } from '@opengis/surveyor'
23
-
24
- app.use(v3Core)
25
- app.use(createSurveyorPlugin())
26
- ```
27
-
28
- ### Routes (example)
29
-
30
- ```js
31
- export default [
32
- { path: '/srv-map', component: () => import('@opengis/surveyor').then((m) => m.Map) },
33
- { path: '/srv-requests/:number?', component: () => import('@opengis/surveyor').then((m) => m.Requests) },
34
- { path: '/srv-organisations/:id?', component: () => import('@opengis/surveyor').then((m) => m.Organisations) },
35
- { path: '/srv-certificates/:id?', component: () => import('@opengis/surveyor').then((m) => m.Certificates) },
36
- { path: '/srv-users/:id?', component: () => import('@opengis/surveyor').then((m) => m.Users) },
37
- { path: '/srv-map-layers/:id?', component: () => import('@opengis/surveyor').then((m) => m.MapLayers) },
38
- { path: '/surveyor-cabinet/requests/:segment?', component: () => import('@opengis/surveyor').then((m) => m.CabinetRequests) },
39
- { path: '/surveyor-cabinet/profile', component: () => import('@opengis/surveyor').then((m) => m.CabinetProfile) },
40
- ]
41
- ```
42
-
43
- Internal links in pages still use standalone paths (`/organizations`, `/requests`, …). For custom prefixes, mount host routes at the same paths or extend path injection in a future release.
44
-
45
- ## Host backend (Bun)
46
-
47
- ```js
48
- await fastify.register(import('@opengis/surveyor/plugin.js'), {})
49
- ```
50
-
51
- Run migrations from this package (`migrations/`) via your fcore migrate workflow.