UNPKG

@ultipa-graph/ultipa-driver

Version:

NodeJS SDK for ultipa-server 5.1

62 lines 2.4 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.printPath = exports.getPathsPrintInfo = void 0; const ULTIPA = __importStar(require("../types/types")); const alias_1 = require("./alias"); function getPathsPrintInfo(paths) { let pathsStr = []; paths?.forEach(p => { let pathString = []; p.edges?.forEach((edge, index) => { let node = p.nodes[index]; let d1 = "-"; let d2 = "-"; if (edge) { if (edge?.from == node?.id) { d2 = "->"; } else { d1 = "<-"; } } pathString.push(`(${node?.id || node?.uuid || null}) ${d1} [${edge?.uuid || null}] ${d2}`); }); let lastNode = p.nodes[p.length() - 1]; pathString.push(`(${lastNode?.id || lastNode?.uuid || null})`); pathsStr.push(pathString.join(" ")); }); return pathsStr; } exports.getPathsPrintInfo = getPathsPrintInfo; function printPath(d) { if (d?.type == ULTIPA.ResultType.RESULT_TYPE_PATH) { // let paths = d.asPaths() (0, alias_1.printAlias)(d); // console.table(getPathsPrintInfo(paths)) } } exports.printPath = printPath; //# sourceMappingURL=path.js.map