diff --git a/dist/clue/base/CLUEGraphManager.d.ts b/dist/clue/base/CLUEGraphManager.d.ts index 6c81ff611..28263bef7 100644 --- a/dist/clue/base/CLUEGraphManager.d.ts +++ b/dist/clue/base/CLUEGraphManager.d.ts @@ -43,7 +43,7 @@ export declare class CLUEGraphManager extends EventHandler { chooseLazy(rejectOnNotFound?: boolean): PromiseLike; choose(list: IProvenanceGraphDataDescription[], rejectOnNotFound?: boolean): PromiseLike; loadOrClone(graph: IProvenanceGraphDataDescription, isSelect: boolean): void; - cloneLocal(graph: IProvenanceGraphDataDescription): Promise | PromiseLike; + cloneLocal(graph: IProvenanceGraphDataDescription): PromiseLike | Promise; /** * create the provenance graph selection dropdown and handles the graph selection * @param manager diff --git a/dist/clue/graph/LocalStorageGraph.d.ts b/dist/clue/graph/LocalStorageGraph.d.ts index e3a4632fa..5ce7d368e 100644 --- a/dist/clue/graph/LocalStorageGraph.d.ts +++ b/dist/clue/graph/LocalStorageGraph.d.ts @@ -3,6 +3,8 @@ import { GraphEdge, GraphNode, IGraph, IGraphDataDescription } from './graph'; export declare class LocalStorageGraph extends GraphBase implements IGraph { private storage; private updateHandler; + private setItem; + private getItem; constructor(desc: IGraphDataDescription, nodes?: GraphNode[], edges?: GraphEdge[], storage?: Storage); static migrate(graph: GraphBase, storage?: Storage): Promise; migrate(): PromiseLike<{ diff --git a/dist/clue/graph/LocalStorageGraph.d.ts.map b/dist/clue/graph/LocalStorageGraph.d.ts.map index 71c93cd02..b5a83f8fe 100644 --- a/dist/clue/graph/LocalStorageGraph.d.ts.map +++ b/dist/clue/graph/LocalStorageGraph.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"LocalStorageGraph.d.ts","sourceRoot":"","sources":["../../../src/clue/graph/LocalStorageGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,qBAAqB,EAAE,MA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,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS;IAazE,UAAU,CAAC,CAAC,EAAE,SAAS;IAYvB,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,GAAG;IAO7B,KAAK;IAqBL,OAAO;CAQR"} \ No newline at end of file diff --git a/dist/clue/graph/LocalStorageGraph.js b/dist/clue/graph/LocalStorageGraph.js index a39e994c4..e93fd0bce 100644 --- a/dist/clue/graph/LocalStorageGraph.js +++ b/dist/clue/graph/LocalStorageGraph.js @@ -1,5 +1,6 @@ import { GraphBase } from './GraphBase'; import { GraphEdge, GraphNode } from './graph'; +import { setCompressedToStorage, getCompressedFromStorage } from '../utils/Compression'; export class LocalStorageGraph extends GraphBase { constructor(desc, nodes = [], edges = [], storage = sessionStorage) { super(desc, nodes, edges); @@ -15,18 +16,24 @@ export class LocalStorageGraph extends GraphBase { this.storage = storage; const { uid } = this; if (nodes.length > 0 || edges.length > 0) { - this.storage.setItem(`${uid}.nodes`, JSON.stringify(nodes.map((d) => d.id))); + this.setItem(`${uid}.nodes`, JSON.stringify(nodes.map((d) => d.id))); nodes.forEach((n) => { - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); + this.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); n.on('setAttr', this.updateHandler); }); - this.storage.setItem(`${uid}.edges`, JSON.stringify(edges.map((d) => d.id))); + this.setItem(`${uid}.edges`, JSON.stringify(edges.map((d) => d.id))); edges.forEach((e) => { - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); e.on('setAttr', this.updateHandler); }); } } + setItem(key, value) { + setCompressedToStorage(this.storage, key, value); + } + getItem(key) { + return getCompressedFromStorage(this.storage, key, null); + } static migrate(graph, storage = sessionStorage) { return Promise.resolve(graph.migrate()).then(({ nodes, edges }) => { return new LocalStorageGraph(graph.desc, nodes, edges, storage); @@ -54,21 +61,21 @@ export class LocalStorageGraph extends GraphBase { } load(factory) { const { uid } = this; - if (this.storage.getItem(`${uid}.nodes`) == null) { + if (this.getItem(`${uid}.nodes`) == null) { return; } - const nodeIds = JSON.parse(this.storage.getItem(`${uid}.nodes`)); + const nodeIds = this.getItem(`${uid}.nodes`); const lookup = new Map(); nodeIds.forEach((id) => { - const n = JSON.parse(this.storage.getItem(`${uid}.node.${id}`)); + const n = this.getItem(`${uid}.node.${id}`); const nn = factory.makeNode(n); lookup.set(nn.id, nn); nn.on('setAttr', this.updateHandler); super.addNode(nn); }); - const edgeIds = JSON.parse(this.storage.getItem(`${uid}.edges`)); + const edgeIds = this.getItem(`${uid}.edges`); edgeIds.forEach((id) => { - const n = JSON.parse(this.storage.getItem(`${uid}.edge.${id}`)); + const n = this.getItem(`${uid}.edge.${id}`); const nn = factory.makeEdge(n, lookup.get.bind(lookup)); nn.on('setAttr', this.updateHandler); super.addEdge(nn); @@ -106,15 +113,15 @@ export class LocalStorageGraph extends GraphBase { addNode(n) { super.addNode(n); const { uid } = this; - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); - this.storage.setItem(`${uid}.nodes`, JSON.stringify(this.nodes.map((d) => d.id))); + this.setItem(`${uid}.node.${n.id}`, n.persist()); + this.setItem(`${uid}.nodes`, this.nodes.map((d) => d.id)); n.on('setAttr', this.updateHandler); return this; } updateNode(n) { super.updateNode(n); const { uid } = this; - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); + this.setItem(`${uid}.node.${n.id}`, n.persist()); return this; } removeNode(n) { @@ -122,7 +129,7 @@ export class LocalStorageGraph extends GraphBase { return null; } const { uid } = this; - this.storage.setItem(`${uid}.nodes`, JSON.stringify(this.nodes.map((d) => d.id))); + this.setItem(`${uid}.nodes`, this.nodes.map((d) => d.id)); this.storage.removeItem(`${uid}.node.${n.id}`); n.off('setAttr', this.updateHandler); return this; @@ -132,8 +139,8 @@ export class LocalStorageGraph extends GraphBase { super.addEdge(edgeOrSource); const e = edgeOrSource; const { uid } = this; - this.storage.setItem(`${uid}.edges`, JSON.stringify(this.edges.map((d) => d.id))); - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edges`, this.edges.map((d) => d.id)); + this.setItem(`${uid}.edge.${e.id}`, e.persist()); e.on('setAttr', this.updateHandler); return this; } @@ -145,7 +152,7 @@ export class LocalStorageGraph extends GraphBase { } // need to shift all const { uid } = this; - this.storage.setItem(`${uid}.edges`, JSON.stringify(this.edges.map((d) => d.id))); + this.setItem(`${uid}.edges`, this.edges.map((d) => d.id)); this.storage.removeItem(`${uid}.edge.${e.id}`); e.off('setAttr', this.updateHandler); return this; @@ -153,7 +160,7 @@ export class LocalStorageGraph extends GraphBase { updateEdge(e) { super.updateEdge(e); const { uid } = this; - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edge.${e.id}`, e.persist()); return this; } clear() { @@ -166,11 +173,11 @@ export class LocalStorageGraph extends GraphBase { this.edges.forEach((n) => n.off('setAttr', this.updateHandler)); super.clear(); const { uid } = this; - JSON.parse(this.storage.getItem(`${uid}.nodes`)).forEach((id) => { + this.getItem(`${uid}.nodes`).forEach((id) => { this.storage.removeItem(`${uid}.node.${id}`); }); this.storage.removeItem(`${uid}.nodes`); - JSON.parse(this.storage.getItem(`${uid}.edges`)).forEach((id) => { + this.getItem(`${uid}.edges`).forEach((id) => { this.storage.removeItem(`${uid}.edge.${id}`); }); this.storage.removeItem(`${uid}.edges`); diff --git a/dist/clue/graph/LocalStorageGraph.js.map b/dist/clue/graph/LocalStorageGraph.js.map index aea05c04a..75a2a772c 100644 --- a/dist/clue/graph/LocalStorageGraph.js.map +++ b/dist/clue/graph/LocalStorageGraph.js.map @@ -1 +1 @@ -{"version":3,"file":"LocalStorageGraph.js","sourceRoot":"","sources":["../../../src/clue/graph/LocalStorageGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC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AAC,OAAO,CAAC,CAAC,EAAU,EAAE,EAAE;YAClD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,SAAS,EAAE,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC;QACxC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,MAAM,CAAC,GAAQ;YACb,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;SACnB,CAAC;QACF,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,CAAC;IACX,CAAC;CACF"} \ No newline at end of file diff --git a/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts b/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts index 1c3f29413..fb0eccb58 100644 --- a/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts +++ b/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts @@ -24,6 +24,7 @@ export declare class LocalStorageProvenanceGraphManager implements IProvenanceGr private options; constructor(options?: ILocalStorageProvenanceGraphManagerOptions); private loadFromLocalStorage; + private setToLocalStorage; listSync(): IProvenanceGraphDataDescription[]; list(): Promise; getGraph(desc: IProvenanceGraphDataDescription): PromiseLike; diff --git a/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts.map b/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts.map index 98ca25a89..8d8f9b142 100644 --- a/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts.map +++ b/dist/clue/provenance/LocalStorageProvenanceGraphManager.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"LocalStorageProvenanceGraphManager.d.ts","sourceRoot":"","sources":["../../../src/clue/provenance/LocalStorageProvenanceGraphManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,MAAM,WAAW,0CAA2C,SAAQ,oCAAoC;IACtG;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,qBAAa,kCAAmC,YAAW,uBAAuB;IAChF,OAAO,CAAC,OAAO,CAKb;gBAEU,OAAO,GAAE,0CAA+C;IAIpE,OAAO,CAAC,oBAAoB;IAa5B,QAAQ,IAAI,+BAA+B,EAAE;IAU7C,IAAI;IAIJ,QAAQ,CAAC,IAAI,EAAE,+BAA+B,GAAG,WAAW,CAAC,iBAAiB,CAAC;IAIzE,GAAG,CAAC,IAAI,EAAE,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAIpE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAWjE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAOjE,MAAM,CAAC,IAAI,EAAE,+BAA+B;IAU5C,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,+BAA+B,EAAE,IAAI,GAAE,GAAQ;IAO7E,OAAO,CAAC,UAAU;IA6BlB,MAAM,CAAC,IAAI,GAAE,GAAQ;IAKrB,OAAO,CAAC,kBAAkB;IA0B1B,cAAc;IAKd,aAAa,CAAC,KAAK,EAAE,SAAS;CAM/B"} \ No newline at end of file +{"version":3,"file":"LocalStorageProvenanceGraphManager.d.ts","sourceRoot":"","sources":["../../../src/clue/provenance/LocalStorageProvenanceGraphManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,WAAW,0CAA2C,SAAQ,oCAAoC;IACtG;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,qBAAa,kCAAmC,YAAW,uBAAuB;IAChF,OAAO,CAAC,OAAO,CAKb;gBAEU,OAAO,GAAE,0CAA+C;IAIpE,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,iBAAiB;IAIzB,QAAQ,IAAI,+BAA+B,EAAE;IAU7C,IAAI;IAIJ,QAAQ,CAAC,IAAI,EAAE,+BAA+B,GAAG,WAAW,CAAC,iBAAiB,CAAC;IAIzE,GAAG,CAAC,IAAI,EAAE,+BAA+B,GAAG,OAAO,CAAC,eAAe,CAAC;IAIpE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAWjE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IAOjE,MAAM,CAAC,IAAI,EAAE,+BAA+B;IAU5C,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,+BAA+B,EAAE,IAAI,GAAE,GAAQ;IAO7E,OAAO,CAAC,UAAU;IA6BlB,MAAM,CAAC,IAAI,GAAE,GAAQ;IAKrB,OAAO,CAAC,kBAAkB;IA0B1B,cAAc;IAKd,aAAa,CAAC,KAAK,EAAE,SAAS;CAM/B"} \ No newline at end of file diff --git a/dist/clue/provenance/LocalStorageProvenanceGraphManager.js b/dist/clue/provenance/LocalStorageProvenanceGraphManager.js index eb3ed368d..d1831b9cb 100644 --- a/dist/clue/provenance/LocalStorageProvenanceGraphManager.js +++ b/dist/clue/provenance/LocalStorageProvenanceGraphManager.js @@ -5,6 +5,7 @@ import { LocalStorageGraph } from '../graph/LocalStorageGraph'; import { UserSession } from '../../app/UserSession'; import { Permission } from '../../security/Permission'; import { MemoryGraph } from '../graph/MemoryGraph'; +import { getCompressedFromStorage, setCompressedToStorage } from '../utils/Compression'; export class LocalStorageProvenanceGraphManager { constructor(options = {}) { this.options = { @@ -16,17 +17,10 @@ export class LocalStorageProvenanceGraphManager { merge(this.options, options); } loadFromLocalStorage(suffix, defaultValue) { - try { - const item = this.options.storage.getItem(this.options.prefix + suffix); - if (item === undefined || item === null) { - return defaultValue; - } - return JSON.parse(item); - } - catch (e) { - console.error(e); - return defaultValue; - } + return getCompressedFromStorage(this.options.storage, this.options.prefix + suffix, defaultValue); + } + setToLocalStorage(suffix, data) { + setCompressedToStorage(this.options.storage, this.options.prefix + suffix, data); } listSync() { const lists = this.loadFromLocalStorage('_provenance_graphs', []); @@ -61,22 +55,22 @@ export class LocalStorageProvenanceGraphManager { return new ProvenanceGraph(pdesc, newGraph); } delete(desc) { - const lists = JSON.parse(this.options.storage.getItem(`${this.options.prefix}_provenance_graphs`) || '[]'); + const lists = this.loadFromLocalStorage('_provenance_graphs', []); lists.splice(lists.indexOf(desc.id), 1); LocalStorageGraph.delete(desc, this.options.storage); // just remove from the list this.options.storage.removeItem(`${this.options.prefix}_provenance_graph.${desc.id}`); - this.options.storage.setItem(`${this.options.prefix}_provenance_graphs`, JSON.stringify(lists)); + this.setToLocalStorage('_provenance_graphs', lists); return Promise.resolve(true); } edit(graph, desc = {}) { const base = graph instanceof ProvenanceGraph ? graph.desc : graph; merge(base, desc); - this.options.storage.setItem(`${this.options.prefix}_provenance_graph.${base.id}`, JSON.stringify(base)); + this.setToLocalStorage(`_provenance_graph.${base.id}`, base); return Promise.resolve(base); } createDesc(overrides = {}) { - const lists = JSON.parse(this.options.storage.getItem(`${this.options.prefix}_provenance_graphs`) || '[]'); + const lists = this.loadFromLocalStorage('_provenance_graphs', []); const uid = lists.length > 0 ? String(1 + Math.max(...lists.map((d) => parseInt(d.slice(this.options.prefix.length), 10)))) : '0'; const id = this.options.prefix + uid; const desc = merge({ @@ -96,8 +90,8 @@ export class LocalStorageProvenanceGraphManager { description: '', }, overrides); lists.push(id); - this.options.storage.setItem(`${this.options.prefix}_provenance_graphs`, JSON.stringify(lists)); - this.options.storage.setItem(`${this.options.prefix}_provenance_graph.${id}`, JSON.stringify(desc)); + this.setToLocalStorage('_provenance_graphs', lists); + this.setToLocalStorage(`_provenance_graph.${id}`, desc); return desc; } create(desc = {}) { diff --git a/dist/clue/provenance/LocalStorageProvenanceGraphManager.js.map b/dist/clue/provenance/LocalStorageProvenanceGraphManager.js.map index a3284af87..564cd6cb7 100644 --- a/dist/clue/provenance/LocalStorageProvenanceGraphManager.js.map +++ b/dist/clue/provenance/LocalStorageProvenanceGraphManager.js.map @@ -1 +1 @@ -{"version":3,"file":"LocalStorageProvenanceGraphManager.js","sourceRoot":"","sources":["../../../src/clue/provenance/LocalStorageProvenanceGraphManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EA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AAoB,CAAC,CAAC,EAAE,CAAC,CAAC;YAC9B,KAAK,EAAE;gBACL,SAAS,EAAE,kBAAkB;gBAC7B,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;aAC7B;YACD,OAAO,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,0BAA0B,EAAE;YAC/D,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;YAC3C,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,WAAW,EAAE,EAAE;SAChB,EACD,IAAI,IAAI,EAAE,EACV;YACE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,IAAI;SACZ,CACF,CAAC;IACJ,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACvC,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;IACjH,CAAC;IAED,aAAa,CAAC,KAAgB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAkC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClF,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,CAAC;QACvF,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"LocalStorageProvenanceGraphManager.js","sourceRoot":"","sources":["../../../src/clue/provenance/LocalStorageProvenanceGraphManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAm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AAE,EAAE,EAAE,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;IACjH,CAAC;IAED,aAAa,CAAC,KAAgB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAkC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClF,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,CAAC;QACvF,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;CACF"} \ No newline at end of file diff --git a/dist/clue/utils/Compression.d.ts b/dist/clue/utils/Compression.d.ts new file mode 100644 index 000000000..9d6fc3b32 --- /dev/null +++ b/dist/clue/utils/Compression.d.ts @@ -0,0 +1,3 @@ +export declare function getCompressedFromStorage(storage: Storage, key: string, defaultValue: T): T; +export declare function setCompressedToStorage(storage: Storage, key: string, data: T): void; +//# sourceMappingURL=Compression.d.ts.map \ No newline at end of file diff --git a/dist/clue/utils/Compression.d.ts.map b/dist/clue/utils/Compression.d.ts.map new file mode 100644 index 000000000..fdbd09daa --- /dev/null +++ b/dist/clue/utils/Compression.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"Compression.d.ts","sourceRoot":"","sources":["../../../src/clue/utils/Compression.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAgB7F;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAEtF"} \ No newline at end of file diff --git a/dist/clue/utils/Compression.js b/dist/clue/utils/Compression.js new file mode 100644 index 000000000..9a73cf2df --- /dev/null +++ b/dist/clue/utils/Compression.js @@ -0,0 +1,24 @@ +import LZString from 'lz-string'; +export function getCompressedFromStorage(storage, key, defaultValue) { + try { + const item = storage.getItem(key); + if (item === undefined || item === null) { + return defaultValue; + } + try { + return JSON.parse(LZString.decompressFromUTF16(item)); + } + catch (e) { + // Error decoding the compressed value, falling back to just JSON parsing + } + return JSON.parse(item); + } + catch (e) { + console.error(e); + return defaultValue; + } +} +export function setCompressedToStorage(storage, key, data) { + storage.setItem(key, LZString.compressToUTF16(JSON.stringify(data))); +} +//# sourceMappingURL=Compression.js.map \ No newline at end of file diff --git a/dist/clue/utils/Compression.js.map b/dist/clue/utils/Compression.js.map new file mode 100644 index 000000000..8e0b23732 --- /dev/null +++ b/dist/clue/utils/Compression.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Compression.js","sourceRoot":"","sources":["../../../src/clue/utils/Compression.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,wBAAwB,CAAI,OAAgB,EAAE,GAAW,EAAE,YAAe;IACxF,IAAI;QACF,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE;YACvC,OAAO,YAAY,CAAC;SACrB;QACD,IAAI;YACF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;SACvD;QAAC,OAAO,CAAC,EAAE;YACV,yEAAyE;SAC1E;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,YAAY,CAAC;KACrB;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAI,OAAgB,EAAE,GAAW,EAAE,IAAO;IAC9E,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"} \ No newline at end of file diff --git a/dist/clue/utils/index.d.ts b/dist/clue/utils/index.d.ts index b93103614..9db48f587 100644 --- a/dist/clue/utils/index.d.ts +++ b/dist/clue/utils/index.d.ts @@ -1,3 +1,4 @@ +export * from './Compression'; export * from './EditProvenanceGraphMenu'; export * from './ProvenanceGraphMenuUtils'; export * from './SessionList'; diff --git a/dist/clue/utils/index.d.ts.map b/dist/clue/utils/index.d.ts.map index 043843d42..e13e8c7ea 100644 --- a/dist/clue/utils/index.d.ts.map +++ b/dist/clue/utils/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clue/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clue/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/clue/utils/index.js b/dist/clue/utils/index.js index fd0df6497..49c52fb7b 100644 --- a/dist/clue/utils/index.js +++ b/dist/clue/utils/index.js @@ -1,3 +1,4 @@ +export * from './Compression'; export * from './EditProvenanceGraphMenu'; export * from './ProvenanceGraphMenuUtils'; export * from './SessionList'; diff --git a/dist/clue/utils/index.js.map b/dist/clue/utils/index.js.map index 90571f8b2..094341bfa 100644 --- a/dist/clue/utils/index.js.map +++ b/dist/clue/utils/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clue/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/clue/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/components/dialogs.d.ts b/dist/components/dialogs.d.ts index 3f89af285..7a94c0c46 100644 --- a/dist/components/dialogs.d.ts +++ b/dist/components/dialogs.d.ts @@ -1,7 +1,6 @@ /// /// /// -/// /// import '../webpack/_bootstrap'; export interface IDialogOptions { diff --git a/dist/components/dialogs.d.ts.map b/dist/components/dialogs.d.ts.map index c1852161f..f3179283b 100644 --- a/dist/components/dialogs.d.ts.map +++ b/dist/components/dialogs.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../src/components/dialogs.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,uBAAuB,CAAC;AAM/B,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AACD,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,sBAAsB,CAAC;IAChG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,MAAM;IACjB,SAAS,CAAC,QAAQ,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S,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1D;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAc,GAAG,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC;CAsCpF;AAGD,qBAAa,oBAAqB,SAAQ,MAAM;gBAClC,KAAK,EAAE,MAAM,EAAE,cAAc,SAAO,EAAE,MAAM,SAAiC,EAAE,oBAAoB,SAAK;IASpH,IAAI,IAAI,oBAEP;IAED,WAAW;IAIX,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO;IAIhC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,cAAc,GAAG,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAuCtF,MAAM,CAAC,UAAU,CAAC,GAAG,SAAK,EAAE,OAAO,GAAE,kBAAkB,GAAG,MAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAkCzF"} \ No newline at end of file diff --git a/dist/lineup/Ranking.d.ts b/dist/lineup/Ranking.d.ts index 8905d9138..a2510c020 100644 --- a/dist/lineup/Ranking.d.ts +++ b/dist/lineup/Ranking.d.ts @@ -1,3 +1,4 @@ +/// import { LocalDataProvider, IColumnDesc } from 'lineupjs'; import { ILazyLoadedColumn } from './internal/column'; import { EViewMode, IAdditionalColumnDesc, IScoreRow, ISelection } from '../base/interfaces'; diff --git a/dist/lineup/Ranking.d.ts.map b/dist/lineup/Ranking.d.ts.map index 1c2b66426..be61ca7cc 100644 --- a/dist/lineup/Ranking.d.ts.map +++ b/dist/lineup/Ranking.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Ranking.d.ts","sourceRoot":"","sources":["../../src/lineup/Ranking.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,iBAAiB,EAajB,WAAW,EAGZ,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,iBAAiB,EAAc,MAAM,mBAAmB,CA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sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClF,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAE/C,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,kBAAkB,CAAC,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACvD;AAiED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,wBAAgB,OAAO,CAAC,EACtB,IAAS,EACT,aAAyC,EACzC,UAAe,EACf,OAAO,EAAE,IAAS,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,aAAa;AACb;;GAEG;AACH,gBAAgB,GACjB,EAAE,aAAa,eAuYf"} \ No newline at end of file diff --git a/package.json b/package.json index e8f2ae27f..95b4abe18 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "jquery": "~3.5.1", "lineupjs": "~4.6.0", "lodash": "~4.17.20", + "lz-string": "^1.4.4", "marked": "~3.0.2", "md5": "^2.3.0", "papaparse": "~5.3.0", @@ -110,6 +111,7 @@ "@types/d3": "~3.5.36", "@types/jest": "~27.4.1", "@types/jquery": "~3.5.5", + "@types/lz-string": "^1.3.34", "@types/select2": "4.0.44", "@types/papaparse": "~5.2.4", "@types/plotly.js-dist-min": "^2.3.0", diff --git a/src/clue/graph/LocalStorageGraph.ts b/src/clue/graph/LocalStorageGraph.ts index 5af8ac37b..9e627b3a2 100644 --- a/src/clue/graph/LocalStorageGraph.ts +++ b/src/clue/graph/LocalStorageGraph.ts @@ -1,6 +1,7 @@ import { IEvent } from '../../base/event'; import { GraphBase, IGraphFactory } from './GraphBase'; import { GraphEdge, GraphNode, IGraph, IGraphDataDescription } from './graph'; +import { setCompressedToStorage, getCompressedFromStorage } from '../utils/Compression'; export class LocalStorageGraph extends GraphBase implements IGraph { private storage: Storage; @@ -15,21 +16,29 @@ export class LocalStorageGraph extends GraphBase implements IGraph { } }; + private setItem(key: string, value: T): void { + setCompressedToStorage(this.storage, key, value); + } + + private getItem(key: string): any { + return getCompressedFromStorage(this.storage, key, null); + } + constructor(desc: IGraphDataDescription, nodes: GraphNode[] = [], edges: GraphEdge[] = [], storage: Storage = sessionStorage) { super(desc, nodes, edges); this.storage = storage; const { uid } = this; if (nodes.length > 0 || edges.length > 0) { - this.storage.setItem(`${uid}.nodes`, JSON.stringify(nodes.map((d) => d.id))); + this.setItem(`${uid}.nodes`, JSON.stringify(nodes.map((d) => d.id))); nodes.forEach((n) => { - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); + this.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); n.on('setAttr', this.updateHandler); }); - this.storage.setItem(`${uid}.edges`, JSON.stringify(edges.map((d) => d.id))); + this.setItem(`${uid}.edges`, JSON.stringify(edges.map((d) => d.id))); edges.forEach((e) => { - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); e.on('setAttr', this.updateHandler); }); } @@ -67,21 +76,21 @@ export class LocalStorageGraph extends GraphBase implements IGraph { private load(factory: IGraphFactory) { const { uid } = this; - if (this.storage.getItem(`${uid}.nodes`) == null) { + if (this.getItem(`${uid}.nodes`) == null) { return; } - const nodeIds: string[] = JSON.parse(this.storage.getItem(`${uid}.nodes`)); + const nodeIds: string[] = this.getItem(`${uid}.nodes`); const lookup = new Map(); nodeIds.forEach((id) => { - const n = JSON.parse(this.storage.getItem(`${uid}.node.${id}`)); + const n = this.getItem(`${uid}.node.${id}`); const nn = factory.makeNode(n); lookup.set(nn.id, nn); nn.on('setAttr', this.updateHandler); super.addNode(nn); }); - const edgeIds: string[] = JSON.parse(this.storage.getItem(`${uid}.edges`)); + const edgeIds: string[] = this.getItem(`${uid}.edges`); edgeIds.forEach((id) => { - const n = JSON.parse(this.storage.getItem(`${uid}.edge.${id}`)); + const n = this.getItem(`${uid}.edge.${id}`); const nn = factory.makeEdge(n, lookup.get.bind(lookup)); nn.on('setAttr', this.updateHandler); super.addEdge(nn); @@ -125,8 +134,8 @@ export class LocalStorageGraph extends GraphBase implements IGraph { addNode(n: GraphNode) { super.addNode(n); const { uid } = this; - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); - this.storage.setItem(`${uid}.nodes`, JSON.stringify(this.nodes.map((d) => d.id))); + this.setItem(`${uid}.node.${n.id}`, n.persist()); + this.setItem(`${uid}.nodes`, this.nodes.map((d) => d.id)); n.on('setAttr', this.updateHandler); return this; } @@ -134,7 +143,7 @@ export class LocalStorageGraph extends GraphBase implements IGraph { updateNode(n: GraphNode): any { super.updateNode(n); const { uid } = this; - this.storage.setItem(`${uid}.node.${n.id}`, JSON.stringify(n.persist())); + this.setItem(`${uid}.node.${n.id}`, n.persist()); return this; } @@ -143,7 +152,7 @@ export class LocalStorageGraph extends GraphBase implements IGraph { return null; } const { uid } = this; - this.storage.setItem(`${uid}.nodes`, JSON.stringify(this.nodes.map((d) => d.id))); + this.setItem(`${uid}.nodes`, this.nodes.map((d) => d.id)); this.storage.removeItem(`${uid}.node.${n.id}`); n.off('setAttr', this.updateHandler); @@ -155,8 +164,8 @@ export class LocalStorageGraph extends GraphBase implements IGraph { super.addEdge(edgeOrSource); const e = edgeOrSource; const { uid } = this; - this.storage.setItem(`${uid}.edges`, JSON.stringify(this.edges.map((d) => d.id))); - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edges`, this.edges.map((d) => d.id)); + this.setItem(`${uid}.edge.${e.id}`, e.persist()); e.on('setAttr', this.updateHandler); return this; } @@ -169,7 +178,7 @@ export class LocalStorageGraph extends GraphBase implements IGraph { } // need to shift all const { uid } = this; - this.storage.setItem(`${uid}.edges`, JSON.stringify(this.edges.map((d) => d.id))); + this.setItem(`${uid}.edges`, this.edges.map((d) => d.id)); this.storage.removeItem(`${uid}.edge.${e.id}`); e.off('setAttr', this.updateHandler); return this; @@ -178,7 +187,7 @@ export class LocalStorageGraph extends GraphBase implements IGraph { updateEdge(e: GraphEdge): any { super.updateEdge(e); const { uid } = this; - this.storage.setItem(`${uid}.edge.${e.id}`, JSON.stringify(e.persist())); + this.setItem(`${uid}.edge.${e.id}`, e.persist()); return this; } @@ -192,11 +201,11 @@ export class LocalStorageGraph extends GraphBase implements IGraph { this.edges.forEach((n) => n.off('setAttr', this.updateHandler)); super.clear(); const { uid } = this; - JSON.parse(this.storage.getItem(`${uid}.nodes`)).forEach((id: string) => { + this.getItem(`${uid}.nodes`).forEach((id: string) => { this.storage.removeItem(`${uid}.node.${id}`); }); this.storage.removeItem(`${uid}.nodes`); - JSON.parse(this.storage.getItem(`${uid}.edges`)).forEach((id: string) => { + this.getItem(`${uid}.edges`).forEach((id: string) => { this.storage.removeItem(`${uid}.edge.${id}`); }); this.storage.removeItem(`${uid}.edges`); diff --git a/src/clue/provenance/LocalStorageProvenanceGraphManager.ts b/src/clue/provenance/LocalStorageProvenanceGraphManager.ts index b6ced852f..9ff260868 100644 --- a/src/clue/provenance/LocalStorageProvenanceGraphManager.ts +++ b/src/clue/provenance/LocalStorageProvenanceGraphManager.ts @@ -8,6 +8,7 @@ import { LocalStorageGraph } from '../graph/LocalStorageGraph'; import { UserSession } from '../../app/UserSession'; import { Permission } from '../../security/Permission'; import { MemoryGraph } from '../graph/MemoryGraph'; +import { getCompressedFromStorage, setCompressedToStorage } from '../utils/Compression'; export interface ILocalStorageProvenanceGraphManagerOptions extends ICommonProvenanceGraphManagerOptions { /** @@ -42,16 +43,11 @@ export class LocalStorageProvenanceGraphManager implements IProvenanceGraphManag } private loadFromLocalStorage(suffix: string, defaultValue: T): T { - try { - const item = this.options.storage.getItem(this.options.prefix + suffix); - if (item === undefined || item === null) { - return defaultValue; - } - return JSON.parse(item); - } catch (e) { - console.error(e); - return defaultValue; - } + return getCompressedFromStorage(this.options.storage, this.options.prefix + suffix, defaultValue); + } + + private setToLocalStorage(suffix: string, data: T): void { + setCompressedToStorage(this.options.storage, this.options.prefix + suffix, data); } listSync(): IProvenanceGraphDataDescription[] { @@ -95,24 +91,24 @@ export class LocalStorageProvenanceGraphManager implements IProvenanceGraphManag } delete(desc: IProvenanceGraphDataDescription) { - const lists = JSON.parse(this.options.storage.getItem(`${this.options.prefix}_provenance_graphs`) || '[]'); + const lists: string[] = this.loadFromLocalStorage('_provenance_graphs', []); lists.splice(lists.indexOf(desc.id), 1); LocalStorageGraph.delete(desc, this.options.storage); // just remove from the list this.options.storage.removeItem(`${this.options.prefix}_provenance_graph.${desc.id}`); - this.options.storage.setItem(`${this.options.prefix}_provenance_graphs`, JSON.stringify(lists)); + this.setToLocalStorage('_provenance_graphs', lists); return Promise.resolve(true); } edit(graph: ProvenanceGraph | IProvenanceGraphDataDescription, desc: any = {}) { const base = graph instanceof ProvenanceGraph ? graph.desc : graph; merge(base, desc); - this.options.storage.setItem(`${this.options.prefix}_provenance_graph.${base.id}`, JSON.stringify(base)); + this.setToLocalStorage(`_provenance_graph.${base.id}`, base); return Promise.resolve(base); } private createDesc(overrides: any = {}) { - const lists: string[] = JSON.parse(this.options.storage.getItem(`${this.options.prefix}_provenance_graphs`) || '[]'); + const lists: string[] = this.loadFromLocalStorage('_provenance_graphs', []); const uid = lists.length > 0 ? String(1 + Math.max(...lists.map((d) => parseInt(d.slice(this.options.prefix.length), 10)))) : '0'; const id = this.options.prefix + uid; const desc: IProvenanceGraphDataDescription = merge( @@ -135,8 +131,8 @@ export class LocalStorageProvenanceGraphManager implements IProvenanceGraphManag overrides, ); lists.push(id); - this.options.storage.setItem(`${this.options.prefix}_provenance_graphs`, JSON.stringify(lists)); - this.options.storage.setItem(`${this.options.prefix}_provenance_graph.${id}`, JSON.stringify(desc)); + this.setToLocalStorage('_provenance_graphs', lists); + this.setToLocalStorage(`_provenance_graph.${id}`, desc); return desc; } diff --git a/src/clue/utils/Compression.ts b/src/clue/utils/Compression.ts new file mode 100644 index 000000000..dfe4281b8 --- /dev/null +++ b/src/clue/utils/Compression.ts @@ -0,0 +1,23 @@ +import LZString from 'lz-string'; + +export function getCompressedFromStorage(storage: Storage, key: string, defaultValue: T): T { + try { + const item = storage.getItem(key); + if (item === undefined || item === null) { + return defaultValue; + } + try { + return JSON.parse(LZString.decompressFromUTF16(item)); + } catch (e) { + // Error decoding the compressed value, falling back to just JSON parsing + } + return JSON.parse(item); + } catch (e) { + console.error(e); + return defaultValue; + } +} + +export function setCompressedToStorage(storage: Storage, key: string, data: T): void { + storage.setItem(key, LZString.compressToUTF16(JSON.stringify(data))); +} diff --git a/src/clue/utils/index.ts b/src/clue/utils/index.ts index 5734e0f15..4fec953a7 100644 --- a/src/clue/utils/index.ts +++ b/src/clue/utils/index.ts @@ -1,3 +1,4 @@ +export * from './Compression'; export * from './EditProvenanceGraphMenu'; export * from './ProvenanceGraphMenuUtils'; export * from './SessionList';