@golemio/fypr 2.0.1-dev.2897169154 → 2.0.1-dev.2954849317

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.
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs/promises');
4
+ const path = require('path');
5
+
6
+ const runSql = (db, name) =>
7
+ fs.readFile(path.join(__dirname, 'sqls', name), 'utf-8').then((sql) => {
8
+ console.log('received data: ' + sql);
9
+ return db.runSql(sql);
10
+ });
11
+
12
+ exports.up = (db) => runSql(db, '20261014120000-mvt-information-panels-in-operation-state-up.sql');
13
+
14
+ exports.down = (db) => runSql(db, '20261014120000-mvt-information-panels-in-operation-state-down.sql');
15
+
16
+ exports._meta = { version: 1 };
@@ -0,0 +1,65 @@
1
+ DROP INDEX IF EXISTS idx_information_panels_mvt_geom;
2
+
3
+ -- Partial GiST index for bbox-driven tile lookups
4
+ CREATE INDEX idx_information_panels_mvt_geom
5
+ ON information_panels USING GIST (geometry)
6
+ WHERE state = 'Hotovo' AND data_source = 'Golemio' AND geometry IS NOT NULL;
7
+
8
+ CREATE OR REPLACE VIEW v_information_panels_for_mvt AS
9
+ SELECT
10
+ ip.id, ip.document_id, ip.uid, ip.kind, ip.name, ip.state, ip.owner, ip.city_district, ip.lat, ip.lon,
11
+ ip.map_link, ip.planned_year_of_realization, ip.note, ip.handover, ip.handover_date, ip.source_created_at,
12
+ ip.source_updated_at, ip.source_published_at, ip.created_at, ip.updated_at, ip.stop_name, ip.stop_direction,
13
+ ip.platform_code, ip.stop_type, ip.thmp_stop_id, ip.land_parcel_number, ip.land_owner, ip.workday_boarding_count,
14
+ ip.lines, ip.location_description, ip.location_verification_on_street_light, ip.shelter_type, ip.shelter_id,
15
+ ip.street_light_number, ip.surface_type, ip.connection_state, ip.connection_type, ip.connection_mode, ip.priority,
16
+ ip.investor_action, ip.design_request, ip.design_state, ip.design_order_number, ip.design_registry_publication,
17
+ ip.design_invoice_paid, ip.production_order_number, ip.production_state, ip.production_registry_publication,
18
+ ip.production_invoice_paid, ip.realization_request, ip.realization_state, ip.realization_order_number,
19
+ ip.realization_registry_publication, ip.realization_invoice_paid, ip.name_for_visually_impaired, ip.voice_day,
20
+ ip.voice_night, ip.templates, ip.preset, ip.data_source, ip.imsi, ip.connection_point, ip.connection_point_number,
21
+ ip.foundation_type, ip.warranty_end, ip.initial_revision, ip.next_revision, ip.electronics_service,
22
+ ip.electronics_service_end, ip.asset_registered, ip.asset_number, ip.insurance, ip.handed_over_to_ozp,
23
+ ip.dpp_documentation_request, ip.dpp_documentation_handover_date, ip.design_deadline, ip.production_deadline,
24
+ ip.ropid_documentation_submitted, ip.ropid_documentation_handover_date, ip.dpp_documentation_submitted,
25
+ ip.realization_deadline, ip.device_id, ip.asw_node_id, ip.asw_stop_id, ip.power_consumption_watt,
26
+ ip.thmp_element_number, ip.electricity_supply_contract, ip.cleaning_frequency, ip.electricity_consumption_price,
27
+ ip.construction_type, ip.panel_size, ip.design_price_without_vat, ip.production_price_without_vat,
28
+ ip.realization_price_without_vat, ip.serial_number, ip.producer, ip.producer_contact_person, ip.panel_technology,
29
+ ip.panel_model, ip.owner_contact, ip.connectivity_internet, ip.phone_number, ip.manager, ip.jis_graphic,
30
+ ip.supported_functions,
31
+ ST_SetSRID(ST_MakePoint(ip.lon, ip.lat), 4326)::geometry(Point, 4326) AS geometry,
32
+ concat_ws(' ', ip.name, ip.stop_name) AS search_fields
33
+ FROM information_panels ip
34
+ WHERE ip.state = 'Hotovo'
35
+ AND ip.lat IS NOT NULL
36
+ AND ip.lon IS NOT NULL
37
+ AND ip.preset IS NOT NULL
38
+ AND ip.data_source = 'Golemio';
39
+
40
+ CREATE OR REPLACE VIEW v_information_panels_for_mvt_with_routes AS
41
+ SELECT
42
+ ip.id,
43
+ ip.preset,
44
+ ip.geometry,
45
+ ip.name AS search_fields,
46
+ -- Cast to text so mvt-maps' FilterBuilder can process the column via `NULLIF(routes, '')::jsonb`
47
+ COALESCE(
48
+ JSONB_AGG(
49
+ JSONB_BUILD_OBJECT(
50
+ 'route_name', p.route_name,
51
+ 'route_type', r.route_type,
52
+ 'route_short_name', r.route_short_name,
53
+ 'route_id', r.route_id
54
+ )
55
+ ) FILTER (WHERE r.preset_id IS NOT NULL),
56
+ '[]'::jsonb
57
+ )::text AS routes
58
+ FROM information_panels ip
59
+ INNER JOIN information_panels_presets p
60
+ ON p.information_panel_document_id = ip.document_id AND NOT p.is_testing
61
+ LEFT JOIN information_panels_presets_routes r ON r.preset_id = p.id
62
+ WHERE ip.state = 'Hotovo'
63
+ AND ip.geometry IS NOT NULL
64
+ AND ip.data_source = 'Golemio'
65
+ GROUP BY ip.id;
@@ -0,0 +1,66 @@
1
+ -- Information panels in state "V provozu" are shown in MVT layers the same way as "Hotovo".
2
+ DROP INDEX IF EXISTS idx_information_panels_mvt_geom;
3
+
4
+ -- Partial GiST index for bbox-driven tile lookups
5
+ CREATE INDEX idx_information_panels_mvt_geom
6
+ ON information_panels USING GIST (geometry)
7
+ WHERE state IN ('Hotovo', 'V provozu') AND data_source = 'Golemio' AND geometry IS NOT NULL;
8
+
9
+ CREATE OR REPLACE VIEW v_information_panels_for_mvt AS
10
+ SELECT
11
+ ip.id, ip.document_id, ip.uid, ip.kind, ip.name, ip.state, ip.owner, ip.city_district, ip.lat, ip.lon,
12
+ ip.map_link, ip.planned_year_of_realization, ip.note, ip.handover, ip.handover_date, ip.source_created_at,
13
+ ip.source_updated_at, ip.source_published_at, ip.created_at, ip.updated_at, ip.stop_name, ip.stop_direction,
14
+ ip.platform_code, ip.stop_type, ip.thmp_stop_id, ip.land_parcel_number, ip.land_owner, ip.workday_boarding_count,
15
+ ip.lines, ip.location_description, ip.location_verification_on_street_light, ip.shelter_type, ip.shelter_id,
16
+ ip.street_light_number, ip.surface_type, ip.connection_state, ip.connection_type, ip.connection_mode, ip.priority,
17
+ ip.investor_action, ip.design_request, ip.design_state, ip.design_order_number, ip.design_registry_publication,
18
+ ip.design_invoice_paid, ip.production_order_number, ip.production_state, ip.production_registry_publication,
19
+ ip.production_invoice_paid, ip.realization_request, ip.realization_state, ip.realization_order_number,
20
+ ip.realization_registry_publication, ip.realization_invoice_paid, ip.name_for_visually_impaired, ip.voice_day,
21
+ ip.voice_night, ip.templates, ip.preset, ip.data_source, ip.imsi, ip.connection_point, ip.connection_point_number,
22
+ ip.foundation_type, ip.warranty_end, ip.initial_revision, ip.next_revision, ip.electronics_service,
23
+ ip.electronics_service_end, ip.asset_registered, ip.asset_number, ip.insurance, ip.handed_over_to_ozp,
24
+ ip.dpp_documentation_request, ip.dpp_documentation_handover_date, ip.design_deadline, ip.production_deadline,
25
+ ip.ropid_documentation_submitted, ip.ropid_documentation_handover_date, ip.dpp_documentation_submitted,
26
+ ip.realization_deadline, ip.device_id, ip.asw_node_id, ip.asw_stop_id, ip.power_consumption_watt,
27
+ ip.thmp_element_number, ip.electricity_supply_contract, ip.cleaning_frequency, ip.electricity_consumption_price,
28
+ ip.construction_type, ip.panel_size, ip.design_price_without_vat, ip.production_price_without_vat,
29
+ ip.realization_price_without_vat, ip.serial_number, ip.producer, ip.producer_contact_person, ip.panel_technology,
30
+ ip.panel_model, ip.owner_contact, ip.connectivity_internet, ip.phone_number, ip.manager, ip.jis_graphic,
31
+ ip.supported_functions,
32
+ ST_SetSRID(ST_MakePoint(ip.lon, ip.lat), 4326)::geometry(Point, 4326) AS geometry,
33
+ concat_ws(' ', ip.name, ip.stop_name) AS search_fields
34
+ FROM information_panels ip
35
+ WHERE ip.state IN ('Hotovo', 'V provozu')
36
+ AND ip.lat IS NOT NULL
37
+ AND ip.lon IS NOT NULL
38
+ AND ip.preset IS NOT NULL
39
+ AND ip.data_source = 'Golemio';
40
+
41
+ CREATE OR REPLACE VIEW v_information_panels_for_mvt_with_routes AS
42
+ SELECT
43
+ ip.id,
44
+ ip.preset,
45
+ ip.geometry,
46
+ ip.name AS search_fields,
47
+ -- Cast to text so mvt-maps' FilterBuilder can process the column via `NULLIF(routes, '')::jsonb`
48
+ COALESCE(
49
+ JSONB_AGG(
50
+ JSONB_BUILD_OBJECT(
51
+ 'route_name', p.route_name,
52
+ 'route_type', r.route_type,
53
+ 'route_short_name', r.route_short_name,
54
+ 'route_id', r.route_id
55
+ )
56
+ ) FILTER (WHERE r.preset_id IS NOT NULL),
57
+ '[]'::jsonb
58
+ )::text AS routes
59
+ FROM information_panels ip
60
+ INNER JOIN information_panels_presets p
61
+ ON p.information_panel_document_id = ip.document_id AND NOT p.is_testing
62
+ LEFT JOIN information_panels_presets_routes r ON r.preset_id = p.id
63
+ WHERE ip.state IN ('Hotovo', 'V provozu')
64
+ AND ip.geometry IS NOT NULL
65
+ AND ip.data_source = 'Golemio'
66
+ GROUP BY ip.id;
@@ -55,5 +55,5 @@ export declare const nullableInteger: {
55
55
  export declare const deviceStatusValues: readonly ["not_charging", "low_power", "ok", "not_ok", "intermittent_outages", "not_monitored", "off"];
56
56
  export declare const stateEnum: {
57
57
  readonly type: "string";
58
- readonly enum: readonly ["Plánováno", "V přípravě", "Hotovo", "Zrušeno", "Neplánováno"];
58
+ readonly enum: readonly ["Plánováno", "V přípravě", "V provozu", "Hotovo", "Odstraňováno", "Zrušeno", "Neplánováno"];
59
59
  };
@@ -59,7 +59,7 @@ export declare abstract class AbstractElementModel extends Model<InferAttributes
59
59
  };
60
60
  readonly state: {
61
61
  readonly type: "string";
62
- readonly enum: readonly ["Plánováno", "V přípravě", "Hotovo", "Zrušeno", "Neplánováno"];
62
+ readonly enum: readonly ["Plánováno", "V přípravě", "V provozu", "Hotovo", "Odstraňováno", "Zrušeno", "Neplánováno"];
63
63
  };
64
64
  readonly owner: {
65
65
  readonly oneOf: readonly [{
@@ -1,2 +1,2 @@
1
- export declare const fyprElementStates: readonly ["Plánováno", "V přípravě", "Hotovo", "Zrušeno", "Neplánováno"];
1
+ export declare const fyprElementStates: readonly ["Plánováno", "V přípravě", "V provozu", "Hotovo", "Odstraňováno", "Zrušeno", "Neplánováno"];
2
2
  export type FyprElementState = typeof fyprElementStates[number];
@@ -1,3 +1,12 @@
1
1
  // Values of the `state` column (Czech `stav_prvku`), shared by all FYPR element kinds.
2
- export const fyprElementStates = ["Plánováno", "V přípravě", "Hotovo", "Zrušeno", "Neplánováno"];
2
+ // "V provozu" is used only by information panels, "Odstraňováno" by information panels and display cases.
3
+ export const fyprElementStates = [
4
+ "Plánováno",
5
+ "V přípravě",
6
+ "V provozu",
7
+ "Hotovo",
8
+ "Odstraňováno",
9
+ "Zrušeno",
10
+ "Neplánováno",
11
+ ];
3
12
  //# sourceMappingURL=fyprElementStates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fyprElementStates.js","sourceRoot":"","sources":["../../../../src/schema-definitions/models/interfaces/fyprElementStates.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAU,CAAC"}
1
+ {"version":3,"file":"fyprElementStates.js","sourceRoot":"","sources":["../../../../src/schema-definitions/models/interfaces/fyprElementStates.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,0GAA0G;AAC1G,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,WAAW;IACX,YAAY;IACZ,WAAW;IACX,QAAQ;IACR,cAAc;IACd,SAAS;IACT,aAAa;CACP,CAAC"}
@@ -345,7 +345,7 @@ Výsledky jsou řazeny dle `source_created_at ASC` (nejstarší záznamy první,
345
345
  - volitelné filtrovací query parametry (pouze pro `information-panels`, jinak `400`):
346
346
  - `jis` (boolean) — filtruje dle příznaku `jis_graphic`
347
347
  - `state` (enum, lze opakovat) — filtruje dle stavu prvku; opakováním se vytvoří podmínka `IN`
348
- (`state=Hotovo&state=Plánováno`); platné hodnoty: `Plánováno`, `V přípravě`, `Hotovo`, `Zrušeno`, `Neplánováno`
348
+ (`state=Hotovo&state=Plánováno`); platné hodnoty: `Plánováno`, `V přípravě`, `V provozu`, `Hotovo`, `Odstraňováno`, `Zrušeno`, `Neplánováno`
349
349
  - `hasDeviceId` (boolean) — `true` vrátí infopanely s vyplněným `device_id`, `false` infopanely bez něj
350
350
 
351
351
  - volitelné query parametry pro připojení souvisejících dat (embed/join, pouze pro `information-panels`); parametr lze opakovat pro připojení více zdrojů najednou (`scopes=routes&scopes=device_status`):
@@ -179,7 +179,9 @@ paths:
179
179
  enum:
180
180
  - Plánováno
181
181
  - V přípravě
182
+ - V provozu
182
183
  - Hotovo
184
+ - Odstraňováno
183
185
  - Zrušeno
184
186
  - Neplánováno
185
187
  description: >-
@@ -501,11 +503,14 @@ components:
501
503
  enum:
502
504
  - "Plánováno"
503
505
  - "V přípravě"
506
+ - "V provozu"
504
507
  - "Hotovo"
508
+ - "Odstraňováno"
505
509
  - "Zrušeno"
506
510
  - "Neplánováno"
507
511
  description: >-
508
- State of the element (stav prvku). Common across all element kinds.
512
+ State of the element (stav prvku). Common across all element kinds;
513
+ "V provozu" is used only by information panels, "Odstraňováno" by information panels and display cases.
509
514
 
510
515
  PhaseStateEnum:
511
516
  type: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/fypr",
3
- "version": "2.0.1-dev.2897169154",
3
+ "version": "2.0.1-dev.2954849317",
4
4
  "description": "Golemio FYPR Module",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",