@yesprasad/fluent-graph 0.1.0 → 0.2.1

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/LICENSE CHANGED
@@ -22,7 +22,7 @@ Built with focus on making ServiceNow Pro Developer Fluent development with now-
22
22
 
23
23
  ## Acknowledgments
24
24
 
25
- ServiceNow SDK team for building the Fluent DSL compiler
25
+ ServiceNow SDK team for building the now-sdk and Fluent DSL compiler
26
26
  MIT License
27
27
 
28
28
  Copyright (c) 2024 ServiceNow Inc.
package/README.md CHANGED
@@ -1,319 +1,131 @@
1
1
  # fluent-graph
2
2
 
3
- **Build-time lineage extraction and impact analysis for ServiceNow Fluent SDK projects.**
4
-
5
- `fluent-graph` observes the ServiceNow SDK's internal compilation process to extract dependency graphs, detect identity conflicts, and perform blast-radius analysis—without modifying your source code or re-parsing Fluent DSL.
3
+ **Dependency visibility and impact analysis for ServiceNow Fluent SDK projects.**
6
4
 
7
5
  ---
8
6
 
9
- ## What It Does
7
+ ## The Problem
8
+
9
+ You're refactoring a ServiceNow custom table. You delete a field. You deploy.
10
+
11
+ **Production breaks.**
10
12
 
11
- - **Extracts artifact lineage** from SDK projects (tables, columns, scripts, business rules)
12
- - **Detects identity conflicts** (duplicate `$id` declarations across files)
13
- - **Maps relationships** (foreign keys, table extensions, logic attachments)
14
- - **Generates blast-radius reports** (what breaks if you change X?)
15
- - **Outputs machine-readable JSON** for CI/CD integration
13
+ 14 client scripts fail. 3 business rules error out. 2 dashboards go blank.
14
+
15
+ **You discover the breaking changes at runtime in production.**
16
16
 
17
17
  ---
18
- ## Installation
19
18
 
20
- **Prerequisites:**
21
- - Node.js 18+
22
- - An existing ServiceNow Fluent SDK project with `@servicenow/sdk` installed
19
+ ## The Solution
20
+
21
+ `fluent-graph` maps every dependency in your Fluent SDK project tables, fields, scripts, business rules, flows, catalog items — so you know what breaks *before* you deploy.
23
22
 
24
- **Install globally:**
25
23
  ```bash
26
- npm install -g @yesprasad/fluent-graph
24
+ npx @yesprasad/fluent-graph blast incident
27
25
  ```
28
- **basic CLI usage:**
29
- ```bash
30
- fluent-graph analyze
31
- fluent-graph blast <table_name or artifact_name>
26
+
27
+ ```
28
+ 🔥 BLAST RADIUS ANALYSIS
29
+ Target: incident
30
+
31
+ ⚠️ 3 artifacts will break if you modify this table:
32
+ • bank_incident_onload (Client Script)
33
+ • cs_incident_onload (Client Script)
34
+ • cs_incident_onchange_caller (Client Script)
32
35
  ```
33
36
 
34
- **Or use directly with npx (no installation needed):**
37
+ **Now you know before you deploy.**
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ Requires Node.js 18+ and an existing Fluent SDK project with `@servicenow/sdk` installed.
44
+
45
+ **Global install:**
35
46
  ```bash
36
- cd your-fluent-project
37
- npx fluent-graph extract
47
+ npm install -g @yesprasad/fluent-graph
38
48
  ```
39
49
 
40
- **Verify installation:**
50
+ **Or use without installing:**
41
51
  ```bash
42
- fluent-graph --version
52
+ npx @yesprasad/fluent-graph analyze
43
53
  ```
54
+
44
55
  ---
45
56
 
46
- ## Usage
57
+ ## Commands
47
58
 
59
+ ### Analyze — full project lineage map
48
60
 
49
- **Output:**
61
+ ```bash
62
+ fluent-graph analyze
50
63
  ```
51
- ✔ ✅ SDK detected at /node_modules/@servicenow/sdk
52
- ✔ Workspace SDK loaded
53
- ✔ Project loaded
54
- ✔ Graph built: 181 nodes, 141 edges
55
64
 
56
- 📊 LINEAGE MAP
57
- ────────────────────────────────────────────────────────────
58
-
59
- 📦 DATA SCHEMA
60
- ┌─────────────────────────────────────────────┬───────────────┐
61
- │ Table │ Status │
62
- ├─────────────────────────────────────────────┼───────────────┤
63
- │ x_1566039_seventh_critical_account │ [ACTIVE] │
64
- │ x_1566039_seventh_critical_account_incident_ext │ [ACTIVE] │
65
- │ x_1566039_seventh_customer │ [ACTIVE] │
66
- │ x_1566039_seventh_account │ [ACTIVE] │
67
- │ x_1566039_seventh_fraud_alert │ [ACTIVE] │
68
- │ x_1566039_seventh_risk_score │ [ACTIVE] │
69
- │ x_1566039_seventh_call_case │ [ACTIVE] │
70
- │ x_1566039_seventh_compliance_flag │ [ACTIVE] │
71
- │ x_1566039_seventh_account_extension │ [ACTIVE] │
72
- └─────────────────────────────────────────────┴───────────────┘
73
-
74
- 🔗 SCHEMA RELATIONSHIPS (Reference Fields)
75
- ┌─────────────────────────────────────────────┬───────────────────┬─────────────────────────────┐
76
- │ Table │ Field │ Target Table │
77
- ├─────────────────────────────────────────────┼───────────────────┼─────────────────────────────┤
78
- │ x_1566039_seventh_critical_account │ assigned_team │ sys_user_group │
79
- │ x_1566039_seventh_critical_account_incident_ext │ bank_account │ x_bank_critical_account │
80
- │ x_1566039_seventh_account │ owner │ x_1566039_seventh_account │
81
- │ x_1566039_seventh_risk_score │ account │ x_1566039_seventh_account │
82
- └─────────────────────────────────────────────┴───────────────────┴─────────────────────────────┘
83
-
84
- ⚙️ LOGIC ATTACHMENTS (Scripts & Actions)
85
- ┌─────────┬────────────────────────────────────┬───────────────────────────────────────────────┬──────────────┬──────────────────┐
86
- │ (index) │ Name │ Table │ Type │ Artifact Type │
87
- ├─────────┼────────────────────────────────────┼───────────────────────────────────────────────┼──────────────┼──────────────────┤
88
- │ 0 │ bank_incident_onload │ incident │ [onLoad] │ script client │
89
- │ 1 │ bank_account_onchange │ x_1566039_seventh_critical_account │ [onChange] │ script client │
90
- │ 2 │ cs_task_onload │ task │ [onLoad] │ script client │
91
- │ 3 │ cs_task_onchange_priority │ x_1566039_seventh_critical_account_incident_ext │ [onChange] │ script client │
92
- │ 4 │ cs_alert_onload │ x_1566039_seventh_fraud_alert │ [onLoad] │ script client │
93
- │ 5 │ cs_risk_onchange_score │ x_1566039_seventh_risk_score │ [onChange] │ script client │
94
- │ 6 │ Auto-close empty Change Requests │ change_request │ [action] │ script │
95
- │ 7 │ View car info │ x_snc_ts_custom_cars │ [action] │ ui action │
96
- │ 8 │ SampleScriptInclude │ [global] │ [action] │ script include │
97
- └─────────┴────────────────────────────────────┴───────────────────────────────────────────────┴──────────────┴──────────────────┘
98
-
99
- 🔒 SECURITY & ACCESS (ACLs)
100
- ┌──────────────────────────────┬───────────────────────┬───────────────────────────┐
101
- │ ACL │ Level / Roles │ Table │
102
- ├──────────────────────────────┼───────────────────────┼───────────────────────────┤
103
- │ DELETE on task.description │ Field-level, Roles: ✔ ✅ SDK detected at /node_modules/@servicenow/sdk
65
+ Scans your project and prints a grouped summary of all artifacts and their relationships:
66
+
67
+ ```
104
68
  ✔ Workspace SDK loaded
105
69
  ✔ Project loaded
106
70
  ✔ Graph built: 181 nodes, 141 edges
107
71
 
108
72
  📊 LINEAGE MAP
109
- ────────────────────────────────────────────────────────────
110
-
111
- 📦 DATA SCHEMA
112
- ┌─────────────────────────────────────────────┬───────────────┐
113
- │ Table │ Status │
114
- ├─────────────────────────────────────────────┼───────────────┤
115
- │ x_1566039_seventh_critical_account │ [ACTIVE] │
116
- │ x_1566039_seventh_critical_account_incident_ext │ [ACTIVE] │
117
- │ x_1566039_seventh_customer │ [ACTIVE] │
118
- │ x_1566039_seventh_account │ [ACTIVE] │
119
- │ x_1566039_seventh_fraud_alert │ [ACTIVE] │
120
- │ x_1566039_seventh_risk_score │ [ACTIVE] │
121
- │ x_1566039_seventh_call_case │ [ACTIVE] │
122
- │ x_1566039_seventh_compliance_flag │ [ACTIVE] │
123
- │ x_1566039_seventh_account_extension │ [ACTIVE] │
124
- └─────────────────────────────────────────────┴───────────────┘
125
-
126
- 🔗 SCHEMA RELATIONSHIPS (Reference Fields)
127
- ┌─────────────────────────────────────────────┬───────────────────┬─────────────────────────────┐
128
- │ Table │ Field │ Target Table │
129
- ├─────────────────────────────────────────────┼───────────────────┼─────────────────────────────┤
130
- │ x_1566039_seventh_critical_account │ assigned_team │ sys_user_group │
131
- │ x_1566039_seventh_critical_account_incident_ext │ bank_account │ x_bank_critical_account │
132
- │ x_1566039_seventh_account │ owner │ x_1566039_seventh_customer │
133
- │ x_1566039_seventh_fraud_alert │ account │ x_1566039_seventh_account │
134
- │ x_1566039_seventh_risk_score │ account │ x_1566039_seventh_account │
135
- │ x_1566039_seventh_call_case │ customer │ x_1566039_seventh_customer │
136
- │ x_1566039_seventh_compliance_flag │ customer │ x_1566039_seventh_customer │
137
- │ x_1566039_seventh_account_extension │ linked_account │ x_1566039_seventh_account │
138
- └─────────────────────────────────────────────┴───────────────────┴─────────────────────────────┘
139
-
140
- ⚙️ LOGIC ATTACHMENTS (Scripts & Actions)
141
- ┌─────────┬────────────────────────────────────┬───────────────────────────────────────────────┬──────────────┬──────────────────┐
142
- │ (index) │ Name │ Table │ Type │ Artifact Type │
143
- ├─────────┼────────────────────────────────────┼───────────────────────────────────────────────┼──────────────┼──────────────────┤
144
- │ 0 │ bank_incident_onload │ incident │ [onLoad] │ script client │
145
- │ 1 │ bank_account_onchange │ x_1566039_seventh_critical_account │ [onChange] │ script client │
146
- │ 2 │ cs_task_onload │ task │ [onLoad] │ script client │
147
- │ 3 │ cs_task_onchange_priority │ x_1566039_seventh_critical_account_incident_ext │ [onChange] │ script client │
148
- │ 4 │ cs_incident_onload │ incident │ [onLoad] │ script client │
149
- │ 5 │ cs_incident_onchange_caller │ incident │ [onChange] │ script client │
150
- │ 6 │ cs_account_onchange_type │ x_1566039_seventh_account │ [onChange] │ script client │
151
- │ 7 │ cs_alert_onload │ x_1566039_seventh_fraud_alert │ [onLoad] │ script client │
152
- │ 8 │ cs_risk_onchange_score │ x_1566039_seventh_risk_score │ [onChange] │ script client │
153
- │ 9 │ Auto-close empty Change Requests │ change_request │ [action] │ script │
154
- │ 10 │ View car info │ x_snc_ts_custom_cars │ [action] │ ui action │
155
- │ 11 │ SampleScriptInclude │ [global] │ [action] │ script include │
156
- └─────────┴────────────────────────────────────┴───────────────────────────────────────────────┴──────────────┴──────────────────┘
157
-
158
- 🔒 SECURITY & ACCESS (ACLs)
159
- ┌──────────────────────────────┬───────────────────────┬───────────────────────────┐
160
- │ ACL │ Level / Roles │ Table │
161
- ├──────────────────────────────┼───────────────────────┼───────────────────────────┤
162
- │ DELETE on task.description │ Field-level,
163
- Roles: 58794a2b937f4c0eba394fce1515930e, ae7beff0df584bd7a39fac26deaf20b7 │ task │
164
- └──────────────────────────────┴───────────────────────┴───────────────────────────┘
165
73
 
166
- 🧠 PROJECT INSIGHTS
167
- • Total User Artifacts: 23
168
- User Artifacts Breakdown:
169
- {
170
- "sys_script_client": 9,
171
- "sys_db_object": 10,
172
- "sys_script": 1,
173
- "sys_security_acl": 1,
174
- "sys_ui_action": 1,
175
- "sys_script_include": 1
176
- }
177
- • Platform Dependencies: 9
178
- • Internal References: 132
179
- • Total Artifacts: 181
180
- • Total Relationships: 141
74
+ Client Script 9 artifacts
75
+ Table 10 artifacts
76
+ Business Rule 1 artifact
77
+ Flow Definition 1 artifact
78
+ Catalog Item 2 artifacts
79
+ Acl 1 artifact
80
+ Ui Action 1 artifact
181
81
 
82
+ 🧠 PROJECT INSIGHTS
83
+ Total User Artifacts: 35
84
+ Platform Dependencies: 9
85
+ Total Relationships: 141
182
86
  ```
183
87
 
184
- **Generated file:** `fluent-graph.json` (in project root)
88
+ Also writes `fluent-graph.json` to your project root for CI/CD or tooling use.
185
89
 
186
90
  ---
187
91
 
188
- ### Blast Radius Analysis
189
-
190
- Analyze the impact of changing a specific table:
92
+ ### Blast impact analysis for a specific artifact
191
93
 
192
94
  ```bash
193
- fluent-graph blast incident
95
+ fluent-graph blast <table_or_artifact_name>
194
96
  ```
195
97
 
196
- **Output:**
98
+ Example:
99
+ ```bash
100
+ fluent-graph blast x_1566039_seventh_customer
197
101
  ```
198
- [FLUENT-GRAPH] BLAST RADIUS REPORT
199
- Target: incident [sys_db_object]
200
- SysID: 26441130e60544259e930cb385f74fca
201
- =========================================================================================
202
-
203
- ┌──────────────────────────┬─────────────────┬──────────────────────────────┬─────────────────────────────────┬──────────────────────┐
204
- │ Impacted Artifact │ Type │ File │ Reason │ State │
205
- ├──────────────────────────┼─────────────────┼──────────────────────────────┼─────────────────────────────────┼──────────────────────┤
206
- │ bank_incident_onload │ client_script │ src/fluent/bank_small_... │ ⚡ Logic Attachment [onLoad] │ INSERT_OR_UPDATE │
207
- │ cs_incident_onload │ client_script │ src/fluent/client-scripts... │ ⚡ Logic Attachment [onLoad] │ INSERT_OR_UPDATE │
208
- │ cs_incident_onchange_... │ client_script │ src/fluent/client-scripts... │ ⚡ Logic Attachment [onChange] │ INSERT_OR_UPDATE │
209
- └──────────────────────────┴─────────────────┴──────────────────────────────┴─────────────────────────────────┴──────────────────────┘
210
102
 
211
- ⚠️ PRE-DEPLOYMENT SUMMARY
212
- - Total Impacted: 3 artifacts
213
- - Breakdown:
214
- • client_script: 3
215
103
  ```
104
+ [FLUENT-GRAPH] BLAST RADIUS REPORT
105
+ Target: x_1566039_seventh_customer
216
106
 
217
- ---
107
+ ┌────────────────────────────────┬───────────────────┬──────────────────────────────┐
108
+ │ Impacted Artifact │ Type │ Reason │
109
+ ├────────────────────────────────┼───────────────────┼──────────────────────────────┤
110
+ │ x_1566039_seventh_account │ table │ Reference field: owner │
111
+ │ x_1566039_seventh_call_case │ table │ Reference field: customer │
112
+ │ cs_account_onchange_type │ client_script │ Logic attachment │
113
+ └────────────────────────────────┴───────────────────┴──────────────────────────────┘
218
114
 
219
- ## Output Format
220
-
221
- The generated `fluent-graph.json` contains:
222
-
223
- ```json
224
- {
225
- "metadata": {
226
- "projectRoot": "/path/to/project",
227
- "scopeId": "59760b6f783848bd981362d6b1d0c7ed",
228
- "scopeName": "x_1566039_seventh",
229
- "recordCount": 171,
230
- "referenceCount": 15,
231
- "compositionCount": 111,
232
- "generatedAt": "2025-01-04T16:32:54.130Z",
233
- "sdkVersion": "4.1.0"
234
- },
235
- "nodes": [
236
- {
237
- "id": "6eed3050f8214b6194056935182d9fa5",
238
- "table": "sys_db_object",
239
- "name": "x_1566039_seventh_customer",
240
- "label": "Customer",
241
- "action": "INSERT_OR_UPDATE",
242
- "attributes": {
243
- "access": "public",
244
- "is_extendable": false,
245
- "read_access": true
246
- },
247
- "source": {
248
- "file": "src/fluent/bank_small_artifacts.now.ts",
249
- "type": "VariableStatement"
250
- }
251
- }
252
- ],
253
- "edges": [
254
- {
255
- "from": "4da5b7b689ae43e69b3db1bfe1dd0cd5",
256
- "to": "0fc60d0f1c35401580488c83440a4d81",
257
- "via": "owner",
258
- "type": "reference",
259
- "targetTable": "x_1566039_seventh_customer"
260
- }
261
- ]
262
- }
115
+ ⚠️ PRE-DEPLOYMENT SUMMARY
116
+ Total Impacted: 3 artifacts
263
117
  ```
264
118
 
265
- ### Node Types
266
-
267
- | `table` Value | Description |
268
- |---------------|-------------|
269
- | `sys_db_object` | Database table definition |
270
- | `sys_dictionary` | Column/field definition |
271
- | `sys_script_client` | Client script (onLoad, onChange, etc.) |
272
- | `sys_script` | Business rule |
273
- | `sys_choice` | Choice list value |
274
-
275
- ### Edge Types
276
-
277
- | `type` | Description |
278
- |--------|-------------|
279
- | `reference` | Foreign key or logic attachment |
280
- | `composition` | Parent-child relationship (e.g., table → columns) |
281
-
282
- ---
283
-
284
- ## How It Works
285
-
286
- `fluent-graph` does **not** parse your TypeScript/Fluent code directly.
287
-
288
- Instead, it:
289
-
290
- 1. **Locates the SDK** installed in `node_modules/@servicenow/sdk`
291
- 2. **Loads your Fluent project** using the SDK's internal `Project` API
292
- 3. **Observes SDK compilation** to extract already-parsed artifacts
293
- 4. **Builds a dependency graph** from SDK-provided metadata
294
- 5. **Outputs structured JSON** for analysis or automation
295
-
296
- This approach:
297
- - ✅ Works across SDK versions (no brittle AST parsing)
298
- - ✅ Captures runtime behavior (e.g., dynamic references)
299
- - ✅ Stays synchronized with SDK semantics
300
-
301
119
  ---
302
120
 
303
- ## Use Cases
121
+ ## CI/CD Integration
304
122
 
305
- ### 1. Pre-Deployment Impact Analysis
306
- ```bash
307
- fluent-graph blast incident > pre-deploy-report.txt
308
- ```
309
-
310
- ### 2. CI/CD Integration
311
123
  ```yaml
312
124
  # .github/workflows/fluent-check.yml
313
- - name: Extract lineage
314
- run: npx fluent-graph analyze
125
+ - name: Analyze lineage
126
+ run: npx @yesprasad/fluent-graph analyze
315
127
 
316
- - name: Check for conflicts
128
+ - name: Fail on identity conflicts
317
129
  run: |
318
130
  if grep -q '"action": "CONFLICT"' fluent-graph.json; then
319
131
  echo "❌ Identity conflicts detected"
@@ -321,111 +133,19 @@ fluent-graph blast incident > pre-deploy-report.txt
321
133
  fi
322
134
  ```
323
135
 
324
- ### 3. Documentation Generation
325
- Parse `fluent-graph.json` to auto-generate:
326
- - Schema diagrams
327
- - Dependency matrices
328
- - Change impact reports
329
-
330
136
  ---
331
137
 
332
- ## Performance
333
-
334
- Typical extraction times on SDK 4.1.x:
335
-
336
- | Project Size | Artifacts | Extraction Time |
337
- |--------------|-----------|-----------------|
338
- | Small | 50-100 | < 5 seconds |
339
- | Medium | 100-500 | 5-15 seconds |
340
- | Large | 500-1000 | 15-30 seconds |
341
- | Enterprise | 1000+ | 30-60 seconds |
342
-
343
- *Times measured on MacBook Air M1, 16GB RAM*
344
-
345
- **Note:** First run is slower (SDK initialization). Subsequent runs are faster.
346
-
347
138
  ## Limitations
348
139
 
349
- ### Current Version (v0.1)
350
-
351
- - **Schema relationships detection incomplete:** The extractor currently captures foreign key relationships declared in `sys_dictionary` records, but some Fluent DSL references (e.g., `ReferenceColumn` in Table definitions) may not appear in edges if the SDK's internal representation doesn't expose them during the observed compilation phase.
352
-
353
- - **Tested against SDK 4.1.x only:** While the architecture is designed to handle SDK evolution, version-specific parsing has only been validated with `@servicenow/sdk@4.1.0`. Newer or older versions may produce incomplete graphs.
354
-
355
- - **No UI visualization:** Output is JSON-only. Use external tools (e.g., D3.js, Mermaid) to render graphs.
356
-
357
- - **Single-project scope:** Does not analyze cross-scope dependencies (e.g., references to `global` tables outside your app scope).
358
-
359
- ---
360
-
361
- ## Roadmap
362
-
363
- - [ ] Improve FK edge extraction: Currently misses some ReferenceColumn relationships when table nodes don't exist
364
- - [ ] Add ACL/UI Policy/UI Action support to blast radius
365
- - [ ] Support SDK 4.0.x (test against 3 versions: 4.0, 4.1, 4.2)
366
- - [ ] HTML report with interactive D3.js graph visualization
367
- - [ ] `--watch` mode: Re-extract on file changes during development
368
- - [ ] Cross-scope analysis: Detect dependencies on global/platform apps
369
- - [ ] Adding unit test cases
370
-
371
- ---
372
-
373
- ## Contributing
374
-
375
- This is an early-stage tool built to solve real problems in Fluent development. Contributions are welcome, especially:
376
-
377
- ### Areas We Need Help
378
-
379
- 1. **SDK Version Testing**
380
- - Test against SDK 4.0.x, 4.2.x, 5.0.x
381
- - Document breaking changes in graph structure
382
-
383
- 2. **Edge Extraction Improvements**
384
- - Capture more FK relationships from Fluent DSL
385
- - Handle complex reference scenarios (polymorphic refs, etc.)
386
-
387
- 3. **Artifact Type Coverage**
388
- - Add support for: Workflows, Flow Designer, Notifications
389
- - Validate ACL/UI Policy detection
390
-
391
- ### Development Setup
392
- ```bash
393
- git clone https://github.com/yesprasad/fluent-graph
394
- cd fluent-graph
395
- npm install
396
- npm run build
397
-
398
- # Test against example project
399
- cd ../your-fluent-project
400
- npx /path/to/fluent-graph/dist/cli/index.js extract
401
- ```
402
-
403
- ### Running Tests
404
- ```bash
405
- npm test # Add Unit tests
406
- npm run test:integration # Test against real SDK project
407
- ```
140
+ - Tested against `@servicenow/sdk@4.5.x`
141
+ - No UI visualization — output is JSON and terminal only
142
+ - Single-project scope does not trace cross-scope dependencies
408
143
 
409
144
  ---
410
145
 
411
146
  ## License
412
- MIT License
413
-
414
- Copyright (c) 2026 Eshwar Sowbhagya Prasad Yaddanapudi.
415
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
416
-
417
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
418
-
419
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
420
147
 
421
-
422
- ---
423
-
424
- ## Author
425
-
426
- **Eshwar Sowbhagya Prasad Yaddanapudi**
427
-
428
- Built with focus on making ServiceNow Pro Developer Fluent development with now-sdk safer, faster, and more transparent.
148
+ MIT License — Copyright (c) 2026 Eshwar Sowbhagya Prasad Yaddanapudi
429
149
 
430
150
  ---
431
151
 
@@ -444,4 +164,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
444
164
 
445
165
  ---
446
166
 
447
- **Questions or issues?** Open an issue on GitHub or reach out directly.
167
+ **Questions or issues?** Open an issue on GitHub or reach out directly.
168
+
169
+ ## Author
170
+
171
+ **Eshwar Sowbhagya Prasad Yaddanapudi**
172
+
173
+ Questions or issues? [Open an issue on GitHub](https://github.com/yesprasad/fluent-graph/issues)
@@ -0,0 +1,48 @@
1
+ import type { LineageGraph, ArtifactNode, ArtifactEdge } from '../types/graphs';
2
+ export interface TraversalNode {
3
+ node: ArtifactNode;
4
+ hop: number;
5
+ /** Chain of node names from target → this node (inclusive). */
6
+ path: string[];
7
+ /** The edge that caused this node to be discovered. */
8
+ viaEdge: ArtifactEdge;
9
+ }
10
+ export interface TraversalResult {
11
+ /** The representative local graph node for the target (non-child preferred), or null if platform. */
12
+ target: ArtifactNode | null;
13
+ targetName: string;
14
+ /** All discovered nodes across all hops, sorted by hop ASC then name ASC. */
15
+ hops: TraversalNode[];
16
+ maxHopReached: number;
17
+ /** Times a visited node was skipped (cycle prevention + same-name deduplication). */
18
+ cyclesPrevented: number;
19
+ }
20
+ /**
21
+ * BFS reverse-traversal over the dependency graph.
22
+ *
23
+ * KEY DESIGN DECISIONS:
24
+ *
25
+ * 1. A logical "entity" is identified by node NAME, not by node ID.
26
+ * Multiple physical nodes can share a name (e.g., a table and all its
27
+ * field/documentation records are all named "x_my_table"). The BFS
28
+ * treats them as one logical node — once any physical node for a name
29
+ * is discovered, ALL siblings for that name are immediately marked
30
+ * visited so they never appear again.
31
+ *
32
+ * 2. The initial target is seeded with ALL physical nodes sharing the
33
+ * target name (plus the synthetic "platform:tableName" ID). This
34
+ * ensures incoming edges are found regardless of which physical node
35
+ * the edge was recorded against.
36
+ *
37
+ * 3. Edge matching uses BOTH:
38
+ * - edge.to === currentNodeId (exact physical node)
39
+ * - edge.targetTable === currentNodeName (canonical name — reliable
40
+ * for platform nodes and catches mis-targeted edges)
41
+ *
42
+ * 4. ALL edge types are traversed. Display filtering is the caller's job.
43
+ *
44
+ * @param graph The loaded LineageGraph.
45
+ * @param targetTableName The table name the user asked about.
46
+ * @param maxDepth Maximum hop depth. Silently clamped to 25.
47
+ */
48
+ export declare function traverseBlastRadius(graph: LineageGraph, targetTableName: string, maxDepth: number): TraversalResult;