@opengis/gis 0.1.17 → 0.1.19

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.
@@ -24704,11 +24704,29 @@ function xb(u) {
24704
24704
  return u.startsWith("http") ? u : `${window.location.origin}${u}`;
24705
24705
  }
24706
24706
  function bb(u) {
24707
- const { id: d, sourceLayer: y, url: x, bounds: A, title: P, style: v, service: s, service_type: z, source_type: R, data: I } = u, O = xb(x), M = z || s || R || "vector";
24707
+ const {
24708
+ id: d,
24709
+ sourceLayer: y,
24710
+ url: x,
24711
+ bounds: A,
24712
+ title: P,
24713
+ style: v,
24714
+ service: s,
24715
+ service_type: z,
24716
+ source_type: R,
24717
+ data: I
24718
+ } = u, O = xb(x), M = z || s || R || "vector";
24708
24719
  switch (M) {
24709
24720
  case "vtile":
24710
24721
  case "vector":
24711
- return wb(d, y, O, A, P, v);
24722
+ return wb(
24723
+ d,
24724
+ y,
24725
+ O,
24726
+ A,
24727
+ P,
24728
+ v
24729
+ );
24712
24730
  case "raster":
24713
24731
  return Sb(d, O, A, P, v);
24714
24732
  case "geojson":
@@ -24729,14 +24747,14 @@ function zy(u) {
24729
24747
  }
24730
24748
  }
24731
24749
  function wb(u, d, y, x, A, P) {
24732
- const v = d || (y.match(/\/vtile\/([^/]+)/) || [])[1], s = {
24750
+ const v = d || (y.match(/\/vtile\/([^/]+)/) || [])[1] || u, s = {
24733
24751
  type: "vector",
24734
24752
  tiles: [y],
24735
24753
  ...x && { bounds: x }
24736
24754
  }, z = P || zy("polygon"), I = Dy(z).map((O, M) => ({
24737
24755
  ...O,
24738
24756
  id: `${u}-${M}`,
24739
- "source-layer": v || u,
24757
+ "source-layer": v,
24740
24758
  source: u
24741
24759
  }));
24742
24760
  return {
@@ -24830,13 +24848,19 @@ function Cb(u, d, y = "/icons/") {
24830
24848
  return By(u, A);
24831
24849
  }
24832
24850
  async function oa(u, d) {
24833
- const y = bb(d), x = kb(d.style);
24851
+ const y = bb(d);
24852
+ console.log("layer", y);
24853
+ const x = kb(d.style);
24834
24854
  x.length > 0 && await By(u, x), d.layout && d.layout["icon-image"] && await Cb(u, d.layout), u.getSource(y.id) || u.addSource(y.id, y.source);
24835
24855
  for (const A of y.layers)
24836
24856
  d.visible !== void 0 && (A.layout = {
24837
24857
  ...A.layout,
24838
24858
  visibility: d.visible ? "visible" : "none"
24839
- }), u.getLayer(A.id) ? u.setLayoutProperty(A.id, "visibility", d.visible ? "visible" : "none") : await u.addLayer(A);
24859
+ }), u.getLayer(A.id) ? u.setLayoutProperty(
24860
+ A.id,
24861
+ "visibility",
24862
+ d.visible ? "visible" : "none"
24863
+ ) : await u.addLayer(A);
24840
24864
  return y;
24841
24865
  }
24842
24866
  function gl(u, d) {
@@ -25083,8 +25107,7 @@ const Pb = { class: "w-full flex flex-col bg-white border border-stone-200 shado
25083
25107
  default: yr(() => [
25084
25108
  v[1] || (v[1] = ei(" Перейти на карту "))
25085
25109
  ]),
25086
- _: 1,
25087
- __: [1]
25110
+ _: 1
25088
25111
  })
25089
25112
  ]),
25090
25113
  default: yr(() => [
@@ -25287,7 +25310,12 @@ const Pb = { class: "w-full flex flex-col bg-white border border-stone-200 shado
25287
25310
  const d = u, y = Ar(() => {
25288
25311
  var z;
25289
25312
  return ((z = d.config) == null ? void 0 : z.title) || "";
25290
- }), x = dr([]), A = Ar(() => d.config.layer.style.rules.some((z) => z.count !== void 0)), P = Ar(() => d.config.layer.style.rules.reduce((z, R) => z + (R.count || 0), 0)), v = (z) => !z || P.value === 0 ? 0 : Math.round(z / P.value * 100), s = () => {
25313
+ }), x = dr([]), A = Ar(() => d.config.layer.style.rules.some(
25314
+ (z) => z.count !== void 0
25315
+ )), P = Ar(() => d.config.layer.style.rules.reduce(
25316
+ (z, R) => z + (R.count || 0),
25317
+ 0
25318
+ )), v = (z) => !z || P.value === 0 ? 0 : Math.round(z / P.value * 100), s = () => {
25291
25319
  const R = d.config.layer.style.rules.filter(
25292
25320
  (I, O) => x.value[O]
25293
25321
  ).map((I) => I.id || I.value).join(",");
@@ -25301,7 +25329,9 @@ const Pb = { class: "w-full flex flex-col bg-white border border-stone-200 shado
25301
25329
  };
25302
25330
  return _l(() => {
25303
25331
  var z;
25304
- (z = d.config) != null && z.layer && (oa(d.map, d.config.layer), x.value = new Array(d.config.layer.style.rules.length).fill(!1));
25332
+ (z = d.config) != null && z.layer && (oa(d.map, d.config.layer), x.value = new Array(d.config.layer.style.rules.length).fill(
25333
+ !1
25334
+ ));
25305
25335
  }), (z, R) => (ze(), Ke("div", f1, [
25306
25336
  y.value ? (ze(), Ke("div", m1, [
25307
25337
  re("div", null, [
@@ -25315,7 +25345,10 @@ const Pb = { class: "w-full flex flex-col bg-white border border-stone-200 shado
25315
25345
  (ze(!0), Ke(lr, null, Qr(u.config.layer.style.rules, (I, O) => (ze(), Ke("div", {
25316
25346
  key: O,
25317
25347
  class: "flex flex-col justify-center overflow-hidden text-xs text-white text-center whitespace-nowrap",
25318
- style: aa({ width: `${v(I.count)}%`, backgroundColor: I.color }),
25348
+ style: aa({
25349
+ width: `${v(I.count)}%`,
25350
+ backgroundColor: I.color
25351
+ }),
25319
25352
  role: "progressbar",
25320
25353
  "aria-valuenow": v(I.count),
25321
25354
  "aria-valuemin": "0",
@@ -26935,7 +26968,7 @@ function Yw(u, d, y, x, A, P) {
26935
26968
  "aria-label": "Reset layers",
26936
26969
  onClick: d[0] || (d[0] = (...U) => P.clearSelectedLayers && P.clearSelectedLayers(...U))
26937
26970
  }, d[7] || (d[7] = [
26938
- ia('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw text-gray-600" data-v-5b1a9326><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" data-v-5b1a9326></path><path d="M21 3v5h-5" data-v-5b1a9326></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" data-v-5b1a9326></path><path d="M8 16H3v5" data-v-5b1a9326></path></svg>', 1)
26971
+ ia('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw text-gray-600" data-v-939430ce><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" data-v-939430ce></path><path d="M21 3v5h-5" data-v-939430ce></path><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" data-v-939430ce></path><path d="M8 16H3v5" data-v-939430ce></path></svg>', 1)
26939
26972
  ]))
26940
26973
  ]),
26941
26974
  re("div", Sw, [
@@ -27213,7 +27246,7 @@ function Yw(u, d, y, x, A, P) {
27213
27246
  ], 64))
27214
27247
  ]);
27215
27248
  }
27216
- const $w = /* @__PURE__ */ br(gw, [["render", Yw], ["__scopeId", "data-v-5b1a9326"]]);
27249
+ const $w = /* @__PURE__ */ br(gw, [["render", Yw], ["__scopeId", "data-v-939430ce"]]);
27217
27250
  var Zu = { exports: {} }, Ku = { exports: {} }, ns = {}, mn = {}, Xm;
27218
27251
  function _n() {
27219
27252
  if (Xm) return mn;
@@ -30855,8 +30888,7 @@ const B2 = { class: "w-full flex flex-col bg-white border border-stone-200 shado
30855
30888
  default: yr(() => [
30856
30889
  I[1] || (I[1] = ei(" Відкрити бокову панель "))
30857
30890
  ]),
30858
- _: 1,
30859
- __: [1]
30891
+ _: 1
30860
30892
  })
30861
30893
  ]),
30862
30894
  _: 1
@@ -31048,8 +31080,7 @@ function dS(u, d, y, x, A, P) {
31048
31080
  default: yr(() => [
31049
31081
  d[0] || (d[0] = re("div", null, "Повернутися до початкових налаштувань", -1))
31050
31082
  ]),
31051
- _: 1,
31052
- __: [0]
31083
+ _: 1
31053
31084
  })
31054
31085
  ]);
31055
31086
  }
@@ -31221,8 +31252,7 @@ function xS(u, d, y, x, A, P) {
31221
31252
  default: yr(() => [
31222
31253
  d[0] || (d[0] = re("div", null, "Надрукувати", -1))
31223
31254
  ]),
31224
- _: 1,
31225
- __: [0]
31255
+ _: 1
31226
31256
  });
31227
31257
  }
31228
31258
  const bS = /* @__PURE__ */ br(vS, [["render", xS]]), wS = {
@@ -31277,8 +31307,7 @@ function SS(u, d, y, x, A, P) {
31277
31307
  default: yr(() => [
31278
31308
  d[1] || (d[1] = re("div", null, "Перемикач виду", -1))
31279
31309
  ]),
31280
- _: 1,
31281
- __: [1]
31310
+ _: 1
31282
31311
  });
31283
31312
  }
31284
31313
  const AS = /* @__PURE__ */ br(wS, [["render", SS]]), kS = {}, TS = {
@@ -31498,8 +31527,7 @@ function HS(u, d, y, x, A, P) {
31498
31527
  default: yr(() => [
31499
31528
  d[7] || (d[7] = re("div", null, "Дізнатися геолокацію", -1))
31500
31529
  ]),
31501
- _: 1,
31502
- __: [7]
31530
+ _: 1
31503
31531
  })
31504
31532
  ]);
31505
31533
  }
@@ -32259,8 +32287,7 @@ function xA(u, d, y, x, A, P) {
32259
32287
  default: yr(() => [
32260
32288
  d[2] || (d[2] = ei(" Приховати панель "))
32261
32289
  ]),
32262
- _: 1,
32263
- __: [2]
32290
+ _: 1
32264
32291
  })
32265
32292
  ]),
32266
32293
  re("div", gA, [
@@ -32305,8 +32332,7 @@ function xA(u, d, y, x, A, P) {
32305
32332
  default: yr(() => [
32306
32333
  d[6] || (d[6] = re("div", null, "Виміряти довжину", -1))
32307
32334
  ]),
32308
- _: 1,
32309
- __: [6]
32335
+ _: 1
32310
32336
  })
32311
32337
  ]);
32312
32338
  }
@@ -32607,8 +32633,7 @@ function zA(u, d, y, x, A, P) {
32607
32633
  default: yr(() => [
32608
32634
  d[1] || (d[1] = ei(" Приховати панель "))
32609
32635
  ]),
32610
- _: 1,
32611
- __: [1]
32636
+ _: 1
32612
32637
  })
32613
32638
  ]),
32614
32639
  re("div", LA, [
@@ -32645,8 +32670,7 @@ function zA(u, d, y, x, A, P) {
32645
32670
  default: yr(() => [
32646
32671
  d[4] || (d[4] = re("div", null, "Виміряти площу", -1))
32647
32672
  ]),
32648
- _: 1,
32649
- __: [4]
32673
+ _: 1
32650
32674
  })
32651
32675
  ]);
32652
32676
  }
@@ -33383,8 +33407,9 @@ const BA = /* @__PURE__ */ br(EA, [["render", zA], ["__scopeId", "data-v-024154e
33383
33407
  key: 0,
33384
33408
  map: y.value,
33385
33409
  activeTool: I.value,
33386
- setActiveTool: Un
33387
- }, { ref_for: !0 }, Ft === "home" ? { initialView: cn.value } : {}, { onCardValuesId: ai }), null, 16, ["map", "activeTool"])) : Yt("", !0)
33410
+ setActiveTool: Un,
33411
+ ref_for: !0
33412
+ }, Ft === "home" ? { initialView: cn.value } : {}, { onCardValuesId: ai }), null, 16, ["map", "activeTool"])) : Yt("", !0)
33388
33413
  ], 64))), 128))
33389
33414
  ])) : Yt("", !0)
33390
33415
  ], 512), [
@@ -33481,7 +33506,11 @@ const Qy = /* @__PURE__ */ br(jA, [["render", KA]]), GA = {
33481
33506
  },
33482
33507
  table: {
33483
33508
  type: String,
33484
- required: !0
33509
+ default: ""
33510
+ },
33511
+ slug: {
33512
+ type: String,
33513
+ default: ""
33485
33514
  }
33486
33515
  },
33487
33516
  data() {
@@ -33512,8 +33541,8 @@ const Qy = /* @__PURE__ */ br(jA, [["render", KA]]), GA = {
33512
33541
  },
33513
33542
  async getData() {
33514
33543
  try {
33515
- const u = this.type === "registry" ? "/api/gis-registry" : "/api/data", { data: d } = await Zr.get(
33516
- `${u}/${this.table}?filter=${this.filterUrl}&page=${this.currentPage}&limit=${this.limit}`
33544
+ const u = this.type === "registry" ? `/api/gis-registry/${this.slug}` : `/api/data/${this.table}`, { data: d } = await Zr.get(
33545
+ `${u}?filter=${this.filterUrl}&page=${this.currentPage}&limit=${this.limit}`
33517
33546
  );
33518
33547
  d && (this.tableData = d == null ? void 0 : d.rows, this.localTotal = this.type === "registry" ? d == null ? void 0 : d.total : d == null ? void 0 : d.filtered);
33519
33548
  } catch (u) {
@@ -47,6 +47,9 @@
47
47
  <th class="py-2 last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0">
48
48
  Приховати поле в карточці
49
49
  </th>
50
+ <th class="py-2 last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0">
51
+ Експорт даних колонки
52
+ </th>
50
53
  </tr>
51
54
  </thead>
52
55
  <tbody class="divide-y divide-gray-200">
@@ -70,6 +73,9 @@
70
73
  <td class="py-2 pr-5 last:sticky last:right-0 ">
71
74
  {{{badge hidden_card data='yes_no'}}}
72
75
  </td>
76
+ <td class="py-2 pr-5 last:sticky last:right-0 ">
77
+ {{{badge is_export data='yes_no'}}}
78
+ </td>
73
79
  </tr>
74
80
  {{/each}}
75
81
  </tbody>
@@ -49,6 +49,9 @@
49
49
  <th class="py-2 last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0">
50
50
  Приховати поле в карточці
51
51
  </th>
52
+ <th class="py-2 last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0">
53
+ Експорт даних колонки
54
+ </th>
52
55
  </tr>
53
56
  </thead>
54
57
  <tbody class="divide-y divide-gray-200">
@@ -72,6 +75,9 @@
72
75
  <td class="py-2 pr-5 last:sticky last:right-0 ">
73
76
  {{{badge hidden_card data='yes_no'}}}
74
77
  </td>
78
+ <td class="py-2 pr-5 last:sticky last:right-0 ">
79
+ {{{badge is_export data='yes_no'}}}
80
+ </td>
75
81
  </tr>
76
82
  {{/each}}
77
83
  </tbody>
@@ -58,10 +58,7 @@
58
58
  "image": {
59
59
  "ua": "Фото",
60
60
  "col": 12,
61
- "type": "Dropzone",
62
- "validators": [
63
- "required"
64
- ]
61
+ "type": "Dropzone"
65
62
  }
66
63
  }
67
64
  }
@@ -200,6 +200,13 @@
200
200
  "ua": "Приховати поле в карточці об'єкта",
201
201
  "i": "Чи приховати поле при перегляді карточки об'єктів",
202
202
  "col": 6
203
+ },
204
+ {
205
+ "key": "is_export",
206
+ "type": "Switcher",
207
+ "ua": "Експорт даних колонки",
208
+ "i": "Чи експортувати колонку при експорті?",
209
+ "col": 6
203
210
  }
204
211
  ]
205
212
  },
@@ -66,6 +66,13 @@
66
66
  "ua": "Приховати поле в карточці об'єкта",
67
67
  "i": "Чи приховати поле при перегляді карточки об'єктів",
68
68
  "col": 6
69
+ },
70
+ {
71
+ "key": "is_export",
72
+ "type": "Switcher",
73
+ "ua": "Експорт даних колонки",
74
+ "i": "Чи експортувати колонку при експорті?",
75
+ "col": 6
69
76
  }
70
77
  ],
71
78
  "validators": [
@@ -218,6 +218,13 @@
218
218
  "ua": "Приховати поле в карточці об'єкта",
219
219
  "i": "Чи приховати поле при перегляді карточки об'єктів",
220
220
  "col": 6
221
+ },
222
+ {
223
+ "key": "is_export",
224
+ "type": "Switcher",
225
+ "ua": "Експорт даних колонки",
226
+ "i": "Чи експортувати колонку при експорті?",
227
+ "col": 6
221
228
  }
222
229
  ]
223
230
  },
@@ -294,6 +301,10 @@
294
301
  "ua": "Стилізація у форматі yml",
295
302
  "type": "Ace",
296
303
  "syntax": "yml"
304
+ },
305
+ "card": {
306
+ "ua": "Шаблон картки",
307
+ "type": "Text"
297
308
  }
298
309
  }
299
310
  }
@@ -57,6 +57,13 @@
57
57
  "ua": "Приховати поле в карточці об'єкта",
58
58
  "i": "Чи приховати поле при перегляді карточки об'єктів",
59
59
  "col": 6
60
+ },
61
+ {
62
+ "key": "is_export",
63
+ "type": "Switcher",
64
+ "ua": "Експорт даних колонки",
65
+ "i": "Чи експортувати колонку при експорті?",
66
+ "col": 6
60
67
  }
61
68
  ],
62
69
  "validators": [
@@ -1,23 +1,16 @@
1
1
  {
2
2
  "key": "map_id",
3
3
  "table": "gis.maps",
4
- "actions": [
5
- "add",
6
- "edit",
7
- "del"
8
- ],
9
- "controls": [
10
- "search",
11
- "list",
12
- "add"
13
- ],
4
+ "public": true,
5
+ "actions": ["add", "edit", "del"],
6
+ "controls": ["search", "list", "add"],
14
7
  "access": "user",
15
8
  "order": "created_at desc",
16
9
  "meta": {
17
10
  "title": "name",
18
11
  "search": "name,description"
19
12
  },
20
- "title":"Тематичні карти",
13
+ "title": "Тематичні карти",
21
14
  "form": "gis.maps.form",
22
15
  "sql": [
23
16
  {
@@ -1,23 +1,16 @@
1
1
  {
2
2
  "key": "register_id",
3
3
  "table": "gis.registers",
4
- "actions": [
5
- "add",
6
- "edit",
7
- "del"
8
- ],
9
- "controls": [
10
- "search",
11
- "list",
12
- "add"
13
- ],
4
+ "public": true,
5
+ "actions": ["add", "edit", "del"],
6
+ "controls": ["search", "list", "add"],
14
7
  "access": "user",
15
8
  "order": "created_at desc",
16
9
  "meta": {
17
10
  "title": "name",
18
11
  "search": "name,description"
19
12
  },
20
- "title":"Реєстри",
13
+ "title": "Реєстри",
21
14
  "form": "gis.registers.form",
22
15
  "columns": [
23
16
  {
@@ -1,23 +1,16 @@
1
1
  {
2
2
  "key": "service_id",
3
3
  "table": "gis.services",
4
- "actions": [
5
- "add",
6
- "edit",
7
- "del"
8
- ],
9
- "controls": [
10
- "search",
11
- "list",
12
- "add"
13
- ],
4
+ "public": true,
5
+ "actions": ["add", "edit", "del"],
6
+ "controls": ["search", "list", "add"],
14
7
  "access": "user",
15
8
  "order": "created_by desc",
16
9
  "meta": {
17
10
  "title": "name",
18
11
  "search": "name,description,source_path"
19
12
  },
20
- "title":"Набори даних",
13
+ "title": "Набори даних",
21
14
  "form": "gis.services.form",
22
15
  "sqlColumns": "*",
23
16
  "columns": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/gis",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "author": "Softpro",
6
6
  "main": "import-file.js",
@@ -18,7 +18,8 @@
18
18
  "dev": "node server",
19
19
  "build": "vite build && vite build admin",
20
20
  "preview": "vite preview",
21
- "prod": "set NODE_ENV=production&& node server",
21
+ "prod": "export NODE_ENV=production&& node server",
22
+ "prodw": "set NODE_ENV=production&& node server",
22
23
  "docs:install": "npm install --prefix ./docs",
23
24
  "docs:dev": "npm run --prefix ./docs docs:dev",
24
25
  "docs:build": "npm run --prefix ./docs docs:build",
@@ -39,15 +40,18 @@
39
40
  "handlebars": "4.7.8",
40
41
  "maplibre-gl": "5.5.0",
41
42
  "marked": "15.0.12",
43
+ "monaco-editor": "^0.52.2",
42
44
  "vue": "^3.5.13",
43
45
  "vue-router": "4.5.1",
44
- "vue3-smooth-dnd": "0.0.6"
46
+ "vue3-smooth-dnd": "0.0.6",
47
+ "yaml": "^2.8.0"
45
48
  },
46
49
  "devDependencies": {
47
50
  "@vitejs/plugin-vue": "^5.2.3",
48
- "vite": "^6.3.5",
51
+ "dotenv": "^16.5.0",
49
52
  "eslint": "8.49.0",
50
53
  "eslint-config-airbnb": "19.0.4",
51
- "sass-embedded": "1.86.3"
54
+ "sass-embedded": "1.86.3",
55
+ "vite": "^6.3.5"
52
56
  }
53
57
  }
@@ -10,7 +10,8 @@ export default async function route(app) {
10
10
  app.put('/insert-columns/:token', insertColumns);
11
11
  app.put('/insert-filters/:token', insertFilters);
12
12
  app.get('/gis-registry/:slug', { config: { policy: ['public'] } }, gisRegistry);
13
- app.get('/gis-registry-list', { config: { policy: ['public'] } }, gisRegistryList);
13
+ app.get('/gis-registry/:slug/:objectId', { config: { policy: ['public'] } }, gisRegistry);
14
+ app.get('/gis-registry', { config: { policy: ['public'] } }, gisRegistryList);
14
15
  app.get('/map-registry/:slug/:id', { config: { policy: ['public'] } }, mapRegistry);
15
16
 
16
17
  app.get('/xml/:id', { config: { policy: ['public'] } }, metadataXML);
@@ -2,7 +2,7 @@ import { attachClassifiers } from './classifiers.js';
2
2
  import { extractVisibleColumns } from './columns.js';
3
3
  import { getMeta, getFilterSQL } from "@opengis/fastify-table/utils.js";
4
4
 
5
- export async function handleRegistryRequest({ settings, query, object_id, offset, limit, page, pg }) {
5
+ export async function handleRegistryRequest({ settings, query, object_id, offset = 0, limit = 16, page = 1, pg }) {
6
6
  const { name, table_name, columns, filters, query: whereQuery, order, pk, register_id, is_files } = settings;
7
7
  const parsedColumns = Array.isArray(columns) ? columns : JSON.parse(columns);
8
8
  const filtersParsed = Array.isArray(filters) ? filters : JSON.parse(filters);
@@ -1,12 +1,17 @@
1
1
  import { pgClients, getTemplate } from "@opengis/fastify-table/utils.js";
2
+
2
3
  import { handleRegistryRequest } from './funcs/handleRegistryRequest.js';
3
- const pg = pgClients.client;
4
4
 
5
- export default async function gisRegistry(req = {}) {
6
- const { params = {}, query = {} } = req;
7
- const { slug } = params;
8
- const { page = 1, limit = 9, object_id } = query;
9
- const offset = limit * (page - 1);
5
+ const maxLimit = 100;
6
+ const defaultLimit = 9;
7
+
8
+ export default async function gisRegistry({
9
+ pg = pgClients.client, params = {}, query = {},
10
+ }) {
11
+ const { slug, objectId } = params;
12
+
13
+ const limit = Math.min(query.limit || defaultLimit, maxLimit);
14
+ const offset = query.page && query.page > 0 && !objectId ? (query.page - 1) * limit : 0;
10
15
 
11
16
  //if (!slug) return reply.code(404).send({ message: 'Params slug is required', status: 404 });
12
17
  if (!slug) throw new Error('Params slug is required');
@@ -19,14 +24,14 @@ export default async function gisRegistry(req = {}) {
19
24
  WHERE register_key = $1`,
20
25
  [slug]
21
26
  );
22
-
27
+
23
28
  if (registry) {
24
- return await handleRegistryRequest({ settings: registry, query, object_id, offset, limit, page, pg });
29
+ return handleRegistryRequest({ settings: registry, query, object_id: objectId, offset, limit, page: query.page, pg });
25
30
  }
26
31
 
27
32
  const registryTemplate = await getTemplate('registry', slug);
28
33
  //if (!registryTemplate) return reply.code(404).send({ message: 'Template not found', status: 404 });
29
34
  if (!registryTemplate) throw new Error('Template not found');
30
35
 
31
- return await handleRegistryRequest({ settings: registryTemplate, query, object_id, offset, limit, page, pg });
36
+ return handleRegistryRequest({ settings: registryTemplate, query, object_id: objectId, offset, limit, page: query.page, pg });
32
37
  }
@@ -1,4 +1,4 @@
1
- import { config, pgClients } from "@opengis/fastify-table/utils.js";
1
+ import { config, pgClients, yml2json } from "@opengis/fastify-table/utils.js";
2
2
 
3
3
  const { prefix = '/api' } = config;
4
4
 
@@ -18,13 +18,21 @@ export default async function mapCatalog({ pg = pgClients.client }, reply) {
18
18
  const { rows: services = [] } = pg.pk?.['gis.services']
19
19
  ? await pg.query(`select
20
20
  service_id as id, name, service_type, service_url as url,
21
- source_type, source_path, style, layers,
21
+ source_type, source_path, geometry_column, style, layers,
22
22
  st_asgeojson(bbox)::json->'coordinates' as bbox,
23
- st_asgeojson(center)::json->'coordinates' as center
23
+ st_asgeojson(center)::json->'coordinates' as center,
24
+ popup, card, filters
24
25
  from gis.services where is_active and is_public`
25
26
  )
26
27
  : {};
27
28
 
29
+ const bboxq = services.filter(el => el.source_path && pg?.pk?.[el.source_path] && !el.bbox).map(el => `update gis.services set bbox = (select st_extent(${el.geometry_column || 'geom'})::geometry from ${el.source_path}) where service_id='${el.id}'`).join(';');
30
+ await pg.query(bboxq).catch(err => console.error(err.toString()));
31
+
32
+ services.filter(row => row.style).map(row => {
33
+ row.style = yml2json(row.style);
34
+ });
35
+
28
36
  services.filter(el => el.bbox).forEach(el => {
29
37
  el.bbox = getBBox(el.bbox);
30
38
  });
@@ -5,7 +5,7 @@ import { readFile, stat, mkdir, writeFile } from 'node:fs/promises';
5
5
 
6
6
  import Sphericalmercator from '@mapbox/sphericalmercator';
7
7
 
8
- import { getTemplate, pgClients, getFilterSQL, getMeta } from '@opengis/fastify-table/utils.js';
8
+ import { getTemplate, pgClients, getFilterSQL, getMeta, yml2json } from '@opengis/fastify-table/utils.js';
9
9
 
10
10
  import rootFolder from '../../../plugins/mapnik/funcs/rootFolder.mjs';
11
11
 
@@ -64,7 +64,9 @@ export default async function vtile({ pg = pgClients.client, params = {}, query
64
64
  return reply.status(404).send('service not found');
65
65
  }
66
66
 
67
- const { source, style, gt, gc } = data;
67
+ const { source, gt, gc } = data;
68
+
69
+ const style = data.style ? yml2json(data.style) : {};
68
70
 
69
71
  if (!source) {
70
72
  return reply.status(400).send('invalid service source path');