@opengis/gis 0.2.167 → 0.2.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CardIcon-golqfa-Y.js → CardIcon-xkRDr3_E.js} +1 -1
- package/dist/{EntityTablePage-BhmxePgR.js → EntityTablePage-D1IR5Bmq.js} +1 -1
- package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BFa27smR.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BJKIgAkD.js} +1 -1
- package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-Dp0MjgnU.js → HeaderActions.vue_vue_type_script_setup_true_lang-BU8__ouG.js} +1 -1
- package/dist/{MapSettings-F_DT3xKl.js → MapSettings-DIOlNpt6.js} +1 -1
- package/dist/{RastersTablePage-3rXQ0baG.js → RastersTablePage-OD1VqHP8.js} +1 -1
- package/dist/{cartocss-CN-UrS7V.js → cartocss-BiamDcNB.js} +5 -5
- package/dist/{import-utils-F5ErbNz1.js → import-utils-CvUG1jV0.js} +1 -1
- package/dist/{index-CdB0VXro.js → index-C6W8IkTm.js} +1224 -1221
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +53 -40
- package/dist/{raster-DWmiWlf7.js → raster-BbIiZGoX.js} +3 -3
- package/dist/{register-D1jLD0hK.js → register-Dt2QoLZ3.js} +3 -3
- package/dist/service-CdUYntMi.js +3472 -0
- package/dist/{vs-datatable-BWItxbtK.js → vs-datatable-BELnJrfM.js} +2 -3
- package/module/gis/card/gis.metadata.table/index.yml +22 -22
- package/module/gis/card/gis.rasters.table/index.yml +11 -11
- package/module/gis/card/gis.registers.table/index.yml +23 -23
- package/module/gis/card/gis.services.table/index.yml +25 -25
- package/module/gis/cls/bool.yes_no.json +12 -12
- package/module/gis/cls/encoding.json +14 -14
- package/module/gis/cls/geom_type.json +14 -14
- package/module/gis/cls/gis.column_type.json +34 -34
- package/module/gis/cls/gis.column_view_type.json +26 -26
- package/module/gis/cls/gis.filter_type.json +22 -22
- package/module/gis/cls/language.json +10 -10
- package/module/gis/cls/meta.service_type.json +42 -42
- package/module/gis/cls/ogc.service.json +21 -21
- package/module/gis/cls/source_type.json +10 -10
- package/module/gis/cls/standarts.json +6 -6
- package/module/gis/cls/topic_category.json +106 -106
- package/module/gis/cls/update_frequency.json +29 -29
- package/module/gis/cls/view.json +21 -21
- package/module/gis/form/feedback.answer.form.json +10 -10
- package/module/gis/form/gis.cartocss.form.json +64 -64
- package/module/gis/form/gis.group_list.form.json +17 -17
- package/module/gis/form/gis.maps.form.json +61 -61
- package/module/gis/form/gis.metadata.form.json +240 -240
- package/module/gis/form/gis.metadata_new.form.json +195 -195
- package/module/gis/form/gis.ogc_service.form.json +51 -51
- package/module/gis/form/gis.rasters.form.json +76 -76
- package/module/gis/form/gis.registers.form.json +124 -124
- package/module/gis/form/gis.registers_column.form.json +84 -84
- package/module/gis/form/gis.registers_filter.form.json +65 -65
- package/module/gis/form/gis.services.form.json +111 -111
- package/module/gis/form/gis.services_attributes.form.json +75 -75
- package/module/gis/form/gis.services_filter.form.json +65 -65
- package/module/gis/menu.json +43 -43
- package/module/gis/select/admin.cls.name.sql +9 -9
- package/module/gis/select/layer_list.sql +7 -7
- package/module/gis/select/layer_list_text.sql +7 -7
- package/module/gis/select/pg.column_name.geometry.sql +12 -12
- package/module/gis/select/pg.columns.parent.sql +6 -6
- package/module/gis/select/pg.table_name.sql +17 -17
- package/module/gis/select/service_id.sql +1 -1
- package/module/gis/select/srid.sql +7 -7
- package/module/gis/table/gis.cartocss.table.json +74 -74
- package/module/gis/table/gis.group_list.table.json +58 -58
- package/module/gis/table/gis.maps.table.json +110 -110
- package/module/gis/table/gis.metadata.table.json +70 -70
- package/module/gis/table/gis.metadata_new.table.json +137 -137
- package/module/gis/table/gis.ogc_service.table.json +100 -100
- package/module/gis/table/gis.rasters.table.json +113 -113
- package/module/gis/table/gis.registers.table.json +143 -143
- package/module/gis/table/gis.services.table.json +120 -120
- package/module/gis/table/site.gis.registers.table.json +88 -88
- package/module/gis/table/site.gis.services.table.json +106 -106
- package/module/gis/templates/ISO19136_2017_gml_template.xml +330 -330
- package/module/gis/tokens.yml +5 -5
- package/module/permissions/form/permissions.users.form.json +151 -151
- package/module/permissions/table/gis.permissions.table.json +97 -97
- package/module/test/map/addr.json +303 -0
- package/module/test/map/{addr.yml → addr1.yml} +3 -1
- package/module/test/select/address.str_id.sql +3 -0
- package/package.json +10 -10
- package/plugin.js +21 -12
- package/server/plugins/mapnik/funcs/checkRasterFile.js +1 -3
- package/server/routes/cartocss/cartocss.route.js +31 -0
- package/server/routes/cartocss/cartocss.route.test.js +79 -0
- package/server/routes/cartocss/cartocss.schema.js +73 -0
- package/server/routes/{gis/cartocss → cartocss/functions}/add.cartocss.js +8 -11
- package/server/routes/{gis/cartocss → cartocss/functions}/get.cartocss.js +11 -13
- package/server/routes/gis/functions/checkXML.js +107 -0
- package/server/routes/gis/functions/dashboard.js +24 -0
- package/server/routes/gis/gis.route.js +26 -0
- package/server/routes/gis/gis.route.test.js +34 -0
- package/server/routes/gis/gis.schema.js +1 -0
- package/server/routes/map/{controllers → functions}/clearTiles.js +9 -8
- package/server/routes/map/{controllers → functions}/geojson.js +43 -43
- package/server/routes/map/{controllers → functions}/gis.convert.js +15 -23
- package/server/routes/map/{controllers → functions}/gis.icon.js +23 -10
- package/server/routes/map/{controllers → functions}/jsonData.js +72 -71
- package/server/routes/map/{controllers → functions}/layerList.js +17 -17
- package/server/routes/map/{controllers → functions}/map.js +8 -9
- package/server/routes/map/{controllers → functions}/mapCatalog.js +7 -7
- package/server/routes/map/functions/mapCatalogAttribute.js +54 -0
- package/server/routes/map/{controllers → functions}/mapFeatures.js +22 -18
- package/server/routes/map/{controllers → functions}/mapFormat.js +25 -28
- package/server/routes/map/{controllers → functions}/mapTiles.js +39 -30
- package/server/routes/map/{controllers → functions}/maps.js +3 -3
- package/server/routes/map/{controllers → functions}/marker_icon.js +1 -1
- package/server/routes/map/{controllers → functions}/parseGeoFile.js +10 -11
- package/server/routes/map/{controllers → functions}/pointHeight.js +3 -7
- package/server/routes/map/{controllers → functions}/vtile.js +5 -3
- package/server/routes/map/{vtile1.js → functions/vtile1.js} +39 -33
- package/server/routes/map/map.route.js +280 -0
- package/server/routes/map/map.route.test.js +503 -0
- package/server/routes/map/map.schema.js +356 -0
- package/server/routes/mapnik/{controllers → functions}/clearTiles.js +26 -29
- package/server/routes/mapnik/{controllers → functions}/createXml.js +17 -20
- package/server/routes/mapnik/{controllers → functions}/createXmlMulti.js +11 -15
- package/server/routes/mapnik/{controllers → functions}/fileSearch.js +6 -9
- package/server/routes/mapnik/functions/fileStat.js +28 -0
- package/server/routes/mapnik/{controllers → functions}/pretile.js +29 -35
- package/server/routes/mapnik/{controllers → functions}/rasterInfo.js +19 -10
- package/server/routes/mapnik/{controllers → functions}/readDir.js +4 -4
- package/server/routes/mapnik/functions/rtile.js +164 -0
- package/server/routes/mapnik/{controllers → functions}/uploadRaster.js +19 -24
- package/server/routes/mapnik/functions/uploadXML.js +27 -0
- package/server/routes/mapnik/mapnik.route.js +102 -0
- package/server/routes/mapnik/mapnik.route.test.js +371 -0
- package/server/routes/mapnik/mapnik.schema.mjs +190 -0
- package/server/routes/mapnik.prefixless/functions/mapnikLogger.js +31 -0
- package/server/routes/{mapnik/controllers → mapnik.prefixless/functions}/mapnikStat.js +7 -5
- package/server/routes/mapnik.prefixless/mapnik.prefixless.route.js +20 -0
- package/server/routes/mapnik.prefixless/mapnik.prefixless.route.test.js +91 -0
- package/server/routes/mapnik.prefixless/mapnik.prefixless.schema.mjs +27 -0
- package/server/routes/maps/functions/add.map.js +42 -0
- package/server/routes/{map/maps → maps/functions}/del.map.js +6 -7
- package/server/routes/{map/maps → maps/functions}/get.map.js +12 -11
- package/server/routes/maps/maps.route.js +58 -0
- package/server/routes/maps/maps.route.test.js +231 -0
- package/server/routes/maps/maps.schema.js +10 -0
- package/server/routes/metadata/functions/editMetadata.js +35 -0
- package/server/routes/metadata/functions/metadataXML.js +19 -0
- package/server/routes/metadata/metadata.route.js +26 -0
- package/server/routes/metadata/metadata.route.test.js +47 -0
- package/server/routes/metadata/metadata.schema.js +53 -0
- package/server/routes/{gis/ogc → ogc/functions}/map.info.point.js +22 -29
- package/server/routes/ogc/ogc.route.js +21 -0
- package/server/routes/ogc/ogc.route.test.js +54 -0
- package/server/routes/ogc/ogc.schema.js +16 -0
- package/server/routes/permissions/functions/catalog.permissions.edit.js +20 -0
- package/server/routes/permissions/functions/catalog.permissions.js +13 -0
- package/server/routes/permissions/{controllers → functions}/gis.catalog.js +10 -10
- package/server/routes/permissions/permissions.route.js +35 -0
- package/server/routes/permissions/permissions.route.test.js +35 -0
- package/server/routes/permissions/permissions.schema.js +44 -0
- package/server/routes/registers/functions/add.registry.js +37 -0
- package/server/routes/{gis/registers/funcs → registers/functions}/classifiers.js +2 -2
- package/server/routes/{gis/registers → registers/functions}/del.registry.js +5 -5
- package/server/routes/{gis/registers/funcs → registers/functions}/get.info.js +9 -5
- package/server/routes/{gis/registers → registers/functions}/gis.export.js +27 -21
- package/server/routes/{gis/registers → registers/functions}/gis.registry.js +22 -15
- package/server/routes/{gis/registers → registers/functions}/gis.registry.list.js +12 -10
- package/server/routes/{gis/registers/funcs → registers/functions}/handleRegistryRequest.js +12 -11
- package/server/routes/registers/registers.route.js +80 -0
- package/server/routes/registers/registers.route.test.js +145 -0
- package/server/routes/registers/registers.schema.js +246 -0
- package/server/routes/{gis/services → services/functions}/add.service.js +14 -16
- package/server/routes/services/functions/create.route.js +93 -0
- package/server/routes/{gis/services → services/functions}/del.service.js +5 -5
- package/server/routes/{gis/services → services/functions}/get.service.users.js +15 -13
- package/server/routes/services/functions/get.services.col.js +34 -0
- package/server/routes/{gis/services → services/functions}/get.services.js +21 -16
- package/server/routes/services/services.route.js +76 -0
- package/server/routes/services/services.route.test.js +168 -0
- package/server/routes/services/services.schema.js +278 -0
- package/server/routes/widgets/functions/add.widget.js +39 -0
- package/server/routes/widgets/functions/del.widget.js +18 -0
- package/server/routes/{map/widgets → widgets/functions}/get.widget.js +12 -11
- package/server/routes/widgets/widgets.route.js +61 -0
- package/server/routes/widgets/widgets.route.test.js +144 -0
- package/server/routes/widgets/widgets.schema.js +25 -0
- package/dist/service-JGNtth-y.js +0 -2593
- package/module/cls.json +0 -7
- package/module/gis/card/gis.metadata.table/main_info.hbs +0 -21
- package/module/gis/card/gis.metadata.table/metadata_info.hbs +0 -28
- package/module/gis/card/gis.metadata.table/other.hbs +0 -26
- package/module/gis/card/gis.rasters.table/main_info.hbs +0 -27
- package/module/gis/card/gis.registers.table/cls.hbs +0 -36
- package/module/gis/card/gis.registers.table/columns.hbs +0 -89
- package/module/gis/card/gis.registers.table/filters.hbs +0 -80
- package/module/gis/card/gis.registers.table/main_info.hbs +0 -35
- package/module/gis/card/gis.registers.table/source.hbs +0 -45
- package/module/gis/card/gis.services.table/attributes.hbs +0 -91
- package/module/gis/card/gis.services.table/filters.hbs +0 -83
- package/module/gis/card/gis.services.table/main_info.hbs +0 -27
- package/module/gis/card/gis.services.table/source.hbs +0 -26
- package/module/test/cls/bp_build_type.json +0 -37
- package/module/test/cls/doc_status.json +0 -32
- package/module/test/cls/ts.temp_status.json +0 -18
- package/module/test/cls/ts.temp_structure.ts_class.json +0 -50
- package/module/test/cls/ts.temp_type.json +0 -10
- package/module/test/layer/bp.json +0 -60
- package/module/test/layer/bp1.yml +0 -33
- package/module/test/layer/individual.yml +0 -54
- package/module/test/layer/ts.linking_passport.yml +0 -56
- package/module/test/layer/ts.temp_structure.yml +0 -51
- package/module/test/map/bp_myo.json +0 -44
- package/module/test/map/bpf.json +0 -44
- package/module/test/map/main.json +0 -39
- package/module/test/map/mbd.json +0 -92
- package/module/test/map/ts.json +0 -53
- package/module/test/select/address_id.json +0 -3
- package/module/test/select/address_id.sql +0 -8
- package/module/test/select/core.user_uid.sql +0 -1
- package/module/test/table/data_address.street.table.json +0 -70
- package/module/test/table/data_bp_myo.bp.table.json +0 -123
- package/server/routes/gis/checkXML.js +0 -117
- package/server/routes/gis/dashboard.js +0 -29
- package/server/routes/gis/index.mjs +0 -92
- package/server/routes/gis/metadata/editMetadata.js +0 -34
- package/server/routes/gis/metadata/metadataXML.js +0 -13
- package/server/routes/gis/registers/add.registry.js +0 -35
- package/server/routes/gis/registers/insert.columns.js +0 -107
- package/server/routes/gis/registers/insert.filters.js +0 -110
- package/server/routes/gis/services/create.route.js +0 -96
- package/server/routes/gis/services/get.services.col.js +0 -33
- package/server/routes/map/controllers/mapCatalogAttribute.js +0 -56
- package/server/routes/map/index.mjs +0 -259
- package/server/routes/map/maps/add.map.js +0 -43
- package/server/routes/map/widgets/add.widget.js +0 -39
- package/server/routes/map/widgets/del.widget.js +0 -23
- package/server/routes/mapnik/controllers/fileStat.js +0 -28
- package/server/routes/mapnik/controllers/mapnikLogger.js +0 -29
- package/server/routes/mapnik/controllers/rtile.js +0 -167
- package/server/routes/mapnik/index.js +0 -40
- package/server/routes/permissions/controllers/catalog.permissions.edit.js +0 -22
- package/server/routes/permissions/controllers/catalog.permissions.js +0 -8
- package/server/routes/permissions/index.mjs +0 -18
- /package/server/routes/map/{controllers/pin → pin}/circle1.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/circle2.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/none.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin1.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin2.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin3.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin4.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin5.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin6.svg +0 -0
- /package/server/routes/map/{controllers/pin → pin}/pin7.svg +0 -0
- /package/server/routes/permissions/{controllers/utils → functions}/get.permissions.js +0 -0
- /package/server/routes/{gis/registers/funcs → registers/functions}/columns.js +0 -0
- /package/server/routes/{gis/registers/funcs → registers/functions}/content.type.js +0 -0
- /package/server/routes/{gis/registers → registers/functions}/map.registry.js +0 -0
- /package/server/routes/{gis/services → services/functions}/get.layer.geom.js +0 -0
- /package/server/routes/{gis/services → services/functions}/legend.auto.js +0 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
const querySearchSchema = { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' };
|
|
2
|
+
|
|
3
|
+
const serviceBodySchema = {
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
properties: {
|
|
7
|
+
service_id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
8
|
+
service_key: { type: 'string' },
|
|
9
|
+
name: { type: 'string' },
|
|
10
|
+
description: { type: ['string', 'null'] },
|
|
11
|
+
keywords: { type: ['array', 'null'], items: { type: 'string' } },
|
|
12
|
+
category: { type: ['string', 'null'] },
|
|
13
|
+
holder: { type: ['string', 'null'] },
|
|
14
|
+
group_id: { type: ['string', 'null'] },
|
|
15
|
+
group_name: { type: ['string', 'null'] },
|
|
16
|
+
service_type: {
|
|
17
|
+
type: 'string', enum: [
|
|
18
|
+
"geojson",
|
|
19
|
+
"vtile",
|
|
20
|
+
"wms",
|
|
21
|
+
"wfs",
|
|
22
|
+
"wmts",
|
|
23
|
+
"tms",
|
|
24
|
+
"raster",
|
|
25
|
+
"other"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
card_mode: { type: 'string' },
|
|
29
|
+
source_type: { type: 'string' },
|
|
30
|
+
service_url: { type: ['string', 'null'] },
|
|
31
|
+
source_path: { type: 'string' },
|
|
32
|
+
query: { type: ['string', 'null'] },
|
|
33
|
+
geom_type: { type: ['string', 'null'] },
|
|
34
|
+
geometry_column: { type: ['string', 'null'] },
|
|
35
|
+
sql_list: { type: ['array', 'string', 'null'] },
|
|
36
|
+
|
|
37
|
+
attributes: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
properties: {
|
|
43
|
+
ua: { type: 'string' },
|
|
44
|
+
data: { type: ['string', 'null'] },
|
|
45
|
+
name: { type: 'string' },
|
|
46
|
+
type: { type: 'string' },
|
|
47
|
+
label: { type: 'string' },
|
|
48
|
+
title: { type: 'string' },
|
|
49
|
+
format: { type: 'string' },
|
|
50
|
+
hidden: { type: 'boolean' },
|
|
51
|
+
options: { type: 'array' },
|
|
52
|
+
visible: { type: 'boolean' },
|
|
53
|
+
disabled: { type: 'boolean' },
|
|
54
|
+
required: { type: 'boolean' },
|
|
55
|
+
is_required: { type: 'boolean' },
|
|
56
|
+
data_key_date: { type: ['string', 'null'] },
|
|
57
|
+
hidden_table_public: { type: 'boolean' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
filters: {
|
|
63
|
+
type: ['array', 'null'],
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
popup: {
|
|
67
|
+
type: 'array',
|
|
68
|
+
items: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
properties: {
|
|
72
|
+
data: { type: 'string' },
|
|
73
|
+
meta: { type: 'string' },
|
|
74
|
+
name: { type: 'string' },
|
|
75
|
+
color: { type: 'string' },
|
|
76
|
+
label: { type: 'string' },
|
|
77
|
+
format: { type: 'string' },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
style: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
additionalProperties: false,
|
|
85
|
+
properties: {
|
|
86
|
+
type: { type: 'string' },
|
|
87
|
+
color: { type: 'string' },
|
|
88
|
+
width: { type: 'number' },
|
|
89
|
+
icon: { type: 'string' },
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
legend: {
|
|
94
|
+
type: ['object', 'null', 'array'],
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
card: {
|
|
98
|
+
type: 'array',
|
|
99
|
+
items: {
|
|
100
|
+
type: 'object',
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
properties: {
|
|
103
|
+
name: { type: 'string' },
|
|
104
|
+
label: { type: 'string' },
|
|
105
|
+
meta: { type: 'string' },
|
|
106
|
+
color: { type: 'string' },
|
|
107
|
+
format: { type: 'string' },
|
|
108
|
+
data: { type: 'string' },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
srid: { type: 'number', minimum: 1 },
|
|
114
|
+
|
|
115
|
+
extent: {
|
|
116
|
+
type: 'array',
|
|
117
|
+
items: { type: 'string' },
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
bbox: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
properties: {
|
|
124
|
+
type: { type: 'string' },
|
|
125
|
+
coordinates: {
|
|
126
|
+
type: 'array',
|
|
127
|
+
items: {
|
|
128
|
+
type: 'array',
|
|
129
|
+
items: {
|
|
130
|
+
type: 'array',
|
|
131
|
+
items: { type: 'number' },
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
center: {
|
|
139
|
+
type: 'array',
|
|
140
|
+
items: { type: 'number' },
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
enabled: { type: 'boolean' },
|
|
144
|
+
is_public: { type: 'boolean' },
|
|
145
|
+
is_active: { type: 'boolean' },
|
|
146
|
+
is_downloadable: { type: 'boolean' },
|
|
147
|
+
|
|
148
|
+
metadata: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
additionalProperties: false,
|
|
151
|
+
properties: {
|
|
152
|
+
type: { type: 'string' },
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
metadata_url: { type: ['string', 'null'] },
|
|
157
|
+
thumbnail_url: { type: ['string', 'null'] },
|
|
158
|
+
created_by: { type: 'string' },
|
|
159
|
+
updated_by: { type: 'string' },
|
|
160
|
+
updated_at: { type: 'string' },
|
|
161
|
+
created_at: { type: 'string' },
|
|
162
|
+
|
|
163
|
+
template: {
|
|
164
|
+
type: ['object', 'null'],
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
count: { type: 'number', minimum: 0 },
|
|
168
|
+
|
|
169
|
+
fields: {
|
|
170
|
+
type: 'array',
|
|
171
|
+
items: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
additionalProperties: false,
|
|
174
|
+
properties: {
|
|
175
|
+
name: { type: 'string' },
|
|
176
|
+
type: { type: 'string' },
|
|
177
|
+
label: { type: 'string' },
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const metadataXMLSchema = {};
|
|
185
|
+
export const getLayerGeomSchema = {};
|
|
186
|
+
|
|
187
|
+
export const getServicesSchema = {
|
|
188
|
+
params: {
|
|
189
|
+
type: 'object',
|
|
190
|
+
properties: {
|
|
191
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const getServicesColSchema = {
|
|
197
|
+
params: {
|
|
198
|
+
type: 'object',
|
|
199
|
+
required: ['id', 'col'],
|
|
200
|
+
properties: {
|
|
201
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
202
|
+
col: { type: 'string', pattern: '^([\\d\\w_]+)$' },
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
export const addServiceSchema = {
|
|
207
|
+
params: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
body: { ...serviceBodySchema, required: ['name', 'service_type'] }
|
|
214
|
+
};
|
|
215
|
+
export const editServiceSchema = {
|
|
216
|
+
params: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
required: ['id'],
|
|
219
|
+
properties: {
|
|
220
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
body: serviceBodySchema
|
|
224
|
+
};
|
|
225
|
+
export const deleteServiceSchema = {
|
|
226
|
+
params: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
required: ['id'],
|
|
229
|
+
properties: {
|
|
230
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
export const legendAutoSchema = {};
|
|
235
|
+
export const getServiceUsersSchema = {
|
|
236
|
+
params: {
|
|
237
|
+
type: 'object',
|
|
238
|
+
properties: {
|
|
239
|
+
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
querystring: {
|
|
243
|
+
type: 'object',
|
|
244
|
+
properties: {
|
|
245
|
+
search: querySearchSchema,
|
|
246
|
+
limit: {
|
|
247
|
+
type: 'number',
|
|
248
|
+
minimum: 1,
|
|
249
|
+
},
|
|
250
|
+
offset: {
|
|
251
|
+
type: 'number',
|
|
252
|
+
minimum: 0,
|
|
253
|
+
default: 0
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
export const createRouteSchema = {
|
|
259
|
+
querystring: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
from: { type: 'string', pattern: '^([\\d,.]+)$' },
|
|
263
|
+
to: { type: 'string', pattern: '^([\\d,.]+)$' },
|
|
264
|
+
via: { type: 'string', pattern: '^([\\d,.;]+)$' },
|
|
265
|
+
mode: {
|
|
266
|
+
type: 'string', pattern: '^([\\w]+)$'
|
|
267
|
+
}, // ! not found at OSRM routing api or geodata api - looks like native /{profile}/
|
|
268
|
+
alternatives: { type: 'string', enum: ['true', '1'] },
|
|
269
|
+
steps: { type: 'string', enum: ['true', '1'] },
|
|
270
|
+
optimize: { type: 'string', enum: ['true', '1'] }, // ! not found at OSRM routing api or geodata api
|
|
271
|
+
surface: { type: 'string', pattern: '^([\\w]+)$' }, // ! not found at geodata api request params
|
|
272
|
+
weight: {
|
|
273
|
+
type: 'string', pattern: '^([\\w]+)$'
|
|
274
|
+
}, // ! not found at OSRM routing api or geodata api request params
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
export default null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BadRequestError, UnauthorizedError } from "@opengis/fastify-table/errors.js";
|
|
2
|
+
import { dataInsert, dataUpdate, pgClients } from "@opengis/fastify-table/utils.js";
|
|
3
|
+
|
|
4
|
+
export default async function addWidget({
|
|
5
|
+
method, id, map, body, uid,
|
|
6
|
+
}, pg = pgClients.client) {
|
|
7
|
+
if (!uid) {
|
|
8
|
+
throw UnauthorizedError('unauthorized');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (!map) {
|
|
12
|
+
throw BadRequestError('not enough params: map id');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (method === 'PUT' && !id) {
|
|
16
|
+
throw BadRequestError('not enough params: id');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (method === 'POST') {
|
|
20
|
+
Object.assign(body, { map_id: map });
|
|
21
|
+
const row = await dataInsert({
|
|
22
|
+
pg,
|
|
23
|
+
id,
|
|
24
|
+
table: 'gis.widgets',
|
|
25
|
+
data: body,
|
|
26
|
+
uid,
|
|
27
|
+
}).then(r => r.rows[0]);
|
|
28
|
+
return row;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const row = await dataUpdate({
|
|
32
|
+
pg,
|
|
33
|
+
id,
|
|
34
|
+
table: 'gis.widgets',
|
|
35
|
+
data: body,
|
|
36
|
+
uid,
|
|
37
|
+
});
|
|
38
|
+
return row;
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UnauthorizedError } from "@opengis/fastify-table/errors.js";
|
|
2
|
+
import { dataDelete, pgClients } from "@opengis/fastify-table/utils.js";
|
|
3
|
+
|
|
4
|
+
export default async function delWidget({
|
|
5
|
+
id, uid,
|
|
6
|
+
}, pg = pgClients.client) {
|
|
7
|
+
if (!uid) {
|
|
8
|
+
throw UnauthorizedError('unauthorized');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const row = await dataDelete({
|
|
12
|
+
pg,
|
|
13
|
+
id,
|
|
14
|
+
table: 'gis.widgets',
|
|
15
|
+
uid,
|
|
16
|
+
});
|
|
17
|
+
return row;
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BadRequestError, NotFoundError } from "@opengis/fastify-table/errors.js";
|
|
1
2
|
import { getMeta, pgClients } from "@opengis/fastify-table/utils.js";
|
|
2
3
|
|
|
3
4
|
const table = 'gis.widgets';
|
|
@@ -12,9 +13,9 @@ const columnType = {
|
|
|
12
13
|
'timestamp with time zone': 'date',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export default async function getWidget({
|
|
16
|
-
if (!
|
|
17
|
-
|
|
16
|
+
export default async function getWidget({ map, id }, pg = pgClients.client) {
|
|
17
|
+
if (!map) {
|
|
18
|
+
throw BadRequestError('not enough params: map id');
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const { columns = [] } = await getMeta({ pg, table }) || {};
|
|
@@ -22,20 +23,20 @@ export default async function getWidget({ params = {}, pg = pgClients.client },
|
|
|
22
23
|
const fields = columns.map(({ name, dataTypeID, title }) => ({ name, type: columnType[pg.pgType?.[dataTypeID] || 'text'], label: title || name }));
|
|
23
24
|
|
|
24
25
|
const rows = pg.pk?.['gis.maps'] && pg.pk?.['gis.widgets'] ? await pg.query(
|
|
25
|
-
`SELECT widget_id as id, * FROM gis.widgets where map_id=$1 and ${
|
|
26
|
-
[
|
|
26
|
+
`SELECT widget_id as id, * FROM gis.widgets where map_id=$1 and ${id ? 'widget_id=$2' : '1=1'}`,
|
|
27
|
+
[map, id].filter(Boolean),
|
|
27
28
|
).then(el => el.rows || []) : [];
|
|
28
29
|
|
|
29
|
-
if (
|
|
30
|
-
|
|
30
|
+
if (id && !rows.length) {
|
|
31
|
+
throw NotFoundError('widget not found');
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
if (
|
|
34
|
-
return
|
|
34
|
+
if (id) {
|
|
35
|
+
return { ...rows[0], fields };
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
return
|
|
38
|
+
return {
|
|
38
39
|
rows,
|
|
39
40
|
fields,
|
|
40
|
-
}
|
|
41
|
+
};
|
|
41
42
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import getWidget from './functions/get.widget.js';
|
|
2
|
+
import addWidget from './functions/add.widget.js';
|
|
3
|
+
import delWidget from './functions/del.widget.js';
|
|
4
|
+
|
|
5
|
+
import { schemaInfo } from './widgets.schema.js';
|
|
6
|
+
|
|
7
|
+
const publicParams = {
|
|
8
|
+
config: { policy: 'L0' },
|
|
9
|
+
schema: schemaInfo,
|
|
10
|
+
package: 'gis',
|
|
11
|
+
}; // * L0 === public
|
|
12
|
+
const privilegedParams = {
|
|
13
|
+
config: { policy: 'L1', role: 'admin' },
|
|
14
|
+
schema: schemaInfo,
|
|
15
|
+
package: 'gis',
|
|
16
|
+
}; // ? just auth or admin
|
|
17
|
+
|
|
18
|
+
export default function (app) {
|
|
19
|
+
if (!app.hasRoute({ method: 'GET', url: '/gis-widget/:map/:id?' })) {
|
|
20
|
+
app.get('/gis-widget/:map/:id?', publicParams, async ({ params, pg }) => {
|
|
21
|
+
const result = await getWidget({
|
|
22
|
+
id: params.id,
|
|
23
|
+
map: params.map
|
|
24
|
+
}, pg);
|
|
25
|
+
return result;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (!app.hasRoute({ method: 'POST', url: '/gis-widget/:map/:id?' })) {
|
|
29
|
+
app.post('/gis-widget/:map/:id?', privilegedParams, async ({ method, body, params, user, pg }) => {
|
|
30
|
+
const result = await addWidget({
|
|
31
|
+
method,
|
|
32
|
+
id: params.id,
|
|
33
|
+
map: params.map,
|
|
34
|
+
body,
|
|
35
|
+
uid: user?.uid
|
|
36
|
+
}, pg);
|
|
37
|
+
return result;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (!app.hasRoute({ method: 'PUT', url: '/gis-widget/:map/:id' })) {
|
|
41
|
+
app.put('/gis-widget/:map/:id', privilegedParams, async ({ method, body, params, user, pg }) => {
|
|
42
|
+
const result = await addWidget({
|
|
43
|
+
method,
|
|
44
|
+
id: params.id,
|
|
45
|
+
map: params.map,
|
|
46
|
+
body,
|
|
47
|
+
uid: user?.uid
|
|
48
|
+
}, pg);
|
|
49
|
+
return result;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!app.hasRoute({ method: 'DELETE', url: '/gis-widget/:map/:id' })) {
|
|
53
|
+
app.delete('/gis-widget/:map/:id', privilegedParams, async ({ params, user, pg }) => {
|
|
54
|
+
const result = await delWidget({
|
|
55
|
+
id: params.id,
|
|
56
|
+
uid: user?.uid
|
|
57
|
+
}, pg);
|
|
58
|
+
return result;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/* eslint-disable indent */
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
describe, test, expect, beforeAll, afterAll,
|
|
6
|
+
} from 'vitest';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getPGAsync,
|
|
10
|
+
} from '@opengis/fastify-table/utils.js';
|
|
11
|
+
|
|
12
|
+
import { build, injectWithHeaders } from '../../../test/helper.js';
|
|
13
|
+
|
|
14
|
+
const user = { uid: '1', user_type: 'admin' };
|
|
15
|
+
const testKey = 'unittest';
|
|
16
|
+
|
|
17
|
+
let pg;
|
|
18
|
+
|
|
19
|
+
const obj = {};
|
|
20
|
+
|
|
21
|
+
const cleanUp = async (when) => {
|
|
22
|
+
if (!pg) return;
|
|
23
|
+
const { rowCount: widgets } = await pg.query('delete from gis.widgets where (map_id like $1 or widget_id like $1)', [`${testKey}%`]);
|
|
24
|
+
console.log(`clean up widgets ${when}:`, widgets);
|
|
25
|
+
const { rowCount: maps } = await pg.query('delete from gis.maps where array[$1] && keywords', [testKey]);
|
|
26
|
+
console.log(`clean up maps ${when}:`, maps);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('maps api test', () => {
|
|
30
|
+
beforeAll(async () => {
|
|
31
|
+
await build();
|
|
32
|
+
pg = await getPGAsync();
|
|
33
|
+
// ensure not exists in case previous test fails / timeouts
|
|
34
|
+
await cleanUp('before');
|
|
35
|
+
|
|
36
|
+
await pg.query(
|
|
37
|
+
'insert into gis.maps (map_id, name, keywords, created_by, center) values($1, $1, array[$1], $2, $3) on conflict (map_id) do nothing returning *',
|
|
38
|
+
[testKey, user.uid, [30, 50]],
|
|
39
|
+
);
|
|
40
|
+
console.log('insert before success');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(async () => {
|
|
44
|
+
await cleanUp('after');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const name = [testKey, randomUUID()].join('-');
|
|
48
|
+
|
|
49
|
+
test('POST /gis-widget/:map/:id?', async () => {
|
|
50
|
+
const res = await injectWithHeaders({
|
|
51
|
+
method: 'POST',
|
|
52
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
53
|
+
payload: {
|
|
54
|
+
type: 'card1',
|
|
55
|
+
},
|
|
56
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
57
|
+
});
|
|
58
|
+
expect(res.statusCode).toBe(200);
|
|
59
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
60
|
+
const json = res.json();
|
|
61
|
+
expect(json).toHaveProperty('map_id');
|
|
62
|
+
expect(json.map_id).toBe(testKey);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('GET /gis-widget/:map/:id', async () => {
|
|
66
|
+
const res = await injectWithHeaders({
|
|
67
|
+
method: 'GET',
|
|
68
|
+
url: `/api/gis-widget/${testKey}`,
|
|
69
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
70
|
+
});
|
|
71
|
+
expect(res.statusCode).toBe(200);
|
|
72
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
73
|
+
const json = res.json();
|
|
74
|
+
Object.assign(obj, { 'GET/gis-widget/:map': json });
|
|
75
|
+
expect(json).toHaveProperty('rows');
|
|
76
|
+
expect(json).toHaveProperty('fields');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('GET /gis-widget/:map/:id', async () => {
|
|
80
|
+
/*await dataInsert({
|
|
81
|
+
table: 'gis.widgets',
|
|
82
|
+
id: name,
|
|
83
|
+
data: {
|
|
84
|
+
widget_id: name,
|
|
85
|
+
map_id: testKey,
|
|
86
|
+
type: 'card',
|
|
87
|
+
title: name,
|
|
88
|
+
config: {
|
|
89
|
+
items: [{
|
|
90
|
+
label: 'Карта тимчасових споруд',
|
|
91
|
+
url: '/map/ts',
|
|
92
|
+
}],
|
|
93
|
+
},
|
|
94
|
+
position: 'top-right',
|
|
95
|
+
},
|
|
96
|
+
uid: '1',
|
|
97
|
+
});*/
|
|
98
|
+
const res = await injectWithHeaders({
|
|
99
|
+
method: 'GET',
|
|
100
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
101
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
102
|
+
});
|
|
103
|
+
expect(res.statusCode).toBe(200);
|
|
104
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
105
|
+
const json = res.json();
|
|
106
|
+
Object.assign(obj, { 'GET/gis-widget/:map/:id': json });
|
|
107
|
+
expect(json).toHaveProperty('widget_id');
|
|
108
|
+
expect(json).toHaveProperty('type');
|
|
109
|
+
expect(json).toHaveProperty('title');
|
|
110
|
+
expect(json).toHaveProperty('config');
|
|
111
|
+
expect(json).toHaveProperty('position');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('PUT /gis-widget/:map/:id', async () => {
|
|
115
|
+
const res = await injectWithHeaders({
|
|
116
|
+
method: 'PUT',
|
|
117
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
118
|
+
payload: {
|
|
119
|
+
type: 'card1',
|
|
120
|
+
},
|
|
121
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
122
|
+
});
|
|
123
|
+
expect(res.statusCode).toBe(200);
|
|
124
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
125
|
+
const json = res.json();
|
|
126
|
+
Object.assign(obj, { 'PUT/gis-widget/:map/:id': json });
|
|
127
|
+
expect(json).toHaveProperty('map_id');
|
|
128
|
+
expect(json.map_id).toBe(testKey);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('DELETE /gis-widget/:map/:id', async () => {
|
|
132
|
+
const res = await injectWithHeaders({
|
|
133
|
+
method: 'DELETE',
|
|
134
|
+
url: `/api/gis-widget/${testKey}/${name}`,
|
|
135
|
+
headers: { uid: user.uid, user_type: user.user_type }
|
|
136
|
+
});
|
|
137
|
+
expect(res.statusCode).toBe(200);
|
|
138
|
+
expect(res.headers['content-type']).toBe('application/json; charset=utf-8');
|
|
139
|
+
const json = res.json();
|
|
140
|
+
Object.assign(obj, { 'DELETE/gis-widget/:map/:id': json });
|
|
141
|
+
expect(json).toHaveProperty('map_id');
|
|
142
|
+
expect(json.map_id).toBe(testKey);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const schemaInfo = {
|
|
2
|
+
params: {
|
|
3
|
+
type: 'object',
|
|
4
|
+
properties: {
|
|
5
|
+
slug: {
|
|
6
|
+
type: 'string',
|
|
7
|
+
},
|
|
8
|
+
z: {
|
|
9
|
+
type: 'number',
|
|
10
|
+
},
|
|
11
|
+
y: {
|
|
12
|
+
type: 'number',
|
|
13
|
+
},
|
|
14
|
+
x: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
pattern: '^\\d+\\.(pbf|vmt)$',
|
|
17
|
+
},
|
|
18
|
+
id: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default null;
|