@opengis/surveyor 0.0.0-stage → 0.0.1

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 (138) hide show
  1. package/README.md +46 -3
  2. package/README.npm.md +51 -0
  3. package/dist/chunks/AppIcon-C-4QykTP.js +85 -0
  4. package/dist/chunks/AppealDetailField-DNRGpnyD.js +58 -0
  5. package/dist/chunks/AppealStatusBadge-CefimzY3.js +132 -0
  6. package/dist/chunks/AppealStatusBadge-Cu-UzdzA.js +171 -0
  7. package/dist/chunks/ApplicationHistorySection-PwToBfej.js +769 -0
  8. package/dist/chunks/BaseModal-DrTTkLmR.js +85 -0
  9. package/dist/chunks/FormFilePicker-CKVdZJU9.js +76 -0
  10. package/dist/chunks/MapLayerMenu-AUeTqgEp.js +145 -0
  11. package/dist/chunks/RegistryForm-pvIcFR-V.js +99 -0
  12. package/dist/chunks/RegistryFormModal-BjGu7Upv.js +85 -0
  13. package/dist/chunks/RegistryToolbar-CiUgsjpU.js +452 -0
  14. package/dist/chunks/UserAccessBadge-DyZDv7Oo.js +44 -0
  15. package/dist/chunks/UserTypeBadge-LvnMuKGo.js +188 -0
  16. package/dist/chunks/VerifiedBadge-B6droMOf.js +34 -0
  17. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  18. package/dist/chunks/account-types-Br7gx_D_.js +35 -0
  19. package/dist/chunks/account_types-DLL1w122.js +25 -0
  20. package/dist/chunks/appealMapLayers-CQMK3rrz.js +115 -0
  21. package/dist/chunks/application_status-BhNGiY2I.js +45 -0
  22. package/dist/chunks/applications-CsCsndMV.js +132 -0
  23. package/dist/chunks/buildSchema-nkA4Y0YG.js +37 -0
  24. package/dist/chunks/card--DHsMNBd.js +330 -0
  25. package/dist/chunks/card-9LaB42Ol.js +538 -0
  26. package/dist/chunks/card-BZn5CDw9.js +739 -0
  27. package/dist/chunks/card-CNqXSyqX.js +297 -0
  28. package/dist/chunks/card-CgGOgGyd.js +973 -0
  29. package/dist/chunks/card-DCyBFoDZ.js +607 -0
  30. package/dist/chunks/certificates-DueBDDvc.js +424 -0
  31. package/dist/chunks/create-l28e-bWl.js +1033 -0
  32. package/dist/chunks/filterQuery-B9XNx1f1.js +99 -0
  33. package/dist/chunks/form-CdGS1nVO.js +315 -0
  34. package/dist/chunks/form-QTkkzwbC.js +89 -0
  35. package/dist/chunks/geometry-DyhIVRcw.js +67 -0
  36. package/dist/chunks/map-BW3iOhQg.js +2763 -0
  37. package/dist/chunks/map-layers-qxWjos2V.js +400 -0
  38. package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
  39. package/dist/chunks/organizations-BtuMZ5s_.js +14 -0
  40. package/dist/chunks/organizations-CZOINYMq.js +476 -0
  41. package/dist/chunks/profile-CuxlkEev.js +243 -0
  42. package/dist/chunks/profile-DxZHxGum.js +164 -0
  43. package/dist/chunks/requests-Bt8fEdRc.js +530 -0
  44. package/dist/chunks/requests-DQJIhz00.js +232 -0
  45. package/dist/chunks/resendSurveyorRegistration-DopjOHaM.js +27 -0
  46. package/dist/chunks/resources-Cl_EvaIy.js +129 -0
  47. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist/chunks/surveyorAccount-BceNQypZ.js +78 -0
  49. package/dist/chunks/users-DlaogjC_.js +291 -0
  50. package/dist/chunks/work_types-Hwme-FEX.js +34 -0
  51. package/dist/index.css +3 -0
  52. package/dist/index.js +259 -0
  53. package/migrations/20260924120000_surveyor_schema.sql +450 -0
  54. package/migrations/20261008170000_address_lookup.sql +20 -0
  55. package/migrations/20261016120000_map_layers.sql +156 -0
  56. package/migrations/20261016150000_password_reset.sql +15 -0
  57. package/migrations/20261016170000_address_lookup_format.sql +37 -0
  58. package/migrations/20261016180000_settlement_lookup.sql +16 -0
  59. package/migrations/20261019170000_actor_lookup.sql +15 -0
  60. package/package.json +75 -4
  61. package/plugin.js +10 -0
  62. package/server/app.ts +50 -0
  63. package/server/dictionaries/index.ts +17 -0
  64. package/server/dictionaries/surveyor/account_types.ts +12 -0
  65. package/server/dictionaries/surveyor/application_status.ts +16 -0
  66. package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
  67. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
  68. package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
  69. package/server/dictionaries/surveyor/work_types.ts +15 -0
  70. package/server/dictionaries/surveyor/yes_no.ts +11 -0
  71. package/server/embed.ts +49 -0
  72. package/server/fastify.d.ts +12 -0
  73. package/server/index.ts +23 -0
  74. package/server/modules/surveyor/route.ts +410 -0
  75. package/server/modules/surveyor/schema.ts +439 -0
  76. package/server/modules/surveyor/services/applicationTile.ts +53 -0
  77. package/server/modules/surveyor/services/cancelApplication.ts +74 -0
  78. package/server/modules/surveyor/services/changeSurveyorPassword.ts +52 -0
  79. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -0
  80. package/server/modules/surveyor/services/completeApplication.ts +46 -0
  81. package/server/modules/surveyor/services/completeSurveyorRegistration.ts +48 -0
  82. package/server/modules/surveyor/services/createApplication.ts +169 -0
  83. package/server/modules/surveyor/services/geometryExport.ts +34 -0
  84. package/server/modules/surveyor/services/geometryImport.ts +66 -0
  85. package/server/modules/surveyor/services/getSurveyorUser.ts +56 -0
  86. package/server/modules/surveyor/services/identifyApplications.ts +82 -0
  87. package/server/modules/surveyor/services/issueSourceData.ts +55 -0
  88. package/server/modules/surveyor/services/loginSurveyor.ts +67 -0
  89. package/server/modules/surveyor/services/mapLayers.ts +61 -0
  90. package/server/modules/surveyor/services/rasterExport.ts +15 -0
  91. package/server/modules/surveyor/services/registerSurveyor.ts +161 -0
  92. package/server/modules/surveyor/services/requestPasswordReset.ts +49 -0
  93. package/server/modules/surveyor/services/resendRegistration.ts +42 -0
  94. package/server/modules/surveyor/services/resetSurveyorPassword.ts +53 -0
  95. package/server/modules/surveyor/services/searchApplications.ts +63 -0
  96. package/server/modules/surveyor/services/submitSurvey.ts +70 -0
  97. package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +52 -0
  98. package/server/modules/surveyor/services/updateSurveyorStatus.ts +53 -0
  99. package/server/modules/surveyor/services/vectorExport.ts +86 -0
  100. package/server/modules/surveyor/services/verifyApplication.ts +59 -0
  101. package/server/modules/surveyor/utils/accessibleApplication.ts +37 -0
  102. package/server/modules/surveyor/utils/application.ts +68 -0
  103. package/server/modules/surveyor/utils/export.ts +39 -0
  104. package/server/modules/surveyor/utils/firstBoundary.ts +48 -0
  105. package/server/modules/surveyor/utils/mail.ts +161 -0
  106. package/server/modules/surveyor/utils/permissions.ts +29 -0
  107. package/server/modules/surveyor/utils/registration.ts +33 -0
  108. package/server/modules/surveyor/utils/shared.ts +305 -0
  109. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -0
  110. package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -0
  111. package/server/modules/surveyor/utils/templates/ds.surveyor_registration.pt.hbs +80 -0
  112. package/server/modules/surveyor/utils/templates/ds.surveyor_send_mail.pt.hbs +79 -0
  113. package/server/modules/surveyor/utils/vectorLayer.ts +41 -0
  114. package/server/plugins/convertVector.ts +74 -0
  115. package/server/plugins/proto/convertVector.proto +21 -0
  116. package/server/plugins/swagger.ts +54 -0
  117. package/server/plugins/vite.dev.ts +52 -0
  118. package/server/plugins/vite.prod.ts +55 -0
  119. package/server/resources/helpers/actor_lookup.ts +5 -0
  120. package/server/resources/helpers/address_lookup.ts +8 -0
  121. package/server/resources/helpers/settlement_lookup.ts +7 -0
  122. package/server/resources/helpers/user_lookup.ts +5 -0
  123. package/server/resources/index.ts +30 -0
  124. package/server/resources/surveyor-admin/application_comments.ts +24 -0
  125. package/server/resources/surveyor-admin/application_status_history.ts +46 -0
  126. package/server/resources/surveyor-admin/applications.ts +125 -0
  127. package/server/resources/surveyor-admin/certificates.ts +87 -0
  128. package/server/resources/surveyor-admin/map_layers.ts +69 -0
  129. package/server/resources/surveyor-admin/organization_surveyors.ts +32 -0
  130. package/server/resources/surveyor-admin/organizations.ts +61 -0
  131. package/server/resources/surveyor-admin/surveyors.ts +71 -0
  132. package/server/resources/surveyor-user/application_status_history.ts +52 -0
  133. package/server/resources/surveyor-user/applications.ts +131 -0
  134. package/server/resources/surveyor-user/certificates.ts +67 -0
  135. package/server/resources/surveyor-user/organizations.ts +40 -0
  136. package/server/resources/surveyor-user/surveyors.ts +69 -0
  137. package/server/tsconfig.json +3 -0
  138. package/surveyor-types.d.ts +30 -0
@@ -0,0 +1,16 @@
1
+ -- Settlement lookup labels with the settlement type: "м. Львів", "с. Лисиничі".
2
+ CREATE OR REPLACE VIEW surveyor.settlement_lookup AS
3
+ SELECT
4
+ settlement.katottg,
5
+ settlement.level,
6
+ concat_ws(' ',
7
+ CASE settlement.type
8
+ WHEN 201 THEN 'м.'
9
+ WHEN 501 THEN 'м.'
10
+ WHEN 503 THEN 'смт'
11
+ WHEN 504 THEN 'с.'
12
+ WHEN 505 THEN 'с-ще'
13
+ END,
14
+ trim(settlement.name)
15
+ ) AS settlement_text
16
+ FROM data_address.atu AS settlement;
@@ -0,0 +1,15 @@
1
+ -- Shared lookup for actions performed by administrators and surveyors.
2
+ -- Actor IDs must identify the same person unambiguously across both tables.
3
+ CREATE OR REPLACE VIEW surveyor.actor_lookup AS
4
+ SELECT uid AS actor_id, login AS actor_text
5
+ FROM admin.users
6
+
7
+ UNION ALL
8
+
9
+ SELECT
10
+ surveyor_id AS actor_id,
11
+ COALESCE(
12
+ NULLIF(trim(concat_ws(' ', last_name, first_name, middle_name)), ''),
13
+ email
14
+ ) AS actor_text
15
+ FROM surveyor.surveyors;
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
1
  {
2
2
  "name": "@opengis/surveyor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "author": "Softpro",
6
+ "description": "Surveyor admin and geodesist cabinet UI for embedded host applications",
7
+ "main": "./dist/index.js",
8
+ "types": "./surveyor-types.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./surveyor-types.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./style.css": "./dist/index.css",
15
+ "./plugin.js": "./plugin.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "plugin.js",
20
+ "server",
21
+ "migrations",
22
+ "README.npm.md",
23
+ "surveyor-types.d.ts"
24
+ ],
25
+ "scripts": {
26
+ "build:lib": "vite build --config vite.lib.config.ts",
27
+ "build:admin": "vue-tsc --noEmit -p admin/tsconfig.json && vite build --config admin/vite.config.ts",
28
+ "build:cabinet": "vue-tsc --noEmit -p cabinet/tsconfig.json && vite build --config cabinet/vite.config.ts",
29
+ "build": "bun run build:lib && bun run build:admin && bun run build:cabinet",
30
+ "prepublishOnly": "bun run build:lib",
31
+ "start": "bun server/index.ts",
32
+ "admin": "bun server/index.ts --admin",
33
+ "cabinet": "bun server/index.ts --cabinet",
34
+ "prod": "bun server/index.ts --production",
35
+ "prod:cabinet": "bun server/index.ts --production --cabinet",
36
+ "server:typecheck": "bunx tsc --noEmit -p tsconfig.server.json",
37
+ "migrate": "bunx fcore-migrate"
38
+ },
39
+ "peerDependencies": {
40
+ "@opengis/core": "^0.0.37",
41
+ "@opengis/filter": "^0.1.59",
42
+ "@opengis/form": "^0.1.32",
43
+ "vue": "^3.5.0",
44
+ "vue-router": "^4.6.0",
45
+ "lucide-vue-next": "^0.446.0"
46
+ },
47
+ "dependencies": {
48
+ "@fastify/static": "9.3.0",
49
+ "@fastify/swagger": "9.9.0",
50
+ "@grpc/grpc-js": "1.14.5",
51
+ "@grpc/proto-loader": "0.8.1",
52
+ "@opengis/fcore": "^0.0.38",
53
+ "fastify": "^5.12.3",
54
+ "fastify-plugin": "^5.0.1",
55
+ "nodemailer": "^10.0.12"
56
+ },
57
+ "devDependencies": {
58
+ "@opengis/core": "^0.0.37",
59
+ "@opengis/filter": "^0.1.59",
60
+ "@opengis/form": "^0.1.32",
61
+ "@tailwindcss/vite": "^4.3.3",
62
+ "@types/node": "^26.4.1",
63
+ "@vitejs/plugin-vue": "^6.0.1",
64
+ "@vue/tsconfig": "^0.8.1",
65
+ "lucide-vue-next": "0.446.0",
66
+ "tailwindcss": "^4.3.3",
67
+ "typescript": "~6.0.2",
68
+ "vite": "^8.2.2",
69
+ "vue": "^3.5.22",
70
+ "vue-router": "^4.6.4",
71
+ "vue-tsc": "^3.0.8"
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://git.softpro.ua/product/surveyor.git"
76
+ }
77
+ }
package/plugin.js ADDED
@@ -0,0 +1,10 @@
1
+ import fp from 'fastify-plugin'
2
+
3
+ /**
4
+ * Fastify plugin: Surveyor API (fcore resources + surveyor routes).
5
+ * Requires Bun or a runtime that resolves TypeScript in ./server/embed.ts.
6
+ */
7
+ export default fp(async function surveyorPlugin(app, opts = {}) {
8
+ const { registerSurveyorBackend } = await import('./server/embed.ts')
9
+ await registerSurveyorBackend(app, opts)
10
+ })
package/server/app.ts ADDED
@@ -0,0 +1,50 @@
1
+ import Fastify from 'fastify';
2
+ import { createFCore, type AppContext } from '@opengis/fcore';
3
+ //import { createFCore, type AppContext } from '../../../npm/fcore/src/index.js';
4
+
5
+ import fcoreFastify from '@opengis/fcore/fastify';
6
+ //import fcoreFastify from '../../../npm/fcore/src/fastify.js';
7
+
8
+ import dictionaries from './dictionaries/index.js';
9
+ import resources from './resources/index.js';
10
+ import { createSurveyorRoutes } from './modules/surveyor/route.js';
11
+ import { afterSurveyorUser } from './modules/surveyor/utils/permissions.js';
12
+ import { registerSwaggerPlugin, registerSwaggerRoutes } from "./plugins/swagger.js";
13
+ import viteDevPlugin from './plugins/vite.dev.js';
14
+ import viteProdPlugin from './plugins/vite.prod.js';
15
+
16
+ export default async function createApp() {
17
+ const ctx = await createFCore({ resources, dictionaries, hooks: { afterUser: afterSurveyorUser } }) as AppContext;
18
+ const app = Fastify({
19
+ loggerInstance: ctx.logger,
20
+ routerOptions: { maxParamLength: 2048 },
21
+ });
22
+
23
+ // Swagger must observe routes as they are registered.
24
+ await registerSwaggerPlugin(app);
25
+
26
+ // Invoke both plugins on this instance so FCore's authentication and access hooks
27
+ // also protect application-specific business routes.
28
+ await fcoreFastify(ctx)(app as any, {});
29
+ await createSurveyorRoutes(ctx)(app as any, {});
30
+
31
+ // Register documentation after FCore installs its route access hooks.
32
+ registerSwaggerRoutes(app);
33
+
34
+ const env = process.env.NODE_ENV?.toLowerCase() || 'production';
35
+
36
+ if (env === 'production') {
37
+ await viteProdPlugin(app, 'admin', '/admin/', ['admin']); // part, base, user_type
38
+ await viteProdPlugin(app, 'cabinet');
39
+ } else if(['admin', 'cabinet'].includes(env)){
40
+ await viteDevPlugin(app, env);
41
+ }
42
+
43
+ //await viteProdPlugin(app);
44
+
45
+ app.addHook('onClose', async () => {
46
+ await ctx.close();
47
+ });
48
+
49
+ return app;
50
+ }
@@ -0,0 +1,17 @@
1
+ import applicationStatus from "./surveyor/application_status.js";
2
+ import workTypes from "./surveyor/work_types.js";
3
+ import accountTypes from "./surveyor/account_types.js";
4
+ import yesNo from "./surveyor/yes_no.js";
5
+ import mapLayerGroups from "./surveyor/map_layer_groups.js";
6
+ import mapLayerTypes from "./surveyor/map_layer_types.js";
7
+ import mapLayerComponents from "./surveyor/map_layer_components.js";
8
+
9
+ export default [
10
+ applicationStatus,
11
+ workTypes,
12
+ accountTypes,
13
+ yesNo,
14
+ mapLayerGroups,
15
+ mapLayerTypes,
16
+ mapLayerComponents,
17
+ ];
@@ -0,0 +1,12 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "account-types",
5
+ name: "Типи сертифікатів",
6
+ checked: true,
7
+ items: [
8
+ { code: "1", name: "Реєстр геодезистів", color: "#32a852" },
9
+ { code: "2", name: "Реєстр землевпорядників", color: "#570b99" },
10
+ { code: "3", name: "Реєстр інженерів-проектувальників", color: "#453ec9" },
11
+ ],
12
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,16 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "application-status",
5
+ name: "Статуси заявок",
6
+ checked: true,
7
+ items: [
8
+ { code: "awaitingData", name: "На видачу вихідних даних", color: "#979da6" },
9
+ { code: "dataIssued", name: "Видано вихідні дані", color: "#ed8c15" },
10
+ { code: "reserve", name: "Резерв", color: "#800000" },
11
+ { code: "underReview", name: "На перевірці", color: "#861aeb" },
12
+ { code: "verified", name: "Перевірено", color: "#3687e3" },
13
+ { code: "completed", name: "Внесено в ЄЦТО", color: "#03800b" },
14
+ { code: "cancelled", name: "Скасовано", color: "#ff0000" },
15
+ ],
16
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-components",
5
+ name: "Компоненти карти",
6
+ items: [
7
+ { code: "map", name: "Карта" },
8
+ { code: "application-form", name: "Форма окреслення геометрії заявки" },
9
+ { code: "application-card", name: "Картка заявки" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,10 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-groups",
5
+ name: "Групи шарів карти",
6
+ items: [
7
+ { code: "base", name: "Базовий шар" },
8
+ { code: "overlay", name: "Додатковий шар" },
9
+ ],
10
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-types",
5
+ name: "Типи шарів карти",
6
+ items: [
7
+ { code: "raster", name: "Растрові тайли" },
8
+ { code: "vector", name: "Векторні тайли" },
9
+ { code: "applications", name: "Заявки" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,15 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "work-types",
5
+ name: "Види робіт",
6
+ checked: true,
7
+ items: [
8
+ { code: "1", name: "Топографічне знімання" },
9
+ { code: "2", name: "Інший вид робіт" },
10
+ { code: "3", name: "Інженерні вишукування" },
11
+ { code: "6", name: "Виконавче знімання" },
12
+ { code: "8", name: "Топографо-геодезичне знімання" },
13
+ { code: "9", name: "План земельної ділянки" },
14
+ ],
15
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "yes-no",
5
+ name: "Так або ні",
6
+ checked: true,
7
+ items: [
8
+ { code: "true", name: "Так", color: "green" },
9
+ { code: "false", name: "Ні", color: "red" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,49 @@
1
+ import type { FastifyInstance } from 'fastify'
2
+ import { createFCore, type AppContext } from '@opengis/fcore'
3
+ import fcoreFastify from '@opengis/fcore/fastify'
4
+
5
+ import dictionaries from './dictionaries/index.js'
6
+ import resources from './resources/index.js'
7
+ import { createSurveyorRoutes } from './modules/surveyor/route.js'
8
+ import { afterSurveyorUser } from './modules/surveyor/utils/permissions.js'
9
+
10
+ export interface RegisterSurveyorBackendOptions {
11
+ fcore?: Record<string, unknown>
12
+ }
13
+
14
+ declare module 'fastify' {
15
+ interface FastifyInstance {
16
+ surveyorCtx?: AppContext
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Registers Surveyor fcore resources and business routes on an existing Fastify app.
22
+ * Does not mount admin/cabinet Vite static assets.
23
+ */
24
+ export async function registerSurveyorBackend(
25
+ app: FastifyInstance,
26
+ opts: RegisterSurveyorBackendOptions = {},
27
+ ): Promise<AppContext> {
28
+ if (app.surveyorCtx) {
29
+ return app.surveyorCtx
30
+ }
31
+
32
+ const ctx = await createFCore({
33
+ resources,
34
+ dictionaries,
35
+ hooks: { afterUser: afterSurveyorUser },
36
+ ...opts.fcore,
37
+ }) as AppContext
38
+
39
+ await fcoreFastify(ctx)(app as any, {})
40
+ await createSurveyorRoutes(ctx)(app as any, {})
41
+
42
+ app.surveyorCtx = ctx
43
+
44
+ app.addHook('onClose', async () => {
45
+ await ctx.close()
46
+ })
47
+
48
+ return ctx
49
+ }
@@ -0,0 +1,12 @@
1
+ import type { User } from '@opengis/fcore';
2
+
3
+ declare module 'fastify' {
4
+ interface FastifySchema {
5
+ access?: 'public' | 'user' | 'admin';
6
+ permissions?: string[];
7
+ tags?: string[];
8
+ }
9
+ interface FastifyRequest {
10
+ user?: User;
11
+ }
12
+ }
@@ -0,0 +1,23 @@
1
+ import createApp from './app.js';
2
+
3
+ if (process.argv.includes('--admin')) process.env.NODE_ENV = 'admin';
4
+ else if (process.argv.includes('--cabinet')) process.env.NODE_ENV = 'cabinet';
5
+ else if (process.argv.includes('--production')) process.env.NODE_ENV = 'production';
6
+
7
+ const app = await createApp();
8
+ const port = Number(process.env.PORT ?? 3000);
9
+
10
+ const shutdown = async () => {
11
+ await app.close();
12
+ };
13
+
14
+ process.once('SIGINT', shutdown);
15
+ process.once('SIGTERM', shutdown);
16
+
17
+ try {
18
+ await app.listen({ host: '0.0.0.0', port });
19
+ app.log.info(`Server started listening on port ${port}`);
20
+ } catch (error) {
21
+ app.log.error(error);
22
+ process.exit(1);
23
+ }