@takodotid/circuit 0.24.0 → 0.26.0

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.
Files changed (42) hide show
  1. package/README.md +3 -3
  2. package/dist/chunks/{index-n4zpd25n.js → index-22sbskdx.js} +22 -6
  3. package/dist/chunks/{server-ckdy25w2.js → server-1ftkqkx5.js} +1 -1
  4. package/dist/cli/index.js +4621 -324
  5. package/dist/presets/index.js +5 -0
  6. package/dist/types/adapters/devices/catalog.d.ts +28 -0
  7. package/dist/types/adapters/devices/fortios/firewall.d.ts +21 -0
  8. package/dist/types/adapters/devices/fortios/index.d.ts +55 -0
  9. package/dist/types/adapters/devices/fortios/models.d.ts +14 -0
  10. package/dist/types/adapters/devices/fortios/names.d.ts +32 -0
  11. package/dist/types/adapters/devices/fortios/plan.d.ts +26 -0
  12. package/dist/types/adapters/devices/fortios/render.d.ts +36 -0
  13. package/dist/types/adapters/devices/fortios/routing.d.ts +32 -0
  14. package/dist/types/adapters/devices/fortios/tree.d.ts +33 -0
  15. package/dist/types/adapters/devices/junos/bgp.d.ts +11 -0
  16. package/dist/types/adapters/devices/junos/index.d.ts +39 -0
  17. package/dist/types/adapters/devices/junos/models.d.ts +14 -0
  18. package/dist/types/adapters/devices/junos/render.d.ts +52 -0
  19. package/dist/types/core/graph.d.ts +2 -0
  20. package/dist/types/presets/index.d.ts +1 -1
  21. package/package.json +7 -2
  22. package/src/adapters/devices/catalog.ts +5 -2
  23. package/src/adapters/devices/fortios/TRAPS.md +40 -0
  24. package/src/adapters/devices/fortios/firewall.ts +352 -0
  25. package/src/adapters/devices/fortios/index.ts +800 -0
  26. package/src/adapters/devices/fortios/models.ts +7 -0
  27. package/src/adapters/devices/fortios/names.ts +78 -0
  28. package/src/adapters/devices/fortios/plan.ts +840 -0
  29. package/src/adapters/devices/fortios/render.ts +734 -0
  30. package/src/adapters/devices/fortios/routing.ts +444 -0
  31. package/src/adapters/devices/fortios/tree.ts +121 -0
  32. package/src/adapters/devices/index.ts +3 -1
  33. package/src/adapters/devices/junos/TRAPS.md +31 -0
  34. package/src/adapters/devices/junos/bgp.ts +263 -0
  35. package/src/adapters/devices/junos/index.ts +784 -0
  36. package/src/adapters/devices/junos/models.ts +7 -0
  37. package/src/adapters/devices/junos/render.ts +868 -0
  38. package/src/core/across.ts +6 -3
  39. package/src/core/graph.ts +3 -1
  40. package/src/core/validate.ts +4 -3
  41. package/src/presets/index.ts +7 -1
  42. package/templates/colocation/checks.ts +8 -1
package/README.md CHANGED
@@ -10,9 +10,9 @@ Documentation: [circuit.tako.id](https://circuit.tako.id)
10
10
  ## What it does
11
11
 
12
12
  - **One file per device.** VLANs, ports, addresses, routing, firewall, users and services, written in TypeScript. Your editor checks every name you refer to as you type.
13
- - **The same words for every vendor.** MikroTik RouterOS 7, Huawei VRP and Raisecom ROS each get their own commands. What a device cannot do is an error before anything is sent.
13
+ - **The same words for every vendor.** MikroTik RouterOS 7, Huawei VRP, Raisecom ROS, Juniper Junos and Fortinet FortiOS each get their own commands. What a device cannot do is an error before anything is sent.
14
14
  - **The file is the whole truth.** A port, user or service the file does not mention is removed or turned off, so nothing set by hand lingers.
15
- - **See every change first.** `diff` shows it offline, `apply` plans it against the live device, and nothing is sent without `--confirm`. On RouterOS, a change undoes itself if Circuit cannot log in again afterwards.
15
+ - **See every change first.** `diff` shows it offline, `apply` plans it against the live device, and nothing is sent without `--confirm`. On RouterOS, Junos and FortiOS, a change undoes itself if Circuit cannot log in again afterwards.
16
16
  - **History in git.** Each device's last snapshot is kept in `.circuit/state/`, so the repository's history is the network's history.
17
17
  - **Rules of your own.** Checks run on every change, and presets give ready-made filters, BGP policies and checks.
18
18
  - **Secrets stay out of the repository.** They come from `.env` or 1Password, and never appear in a plan or a snapshot.
@@ -44,7 +44,7 @@ npx @takodotid/circuit new # or: pnpm dlx @takodotid/circuit new, bunx @t
44
44
 
45
45
  It asks which kind of network you have, creates a project with example devices, and installs Circuit. [Getting started](https://circuit.tako.id/guide/getting-started) walks through the first run.
46
46
 
47
- Circuit supports MikroTik RouterOS 7, Huawei VRP and Raisecom ROS. Releases are on the [releases page](https://github.com/takodotid/circuit/releases), on npm and on GitHub Packages.
47
+ Circuit supports MikroTik RouterOS 7, Huawei VRP, Raisecom ROS, Juniper Junos and Fortinet FortiOS. Releases are on the [releases page](https://github.com/takodotid/circuit/releases), on npm and on GitHub Packages.
48
48
 
49
49
  ## Working on Circuit
50
50
 
@@ -12,8 +12,24 @@ import {
12
12
  host2
13
13
  } from "./index-v8zgr7wm.js";
14
14
 
15
- // src/adapters/devices/raisecom-ros/models.ts
15
+ // src/adapters/devices/fortios/models.ts
16
16
  var models = {
17
+ "FG-3700D": {
18
+ ports: { "40g": 4, "10g": 28, "1g": 2 },
19
+ spelling: { "40g": "port{n}", "10g": "port{n+4}", "1g": "mgmt{n}" }
20
+ }
21
+ };
22
+
23
+ // src/adapters/devices/junos/models.ts
24
+ var models2 = {
25
+ "QFX5100-48S-6Q": {
26
+ ports: { "40g": 6, "10g": 48, "1g": 2 },
27
+ spelling: { "40g": "et-0/0/{n+47}", "10g": "xe-0/0/{n-1}", "1g": "em{n-1}" }
28
+ }
29
+ };
30
+
31
+ // src/adapters/devices/raisecom-ros/models.ts
32
+ var models3 = {
17
33
  "RAX721-C-6C48": {
18
34
  ports: { "100g": 6, "25g": 24, "10g": 24 },
19
35
  spelling: { "100g": "hundredgige 1/1/{n}", "25g": "twenty-fivegige 1/2/{n}", "10g": "tengigabitethernet 1/3/{n}" }
@@ -21,7 +37,7 @@ var models = {
21
37
  };
22
38
 
23
39
  // src/adapters/devices/routeros/models.ts
24
- var models2 = {
40
+ var models4 = {
25
41
  "CCR2216-1G-12XS-2XQ": {
26
42
  ports: { "100g": 2, "25g": 12, "1g": 1 },
27
43
  spelling: { "100g": "qsfp28-{n}-1", "25g": "sfp28-{n}", "1g": "ether{n}" }
@@ -29,12 +45,12 @@ var models2 = {
29
45
  };
30
46
 
31
47
  // src/adapters/devices/vrp/models.ts
32
- var models3 = {
48
+ var models5 = {
33
49
  "CE6855-48S6Q-HI": { ports: { "10g": 48, "40g": 6 }, spelling: { "10g": "10GE1/0/{n}", "40g": "40GE1/0/{n}" } }
34
50
  };
35
51
 
36
52
  // src/adapters/devices/catalog.ts
37
- var catalog = { routeros: models2, vrp: models3, "raisecom-ros": models };
53
+ var catalog = { routeros: models4, vrp: models5, "raisecom-ros": models3, junos: models2, fortios: models };
38
54
  function portsOf(platform, model) {
39
55
  const spec = catalog[platform]?.[model];
40
56
  if (!spec)
@@ -47,7 +63,7 @@ function spell(platform, model, port) {
47
63
  const template = parts && spec?.spelling[parts[1]];
48
64
  if (!template)
49
65
  throw new Error(`${model} has no port ${port}`);
50
- return template.replace("{n}", parts[2]);
66
+ return template.replace(/\{n([+-]\d+)?\}/, (_, shift) => String(Number(parts[2]) + Number(shift ?? 0)));
51
67
  }
52
68
 
53
69
  // src/core/graph.ts
@@ -92,7 +108,7 @@ function holdersOf(devices) {
92
108
  if (!isCidr2(address))
93
109
  return [];
94
110
  const peer = typeof entry === "string" ? undefined : entry.peer;
95
- return [{ device, name, address, peer, vrrp: settings.vrrp ?? [] }];
111
+ return [{ device, name, address, peer, vrrp: settings.vrrp ?? [], vrf: settings.vrf }];
96
112
  })));
97
113
  }
98
114
  function describeDevice(device) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  packageRoot
3
- } from "./index-n4zpd25n.js";
3
+ } from "./index-22sbskdx.js";
4
4
 
5
5
  // src/studio/server.ts
6
6
  import { execFile as execFile2, spawn } from "node:child_process";