@yesprasad/fluent-graph 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.
- package/LICENSE +36 -0
- package/README.md +447 -0
- package/bin/fluent-graph.js +9 -0
- package/dist/cli/commands/blast.d.ts +2 -0
- package/dist/cli/commands/blast.js +202 -0
- package/dist/cli/commands/extract.d.ts +6 -0
- package/dist/cli/commands/extract.js +178 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +61 -0
- package/dist/cli/utils/banner.d.ts +2 -0
- package/dist/cli/utils/banner.js +25 -0
- package/dist/cli/utils/display.d.ts +2 -0
- package/dist/cli/utils/display.js +172 -0
- package/dist/extractor/edges.d.ts +11 -0
- package/dist/extractor/edges.js +120 -0
- package/dist/extractor/index.d.ts +2 -0
- package/dist/extractor/index.js +24 -0
- package/dist/extractor/metadata.d.ts +6 -0
- package/dist/extractor/metadata.js +37 -0
- package/dist/extractor/nodes.d.ts +2 -0
- package/dist/extractor/nodes.js +64 -0
- package/dist/graph/extractor.d.ts +6 -0
- package/dist/graph/extractor.js +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/output/writer.d.ts +9 -0
- package/dist/output/writer.js +28 -0
- package/dist/sdk/detector.d.ts +6 -0
- package/dist/sdk/detector.js +32 -0
- package/dist/sdk/loader.d.ts +5 -0
- package/dist/sdk/loader.js +15 -0
- package/dist/types/graphs.d.ts +35 -0
- package/dist/types/graphs.js +2 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
## License
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2026 Eshwar Sowbhagya Prasad Yaddanapudi.
|
|
6
|
+
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:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Author
|
|
16
|
+
|
|
17
|
+
**Eshwar Sowbhagya Prasad Yaddanapudi**
|
|
18
|
+
|
|
19
|
+
Built with focus on making ServiceNow Pro Developer Fluent development with now-sdk safer, faster, and more transparent.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Acknowledgments
|
|
24
|
+
|
|
25
|
+
ServiceNow SDK team for building the Fluent DSL compiler
|
|
26
|
+
MIT License
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2024 ServiceNow Inc.
|
|
29
|
+
|
|
30
|
+
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:
|
|
31
|
+
|
|
32
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
---
|
package/README.md
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
# fluent-graph
|
|
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.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
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
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
**Prerequisites:**
|
|
21
|
+
- Node.js 18+
|
|
22
|
+
- An existing ServiceNow Fluent SDK project with `@servicenow/sdk` installed
|
|
23
|
+
|
|
24
|
+
**Install globally:**
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g @yesprasad/fluent-graph
|
|
27
|
+
```
|
|
28
|
+
**basic CLI usage:**
|
|
29
|
+
```bash
|
|
30
|
+
fluent-graph analyze
|
|
31
|
+
fluent-graph blast <table_name or artifact_name>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Or use directly with npx (no installation needed):**
|
|
35
|
+
```bash
|
|
36
|
+
cd your-fluent-project
|
|
37
|
+
npx fluent-graph extract
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Verify installation:**
|
|
41
|
+
```bash
|
|
42
|
+
fluent-graph --version
|
|
43
|
+
```
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
**Output:**
|
|
50
|
+
```
|
|
51
|
+
✔ ✅ SDK detected at /node_modules/@servicenow/sdk
|
|
52
|
+
✔ Workspace SDK loaded
|
|
53
|
+
✔ Project loaded
|
|
54
|
+
✔ Graph built: 181 nodes, 141 edges
|
|
55
|
+
|
|
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
|
|
104
|
+
✔ Workspace SDK loaded
|
|
105
|
+
✔ Project loaded
|
|
106
|
+
✔ Graph built: 181 nodes, 141 edges
|
|
107
|
+
|
|
108
|
+
📊 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
|
+
|
|
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
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Generated file:** `fluent-graph.json` (in project root)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Blast Radius Analysis
|
|
189
|
+
|
|
190
|
+
Analyze the impact of changing a specific table:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
fluent-graph blast incident
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Output:**
|
|
197
|
+
```
|
|
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
|
+
|
|
211
|
+
⚠️ PRE-DEPLOYMENT SUMMARY
|
|
212
|
+
- Total Impacted: 3 artifacts
|
|
213
|
+
- Breakdown:
|
|
214
|
+
• client_script: 3
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
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
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
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
|
+
---
|
|
302
|
+
|
|
303
|
+
## Use Cases
|
|
304
|
+
|
|
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
|
+
```yaml
|
|
312
|
+
# .github/workflows/fluent-check.yml
|
|
313
|
+
- name: Extract lineage
|
|
314
|
+
run: npx fluent-graph analyze
|
|
315
|
+
|
|
316
|
+
- name: Check for conflicts
|
|
317
|
+
run: |
|
|
318
|
+
if grep -q '"action": "CONFLICT"' fluent-graph.json; then
|
|
319
|
+
echo "❌ Identity conflicts detected"
|
|
320
|
+
exit 1
|
|
321
|
+
fi
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### 3. Documentation Generation
|
|
325
|
+
Parse `fluent-graph.json` to auto-generate:
|
|
326
|
+
- Schema diagrams
|
|
327
|
+
- Dependency matrices
|
|
328
|
+
- Change impact reports
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
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
|
+
## Limitations
|
|
348
|
+
|
|
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
|
+
```
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## 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
|
+
|
|
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.
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## Acknowledgments
|
|
433
|
+
|
|
434
|
+
ServiceNow SDK team for building the Fluent DSL compiler
|
|
435
|
+
MIT License
|
|
436
|
+
|
|
437
|
+
Copyright (c) 2024 ServiceNow Inc.
|
|
438
|
+
|
|
439
|
+
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:
|
|
440
|
+
|
|
441
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
442
|
+
|
|
443
|
+
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.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
**Questions or issues?** Open an issue on GitHub or reach out directly.
|