@terra-graph/core 1.0.0-rc.6 → 1.0.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Graph/Renderers/DotRenderer.js +4 -5
- package/dist/cjs/Graph/Renderers/DotRenderer.test.js +18 -13
- package/dist/cjs/Graph/Renderers/TgNodeLabel.js +0 -3
- package/dist/cjs/Graph/TgGraph.d.ts +0 -1
- package/dist/esm/Graph/Renderers/DotRenderer.js +4 -5
- package/dist/esm/Graph/Renderers/DotRenderer.test.js +18 -13
- package/dist/esm/Graph/Renderers/TgNodeLabel.js +0 -3
- package/dist/esm/Graph/TgGraph.d.ts +0 -1
- package/package.json +1 -1
|
@@ -162,15 +162,14 @@ ${legendRows}
|
|
|
162
162
|
if (firstBrace === -1) {
|
|
163
163
|
return output;
|
|
164
164
|
}
|
|
165
|
-
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}
|
|
166
|
-
}
|
|
167
|
-
buildNodeLabel(node) {
|
|
168
|
-
return new TgNodeLabel_js_1.TgNodeLabel(node)
|
|
169
|
-
.getLabel()
|
|
165
|
+
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`
|
|
170
166
|
.replace(/"\s*<</g, '<<')
|
|
171
167
|
.replace(/>>\s*"/g, '>>')
|
|
172
168
|
.replaceAll('\\"', '"');
|
|
173
169
|
}
|
|
170
|
+
buildNodeLabel(node) {
|
|
171
|
+
return new TgNodeLabel_js_1.TgNodeLabel(node).getLabel();
|
|
172
|
+
}
|
|
174
173
|
static resolveGraphOptions(input) {
|
|
175
174
|
/* istanbul ignore next */
|
|
176
175
|
const graphOptions = {
|
|
@@ -934,19 +934,6 @@ describe('DotRenderer.buildNodeLabel', () => {
|
|
|
934
934
|
};
|
|
935
935
|
expect(subject.buildNodeLabel(node)).toBe('node-e');
|
|
936
936
|
});
|
|
937
|
-
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
938
|
-
const renderer = new DotRenderer_js_1.DotRenderer();
|
|
939
|
-
const subject = renderer;
|
|
940
|
-
const node = {
|
|
941
|
-
id: (0, TgGraph_js_1.asNodeId)('node-html'),
|
|
942
|
-
hints: {
|
|
943
|
-
label: {
|
|
944
|
-
overwriteTo: '"\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "',
|
|
945
|
-
},
|
|
946
|
-
},
|
|
947
|
-
};
|
|
948
|
-
expect(subject.buildNodeLabel(node)).toBe('<<table><tr><td>"hello"</td></tr></table>>');
|
|
949
|
-
});
|
|
950
937
|
});
|
|
951
938
|
describe('DotRenderer.applyLegend', () => {
|
|
952
939
|
it('shoud return output unchanged when no graph block is present', () => {
|
|
@@ -979,6 +966,24 @@ describe('DotRenderer.applyLegend', () => {
|
|
|
979
966
|
expect(next).toContain('cluster_Legend');
|
|
980
967
|
expect(next).toContain('Owner:');
|
|
981
968
|
});
|
|
969
|
+
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
970
|
+
const renderer = new DotRenderer_js_1.DotRenderer();
|
|
971
|
+
const subject = renderer;
|
|
972
|
+
const tg = {
|
|
973
|
+
schemaVersion: TgGraph_js_1.TG_SCHEMA_VERSION,
|
|
974
|
+
description: {
|
|
975
|
+
Environment: 'test',
|
|
976
|
+
},
|
|
977
|
+
nodes: {},
|
|
978
|
+
edges: [],
|
|
979
|
+
};
|
|
980
|
+
const output = `digraph { "node-html" [label="
|
|
981
|
+
<<table><tr><td>\\\"hello\\\"</td></tr></table>>
|
|
982
|
+
"]; }`;
|
|
983
|
+
const next = subject.applyLegend(output, tg);
|
|
984
|
+
expect(next).toContain('label=<<table><tr><td>"hello"</td></tr></table>>');
|
|
985
|
+
expect(next).not.toContain('label="\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "');
|
|
986
|
+
});
|
|
982
987
|
});
|
|
983
988
|
describe('DotRenderer.applyRanks', () => {
|
|
984
989
|
it('shoud return output unchanged when closing brace is missing', () => {
|
|
@@ -17,9 +17,6 @@ class TgNodeLabel {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
getLabel() {
|
|
20
|
-
if (this.node.hints?.label?.overwriteTo) {
|
|
21
|
-
return this.node.hints?.label?.overwriteTo;
|
|
22
|
-
}
|
|
23
20
|
const { resourceName, name } = this.getLabelComponents();
|
|
24
21
|
const kind = this.node.terraform?.kind;
|
|
25
22
|
const parentModuleName = this.node.terraform?.parentModuleName ?? '';
|
|
@@ -156,15 +156,14 @@ ${legendRows}
|
|
|
156
156
|
if (firstBrace === -1) {
|
|
157
157
|
return output;
|
|
158
158
|
}
|
|
159
|
-
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}
|
|
160
|
-
}
|
|
161
|
-
buildNodeLabel(node) {
|
|
162
|
-
return new TgNodeLabel(node)
|
|
163
|
-
.getLabel()
|
|
159
|
+
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`
|
|
164
160
|
.replace(/"\s*<</g, '<<')
|
|
165
161
|
.replace(/>>\s*"/g, '>>')
|
|
166
162
|
.replaceAll('\\"', '"');
|
|
167
163
|
}
|
|
164
|
+
buildNodeLabel(node) {
|
|
165
|
+
return new TgNodeLabel(node).getLabel();
|
|
166
|
+
}
|
|
168
167
|
static resolveGraphOptions(input) {
|
|
169
168
|
/* istanbul ignore next */
|
|
170
169
|
const graphOptions = {
|
|
@@ -932,19 +932,6 @@ describe('DotRenderer.buildNodeLabel', () => {
|
|
|
932
932
|
};
|
|
933
933
|
expect(subject.buildNodeLabel(node)).toBe('node-e');
|
|
934
934
|
});
|
|
935
|
-
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
936
|
-
const renderer = new DotRenderer();
|
|
937
|
-
const subject = renderer;
|
|
938
|
-
const node = {
|
|
939
|
-
id: asNodeId('node-html'),
|
|
940
|
-
hints: {
|
|
941
|
-
label: {
|
|
942
|
-
overwriteTo: '"\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "',
|
|
943
|
-
},
|
|
944
|
-
},
|
|
945
|
-
};
|
|
946
|
-
expect(subject.buildNodeLabel(node)).toBe('<<table><tr><td>"hello"</td></tr></table>>');
|
|
947
|
-
});
|
|
948
935
|
});
|
|
949
936
|
describe('DotRenderer.applyLegend', () => {
|
|
950
937
|
it('shoud return output unchanged when no graph block is present', () => {
|
|
@@ -977,6 +964,24 @@ describe('DotRenderer.applyLegend', () => {
|
|
|
977
964
|
expect(next).toContain('cluster_Legend');
|
|
978
965
|
expect(next).toContain('Owner:');
|
|
979
966
|
});
|
|
967
|
+
it('shoud strip quoted html labels with whitespace padding', () => {
|
|
968
|
+
const renderer = new DotRenderer();
|
|
969
|
+
const subject = renderer;
|
|
970
|
+
const tg = {
|
|
971
|
+
schemaVersion: TG_SCHEMA_VERSION,
|
|
972
|
+
description: {
|
|
973
|
+
Environment: 'test',
|
|
974
|
+
},
|
|
975
|
+
nodes: {},
|
|
976
|
+
edges: [],
|
|
977
|
+
};
|
|
978
|
+
const output = `digraph { "node-html" [label="
|
|
979
|
+
<<table><tr><td>\\\"hello\\\"</td></tr></table>>
|
|
980
|
+
"]; }`;
|
|
981
|
+
const next = subject.applyLegend(output, tg);
|
|
982
|
+
expect(next).toContain('label=<<table><tr><td>"hello"</td></tr></table>>');
|
|
983
|
+
expect(next).not.toContain('label="\n <<table><tr><td>\\"hello\\"</td></tr></table>>\n "');
|
|
984
|
+
});
|
|
980
985
|
});
|
|
981
986
|
describe('DotRenderer.applyRanks', () => {
|
|
982
987
|
it('shoud return output unchanged when closing brace is missing', () => {
|
|
@@ -14,9 +14,6 @@ export class TgNodeLabel {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
getLabel() {
|
|
17
|
-
if (this.node.hints?.label?.overwriteTo) {
|
|
18
|
-
return this.node.hints?.label?.overwriteTo;
|
|
19
|
-
}
|
|
20
17
|
const { resourceName, name } = this.getLabelComponents();
|
|
21
18
|
const kind = this.node.terraform?.kind;
|
|
22
19
|
const parentModuleName = this.node.terraform?.parentModuleName ?? '';
|
package/package.json
CHANGED