@shumoku/core 0.2.4 → 0.2.13

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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Sample network fixtures for testing and playground
3
+ */
4
+ export interface SampleFile {
5
+ name: string;
6
+ content: string;
7
+ }
8
+ /**
9
+ * Sample Network - Multi-file hierarchical structure
10
+ * Comprehensive example covering: HA routers, firewalls, VPN, DMZ, campus with multiple buildings
11
+ */
12
+ export declare const sampleNetwork: SampleFile[];
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,EAgiBrC,CAAA"}
@@ -0,0 +1,553 @@
1
+ /**
2
+ * Sample network fixtures for testing and playground
3
+ */
4
+ /**
5
+ * Sample Network - Multi-file hierarchical structure
6
+ * Comprehensive example covering: HA routers, firewalls, VPN, DMZ, campus with multiple buildings
7
+ */
8
+ export const sampleNetwork = [
9
+ {
10
+ name: 'main.yaml',
11
+ content: `name: "Sample Network"
12
+ description: "Sample network with HA routers, firewall, DMZ and campus"
13
+
14
+ settings:
15
+ theme: light
16
+
17
+ subgraphs:
18
+ - id: cloud
19
+ label: "Cloud Services"
20
+ file: "./cloud.yaml"
21
+ vendor: aws
22
+ service: vpc
23
+ resource: virtual-private-cloud-vpc
24
+ style:
25
+ fill: "#f0f8ff"
26
+ stroke: "#0072bc"
27
+ strokeDasharray: "5 5"
28
+
29
+ - id: perimeter
30
+ label: "Perimeter (Edge + Security)"
31
+ file: "./perimeter.yaml"
32
+ style:
33
+ fill: "#fff5f5"
34
+ stroke: "#d4a017"
35
+ strokeWidth: 2
36
+
37
+ - id: dmz
38
+ label: "DMZ"
39
+ file: "./dmz.yaml"
40
+ style:
41
+ fill: "#fefce8"
42
+ stroke: "#ca8a04"
43
+
44
+ - id: campus
45
+ label: "Campus"
46
+ file: "./campus.yaml"
47
+ style:
48
+ fill: "#fffbf0"
49
+ stroke: "#d4a017"
50
+
51
+ links:
52
+ # Cloud to Perimeter (VPN)
53
+ - from:
54
+ node: vgw
55
+ port: tun0
56
+ ip: 169.254.100.1/30
57
+ to:
58
+ node: rt1
59
+ port: tun1
60
+ ip: 169.254.100.2/30
61
+ label: "IPsec VPN"
62
+ type: dashed
63
+
64
+ - from:
65
+ node: vgw
66
+ port: tun1
67
+ ip: 169.254.101.1/30
68
+ to:
69
+ node: rt2
70
+ port: tun1
71
+ ip: 169.254.101.2/30
72
+ label: "IPsec VPN"
73
+ type: dashed
74
+
75
+ # Perimeter to DMZ
76
+ - from:
77
+ node: fw1
78
+ port: dmz
79
+ ip: 10.100.0.2/24
80
+ to:
81
+ node: dmz-sw
82
+ port: uplink
83
+ ip: 10.100.0.1/24
84
+ label: "DMZ"
85
+ vlan: 100
86
+ bandwidth: 10G
87
+
88
+ # Perimeter to Campus
89
+ - from:
90
+ node: fw1
91
+ port: inside
92
+ ip: 10.0.2.1/30
93
+ to:
94
+ node: core-sw
95
+ port: eth1
96
+ ip: 10.0.2.2/30
97
+ label: "Active"
98
+ bandwidth: 10G
99
+
100
+ - from:
101
+ node: fw2
102
+ port: inside
103
+ ip: 10.0.2.5/30
104
+ to:
105
+ node: core-sw
106
+ port: eth2
107
+ ip: 10.0.2.6/30
108
+ label: "Standby"
109
+ bandwidth: 10G
110
+ `,
111
+ },
112
+ {
113
+ name: 'cloud.yaml',
114
+ content: `name: "Cloud Services"
115
+
116
+ nodes:
117
+ - id: cloud-services
118
+ label:
119
+ - "<b>Services VPC</b>"
120
+ - "CIDR: 172.16.0.0/16"
121
+ - "---"
122
+ - "DNS / DHCP / Monitoring"
123
+ type: server
124
+ vendor: aws
125
+ service: ec2
126
+ resource: instances
127
+
128
+ - id: vgw
129
+ label:
130
+ - "<b>VPN Gateway</b>"
131
+ - "Peer: 169.254.x.x"
132
+ type: vpn
133
+ vendor: aws
134
+ service: vpc
135
+ resource: vpn-gateway
136
+
137
+ links:
138
+ - from:
139
+ node: cloud-services
140
+ port: eth0
141
+ to:
142
+ node: vgw
143
+ port: vpc
144
+ label: "Internal"
145
+ `,
146
+ },
147
+ {
148
+ name: 'perimeter.yaml',
149
+ content: `name: "Perimeter Network"
150
+ description: "Edge routers and firewalls"
151
+
152
+ subgraphs:
153
+ - id: edge
154
+ label: "Edge (HA Routers)"
155
+ style:
156
+ fill: "#fff5f5"
157
+ stroke: "#d4a017"
158
+ strokeWidth: 2
159
+
160
+ - id: security
161
+ label: "Security"
162
+ style:
163
+ fill: "#fef2f2"
164
+ stroke: "#dc2626"
165
+ strokeWidth: 2
166
+
167
+ nodes:
168
+ # ========== Edge Layer ==========
169
+ - id: isp1
170
+ label:
171
+ - "<b>ISP Line #1</b>"
172
+ - "(Primary)"
173
+ type: internet
174
+ parent: edge
175
+
176
+ - id: isp2
177
+ label:
178
+ - "<b>ISP Line #2</b>"
179
+ - "(Secondary)"
180
+ type: internet
181
+ parent: edge
182
+
183
+ - id: rt1
184
+ label:
185
+ - "<b>Edge-RT-1 (Master)</b>"
186
+ - "Mgmt: 10.0.0.1"
187
+ - "VRRP VIP: 10.0.0.254"
188
+ type: router
189
+ vendor: yamaha
190
+ model: rtx3510
191
+ parent: edge
192
+
193
+ - id: rt2
194
+ label:
195
+ - "<b>Edge-RT-2 (Backup)</b>"
196
+ - "Mgmt: 10.0.0.2"
197
+ - "VRRP VIP: 10.0.0.254"
198
+ type: router
199
+ vendor: yamaha
200
+ model: rtx3510
201
+ parent: edge
202
+
203
+ # ========== Security Layer ==========
204
+ - id: fw1
205
+ label:
206
+ - "<b>FW-1 (Active)</b>"
207
+ - "Mgmt: 10.0.100.1"
208
+ type: firewall
209
+ vendor: juniper
210
+ model: SRX4100
211
+ parent: security
212
+
213
+ - id: fw2
214
+ label:
215
+ - "<b>FW-2 (Standby)</b>"
216
+ - "Mgmt: 10.0.100.2"
217
+ type: firewall
218
+ vendor: juniper
219
+ model: SRX4100
220
+ parent: security
221
+
222
+ links:
223
+ # ISP to Routers
224
+ - from:
225
+ node: isp1
226
+ port: eth0
227
+ ip: 203.0.113.2/30
228
+ to:
229
+ node: rt1
230
+ port: wan1
231
+ ip: 203.0.113.1/30
232
+ bandwidth: 10G
233
+
234
+ - from:
235
+ node: isp2
236
+ port: eth0
237
+ ip: 198.51.100.2/30
238
+ to:
239
+ node: rt2
240
+ port: wan1
241
+ ip: 198.51.100.1/30
242
+ bandwidth: 10G
243
+
244
+ # Router HA Keepalive
245
+ - from:
246
+ node: rt1
247
+ port: ha0
248
+ ip: 10.255.0.1/30
249
+ to:
250
+ node: rt2
251
+ port: ha0
252
+ ip: 10.255.0.2/30
253
+ label: "Keepalive"
254
+ redundancy: ha
255
+ style:
256
+ minLength: 300
257
+
258
+ # Router to Firewall
259
+ - from:
260
+ node: rt1
261
+ port: lan1
262
+ ip: 10.0.1.1/30
263
+ to:
264
+ node: fw1
265
+ port: outside
266
+ ip: 10.0.1.2/30
267
+ bandwidth: 10G
268
+
269
+ - from:
270
+ node: rt2
271
+ port: lan1
272
+ ip: 10.0.1.5/30
273
+ to:
274
+ node: fw2
275
+ port: outside
276
+ ip: 10.0.1.6/30
277
+ bandwidth: 10G
278
+
279
+ # Firewall HA
280
+ - from:
281
+ node: fw1
282
+ port: ha
283
+ to:
284
+ node: fw2
285
+ port: ha
286
+ label: "HA Sync"
287
+ redundancy: ha
288
+ style:
289
+ minLength: 300
290
+ `,
291
+ },
292
+ {
293
+ name: 'dmz.yaml',
294
+ content: `name: "DMZ"
295
+ description: "Demilitarized zone with public-facing servers"
296
+
297
+ nodes:
298
+ - id: dmz-sw
299
+ label:
300
+ - "<b>DMZ-SW</b>"
301
+ - "Mgmt: 10.100.0.1"
302
+ type: l2-switch
303
+
304
+ - id: web-srv
305
+ label:
306
+ - "<b>Web Server</b>"
307
+ - "10.100.10.10"
308
+ type: server
309
+
310
+ - id: mail-srv
311
+ label:
312
+ - "<b>Mail Server</b>"
313
+ - "10.100.10.20"
314
+ type: server
315
+
316
+ links:
317
+ - from:
318
+ node: dmz-sw
319
+ port: eth1
320
+ to:
321
+ node: web-srv
322
+ port: eth0
323
+ vlan: 100
324
+ bandwidth: 1G
325
+
326
+ - from:
327
+ node: dmz-sw
328
+ port: eth2
329
+ to:
330
+ node: mail-srv
331
+ port: eth0
332
+ vlan: 100
333
+ bandwidth: 1G
334
+ `,
335
+ },
336
+ {
337
+ name: 'campus.yaml',
338
+ content: `name: "Campus Network"
339
+ description: "Internal campus network with NOC and buildings"
340
+
341
+ subgraphs:
342
+ - id: noc
343
+ label: "NOC"
344
+ style:
345
+ fill: "#e6f7ff"
346
+ stroke: "#0055a6"
347
+ strokeWidth: 2
348
+
349
+ - id: building-a
350
+ label: "Building A"
351
+ direction: TB
352
+ style:
353
+ fill: "#f0fdf4"
354
+ stroke: "#22c55e"
355
+
356
+ - id: building-b
357
+ label: "Building B"
358
+ direction: TB
359
+ style:
360
+ fill: "#fef3c7"
361
+ stroke: "#f59e0b"
362
+
363
+ nodes:
364
+ # ========== NOC ==========
365
+ - id: core-sw
366
+ label:
367
+ - "<b>Core-SW</b>"
368
+ - "Mgmt: 10.1.0.1"
369
+ - "Inter-VLAN Routing"
370
+ type: l3-switch
371
+ vendor: juniper
372
+ model: QFX5120-48T
373
+ parent: noc
374
+
375
+ - id: dist-sw
376
+ label:
377
+ - "<b>Distribution-SW</b>"
378
+ - "Mgmt: 10.1.0.2"
379
+ - "Uplink: 40G"
380
+ type: l3-switch
381
+ vendor: juniper
382
+ model: EX4400-48T
383
+ parent: noc
384
+
385
+ # ========== Building A ==========
386
+ - id: sw-a1
387
+ label:
388
+ - "<b>SW-A1 (Floor 1)</b>"
389
+ - "Mgmt: 10.10.0.1"
390
+ type: l2-switch
391
+ vendor: juniper
392
+ model: EX2300-24P
393
+ parent: building-a
394
+
395
+ - id: sw-a2
396
+ label:
397
+ - "<b>SW-A2 (Floor 2)</b>"
398
+ - "Mgmt: 10.10.0.2"
399
+ type: l2-switch
400
+ vendor: juniper
401
+ model: EX2300-24P
402
+ parent: building-a
403
+
404
+ - id: ap-a1
405
+ label: "AP-A1"
406
+ type: access-point
407
+ vendor: aruba
408
+ model: ap500-series
409
+ parent: building-a
410
+
411
+ - id: ap-a2
412
+ label: "AP-A2"
413
+ type: access-point
414
+ vendor: aruba
415
+ model: ap500-series
416
+ parent: building-a
417
+
418
+ # ========== Building B ==========
419
+ - id: sw-b1
420
+ label:
421
+ - "<b>SW-B1 (Floor 1)</b>"
422
+ - "Mgmt: 10.20.0.1"
423
+ type: l2-switch
424
+ vendor: yamaha
425
+ model: swx2310_28gt
426
+ parent: building-b
427
+
428
+ - id: sw-b2
429
+ label:
430
+ - "<b>SW-B2 (Floor 2)</b>"
431
+ - "Mgmt: 10.20.0.2"
432
+ type: l2-switch
433
+ vendor: yamaha
434
+ model: swx2310_28gt
435
+ parent: building-b
436
+
437
+ - id: ap-b1
438
+ label: "AP-B1"
439
+ type: access-point
440
+ vendor: aruba
441
+ model: ap500-series
442
+ parent: building-b
443
+
444
+ - id: ap-b2
445
+ label: "AP-B2"
446
+ type: access-point
447
+ vendor: aruba
448
+ model: ap500-series
449
+ parent: building-b
450
+
451
+ links:
452
+ # Core to Distribution
453
+ - from:
454
+ node: core-sw
455
+ port: ae0
456
+ ip: 10.0.3.1/30
457
+ to:
458
+ node: dist-sw
459
+ port: ae0
460
+ ip: 10.0.3.2/30
461
+ label: "40G LACP"
462
+ bandwidth: 40G
463
+
464
+ # Distribution to Buildings
465
+ - from:
466
+ node: dist-sw
467
+ port: eth10
468
+ ip: 10.10.0.254/24
469
+ to:
470
+ node: sw-a1
471
+ port: uplink
472
+ ip: 10.10.0.1/24
473
+ label: "Trunk"
474
+ vlan: [10, 20]
475
+ bandwidth: 10G
476
+
477
+ - from:
478
+ node: dist-sw
479
+ port: eth20
480
+ ip: 10.20.0.254/24
481
+ to:
482
+ node: sw-b1
483
+ port: uplink
484
+ ip: 10.20.0.1/24
485
+ label: "Trunk"
486
+ vlan: [10, 30]
487
+ bandwidth: 10G
488
+
489
+ # Building A cascade
490
+ - from:
491
+ node: sw-a1
492
+ port: eth24
493
+ ip: 10.10.1.1/30
494
+ to:
495
+ node: sw-a2
496
+ port: uplink
497
+ ip: 10.10.1.2/30
498
+ label: "Cascade"
499
+ vlan: [10, 20]
500
+ bandwidth: 10G
501
+
502
+ - from:
503
+ node: sw-a1
504
+ port: eth1
505
+ to:
506
+ node: ap-a1
507
+ port: eth0
508
+ vlan: 20
509
+ bandwidth: 1G
510
+
511
+ - from:
512
+ node: sw-a2
513
+ port: eth1
514
+ to:
515
+ node: ap-a2
516
+ port: eth0
517
+ vlan: 20
518
+ bandwidth: 1G
519
+
520
+ # Building B cascade
521
+ - from:
522
+ node: sw-b1
523
+ port: eth24
524
+ ip: 10.20.1.1/30
525
+ to:
526
+ node: sw-b2
527
+ port: uplink
528
+ ip: 10.20.1.2/30
529
+ label: "Cascade"
530
+ vlan: [10, 30]
531
+ bandwidth: 10G
532
+
533
+ - from:
534
+ node: sw-b1
535
+ port: eth1
536
+ to:
537
+ node: ap-b1
538
+ port: eth0
539
+ vlan: 30
540
+ bandwidth: 1G
541
+
542
+ - from:
543
+ node: sw-b2
544
+ port: eth1
545
+ to:
546
+ node: ap-b2
547
+ port: eth0
548
+ vlan: 30
549
+ bandwidth: 1G
550
+ `,
551
+ },
552
+ ];
553
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGZ;KACE;IACD;QACE,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BZ;KACE;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IZ;KACE;IACD;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCZ;KACE;IACD;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoNZ;KACE;CACF,CAAA"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Hierarchical sheet generation utilities
3
+ * Shared logic for building child sheets with export connectors
4
+ */
5
+ import type { LayoutResult, NetworkGraph } from './models/types.js';
6
+ export interface SheetData {
7
+ graph: NetworkGraph;
8
+ layout: LayoutResult;
9
+ }
10
+ export interface LayoutEngine {
11
+ layoutAsync(graph: NetworkGraph): Promise<LayoutResult>;
12
+ }
13
+ /**
14
+ * Check if a node is a virtual export connector
15
+ */
16
+ export declare function isExportNode(nodeId: string): boolean;
17
+ /**
18
+ * Check if a link is a virtual export connector link
19
+ */
20
+ export declare function isExportLink(linkId: string): boolean;
21
+ /**
22
+ * Build hierarchical sheets from a root graph
23
+ *
24
+ * Creates child sheets for each subgraph with:
25
+ * - Filtered nodes (only those belonging to the subgraph)
26
+ * - Internal links (both endpoints in subgraph)
27
+ * - Export connector nodes/links for boundary connections
28
+ *
29
+ * @param graph - Root network graph with subgraphs
30
+ * @param rootLayout - Layout result for the root graph
31
+ * @param layoutEngine - Engine to layout child sheets
32
+ * @returns Map of sheet ID to SheetData (includes 'root')
33
+ */
34
+ export declare function buildHierarchicalSheets(graph: NetworkGraph, rootLayout: LayoutResult, layoutEngine: LayoutEngine): Promise<Map<string, SheetData>>;
35
+ //# sourceMappingURL=hierarchical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hierarchical.d.ts","sourceRoot":"","sources":["../src/hierarchical.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAQ,YAAY,EAAkB,MAAM,mBAAmB,CAAA;AAazF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,YAAY,CAAA;IACnB,MAAM,EAAE,YAAY,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;CACxD;AAgBD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,YAAY,EACxB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAsBjC"}