@gisatcz/ptr-be-core 0.0.1-dev.6 → 0.0.1-dev.7

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.
@@ -1,6 +1,5 @@
1
1
  import { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from "../panther/enums.panther";
2
- import { OneOfEdgeProperties } from "../panther/models.edges.properties";
3
- import { FullPantherEntity } from "../panther/models.nodes";
2
+ import { FullEdgeProperties, FullPantherEntity } from "../panther/models.groups";
4
3
  /**
5
4
  * Represents a node in the Arrows diagram/model.
6
5
  *
@@ -53,6 +52,6 @@ export interface ArrowsEdge {
53
52
  fromId: string;
54
53
  toId: string;
55
54
  type: string | UsedEdgeLabels;
56
- properties?: Partial<OneOfEdgeProperties>;
55
+ properties?: Partial<FullEdgeProperties>;
57
56
  style?: object;
58
57
  }
@@ -29,7 +29,9 @@ export declare enum UsedDatasourceLabels {
29
29
  PostGIS = "postgis",// PostGIS database source
30
30
  WMTS = "wmts",// Web Map Tile Service
31
31
  WFS = "wfs",// Web Feature Service
32
- GeoPackage = "geopackage"
32
+ GeoPackage = "geopackage",// OGC GeoPackage format
33
+ MapStyle = "mapStyle",// Map style datasource
34
+ Timeseries = "timeseries"
33
35
  }
34
36
  /**
35
37
  * What types of edges we use in metadata model
@@ -39,3 +41,13 @@ export declare enum UsedEdgeLabels {
39
41
  Has = "HAS",// Edge for ownership relation
40
42
  InPostgisLocation = "IN_POSTGIS_LOCATION"
41
43
  }
44
+ /**
45
+ * What time steps are used in timeseries data
46
+ */
47
+ export declare enum UsedTimeseriesSteps {
48
+ Year = "year",
49
+ Quarter = "quarter",
50
+ Month = "month",
51
+ Week = "week",
52
+ Day = "day"
53
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Nullable } from "../coding/code.types.js";
2
2
  import { UsedEdgeLabels } from "./enums.panther.js";
3
- import { OneOfEdgeProperties } from "./models.edges.properties.js";
3
+ import { FullEdgeProperties } from "./models.groups.js";
4
4
  /**
5
5
  * Tuple for relation between two graph nodes
6
6
  * It is point to point definition of graph edge
@@ -14,5 +14,5 @@ export type GraphRelation = [string, string];
14
14
  export interface GraphEdge {
15
15
  label: UsedEdgeLabels;
16
16
  edgeNodes: GraphRelation;
17
- properties: Nullable<OneOfEdgeProperties>;
17
+ properties: Nullable<FullEdgeProperties>;
18
18
  }
@@ -33,10 +33,3 @@ export interface EdgeForPostgisLocationProperties extends EdgePropertiesBasic {
33
33
  featureIdColumn: string | null;
34
34
  periodIso: string | null;
35
35
  }
36
- /**
37
- * Represents a union type for edge properties, which can be either
38
- * `EdgeForPostgisLocationProperties` or `EdgePropertiesBasic`.
39
- * This type is used to define the possible properties of an edge
40
- * in the application.
41
- */
42
- export type OneOfEdgeProperties = EdgeForPostgisLocationProperties | EdgePropertiesBasic;
@@ -0,0 +1,21 @@
1
+ import { EdgeForPostgisLocationProperties, EdgePropertiesBasic } from "./models.edges.properties";
2
+ import { PantherEntity } from "./models.nodes";
3
+ import { HasBands, HasColor, HasDocumentId, HasSpecificName, HasTimeseries, HasUrl } from "./models.nodes.properties.datasources";
4
+ import { HasConfiguration, HasGeometry, HasInterval, HasLevels, HasUnits } from "./models.nodes.properties.general";
5
+ /**
6
+ * Full properties for a datasource, combining all relevant interfaces.
7
+ */
8
+ export interface FullDatasourceProperties extends HasConfiguration, HasUrl, HasBands, HasTimeseries, HasSpecificName, HasColor, HasDocumentId {
9
+ }
10
+ /**
11
+ * Represents a full panther entity which extends the basic PantherEntity
12
+ */
13
+ export interface FullPantherEntity extends PantherEntity, Partial<HasGeometry & HasInterval & HasLevels & HasConfiguration & HasUrl & HasBands & HasSpecificName & HasColor & HasUnits & HasDocumentId & HasTimeseries> {
14
+ }
15
+ /**
16
+ * Represents a union type for edge properties, which can be either
17
+ * `EdgeForPostgisLocationProperties` or `EdgePropertiesBasic`.
18
+ * This type is used to define the possible properties of an edge
19
+ * in the application.
20
+ */
21
+ export type FullEdgeProperties = EdgeForPostgisLocationProperties | EdgePropertiesBasic;
@@ -1,6 +1,8 @@
1
- import { HasGeometry, HasInterval, HasLevels, HasConfiguration, HasUrl, HasBands, HasSpecificName, HasColor, HasUnits } from "./models.nodes.properties.js";
1
+ import { HasGeometry, HasInterval, HasLevels, HasConfiguration, HasUnits } from "./models.nodes.properties.general.js";
2
2
  import { UsedNodeLabels, UsedDatasourceLabels } from "./enums.panther.js";
3
+ import { HasColor } from "./models.nodes.properties.datasources.js";
3
4
  import { Nullable } from "../coding/code.types.js";
5
+ import { FullDatasourceProperties } from "./models.groups.js";
4
6
  /**
5
7
  * General graph node - same for all metadatata entities
6
8
  */
@@ -12,8 +14,6 @@ export interface PantherEntity {
12
14
  description: Nullable<string>;
13
15
  lastUpdatedAt: number;
14
16
  }
15
- export interface MapStyle extends PantherEntity, Partial<HasSpecificName> {
16
- }
17
17
  /**
18
18
  * Place node - somewhere in the world
19
19
  */
@@ -32,7 +32,7 @@ export interface AreaTreeLevel extends PantherEntity, HasLevels {
32
32
  /**
33
33
  * Datasource with source configuration
34
34
  */
35
- export interface Datasource extends PantherEntity, Partial<HasConfiguration & HasUrl & HasBands> {
35
+ export interface Datasource extends PantherEntity, Partial<FullDatasourceProperties> {
36
36
  }
37
37
  /**
38
38
  * Application node - main entity in metadata model
@@ -45,20 +45,3 @@ export interface ApplicationNode extends PantherEntity, Partial<HasConfiguration
45
45
  */
46
46
  export interface Attribute extends PantherEntity, Partial<HasColor & HasUnits> {
47
47
  }
48
- /**
49
- * Represents a full panther entity which extends the basic PantherEntity
50
- * and optionally includes geometry, interval, levels, and configuration properties.
51
- *
52
- * @extends PantherEntity
53
- * @extends Partial<HasGeometry>
54
- * @extends Partial<HasInterval>
55
- * @extends Partial<HasLevels>
56
- * @extends Partial<HasConfiguration>
57
- * @extends Partial<HasUrl>
58
- * @extends Partial<HasBands>
59
- * @extends Partial<HasSpecificName>
60
- * @extends Partial<HasColor>
61
- * @extends Partial<HasUnits>
62
- */
63
- export interface FullPantherEntity extends PantherEntity, Partial<HasGeometry & HasInterval & HasLevels & HasConfiguration & HasUrl & HasBands & HasSpecificName & HasColor & HasUnits> {
64
- }
@@ -0,0 +1,50 @@
1
+ import { UsedTimeseriesSteps } from "./enums.panther";
2
+ import { HasInterval } from "./models.nodes.properties.general";
3
+ /**
4
+ * Represents a datasource that has a document ID.
5
+ * The document ID is a unique identifier for the document.
6
+ * Example is vector dataset, that has one unique document ID for all backend services and frontends.
7
+ */
8
+ export interface HasDocumentId {
9
+ documentId: string;
10
+ }
11
+ /**
12
+ * Datasource that has bands, e.g. satellite imagery
13
+ * Bands have CSV format - order of values is important.
14
+ * Bands are used to represent different spectral bands in satellite imagery.
15
+ * Each band can have a name and a period (e.g., wavelength).
16
+ */
17
+ export interface HasBands {
18
+ bands: number[];
19
+ bandNames: string[];
20
+ bandPeriods: string[];
21
+ }
22
+ /**
23
+ * Datasource that has a URL, e.g. a link to a resource or a service.
24
+ * This is used for entities that can be accessed via a URL.
25
+ */
26
+ export interface HasUrl {
27
+ url: string;
28
+ }
29
+ /**
30
+ * Datasource representing time series data
31
+ * Has relevant time interval and step.
32
+ * @extends HasInterval
33
+ */
34
+ export interface HasTimeseries extends HasInterval {
35
+ step: UsedTimeseriesSteps;
36
+ }
37
+ /**
38
+ * Style Datasource that has a specific name, e.g. a unique identifier or a specific title.
39
+ * This is used for entities that need to be identified by a specific name.
40
+ */
41
+ export interface HasSpecificName {
42
+ specificName: string;
43
+ }
44
+ /**
45
+ * Style Datasource that has a color property.
46
+ * The color is defined as a hexadecimal color code.
47
+ */
48
+ export interface HasColor {
49
+ color: string;
50
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Datasource that has relevant time interval.
3
+ * Example: Period is connected to some time range.
4
+ */
5
+ export interface HasInterval {
6
+ validIntervalIso: string;
7
+ validFrom: number;
8
+ validTo: number;
9
+ }
10
+ /**
11
+ * Entity with custom configuration
12
+ */
13
+ export interface HasConfiguration {
14
+ configuration: string;
15
+ }
16
+ /**
17
+ * Place node - somewhere in the world
18
+ */
19
+ export interface HasGeometry {
20
+ geometry: any;
21
+ bbox: number[];
22
+ }
23
+ /**
24
+ * Place node - somewhere in the world
25
+ */
26
+ export interface HasLevels {
27
+ level: number;
28
+ }
29
+ /**
30
+ * Represents an entity that has a unit of measurement.
31
+ */
32
+ export interface HasUnits {
33
+ unit: string;
34
+ valueType: 'string' | 'number' | 'boolean' | 'date' | 'json';
35
+ }
@@ -1,9 +1,11 @@
1
1
  export { enumCombineValuesToString, enumValuesToArray, enumValuesToString, flattenObject, isInEnum, notEmptyString, randomNumberBetween, removeDuplicitiesFromArray, sortStringArray } from "./globals/coding/code.formating.js";
2
2
  export { type Nullable, type Nullish, type Unsure, type UsurePromise } from "./globals/coding/code.types.js";
3
- export { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from "./globals/panther/enums.panther.js";
4
- export { type EdgeForPostgisLocationProperties, type EdgePropertiesBasic, type OneOfEdgeProperties } from "./globals/panther/models.edges.properties.js";
3
+ export { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels, UsedTimeseriesSteps } from "./globals/panther/enums.panther.js";
4
+ export { type EdgeForPostgisLocationProperties, type EdgePropertiesBasic } from "./globals/panther/models.edges.properties.js";
5
5
  export { type GraphEdge, type GraphRelation } from "./globals/panther/models.edges.js";
6
- export { type HasBands, type HasColor, type HasConfiguration, type HasGeometry, type HasInterval, type HasLevels, type HasSpecificName, type HasUrl, type HasUnits } from "./globals/panther/models.nodes.properties.js";
7
- export { type Place, type Period, type AreaTreeLevel, type Datasource, type ApplicationNode, type Attribute, type FullPantherEntity, type MapStyle, type PantherEntity } from "./globals/panther/models.nodes.js";
8
6
  export { type HasEdges, type HasNeighbours, type NodeWithNeighbours } from "./globals/panther/models.nodes.structure.js";
7
+ export { type HasConfiguration, type HasGeometry, type HasInterval, type HasLevels, type HasUnits } from "./globals/panther/models.nodes.properties.general.js";
8
+ export { type HasBands, type HasDocumentId, type HasTimeseries, type HasUrl, type HasSpecificName, type HasColor } from "./globals/panther/models.nodes.properties.datasources.js";
9
+ export { type Place, type Period, type AreaTreeLevel, type Datasource, type ApplicationNode, type Attribute, type PantherEntity } from "./globals/panther/models.nodes.js";
10
+ export { type FullDatasourceProperties, type FullPantherEntity, type FullEdgeProperties } from "./globals/panther/models.groups.js";
9
11
  export { type ArrowsNode, type ArrowsEdge } from "./globals/arrows/models.arrows.js";
@@ -126,7 +126,9 @@ var UsedDatasourceLabels;
126
126
  UsedDatasourceLabels["PostGIS"] = "postgis";
127
127
  UsedDatasourceLabels["WMTS"] = "wmts";
128
128
  UsedDatasourceLabels["WFS"] = "wfs";
129
- UsedDatasourceLabels["GeoPackage"] = "geopackage"; // OGC GeoPackage format
129
+ UsedDatasourceLabels["GeoPackage"] = "geopackage";
130
+ UsedDatasourceLabels["MapStyle"] = "mapStyle";
131
+ UsedDatasourceLabels["Timeseries"] = "timeseries"; // Timeseries datasource (with from-to and step)
130
132
  })(UsedDatasourceLabels || (UsedDatasourceLabels = {}));
131
133
  /**
132
134
  * What types of edges we use in metadata model
@@ -137,6 +139,17 @@ var UsedEdgeLabels;
137
139
  UsedEdgeLabels["Has"] = "HAS";
138
140
  UsedEdgeLabels["InPostgisLocation"] = "IN_POSTGIS_LOCATION"; // Edge to connect datasource with PostGIS location (schema, table, geometry column)
139
141
  })(UsedEdgeLabels || (UsedEdgeLabels = {}));
142
+ /**
143
+ * What time steps are used in timeseries data
144
+ */
145
+ var UsedTimeseriesSteps;
146
+ (function (UsedTimeseriesSteps) {
147
+ UsedTimeseriesSteps["Year"] = "year";
148
+ UsedTimeseriesSteps["Quarter"] = "quarter";
149
+ UsedTimeseriesSteps["Month"] = "month";
150
+ UsedTimeseriesSteps["Week"] = "week";
151
+ UsedTimeseriesSteps["Day"] = "day";
152
+ })(UsedTimeseriesSteps || (UsedTimeseriesSteps = {}));
140
153
 
141
- export { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels, enumCombineValuesToString, enumValuesToArray, enumValuesToString, flattenObject, isInEnum, notEmptyString, randomNumberBetween, removeDuplicitiesFromArray, sortStringArray };
154
+ export { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels, UsedTimeseriesSteps, enumCombineValuesToString, enumValuesToArray, enumValuesToString, flattenObject, isInEnum, notEmptyString, randomNumberBetween, removeDuplicitiesFromArray, sortStringArray };
142
155
  //# sourceMappingURL=index.browser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.browser.js","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\" // OGC GeoPackage format\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,QAAkB,KAAK,QAAQ,CAAC,IAAI;AAEpE;;;;AAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,GAAU,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC;AAG1E;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,KAAK,KAAK;AAG3D;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAa,EAAE,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS;AAE7G;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,CAAC,SAAgB,EAAE,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC,GAAG,CAAC,QAAQ,IAAI,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS;AAElK;;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,oBAAoB,KAApB,oBAAoB,GAAA,EAAA,CAAA,CAAA;AAgBhC;;AAEG;IACS;AAAZ,CAAA,UAAY,cAAc,EAAA;AACtB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,cAAA,CAAA,KAAA,CAAA,GAAA,KAAW;IACX,cAAA,CAAA,mBAAA,CAAA,GAAA,qBAAyC,CAAA;AAC7C,CAAC,EAJW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"index.browser.js","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\", // OGC GeoPackage format\n MapStyle = \"mapStyle\", // Map style datasource\n Timeseries = \"timeseries\" // Timeseries datasource (with from-to and step)\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n\n/**\n * What time steps are used in timeseries data\n */\nexport enum UsedTimeseriesSteps{\n Year = \"year\",\n Quarter = \"quarter\",\n Month = \"month\",\n Week = \"week\",\n Day = \"day\"\n}"],"names":[],"mappings":"AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,QAAkB,KAAK,QAAQ,CAAC,IAAI;AAEpE;;;;AAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,GAAU,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC;AAG1E;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,KAAK,KAAK;AAG3D;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAa,EAAE,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,MA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,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,oBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;IACrB,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC7B,CAAC,EAhBW,oBAAoB,KAApB,oBAAoB,GAAA,EAAA,CAAA,CAAA;AAkBhC;;AAEG;IACS;AAAZ,CAAA,UAAY,cAAc,EAAA;AACtB,IAAA,cAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,cAAA,CAAA,KAAA,CAAA,GAAA,KAAW;IACX,cAAA,CAAA,mBAAA,CAAA,GAAA,qBAAyC,CAAA;AAC7C,CAAC,EAJW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;AAM1B;;AAEG;IACS;AAAZ,CAAA,UAAY,mBAAmB,EAAA;AAC3B,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,mBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,mBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,mBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,mBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACf,CAAC,EANW,mBAAmB,KAAnB,mBAAmB,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -131,7 +131,9 @@ exports.UsedDatasourceLabels = void 0;
131
131
  UsedDatasourceLabels["PostGIS"] = "postgis";
132
132
  UsedDatasourceLabels["WMTS"] = "wmts";
133
133
  UsedDatasourceLabels["WFS"] = "wfs";
134
- UsedDatasourceLabels["GeoPackage"] = "geopackage"; // OGC GeoPackage format
134
+ UsedDatasourceLabels["GeoPackage"] = "geopackage";
135
+ UsedDatasourceLabels["MapStyle"] = "mapStyle";
136
+ UsedDatasourceLabels["Timeseries"] = "timeseries"; // Timeseries datasource (with from-to and step)
135
137
  })(exports.UsedDatasourceLabels || (exports.UsedDatasourceLabels = {}));
136
138
  /**
137
139
  * What types of edges we use in metadata model
@@ -142,6 +144,17 @@ exports.UsedEdgeLabels = void 0;
142
144
  UsedEdgeLabels["Has"] = "HAS";
143
145
  UsedEdgeLabels["InPostgisLocation"] = "IN_POSTGIS_LOCATION"; // Edge to connect datasource with PostGIS location (schema, table, geometry column)
144
146
  })(exports.UsedEdgeLabels || (exports.UsedEdgeLabels = {}));
147
+ /**
148
+ * What time steps are used in timeseries data
149
+ */
150
+ exports.UsedTimeseriesSteps = void 0;
151
+ (function (UsedTimeseriesSteps) {
152
+ UsedTimeseriesSteps["Year"] = "year";
153
+ UsedTimeseriesSteps["Quarter"] = "quarter";
154
+ UsedTimeseriesSteps["Month"] = "month";
155
+ UsedTimeseriesSteps["Week"] = "week";
156
+ UsedTimeseriesSteps["Day"] = "day";
157
+ })(exports.UsedTimeseriesSteps || (exports.UsedTimeseriesSteps = {}));
145
158
 
146
159
  /**
147
160
  * Extract message from exception error (try-catch)
@@ -1 +1 @@
1
- {"version":3,"file":"index.node.cjs","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts","../src/node/api/errors.api.ts","../src/node/logging/logger.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\" // OGC GeoPackage format\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n","/**\n * Extract message from exception error (try-catch)\n * @param error error from catch block as any\n * @returns \n */\n export const messageFromError = (error: any) => error[\"message\"] as string\n\n/**\n * We miss a API parameter needed to process action\n */\nexport class InvalidRequestError extends Error{\n constructor(message: string){\n super(`Invalid Request: ${message}`)\n }\n}\n\n/**\n * Where client has general authorization issue\n */\nexport class AuthorizationError extends Error{\n constructor(){\n super(`Authorization has failed.`)\n }\n}","// logger.ts\nimport pino, { Logger } from 'pino'\nimport pretty from 'pino-pretty'\n\n/**\n * @typedef {Object} AppLogOptions\n * @property {string} label - The label for the log entry.\n * @property {string|number|boolean} [key] - Any extra fields.\n */\nexport type AppLogOptions = {\n label: string\n [key: string]: string|number|boolean\n}\n\nconst DEFAULT_LOG_OPTIONS: AppLogOptions = {\n label: 'App'\n}\n\n// create the pretty‐printing stream once\nconst prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n translateTime: 'yyyy-mm-dd HH:MM:ss'\n})\n\n// create your logger once and for all\nconst baseLogger: Logger = pino({}, prettyStream)\n\nexport class AppLogger {\n static info(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.info({ ...options, message })\n }\n\n static warn(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.warn({ ...options, message })\n }\n\n static error(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.error({ ...options, message })\n }\n\n static appStart(\n host: string,\n port: number,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n AppLogger.info(`Application started on ${host}:${port}`, options)\n }\n}"],"names":["UsedNodeLabels","UsedDatasourceLabels","UsedEdgeLabels"],"mappings":";;;;;AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,QAAkB,KAAK,QAAQ,CAAC,IAAI;AAEpE;;;;AAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,GAAU,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC;AAG1E;;;;AAIG;AACI,MAAM,cAAc,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AAA,UAAU,EAAE,IAAI;AAChB,IAAA,aAAa,EAAE;AAChB,CAAA,CAAC;AAEF;AACA,MAAM,UAAU,GAAW,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC;MAEpC,SAAS,CAAA;AACpB,IAAA,OAAO,IAAI,CACT,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC1C;AAEA,IAAA,OAAO,IAAI,CACT,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC1C;AAEA,IAAA,OAAO,KAAK,CACV,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C;IAEA,OAAO,QAAQ,CACb,IAAY,EACZ,IAAY,EACZ,UAAyB,mBAAmB,EAAA;QAE5C,SAAS,CAAC,IAAI,CAAC,CAAA,uBAAA,EAA0B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,EAAE,OAAO,CAAC;IACnE;AACD;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.node.cjs","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts","../src/node/api/errors.api.ts","../src/node/logging/logger.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\", // OGC GeoPackage format\n MapStyle = \"mapStyle\", // Map style datasource\n Timeseries = \"timeseries\" // Timeseries datasource (with from-to and step)\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n\n/**\n * What time steps are used in timeseries data\n */\nexport enum UsedTimeseriesSteps{\n Year = \"year\",\n Quarter = \"quarter\",\n Month = \"month\",\n Week = \"week\",\n Day = \"day\"\n}","/**\n * Extract message from exception error (try-catch)\n * @param error error from catch block as any\n * @returns \n */\n export const messageFromError = (error: any) => error[\"message\"] as string\n\n/**\n * We miss a API parameter needed to process action\n */\nexport class InvalidRequestError extends Error{\n constructor(message: string){\n super(`Invalid Request: ${message}`)\n }\n}\n\n/**\n * Where client has general authorization issue\n */\nexport class AuthorizationError extends Error{\n constructor(){\n super(`Authorization has failed.`)\n }\n}","// logger.ts\nimport pino, { Logger } from 'pino'\nimport pretty from 'pino-pretty'\n\n/**\n * @typedef {Object} AppLogOptions\n * @property {string} label - The label for the log entry.\n * @property {string|number|boolean} [key] - Any extra fields.\n */\nexport type AppLogOptions = {\n label: string\n [key: string]: string|number|boolean\n}\n\nconst DEFAULT_LOG_OPTIONS: AppLogOptions = {\n label: 'App'\n}\n\n// create the pretty‐printing stream once\nconst prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n translateTime: 'yyyy-mm-dd HH:MM:ss'\n})\n\n// create your logger once and for all\nconst baseLogger: Logger = pino({}, prettyStream)\n\nexport class AppLogger {\n static info(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.info({ ...options, message })\n }\n\n static warn(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.warn({ ...options, message })\n }\n\n static error(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.error({ ...options, message })\n }\n\n static appStart(\n host: string,\n port: number,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n AppLogger.info(`Application started on ${host}:${port}`, options)\n }\n}"],"names":["UsedNodeLabels","UsedDatasourceLabels","UsedEdgeLabels","UsedTimeseriesSteps"],"mappings":";;;;;AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG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C;IAC3C;IAEA,OAAO,QAAQ,CACb,IAAY,EACZ,IAAY,EACZ,UAAyB,mBAAmB,EAAA;QAE5C,SAAS,CAAC,IAAI,CAAC,CAAA,uBAAA,EAA0B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,EAAE,OAAO,CAAC;IACnE;AACD;;;;;;;;;;;;;;;;"}
@@ -129,7 +129,9 @@ var UsedDatasourceLabels;
129
129
  UsedDatasourceLabels["PostGIS"] = "postgis";
130
130
  UsedDatasourceLabels["WMTS"] = "wmts";
131
131
  UsedDatasourceLabels["WFS"] = "wfs";
132
- UsedDatasourceLabels["GeoPackage"] = "geopackage"; // OGC GeoPackage format
132
+ UsedDatasourceLabels["GeoPackage"] = "geopackage";
133
+ UsedDatasourceLabels["MapStyle"] = "mapStyle";
134
+ UsedDatasourceLabels["Timeseries"] = "timeseries"; // Timeseries datasource (with from-to and step)
133
135
  })(UsedDatasourceLabels || (UsedDatasourceLabels = {}));
134
136
  /**
135
137
  * What types of edges we use in metadata model
@@ -140,6 +142,17 @@ var UsedEdgeLabels;
140
142
  UsedEdgeLabels["Has"] = "HAS";
141
143
  UsedEdgeLabels["InPostgisLocation"] = "IN_POSTGIS_LOCATION"; // Edge to connect datasource with PostGIS location (schema, table, geometry column)
142
144
  })(UsedEdgeLabels || (UsedEdgeLabels = {}));
145
+ /**
146
+ * What time steps are used in timeseries data
147
+ */
148
+ var UsedTimeseriesSteps;
149
+ (function (UsedTimeseriesSteps) {
150
+ UsedTimeseriesSteps["Year"] = "year";
151
+ UsedTimeseriesSteps["Quarter"] = "quarter";
152
+ UsedTimeseriesSteps["Month"] = "month";
153
+ UsedTimeseriesSteps["Week"] = "week";
154
+ UsedTimeseriesSteps["Day"] = "day";
155
+ })(UsedTimeseriesSteps || (UsedTimeseriesSteps = {}));
143
156
 
144
157
  /**
145
158
  * Extract message from exception error (try-catch)
@@ -191,5 +204,5 @@ class AppLogger {
191
204
  }
192
205
  }
193
206
 
194
- export { AppLogger, AuthorizationError, InvalidRequestError, UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels, enumCombineValuesToString, enumValuesToArray, enumValuesToString, flattenObject, isInEnum, messageFromError, notEmptyString, randomNumberBetween, removeDuplicitiesFromArray, sortStringArray };
207
+ export { AppLogger, AuthorizationError, InvalidRequestError, UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels, UsedTimeseriesSteps, enumCombineValuesToString, enumValuesToArray, enumValuesToString, flattenObject, isInEnum, messageFromError, notEmptyString, randomNumberBetween, removeDuplicitiesFromArray, sortStringArray };
195
208
  //# sourceMappingURL=index.node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.node.js","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts","../src/node/api/errors.api.ts","../src/node/logging/logger.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\" // OGC GeoPackage format\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n","/**\n * Extract message from exception error (try-catch)\n * @param error error from catch block as any\n * @returns \n */\n export const messageFromError = (error: any) => error[\"message\"] as string\n\n/**\n * We miss a API parameter needed to process action\n */\nexport class InvalidRequestError extends Error{\n constructor(message: string){\n super(`Invalid Request: ${message}`)\n }\n}\n\n/**\n * Where client has general authorization issue\n */\nexport class AuthorizationError extends Error{\n constructor(){\n super(`Authorization has failed.`)\n }\n}","// logger.ts\nimport pino, { Logger } from 'pino'\nimport pretty from 'pino-pretty'\n\n/**\n * @typedef {Object} AppLogOptions\n * @property {string} label - The label for the log entry.\n * @property {string|number|boolean} [key] - Any extra fields.\n */\nexport type AppLogOptions = {\n label: string\n [key: string]: string|number|boolean\n}\n\nconst DEFAULT_LOG_OPTIONS: AppLogOptions = {\n label: 'App'\n}\n\n// create the pretty‐printing stream once\nconst prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n translateTime: 'yyyy-mm-dd HH:MM:ss'\n})\n\n// create your logger once and for all\nconst baseLogger: Logger = pino({}, prettyStream)\n\nexport class AppLogger {\n static info(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.info({ ...options, message })\n }\n\n static warn(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.warn({ ...options, message })\n }\n\n static error(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.error({ ...options, message })\n }\n\n static appStart(\n host: string,\n port: number,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n AppLogger.info(`Application started on ${host}:${port}`, options)\n }\n}"],"names":[],"mappings":";;;AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,QAAkB,KAAK,QAAQ,CAAC,IAAI;AAEpE;;;;AAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,GAAU,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC;AAG1E;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,KAAK,KAAK;AAG3D;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAa,EAAE,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS;AAE7G;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,CAAC,SAAgB,EAAE,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC,GAAG,CAAC,QAAQ,IAAI,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS;AAElK;;;;AAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,QAAa,KAAK,MAAM,CAA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,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C;IAEA,OAAO,QAAQ,CACb,IAAY,EACZ,IAAY,EACZ,UAAyB,mBAAmB,EAAA;QAE5C,SAAS,CAAC,IAAI,CAAC,CAAA,uBAAA,EAA0B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,EAAE,OAAO,CAAC;IACnE;AACD;;;;"}
1
+ {"version":3,"file":"index.node.js","sources":["../src/globals/coding/code.formating.ts","../src/globals/panther/enums.panther.ts","../src/node/api/errors.api.ts","../src/node/logging/logger.ts"],"sourcesContent":["/**\n * Check if the value in included in enum posibilities.\n * @param value Value we need to check\n * @param enumEntity Enum type we check againts the value\n * @returns Is the value in this enum?\n */\nexport const isInEnum = (value: any, enumEntity: any) => {\n const allEnumValues = Object.values(enumEntity) as string[]\n return allEnumValues.includes(value)\n }\n\n/**\n * Sort array of string elements\n * @param rawArray Raw unsorted array of elements\n * @returns Sorted string array\n */\nexport const sortStringArray = (rawArray: string[]) => rawArray.sort()\n\n/**\n * Remove all duplicity string items from an array\n * @param arr Original array with duplicities\n * @returns Array of original values\n */\nexport const removeDuplicitiesFromArray = (arr: any[]) => [...new Set(arr)]\n\n\n/**\n * Check if the string value is not ` \"\" `\n * @param value Value to check\n * @returns Boolean result about the truth\n */\nexport const notEmptyString = (value: string) => value !== \"\"\n\n\n/**\n * Return enum values as array of string\n * @param enumType Type of the enum from code\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumValuesToString = (enumType: any, separator = \", \") => Object.values(enumType).join(separator)\n\n/**\n * Return enum values as array of string\n * @param enumTypes Combination of enum types\n * @param separator Optional - separator character\n * @returns Array of enum possible values\n */\nexport const enumCombineValuesToString = (enumTypes: any[], separator = \", \") => enumTypes.map(enumType => enumValuesToString(enumType, separator)).join(separator)\n\n/**\n * Return all enum values as array\n * @param enumType What array we want to work with\n * @returns Array of enum values\n */\nexport const enumValuesToArray = (enumType: any) => Object.values(enumType) as string[]\n\n/**\n * Return random number (integer) between two values\n * @param min \n * @param max \n * @returns \n */\nexport const randomNumberBetween = (min: number, max: number) => {\n const minAr = Math.ceil(min)\n const maxAr = Math.floor(max)\n return Math.floor(Math.random()*(maxAr - minAr + 1) + min)\n}\n\n/**\n * Recursively flattens a nested object. The keys of the resulting object\n * will be the paths to the original values in the nested object, joined by dots.\n *\n * @param obj - The object to flatten.\n * @param prefix - The prefix to use for the keys in the flattened object. Defaults to an empty string.\n * @returns A new object with flattened keys.\n *\n * @example\n * ```typescript\n * const nestedObj = {\n * a: {\n * b: {\n * c: 1\n * }\n * },\n * d: 2\n * };\n * const flatObj = flattenObject(nestedObj);\n * console.log(flatObj);\n * // Output: { 'a.b.c': 1, 'a.b.d': 2 }\n * ```\n */\nexport const flattenObject = (obj: any, prefix = ''): Record<string, any> => {\n return Object.keys(obj).reduce((acc: Record<string, any>, key: string) => {\n const propName = prefix ? `${prefix}.${key}` : key\n if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {\n Object.assign(acc, flattenObject(obj[key], propName))\n } else {\n acc[propName] = obj[key]\n }\n return acc\n }, {})\n}","/**\n * What types of graph nodes we use in metadata model\n */\nexport enum UsedNodeLabels {\n Application = \"application\", // Application node (the root of the FE app)\n Datasource = \"datasource\", // Datasource node for data including GIS information\n Place = \"place\", // Place node for geographical information\n Period = \"period\", // Period node for time information\n AreaTree = \"areaTree\", // Area tree node for administrative division\n AreaTreeLevel = \"areaTreeLevel\", // Area tree level node for administrative division\n Layer = \"layer\", // Layer node for map layer (layer have a style and a datasource)\n Style = \"style\", // Style node for map layer or a feature\n Feature = \"feature\", // Feature node for map layer,\n Attribute = \"attribute\" // Attribute node for properties of entities, like \"temperature\", \"population\", etc.\n}\n\n/**\n * What datasources we use in the system\n */\nexport enum UsedDatasourceLabels {\n Attribute = \"attributeSource\", // Column(s) with attribute values\n Geojson = \"geojson\", // Geojson for web map\n WMS = \"wms\", // WMS online source\n COG = \"cloudOptimizedGeotiff\", // COG online source\n MVT = \"mvt\", // MVT (Mapbox Vector Tiles) source\n XYZ = \"xyz\", // XYZ tile source\n CSV = \"csv\", // CSV data source\n GeoTIFF = \"geotiff\", // GeoTIFF raster data\n Shapefile = \"shapefile\", // ESRI Shapefile format\n PostGIS = \"postgis\", // PostGIS database source\n WMTS = \"wmts\", // Web Map Tile Service\n WFS = \"wfs\", // Web Feature Service\n GeoPackage = \"geopackage\", // OGC GeoPackage format\n MapStyle = \"mapStyle\", // Map style datasource\n Timeseries = \"timeseries\" // Timeseries datasource (with from-to and step)\n}\n\n/**\n * What types of edges we use in metadata model\n */\nexport enum UsedEdgeLabels {\n RelatedTo = \"RELATED\", // Generic edge for any relation\n Has = \"HAS\", // Edge for ownership relation\n InPostgisLocation = \"IN_POSTGIS_LOCATION\" // Edge to connect datasource with PostGIS location (schema, table, geometry column)\n}\n\n/**\n * What time steps are used in timeseries data\n */\nexport enum UsedTimeseriesSteps{\n Year = \"year\",\n Quarter = \"quarter\",\n Month = \"month\",\n Week = \"week\",\n Day = \"day\"\n}","/**\n * Extract message from exception error (try-catch)\n * @param error error from catch block as any\n * @returns \n */\n export const messageFromError = (error: any) => error[\"message\"] as string\n\n/**\n * We miss a API parameter needed to process action\n */\nexport class InvalidRequestError extends Error{\n constructor(message: string){\n super(`Invalid Request: ${message}`)\n }\n}\n\n/**\n * Where client has general authorization issue\n */\nexport class AuthorizationError extends Error{\n constructor(){\n super(`Authorization has failed.`)\n }\n}","// logger.ts\nimport pino, { Logger } from 'pino'\nimport pretty from 'pino-pretty'\n\n/**\n * @typedef {Object} AppLogOptions\n * @property {string} label - The label for the log entry.\n * @property {string|number|boolean} [key] - Any extra fields.\n */\nexport type AppLogOptions = {\n label: string\n [key: string]: string|number|boolean\n}\n\nconst DEFAULT_LOG_OPTIONS: AppLogOptions = {\n label: 'App'\n}\n\n// create the pretty‐printing stream once\nconst prettyStream = pretty({\n colorize: true,\n levelFirst: true,\n translateTime: 'yyyy-mm-dd HH:MM:ss'\n})\n\n// create your logger once and for all\nconst baseLogger: Logger = pino({}, prettyStream)\n\nexport class AppLogger {\n static info(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.info({ ...options, message })\n }\n\n static warn(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.warn({ ...options, message })\n }\n\n static error(\n message: string,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n baseLogger.error({ ...options, message })\n }\n\n static appStart(\n host: string,\n port: number,\n options: AppLogOptions = DEFAULT_LOG_OPTIONS,\n ) {\n AppLogger.info(`Application started on ${host}:${port}`, options)\n }\n}"],"names":[],"mappings":";;;AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAa;AAC3D,IAAA,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEF;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,QAAkB,KAAK,QAAQ,CAAC,IAAI;AAEpE;;;;AAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,GAAU,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC;AAG1E;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,KAAK,KAAK,KAAK;AAG3D;;;;;AAKG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAa,EAAE,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS;AAE7G;;;;;AAKG;AACI,MAAM,yBAAyB,GAAG,CAAC,SAAgB,EAAE,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC,GAAG,CAAC,QAAQ,IAAI,kBAAkB,CAAC,QAAQ,EAAE,SA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AkB;AACzC,IAAA,KAAK,EAAE;CACR;AAED;AACA,MAAM,YAAY,GAAG,MAAM,CAAC;AAC1B,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,aAAa,EAAE;AAChB,CAAA,CAAC;AAEF;AACA,MAAM,UAAU,GAAW,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC;MAEpC,SAAS,CAAA;AACpB,IAAA,OAAO,IAAI,CACT,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC1C;AAEA,IAAA,OAAO,IAAI,CACT,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC1C;AAEA,IAAA,OAAO,KAAK,CACV,OAAe,EACf,UAAyB,mBAAmB,EAAA;QAE5C,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C;IAEA,OAAO,QAAQ,CACb,IAAY,EACZ,IAAY,EACZ,UAAyB,mBAAmB,EAAA;QAE5C,SAAS,CAAC,IAAI,CAAC,CAAA,uBAAA,EAA0B,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE,EAAE,OAAO,CAAC;IACnE;AACD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisatcz/ptr-be-core",
3
- "version": "0.0.1-dev.6",
3
+ "version": "0.0.1-dev.7",
4
4
  "description": "Shared core library for PTR BE services",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,12 +23,13 @@
23
23
  "scripts": {
24
24
  "yalc:publish": "yalc publish",
25
25
  "yalc:publish:push": "yalc publish --push",
26
- "build:clean": "rm -rf dist .rollup.cache tsconfig.tsbuildinfo",
27
26
  "dev": "npm run build:clean && rollup --config --watch",
28
- "build": "npm run build:clean && rollup --config",
29
- "build:tsc": "tsc --build tsconfig.prod.json",
27
+ "pack:check": "npm pack --dry-run",
28
+ "lint": "eslint",
30
29
  "test": "vitest --config vitest.config.ts",
31
- "pack:check": "npm pack --dry-run"
30
+ "build:clean": "rm -rf dist .rollup.cache tsconfig.tsbuildinfo",
31
+ "build": "npm run build:clean && rollup --config",
32
+ "before:push": "npm run lint && npm run build && npm run test"
32
33
  },
33
34
  "author": "",
34
35
  "license": "ISC",
@@ -42,6 +43,11 @@
42
43
  "@rollup/plugin-json": "^6.1.0",
43
44
  "@rollup/plugin-node-resolve": "^16.0.1",
44
45
  "@rollup/plugin-typescript": "^12.1.2",
46
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
47
+ "@typescript-eslint/parser": "^8.32.1",
48
+ "eslint": "^9.27.0",
49
+ "eslint-plugin-node": "^11.1.0",
50
+ "typescript-eslint": "^8.32.1",
45
51
  "@types/luxon": "^3.6.2",
46
52
  "@types/node": "^22.15.12",
47
53
  "barrelsby": "^2.8.1",
@@ -1,67 +0,0 @@
1
- /**
2
- * Entity that has relevant time interval.
3
- * Example: Period is connected to some time range.
4
- */
5
- export interface HasInterval {
6
- validIntervalIso: string;
7
- validFrom: number;
8
- validTo: number;
9
- }
10
- /**
11
- * Entity with custom configuration
12
- */
13
- export interface HasConfiguration {
14
- configuration: string;
15
- }
16
- /**
17
- * Place node - somewhere in the world
18
- */
19
- export interface HasGeometry {
20
- geometry: any;
21
- bbox: number[];
22
- }
23
- /**
24
- * Entity that has bands, e.g. satellite imagery
25
- * Bands have CSV format - order of values is important.
26
- * Bands are used to represent different spectral bands in satellite imagery.
27
- * Each band can have a name and a period (e.g., wavelength).
28
- */
29
- export interface HasBands {
30
- bands: number[];
31
- bandNames: string[];
32
- bandPeriods: string[];
33
- }
34
- /**
35
- * Place node - somewhere in the world
36
- */
37
- export interface HasLevels {
38
- level: number;
39
- }
40
- /**
41
- * Entity that has a URL, e.g. a link to a resource or a service.
42
- * This is used for entities that can be accessed via a URL.
43
- */
44
- export interface HasUrl {
45
- url: string;
46
- }
47
- /**
48
- * Entity that has a specific name, e.g. a unique identifier or a specific title.
49
- * This is used for entities that need to be identified by a specific name.
50
- */
51
- export interface HasSpecificName {
52
- specificName: string;
53
- }
54
- /**
55
- * Represents an entity that has a color property.
56
- * The color is defined as a hexadecimal color code.
57
- */
58
- export interface HasColor {
59
- color: string;
60
- }
61
- /**
62
- * Represents an entity that has a unit of measurement.
63
- */
64
- export interface HasUnits {
65
- unit: string;
66
- valueType: 'string' | 'number' | 'boolean' | 'date' | 'json';
67
- }