@gisatcz/ptr-be-core 0.0.1-dev.8 → 0.0.2

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.
@@ -4,7 +4,7 @@ var luxon = require('luxon');
4
4
  var pino = require('pino');
5
5
  var pretty = require('pino-pretty');
6
6
  var crypto = require('crypto');
7
- var lodash = require('lodash');
7
+ var _ = require('lodash');
8
8
 
9
9
  /**
10
10
  * Check if the value in included in enum posibilities.
@@ -398,7 +398,7 @@ const validateNodeLabels = (labels) => {
398
398
  if (labels === undefined || labels === null) {
399
399
  throw new InvalidRequestError("Graph node labels are required.");
400
400
  }
401
- if (!lodash.isArray(labels))
401
+ if (!_.isArray(labels))
402
402
  throw new InvalidRequestError(`Graph node labels must be an array of strings.`);
403
403
  if (labels.length === 0)
404
404
  throw new InvalidRequestError("Graph node labels array must contain at least one label.");
@@ -749,7 +749,7 @@ const parseSinglePantherNode = (bodyNodeEntity) => {
749
749
  */
750
750
  const parseParsePantherNodes = (body) => {
751
751
  const nodeArray = body;
752
- if (!lodash.isArray(nodeArray))
752
+ if (!_.isArray(nodeArray))
753
753
  throw new InvalidRequestError("Request: Grah nodes must be an array");
754
754
  return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity));
755
755
  };
@@ -832,7 +832,7 @@ const parseArrowsJson = (body) => {
832
832
  if (!("nodes" in body) || !("relationships" in body))
833
833
  throw new InvalidRequestError("Invalid JSON format: Missing nodes or relationships");
834
834
  // Check if nodes and relationships are arrays
835
- if (!lodash.isArray(body.nodes) || !lodash.isArray(body.relationships))
835
+ if (!_.isArray(body.nodes) || !_.isArray(body.relationships))
836
836
  throw new InvalidRequestError("Invalid JSON format: nodes and relationships must be arrays");
837
837
  // Extract nodes and relationships from the body
838
838
  const { nodes: rawNodes, relationships: rawEdges } = body;
@@ -869,7 +869,7 @@ const parseRichEdges = (body) => {
869
869
  return parsedEdge;
870
870
  };
871
871
  const edgesRaw = body;
872
- if (!lodash.isArray(edgesRaw))
872
+ if (!_.isArray(edgesRaw))
873
873
  throw new InvalidRequestError("Graph edges must be an array of edges");
874
874
  if (edgesRaw.length === 0)
875
875
  throw new InvalidRequestError("Graph edges array must not be empty");
@@ -889,7 +889,7 @@ const parseEqualEdges = (body) => {
889
889
  * @returns Parsed edge relation
890
890
  */
891
891
  const parseSingleEdgeRelation = (edgeRelation) => {
892
- if (!lodash.isArray(edgeRelation))
892
+ if (!_.isArray(edgeRelation))
893
893
  throw new InvalidRequestError("Every graph relation must be two element string tuple [string, string]");
894
894
  if (edgeRelation.length !== 2)
895
895
  throw new InvalidRequestError("Every graph relation must be two element string tuple [string, string]");
@@ -897,7 +897,7 @@ const parseEqualEdges = (body) => {
897
897
  throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`);
898
898
  return edgeRelation;
899
899
  };
900
- if (!lodash.isArray(relations))
900
+ if (!_.isArray(relations))
901
901
  throw new InvalidRequestError("Graph edges must be an array of tuples");
902
902
  const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge));
903
903
  return validatedGraphEdges;
@@ -1 +1 @@
1
- {"version":3,"file":"index.node.cjs","sources":["../src/globals/coding/code.formating.ts","../src/node/api/errors.api.ts","../src/globals/coding/code.dates.ts","../src/globals/coding/formats.csv.ts","../src/globals/panther/utils.panther.ts","../src/globals/panther/enums.panther.ts","../src/node/logging/logger.ts","../src/node/api/validations.shared.ts","../src/node/api/parse.changeNodes.ts","../src/node/api/parse.arrows.json.ts","../src/node/api/parse.changesEdges.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 * 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}","import { DateTime } from \"luxon\"\nimport { InvalidRequestError } from \"../../node/api/errors.api\"\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestamp = (regime: \"milisecond\" | \"second\" = \"milisecond\"): number => {\n const timestamp = DateTime.now().toMillis()\n return regime === \"second\" ? Math.round((timestamp / 1000)) : timestamp\n}\n\n/**\n * Convert epoch time value into ISO format\n * @param epochValue Epoch value of the timestamp\n * @returns ISO format of the date\n */\nexport const epochToIsoFormat = (epochValue: number) => DateTime.fromMillis(epochValue).toISO() as string\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestampIso = () => {\n const timestamp = DateTime.now().toISO()\n return timestamp as string\n}\n\n/**\n * Check if input date is valid for ISO format\n * @param dateToCheck \n * @returns \n */\n export const hasIsoFormat = (dateToCheck: string) => {\n try{\n const toDate = new Date(Date.parse(dateToCheck))\n const isoCheck = toDate.toISOString().includes(dateToCheck) \n return isoCheck\n }\n catch{\n return false\n }\n}\n\n/**\n * Convert date in ISO formtat to milisecond timestamp\n * @param isoDate Date in ISO 8601 format\n * @returns Timestamp representing the date in miliseconds\n */\nexport const isoDateToTimestamp = (isoDate: string) => DateTime.fromISO(isoDate).toMillis()\n\n/**\n * Format ISO 8601 interval to from-to values\n * @param interval Defined inteval in ISO format (from/to) of the UTC\n * @returns Tuple - from timestamp and to timestamp\n */\nexport const isoIntervalToTimestamps = (interval: string): [number, number] => {\n\n // Split the interval into two parts\n const intervals = interval.split(\"/\")\n\n // interval as a single year has just one part\n if (intervals.length == 1) {\n const newIso = `${interval}-01-01/${interval}-12-31`\n return isoIntervalToTimestamps(newIso)\n }\n\n // interval with two parts or less than one\n else if (intervals.length > 2 || intervals.length < 1)\n throw new InvalidRequestError(\"Interval can have only two parameters\")\n\n // valid interval with two parts\n else {\n if (!intervals.every(interval => hasIsoFormat(interval)))\n throw new InvalidRequestError(\"Parameter utcIntervalIso is not ISO 8601 time interval (date01/date02) or year\");\n\n const [int1, int2] = intervals.map(intervalIso => {\n const cleared = intervalIso.replace(\" \", \"\")\n return isoDateToTimestamp(cleared)\n })\n\n return [int1, int2]\n }\n}\n","// TODO: Cover by tests\n// TODO: mode to ptr-be-core as general CSV methods\n\n\n/**\n * Parses a single line of CSV-formatted strings into an array of trimmed string values.\n *\n * @param csvStingsLine - A string representing a single line of comma-separated values.\n * @returns An array of strings, each representing a trimmed value from the CSV line.\n */\nexport const csvParseStrings = (csvStingsLine: string): string[] => {\n return csvStingsLine.split(\",\").map((value: string) => value.trim());\n}\n\n/**\n * Parses a comma-separated string of numbers into an array of numbers.\n *\n * @param csvNumbersLine - A string containing numbers separated by commas (e.g., \"1, 2, 3.5\").\n * @returns An array of numbers parsed from the input string.\n */\nexport const csvParseNumbers = (csvNumbersLine: string): number[] => {\n return csvNumbersLine.split(\",\").map((value: string) => parseFloat(value.trim()));\n}","import { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"./enums.panther\"\nimport { GraphEdge } from \"./models.edges\"\nimport { FullPantherEntity } from \"./models.nodes\"\n\n/**\n * Finds the first node in the provided list that contains the specified label.\n *\n * Searches the given array of FullPantherEntity objects and returns the first entity\n * whose `labels` array includes the provided label.\n *\n * @param nodes - Array of FullPantherEntity objects to search through.\n * @param label - Label to match; may be a UsedDatasourceLabels or UsedNodeLabels.\n * @returns The first FullPantherEntity whose `labels` includes `label`, or `undefined`\n * if no such entity is found.\n *\n * @remarks\n * - The search stops at the first match (uses `Array.prototype.find`).\n * - Label comparison is exact (uses `Array.prototype.includes`), so it is case-sensitive\n * and requires the same string instance/value.\n *\n * @example\n * const result = findNodeByLabel(nodes, 'datasource-main');\n * if (result) {\n * // found a node that has the 'datasource-main' label\n * }\n */\nexport const findNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity | undefined => {\n return nodes.find(n => n.labels.includes(label))\n}\n\n/**\n * Filters an array of FullPantherEntity objects, returning only those that contain the specified label.\n *\n * The function performs a shallow, non-mutating filter: it returns a new array and does not modify the input.\n * Matching is done using Array.prototype.includes on each entity's `labels` array (strict equality).\n *\n * @param nodes - The array of entities to filter.\n * @param label - The label to match; can be a UsedDatasourceLabels or UsedNodeLabels value.\n * @returns A new array containing only the entities whose `labels` array includes the provided label.\n *\n * @remarks\n * Time complexity is O(n * m) where n is the number of entities and m is the average number of labels per entity.\n *\n * @example\n * ```ts\n * const matched = filterNodeByLabel(entities, 'MY_LABEL');\n * ```\n */\nexport const filterNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity[] => {\n return nodes.filter(n => n.labels.includes(label))\n}\n\n/**\n * Finds the first edge in the provided array whose label strictly equals the given label.\n *\n * @param edges - Array of GraphEdge objects to search.\n * @param label - The UsedEdgeLabels value to match against each edge's `label` property.\n * @returns The first matching GraphEdge if found; otherwise `undefined`.\n *\n * @example\n * const edge = findEdgeByLabel(edges, 'dependency');\n * if (edge) {\n * // handle found edge\n * }\n */\nexport const findEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge | undefined => {\n return edges.find(e => e.label === label)\n}\n\n/**\n * Filters a list of GraphEdge objects by a specific edge label.\n *\n * Returns a new array containing only those edges whose `label` property\n * strictly equals the provided `label` argument. The original `edges`\n * array is not mutated.\n *\n * @param edges - Array of GraphEdge objects to filter.\n * @param label - The label to match; comparison is performed using strict (`===`) equality.\n * @returns A new array of GraphEdge objects whose `label` matches the provided label. Returns an empty array if no edges match.\n *\n * @remarks\n * Time complexity: O(n), where n is the number of edges.\n *\n * @example\n * // const result = filterEdgeByLabel(edges, 'CONNECTS');\n */\nexport const filterEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge[] => {\n return edges.filter(e => e.label === label)\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}","// 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}","import { isArray } from \"lodash\"\nimport { enumCombineValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\n\n\n/**\n * Validates the provided labels to ensure they are an array of strings and that each label\n * is a valid value within the specified enums (`UsedNodeLabels` or `UsedDatasourceLabels`).\n *\n * @param labels - The input to validate, expected to be an array of strings.\n * @throws {InvalidRequestError} If `labels` is not an array.\n * @throws {InvalidRequestError} If any label in the array is not a valid value in the combined enums.\n */\nexport const validateNodeLabels = (labels: unknown) => {\n\n if (labels === undefined || labels === null) {\n throw new InvalidRequestError(\"Graph node labels are required.\")\n }\n\n if (!isArray(labels))\n throw new InvalidRequestError(`Graph node labels must be an array of strings.`)\n\n if (labels.length === 0)\n throw new InvalidRequestError(\"Graph node labels array must contain at least one label.\")\n\n for (const label of labels) {\n if (!isInEnum(label, UsedNodeLabels) && !isInEnum(label, UsedDatasourceLabels))\n throw new InvalidRequestError(`Label ${label} is not supported. Value must be one of: ${enumCombineValuesToString([UsedNodeLabels, UsedDatasourceLabels])}`)\n }\n}\n\n/**\n * Validate a graph edge label.\n *\n * The value is first checked for presence (not `undefined`/`null`), then for type (`string`).\n * The string is normalised using `toLocaleLowerCase()` and validated against the `UsedEdgeLabels` enum.\n *\n * @param label - The value to validate; expected to be a string representing an edge label.\n *\n * @throws {InvalidRequestError} If `label` is `undefined` or `null`.\n * @throws {InvalidRequestError} If `label` is not a `string`.\n * @throws {InvalidRequestError} If the normalised label is not one of the supported values in `UsedEdgeLabels`.\n *\n * @example\n * validateEdgeLabel('CONNECTS'); // succeeds if 'connects' exists in UsedEdgeLabels\n *\n * @remarks\n * Membership is determined via `isInEnum` and error messages include the allowed values (via `enumCombineValuesToString`).\n */\nexport const validateEdgeLabel = (label: unknown) => {\n\n if (label === undefined || label === null) {\n throw new InvalidRequestError(\"Graph edge label is required.\")\n }\n\n if (typeof label !== \"string\") {\n throw new InvalidRequestError(`Graph edge label must be a string.`)\n }\n\n const normalisedLabel = label.toLocaleLowerCase()\n\n if (!isInEnum(normalisedLabel, UsedEdgeLabels)) {\n throw new InvalidRequestError(`Graph edge label '${normalisedLabel}' is not supported. Value must be one of: ${enumCombineValuesToString([UsedEdgeLabels])}`)\n }\n}","import { randomUUID } from \"crypto\"\nimport { isArray } from \"lodash\"\nimport { Unsure } from \"../../globals/coding/code.types\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\nimport { HasConfiguration, HasGeometry, HasInterval, HasLevels, HasUnits } from \"../../globals/panther/models.nodes.properties.general\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { HasBands, HasColor, HasDocumentId, HasSpecificName, HasTimeseries, HasUrl } from \"../../globals/panther/models.nodes.properties.datasources\"\nimport { UsedDatasourceLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { isoIntervalToTimestamps, nowTimestamp } from \"../../globals/coding/code.dates\"\nimport { csvParseNumbers, csvParseStrings } from \"../../globals/coding/formats.csv\"\n\n/**\n * Extract and parse basic entitry from request body\n * This parse function is used in other parsers, becuase basic entity is part of other models\n * @param bodyRaw Body from http request\n * @param key Optional - key value for existing recods in database\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseBasicNodeFromBody = (bodyRaw: unknown): PantherEntity => {\n const {\n labels,\n nameInternal,\n nameDisplay,\n description,\n key\n } = bodyRaw as any\n\n validateNodeLabels(labels)\n\n const basicGraphResult: PantherEntity = {\n lastUpdatedAt: nowTimestamp(),\n key: key ?? randomUUID(),\n nameInternal: nameInternal as string ?? \"\",\n nameDisplay: nameDisplay as string ?? \"\",\n description: description as string ?? \"\",\n labels: labels as string[]\n }\n\n return basicGraphResult\n}\n\n/**\n * Parse node of type area tree level \n * @param levelBody Content from request\n * @returns Parsed area tree level\n */\nconst paseHasLevels = (levelBody: unknown): HasLevels => {\n const { level } = levelBody as any\n\n const result: HasLevels = {\n level\n }\n\n return result\n}\n\n/**\n * Parse body to period entity\n * @param bodyRaw Request body content - can be anything\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseWithInterval = (bodyRaw: any): HasInterval => {\n const {\n intervalISO,\n } = bodyRaw\n\n if (!intervalISO)\n throw new InvalidRequestError(\"Period must have UTC interval in ISO format\")\n\n const [from, to] = isoIntervalToTimestamps(intervalISO)\n const intervalResult: HasInterval = {\n validIntervalIso: intervalISO,\n validFrom: from,\n validTo: to\n }\n\n return intervalResult\n}\n\nconst parseWithConfiguration = (bodyRaw: any, required = false): Unsure<HasConfiguration> => {\n const { configuration } = bodyRaw\n\n if (!configuration && required)\n throw new InvalidRequestError(\"Configuration is required\")\n\n if (!configuration)\n return\n\n return { configuration: typeof configuration === 'string' ? configuration : JSON.stringify(configuration) }\n}\n\n/**\n * Parse body to place entity\n * @param bodyRaw Request body content - can be anything\n * @returns \n */\nconst parseHasGeometry = (bodyRaw: any) => {\n const {\n bbox,\n geometry,\n } = bodyRaw\n\n /**\n * Convert bbox from CSV string to array of 4 coordinates\n * @returns Parsed bounding box from CSV string\n */\n const bboxFromCSV = () => {\n const bboxFromCSV = csvParseNumbers(bbox as string)\n\n if (bboxFromCSV.length !== 4)\n throw new InvalidRequestError(\"bbox must be an array of 4 numbers\")\n\n return bboxFromCSV\n }\n\n const geometryResult: HasGeometry = {\n bbox: bbox ? bboxFromCSV() : [],\n geometry: geometry ?? \"\"\n }\n\n return geometryResult\n}\n\n/**\n * Parses the input object and extracts the `url` property.\n * If the `url` property is not present or is undefined, it returns `null` for `url`.\n *\n * @param bodyRaw - The raw input object that may contain a `url` property.\n * @returns An object with a single `url` property, which is either the extracted value or `null`.\n */\nconst parseHasUrl = (bodyRaw: any, isRequired = true): Unsure<HasUrl> => {\n const { url } = bodyRaw\n\n if (isRequired && !url)\n throw new InvalidRequestError(\"Url is required for the node\")\n\n if (!url) return\n\n return { url }\n}\n\n/**\n * Parses the `specificName` property from the provided object and returns it wrapped in a `HasSpecificName` type.\n *\n * @param bodyRaw - The raw input object potentially containing the `specificName` property.\n * @param isRequired - If `true`, throws an `InvalidRequestError` when `specificName` is missing. Defaults to `false`.\n * @returns An object with the `specificName` property if present, or `undefined` if not required and missing.\n * @throws {InvalidRequestError} If `isRequired` is `true` and `specificName` is not provided.\n */\nconst parseHasSpecificName = (bodyRaw: any, isRequired = false): Unsure<HasSpecificName> => {\n const { specificName } = bodyRaw\n\n if (isRequired && !specificName)\n throw new InvalidRequestError(\"Property specificName is required for the node\")\n\n if (!specificName) return\n\n return { specificName }\n}\n\n\n\n/**\n * Parses the `color` property from the provided `bodyRaw` object and returns it\n * wrapped in an object if it exists. If the `isRequired` flag is set to `true`\n * and the `color` property is missing, an error is thrown.\n *\n * @param bodyRaw - The raw input object containing the `color` property.\n * @param isRequired - A boolean indicating whether the `color` property is required.\n * Defaults to `false`.\n * @returns An object containing the `color` property if it exists, or `undefined` if not required.\n * @throws {InvalidRequestError} If `isRequired` is `true` and the `color` property is missing.\n */\nconst parseWithColor = (bodyRaw: any, isRequired = false): Unsure<HasColor> => {\n const { color } = bodyRaw\n\n if (isRequired && !color)\n throw new InvalidRequestError(\"Property color is required for the node\")\n\n if (!color) return\n\n return { color }\n}\n\n/**\n * Parses the provided raw body object to extract unit and valueType properties.\n * Ensures that the required properties are present if `isRequired` is set to true.\n *\n * @param bodyRaw - The raw input object containing the properties to parse.\n * @param isRequired - A boolean indicating whether the `unit` and `valueType` properties are mandatory.\n * Defaults to `false`.\n * @returns An object containing the `unit` and `valueType` properties, or `null` if they are not provided.\n * @throws {InvalidRequestError} If `isRequired` is true and either `unit` or `valueType` is missing.\n */\nconst parseWithUnits = (bodyRaw: any, isRequired = false): Unsure<HasUnits> => {\n const { unit, valueType } = bodyRaw\n\n if (isRequired && (!unit || !valueType))\n throw new InvalidRequestError(\"Properties unit and valueType are required for the node\")\n\n return { unit: unit ?? null, valueType: valueType ?? null }\n}\n\n/**\n * Parse and validate the `documentId` property from a raw request body.\n *\n * Extracts `documentId` from `bodyRaw` and returns it as an object matching\n * HasDocumentId, wrapped in the Unsure type. If `documentId` is missing or\n * falsy, the function throws an InvalidRequestError.\n *\n * @param bodyRaw - The raw request body (e.g. parsed JSON) expected to contain `documentId`.\n * @returns Unsure<HasDocumentId> — an object with the `documentId` property.\n * @throws {InvalidRequestError} Thrown when `documentId` is not present on `bodyRaw`.\n */\nconst parseHasDocumentId = (bodyRaw: any): HasDocumentId => {\n const { documentId } = bodyRaw\n\n if (!documentId)\n throw new InvalidRequestError(\"Property documentId is required for the node\")\n\n return { documentId }\n}\n\n/**\n * Parse timeseries information from a raw request body.\n *\n * Delegates interval parsing to `parseWithInterval(bodyRaw)` and then\n * attaches the `step` value from the provided `bodyRaw` to the resulting\n * timeseries object. The function does not mutate the input object.\n *\n * @param bodyRaw - Raw request payload (unknown/loose shape). Expected to\n * contain whatever fields `parseWithInterval` requires and\n * optionally a `step` property.\n * @returns A `HasTimeseries` object composed of the interval-related fields\n * returned by `parseWithInterval` plus the `step` property from\n * `bodyRaw` (which may be `undefined` if not present).\n * @throws Rethrows any errors produced by `parseWithInterval` when the input\n * body is invalid for interval parsing.\n */\nconst parseWithTimeseries = (bodyRaw: any): HasTimeseries => {\n const timeseriesIntervals = parseWithInterval(bodyRaw)\n const { step } = bodyRaw\n\n if (!step)\n throw new InvalidRequestError(\"Property step is required for timeseries datasource\")\n\n return { ...timeseriesIntervals, step }\n}\n\n/**\n * Parses the `bands`, `bandNames`, and `bandPeriods` properties from the provided raw input object.\n * \n * - If `required` is `true`, throws an `InvalidRequestError` if any of the properties are missing.\n * - Converts CSV strings to arrays:\n * - `bands` is parsed as an array of numbers.\n * - `bandNames` and `bandPeriods` are parsed as arrays of trimmed strings.\n * - Returns an object containing any of the parsed properties that were present in the input.\n *\n * @param bodyRaw - The raw input object potentially containing `bands`, `bandNames`, and `bandPeriods` as CSV strings.\n * @param required - If `true`, all three properties are required and an error is thrown if any are missing. Defaults to `false`.\n * @returns An object with the parsed properties, or `undefined` if none are present.\n * @throws {InvalidRequestError} If `required` is `true` and any property is missing.\n */\nconst parseHasBands = (bodyRaw: any, required = false): Unsure<HasBands> => {\n const { bands, bandNames, bandPeriods } = bodyRaw\n let result: any\n\n if (required && (!bands || !bandNames || !bandPeriods))\n throw new InvalidRequestError(\"Bands, bandNames and bandPeriods are required for the node\")\n\n if (bands) {\n result = result ?? {}\n Object.assign(result, { bands: csvParseNumbers(bands as string) })\n }\n\n if (bandNames) {\n result = result ?? {}\n Object.assign(result, { bandNames: csvParseStrings(bandNames as string) })\n }\n\n if (bandPeriods) {\n result = result ?? {}\n Object.assign(result, { bandPeriods: csvParseStrings(bandPeriods as string) })\n }\n\n return result as Unsure<HasBands>\n}\n\n/**\n * Parse single graph node from body entity \n * @param bodyNodeEntity Entity from request body\n * @returns Parsed object for specific node\n */\nexport const parseSinglePantherNode = (bodyNodeEntity: unknown): FullPantherEntity => {\n\n // Parse basic node properties first\n let node: PantherEntity = parseBasicNodeFromBody(bodyNodeEntity)\n\n // Parse additional properties for specific node types\n // single for loop is used to avoid multiple labels array iterations\n for (const label of node.labels) {\n\n // If node is a Period, add interval information\n if (label === UsedNodeLabels.Period)\n node = { ...node, ...parseWithInterval(bodyNodeEntity) };\n\n // If node is a Place, add geographic information\n if (label === UsedNodeLabels.Place)\n node = { ...node, ...parseHasGeometry(bodyNodeEntity) };\n\n // If node is a Datasource or Application, add configuration when available\n if (label === UsedNodeLabels.Datasource || label === UsedNodeLabels.Application) {\n const parsedConfiguration = parseWithConfiguration(bodyNodeEntity, false);\n node = parsedConfiguration ? { ...node, ...parsedConfiguration } : node;\n }\n\n // If node is a online Datasource, add URL information\n const datasourcesWithUrl = [\n UsedDatasourceLabels.COG,\n UsedDatasourceLabels.WMS,\n UsedDatasourceLabels.MVT,\n UsedDatasourceLabels.WFS,\n UsedDatasourceLabels.WMTS,\n UsedDatasourceLabels.Geojson\n ];\n\n // If node is a Datasource with URL, add URL information\n if (datasourcesWithUrl.includes(label as UsedDatasourceLabels)) {\n const parsedUrl = parseHasUrl(bodyNodeEntity, true);\n node = parsedUrl ? { ...node, ...parsedUrl } : node;\n }\n\n // If node is a Datasource with bands, add bands information\n const datasourcesWithPossibleBands = [\n UsedDatasourceLabels.COG,\n ];\n\n // If node is a Datasource can have bands, add them\n if (datasourcesWithPossibleBands.includes(label as UsedDatasourceLabels)) {\n const parsedBands = parseHasBands(bodyNodeEntity, false);\n node = parsedBands ? { ...node, ...parsedBands } : node;\n }\n\n // If node is a Style, add specific name information\n if (label === UsedNodeLabels.Style || label === UsedDatasourceLabels.MapStyle) {\n const parsedSpecificName = parseHasSpecificName(bodyNodeEntity, true);\n node = parsedSpecificName ? { ...node, ...parsedSpecificName } : node;\n }\n\n // If node is a Datasource with timeseries, add timeseries information\n if (label === UsedDatasourceLabels.Timeseries) {\n const parsedTimeseries = parseWithTimeseries(bodyNodeEntity);\n node = { ...node, ...parsedTimeseries };\n }\n\n // If node is a Datasource with document ID, add document ID information\n const datasourcesWithDocumentId = [\n UsedDatasourceLabels.PostGIS,\n UsedDatasourceLabels.Timeseries\n ];\n\n if (datasourcesWithDocumentId.includes(label as UsedDatasourceLabels)) {\n const parsedDocumentId = parseHasDocumentId(bodyNodeEntity);\n node = { ...node, ...parsedDocumentId };\n }\n\n // If node is an AreaTreeLevel, add level information\n if (label === UsedNodeLabels.AreaTreeLevel)\n node = { ...node, ...paseHasLevels(bodyNodeEntity) };\n\n // If node is an Attribute, add color information and units\n if (label === UsedNodeLabels.Attribute) {\n const parsedColor = parseWithColor(bodyNodeEntity, false);\n const parsedUnit = parseWithUnits(bodyNodeEntity, false);\n \n // Add parsed unit if available\n node = parsedUnit ? { \n ...node, \n ...parsedUnit \n } : node;\n\n // Add parsed color if available\n node = parsedColor ? { \n ...node, \n ...parsedColor \n } : node;\n }\n\n }\n\n return node;\n}\n\n/**\n * Parse array of graph nodes from request body\n * @param body Array of graph nodes inside http request body\n * @returns Array of parsed graph nodes in correct form\n */\nexport const parseParsePantherNodes = (body: unknown): FullPantherEntity[] => {\n const nodeArray = body as any[]\n\n if (!isArray(nodeArray))\n throw new InvalidRequestError(\"Request: Grah nodes must be an array\")\n\n return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity))\n}\n\n// TODO: cover by better testing","import { randomUUID } from \"crypto\"\nimport { isArray } from \"lodash\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { parseSinglePantherNode } from \"./parse.changeNodes\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\nimport { isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\n\n/**\n * Parses a node object from the Arrows JSON format and converts it into a `PantherEntity`.\n *\n * Validates that the node's labels are arrays of supported enum values, and constructs\n * a `PantherEntity` object with the appropriate properties. Throws an `InvalidRequestError`\n * if the labels are not valid.\n *\n * @param node - The node object from the Arrows JSON to parse.\n * @returns A `PantherEntity` object representing the parsed node.\n * @throws {InvalidRequestError} If the node's labels are not an array of supported values.\n */\nconst parseNodeFromArrows = (node: any): FullPantherEntity => {\n const { labels, properties, id, caption } = node\n\n validateNodeLabels(labels)\n\n const basicGraphResult: FullPantherEntity = parseSinglePantherNode({\n labels: labels as string[],\n key: properties.key as string ?? id ?? randomUUID(),\n nameDisplay: caption ?? properties.nameDisplay as string ?? \"\",\n ...properties\n })\n\n return basicGraphResult\n}\n\n\n/**\n * Parses an edge object from the Arrows format and converts it into a `GraphEdge`.\n *\n * @param edge - The edge object to parse, containing details about the graph edge.\n * @returns A `GraphEdge` object containing the parsed edge nodes, label, and properties.\n *\n * @throws {InvalidRequestError} If the edge does not have a type (`label`).\n * @throws {InvalidRequestError} If the edge type (`label`) is not supported.\n * @throws {InvalidRequestError} If the edge does not have properties.\n * @throws {InvalidRequestError} If the edge does not have `fromId` or `toId`.\n * @throws {InvalidRequestError} If the `fromId` and `toId` are the same.\n */\nconst parseEdgeFromArrows = (edge: any): GraphEdge => {\n const {\n fromId: from,\n toId: to,\n type,\n properties\n } = edge\n\n // Determine the label, defaulting to \"RelatedTo\" if the type is invalid or not provided\n const label = (typeof type === \"string\" && type.trim().length > 0) \n ? type.trim() as UsedEdgeLabels\n : UsedEdgeLabels.RelatedTo\n \n // validate the edge properties\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge type '${label}' is not supported`)\n\n // edge must have a properties\n if (!properties)\n throw new InvalidRequestError(`Graph edge must have properties`)\n\n // edge must have fromId and toId\n if (!from || !to)\n throw new InvalidRequestError(`Graph edge must have fromId and toId`)\n\n if (from === to)\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${from} leads to ${to})`)\n\n // prepare relation tuple\n const result: GraphRelation = [from, to]\n\n // construct the parsed edge object\n const parsedEdge: GraphEdge = {\n edgeNodes: result,\n label,\n properties\n }\n\n // return the parsed edge\n return parsedEdge\n}\n\n/**\n * Parses a JSON object representing nodes and relationships (edges) from the Arrows JSON.\n *\n * @param body - The input JSON object to parse. Expected to contain `nodes` and `relationships` arrays.\n * @returns An object containing parsed `nodes` and `edges` arrays.\n * @throws {InvalidRequestError} If the input is not a valid object, or if required properties are missing or not arrays.\n */\nexport const parseArrowsJson = (body: unknown): { nodes: FullPantherEntity[]; edges: GraphEdge[] } => {\n\n // Check if the body is a valid object\n if (typeof body !== \"object\" || body === null)\n throw new InvalidRequestError(\"Invalid JSON format\")\n\n // Check if the body contains the required properties\n if (!(\"nodes\" in body) || !(\"relationships\" in body))\n throw new InvalidRequestError(\"Invalid JSON format: Missing nodes or relationships\")\n\n // Check if nodes and relationships are arrays\n if (!isArray((body as any).nodes) || !isArray((body as any).relationships))\n throw new InvalidRequestError(\"Invalid JSON format: nodes and relationships must be arrays\")\n\n // Extract nodes and relationships from the body\n const { nodes: rawNodes, relationships: rawEdges } = body as any\n\n // Define default values for nodes and edges\n const nodes: PantherEntity[] = rawNodes ?? []\n const edges: GraphEdge[] = rawEdges ?? []\n\n // Parse nodes and edges using the defined functions\n const parsedNodes = nodes.map((node: any) => parseNodeFromArrows(node))\n const parsedEdges = edges.map((edge: any) => parseEdgeFromArrows(edge))\n\n return {\n nodes: parsedNodes,\n edges: parsedEdges\n }\n}","import { isArray } from \"lodash\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { enumValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\n\nexport const parseRichEdges = (body: unknown): GraphEdge[] => {\n\n const parseSingleEdge = (edge: unknown): GraphEdge => {\n\n const {label, fromKey, toKey, properties } = edge as any\n\n if (!label || typeof label !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string label\")\n\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge label is not allowed (${label}). Must be one of: ${enumValuesToString(UsedEdgeLabels)}`)\n\n if (!fromKey || typeof fromKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string fromKey\")\n\n if (!toKey || typeof toKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string toKey\")\n\n if (fromKey === toKey)\n throw new InvalidRequestError(`Cannot connect two same keys in graph edge (${fromKey})`)\n\n const parsedEdge: GraphEdge = {\n label: label as UsedEdgeLabels,\n edgeNodes: [fromKey, toKey],\n properties: properties || {}\n }\n\n return parsedEdge\n }\n const edgesRaw = body as any[]\n \n if (!isArray(edgesRaw))\n throw new InvalidRequestError(\"Graph edges must be an array of edges\")\n\n if (edgesRaw.length === 0)\n throw new InvalidRequestError(\"Graph edges array must not be empty\")\n\n const parsedEdges = edgesRaw.map(edge => parseSingleEdge(edge))\n return parsedEdges\n}\n\n/**\n * Parse body to graph relation\n * @param body Body from request\n * @returns Graph relation\n */\nexport const parseEqualEdges = (body: unknown): GraphRelation[] => {\n const relations = body as any[]\n\n /**\n * Check single edge relation and parse it\n * @param edgeRelation \n * @returns Parsed edge relation\n */\n const parseSingleEdgeRelation = (edgeRelation: unknown): GraphRelation => {\n\n if (!isArray(edgeRelation))\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation.length !== 2)\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation[0] === edgeRelation[1])\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`)\n\n return edgeRelation as GraphRelation\n }\n\n if (!isArray(relations))\n throw new InvalidRequestError(\"Graph edges must be an array of tuples\")\n\n const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge))\n\n return validatedGraphEdges\n} "],"names":["DateTime","UsedNodeLabels","UsedDatasourceLabels","UsedEdgeLabels","UsedTimeseriesSteps","isArray","randomUUID"],"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,CAAC,MAAM,CAAC,QAAQ;AAE1E;;;;;AAKG;MACU,mBAAmB,GAAG,CAAC,GAAW,EAAE,GAAW,KAAI;IAC9D,MAAM,KAAK,GAAG,I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AACnB,QAAA,MAAM,IAAI,mBAAmB,CAAC,wCAAwC,CAAC;AAE3E,IAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAEhF,IAAA,OAAO,mBAAmB;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.node.cjs","sources":["../src/globals/coding/code.formating.ts","../src/node/api/errors.api.ts","../src/globals/coding/code.dates.ts","../src/globals/coding/formats.csv.ts","../src/globals/panther/utils.panther.ts","../src/globals/panther/enums.panther.ts","../src/node/logging/logger.ts","../src/node/api/validations.shared.ts","../src/node/api/parse.changeNodes.ts","../src/node/api/parse.arrows.json.ts","../src/node/api/parse.changesEdges.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 * 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}","import { DateTime } from \"luxon\"\nimport { InvalidRequestError } from \"../../node/api/errors.api\"\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestamp = (regime: \"milisecond\" | \"second\" = \"milisecond\"): number => {\n const timestamp = DateTime.now().toMillis()\n return regime === \"second\" ? Math.round((timestamp / 1000)) : timestamp\n}\n\n/**\n * Convert epoch time value into ISO format\n * @param epochValue Epoch value of the timestamp\n * @returns ISO format of the date\n */\nexport const epochToIsoFormat = (epochValue: number) => DateTime.fromMillis(epochValue).toISO() as string\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestampIso = () => {\n const timestamp = DateTime.now().toISO()\n return timestamp as string\n}\n\n/**\n * Check if input date is valid for ISO format\n * @param dateToCheck \n * @returns \n */\n export const hasIsoFormat = (dateToCheck: string) => {\n try{\n const toDate = new Date(Date.parse(dateToCheck))\n const isoCheck = toDate.toISOString().includes(dateToCheck) \n return isoCheck\n }\n catch{\n return false\n }\n}\n\n/**\n * Convert date in ISO formtat to milisecond timestamp\n * @param isoDate Date in ISO 8601 format\n * @returns Timestamp representing the date in miliseconds\n */\nexport const isoDateToTimestamp = (isoDate: string) => DateTime.fromISO(isoDate).toMillis()\n\n/**\n * Format ISO 8601 interval to from-to values\n * @param interval Defined inteval in ISO format (from/to) of the UTC\n * @returns Tuple - from timestamp and to timestamp\n */\nexport const isoIntervalToTimestamps = (interval: string): [number, number] => {\n\n // Split the interval into two parts\n const intervals = interval.split(\"/\")\n\n // interval as a single year has just one part\n if (intervals.length == 1) {\n const newIso = `${interval}-01-01/${interval}-12-31`\n return isoIntervalToTimestamps(newIso)\n }\n\n // interval with two parts or less than one\n else if (intervals.length > 2 || intervals.length < 1)\n throw new InvalidRequestError(\"Interval can have only two parameters\")\n\n // valid interval with two parts\n else {\n if (!intervals.every(interval => hasIsoFormat(interval)))\n throw new InvalidRequestError(\"Parameter utcIntervalIso is not ISO 8601 time interval (date01/date02) or year\");\n\n const [int1, int2] = intervals.map(intervalIso => {\n const cleared = intervalIso.replace(\" \", \"\")\n return isoDateToTimestamp(cleared)\n })\n\n return [int1, int2]\n }\n}\n","// TODO: Cover by tests\n// TODO: mode to ptr-be-core as general CSV methods\n\n\n/**\n * Parses a single line of CSV-formatted strings into an array of trimmed string values.\n *\n * @param csvStingsLine - A string representing a single line of comma-separated values.\n * @returns An array of strings, each representing a trimmed value from the CSV line.\n */\nexport const csvParseStrings = (csvStingsLine: string): string[] => {\n return csvStingsLine.split(\",\").map((value: string) => value.trim());\n}\n\n/**\n * Parses a comma-separated string of numbers into an array of numbers.\n *\n * @param csvNumbersLine - A string containing numbers separated by commas (e.g., \"1, 2, 3.5\").\n * @returns An array of numbers parsed from the input string.\n */\nexport const csvParseNumbers = (csvNumbersLine: string): number[] => {\n return csvNumbersLine.split(\",\").map((value: string) => parseFloat(value.trim()));\n}","import { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"./enums.panther\"\nimport { GraphEdge } from \"./models.edges\"\nimport { FullPantherEntity } from \"./models.nodes\"\n\n/**\n * Finds the first node in the provided list that contains the specified label.\n *\n * Searches the given array of FullPantherEntity objects and returns the first entity\n * whose `labels` array includes the provided label.\n *\n * @param nodes - Array of FullPantherEntity objects to search through.\n * @param label - Label to match; may be a UsedDatasourceLabels or UsedNodeLabels.\n * @returns The first FullPantherEntity whose `labels` includes `label`, or `undefined`\n * if no such entity is found.\n *\n * @remarks\n * - The search stops at the first match (uses `Array.prototype.find`).\n * - Label comparison is exact (uses `Array.prototype.includes`), so it is case-sensitive\n * and requires the same string instance/value.\n *\n * @example\n * const result = findNodeByLabel(nodes, 'datasource-main');\n * if (result) {\n * // found a node that has the 'datasource-main' label\n * }\n */\nexport const findNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity | undefined => {\n return nodes.find(n => n.labels.includes(label))\n}\n\n/**\n * Filters an array of FullPantherEntity objects, returning only those that contain the specified label.\n *\n * The function performs a shallow, non-mutating filter: it returns a new array and does not modify the input.\n * Matching is done using Array.prototype.includes on each entity's `labels` array (strict equality).\n *\n * @param nodes - The array of entities to filter.\n * @param label - The label to match; can be a UsedDatasourceLabels or UsedNodeLabels value.\n * @returns A new array containing only the entities whose `labels` array includes the provided label.\n *\n * @remarks\n * Time complexity is O(n * m) where n is the number of entities and m is the average number of labels per entity.\n *\n * @example\n * ```ts\n * const matched = filterNodeByLabel(entities, 'MY_LABEL');\n * ```\n */\nexport const filterNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity[] => {\n return nodes.filter(n => n.labels.includes(label))\n}\n\n/**\n * Finds the first edge in the provided array whose label strictly equals the given label.\n *\n * @param edges - Array of GraphEdge objects to search.\n * @param label - The UsedEdgeLabels value to match against each edge's `label` property.\n * @returns The first matching GraphEdge if found; otherwise `undefined`.\n *\n * @example\n * const edge = findEdgeByLabel(edges, 'dependency');\n * if (edge) {\n * // handle found edge\n * }\n */\nexport const findEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge | undefined => {\n return edges.find(e => e.label === label)\n}\n\n/**\n * Filters a list of GraphEdge objects by a specific edge label.\n *\n * Returns a new array containing only those edges whose `label` property\n * strictly equals the provided `label` argument. The original `edges`\n * array is not mutated.\n *\n * @param edges - Array of GraphEdge objects to filter.\n * @param label - The label to match; comparison is performed using strict (`===`) equality.\n * @returns A new array of GraphEdge objects whose `label` matches the provided label. Returns an empty array if no edges match.\n *\n * @remarks\n * Time complexity: O(n), where n is the number of edges.\n *\n * @example\n * // const result = filterEdgeByLabel(edges, 'CONNECTS');\n */\nexport const filterEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge[] => {\n return edges.filter(e => e.label === label)\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}","// 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}","import _ from \"lodash\"\nimport { enumCombineValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\n\n\n/**\n * Validates the provided labels to ensure they are an array of strings and that each label\n * is a valid value within the specified enums (`UsedNodeLabels` or `UsedDatasourceLabels`).\n *\n * @param labels - The input to validate, expected to be an array of strings.\n * @throws {InvalidRequestError} If `labels` is not an array.\n * @throws {InvalidRequestError} If any label in the array is not a valid value in the combined enums.\n */\nexport const validateNodeLabels = (labels: unknown) => {\n\n if (labels === undefined || labels === null) {\n throw new InvalidRequestError(\"Graph node labels are required.\")\n }\n\n if (!_.isArray(labels))\n throw new InvalidRequestError(`Graph node labels must be an array of strings.`)\n\n if (labels.length === 0)\n throw new InvalidRequestError(\"Graph node labels array must contain at least one label.\")\n\n for (const label of labels) {\n if (!isInEnum(label, UsedNodeLabels) && !isInEnum(label, UsedDatasourceLabels))\n throw new InvalidRequestError(`Label ${label} is not supported. Value must be one of: ${enumCombineValuesToString([UsedNodeLabels, UsedDatasourceLabels])}`)\n }\n}\n\n/**\n * Validate a graph edge label.\n *\n * The value is first checked for presence (not `undefined`/`null`), then for type (`string`).\n * The string is normalised using `toLocaleLowerCase()` and validated against the `UsedEdgeLabels` enum.\n *\n * @param label - The value to validate; expected to be a string representing an edge label.\n *\n * @throws {InvalidRequestError} If `label` is `undefined` or `null`.\n * @throws {InvalidRequestError} If `label` is not a `string`.\n * @throws {InvalidRequestError} If the normalised label is not one of the supported values in `UsedEdgeLabels`.\n *\n * @example\n * validateEdgeLabel('CONNECTS'); // succeeds if 'connects' exists in UsedEdgeLabels\n *\n * @remarks\n * Membership is determined via `isInEnum` and error messages include the allowed values (via `enumCombineValuesToString`).\n */\nexport const validateEdgeLabel = (label: unknown) => {\n\n if (label === undefined || label === null) {\n throw new InvalidRequestError(\"Graph edge label is required.\")\n }\n\n if (typeof label !== \"string\") {\n throw new InvalidRequestError(`Graph edge label must be a string.`)\n }\n\n const normalisedLabel = label.toLocaleLowerCase()\n\n if (!isInEnum(normalisedLabel, UsedEdgeLabels)) {\n throw new InvalidRequestError(`Graph edge label '${normalisedLabel}' is not supported. Value must be one of: ${enumCombineValuesToString([UsedEdgeLabels])}`)\n }\n}","import { randomUUID } from \"crypto\"\nimport _ from \"lodash\"\nimport { Unsure } from \"../../globals/coding/code.types\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\nimport { HasConfiguration, HasGeometry, HasInterval, HasLevels, HasUnits } from \"../../globals/panther/models.nodes.properties.general\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { HasBands, HasColor, HasDocumentId, HasSpecificName, HasTimeseries, HasUrl } from \"../../globals/panther/models.nodes.properties.datasources\"\nimport { UsedDatasourceLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { isoIntervalToTimestamps, nowTimestamp } from \"../../globals/coding/code.dates\"\nimport { csvParseNumbers, csvParseStrings } from \"../../globals/coding/formats.csv\"\n\n/**\n * Extract and parse basic entitry from request body\n * This parse function is used in other parsers, becuase basic entity is part of other models\n * @param bodyRaw Body from http request\n * @param key Optional - key value for existing recods in database\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseBasicNodeFromBody = (bodyRaw: unknown): PantherEntity => {\n const {\n labels,\n nameInternal,\n nameDisplay,\n description,\n key\n } = bodyRaw as any\n\n validateNodeLabels(labels)\n\n const basicGraphResult: PantherEntity = {\n lastUpdatedAt: nowTimestamp(),\n key: key ?? randomUUID(),\n nameInternal: nameInternal as string ?? \"\",\n nameDisplay: nameDisplay as string ?? \"\",\n description: description as string ?? \"\",\n labels: labels as string[]\n }\n\n return basicGraphResult\n}\n\n/**\n * Parse node of type area tree level \n * @param levelBody Content from request\n * @returns Parsed area tree level\n */\nconst paseHasLevels = (levelBody: unknown): HasLevels => {\n const { level } = levelBody as any\n\n const result: HasLevels = {\n level\n }\n\n return result\n}\n\n/**\n * Parse body to period entity\n * @param bodyRaw Request body content - can be anything\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseWithInterval = (bodyRaw: any): HasInterval => {\n const {\n intervalISO,\n } = bodyRaw\n\n if (!intervalISO)\n throw new InvalidRequestError(\"Period must have UTC interval in ISO format\")\n\n const [from, to] = isoIntervalToTimestamps(intervalISO)\n const intervalResult: HasInterval = {\n validIntervalIso: intervalISO,\n validFrom: from,\n validTo: to\n }\n\n return intervalResult\n}\n\nconst parseWithConfiguration = (bodyRaw: any, required = false): Unsure<HasConfiguration> => {\n const { configuration } = bodyRaw\n\n if (!configuration && required)\n throw new InvalidRequestError(\"Configuration is required\")\n\n if (!configuration)\n return\n\n return { configuration: typeof configuration === 'string' ? configuration : JSON.stringify(configuration) }\n}\n\n/**\n * Parse body to place entity\n * @param bodyRaw Request body content - can be anything\n * @returns \n */\nconst parseHasGeometry = (bodyRaw: any) => {\n const {\n bbox,\n geometry,\n } = bodyRaw\n\n /**\n * Convert bbox from CSV string to array of 4 coordinates\n * @returns Parsed bounding box from CSV string\n */\n const bboxFromCSV = () => {\n const bboxFromCSV = csvParseNumbers(bbox as string)\n\n if (bboxFromCSV.length !== 4)\n throw new InvalidRequestError(\"bbox must be an array of 4 numbers\")\n\n return bboxFromCSV\n }\n\n const geometryResult: HasGeometry = {\n bbox: bbox ? bboxFromCSV() : [],\n geometry: geometry ?? \"\"\n }\n\n return geometryResult\n}\n\n/**\n * Parses the input object and extracts the `url` property.\n * If the `url` property is not present or is undefined, it returns `null` for `url`.\n *\n * @param bodyRaw - The raw input object that may contain a `url` property.\n * @returns An object with a single `url` property, which is either the extracted value or `null`.\n */\nconst parseHasUrl = (bodyRaw: any, isRequired = true): Unsure<HasUrl> => {\n const { url } = bodyRaw\n\n if (isRequired && !url)\n throw new InvalidRequestError(\"Url is required for the node\")\n\n if (!url) return\n\n return { url }\n}\n\n/**\n * Parses the `specificName` property from the provided object and returns it wrapped in a `HasSpecificName` type.\n *\n * @param bodyRaw - The raw input object potentially containing the `specificName` property.\n * @param isRequired - If `true`, throws an `InvalidRequestError` when `specificName` is missing. Defaults to `false`.\n * @returns An object with the `specificName` property if present, or `undefined` if not required and missing.\n * @throws {InvalidRequestError} If `isRequired` is `true` and `specificName` is not provided.\n */\nconst parseHasSpecificName = (bodyRaw: any, isRequired = false): Unsure<HasSpecificName> => {\n const { specificName } = bodyRaw\n\n if (isRequired && !specificName)\n throw new InvalidRequestError(\"Property specificName is required for the node\")\n\n if (!specificName) return\n\n return { specificName }\n}\n\n\n\n/**\n * Parses the `color` property from the provided `bodyRaw` object and returns it\n * wrapped in an object if it exists. If the `isRequired` flag is set to `true`\n * and the `color` property is missing, an error is thrown.\n *\n * @param bodyRaw - The raw input object containing the `color` property.\n * @param isRequired - A boolean indicating whether the `color` property is required.\n * Defaults to `false`.\n * @returns An object containing the `color` property if it exists, or `undefined` if not required.\n * @throws {InvalidRequestError} If `isRequired` is `true` and the `color` property is missing.\n */\nconst parseWithColor = (bodyRaw: any, isRequired = false): Unsure<HasColor> => {\n const { color } = bodyRaw\n\n if (isRequired && !color)\n throw new InvalidRequestError(\"Property color is required for the node\")\n\n if (!color) return\n\n return { color }\n}\n\n/**\n * Parses the provided raw body object to extract unit and valueType properties.\n * Ensures that the required properties are present if `isRequired` is set to true.\n *\n * @param bodyRaw - The raw input object containing the properties to parse.\n * @param isRequired - A boolean indicating whether the `unit` and `valueType` properties are mandatory.\n * Defaults to `false`.\n * @returns An object containing the `unit` and `valueType` properties, or `null` if they are not provided.\n * @throws {InvalidRequestError} If `isRequired` is true and either `unit` or `valueType` is missing.\n */\nconst parseWithUnits = (bodyRaw: any, isRequired = false): Unsure<HasUnits> => {\n const { unit, valueType } = bodyRaw\n\n if (isRequired && (!unit || !valueType))\n throw new InvalidRequestError(\"Properties unit and valueType are required for the node\")\n\n return { unit: unit ?? null, valueType: valueType ?? null }\n}\n\n/**\n * Parse and validate the `documentId` property from a raw request body.\n *\n * Extracts `documentId` from `bodyRaw` and returns it as an object matching\n * HasDocumentId, wrapped in the Unsure type. If `documentId` is missing or\n * falsy, the function throws an InvalidRequestError.\n *\n * @param bodyRaw - The raw request body (e.g. parsed JSON) expected to contain `documentId`.\n * @returns Unsure<HasDocumentId> — an object with the `documentId` property.\n * @throws {InvalidRequestError} Thrown when `documentId` is not present on `bodyRaw`.\n */\nconst parseHasDocumentId = (bodyRaw: any): HasDocumentId => {\n const { documentId } = bodyRaw\n\n if (!documentId)\n throw new InvalidRequestError(\"Property documentId is required for the node\")\n\n return { documentId }\n}\n\n/**\n * Parse timeseries information from a raw request body.\n *\n * Delegates interval parsing to `parseWithInterval(bodyRaw)` and then\n * attaches the `step` value from the provided `bodyRaw` to the resulting\n * timeseries object. The function does not mutate the input object.\n *\n * @param bodyRaw - Raw request payload (unknown/loose shape). Expected to\n * contain whatever fields `parseWithInterval` requires and\n * optionally a `step` property.\n * @returns A `HasTimeseries` object composed of the interval-related fields\n * returned by `parseWithInterval` plus the `step` property from\n * `bodyRaw` (which may be `undefined` if not present).\n * @throws Rethrows any errors produced by `parseWithInterval` when the input\n * body is invalid for interval parsing.\n */\nconst parseWithTimeseries = (bodyRaw: any): HasTimeseries => {\n const timeseriesIntervals = parseWithInterval(bodyRaw)\n const { step } = bodyRaw\n\n if (!step)\n throw new InvalidRequestError(\"Property step is required for timeseries datasource\")\n\n return { ...timeseriesIntervals, step }\n}\n\n/**\n * Parses the `bands`, `bandNames`, and `bandPeriods` properties from the provided raw input object.\n * \n * - If `required` is `true`, throws an `InvalidRequestError` if any of the properties are missing.\n * - Converts CSV strings to arrays:\n * - `bands` is parsed as an array of numbers.\n * - `bandNames` and `bandPeriods` are parsed as arrays of trimmed strings.\n * - Returns an object containing any of the parsed properties that were present in the input.\n *\n * @param bodyRaw - The raw input object potentially containing `bands`, `bandNames`, and `bandPeriods` as CSV strings.\n * @param required - If `true`, all three properties are required and an error is thrown if any are missing. Defaults to `false`.\n * @returns An object with the parsed properties, or `undefined` if none are present.\n * @throws {InvalidRequestError} If `required` is `true` and any property is missing.\n */\nconst parseHasBands = (bodyRaw: any, required = false): Unsure<HasBands> => {\n const { bands, bandNames, bandPeriods } = bodyRaw\n let result: any\n\n if (required && (!bands || !bandNames || !bandPeriods))\n throw new InvalidRequestError(\"Bands, bandNames and bandPeriods are required for the node\")\n\n if (bands) {\n result = result ?? {}\n Object.assign(result, { bands: csvParseNumbers(bands as string) })\n }\n\n if (bandNames) {\n result = result ?? {}\n Object.assign(result, { bandNames: csvParseStrings(bandNames as string) })\n }\n\n if (bandPeriods) {\n result = result ?? {}\n Object.assign(result, { bandPeriods: csvParseStrings(bandPeriods as string) })\n }\n\n return result as Unsure<HasBands>\n}\n\n/**\n * Parse single graph node from body entity \n * @param bodyNodeEntity Entity from request body\n * @returns Parsed object for specific node\n */\nexport const parseSinglePantherNode = (bodyNodeEntity: unknown): FullPantherEntity => {\n\n // Parse basic node properties first\n let node: PantherEntity = parseBasicNodeFromBody(bodyNodeEntity)\n\n // Parse additional properties for specific node types\n // single for loop is used to avoid multiple labels array iterations\n for (const label of node.labels) {\n\n // If node is a Period, add interval information\n if (label === UsedNodeLabels.Period)\n node = { ...node, ...parseWithInterval(bodyNodeEntity) };\n\n // If node is a Place, add geographic information\n if (label === UsedNodeLabels.Place)\n node = { ...node, ...parseHasGeometry(bodyNodeEntity) };\n\n // If node is a Datasource or Application, add configuration when available\n if (label === UsedNodeLabels.Datasource || label === UsedNodeLabels.Application) {\n const parsedConfiguration = parseWithConfiguration(bodyNodeEntity, false);\n node = parsedConfiguration ? { ...node, ...parsedConfiguration } : node;\n }\n\n // If node is a online Datasource, add URL information\n const datasourcesWithUrl = [\n UsedDatasourceLabels.COG,\n UsedDatasourceLabels.WMS,\n UsedDatasourceLabels.MVT,\n UsedDatasourceLabels.WFS,\n UsedDatasourceLabels.WMTS,\n UsedDatasourceLabels.Geojson\n ];\n\n // If node is a Datasource with URL, add URL information\n if (datasourcesWithUrl.includes(label as UsedDatasourceLabels)) {\n const parsedUrl = parseHasUrl(bodyNodeEntity, true);\n node = parsedUrl ? { ...node, ...parsedUrl } : node;\n }\n\n // If node is a Datasource with bands, add bands information\n const datasourcesWithPossibleBands = [\n UsedDatasourceLabels.COG,\n ];\n\n // If node is a Datasource can have bands, add them\n if (datasourcesWithPossibleBands.includes(label as UsedDatasourceLabels)) {\n const parsedBands = parseHasBands(bodyNodeEntity, false);\n node = parsedBands ? { ...node, ...parsedBands } : node;\n }\n\n // If node is a Style, add specific name information\n if (label === UsedNodeLabels.Style || label === UsedDatasourceLabels.MapStyle) {\n const parsedSpecificName = parseHasSpecificName(bodyNodeEntity, true);\n node = parsedSpecificName ? { ...node, ...parsedSpecificName } : node;\n }\n\n // If node is a Datasource with timeseries, add timeseries information\n if (label === UsedDatasourceLabels.Timeseries) {\n const parsedTimeseries = parseWithTimeseries(bodyNodeEntity);\n node = { ...node, ...parsedTimeseries };\n }\n\n // If node is a Datasource with document ID, add document ID information\n const datasourcesWithDocumentId = [\n UsedDatasourceLabels.PostGIS,\n UsedDatasourceLabels.Timeseries\n ];\n\n if (datasourcesWithDocumentId.includes(label as UsedDatasourceLabels)) {\n const parsedDocumentId = parseHasDocumentId(bodyNodeEntity);\n node = { ...node, ...parsedDocumentId };\n }\n\n // If node is an AreaTreeLevel, add level information\n if (label === UsedNodeLabels.AreaTreeLevel)\n node = { ...node, ...paseHasLevels(bodyNodeEntity) };\n\n // If node is an Attribute, add color information and units\n if (label === UsedNodeLabels.Attribute) {\n const parsedColor = parseWithColor(bodyNodeEntity, false);\n const parsedUnit = parseWithUnits(bodyNodeEntity, false);\n \n // Add parsed unit if available\n node = parsedUnit ? { \n ...node, \n ...parsedUnit \n } : node;\n\n // Add parsed color if available\n node = parsedColor ? { \n ...node, \n ...parsedColor \n } : node;\n }\n\n }\n\n return node;\n}\n\n/**\n * Parse array of graph nodes from request body\n * @param body Array of graph nodes inside http request body\n * @returns Array of parsed graph nodes in correct form\n */\nexport const parseParsePantherNodes = (body: unknown): FullPantherEntity[] => {\n const nodeArray = body as any[]\n\n if (!_.isArray(nodeArray))\n throw new InvalidRequestError(\"Request: Grah nodes must be an array\")\n\n return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity))\n}\n\n// TODO: cover by better testing","import { randomUUID } from \"crypto\"\nimport _ from \"lodash\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { parseSinglePantherNode } from \"./parse.changeNodes\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\nimport { isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\n\n/**\n * Parses a node object from the Arrows JSON format and converts it into a `PantherEntity`.\n *\n * Validates that the node's labels are arrays of supported enum values, and constructs\n * a `PantherEntity` object with the appropriate properties. Throws an `InvalidRequestError`\n * if the labels are not valid.\n *\n * @param node - The node object from the Arrows JSON to parse.\n * @returns A `PantherEntity` object representing the parsed node.\n * @throws {InvalidRequestError} If the node's labels are not an array of supported values.\n */\nconst parseNodeFromArrows = (node: any): FullPantherEntity => {\n const { labels, properties, id, caption } = node\n\n validateNodeLabels(labels)\n\n const basicGraphResult: FullPantherEntity = parseSinglePantherNode({\n labels: labels as string[],\n key: properties.key as string ?? id ?? randomUUID(),\n nameDisplay: caption ?? properties.nameDisplay as string ?? \"\",\n ...properties\n })\n\n return basicGraphResult\n}\n\n\n/**\n * Parses an edge object from the Arrows format and converts it into a `GraphEdge`.\n *\n * @param edge - The edge object to parse, containing details about the graph edge.\n * @returns A `GraphEdge` object containing the parsed edge nodes, label, and properties.\n *\n * @throws {InvalidRequestError} If the edge does not have a type (`label`).\n * @throws {InvalidRequestError} If the edge type (`label`) is not supported.\n * @throws {InvalidRequestError} If the edge does not have properties.\n * @throws {InvalidRequestError} If the edge does not have `fromId` or `toId`.\n * @throws {InvalidRequestError} If the `fromId` and `toId` are the same.\n */\nconst parseEdgeFromArrows = (edge: any): GraphEdge => {\n const {\n fromId: from,\n toId: to,\n type,\n properties\n } = edge\n\n // Determine the label, defaulting to \"RelatedTo\" if the type is invalid or not provided\n const label = (typeof type === \"string\" && type.trim().length > 0) \n ? type.trim() as UsedEdgeLabels\n : UsedEdgeLabels.RelatedTo\n \n // validate the edge properties\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge type '${label}' is not supported`)\n\n // edge must have a properties\n if (!properties)\n throw new InvalidRequestError(`Graph edge must have properties`)\n\n // edge must have fromId and toId\n if (!from || !to)\n throw new InvalidRequestError(`Graph edge must have fromId and toId`)\n\n if (from === to)\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${from} leads to ${to})`)\n\n // prepare relation tuple\n const result: GraphRelation = [from, to]\n\n // construct the parsed edge object\n const parsedEdge: GraphEdge = {\n edgeNodes: result,\n label,\n properties\n }\n\n // return the parsed edge\n return parsedEdge\n}\n\n/**\n * Parses a JSON object representing nodes and relationships (edges) from the Arrows JSON.\n *\n * @param body - The input JSON object to parse. Expected to contain `nodes` and `relationships` arrays.\n * @returns An object containing parsed `nodes` and `edges` arrays.\n * @throws {InvalidRequestError} If the input is not a valid object, or if required properties are missing or not arrays.\n */\nexport const parseArrowsJson = (body: unknown): { nodes: FullPantherEntity[]; edges: GraphEdge[] } => {\n\n // Check if the body is a valid object\n if (typeof body !== \"object\" || body === null)\n throw new InvalidRequestError(\"Invalid JSON format\")\n\n // Check if the body contains the required properties\n if (!(\"nodes\" in body) || !(\"relationships\" in body))\n throw new InvalidRequestError(\"Invalid JSON format: Missing nodes or relationships\")\n\n // Check if nodes and relationships are arrays\n if (!_.isArray((body as any).nodes) || !_.isArray((body as any).relationships))\n throw new InvalidRequestError(\"Invalid JSON format: nodes and relationships must be arrays\")\n\n // Extract nodes and relationships from the body\n const { nodes: rawNodes, relationships: rawEdges } = body as any\n\n // Define default values for nodes and edges\n const nodes: PantherEntity[] = rawNodes ?? []\n const edges: GraphEdge[] = rawEdges ?? []\n\n // Parse nodes and edges using the defined functions\n const parsedNodes = nodes.map((node: any) => parseNodeFromArrows(node))\n const parsedEdges = edges.map((edge: any) => parseEdgeFromArrows(edge))\n\n return {\n nodes: parsedNodes,\n edges: parsedEdges\n }\n}","import _ from \"lodash\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { enumValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\n\nexport const parseRichEdges = (body: unknown): GraphEdge[] => {\n\n const parseSingleEdge = (edge: unknown): GraphEdge => {\n\n const {label, fromKey, toKey, properties } = edge as any\n\n if (!label || typeof label !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string label\")\n\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge label is not allowed (${label}). Must be one of: ${enumValuesToString(UsedEdgeLabels)}`)\n\n if (!fromKey || typeof fromKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string fromKey\")\n\n if (!toKey || typeof toKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string toKey\")\n\n if (fromKey === toKey)\n throw new InvalidRequestError(`Cannot connect two same keys in graph edge (${fromKey})`)\n\n const parsedEdge: GraphEdge = {\n label: label as UsedEdgeLabels,\n edgeNodes: [fromKey, toKey],\n properties: properties || {}\n }\n\n return parsedEdge\n }\n const edgesRaw = body as any[]\n \n if (!_.isArray(edgesRaw))\n throw new InvalidRequestError(\"Graph edges must be an array of edges\")\n\n if (edgesRaw.length === 0)\n throw new InvalidRequestError(\"Graph edges array must not be empty\")\n\n const parsedEdges = edgesRaw.map(edge => parseSingleEdge(edge))\n return parsedEdges\n}\n\n/**\n * Parse body to graph relation\n * @param body Body from request\n * @returns Graph relation\n */\nexport const parseEqualEdges = (body: unknown): GraphRelation[] => {\n const relations = body as any[]\n\n /**\n * Check single edge relation and parse it\n * @param edgeRelation \n * @returns Parsed edge relation\n */\n const parseSingleEdgeRelation = (edgeRelation: unknown): GraphRelation => {\n\n if (!_.isArray(edgeRelation))\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation.length !== 2)\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation[0] === edgeRelation[1])\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`)\n\n return edgeRelation as GraphRelation\n }\n\n if (!_.isArray(relations))\n throw new InvalidRequestError(\"Graph edges must be an array of tuples\")\n\n const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge))\n\n return validatedGraphEdges\n} "],"names":["DateTime","UsedNodeLabels","UsedDatasourceLabels","UsedEdgeLabels","UsedTimeseriesSteps","randomUUID"],"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;AAE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AQ,CAAC,MAAM,KAAK,CAAC;AACrB,QAAA,MAAM,IAAI,mBAAmB,CAAC,qCAAqC,CAAC;AAExE,IAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/D,IAAA,OAAO,WAAW;AACtB;AAEA;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,IAAa,KAAqB;IAC9D,MAAM,SAAS,GAAG,IAAa;AAE/B;;;;AAIG;AACH,IAAA,MAAM,uBAAuB,GAAG,CAAC,YAAqB,KAAmB;AAErE,QAAA,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;AACxB,YAAA,MAAM,IAAI,mBAAmB,CAAC,wEAAwE,CAAC;AAE3G,QAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;AACzB,YAAA,MAAM,IAAI,mBAAmB,CAAC,wEAAwE,CAAC;QAE3G,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC;YACnC,MAAM,IAAI,mBAAmB,CAAC,CAAA,gDAAA,EAAmD,YAAY,CAAC,CAAC,CAAC,CAAA,CAAA,CAAG,CAAC;AAExG,QAAA,OAAO,YAA6B;AACxC,IAAA,CAAC;AAED,IAAA,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACrB,QAAA,MAAM,IAAI,mBAAmB,CAAC,wCAAwC,CAAC;AAE3E,IAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAEhF,IAAA,OAAO,mBAAmB;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import { DateTime } from 'luxon';
2
2
  import pino from 'pino';
3
3
  import pretty from 'pino-pretty';
4
4
  import { randomUUID } from 'crypto';
5
- import { isArray } from 'lodash';
5
+ import _ from 'lodash';
6
6
 
7
7
  /**
8
8
  * Check if the value in included in enum posibilities.
@@ -396,7 +396,7 @@ const validateNodeLabels = (labels) => {
396
396
  if (labels === undefined || labels === null) {
397
397
  throw new InvalidRequestError("Graph node labels are required.");
398
398
  }
399
- if (!isArray(labels))
399
+ if (!_.isArray(labels))
400
400
  throw new InvalidRequestError(`Graph node labels must be an array of strings.`);
401
401
  if (labels.length === 0)
402
402
  throw new InvalidRequestError("Graph node labels array must contain at least one label.");
@@ -747,7 +747,7 @@ const parseSinglePantherNode = (bodyNodeEntity) => {
747
747
  */
748
748
  const parseParsePantherNodes = (body) => {
749
749
  const nodeArray = body;
750
- if (!isArray(nodeArray))
750
+ if (!_.isArray(nodeArray))
751
751
  throw new InvalidRequestError("Request: Grah nodes must be an array");
752
752
  return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity));
753
753
  };
@@ -830,7 +830,7 @@ const parseArrowsJson = (body) => {
830
830
  if (!("nodes" in body) || !("relationships" in body))
831
831
  throw new InvalidRequestError("Invalid JSON format: Missing nodes or relationships");
832
832
  // Check if nodes and relationships are arrays
833
- if (!isArray(body.nodes) || !isArray(body.relationships))
833
+ if (!_.isArray(body.nodes) || !_.isArray(body.relationships))
834
834
  throw new InvalidRequestError("Invalid JSON format: nodes and relationships must be arrays");
835
835
  // Extract nodes and relationships from the body
836
836
  const { nodes: rawNodes, relationships: rawEdges } = body;
@@ -867,7 +867,7 @@ const parseRichEdges = (body) => {
867
867
  return parsedEdge;
868
868
  };
869
869
  const edgesRaw = body;
870
- if (!isArray(edgesRaw))
870
+ if (!_.isArray(edgesRaw))
871
871
  throw new InvalidRequestError("Graph edges must be an array of edges");
872
872
  if (edgesRaw.length === 0)
873
873
  throw new InvalidRequestError("Graph edges array must not be empty");
@@ -887,7 +887,7 @@ const parseEqualEdges = (body) => {
887
887
  * @returns Parsed edge relation
888
888
  */
889
889
  const parseSingleEdgeRelation = (edgeRelation) => {
890
- if (!isArray(edgeRelation))
890
+ if (!_.isArray(edgeRelation))
891
891
  throw new InvalidRequestError("Every graph relation must be two element string tuple [string, string]");
892
892
  if (edgeRelation.length !== 2)
893
893
  throw new InvalidRequestError("Every graph relation must be two element string tuple [string, string]");
@@ -895,7 +895,7 @@ const parseEqualEdges = (body) => {
895
895
  throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`);
896
896
  return edgeRelation;
897
897
  };
898
- if (!isArray(relations))
898
+ if (!_.isArray(relations))
899
899
  throw new InvalidRequestError("Graph edges must be an array of tuples");
900
900
  const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge));
901
901
  return validatedGraphEdges;
@@ -1 +1 @@
1
- {"version":3,"file":"index.node.js","sources":["../src/globals/coding/code.formating.ts","../src/node/api/errors.api.ts","../src/globals/coding/code.dates.ts","../src/globals/coding/formats.csv.ts","../src/globals/panther/utils.panther.ts","../src/globals/panther/enums.panther.ts","../src/node/logging/logger.ts","../src/node/api/validations.shared.ts","../src/node/api/parse.changeNodes.ts","../src/node/api/parse.arrows.json.ts","../src/node/api/parse.changesEdges.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 * 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}","import { DateTime } from \"luxon\"\nimport { InvalidRequestError } from \"../../node/api/errors.api\"\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestamp = (regime: \"milisecond\" | \"second\" = \"milisecond\"): number => {\n const timestamp = DateTime.now().toMillis()\n return regime === \"second\" ? Math.round((timestamp / 1000)) : timestamp\n}\n\n/**\n * Convert epoch time value into ISO format\n * @param epochValue Epoch value of the timestamp\n * @returns ISO format of the date\n */\nexport const epochToIsoFormat = (epochValue: number) => DateTime.fromMillis(epochValue).toISO() as string\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestampIso = () => {\n const timestamp = DateTime.now().toISO()\n return timestamp as string\n}\n\n/**\n * Check if input date is valid for ISO format\n * @param dateToCheck \n * @returns \n */\n export const hasIsoFormat = (dateToCheck: string) => {\n try{\n const toDate = new Date(Date.parse(dateToCheck))\n const isoCheck = toDate.toISOString().includes(dateToCheck) \n return isoCheck\n }\n catch{\n return false\n }\n}\n\n/**\n * Convert date in ISO formtat to milisecond timestamp\n * @param isoDate Date in ISO 8601 format\n * @returns Timestamp representing the date in miliseconds\n */\nexport const isoDateToTimestamp = (isoDate: string) => DateTime.fromISO(isoDate).toMillis()\n\n/**\n * Format ISO 8601 interval to from-to values\n * @param interval Defined inteval in ISO format (from/to) of the UTC\n * @returns Tuple - from timestamp and to timestamp\n */\nexport const isoIntervalToTimestamps = (interval: string): [number, number] => {\n\n // Split the interval into two parts\n const intervals = interval.split(\"/\")\n\n // interval as a single year has just one part\n if (intervals.length == 1) {\n const newIso = `${interval}-01-01/${interval}-12-31`\n return isoIntervalToTimestamps(newIso)\n }\n\n // interval with two parts or less than one\n else if (intervals.length > 2 || intervals.length < 1)\n throw new InvalidRequestError(\"Interval can have only two parameters\")\n\n // valid interval with two parts\n else {\n if (!intervals.every(interval => hasIsoFormat(interval)))\n throw new InvalidRequestError(\"Parameter utcIntervalIso is not ISO 8601 time interval (date01/date02) or year\");\n\n const [int1, int2] = intervals.map(intervalIso => {\n const cleared = intervalIso.replace(\" \", \"\")\n return isoDateToTimestamp(cleared)\n })\n\n return [int1, int2]\n }\n}\n","// TODO: Cover by tests\n// TODO: mode to ptr-be-core as general CSV methods\n\n\n/**\n * Parses a single line of CSV-formatted strings into an array of trimmed string values.\n *\n * @param csvStingsLine - A string representing a single line of comma-separated values.\n * @returns An array of strings, each representing a trimmed value from the CSV line.\n */\nexport const csvParseStrings = (csvStingsLine: string): string[] => {\n return csvStingsLine.split(\",\").map((value: string) => value.trim());\n}\n\n/**\n * Parses a comma-separated string of numbers into an array of numbers.\n *\n * @param csvNumbersLine - A string containing numbers separated by commas (e.g., \"1, 2, 3.5\").\n * @returns An array of numbers parsed from the input string.\n */\nexport const csvParseNumbers = (csvNumbersLine: string): number[] => {\n return csvNumbersLine.split(\",\").map((value: string) => parseFloat(value.trim()));\n}","import { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"./enums.panther\"\nimport { GraphEdge } from \"./models.edges\"\nimport { FullPantherEntity } from \"./models.nodes\"\n\n/**\n * Finds the first node in the provided list that contains the specified label.\n *\n * Searches the given array of FullPantherEntity objects and returns the first entity\n * whose `labels` array includes the provided label.\n *\n * @param nodes - Array of FullPantherEntity objects to search through.\n * @param label - Label to match; may be a UsedDatasourceLabels or UsedNodeLabels.\n * @returns The first FullPantherEntity whose `labels` includes `label`, or `undefined`\n * if no such entity is found.\n *\n * @remarks\n * - The search stops at the first match (uses `Array.prototype.find`).\n * - Label comparison is exact (uses `Array.prototype.includes`), so it is case-sensitive\n * and requires the same string instance/value.\n *\n * @example\n * const result = findNodeByLabel(nodes, 'datasource-main');\n * if (result) {\n * // found a node that has the 'datasource-main' label\n * }\n */\nexport const findNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity | undefined => {\n return nodes.find(n => n.labels.includes(label))\n}\n\n/**\n * Filters an array of FullPantherEntity objects, returning only those that contain the specified label.\n *\n * The function performs a shallow, non-mutating filter: it returns a new array and does not modify the input.\n * Matching is done using Array.prototype.includes on each entity's `labels` array (strict equality).\n *\n * @param nodes - The array of entities to filter.\n * @param label - The label to match; can be a UsedDatasourceLabels or UsedNodeLabels value.\n * @returns A new array containing only the entities whose `labels` array includes the provided label.\n *\n * @remarks\n * Time complexity is O(n * m) where n is the number of entities and m is the average number of labels per entity.\n *\n * @example\n * ```ts\n * const matched = filterNodeByLabel(entities, 'MY_LABEL');\n * ```\n */\nexport const filterNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity[] => {\n return nodes.filter(n => n.labels.includes(label))\n}\n\n/**\n * Finds the first edge in the provided array whose label strictly equals the given label.\n *\n * @param edges - Array of GraphEdge objects to search.\n * @param label - The UsedEdgeLabels value to match against each edge's `label` property.\n * @returns The first matching GraphEdge if found; otherwise `undefined`.\n *\n * @example\n * const edge = findEdgeByLabel(edges, 'dependency');\n * if (edge) {\n * // handle found edge\n * }\n */\nexport const findEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge | undefined => {\n return edges.find(e => e.label === label)\n}\n\n/**\n * Filters a list of GraphEdge objects by a specific edge label.\n *\n * Returns a new array containing only those edges whose `label` property\n * strictly equals the provided `label` argument. The original `edges`\n * array is not mutated.\n *\n * @param edges - Array of GraphEdge objects to filter.\n * @param label - The label to match; comparison is performed using strict (`===`) equality.\n * @returns A new array of GraphEdge objects whose `label` matches the provided label. Returns an empty array if no edges match.\n *\n * @remarks\n * Time complexity: O(n), where n is the number of edges.\n *\n * @example\n * // const result = filterEdgeByLabel(edges, 'CONNECTS');\n */\nexport const filterEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge[] => {\n return edges.filter(e => e.label === label)\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}","// 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}","import { isArray } from \"lodash\"\nimport { enumCombineValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\n\n\n/**\n * Validates the provided labels to ensure they are an array of strings and that each label\n * is a valid value within the specified enums (`UsedNodeLabels` or `UsedDatasourceLabels`).\n *\n * @param labels - The input to validate, expected to be an array of strings.\n * @throws {InvalidRequestError} If `labels` is not an array.\n * @throws {InvalidRequestError} If any label in the array is not a valid value in the combined enums.\n */\nexport const validateNodeLabels = (labels: unknown) => {\n\n if (labels === undefined || labels === null) {\n throw new InvalidRequestError(\"Graph node labels are required.\")\n }\n\n if (!isArray(labels))\n throw new InvalidRequestError(`Graph node labels must be an array of strings.`)\n\n if (labels.length === 0)\n throw new InvalidRequestError(\"Graph node labels array must contain at least one label.\")\n\n for (const label of labels) {\n if (!isInEnum(label, UsedNodeLabels) && !isInEnum(label, UsedDatasourceLabels))\n throw new InvalidRequestError(`Label ${label} is not supported. Value must be one of: ${enumCombineValuesToString([UsedNodeLabels, UsedDatasourceLabels])}`)\n }\n}\n\n/**\n * Validate a graph edge label.\n *\n * The value is first checked for presence (not `undefined`/`null`), then for type (`string`).\n * The string is normalised using `toLocaleLowerCase()` and validated against the `UsedEdgeLabels` enum.\n *\n * @param label - The value to validate; expected to be a string representing an edge label.\n *\n * @throws {InvalidRequestError} If `label` is `undefined` or `null`.\n * @throws {InvalidRequestError} If `label` is not a `string`.\n * @throws {InvalidRequestError} If the normalised label is not one of the supported values in `UsedEdgeLabels`.\n *\n * @example\n * validateEdgeLabel('CONNECTS'); // succeeds if 'connects' exists in UsedEdgeLabels\n *\n * @remarks\n * Membership is determined via `isInEnum` and error messages include the allowed values (via `enumCombineValuesToString`).\n */\nexport const validateEdgeLabel = (label: unknown) => {\n\n if (label === undefined || label === null) {\n throw new InvalidRequestError(\"Graph edge label is required.\")\n }\n\n if (typeof label !== \"string\") {\n throw new InvalidRequestError(`Graph edge label must be a string.`)\n }\n\n const normalisedLabel = label.toLocaleLowerCase()\n\n if (!isInEnum(normalisedLabel, UsedEdgeLabels)) {\n throw new InvalidRequestError(`Graph edge label '${normalisedLabel}' is not supported. Value must be one of: ${enumCombineValuesToString([UsedEdgeLabels])}`)\n }\n}","import { randomUUID } from \"crypto\"\nimport { isArray } from \"lodash\"\nimport { Unsure } from \"../../globals/coding/code.types\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\nimport { HasConfiguration, HasGeometry, HasInterval, HasLevels, HasUnits } from \"../../globals/panther/models.nodes.properties.general\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { HasBands, HasColor, HasDocumentId, HasSpecificName, HasTimeseries, HasUrl } from \"../../globals/panther/models.nodes.properties.datasources\"\nimport { UsedDatasourceLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { isoIntervalToTimestamps, nowTimestamp } from \"../../globals/coding/code.dates\"\nimport { csvParseNumbers, csvParseStrings } from \"../../globals/coding/formats.csv\"\n\n/**\n * Extract and parse basic entitry from request body\n * This parse function is used in other parsers, becuase basic entity is part of other models\n * @param bodyRaw Body from http request\n * @param key Optional - key value for existing recods in database\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseBasicNodeFromBody = (bodyRaw: unknown): PantherEntity => {\n const {\n labels,\n nameInternal,\n nameDisplay,\n description,\n key\n } = bodyRaw as any\n\n validateNodeLabels(labels)\n\n const basicGraphResult: PantherEntity = {\n lastUpdatedAt: nowTimestamp(),\n key: key ?? randomUUID(),\n nameInternal: nameInternal as string ?? \"\",\n nameDisplay: nameDisplay as string ?? \"\",\n description: description as string ?? \"\",\n labels: labels as string[]\n }\n\n return basicGraphResult\n}\n\n/**\n * Parse node of type area tree level \n * @param levelBody Content from request\n * @returns Parsed area tree level\n */\nconst paseHasLevels = (levelBody: unknown): HasLevels => {\n const { level } = levelBody as any\n\n const result: HasLevels = {\n level\n }\n\n return result\n}\n\n/**\n * Parse body to period entity\n * @param bodyRaw Request body content - can be anything\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseWithInterval = (bodyRaw: any): HasInterval => {\n const {\n intervalISO,\n } = bodyRaw\n\n if (!intervalISO)\n throw new InvalidRequestError(\"Period must have UTC interval in ISO format\")\n\n const [from, to] = isoIntervalToTimestamps(intervalISO)\n const intervalResult: HasInterval = {\n validIntervalIso: intervalISO,\n validFrom: from,\n validTo: to\n }\n\n return intervalResult\n}\n\nconst parseWithConfiguration = (bodyRaw: any, required = false): Unsure<HasConfiguration> => {\n const { configuration } = bodyRaw\n\n if (!configuration && required)\n throw new InvalidRequestError(\"Configuration is required\")\n\n if (!configuration)\n return\n\n return { configuration: typeof configuration === 'string' ? configuration : JSON.stringify(configuration) }\n}\n\n/**\n * Parse body to place entity\n * @param bodyRaw Request body content - can be anything\n * @returns \n */\nconst parseHasGeometry = (bodyRaw: any) => {\n const {\n bbox,\n geometry,\n } = bodyRaw\n\n /**\n * Convert bbox from CSV string to array of 4 coordinates\n * @returns Parsed bounding box from CSV string\n */\n const bboxFromCSV = () => {\n const bboxFromCSV = csvParseNumbers(bbox as string)\n\n if (bboxFromCSV.length !== 4)\n throw new InvalidRequestError(\"bbox must be an array of 4 numbers\")\n\n return bboxFromCSV\n }\n\n const geometryResult: HasGeometry = {\n bbox: bbox ? bboxFromCSV() : [],\n geometry: geometry ?? \"\"\n }\n\n return geometryResult\n}\n\n/**\n * Parses the input object and extracts the `url` property.\n * If the `url` property is not present or is undefined, it returns `null` for `url`.\n *\n * @param bodyRaw - The raw input object that may contain a `url` property.\n * @returns An object with a single `url` property, which is either the extracted value or `null`.\n */\nconst parseHasUrl = (bodyRaw: any, isRequired = true): Unsure<HasUrl> => {\n const { url } = bodyRaw\n\n if (isRequired && !url)\n throw new InvalidRequestError(\"Url is required for the node\")\n\n if (!url) return\n\n return { url }\n}\n\n/**\n * Parses the `specificName` property from the provided object and returns it wrapped in a `HasSpecificName` type.\n *\n * @param bodyRaw - The raw input object potentially containing the `specificName` property.\n * @param isRequired - If `true`, throws an `InvalidRequestError` when `specificName` is missing. Defaults to `false`.\n * @returns An object with the `specificName` property if present, or `undefined` if not required and missing.\n * @throws {InvalidRequestError} If `isRequired` is `true` and `specificName` is not provided.\n */\nconst parseHasSpecificName = (bodyRaw: any, isRequired = false): Unsure<HasSpecificName> => {\n const { specificName } = bodyRaw\n\n if (isRequired && !specificName)\n throw new InvalidRequestError(\"Property specificName is required for the node\")\n\n if (!specificName) return\n\n return { specificName }\n}\n\n\n\n/**\n * Parses the `color` property from the provided `bodyRaw` object and returns it\n * wrapped in an object if it exists. If the `isRequired` flag is set to `true`\n * and the `color` property is missing, an error is thrown.\n *\n * @param bodyRaw - The raw input object containing the `color` property.\n * @param isRequired - A boolean indicating whether the `color` property is required.\n * Defaults to `false`.\n * @returns An object containing the `color` property if it exists, or `undefined` if not required.\n * @throws {InvalidRequestError} If `isRequired` is `true` and the `color` property is missing.\n */\nconst parseWithColor = (bodyRaw: any, isRequired = false): Unsure<HasColor> => {\n const { color } = bodyRaw\n\n if (isRequired && !color)\n throw new InvalidRequestError(\"Property color is required for the node\")\n\n if (!color) return\n\n return { color }\n}\n\n/**\n * Parses the provided raw body object to extract unit and valueType properties.\n * Ensures that the required properties are present if `isRequired` is set to true.\n *\n * @param bodyRaw - The raw input object containing the properties to parse.\n * @param isRequired - A boolean indicating whether the `unit` and `valueType` properties are mandatory.\n * Defaults to `false`.\n * @returns An object containing the `unit` and `valueType` properties, or `null` if they are not provided.\n * @throws {InvalidRequestError} If `isRequired` is true and either `unit` or `valueType` is missing.\n */\nconst parseWithUnits = (bodyRaw: any, isRequired = false): Unsure<HasUnits> => {\n const { unit, valueType } = bodyRaw\n\n if (isRequired && (!unit || !valueType))\n throw new InvalidRequestError(\"Properties unit and valueType are required for the node\")\n\n return { unit: unit ?? null, valueType: valueType ?? null }\n}\n\n/**\n * Parse and validate the `documentId` property from a raw request body.\n *\n * Extracts `documentId` from `bodyRaw` and returns it as an object matching\n * HasDocumentId, wrapped in the Unsure type. If `documentId` is missing or\n * falsy, the function throws an InvalidRequestError.\n *\n * @param bodyRaw - The raw request body (e.g. parsed JSON) expected to contain `documentId`.\n * @returns Unsure<HasDocumentId> — an object with the `documentId` property.\n * @throws {InvalidRequestError} Thrown when `documentId` is not present on `bodyRaw`.\n */\nconst parseHasDocumentId = (bodyRaw: any): HasDocumentId => {\n const { documentId } = bodyRaw\n\n if (!documentId)\n throw new InvalidRequestError(\"Property documentId is required for the node\")\n\n return { documentId }\n}\n\n/**\n * Parse timeseries information from a raw request body.\n *\n * Delegates interval parsing to `parseWithInterval(bodyRaw)` and then\n * attaches the `step` value from the provided `bodyRaw` to the resulting\n * timeseries object. The function does not mutate the input object.\n *\n * @param bodyRaw - Raw request payload (unknown/loose shape). Expected to\n * contain whatever fields `parseWithInterval` requires and\n * optionally a `step` property.\n * @returns A `HasTimeseries` object composed of the interval-related fields\n * returned by `parseWithInterval` plus the `step` property from\n * `bodyRaw` (which may be `undefined` if not present).\n * @throws Rethrows any errors produced by `parseWithInterval` when the input\n * body is invalid for interval parsing.\n */\nconst parseWithTimeseries = (bodyRaw: any): HasTimeseries => {\n const timeseriesIntervals = parseWithInterval(bodyRaw)\n const { step } = bodyRaw\n\n if (!step)\n throw new InvalidRequestError(\"Property step is required for timeseries datasource\")\n\n return { ...timeseriesIntervals, step }\n}\n\n/**\n * Parses the `bands`, `bandNames`, and `bandPeriods` properties from the provided raw input object.\n * \n * - If `required` is `true`, throws an `InvalidRequestError` if any of the properties are missing.\n * - Converts CSV strings to arrays:\n * - `bands` is parsed as an array of numbers.\n * - `bandNames` and `bandPeriods` are parsed as arrays of trimmed strings.\n * - Returns an object containing any of the parsed properties that were present in the input.\n *\n * @param bodyRaw - The raw input object potentially containing `bands`, `bandNames`, and `bandPeriods` as CSV strings.\n * @param required - If `true`, all three properties are required and an error is thrown if any are missing. Defaults to `false`.\n * @returns An object with the parsed properties, or `undefined` if none are present.\n * @throws {InvalidRequestError} If `required` is `true` and any property is missing.\n */\nconst parseHasBands = (bodyRaw: any, required = false): Unsure<HasBands> => {\n const { bands, bandNames, bandPeriods } = bodyRaw\n let result: any\n\n if (required && (!bands || !bandNames || !bandPeriods))\n throw new InvalidRequestError(\"Bands, bandNames and bandPeriods are required for the node\")\n\n if (bands) {\n result = result ?? {}\n Object.assign(result, { bands: csvParseNumbers(bands as string) })\n }\n\n if (bandNames) {\n result = result ?? {}\n Object.assign(result, { bandNames: csvParseStrings(bandNames as string) })\n }\n\n if (bandPeriods) {\n result = result ?? {}\n Object.assign(result, { bandPeriods: csvParseStrings(bandPeriods as string) })\n }\n\n return result as Unsure<HasBands>\n}\n\n/**\n * Parse single graph node from body entity \n * @param bodyNodeEntity Entity from request body\n * @returns Parsed object for specific node\n */\nexport const parseSinglePantherNode = (bodyNodeEntity: unknown): FullPantherEntity => {\n\n // Parse basic node properties first\n let node: PantherEntity = parseBasicNodeFromBody(bodyNodeEntity)\n\n // Parse additional properties for specific node types\n // single for loop is used to avoid multiple labels array iterations\n for (const label of node.labels) {\n\n // If node is a Period, add interval information\n if (label === UsedNodeLabels.Period)\n node = { ...node, ...parseWithInterval(bodyNodeEntity) };\n\n // If node is a Place, add geographic information\n if (label === UsedNodeLabels.Place)\n node = { ...node, ...parseHasGeometry(bodyNodeEntity) };\n\n // If node is a Datasource or Application, add configuration when available\n if (label === UsedNodeLabels.Datasource || label === UsedNodeLabels.Application) {\n const parsedConfiguration = parseWithConfiguration(bodyNodeEntity, false);\n node = parsedConfiguration ? { ...node, ...parsedConfiguration } : node;\n }\n\n // If node is a online Datasource, add URL information\n const datasourcesWithUrl = [\n UsedDatasourceLabels.COG,\n UsedDatasourceLabels.WMS,\n UsedDatasourceLabels.MVT,\n UsedDatasourceLabels.WFS,\n UsedDatasourceLabels.WMTS,\n UsedDatasourceLabels.Geojson\n ];\n\n // If node is a Datasource with URL, add URL information\n if (datasourcesWithUrl.includes(label as UsedDatasourceLabels)) {\n const parsedUrl = parseHasUrl(bodyNodeEntity, true);\n node = parsedUrl ? { ...node, ...parsedUrl } : node;\n }\n\n // If node is a Datasource with bands, add bands information\n const datasourcesWithPossibleBands = [\n UsedDatasourceLabels.COG,\n ];\n\n // If node is a Datasource can have bands, add them\n if (datasourcesWithPossibleBands.includes(label as UsedDatasourceLabels)) {\n const parsedBands = parseHasBands(bodyNodeEntity, false);\n node = parsedBands ? { ...node, ...parsedBands } : node;\n }\n\n // If node is a Style, add specific name information\n if (label === UsedNodeLabels.Style || label === UsedDatasourceLabels.MapStyle) {\n const parsedSpecificName = parseHasSpecificName(bodyNodeEntity, true);\n node = parsedSpecificName ? { ...node, ...parsedSpecificName } : node;\n }\n\n // If node is a Datasource with timeseries, add timeseries information\n if (label === UsedDatasourceLabels.Timeseries) {\n const parsedTimeseries = parseWithTimeseries(bodyNodeEntity);\n node = { ...node, ...parsedTimeseries };\n }\n\n // If node is a Datasource with document ID, add document ID information\n const datasourcesWithDocumentId = [\n UsedDatasourceLabels.PostGIS,\n UsedDatasourceLabels.Timeseries\n ];\n\n if (datasourcesWithDocumentId.includes(label as UsedDatasourceLabels)) {\n const parsedDocumentId = parseHasDocumentId(bodyNodeEntity);\n node = { ...node, ...parsedDocumentId };\n }\n\n // If node is an AreaTreeLevel, add level information\n if (label === UsedNodeLabels.AreaTreeLevel)\n node = { ...node, ...paseHasLevels(bodyNodeEntity) };\n\n // If node is an Attribute, add color information and units\n if (label === UsedNodeLabels.Attribute) {\n const parsedColor = parseWithColor(bodyNodeEntity, false);\n const parsedUnit = parseWithUnits(bodyNodeEntity, false);\n \n // Add parsed unit if available\n node = parsedUnit ? { \n ...node, \n ...parsedUnit \n } : node;\n\n // Add parsed color if available\n node = parsedColor ? { \n ...node, \n ...parsedColor \n } : node;\n }\n\n }\n\n return node;\n}\n\n/**\n * Parse array of graph nodes from request body\n * @param body Array of graph nodes inside http request body\n * @returns Array of parsed graph nodes in correct form\n */\nexport const parseParsePantherNodes = (body: unknown): FullPantherEntity[] => {\n const nodeArray = body as any[]\n\n if (!isArray(nodeArray))\n throw new InvalidRequestError(\"Request: Grah nodes must be an array\")\n\n return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity))\n}\n\n// TODO: cover by better testing","import { randomUUID } from \"crypto\"\nimport { isArray } from \"lodash\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { parseSinglePantherNode } from \"./parse.changeNodes\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\nimport { isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\n\n/**\n * Parses a node object from the Arrows JSON format and converts it into a `PantherEntity`.\n *\n * Validates that the node's labels are arrays of supported enum values, and constructs\n * a `PantherEntity` object with the appropriate properties. Throws an `InvalidRequestError`\n * if the labels are not valid.\n *\n * @param node - The node object from the Arrows JSON to parse.\n * @returns A `PantherEntity` object representing the parsed node.\n * @throws {InvalidRequestError} If the node's labels are not an array of supported values.\n */\nconst parseNodeFromArrows = (node: any): FullPantherEntity => {\n const { labels, properties, id, caption } = node\n\n validateNodeLabels(labels)\n\n const basicGraphResult: FullPantherEntity = parseSinglePantherNode({\n labels: labels as string[],\n key: properties.key as string ?? id ?? randomUUID(),\n nameDisplay: caption ?? properties.nameDisplay as string ?? \"\",\n ...properties\n })\n\n return basicGraphResult\n}\n\n\n/**\n * Parses an edge object from the Arrows format and converts it into a `GraphEdge`.\n *\n * @param edge - The edge object to parse, containing details about the graph edge.\n * @returns A `GraphEdge` object containing the parsed edge nodes, label, and properties.\n *\n * @throws {InvalidRequestError} If the edge does not have a type (`label`).\n * @throws {InvalidRequestError} If the edge type (`label`) is not supported.\n * @throws {InvalidRequestError} If the edge does not have properties.\n * @throws {InvalidRequestError} If the edge does not have `fromId` or `toId`.\n * @throws {InvalidRequestError} If the `fromId` and `toId` are the same.\n */\nconst parseEdgeFromArrows = (edge: any): GraphEdge => {\n const {\n fromId: from,\n toId: to,\n type,\n properties\n } = edge\n\n // Determine the label, defaulting to \"RelatedTo\" if the type is invalid or not provided\n const label = (typeof type === \"string\" && type.trim().length > 0) \n ? type.trim() as UsedEdgeLabels\n : UsedEdgeLabels.RelatedTo\n \n // validate the edge properties\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge type '${label}' is not supported`)\n\n // edge must have a properties\n if (!properties)\n throw new InvalidRequestError(`Graph edge must have properties`)\n\n // edge must have fromId and toId\n if (!from || !to)\n throw new InvalidRequestError(`Graph edge must have fromId and toId`)\n\n if (from === to)\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${from} leads to ${to})`)\n\n // prepare relation tuple\n const result: GraphRelation = [from, to]\n\n // construct the parsed edge object\n const parsedEdge: GraphEdge = {\n edgeNodes: result,\n label,\n properties\n }\n\n // return the parsed edge\n return parsedEdge\n}\n\n/**\n * Parses a JSON object representing nodes and relationships (edges) from the Arrows JSON.\n *\n * @param body - The input JSON object to parse. Expected to contain `nodes` and `relationships` arrays.\n * @returns An object containing parsed `nodes` and `edges` arrays.\n * @throws {InvalidRequestError} If the input is not a valid object, or if required properties are missing or not arrays.\n */\nexport const parseArrowsJson = (body: unknown): { nodes: FullPantherEntity[]; edges: GraphEdge[] } => {\n\n // Check if the body is a valid object\n if (typeof body !== \"object\" || body === null)\n throw new InvalidRequestError(\"Invalid JSON format\")\n\n // Check if the body contains the required properties\n if (!(\"nodes\" in body) || !(\"relationships\" in body))\n throw new InvalidRequestError(\"Invalid JSON format: Missing nodes or relationships\")\n\n // Check if nodes and relationships are arrays\n if (!isArray((body as any).nodes) || !isArray((body as any).relationships))\n throw new InvalidRequestError(\"Invalid JSON format: nodes and relationships must be arrays\")\n\n // Extract nodes and relationships from the body\n const { nodes: rawNodes, relationships: rawEdges } = body as any\n\n // Define default values for nodes and edges\n const nodes: PantherEntity[] = rawNodes ?? []\n const edges: GraphEdge[] = rawEdges ?? []\n\n // Parse nodes and edges using the defined functions\n const parsedNodes = nodes.map((node: any) => parseNodeFromArrows(node))\n const parsedEdges = edges.map((edge: any) => parseEdgeFromArrows(edge))\n\n return {\n nodes: parsedNodes,\n edges: parsedEdges\n }\n}","import { isArray } from \"lodash\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { enumValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\n\nexport const parseRichEdges = (body: unknown): GraphEdge[] => {\n\n const parseSingleEdge = (edge: unknown): GraphEdge => {\n\n const {label, fromKey, toKey, properties } = edge as any\n\n if (!label || typeof label !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string label\")\n\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge label is not allowed (${label}). Must be one of: ${enumValuesToString(UsedEdgeLabels)}`)\n\n if (!fromKey || typeof fromKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string fromKey\")\n\n if (!toKey || typeof toKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string toKey\")\n\n if (fromKey === toKey)\n throw new InvalidRequestError(`Cannot connect two same keys in graph edge (${fromKey})`)\n\n const parsedEdge: GraphEdge = {\n label: label as UsedEdgeLabels,\n edgeNodes: [fromKey, toKey],\n properties: properties || {}\n }\n\n return parsedEdge\n }\n const edgesRaw = body as any[]\n \n if (!isArray(edgesRaw))\n throw new InvalidRequestError(\"Graph edges must be an array of edges\")\n\n if (edgesRaw.length === 0)\n throw new InvalidRequestError(\"Graph edges array must not be empty\")\n\n const parsedEdges = edgesRaw.map(edge => parseSingleEdge(edge))\n return parsedEdges\n}\n\n/**\n * Parse body to graph relation\n * @param body Body from request\n * @returns Graph relation\n */\nexport const parseEqualEdges = (body: unknown): GraphRelation[] => {\n const relations = body as any[]\n\n /**\n * Check single edge relation and parse it\n * @param edgeRelation \n * @returns Parsed edge relation\n */\n const parseSingleEdgeRelation = (edgeRelation: unknown): GraphRelation => {\n\n if (!isArray(edgeRelation))\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation.length !== 2)\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation[0] === edgeRelation[1])\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`)\n\n return edgeRelation as GraphRelation\n }\n\n if (!isArray(relations))\n throw new InvalidRequestError(\"Graph edges must be an array of tuples\")\n\n const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge))\n\n return validatedGraphEdges\n} "],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;MACU,QAAQ,GAAG,CAAC,KAAU,EAAE,UAAe,KAAI;IACpD,MAAM,aAAa,GAAG,MAAM,CA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M,IAAI,mBAAmB,CAAC,qCAAqC,CAAC;AAExE,IAAA,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;AAC/D,IAAA,OAAO,WAAW;AACtB;AAEA;;;;AAIG;AACI,MAAM,eAAe,GAAG,CAAC,IAAa,KAAqB;IAC9D,MAAM,SAAS,GAAG,IAAa;AAE/B;;;;AAIG;AACH,IAAA,MAAM,uBAAuB,GAAG,CAAC,YAAqB,KAAmB;AAErE,QAAA,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;AACtB,YAAA,MAAM,IAAI,mBAAmB,CAAC,wEAAwE,CAAC;AAE3G,QAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;AACzB,YAAA,MAAM,IAAI,mBAAmB,CAAC,wEAAwE,CAAC;QAE3G,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC;YACnC,MAAM,IAAI,mBAAmB,CAAC,CAAA,gDAAA,EAAmD,YAAY,CAAC,CAAC,CAAC,CAAA,CAAA,CAAG,CAAC;AAExG,QAAA,OAAO,YAA6B;AACxC,IAAA,CAAC;AAED,IAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;AACnB,QAAA,MAAM,IAAI,mBAAmB,CAAC,wCAAwC,CAAC;AAE3E,IAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAEhF,IAAA,OAAO,mBAAmB;AAC9B;;;;"}
1
+ {"version":3,"file":"index.node.js","sources":["../src/globals/coding/code.formating.ts","../src/node/api/errors.api.ts","../src/globals/coding/code.dates.ts","../src/globals/coding/formats.csv.ts","../src/globals/panther/utils.panther.ts","../src/globals/panther/enums.panther.ts","../src/node/logging/logger.ts","../src/node/api/validations.shared.ts","../src/node/api/parse.changeNodes.ts","../src/node/api/parse.arrows.json.ts","../src/node/api/parse.changesEdges.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 * 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}","import { DateTime } from \"luxon\"\nimport { InvalidRequestError } from \"../../node/api/errors.api\"\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestamp = (regime: \"milisecond\" | \"second\" = \"milisecond\"): number => {\n const timestamp = DateTime.now().toMillis()\n return regime === \"second\" ? Math.round((timestamp / 1000)) : timestamp\n}\n\n/**\n * Convert epoch time value into ISO format\n * @param epochValue Epoch value of the timestamp\n * @returns ISO format of the date\n */\nexport const epochToIsoFormat = (epochValue: number) => DateTime.fromMillis(epochValue).toISO() as string\n\n/**\n * Return epoch timestamp\n * @param regime Set if you want milisecond format or second format\n * @returns \n */\nexport const nowTimestampIso = () => {\n const timestamp = DateTime.now().toISO()\n return timestamp as string\n}\n\n/**\n * Check if input date is valid for ISO format\n * @param dateToCheck \n * @returns \n */\n export const hasIsoFormat = (dateToCheck: string) => {\n try{\n const toDate = new Date(Date.parse(dateToCheck))\n const isoCheck = toDate.toISOString().includes(dateToCheck) \n return isoCheck\n }\n catch{\n return false\n }\n}\n\n/**\n * Convert date in ISO formtat to milisecond timestamp\n * @param isoDate Date in ISO 8601 format\n * @returns Timestamp representing the date in miliseconds\n */\nexport const isoDateToTimestamp = (isoDate: string) => DateTime.fromISO(isoDate).toMillis()\n\n/**\n * Format ISO 8601 interval to from-to values\n * @param interval Defined inteval in ISO format (from/to) of the UTC\n * @returns Tuple - from timestamp and to timestamp\n */\nexport const isoIntervalToTimestamps = (interval: string): [number, number] => {\n\n // Split the interval into two parts\n const intervals = interval.split(\"/\")\n\n // interval as a single year has just one part\n if (intervals.length == 1) {\n const newIso = `${interval}-01-01/${interval}-12-31`\n return isoIntervalToTimestamps(newIso)\n }\n\n // interval with two parts or less than one\n else if (intervals.length > 2 || intervals.length < 1)\n throw new InvalidRequestError(\"Interval can have only two parameters\")\n\n // valid interval with two parts\n else {\n if (!intervals.every(interval => hasIsoFormat(interval)))\n throw new InvalidRequestError(\"Parameter utcIntervalIso is not ISO 8601 time interval (date01/date02) or year\");\n\n const [int1, int2] = intervals.map(intervalIso => {\n const cleared = intervalIso.replace(\" \", \"\")\n return isoDateToTimestamp(cleared)\n })\n\n return [int1, int2]\n }\n}\n","// TODO: Cover by tests\n// TODO: mode to ptr-be-core as general CSV methods\n\n\n/**\n * Parses a single line of CSV-formatted strings into an array of trimmed string values.\n *\n * @param csvStingsLine - A string representing a single line of comma-separated values.\n * @returns An array of strings, each representing a trimmed value from the CSV line.\n */\nexport const csvParseStrings = (csvStingsLine: string): string[] => {\n return csvStingsLine.split(\",\").map((value: string) => value.trim());\n}\n\n/**\n * Parses a comma-separated string of numbers into an array of numbers.\n *\n * @param csvNumbersLine - A string containing numbers separated by commas (e.g., \"1, 2, 3.5\").\n * @returns An array of numbers parsed from the input string.\n */\nexport const csvParseNumbers = (csvNumbersLine: string): number[] => {\n return csvNumbersLine.split(\",\").map((value: string) => parseFloat(value.trim()));\n}","import { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"./enums.panther\"\nimport { GraphEdge } from \"./models.edges\"\nimport { FullPantherEntity } from \"./models.nodes\"\n\n/**\n * Finds the first node in the provided list that contains the specified label.\n *\n * Searches the given array of FullPantherEntity objects and returns the first entity\n * whose `labels` array includes the provided label.\n *\n * @param nodes - Array of FullPantherEntity objects to search through.\n * @param label - Label to match; may be a UsedDatasourceLabels or UsedNodeLabels.\n * @returns The first FullPantherEntity whose `labels` includes `label`, or `undefined`\n * if no such entity is found.\n *\n * @remarks\n * - The search stops at the first match (uses `Array.prototype.find`).\n * - Label comparison is exact (uses `Array.prototype.includes`), so it is case-sensitive\n * and requires the same string instance/value.\n *\n * @example\n * const result = findNodeByLabel(nodes, 'datasource-main');\n * if (result) {\n * // found a node that has the 'datasource-main' label\n * }\n */\nexport const findNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity | undefined => {\n return nodes.find(n => n.labels.includes(label))\n}\n\n/**\n * Filters an array of FullPantherEntity objects, returning only those that contain the specified label.\n *\n * The function performs a shallow, non-mutating filter: it returns a new array and does not modify the input.\n * Matching is done using Array.prototype.includes on each entity's `labels` array (strict equality).\n *\n * @param nodes - The array of entities to filter.\n * @param label - The label to match; can be a UsedDatasourceLabels or UsedNodeLabels value.\n * @returns A new array containing only the entities whose `labels` array includes the provided label.\n *\n * @remarks\n * Time complexity is O(n * m) where n is the number of entities and m is the average number of labels per entity.\n *\n * @example\n * ```ts\n * const matched = filterNodeByLabel(entities, 'MY_LABEL');\n * ```\n */\nexport const filterNodeByLabel = (\n nodes: FullPantherEntity[],\n label: UsedDatasourceLabels | UsedNodeLabels): FullPantherEntity[] => {\n return nodes.filter(n => n.labels.includes(label))\n}\n\n/**\n * Finds the first edge in the provided array whose label strictly equals the given label.\n *\n * @param edges - Array of GraphEdge objects to search.\n * @param label - The UsedEdgeLabels value to match against each edge's `label` property.\n * @returns The first matching GraphEdge if found; otherwise `undefined`.\n *\n * @example\n * const edge = findEdgeByLabel(edges, 'dependency');\n * if (edge) {\n * // handle found edge\n * }\n */\nexport const findEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge | undefined => {\n return edges.find(e => e.label === label)\n}\n\n/**\n * Filters a list of GraphEdge objects by a specific edge label.\n *\n * Returns a new array containing only those edges whose `label` property\n * strictly equals the provided `label` argument. The original `edges`\n * array is not mutated.\n *\n * @param edges - Array of GraphEdge objects to filter.\n * @param label - The label to match; comparison is performed using strict (`===`) equality.\n * @returns A new array of GraphEdge objects whose `label` matches the provided label. Returns an empty array if no edges match.\n *\n * @remarks\n * Time complexity: O(n), where n is the number of edges.\n *\n * @example\n * // const result = filterEdgeByLabel(edges, 'CONNECTS');\n */\nexport const filterEdgeByLabel = (\n edges: GraphEdge[],\n label: UsedEdgeLabels): GraphEdge[] => {\n return edges.filter(e => e.label === label)\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}","// 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}","import _ from \"lodash\"\nimport { enumCombineValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { UsedDatasourceLabels, UsedEdgeLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\n\n\n/**\n * Validates the provided labels to ensure they are an array of strings and that each label\n * is a valid value within the specified enums (`UsedNodeLabels` or `UsedDatasourceLabels`).\n *\n * @param labels - The input to validate, expected to be an array of strings.\n * @throws {InvalidRequestError} If `labels` is not an array.\n * @throws {InvalidRequestError} If any label in the array is not a valid value in the combined enums.\n */\nexport const validateNodeLabels = (labels: unknown) => {\n\n if (labels === undefined || labels === null) {\n throw new InvalidRequestError(\"Graph node labels are required.\")\n }\n\n if (!_.isArray(labels))\n throw new InvalidRequestError(`Graph node labels must be an array of strings.`)\n\n if (labels.length === 0)\n throw new InvalidRequestError(\"Graph node labels array must contain at least one label.\")\n\n for (const label of labels) {\n if (!isInEnum(label, UsedNodeLabels) && !isInEnum(label, UsedDatasourceLabels))\n throw new InvalidRequestError(`Label ${label} is not supported. Value must be one of: ${enumCombineValuesToString([UsedNodeLabels, UsedDatasourceLabels])}`)\n }\n}\n\n/**\n * Validate a graph edge label.\n *\n * The value is first checked for presence (not `undefined`/`null`), then for type (`string`).\n * The string is normalised using `toLocaleLowerCase()` and validated against the `UsedEdgeLabels` enum.\n *\n * @param label - The value to validate; expected to be a string representing an edge label.\n *\n * @throws {InvalidRequestError} If `label` is `undefined` or `null`.\n * @throws {InvalidRequestError} If `label` is not a `string`.\n * @throws {InvalidRequestError} If the normalised label is not one of the supported values in `UsedEdgeLabels`.\n *\n * @example\n * validateEdgeLabel('CONNECTS'); // succeeds if 'connects' exists in UsedEdgeLabels\n *\n * @remarks\n * Membership is determined via `isInEnum` and error messages include the allowed values (via `enumCombineValuesToString`).\n */\nexport const validateEdgeLabel = (label: unknown) => {\n\n if (label === undefined || label === null) {\n throw new InvalidRequestError(\"Graph edge label is required.\")\n }\n\n if (typeof label !== \"string\") {\n throw new InvalidRequestError(`Graph edge label must be a string.`)\n }\n\n const normalisedLabel = label.toLocaleLowerCase()\n\n if (!isInEnum(normalisedLabel, UsedEdgeLabels)) {\n throw new InvalidRequestError(`Graph edge label '${normalisedLabel}' is not supported. Value must be one of: ${enumCombineValuesToString([UsedEdgeLabels])}`)\n }\n}","import { randomUUID } from \"crypto\"\nimport _ from \"lodash\"\nimport { Unsure } from \"../../globals/coding/code.types\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\nimport { HasConfiguration, HasGeometry, HasInterval, HasLevels, HasUnits } from \"../../globals/panther/models.nodes.properties.general\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { HasBands, HasColor, HasDocumentId, HasSpecificName, HasTimeseries, HasUrl } from \"../../globals/panther/models.nodes.properties.datasources\"\nimport { UsedDatasourceLabels, UsedNodeLabels } from \"../../globals/panther/enums.panther\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { isoIntervalToTimestamps, nowTimestamp } from \"../../globals/coding/code.dates\"\nimport { csvParseNumbers, csvParseStrings } from \"../../globals/coding/formats.csv\"\n\n/**\n * Extract and parse basic entitry from request body\n * This parse function is used in other parsers, becuase basic entity is part of other models\n * @param bodyRaw Body from http request\n * @param key Optional - key value for existing recods in database\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseBasicNodeFromBody = (bodyRaw: unknown): PantherEntity => {\n const {\n labels,\n nameInternal,\n nameDisplay,\n description,\n key\n } = bodyRaw as any\n\n validateNodeLabels(labels)\n\n const basicGraphResult: PantherEntity = {\n lastUpdatedAt: nowTimestamp(),\n key: key ?? randomUUID(),\n nameInternal: nameInternal as string ?? \"\",\n nameDisplay: nameDisplay as string ?? \"\",\n description: description as string ?? \"\",\n labels: labels as string[]\n }\n\n return basicGraphResult\n}\n\n/**\n * Parse node of type area tree level \n * @param levelBody Content from request\n * @returns Parsed area tree level\n */\nconst paseHasLevels = (levelBody: unknown): HasLevels => {\n const { level } = levelBody as any\n\n const result: HasLevels = {\n level\n }\n\n return result\n}\n\n/**\n * Parse body to period entity\n * @param bodyRaw Request body content - can be anything\n * @returns Parsed entity - all unwanted parameters are gone\n */\nconst parseWithInterval = (bodyRaw: any): HasInterval => {\n const {\n intervalISO,\n } = bodyRaw\n\n if (!intervalISO)\n throw new InvalidRequestError(\"Period must have UTC interval in ISO format\")\n\n const [from, to] = isoIntervalToTimestamps(intervalISO)\n const intervalResult: HasInterval = {\n validIntervalIso: intervalISO,\n validFrom: from,\n validTo: to\n }\n\n return intervalResult\n}\n\nconst parseWithConfiguration = (bodyRaw: any, required = false): Unsure<HasConfiguration> => {\n const { configuration } = bodyRaw\n\n if (!configuration && required)\n throw new InvalidRequestError(\"Configuration is required\")\n\n if (!configuration)\n return\n\n return { configuration: typeof configuration === 'string' ? configuration : JSON.stringify(configuration) }\n}\n\n/**\n * Parse body to place entity\n * @param bodyRaw Request body content - can be anything\n * @returns \n */\nconst parseHasGeometry = (bodyRaw: any) => {\n const {\n bbox,\n geometry,\n } = bodyRaw\n\n /**\n * Convert bbox from CSV string to array of 4 coordinates\n * @returns Parsed bounding box from CSV string\n */\n const bboxFromCSV = () => {\n const bboxFromCSV = csvParseNumbers(bbox as string)\n\n if (bboxFromCSV.length !== 4)\n throw new InvalidRequestError(\"bbox must be an array of 4 numbers\")\n\n return bboxFromCSV\n }\n\n const geometryResult: HasGeometry = {\n bbox: bbox ? bboxFromCSV() : [],\n geometry: geometry ?? \"\"\n }\n\n return geometryResult\n}\n\n/**\n * Parses the input object and extracts the `url` property.\n * If the `url` property is not present or is undefined, it returns `null` for `url`.\n *\n * @param bodyRaw - The raw input object that may contain a `url` property.\n * @returns An object with a single `url` property, which is either the extracted value or `null`.\n */\nconst parseHasUrl = (bodyRaw: any, isRequired = true): Unsure<HasUrl> => {\n const { url } = bodyRaw\n\n if (isRequired && !url)\n throw new InvalidRequestError(\"Url is required for the node\")\n\n if (!url) return\n\n return { url }\n}\n\n/**\n * Parses the `specificName` property from the provided object and returns it wrapped in a `HasSpecificName` type.\n *\n * @param bodyRaw - The raw input object potentially containing the `specificName` property.\n * @param isRequired - If `true`, throws an `InvalidRequestError` when `specificName` is missing. Defaults to `false`.\n * @returns An object with the `specificName` property if present, or `undefined` if not required and missing.\n * @throws {InvalidRequestError} If `isRequired` is `true` and `specificName` is not provided.\n */\nconst parseHasSpecificName = (bodyRaw: any, isRequired = false): Unsure<HasSpecificName> => {\n const { specificName } = bodyRaw\n\n if (isRequired && !specificName)\n throw new InvalidRequestError(\"Property specificName is required for the node\")\n\n if (!specificName) return\n\n return { specificName }\n}\n\n\n\n/**\n * Parses the `color` property from the provided `bodyRaw` object and returns it\n * wrapped in an object if it exists. If the `isRequired` flag is set to `true`\n * and the `color` property is missing, an error is thrown.\n *\n * @param bodyRaw - The raw input object containing the `color` property.\n * @param isRequired - A boolean indicating whether the `color` property is required.\n * Defaults to `false`.\n * @returns An object containing the `color` property if it exists, or `undefined` if not required.\n * @throws {InvalidRequestError} If `isRequired` is `true` and the `color` property is missing.\n */\nconst parseWithColor = (bodyRaw: any, isRequired = false): Unsure<HasColor> => {\n const { color } = bodyRaw\n\n if (isRequired && !color)\n throw new InvalidRequestError(\"Property color is required for the node\")\n\n if (!color) return\n\n return { color }\n}\n\n/**\n * Parses the provided raw body object to extract unit and valueType properties.\n * Ensures that the required properties are present if `isRequired` is set to true.\n *\n * @param bodyRaw - The raw input object containing the properties to parse.\n * @param isRequired - A boolean indicating whether the `unit` and `valueType` properties are mandatory.\n * Defaults to `false`.\n * @returns An object containing the `unit` and `valueType` properties, or `null` if they are not provided.\n * @throws {InvalidRequestError} If `isRequired` is true and either `unit` or `valueType` is missing.\n */\nconst parseWithUnits = (bodyRaw: any, isRequired = false): Unsure<HasUnits> => {\n const { unit, valueType } = bodyRaw\n\n if (isRequired && (!unit || !valueType))\n throw new InvalidRequestError(\"Properties unit and valueType are required for the node\")\n\n return { unit: unit ?? null, valueType: valueType ?? null }\n}\n\n/**\n * Parse and validate the `documentId` property from a raw request body.\n *\n * Extracts `documentId` from `bodyRaw` and returns it as an object matching\n * HasDocumentId, wrapped in the Unsure type. If `documentId` is missing or\n * falsy, the function throws an InvalidRequestError.\n *\n * @param bodyRaw - The raw request body (e.g. parsed JSON) expected to contain `documentId`.\n * @returns Unsure<HasDocumentId> — an object with the `documentId` property.\n * @throws {InvalidRequestError} Thrown when `documentId` is not present on `bodyRaw`.\n */\nconst parseHasDocumentId = (bodyRaw: any): HasDocumentId => {\n const { documentId } = bodyRaw\n\n if (!documentId)\n throw new InvalidRequestError(\"Property documentId is required for the node\")\n\n return { documentId }\n}\n\n/**\n * Parse timeseries information from a raw request body.\n *\n * Delegates interval parsing to `parseWithInterval(bodyRaw)` and then\n * attaches the `step` value from the provided `bodyRaw` to the resulting\n * timeseries object. The function does not mutate the input object.\n *\n * @param bodyRaw - Raw request payload (unknown/loose shape). Expected to\n * contain whatever fields `parseWithInterval` requires and\n * optionally a `step` property.\n * @returns A `HasTimeseries` object composed of the interval-related fields\n * returned by `parseWithInterval` plus the `step` property from\n * `bodyRaw` (which may be `undefined` if not present).\n * @throws Rethrows any errors produced by `parseWithInterval` when the input\n * body is invalid for interval parsing.\n */\nconst parseWithTimeseries = (bodyRaw: any): HasTimeseries => {\n const timeseriesIntervals = parseWithInterval(bodyRaw)\n const { step } = bodyRaw\n\n if (!step)\n throw new InvalidRequestError(\"Property step is required for timeseries datasource\")\n\n return { ...timeseriesIntervals, step }\n}\n\n/**\n * Parses the `bands`, `bandNames`, and `bandPeriods` properties from the provided raw input object.\n * \n * - If `required` is `true`, throws an `InvalidRequestError` if any of the properties are missing.\n * - Converts CSV strings to arrays:\n * - `bands` is parsed as an array of numbers.\n * - `bandNames` and `bandPeriods` are parsed as arrays of trimmed strings.\n * - Returns an object containing any of the parsed properties that were present in the input.\n *\n * @param bodyRaw - The raw input object potentially containing `bands`, `bandNames`, and `bandPeriods` as CSV strings.\n * @param required - If `true`, all three properties are required and an error is thrown if any are missing. Defaults to `false`.\n * @returns An object with the parsed properties, or `undefined` if none are present.\n * @throws {InvalidRequestError} If `required` is `true` and any property is missing.\n */\nconst parseHasBands = (bodyRaw: any, required = false): Unsure<HasBands> => {\n const { bands, bandNames, bandPeriods } = bodyRaw\n let result: any\n\n if (required && (!bands || !bandNames || !bandPeriods))\n throw new InvalidRequestError(\"Bands, bandNames and bandPeriods are required for the node\")\n\n if (bands) {\n result = result ?? {}\n Object.assign(result, { bands: csvParseNumbers(bands as string) })\n }\n\n if (bandNames) {\n result = result ?? {}\n Object.assign(result, { bandNames: csvParseStrings(bandNames as string) })\n }\n\n if (bandPeriods) {\n result = result ?? {}\n Object.assign(result, { bandPeriods: csvParseStrings(bandPeriods as string) })\n }\n\n return result as Unsure<HasBands>\n}\n\n/**\n * Parse single graph node from body entity \n * @param bodyNodeEntity Entity from request body\n * @returns Parsed object for specific node\n */\nexport const parseSinglePantherNode = (bodyNodeEntity: unknown): FullPantherEntity => {\n\n // Parse basic node properties first\n let node: PantherEntity = parseBasicNodeFromBody(bodyNodeEntity)\n\n // Parse additional properties for specific node types\n // single for loop is used to avoid multiple labels array iterations\n for (const label of node.labels) {\n\n // If node is a Period, add interval information\n if (label === UsedNodeLabels.Period)\n node = { ...node, ...parseWithInterval(bodyNodeEntity) };\n\n // If node is a Place, add geographic information\n if (label === UsedNodeLabels.Place)\n node = { ...node, ...parseHasGeometry(bodyNodeEntity) };\n\n // If node is a Datasource or Application, add configuration when available\n if (label === UsedNodeLabels.Datasource || label === UsedNodeLabels.Application) {\n const parsedConfiguration = parseWithConfiguration(bodyNodeEntity, false);\n node = parsedConfiguration ? { ...node, ...parsedConfiguration } : node;\n }\n\n // If node is a online Datasource, add URL information\n const datasourcesWithUrl = [\n UsedDatasourceLabels.COG,\n UsedDatasourceLabels.WMS,\n UsedDatasourceLabels.MVT,\n UsedDatasourceLabels.WFS,\n UsedDatasourceLabels.WMTS,\n UsedDatasourceLabels.Geojson\n ];\n\n // If node is a Datasource with URL, add URL information\n if (datasourcesWithUrl.includes(label as UsedDatasourceLabels)) {\n const parsedUrl = parseHasUrl(bodyNodeEntity, true);\n node = parsedUrl ? { ...node, ...parsedUrl } : node;\n }\n\n // If node is a Datasource with bands, add bands information\n const datasourcesWithPossibleBands = [\n UsedDatasourceLabels.COG,\n ];\n\n // If node is a Datasource can have bands, add them\n if (datasourcesWithPossibleBands.includes(label as UsedDatasourceLabels)) {\n const parsedBands = parseHasBands(bodyNodeEntity, false);\n node = parsedBands ? { ...node, ...parsedBands } : node;\n }\n\n // If node is a Style, add specific name information\n if (label === UsedNodeLabels.Style || label === UsedDatasourceLabels.MapStyle) {\n const parsedSpecificName = parseHasSpecificName(bodyNodeEntity, true);\n node = parsedSpecificName ? { ...node, ...parsedSpecificName } : node;\n }\n\n // If node is a Datasource with timeseries, add timeseries information\n if (label === UsedDatasourceLabels.Timeseries) {\n const parsedTimeseries = parseWithTimeseries(bodyNodeEntity);\n node = { ...node, ...parsedTimeseries };\n }\n\n // If node is a Datasource with document ID, add document ID information\n const datasourcesWithDocumentId = [\n UsedDatasourceLabels.PostGIS,\n UsedDatasourceLabels.Timeseries\n ];\n\n if (datasourcesWithDocumentId.includes(label as UsedDatasourceLabels)) {\n const parsedDocumentId = parseHasDocumentId(bodyNodeEntity);\n node = { ...node, ...parsedDocumentId };\n }\n\n // If node is an AreaTreeLevel, add level information\n if (label === UsedNodeLabels.AreaTreeLevel)\n node = { ...node, ...paseHasLevels(bodyNodeEntity) };\n\n // If node is an Attribute, add color information and units\n if (label === UsedNodeLabels.Attribute) {\n const parsedColor = parseWithColor(bodyNodeEntity, false);\n const parsedUnit = parseWithUnits(bodyNodeEntity, false);\n \n // Add parsed unit if available\n node = parsedUnit ? { \n ...node, \n ...parsedUnit \n } : node;\n\n // Add parsed color if available\n node = parsedColor ? { \n ...node, \n ...parsedColor \n } : node;\n }\n\n }\n\n return node;\n}\n\n/**\n * Parse array of graph nodes from request body\n * @param body Array of graph nodes inside http request body\n * @returns Array of parsed graph nodes in correct form\n */\nexport const parseParsePantherNodes = (body: unknown): FullPantherEntity[] => {\n const nodeArray = body as any[]\n\n if (!_.isArray(nodeArray))\n throw new InvalidRequestError(\"Request: Grah nodes must be an array\")\n\n return nodeArray.map(PantherEntity => parseSinglePantherNode(PantherEntity))\n}\n\n// TODO: cover by better testing","import { randomUUID } from \"crypto\"\nimport _ from \"lodash\"\nimport { validateNodeLabels } from \"./validations.shared\"\nimport { parseSinglePantherNode } from \"./parse.changeNodes\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\nimport { isInEnum } from \"../../globals/coding/code.formating\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { FullPantherEntity, PantherEntity } from \"../../globals/panther/models.nodes\"\n\n/**\n * Parses a node object from the Arrows JSON format and converts it into a `PantherEntity`.\n *\n * Validates that the node's labels are arrays of supported enum values, and constructs\n * a `PantherEntity` object with the appropriate properties. Throws an `InvalidRequestError`\n * if the labels are not valid.\n *\n * @param node - The node object from the Arrows JSON to parse.\n * @returns A `PantherEntity` object representing the parsed node.\n * @throws {InvalidRequestError} If the node's labels are not an array of supported values.\n */\nconst parseNodeFromArrows = (node: any): FullPantherEntity => {\n const { labels, properties, id, caption } = node\n\n validateNodeLabels(labels)\n\n const basicGraphResult: FullPantherEntity = parseSinglePantherNode({\n labels: labels as string[],\n key: properties.key as string ?? id ?? randomUUID(),\n nameDisplay: caption ?? properties.nameDisplay as string ?? \"\",\n ...properties\n })\n\n return basicGraphResult\n}\n\n\n/**\n * Parses an edge object from the Arrows format and converts it into a `GraphEdge`.\n *\n * @param edge - The edge object to parse, containing details about the graph edge.\n * @returns A `GraphEdge` object containing the parsed edge nodes, label, and properties.\n *\n * @throws {InvalidRequestError} If the edge does not have a type (`label`).\n * @throws {InvalidRequestError} If the edge type (`label`) is not supported.\n * @throws {InvalidRequestError} If the edge does not have properties.\n * @throws {InvalidRequestError} If the edge does not have `fromId` or `toId`.\n * @throws {InvalidRequestError} If the `fromId` and `toId` are the same.\n */\nconst parseEdgeFromArrows = (edge: any): GraphEdge => {\n const {\n fromId: from,\n toId: to,\n type,\n properties\n } = edge\n\n // Determine the label, defaulting to \"RelatedTo\" if the type is invalid or not provided\n const label = (typeof type === \"string\" && type.trim().length > 0) \n ? type.trim() as UsedEdgeLabels\n : UsedEdgeLabels.RelatedTo\n \n // validate the edge properties\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge type '${label}' is not supported`)\n\n // edge must have a properties\n if (!properties)\n throw new InvalidRequestError(`Graph edge must have properties`)\n\n // edge must have fromId and toId\n if (!from || !to)\n throw new InvalidRequestError(`Graph edge must have fromId and toId`)\n\n if (from === to)\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${from} leads to ${to})`)\n\n // prepare relation tuple\n const result: GraphRelation = [from, to]\n\n // construct the parsed edge object\n const parsedEdge: GraphEdge = {\n edgeNodes: result,\n label,\n properties\n }\n\n // return the parsed edge\n return parsedEdge\n}\n\n/**\n * Parses a JSON object representing nodes and relationships (edges) from the Arrows JSON.\n *\n * @param body - The input JSON object to parse. Expected to contain `nodes` and `relationships` arrays.\n * @returns An object containing parsed `nodes` and `edges` arrays.\n * @throws {InvalidRequestError} If the input is not a valid object, or if required properties are missing or not arrays.\n */\nexport const parseArrowsJson = (body: unknown): { nodes: FullPantherEntity[]; edges: GraphEdge[] } => {\n\n // Check if the body is a valid object\n if (typeof body !== \"object\" || body === null)\n throw new InvalidRequestError(\"Invalid JSON format\")\n\n // Check if the body contains the required properties\n if (!(\"nodes\" in body) || !(\"relationships\" in body))\n throw new InvalidRequestError(\"Invalid JSON format: Missing nodes or relationships\")\n\n // Check if nodes and relationships are arrays\n if (!_.isArray((body as any).nodes) || !_.isArray((body as any).relationships))\n throw new InvalidRequestError(\"Invalid JSON format: nodes and relationships must be arrays\")\n\n // Extract nodes and relationships from the body\n const { nodes: rawNodes, relationships: rawEdges } = body as any\n\n // Define default values for nodes and edges\n const nodes: PantherEntity[] = rawNodes ?? []\n const edges: GraphEdge[] = rawEdges ?? []\n\n // Parse nodes and edges using the defined functions\n const parsedNodes = nodes.map((node: any) => parseNodeFromArrows(node))\n const parsedEdges = edges.map((edge: any) => parseEdgeFromArrows(edge))\n\n return {\n nodes: parsedNodes,\n edges: parsedEdges\n }\n}","import _ from \"lodash\"\nimport { InvalidRequestError } from \"./errors.api\"\nimport { GraphEdge, GraphRelation } from \"../../globals/panther/models.edges\"\nimport { enumValuesToString, isInEnum } from \"../../globals/coding/code.formating\"\nimport { UsedEdgeLabels } from \"../../globals/panther/enums.panther\"\n\nexport const parseRichEdges = (body: unknown): GraphEdge[] => {\n\n const parseSingleEdge = (edge: unknown): GraphEdge => {\n\n const {label, fromKey, toKey, properties } = edge as any\n\n if (!label || typeof label !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string label\")\n\n if (!isInEnum(label, UsedEdgeLabels))\n throw new InvalidRequestError(`Graph edge label is not allowed (${label}). Must be one of: ${enumValuesToString(UsedEdgeLabels)}`)\n\n if (!fromKey || typeof fromKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string fromKey\")\n\n if (!toKey || typeof toKey !== \"string\")\n throw new InvalidRequestError(\"Every graph edge must have string toKey\")\n\n if (fromKey === toKey)\n throw new InvalidRequestError(`Cannot connect two same keys in graph edge (${fromKey})`)\n\n const parsedEdge: GraphEdge = {\n label: label as UsedEdgeLabels,\n edgeNodes: [fromKey, toKey],\n properties: properties || {}\n }\n\n return parsedEdge\n }\n const edgesRaw = body as any[]\n \n if (!_.isArray(edgesRaw))\n throw new InvalidRequestError(\"Graph edges must be an array of edges\")\n\n if (edgesRaw.length === 0)\n throw new InvalidRequestError(\"Graph edges array must not be empty\")\n\n const parsedEdges = edgesRaw.map(edge => parseSingleEdge(edge))\n return parsedEdges\n}\n\n/**\n * Parse body to graph relation\n * @param body Body from request\n * @returns Graph relation\n */\nexport const parseEqualEdges = (body: unknown): GraphRelation[] => {\n const relations = body as any[]\n\n /**\n * Check single edge relation and parse it\n * @param edgeRelation \n * @returns Parsed edge relation\n */\n const parseSingleEdgeRelation = (edgeRelation: unknown): GraphRelation => {\n\n if (!_.isArray(edgeRelation))\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation.length !== 2)\n throw new InvalidRequestError(\"Every graph relation must be two element string tuple [string, string]\")\n\n if (edgeRelation[0] === edgeRelation[1])\n throw new InvalidRequestError(`Cannot connect two same keys in graph relation (${edgeRelation[0]})`)\n\n return edgeRelation as GraphRelation\n }\n\n if (!_.isArray(relations))\n throw new InvalidRequestError(\"Graph edges must be an array of tuples\")\n\n const validatedGraphEdges = relations.map(edge => parseSingleEdgeRelation(edge))\n\n return validatedGraphEdges\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,C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AAC,CAAC,CAAC;YACnC,MAAM,IAAI,mBAAmB,CAAC,CAAA,gDAAA,EAAmD,YAAY,CAAC,CAAC,CAAC,CAAA,CAAA,CAAG,CAAC;AAExG,QAAA,OAAO,YAA6B;AACxC,IAAA,CAAC;AAED,IAAA,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACrB,QAAA,MAAM,IAAI,mBAAmB,CAAC,wCAAwC,CAAC;AAE3E,IAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAEhF,IAAA,OAAO,mBAAmB;AAC9B;;;;"}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@gisatcz/ptr-be-core",
3
- "version": "0.0.1-dev.8",
3
+ "version": "0.0.2",
4
4
  "description": "Shared core library for PTR BE services",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Gisat/ptr-be-core.git"
8
+ },
5
9
  "type": "module",
6
10
  "files": [
7
11
  "dist/"