file-graph
Advanced tools
+156
-121
@@ -1,2 +0,13 @@ | ||
| import { uuid, createError } from '../utils'; | ||
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const utils_1 = require("../utils"); | ||
| class FileGraphIml { | ||
@@ -7,14 +18,18 @@ constructor(storageFile, asyncTaskQueue) { | ||
| } | ||
| async createVertex(data) { | ||
| return this.asyncTaskQueue.addTask(async () => { | ||
| const vertex = this.vertexTemplate(data); | ||
| await this.storageFile.appendFile(vertex); | ||
| return vertex; | ||
| createVertex(data) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return this.asyncTaskQueue.addTask(() => __awaiter(this, void 0, void 0, function* () { | ||
| const vertex = this.vertexTemplate(data); | ||
| yield this.storageFile.appendFile(vertex); | ||
| return vertex; | ||
| })); | ||
| }); | ||
| } | ||
| async createVertices(data) { | ||
| return this.asyncTaskQueue.addTask(async () => { | ||
| const vertices = data.map(this.vertexTemplate); | ||
| await this.storageFile.appendFile(vertices); | ||
| return vertices; | ||
| createVertices(data) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| return this.asyncTaskQueue.addTask(() => __awaiter(this, void 0, void 0, function* () { | ||
| const vertices = data.map(this.vertexTemplate); | ||
| yield this.storageFile.appendFile(vertices); | ||
| return vertices; | ||
| })); | ||
| }); | ||
@@ -31,39 +46,47 @@ } | ||
| } | ||
| async findAll(predicate) { | ||
| const vertices = []; | ||
| const findVertex = vertex => { | ||
| if (predicate(vertex)) | ||
| vertices.push(vertex); | ||
| }; | ||
| await this.storageFile.searchLine(findVertex); | ||
| return vertices; | ||
| findAll(predicate) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const vertices = []; | ||
| const findVertex = vertex => { | ||
| if (predicate(vertex)) | ||
| vertices.push(vertex); | ||
| }; | ||
| yield this.storageFile.searchLine(findVertex); | ||
| return vertices; | ||
| }); | ||
| } | ||
| async forEachVertex(callbackVertex) { | ||
| await this.storageFile.searchLine(callbackVertex); | ||
| forEachVertex(callbackVertex) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| yield this.storageFile.searchLine(callbackVertex); | ||
| }); | ||
| } | ||
| async createEdge(ids) { | ||
| const updater = (vertex) => { | ||
| const index = ids.indexOf(vertex.id); | ||
| if (index === -1) | ||
| return; | ||
| const neighbors = [ids[index - 1], ids[index + 1]].filter(neighbor => neighbor !== undefined); | ||
| const links = vertex.links; | ||
| neighbors.forEach(neighbor => !links.includes(neighbor) && links.push(neighbor)); | ||
| return { links }; | ||
| }; | ||
| const updateResult = this.storageFile.updateLine(updater); | ||
| return this.asyncTaskQueue.addTask(() => updateResult); | ||
| createEdge(ids) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const updater = (vertex) => { | ||
| const index = ids.indexOf(vertex.id); | ||
| if (index === -1) | ||
| return; | ||
| const neighbors = [ids[index - 1], ids[index + 1]].filter(neighbor => neighbor !== undefined); | ||
| const links = vertex.links; | ||
| neighbors.forEach(neighbor => !links.includes(neighbor) && links.push(neighbor)); | ||
| return { links }; | ||
| }; | ||
| const updateResult = this.storageFile.updateLine(updater); | ||
| return this.asyncTaskQueue.addTask(() => updateResult); | ||
| }); | ||
| } | ||
| async createArcs(ids) { | ||
| const updater = (vertex) => { | ||
| const index = ids.indexOf(vertex.id); | ||
| if (index === -1) | ||
| return; | ||
| const nextVertexId = ids[index + 1]; | ||
| if (nextVertexId && !vertex.links.includes(nextVertexId)) { | ||
| return { links: [...vertex.links, nextVertexId] }; | ||
| } | ||
| }; | ||
| const updateResult = this.storageFile.updateLine(updater); | ||
| return this.asyncTaskQueue.addTask(() => updateResult); | ||
| createArcs(ids) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const updater = (vertex) => { | ||
| const index = ids.indexOf(vertex.id); | ||
| if (index === -1) | ||
| return; | ||
| const nextVertexId = ids[index + 1]; | ||
| if (nextVertexId && !vertex.links.includes(nextVertexId)) { | ||
| return { links: [...vertex.links, nextVertexId] }; | ||
| } | ||
| }; | ||
| const updateResult = this.storageFile.updateLine(updater); | ||
| return this.asyncTaskQueue.addTask(() => updateResult); | ||
| }); | ||
| } | ||
@@ -75,3 +98,3 @@ createArc(sourceVertexId, targetVertexId) { | ||
| if (vertex.links.includes(targetVertexId)) { | ||
| throw createError('TARGET_VERTEX_ALREADY_EXISTS', targetVertexId, sourceVertexId); | ||
| throw (0, utils_1.createError)('TARGET_VERTEX_ALREADY_EXISTS', targetVertexId, sourceVertexId); | ||
| } | ||
@@ -86,3 +109,3 @@ return { links: [...vertex.links, targetVertexId] }; | ||
| if (!vertex.links.includes(targetVertexId)) { | ||
| throw createError('TARGET_VERTEX_DOES_NOT_EXIST', targetVertexId, sourceVertexId); | ||
| throw (0, utils_1.createError)('TARGET_VERTEX_DOES_NOT_EXIST', targetVertexId, sourceVertexId); | ||
| } | ||
@@ -92,93 +115,105 @@ return { links: vertex.links.filter(v => v !== targetVertexId) }; | ||
| } | ||
| async hasArc(sourceVertexId, targetVertexId) { | ||
| const targetVertexExists = await this.storageFile.searchLine(vertex => vertex.id === sourceVertexId); | ||
| if (!targetVertexExists) { | ||
| throw createError('TARGET_VERTEX_NOT_FOUND', targetVertexId); | ||
| } | ||
| return targetVertexExists.links.includes(targetVertexId); | ||
| hasArc(sourceVertexId, targetVertexId) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const targetVertexExists = yield this.storageFile.searchLine(vertex => vertex.id === sourceVertexId); | ||
| if (!targetVertexExists) { | ||
| throw (0, utils_1.createError)('TARGET_VERTEX_NOT_FOUND', targetVertexId); | ||
| } | ||
| return targetVertexExists.links.includes(targetVertexId); | ||
| }); | ||
| } | ||
| async findUpToLevel(vertexId, maxLevel) { | ||
| if (maxLevel < 0) | ||
| throw createError('NEGATIVE_LEVEL'); | ||
| const startingVertex = await this.checkVertex(vertexId); | ||
| const resultVertices = []; | ||
| const queue = [{ vertex: startingVertex, currentLevel: 0 }]; | ||
| while (queue.length > 0) { | ||
| const { vertex, currentLevel } = queue.shift(); | ||
| const vertexLinks = vertex.links; | ||
| const nextLevel = currentLevel + 1; | ||
| if (currentLevel > maxLevel) | ||
| break; | ||
| resultVertices.push({ ...vertex, level: currentLevel }); | ||
| if (!vertexLinks.length) | ||
| continue; | ||
| await this.storageFile.searchLine(vertex => { | ||
| const isNewArc = vertexLinks.includes(vertex.id) && | ||
| !resultVertices.some(addedVertex => addedVertex.id === vertex.id); | ||
| if (isNewArc) | ||
| queue.push({ vertex, currentLevel: nextLevel }); | ||
| }); | ||
| } | ||
| return resultVertices; | ||
| } | ||
| async hasPath(sourceVertexId, targetVertexId) { | ||
| let isExistVertex = false; | ||
| await this.traverseGraph(sourceVertexId, vertex => { | ||
| if (vertex.id == targetVertexId) { | ||
| isExistVertex = true; | ||
| return true; | ||
| findUpToLevel(vertexId, maxLevel) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| if (maxLevel < 0) | ||
| throw (0, utils_1.createError)('NEGATIVE_LEVEL'); | ||
| const startingVertex = yield this.checkVertex(vertexId); | ||
| const resultVertices = []; | ||
| const queue = [{ vertex: startingVertex, currentLevel: 0 }]; | ||
| while (queue.length > 0) { | ||
| const { vertex, currentLevel } = queue.shift(); | ||
| const vertexLinks = vertex.links; | ||
| const nextLevel = currentLevel + 1; | ||
| if (currentLevel > maxLevel) | ||
| break; | ||
| resultVertices.push(Object.assign(Object.assign({}, vertex), { level: currentLevel })); | ||
| if (!vertexLinks.length) | ||
| continue; | ||
| yield this.storageFile.searchLine(vertex => { | ||
| const isNewArc = vertexLinks.includes(vertex.id) && | ||
| !resultVertices.some(addedVertex => addedVertex.id === vertex.id); | ||
| if (isNewArc) | ||
| queue.push({ vertex, currentLevel: nextLevel }); | ||
| }); | ||
| } | ||
| return resultVertices; | ||
| }); | ||
| return isExistVertex; | ||
| } | ||
| async searchVerticesFrom(vertexId, predicate) { | ||
| const results = []; | ||
| await this.traverseGraph(vertexId, vertex => { | ||
| if (predicate(vertex)) | ||
| results.push(vertex); | ||
| hasPath(sourceVertexId, targetVertexId) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| let isExistVertex = false; | ||
| yield this.traverseGraph(sourceVertexId, vertex => { | ||
| if (vertex.id == targetVertexId) { | ||
| isExistVertex = true; | ||
| return true; | ||
| } | ||
| }); | ||
| return isExistVertex; | ||
| }); | ||
| return results; | ||
| } | ||
| async traverseGraph(startVertexId, action) { | ||
| const startingVertex = await this.checkVertex(startVertexId); | ||
| const queue = [startingVertex]; | ||
| const visited = new Set(); | ||
| while (queue.length > 0) { | ||
| const currentVertex = queue.pop(); | ||
| visited.add(currentVertex.id); | ||
| const abort = action(currentVertex); | ||
| if (abort) | ||
| return; | ||
| const vertexLinks = currentVertex.links; | ||
| if (!vertexLinks.length) | ||
| continue; | ||
| await this.storageFile.searchLine(linkedVertex => { | ||
| const isUnvisited = vertexLinks.includes(linkedVertex.id) && | ||
| !visited.has(linkedVertex.id); | ||
| if (isUnvisited) | ||
| queue.push(linkedVertex); | ||
| searchVerticesFrom(vertexId, predicate) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const results = []; | ||
| yield this.traverseGraph(vertexId, vertex => { | ||
| if (predicate(vertex)) | ||
| results.push(vertex); | ||
| }); | ||
| } | ||
| return results; | ||
| }); | ||
| } | ||
| traverseGraph(startVertexId, action) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const startingVertex = yield this.checkVertex(startVertexId); | ||
| const queue = [startingVertex]; | ||
| const visited = new Set(); | ||
| while (queue.length > 0) { | ||
| const currentVertex = queue.pop(); | ||
| visited.add(currentVertex.id); | ||
| const abort = action(currentVertex); | ||
| if (abort) | ||
| return; | ||
| const vertexLinks = currentVertex.links; | ||
| if (!vertexLinks.length) | ||
| continue; | ||
| yield this.storageFile.searchLine(linkedVertex => { | ||
| const isUnvisited = vertexLinks.includes(linkedVertex.id) && | ||
| !visited.has(linkedVertex.id); | ||
| if (isUnvisited) | ||
| queue.push(linkedVertex); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| updateArc(targetVertexId, updater) { | ||
| return this.asyncTaskQueue.addTask(async () => { | ||
| const targetVertexExists = await this.storageFile.searchLine(vertex => vertex.id === targetVertexId); | ||
| return this.asyncTaskQueue.addTask(() => __awaiter(this, void 0, void 0, function* () { | ||
| const targetVertexExists = yield this.storageFile.searchLine(vertex => vertex.id === targetVertexId); | ||
| if (!targetVertexExists) { | ||
| throw createError('TARGET_VERTEX_NOT_FOUND', targetVertexId); | ||
| throw (0, utils_1.createError)('TARGET_VERTEX_NOT_FOUND', targetVertexId); | ||
| } | ||
| const updateResult = await this.storageFile.updateLine(updater); | ||
| const updateResult = yield this.storageFile.updateLine(updater); | ||
| return updateResult; | ||
| })); | ||
| } | ||
| checkVertex(vertexId) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const startingVertex = yield this.storageFile.searchLine(vertex => vertex.id === vertexId); | ||
| if (!startingVertex) | ||
| throw (0, utils_1.createError)('VERTEX_NOT_FOUND', vertexId); | ||
| return startingVertex; | ||
| }); | ||
| } | ||
| async checkVertex(vertexId) { | ||
| const startingVertex = await this.storageFile.searchLine(vertex => vertex.id === vertexId); | ||
| if (!startingVertex) | ||
| throw createError('VERTEX_NOT_FOUND', vertexId); | ||
| return startingVertex; | ||
| } | ||
| vertexTemplate(data) { | ||
| return { id: uuid(), data, links: [] }; | ||
| return { id: (0, utils_1.uuid)(), data, links: [] }; | ||
| } | ||
| } | ||
| export default FileGraphIml; | ||
| exports.default = FileGraphIml; | ||
| //# sourceMappingURL=file.graph.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"file.graph.js","sourceRoot":"","sources":["../../lib/graph/file.graph.ts"],"names":[],"mappings":"AAYA,OAAO,EAAkB,IAAI,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,YAAY;IAChB,YACmB,WAAwB,EACxB,cAA8B;QAD9B,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAEG,KAAK,CAAC,YAAY,CAAmB,IAAO;QACjD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC1C,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,cAAc,CACzB,IAAS;QAET,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC/C,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC5C,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,YAAY,CACjB,OAAoB;QAEpB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CACtC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CACrC,CAAC;IACJ,CAAC;IAEM,YAAY,CACjB,SAAwB;QAExB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CACtC,IAAI,CAAC,WAAW,CAAC,UAAU,CA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AEa,WAAW,CAAmB,QAAkB;;YAC5D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CACtD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CACjC,CAAC;YACF,IAAI,CAAC,cAAc;gBAAE,MAAM,IAAA,mBAAW,EAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YACrE,OAAO,cAAc,CAAC;QACxB,CAAC;KAAA;IAEO,cAAc,CAAmB,IAAO;QAC9C,OAAO,EAAE,EAAE,EAAE,IAAA,YAAI,GAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;CACF;AAED,kBAAe,YAAY,CAAC"} |
+11
-4
@@ -1,5 +0,12 @@ | ||
| import { asyncTaskQueue } from 'lib/utils'; | ||
| import FileGraphIml from './file.graph'; | ||
| import StorageFile from './storage.file'; | ||
| export const FileGraph = (path) => new FileGraphIml(new StorageFile(path), asyncTaskQueue); | ||
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.FileGraph = void 0; | ||
| const utils_1 = require("../utils"); | ||
| const file_graph_1 = __importDefault(require("./file.graph")); | ||
| const storage_file_1 = __importDefault(require("./storage.file")); | ||
| const FileGraph = (path) => new file_graph_1.default(new storage_file_1.default(path), utils_1.asyncTaskQueue); | ||
| exports.FileGraph = FileGraph; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACxC,IAAI,YAAY,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/graph/index.ts"],"names":[],"mappings":";;;;;;AAAA,oCAA0C;AAC1C,8DAAwC;AACxC,kEAAyC;AAElC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACxC,IAAI,oBAAY,CAAC,IAAI,sBAAW,CAAC,IAAI,CAAC,EAAE,sBAAc,CAAC,CAAC;AAD7C,QAAA,SAAS,aACoC"} |
@@ -1,6 +0,27 @@ | ||
| import { createReadStream, createWriteStream, promises as fsPromises, } from 'fs'; | ||
| import { appendFile } from 'fs/promises'; | ||
| import { finished } from 'stream/promises'; | ||
| import readline from 'readline'; | ||
| import { mergeVertices, uuid } from '../utils'; | ||
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __asyncValues = (this && this.__asyncValues) || function (o) { | ||
| if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
| var m = o[Symbol.asyncIterator], i; | ||
| return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
| function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
| function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const fs_1 = require("fs"); | ||
| const promises_1 = require("fs/promises"); | ||
| const promises_2 = require("stream/promises"); | ||
| const readline_1 = __importDefault(require("readline")); | ||
| const utils_1 = require("../utils"); | ||
| class StorageFile { | ||
@@ -10,59 +31,78 @@ constructor(path) { | ||
| } | ||
| async appendFile(vertex) { | ||
| const vertexSer = Array.isArray(vertex) | ||
| ? vertex.map(this.serializer).join('\n') + '\n' | ||
| : this.serializer(vertex) + '\n'; | ||
| return appendFile(this.path, vertexSer); | ||
| } | ||
| async searchLine(predicate) { | ||
| const fileStream = this.createLineStream(true); | ||
| return await fileStream(async (line) => { | ||
| const vertex = this.deserializer(line); | ||
| if (predicate(vertex)) | ||
| return vertex; | ||
| appendFile(vertex) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const vertexSer = Array.isArray(vertex) | ||
| ? vertex.map(this.serializer).join('\n') + '\n' | ||
| : this.serializer(vertex) + '\n'; | ||
| return (0, promises_1.appendFile)(this.path, vertexSer); | ||
| }); | ||
| } | ||
| async updateLine(updater) { | ||
| const tempPath = `${this.path}.${uuid()}.tmp`; | ||
| let updated = false; | ||
| const fileStream = this.createLineStream(false); | ||
| const tempStream = createWriteStream(tempPath, { encoding: 'utf8' }); | ||
| try { | ||
| await fileStream(async (line) => { | ||
| searchLine(predicate) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const fileStream = this.createLineStream(true); | ||
| return yield fileStream((line) => __awaiter(this, void 0, void 0, function* () { | ||
| const vertex = this.deserializer(line); | ||
| const updaterVertex = updater(vertex); | ||
| if (updaterVertex === true) | ||
| return void (updated = true); | ||
| if (typeof updaterVertex === 'object' && updaterVertex !== null) { | ||
| const newVertices = mergeVertices(vertex, updaterVertex); | ||
| tempStream.write(this.serializer(newVertices) + '\n'); | ||
| return void (updated = true); | ||
| } | ||
| tempStream.write(line + '\n'); | ||
| }); | ||
| } | ||
| catch (error) { | ||
| await fsPromises.unlink(tempPath); | ||
| throw error; | ||
| } | ||
| finally { | ||
| tempStream.end(); | ||
| } | ||
| await finished(tempStream); | ||
| await fsPromises.rename(tempPath, this.path); | ||
| return updated; | ||
| if (predicate(vertex)) | ||
| return vertex; | ||
| })); | ||
| }); | ||
| } | ||
| updateLine(updater) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| const tempPath = `${this.path}.${(0, utils_1.uuid)()}.tmp`; | ||
| let updated = false; | ||
| const fileStream = this.createLineStream(false); | ||
| const tempStream = (0, fs_1.createWriteStream)(tempPath, { encoding: 'utf8' }); | ||
| try { | ||
| yield fileStream((line) => __awaiter(this, void 0, void 0, function* () { | ||
| const vertex = this.deserializer(line); | ||
| const updaterVertex = updater(vertex); | ||
| if (updaterVertex === true) | ||
| return void (updated = true); | ||
| if (typeof updaterVertex === 'object' && updaterVertex !== null) { | ||
| const newVertices = (0, utils_1.mergeVertices)(vertex, updaterVertex); | ||
| tempStream.write(this.serializer(newVertices) + '\n'); | ||
| return void (updated = true); | ||
| } | ||
| tempStream.write(line + '\n'); | ||
| })); | ||
| } | ||
| catch (error) { | ||
| yield fs_1.promises.unlink(tempPath); | ||
| throw error; | ||
| } | ||
| finally { | ||
| tempStream.end(); | ||
| } | ||
| yield (0, promises_2.finished)(tempStream); | ||
| yield fs_1.promises.rename(tempPath, this.path); | ||
| return updated; | ||
| }); | ||
| } | ||
| createLineStream(canAbort) { | ||
| const fileStream = createReadStream(this.path, 'utf8'); | ||
| const rl = readline.createInterface({ | ||
| const fileStream = (0, fs_1.createReadStream)(this.path, 'utf8'); | ||
| const rl = readline_1.default.createInterface({ | ||
| input: fileStream, | ||
| crlfDelay: Infinity, | ||
| }); | ||
| return async (read) => { | ||
| return (read) => __awaiter(this, void 0, void 0, function* () { | ||
| var _a, e_1, _b, _c; | ||
| try { | ||
| for await (const line of rl) { | ||
| const result = await read(line); | ||
| if (canAbort && result) | ||
| return result; | ||
| try { | ||
| for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), _a = rl_1_1.done, !_a; _d = true) { | ||
| _c = rl_1_1.value; | ||
| _d = false; | ||
| const line = _c; | ||
| const result = yield read(line); | ||
| if (canAbort && result) | ||
| return result; | ||
| } | ||
| } | ||
| catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
| finally { | ||
| try { | ||
| if (!_d && !_a && (_b = rl_1.return)) yield _b.call(rl_1); | ||
| } | ||
| finally { if (e_1) throw e_1.error; } | ||
| } | ||
| } | ||
@@ -74,3 +114,3 @@ finally { | ||
| return null; | ||
| }; | ||
| }); | ||
| } | ||
@@ -96,3 +136,3 @@ serializer(vertex) { | ||
| } | ||
| export default StorageFile; | ||
| exports.default = StorageFile; | ||
| //# sourceMappingURL=storage.file.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"storage.file.js","sourceRoot":"","sources":["../../lib/graph/storage.file.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,IAAI,UAAU,GACvB,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAU/C,MAAM,WAAW;IACf,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAEtC,KAAK,CAAC,UAAU,CAAmB,MAAS;QACjD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACrC,CAAC,CAAC,MAAM,CAAC,GAAG,C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CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACO,YAAY,CAAC,IAAY;QAC/B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,kBAAe,WAAW,CAAC"} |
+18
-2
@@ -1,3 +0,19 @@ | ||
| export * from './graph'; | ||
| export * from './interfaces'; | ||
| "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 __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| __exportStar(require("./graph"), exports); | ||
| __exportStar(require("./interfaces"), exports); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,+CAA6B"} |
@@ -1,3 +0,7 @@ | ||
| export class FileGraphAbstract { | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.FileGraphAbstract = void 0; | ||
| class FileGraphAbstract { | ||
| } | ||
| exports.FileGraphAbstract = FileGraphAbstract; | ||
| //# sourceMappingURL=graph.interface.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"graph.interface.js","sourceRoot":"","sources":["../../lib/interfaces/graph.interface.ts"],"names":[],"mappings":"AAUA,MAAM,OAAgB,iBAAiB;CAuMtC"} | ||
| {"version":3,"file":"graph.interface.js","sourceRoot":"","sources":["../../lib/interfaces/graph.interface.ts"],"names":[],"mappings":";;;AAUA,MAAsB,iBAAiB;CAuMtC;AAvMD,8CAuMC"} |
@@ -1,3 +0,19 @@ | ||
| export * from './graph.interface'; | ||
| export * from './params.interface'; | ||
| "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 __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| __exportStar(require("./graph.interface"), exports); | ||
| __exportStar(require("./params.interface"), exports); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC"} |
@@ -1,2 +0,3 @@ | ||
| export {}; | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=params.interface.js.map |
@@ -1,2 +0,14 @@ | ||
| export class AsyncTaskQueue { | ||
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.asyncTaskQueue = exports.AsyncTaskQueue = void 0; | ||
| class AsyncTaskQueue { | ||
| constructor() { | ||
@@ -12,19 +24,22 @@ this.queue = []; | ||
| } | ||
| async processQueue() { | ||
| if (this.isProcessing) | ||
| return; | ||
| this.isProcessing = true; | ||
| try { | ||
| while (this.queue.length > 0) { | ||
| const task = this.queue.shift(); | ||
| if (task) | ||
| await task(); | ||
| processQueue() { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| if (this.isProcessing) | ||
| return; | ||
| this.isProcessing = true; | ||
| try { | ||
| while (this.queue.length > 0) { | ||
| const task = this.queue.shift(); | ||
| if (task) | ||
| yield task(); | ||
| } | ||
| } | ||
| } | ||
| finally { | ||
| this.isProcessing = false; | ||
| } | ||
| finally { | ||
| this.isProcessing = false; | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| export const asyncTaskQueue = new AsyncTaskQueue(); | ||
| exports.AsyncTaskQueue = AsyncTaskQueue; | ||
| exports.asyncTaskQueue = new AsyncTaskQueue(); | ||
| //# sourceMappingURL=async-task-queue.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"async-task-queue.js","sourceRoot":"","sources":["../../lib/utils/async-task-queue.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,cAAc;IAA3B;QACU,UAAK,GAAgB,EAAE,CAAC;QACxB,iBAAY,GAAG,KAAK,CAAC;IAqB/B,CAAC;IAnBC,OAAO,CAAI,IAAe;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBAChC,IAAI,IAAI;oBAAE,MAAM,IAAI,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"} | ||
| {"version":3,"file":"async-task-queue.js","sourceRoot":"","sources":["../../lib/utils/async-task-queue.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,MAAa,cAAc;IAA3B;QACU,UAAK,GAAgB,EAAE,CAAC;QACxB,iBAAY,GAAG,KAAK,CAAC;IAqB/B,CAAC;IAnBC,OAAO,CAAI,IAAe;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;IAEa,YAAY;;YACxB,IAAI,IAAI,CAAC,YAAY;gBAAE,OAAO;YAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChC,IAAI,IAAI;wBAAE,MAAM,IAAI,EAAE,CAAC;gBACzB,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC;KAAA;CACF;AAvBD,wCAuBC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"} |
@@ -0,1 +1,4 @@ | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.createError = void 0; | ||
| const ERRORS = { | ||
@@ -16,3 +19,3 @@ VERTEX_NOT_FOUND: (id) => `Vertex with id ${id} not found.`, | ||
| }; | ||
| export { createError }; | ||
| exports.createError = createError; | ||
| //# sourceMappingURL=errors.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/utils/errors.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,gBAAgB,EAAE,CAAC,EAAY,EAAE,E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,WAAW,GAAG,CAAC,IAAyB,EAAE,GAAG,IAAW,EAAE,EAAE;IAChE,MAAM,aAAa,GAA0C,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1E,IAAI,CAAC,aAAa;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAC1D,OAAO,IAAI,KAAK,CACd,OAAO,aAAa,KAAK,UAAU;QACjC,CAAC,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC,aAAa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEO,kCAAW"} |
+20
-4
@@ -1,5 +0,21 @@ | ||
| export * from './uuid'; | ||
| export * from './async-task-queue'; | ||
| export * from './merge-vertex'; | ||
| export * from './errors'; | ||
| "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 __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| __exportStar(require("./uuid"), exports); | ||
| __exportStar(require("./async-task-queue"), exports); | ||
| __exportStar(require("./merge-vertex"), exports); | ||
| __exportStar(require("./errors"), exports); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,qDAAmC;AACnC,iDAA+B;AAC/B,2CAAyB"} |
@@ -1,10 +0,10 @@ | ||
| import { IVertex } from 'lib/interfaces'; | ||
| import { IVertex } from '../interfaces'; | ||
| export declare const mergeVertices: <T extends object>(vertex: IVertex<T>, updaterVertex: IVertex<T> | Record<string, any>) => { | ||
| data: any; | ||
| id: import("lib/interfaces").uuidType; | ||
| links: Array<import("lib/interfaces").uuidType>; | ||
| id: import("../interfaces").uuidType; | ||
| links: Array<import("../interfaces").uuidType>; | ||
| } | { | ||
| data: any; | ||
| id: import("lib/interfaces").uuidType; | ||
| links: Array<import("lib/interfaces").uuidType>; | ||
| id: import("../interfaces").uuidType; | ||
| links: Array<import("../interfaces").uuidType>; | ||
| }; |
@@ -1,9 +0,6 @@ | ||
| export const mergeVertices = (vertex, updaterVertex) => ({ | ||
| ...vertex, | ||
| ...updaterVertex, | ||
| data: { | ||
| ...vertex.data, | ||
| ...(updaterVertex?.data || {}), | ||
| }, | ||
| }); | ||
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.mergeVertices = void 0; | ||
| const mergeVertices = (vertex, updaterVertex) => (Object.assign(Object.assign(Object.assign({}, vertex), updaterVertex), { data: Object.assign(Object.assign({}, vertex.data), ((updaterVertex === null || updaterVertex === void 0 ? void 0 : updaterVertex.data) || {})) })); | ||
| exports.mergeVertices = mergeVertices; | ||
| //# sourceMappingURL=merge-vertex.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"merge-vertex.js","sourceRoot":"","sources":["../../lib/utils/merge-vertex.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAkB,EAClB,aAA+C,EAC/C,EAAE,CAAC,CAAC;IACJ,GAAG,MAAM;IACT,GAAG,aAAa;IAChB,IAAI,EAAE;QACJ,GAAG,MAAM,CAAC,IAAI;QACd,GAAG,CAAC,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC;KAC/B;CACF,CAAC,CAAC"} | ||
| {"version":3,"file":"merge-vertex.js","sourceRoot":"","sources":["../../lib/utils/merge-vertex.ts"],"names":[],"mappings":";;;AAEO,MAAM,aAAa,GAAG,CAC3B,MAAkB,EAClB,aAA+C,EAC/C,EAAE,CAAC,+CACA,MAAM,GACN,aAAa,KAChB,IAAI,kCACC,MAAM,CAAC,IAAI,GACX,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,KAAI,EAAE,CAAC,KAEhC,CAAC;AAVU,QAAA,aAAa,iBAUvB"} |
@@ -1,3 +0,10 @@ | ||
| import crypto from 'crypto'; | ||
| export const uuid = () => crypto.randomUUID({ disableEntropyCache: false }); | ||
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.uuid = void 0; | ||
| const crypto_1 = __importDefault(require("crypto")); | ||
| const uuid = () => crypto_1.default.randomUUID({ disableEntropyCache: false }); | ||
| exports.uuid = uuid; | ||
| //# sourceMappingURL=uuid.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../lib/utils/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC"} | ||
| {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../lib/utils/uuid.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AACrB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,gBAAM,CAAC,UAAU,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;AAA/D,QAAA,IAAI,QAA2D"} |
+5
-7
| { | ||
| "name": "file-graph", | ||
| "version": "0.12.1", | ||
| "version": "1.0.0", | ||
| "main": "./dist/index.js", | ||
| "module": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "files": [ | ||
| "./dist" | ||
| ], | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "tsc -p tsconfig.build.json", | ||
| "build": "tsc -p tsconfig.cjs.json", | ||
| "prettier": "prettier 'lib/**/**.{js,ts}' 'test/**/**.{js,ts}' --check --ignore-unknown", | ||
@@ -62,2 +57,5 @@ "prettier:fix": "prettier lib/**/**.{js,ts}' 'test/**/**.{js,ts}' -w", | ||
| ], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "npm": { | ||
@@ -64,0 +62,0 @@ "publish": true |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
64046
17.08%752
26.39%0
-100%No
NaN