@sentriflow/core 0.1.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 (71) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +86 -0
  3. package/package.json +60 -0
  4. package/src/constants.ts +77 -0
  5. package/src/engine/RuleExecutor.ts +256 -0
  6. package/src/engine/Runner.ts +312 -0
  7. package/src/engine/SandboxedExecutor.ts +208 -0
  8. package/src/errors.ts +88 -0
  9. package/src/helpers/arista/helpers.ts +1220 -0
  10. package/src/helpers/arista/index.ts +12 -0
  11. package/src/helpers/aruba/helpers.ts +637 -0
  12. package/src/helpers/aruba/index.ts +13 -0
  13. package/src/helpers/cisco/helpers.ts +534 -0
  14. package/src/helpers/cisco/index.ts +11 -0
  15. package/src/helpers/common/helpers.ts +265 -0
  16. package/src/helpers/common/index.ts +5 -0
  17. package/src/helpers/common/validation.ts +280 -0
  18. package/src/helpers/cumulus/helpers.ts +676 -0
  19. package/src/helpers/cumulus/index.ts +12 -0
  20. package/src/helpers/extreme/helpers.ts +422 -0
  21. package/src/helpers/extreme/index.ts +12 -0
  22. package/src/helpers/fortinet/helpers.ts +892 -0
  23. package/src/helpers/fortinet/index.ts +12 -0
  24. package/src/helpers/huawei/helpers.ts +790 -0
  25. package/src/helpers/huawei/index.ts +11 -0
  26. package/src/helpers/index.ts +53 -0
  27. package/src/helpers/juniper/helpers.ts +756 -0
  28. package/src/helpers/juniper/index.ts +12 -0
  29. package/src/helpers/mikrotik/helpers.ts +722 -0
  30. package/src/helpers/mikrotik/index.ts +12 -0
  31. package/src/helpers/nokia/helpers.ts +856 -0
  32. package/src/helpers/nokia/index.ts +11 -0
  33. package/src/helpers/paloalto/helpers.ts +939 -0
  34. package/src/helpers/paloalto/index.ts +12 -0
  35. package/src/helpers/vyos/helpers.ts +429 -0
  36. package/src/helpers/vyos/index.ts +12 -0
  37. package/src/index.ts +30 -0
  38. package/src/json-rules/ExpressionEvaluator.ts +292 -0
  39. package/src/json-rules/HelperRegistry.ts +177 -0
  40. package/src/json-rules/JsonRuleCompiler.ts +339 -0
  41. package/src/json-rules/JsonRuleValidator.ts +371 -0
  42. package/src/json-rules/index.ts +97 -0
  43. package/src/json-rules/schema.json +350 -0
  44. package/src/json-rules/types.ts +303 -0
  45. package/src/pack-loader/PackLoader.ts +332 -0
  46. package/src/pack-loader/index.ts +17 -0
  47. package/src/pack-loader/types.ts +135 -0
  48. package/src/parser/IncrementalParser.ts +527 -0
  49. package/src/parser/Sanitizer.ts +104 -0
  50. package/src/parser/SchemaAwareParser.ts +504 -0
  51. package/src/parser/VendorSchema.ts +72 -0
  52. package/src/parser/vendors/arista-eos.ts +206 -0
  53. package/src/parser/vendors/aruba-aoscx.ts +123 -0
  54. package/src/parser/vendors/aruba-aosswitch.ts +113 -0
  55. package/src/parser/vendors/aruba-wlc.ts +173 -0
  56. package/src/parser/vendors/cisco-ios.ts +110 -0
  57. package/src/parser/vendors/cisco-nxos.ts +107 -0
  58. package/src/parser/vendors/cumulus-linux.ts +161 -0
  59. package/src/parser/vendors/extreme-exos.ts +154 -0
  60. package/src/parser/vendors/extreme-voss.ts +167 -0
  61. package/src/parser/vendors/fortinet-fortigate.ts +217 -0
  62. package/src/parser/vendors/huawei-vrp.ts +192 -0
  63. package/src/parser/vendors/index.ts +1521 -0
  64. package/src/parser/vendors/juniper-junos.ts +230 -0
  65. package/src/parser/vendors/mikrotik-routeros.ts +274 -0
  66. package/src/parser/vendors/nokia-sros.ts +251 -0
  67. package/src/parser/vendors/paloalto-panos.ts +264 -0
  68. package/src/parser/vendors/vyos-vyos.ts +454 -0
  69. package/src/types/ConfigNode.ts +72 -0
  70. package/src/types/DeclarativeRule.ts +158 -0
  71. package/src/types/IRule.ts +270 -0
@@ -0,0 +1,11 @@
1
+ // packages/rule-helpers/src/huawei/index.ts
2
+ // Re-export all Huawei VRP helpers
3
+
4
+ export * from './helpers';
5
+
6
+ // Also re-export commonly used common helpers for convenience
7
+ export {
8
+ hasChildCommand,
9
+ getChildCommand,
10
+ getChildCommands,
11
+ } from '../common/helpers';
@@ -0,0 +1,53 @@
1
+ // packages/core/src/helpers/index.ts
2
+ /**
3
+ * Rule Helpers Module
4
+ *
5
+ * Provides vendor-specific and common helper functions for rule authoring.
6
+ * Vendor namespaces are dynamically detected - add a new vendor by creating
7
+ * a directory with index.ts and adding an export below.
8
+ */
9
+
10
+ // Re-export all common helpers at top level
11
+ export * from './common';
12
+
13
+ // Vendor modules as namespaces
14
+ import * as arista from './arista';
15
+ import * as aruba from './aruba';
16
+ import * as cisco from './cisco';
17
+ import * as cumulus from './cumulus';
18
+ import * as extreme from './extreme';
19
+ import * as fortinet from './fortinet';
20
+ import * as huawei from './huawei';
21
+ import * as juniper from './juniper';
22
+ import * as mikrotik from './mikrotik';
23
+ import * as nokia from './nokia';
24
+ import * as paloalto from './paloalto';
25
+ import * as vyos from './vyos';
26
+
27
+ // Export vendor namespaces
28
+ export { arista, aruba, cisco, cumulus, extreme, fortinet, huawei, juniper, mikrotik, nokia, paloalto, vyos };
29
+
30
+ // Dynamically derive vendor namespaces from exports
31
+ const vendorModules = { arista, aruba, cisco, cumulus, extreme, fortinet, huawei, juniper, mikrotik, nokia, paloalto, vyos };
32
+
33
+ /**
34
+ * List of all vendor namespace names, derived from actual exports.
35
+ * Add a new vendor by importing it above and adding to vendorModules.
36
+ */
37
+ export const VENDOR_NAMESPACES = Object.keys(vendorModules) as ReadonlyArray<keyof typeof vendorModules>;
38
+
39
+ export type VendorNamespace = keyof typeof vendorModules;
40
+
41
+ /**
42
+ * Get a vendor module by name.
43
+ */
44
+ export function getVendorModule(name: VendorNamespace): typeof vendorModules[typeof name] {
45
+ return vendorModules[name];
46
+ }
47
+
48
+ /**
49
+ * Get all vendor modules as a record.
50
+ */
51
+ export function getAllVendorModules(): typeof vendorModules {
52
+ return vendorModules;
53
+ }