@terra-graph/core 1.0.0-rc.5 → 1.0.0-rc.6
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 +5 -1
- package/dist/cjs/Graph/Renderers/DotRenderer.test.js +13 -0
- package/dist/cjs/Graph/Renderers/TgNodeLabel.js +3 -0
- package/dist/cjs/Graph/TgGraph.d.ts +1 -0
- package/dist/esm/Graph/Renderers/DotRenderer.js +5 -1
- package/dist/esm/Graph/Renderers/DotRenderer.test.js +13 -0
- package/dist/esm/Graph/Renderers/TgNodeLabel.js +3 -0
- package/dist/esm/Graph/TgGraph.d.ts +1 -0
- package/package.json +2 -1
|
@@ -165,7 +165,11 @@ ${legendRows}
|
|
|
165
165
|
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`;
|
|
166
166
|
}
|
|
167
167
|
buildNodeLabel(node) {
|
|
168
|
-
return new TgNodeLabel_js_1.TgNodeLabel(node)
|
|
168
|
+
return new TgNodeLabel_js_1.TgNodeLabel(node)
|
|
169
|
+
.getLabel()
|
|
170
|
+
.replace(/"\s*<</g, '<<')
|
|
171
|
+
.replace(/>>\s*"/g, '>>')
|
|
172
|
+
.replaceAll('\\"', '"');
|
|
169
173
|
}
|
|
170
174
|
static resolveGraphOptions(input) {
|
|
171
175
|
/* istanbul ignore next */
|
|
@@ -934,6 +934,19 @@ 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
|
+
});
|
|
937
950
|
});
|
|
938
951
|
describe('DotRenderer.applyLegend', () => {
|
|
939
952
|
it('shoud return output unchanged when no graph block is present', () => {
|
|
@@ -17,6 +17,9 @@ class TgNodeLabel {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
getLabel() {
|
|
20
|
+
if (this.node.hints?.label?.overwriteTo) {
|
|
21
|
+
return this.node.hints?.label?.overwriteTo;
|
|
22
|
+
}
|
|
20
23
|
const { resourceName, name } = this.getLabelComponents();
|
|
21
24
|
const kind = this.node.terraform?.kind;
|
|
22
25
|
const parentModuleName = this.node.terraform?.parentModuleName ?? '';
|
|
@@ -159,7 +159,11 @@ ${legendRows}
|
|
|
159
159
|
return `${output.slice(0, firstBrace + 1)}\n${keySubgraph}\n${output.slice(firstBrace + 1)}`;
|
|
160
160
|
}
|
|
161
161
|
buildNodeLabel(node) {
|
|
162
|
-
return new TgNodeLabel(node)
|
|
162
|
+
return new TgNodeLabel(node)
|
|
163
|
+
.getLabel()
|
|
164
|
+
.replace(/"\s*<</g, '<<')
|
|
165
|
+
.replace(/>>\s*"/g, '>>')
|
|
166
|
+
.replaceAll('\\"', '"');
|
|
163
167
|
}
|
|
164
168
|
static resolveGraphOptions(input) {
|
|
165
169
|
/* istanbul ignore next */
|
|
@@ -932,6 +932,19 @@ 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
|
+
});
|
|
935
948
|
});
|
|
936
949
|
describe('DotRenderer.applyLegend', () => {
|
|
937
950
|
it('shoud return output unchanged when no graph block is present', () => {
|
|
@@ -14,6 +14,9 @@ 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
|
+
}
|
|
17
20
|
const { resourceName, name } = this.getLabelComponents();
|
|
18
21
|
const kind = this.node.terraform?.kind;
|
|
19
22
|
const parentModuleName = this.node.terraform?.parentModuleName ?? '';
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terra-graph/core",
|
|
3
|
+
"license": "Apache-2.0",
|
|
3
4
|
"author": {
|
|
4
5
|
"name": "Kevin Baldwyn",
|
|
5
6
|
"url": "https://github.com/terra-graph/core"
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git+https://github.com/terra-graph/core.git"
|
|
10
11
|
},
|
|
11
|
-
"version": "1.0.0-rc.
|
|
12
|
+
"version": "1.0.0-rc.6",
|
|
12
13
|
"main": "./dist/cjs/index.js",
|
|
13
14
|
"module": "./dist/esm/index.js",
|
|
14
15
|
"types": "./dist/esm/index.d.ts",
|