@huaweidevtools/aishell-dsh-deploy 0.0.18 → 0.0.20
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/README.md +6 -3
- package/lib/data/terraform-examples.zip +0 -0
- package/lib/index.js +1579 -556
- package/lib/types/account-view.d.ts +174 -0
- package/lib/types/design-render.d.ts +64 -0
- package/lib/types/diagram.d.ts +49 -0
- package/lib/types/layout.d.ts +145 -0
- package/lib/types/svg-render.d.ts +146 -0
- package/lib/types/traffic.d.ts +105 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +10 -11
- package/lib/types/d2-design.d.ts +0 -60
- package/lib/types/d2-engine.d.ts +0 -111
- package/lib/types/d2-inventory.d.ts +0 -82
package/lib/types/version.d.ts
CHANGED
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* written by earlier releases carry it — so it is kept even though there is no
|
|
19
19
|
* server.
|
|
20
20
|
*/
|
|
21
|
-
export declare const SERVER_VERSION = "aishell-deploy 0.0.
|
|
21
|
+
export declare const SERVER_VERSION = "aishell-deploy 0.0.20";
|
|
22
22
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-deploy",
|
|
3
3
|
"description": "Huawei Cloud infrastructure tools for DSH — Terraform, OpenAPI, resource inventory, cost estimates",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.20",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,27 +27,26 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@terrastruct/d2": "^0.1.33",
|
|
31
30
|
"adm-zip": "^0.6.1",
|
|
32
31
|
"hcl2-parser": "^1.0.3",
|
|
33
32
|
"jsonpath-plus": "^10.4.0",
|
|
34
33
|
"zod": "^4.2.0",
|
|
35
|
-
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.
|
|
34
|
+
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.20"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
37
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
39
|
-
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
40
|
-
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
41
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
42
|
-
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
|
|
38
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
39
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
40
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
44
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
46
45
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.5",
|
|
47
|
-
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
48
|
-
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
49
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
50
|
-
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
46
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1 || 0.2.2-rc.2",
|
|
51
50
|
"@deepseek-ai/schemastery": "3.18.4",
|
|
52
51
|
"tsdown": "^0.10.0",
|
|
53
52
|
"typescript": "^5.7.0",
|
package/lib/types/d2-design.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drawing a design: what a `.tf` declares, with the resources it reuses marked.
|
|
3
|
-
*
|
|
4
|
-
* ## Why this module does have a table of kinds
|
|
5
|
-
*
|
|
6
|
-
* Its input is `Topology`, whose nodes have already been classified into a
|
|
7
|
-
* design vocabulary (`vpc`, `subnet`, `security-group`, …). That
|
|
8
|
-
* classification is the point of the design path: a design is a network
|
|
9
|
-
* configuration, and the picture is about the network it declares. A resource
|
|
10
|
-
* outside that vocabulary is reported by name rather than drawn — see
|
|
11
|
-
* `topology.ts`.
|
|
12
|
-
*
|
|
13
|
-
* So the tables here map that closed vocabulary onto colour and words. They are
|
|
14
|
-
* finite because the input is finite, and a kind added to `NodeKind` without a
|
|
15
|
-
* class here fails at generation, naming the fragment.
|
|
16
|
-
*
|
|
17
|
-
* An account that already exists draws through `d2-inventory.ts` instead, where
|
|
18
|
-
* the vocabulary has no closed form.
|
|
19
|
-
*
|
|
20
|
-
* ## What D2 carries
|
|
21
|
-
*
|
|
22
|
-
* The PICTURE. Not data: an attribute written as a child (`cidr: "10.0.0.0/16"`)
|
|
23
|
-
* becomes a visible second box, so facts go into the node's LABEL instead. A
|
|
24
|
-
* mistyped attribute or an edge to an undefined node is accepted silently.
|
|
25
|
-
*
|
|
26
|
-
* @module @huaweidevtools/aishell-dsh-deploy/d2-design
|
|
27
|
-
*/
|
|
28
|
-
import type { Topology, TopologyEdge } from './topology.ts';
|
|
29
|
-
import type { RenderResult } from './d2-engine.ts';
|
|
30
|
-
/**
|
|
31
|
-
* Draw the topology.
|
|
32
|
-
*
|
|
33
|
-
* @param topology - the derived picture.
|
|
34
|
-
* @param edges - the relationships to draw, from `<from-address>` to
|
|
35
|
-
* `<to-address>`. Only addresses the topology knows are drawn.
|
|
36
|
-
* @returns the D2 source and the SVG it renders to.
|
|
37
|
-
* @throws when the generated D2 source does not compile. That is a defect in
|
|
38
|
-
* this module rather than in the user's configuration — the generator is
|
|
39
|
-
* what produced the text — so the message names the generated fragment.
|
|
40
|
-
*/
|
|
41
|
-
export declare function renderTopology(topology: Topology, edges: readonly TopologyEdge[]): Promise<RenderResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Generate the D2 source for one topology.
|
|
44
|
-
*
|
|
45
|
-
* The shape of the output is fixed by what D2 accepts:
|
|
46
|
-
*
|
|
47
|
-
* - Nothing is written as an attribute child. `cidr: "10.0.0.0/16"` inside a
|
|
48
|
-
* node's block renders as its own box, which would put a stray rectangle
|
|
49
|
-
* in every subnet. Facts go into the node's LABEL instead.
|
|
50
|
-
* - Facts are separated by `·` rather than aligned into columns, because D2
|
|
51
|
-
* treats a leading `|` as a block-string terminator.
|
|
52
|
-
* - No `vars` block beyond the theme: D2 discards everything under it except
|
|
53
|
-
* `d2-config`.
|
|
54
|
-
*
|
|
55
|
-
* @param topology - the derived picture.
|
|
56
|
-
* @param edges - the relationships to draw.
|
|
57
|
-
* @returns D2 source text.
|
|
58
|
-
*/
|
|
59
|
-
export declare function toD2(topology: Topology, edges: readonly TopologyEdge[]): string;
|
|
60
|
-
//# sourceMappingURL=d2-design.d.ts.map
|
package/lib/types/d2-engine.d.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The D2 renderer itself: source text in, SVG out.
|
|
3
|
-
*
|
|
4
|
-
* ## What this module owns, and what it does not
|
|
5
|
-
*
|
|
6
|
-
* It owns the mechanism — instantiating the WASM build, compiling, rendering,
|
|
7
|
-
* and handing the linear memory back. It knows nothing about topology: the
|
|
8
|
-
* source text it is given could draw anything.
|
|
9
|
-
*
|
|
10
|
-
* That separation is why there are two topology modules beside it
|
|
11
|
-
* (`d2-design.ts` and `d2-inventory.ts`). They generate different source from
|
|
12
|
-
* different inputs, and neither is a mode of the other; putting both in one file
|
|
13
|
-
* made a module whose reader could not tell which rules applied to which
|
|
14
|
-
* picture.
|
|
15
|
-
*
|
|
16
|
-
* ## Why D2 at all
|
|
17
|
-
*
|
|
18
|
-
* A network topology is a nested graph with edges, and every hand-rolled layout
|
|
19
|
-
* for one has to solve two things badly: where a box goes, and where its edges
|
|
20
|
-
* land. D2 solves both, and it is the format's own vocabulary — containers
|
|
21
|
-
* nest, arrows connect, `near:` pins an annotation panel.
|
|
22
|
-
*
|
|
23
|
-
* The cost is real and worth stating: the WASM build is ~21 MB packaged, and
|
|
24
|
-
* the compile step instantiates it once per process (~1.1 s cold, then ~70 ms
|
|
25
|
-
* per diagram). It runs inside a worker thread that D2 owns, so the
|
|
26
|
-
* instantiation does not block this process's event loop; {@link closeD2}
|
|
27
|
-
* terminates that worker, which is the only way to hand the ~600 MB of WASM
|
|
28
|
-
* linear memory back.
|
|
29
|
-
*
|
|
30
|
-
* ## What D2 does and does not carry
|
|
31
|
-
*
|
|
32
|
-
* It carries the PICTURE. It does not carry data: custom `vars` are discarded,
|
|
33
|
-
* an attribute written as a child (`cidr: "10.0.0.0/16"`) becomes a visible
|
|
34
|
-
* second box, and a mistyped attribute or an edge to an undefined node are
|
|
35
|
-
* accepted silently. So nothing is ever read back out of D2 — a topology is
|
|
36
|
-
* derived from its own source and D2 is only where it is drawn. That direction
|
|
37
|
-
* matters: a generator is exact, a parser of pictures is not.
|
|
38
|
-
*
|
|
39
|
-
* @module @huaweidevtools/aishell-dsh-deploy/d2-engine
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* The D2 themes, light and dark.
|
|
43
|
-
*
|
|
44
|
-
* Theme 5 rather than 0 for light. Theme 0 collapses its accent ramps into one
|
|
45
|
-
* blue-grey: `B`, `AA` and `AB` all resolve to shades of `#EDF0FD`/`#F7F8FE`
|
|
46
|
-
* there, so a diagram styled with three kinds of box draws three boxes in one
|
|
47
|
-
* colour. Theme 5 keeps them apart — blue, violet, pink (measured against the
|
|
48
|
-
* rendered palette, not the docs).
|
|
49
|
-
*
|
|
50
|
-
* 201 rather than 200 for dark, for the same reason and by the same measurement:
|
|
51
|
-
* 200 collapses the same way (`B2` and `AA2` both `#CBA6f7`), 201 keeps a
|
|
52
|
-
* distinguishable blue/violet/teal.
|
|
53
|
-
*
|
|
54
|
-
* Both ids must be given. With no `dark-theme-id` D2 emits NO dark palette at
|
|
55
|
-
* all, and every class would resolve in light colours on a dark ground.
|
|
56
|
-
*/
|
|
57
|
-
export declare const LIGHT_THEME_ID = 5;
|
|
58
|
-
export declare const DARK_THEME_ID = 201;
|
|
59
|
-
/** One render in, one render out; the caller owns timing and disposal. */
|
|
60
|
-
export interface RenderResult {
|
|
61
|
-
/** The D2 source that was rendered, so a reader can see what was drawn. */
|
|
62
|
-
readonly source: string;
|
|
63
|
-
/** The SVG, with no XML declaration so it embeds directly in HTML. */
|
|
64
|
-
readonly svg: string;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The `vars` block every generated diagram opens with.
|
|
68
|
-
*
|
|
69
|
-
* The theme ids are written into the diagram rather than passed to `render`, so
|
|
70
|
-
* the generated source is the whole description of what was drawn — a reader
|
|
71
|
-
* feeding it to the D2 CLI gets the same colours.
|
|
72
|
-
*
|
|
73
|
-
* @returns the opening lines of a D2 document.
|
|
74
|
-
*/
|
|
75
|
-
export declare function themePreamble(): string[];
|
|
76
|
-
/**
|
|
77
|
-
* Compile D2 source and render it to an SVG.
|
|
78
|
-
*
|
|
79
|
-
* @param source - the D2 source text.
|
|
80
|
-
* @returns the SVG, with no XML declaration.
|
|
81
|
-
* @throws when the source does not compile. That is a defect in the generator
|
|
82
|
-
* rather than in the user's configuration — the generator produced the text —
|
|
83
|
-
* so the caller names the generated fragment in its message.
|
|
84
|
-
*/
|
|
85
|
-
export declare function renderD2(source: string): Promise<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Quote a string for a D2 label.
|
|
88
|
-
*
|
|
89
|
-
* @param text - the label.
|
|
90
|
-
* @returns the text inside double quotes, with its own quotes escaped.
|
|
91
|
-
*/
|
|
92
|
-
export declare function quote(text: string): string;
|
|
93
|
-
/**
|
|
94
|
-
* The D2 identifier for an address or cloud id.
|
|
95
|
-
*
|
|
96
|
-
* A `.` in a D2 key means "member of the block before it", so an unreplaced one
|
|
97
|
-
* nests the node inside a box named after the part before the dot — inventing a
|
|
98
|
-
* container that does not exist. Every character D2 reserves is replaced by `_`
|
|
99
|
-
* for the same reason.
|
|
100
|
-
*
|
|
101
|
-
* A collision is possible in principle (`a_b.c` and `a.b_c` both map to
|
|
102
|
-
* `a_b_c`). It cannot occur inside one provider namespace, where the separator
|
|
103
|
-
* between resource types and names is always the same `.`, but callers draw
|
|
104
|
-
* from a map keyed by the original id, so a collision would drop an edge rather
|
|
105
|
-
* than misplace it.
|
|
106
|
-
*
|
|
107
|
-
* @param address - a terraform `type.name` address or a cloud resource id.
|
|
108
|
-
* @returns an identifier D2 accepts.
|
|
109
|
-
*/
|
|
110
|
-
export declare function d2Id(address: string): string;
|
|
111
|
-
//# sourceMappingURL=d2-engine.d.ts.map
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drawing an account that already exists.
|
|
3
|
-
*
|
|
4
|
-
* ## What this module is given, and what it is not
|
|
5
|
-
*
|
|
6
|
-
* Its input is `InventoryTopology`: nodes carrying the raw `provider`/`type`
|
|
7
|
-
* the inventory reported, and edges carrying the attribute that established
|
|
8
|
-
* them. Nothing here has been translated into a design vocabulary first, which
|
|
9
|
-
* is why nothing here needs a table of kinds — the picture can contain a
|
|
10
|
-
* service this deployment has never seen.
|
|
11
|
-
*
|
|
12
|
-
* ## Colour
|
|
13
|
-
*
|
|
14
|
-
* A table of types would need a line per service and would be wrong the first
|
|
15
|
-
* time an unfamiliar one appeared. Colouring by provider alone is not enough
|
|
16
|
-
* either: a picture of one VPC and nine security groups then reads as ten of
|
|
17
|
-
* the same thing.
|
|
18
|
-
*
|
|
19
|
-
* So the provider picks the hue and the type picks the lightness step inside it:
|
|
20
|
-
* resources of one service read as a family, and different types inside it stay
|
|
21
|
-
* apart. Both are D2's own theme classes, so the dark palette follows with no
|
|
22
|
-
* JavaScript.
|
|
23
|
-
*
|
|
24
|
-
* The mapping is a hash rather than an assignment, for the same reason: a table
|
|
25
|
-
* that assigned a hue per service would need a new line for every service, and
|
|
26
|
-
* a service missing from it would draw in whatever the fallback happened to be.
|
|
27
|
-
*
|
|
28
|
-
* @module @huaweidevtools/aishell-dsh-deploy/d2-inventory
|
|
29
|
-
*/
|
|
30
|
-
import type { InventoryEdge, InventoryTopology } from './existing-topology.ts';
|
|
31
|
-
import type { RenderResult } from './d2-engine.ts';
|
|
32
|
-
/**
|
|
33
|
-
* The class for one provider/type pair, stable across runs and pictures.
|
|
34
|
-
*
|
|
35
|
-
* @param provider - the service that reported the resource.
|
|
36
|
-
* @param type - that service's own type name.
|
|
37
|
-
* @returns a D2 theme class reference.
|
|
38
|
-
*/
|
|
39
|
-
export declare function inventoryClass(provider: string, type: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* Draw an inventory-derived topology.
|
|
42
|
-
*
|
|
43
|
-
* @param topology - the picture derived from the inventory.
|
|
44
|
-
* @returns the D2 source and the SVG it renders to.
|
|
45
|
-
*/
|
|
46
|
-
export declare function renderInventoryTopology(topology: InventoryTopology): Promise<RenderResult>;
|
|
47
|
-
/**
|
|
48
|
-
* Generate the D2 source for an inventory-derived topology.
|
|
49
|
-
*
|
|
50
|
-
* @param topology - the picture.
|
|
51
|
-
* @returns D2 source text.
|
|
52
|
-
*/
|
|
53
|
-
export declare function inventoryToD2(topology: InventoryTopology): string;
|
|
54
|
-
/**
|
|
55
|
-
* The relationships worth drawing as an arrow.
|
|
56
|
-
*
|
|
57
|
-
* Three kinds of association are dropped, each for a reason that shows up on a
|
|
58
|
-
* real account rather than being a preference:
|
|
59
|
-
*
|
|
60
|
-
* 1. **Containment.** A parent/child edge is already said by the nesting, and
|
|
61
|
-
* an arrow beside it draws the same fact twice — the line leaves the box
|
|
62
|
-
* it never left.
|
|
63
|
-
* 2. **The reverse of another edge.** The inventory reports both ends of a
|
|
64
|
-
* relationship: an EIP names its bandwidth and the bandwidth names the
|
|
65
|
-
* EIP, a server names its volumes and each volume names the server. Both
|
|
66
|
-
* are true, but one arrow per pair says as much and does not put two
|
|
67
|
-
* lines on top of each other. Measured on a live 49-resource account:
|
|
68
|
-
* 40 associations, 32 distinct pairs.
|
|
69
|
-
* 3. **A reference that points at an ancestor.** The VPC a resource sits in
|
|
70
|
-
* is visible from where the resource is drawn; a line from inside the
|
|
71
|
-
* container out to it adds no fact and crosses the container's border to
|
|
72
|
-
* say nothing. Five of those on the same account, all of them `vpc_id`.
|
|
73
|
-
*
|
|
74
|
-
* What is left is a genuine cross-container reference: a resource here naming
|
|
75
|
-
* a resource there. Those are the ones a reader has to follow, so they are the
|
|
76
|
-
* ones that get a line.
|
|
77
|
-
*
|
|
78
|
-
* @param topology - the derived picture.
|
|
79
|
-
* @returns the edges to draw, deduplicated and without the ones nesting implies.
|
|
80
|
-
*/
|
|
81
|
-
export declare function drawnEdges(topology: InventoryTopology): readonly InventoryEdge[];
|
|
82
|
-
//# sourceMappingURL=d2-inventory.d.ts.map
|