@grafema/types 0.1.0-alpha.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 +190 -0
- package/README.md +39 -0
- package/dist/edges.d.ts +77 -0
- package/dist/edges.d.ts.map +1 -0
- package/dist/edges.js +56 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/nodes.d.ts +162 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +84 -0
- package/dist/plugins.d.ts +131 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +30 -0
- package/dist/rfdb.d.ts +183 -0
- package/dist/rfdb.d.ts.map +1 -0
- package/dist/rfdb.js +4 -0
- package/package.json +38 -0
- package/src/edges.ts +111 -0
- package/src/index.ts +15 -0
- package/src/nodes.ts +269 -0
- package/src/plugins.ts +187 -0
- package/src/rfdb.ts +279 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Vadim Reshetnikov
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @grafema/types
|
|
2
|
+
|
|
3
|
+
> Type definitions for Grafema code analysis toolkit
|
|
4
|
+
|
|
5
|
+
**Warning: This package is in early alpha stage and is not recommended for production use.**
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @grafema/types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
This package provides TypeScript type definitions used across the Grafema ecosystem:
|
|
16
|
+
|
|
17
|
+
- **Node types** - Graph node definitions (functions, classes, variables, etc.)
|
|
18
|
+
- **Edge types** - Relationship definitions (calls, imports, assignments, etc.)
|
|
19
|
+
- **Plugin types** - Plugin system interfaces
|
|
20
|
+
- **RFDB types** - Wire protocol types for RFDB graph database
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import type { NodeType, EdgeType, WireNode, WireEdge } from '@grafema/types';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Exports
|
|
29
|
+
|
|
30
|
+
| Module | Description |
|
|
31
|
+
|--------|-------------|
|
|
32
|
+
| `nodes` | Node type definitions |
|
|
33
|
+
| `edges` | Edge type definitions |
|
|
34
|
+
| `plugins` | Plugin interface types |
|
|
35
|
+
| `rfdb` | RFDB protocol types |
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
Apache-2.0
|
package/dist/edges.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge Types - graph edge type definitions
|
|
3
|
+
*/
|
|
4
|
+
export declare const EDGE_TYPE: {
|
|
5
|
+
readonly CONTAINS: "CONTAINS";
|
|
6
|
+
readonly DEPENDS_ON: "DEPENDS_ON";
|
|
7
|
+
readonly HAS_SCOPE: "HAS_SCOPE";
|
|
8
|
+
readonly CALLS: "CALLS";
|
|
9
|
+
readonly HAS_CALLBACK: "HAS_CALLBACK";
|
|
10
|
+
readonly PASSES_ARGUMENT: "PASSES_ARGUMENT";
|
|
11
|
+
readonly RECEIVES_ARGUMENT: "RECEIVES_ARGUMENT";
|
|
12
|
+
readonly RETURNS: "RETURNS";
|
|
13
|
+
readonly EXTENDS: "EXTENDS";
|
|
14
|
+
readonly IMPLEMENTS: "IMPLEMENTS";
|
|
15
|
+
readonly INSTANCE_OF: "INSTANCE_OF";
|
|
16
|
+
readonly IMPORTS: "IMPORTS";
|
|
17
|
+
readonly EXPORTS: "EXPORTS";
|
|
18
|
+
readonly IMPORTS_FROM: "IMPORTS_FROM";
|
|
19
|
+
readonly EXPORTS_TO: "EXPORTS_TO";
|
|
20
|
+
readonly DEFINES: "DEFINES";
|
|
21
|
+
readonly USES: "USES";
|
|
22
|
+
readonly DECLARES: "DECLARES";
|
|
23
|
+
readonly MODIFIES: "MODIFIES";
|
|
24
|
+
readonly CAPTURES: "CAPTURES";
|
|
25
|
+
readonly ASSIGNED_FROM: "ASSIGNED_FROM";
|
|
26
|
+
readonly READS_FROM: "READS_FROM";
|
|
27
|
+
readonly WRITES_TO: "WRITES_TO";
|
|
28
|
+
readonly ROUTES_TO: "ROUTES_TO";
|
|
29
|
+
readonly HANDLED_BY: "HANDLED_BY";
|
|
30
|
+
readonly MAKES_REQUEST: "MAKES_REQUEST";
|
|
31
|
+
readonly MOUNTS: "MOUNTS";
|
|
32
|
+
readonly EXPOSES: "EXPOSES";
|
|
33
|
+
readonly LISTENS_TO: "LISTENS_TO";
|
|
34
|
+
readonly EMITS_EVENT: "EMITS_EVENT";
|
|
35
|
+
readonly JOINS_ROOM: "JOINS_ROOM";
|
|
36
|
+
readonly CALLS_API: "CALLS_API";
|
|
37
|
+
readonly INTERACTS_WITH: "INTERACTS_WITH";
|
|
38
|
+
readonly REGISTERS_VIEW: "REGISTERS_VIEW";
|
|
39
|
+
readonly THROWS: "THROWS";
|
|
40
|
+
readonly GOVERNS: "GOVERNS";
|
|
41
|
+
readonly VIOLATES: "VIOLATES";
|
|
42
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
43
|
+
};
|
|
44
|
+
export type EdgeType = typeof EDGE_TYPE[keyof typeof EDGE_TYPE] | string;
|
|
45
|
+
export interface EdgeRecord {
|
|
46
|
+
src: string;
|
|
47
|
+
dst: string;
|
|
48
|
+
type: EdgeType;
|
|
49
|
+
index?: number;
|
|
50
|
+
metadata?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
export interface ContainsEdge extends EdgeRecord {
|
|
53
|
+
type: 'CONTAINS';
|
|
54
|
+
}
|
|
55
|
+
export interface CallsEdge extends EdgeRecord {
|
|
56
|
+
type: 'CALLS';
|
|
57
|
+
argumentCount?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface ImportsEdge extends EdgeRecord {
|
|
60
|
+
type: 'IMPORTS';
|
|
61
|
+
specifier?: string;
|
|
62
|
+
isDefault?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface ExportsEdge extends EdgeRecord {
|
|
65
|
+
type: 'EXPORTS';
|
|
66
|
+
exportedName?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface DataFlowEdge extends EdgeRecord {
|
|
69
|
+
type: 'ASSIGNED_FROM' | 'READS_FROM' | 'WRITES_TO' | 'PASSES_ARGUMENT';
|
|
70
|
+
dataType?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface RouteEdge extends EdgeRecord {
|
|
73
|
+
type: 'ROUTES_TO' | 'HANDLED_BY';
|
|
74
|
+
method?: string;
|
|
75
|
+
path?: string;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../src/edges.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,GAAG,MAAM,CAAC;AAGzE,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAGD,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,IAAI,EAAE,eAAe,GAAG,YAAY,GAAG,WAAW,GAAG,iBAAiB,CAAC;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
package/dist/edges.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge Types - graph edge type definitions
|
|
3
|
+
*/
|
|
4
|
+
// === EDGE TYPES ===
|
|
5
|
+
export const EDGE_TYPE = {
|
|
6
|
+
// Structure
|
|
7
|
+
CONTAINS: 'CONTAINS',
|
|
8
|
+
DEPENDS_ON: 'DEPENDS_ON',
|
|
9
|
+
HAS_SCOPE: 'HAS_SCOPE',
|
|
10
|
+
// Calls
|
|
11
|
+
CALLS: 'CALLS',
|
|
12
|
+
HAS_CALLBACK: 'HAS_CALLBACK',
|
|
13
|
+
PASSES_ARGUMENT: 'PASSES_ARGUMENT',
|
|
14
|
+
RECEIVES_ARGUMENT: 'RECEIVES_ARGUMENT',
|
|
15
|
+
RETURNS: 'RETURNS',
|
|
16
|
+
// Inheritance
|
|
17
|
+
EXTENDS: 'EXTENDS',
|
|
18
|
+
IMPLEMENTS: 'IMPLEMENTS',
|
|
19
|
+
INSTANCE_OF: 'INSTANCE_OF',
|
|
20
|
+
// Imports/Exports
|
|
21
|
+
IMPORTS: 'IMPORTS',
|
|
22
|
+
EXPORTS: 'EXPORTS',
|
|
23
|
+
IMPORTS_FROM: 'IMPORTS_FROM',
|
|
24
|
+
EXPORTS_TO: 'EXPORTS_TO',
|
|
25
|
+
// Variables/Data flow
|
|
26
|
+
DEFINES: 'DEFINES',
|
|
27
|
+
USES: 'USES',
|
|
28
|
+
DECLARES: 'DECLARES',
|
|
29
|
+
MODIFIES: 'MODIFIES',
|
|
30
|
+
CAPTURES: 'CAPTURES',
|
|
31
|
+
ASSIGNED_FROM: 'ASSIGNED_FROM',
|
|
32
|
+
READS_FROM: 'READS_FROM',
|
|
33
|
+
WRITES_TO: 'WRITES_TO',
|
|
34
|
+
// HTTP/Routing
|
|
35
|
+
ROUTES_TO: 'ROUTES_TO',
|
|
36
|
+
HANDLED_BY: 'HANDLED_BY',
|
|
37
|
+
MAKES_REQUEST: 'MAKES_REQUEST',
|
|
38
|
+
MOUNTS: 'MOUNTS',
|
|
39
|
+
EXPOSES: 'EXPOSES',
|
|
40
|
+
// Events/Sockets
|
|
41
|
+
LISTENS_TO: 'LISTENS_TO',
|
|
42
|
+
EMITS_EVENT: 'EMITS_EVENT',
|
|
43
|
+
JOINS_ROOM: 'JOINS_ROOM',
|
|
44
|
+
// External
|
|
45
|
+
CALLS_API: 'CALLS_API',
|
|
46
|
+
INTERACTS_WITH: 'INTERACTS_WITH',
|
|
47
|
+
// Views
|
|
48
|
+
REGISTERS_VIEW: 'REGISTERS_VIEW',
|
|
49
|
+
// Errors
|
|
50
|
+
THROWS: 'THROWS',
|
|
51
|
+
// Guarantees/Invariants
|
|
52
|
+
GOVERNS: 'GOVERNS',
|
|
53
|
+
VIOLATES: 'VIOLATES',
|
|
54
|
+
// Unknown/fallback
|
|
55
|
+
UNKNOWN: 'UNKNOWN',
|
|
56
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @grafema/types - Type definitions for GraphDD code analysis toolkit
|
|
3
|
+
*/
|
|
4
|
+
// Node types
|
|
5
|
+
export * from './nodes.js';
|
|
6
|
+
// Edge types
|
|
7
|
+
export * from './edges.js';
|
|
8
|
+
// Plugin types
|
|
9
|
+
export * from './plugins.js';
|
|
10
|
+
// RFDB protocol types
|
|
11
|
+
export * from './rfdb.js';
|
package/dist/nodes.d.ts
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Types - graph node type definitions
|
|
3
|
+
*/
|
|
4
|
+
export declare const NODE_TYPE: {
|
|
5
|
+
readonly FUNCTION: "FUNCTION";
|
|
6
|
+
readonly CLASS: "CLASS";
|
|
7
|
+
readonly METHOD: "METHOD";
|
|
8
|
+
readonly VARIABLE: "VARIABLE";
|
|
9
|
+
readonly PARAMETER: "PARAMETER";
|
|
10
|
+
readonly CONSTANT: "CONSTANT";
|
|
11
|
+
readonly LITERAL: "LITERAL";
|
|
12
|
+
readonly EXPRESSION: "EXPRESSION";
|
|
13
|
+
readonly MODULE: "MODULE";
|
|
14
|
+
readonly IMPORT: "IMPORT";
|
|
15
|
+
readonly EXPORT: "EXPORT";
|
|
16
|
+
readonly CALL: "CALL";
|
|
17
|
+
readonly PROJECT: "PROJECT";
|
|
18
|
+
readonly SERVICE: "SERVICE";
|
|
19
|
+
readonly FILE: "FILE";
|
|
20
|
+
readonly SCOPE: "SCOPE";
|
|
21
|
+
readonly EXTERNAL: "EXTERNAL";
|
|
22
|
+
readonly EXTERNAL_MODULE: "EXTERNAL_MODULE";
|
|
23
|
+
readonly SIDE_EFFECT: "SIDE_EFFECT";
|
|
24
|
+
};
|
|
25
|
+
export type BaseNodeType = typeof NODE_TYPE[keyof typeof NODE_TYPE];
|
|
26
|
+
export declare const NAMESPACED_TYPE: {
|
|
27
|
+
readonly HTTP_ROUTE: "http:route";
|
|
28
|
+
readonly HTTP_REQUEST: "http:request";
|
|
29
|
+
readonly EXPRESS_ROUTER: "express:router";
|
|
30
|
+
readonly EXPRESS_MIDDLEWARE: "express:middleware";
|
|
31
|
+
readonly EXPRESS_MOUNT: "express:mount";
|
|
32
|
+
readonly SOCKETIO_EMIT: "socketio:emit";
|
|
33
|
+
readonly SOCKETIO_ON: "socketio:on";
|
|
34
|
+
readonly SOCKETIO_NAMESPACE: "socketio:namespace";
|
|
35
|
+
readonly DB_QUERY: "db:query";
|
|
36
|
+
readonly DB_CONNECTION: "db:connection";
|
|
37
|
+
readonly FS_READ: "fs:read";
|
|
38
|
+
readonly FS_WRITE: "fs:write";
|
|
39
|
+
readonly FS_OPERATION: "fs:operation";
|
|
40
|
+
readonly NET_REQUEST: "net:request";
|
|
41
|
+
readonly NET_STDIO: "net:stdio";
|
|
42
|
+
readonly EVENT_LISTENER: "event:listener";
|
|
43
|
+
readonly EVENT_EMIT: "event:emit";
|
|
44
|
+
};
|
|
45
|
+
export type NamespacedNodeType = typeof NAMESPACED_TYPE[keyof typeof NAMESPACED_TYPE];
|
|
46
|
+
export type NodeType = BaseNodeType | NamespacedNodeType | string;
|
|
47
|
+
export interface BaseNodeRecord {
|
|
48
|
+
id: string;
|
|
49
|
+
stableId?: string;
|
|
50
|
+
type: NodeType;
|
|
51
|
+
name: string;
|
|
52
|
+
file: string;
|
|
53
|
+
line?: number;
|
|
54
|
+
column?: number;
|
|
55
|
+
metadata?: Record<string, unknown>;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
export interface FunctionNodeRecord extends BaseNodeRecord {
|
|
59
|
+
type: 'FUNCTION';
|
|
60
|
+
async: boolean;
|
|
61
|
+
generator: boolean;
|
|
62
|
+
exported: boolean;
|
|
63
|
+
arrowFunction: boolean;
|
|
64
|
+
parentScopeId?: string;
|
|
65
|
+
isClassMethod?: boolean;
|
|
66
|
+
className?: string;
|
|
67
|
+
params?: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface ClassNodeRecord extends BaseNodeRecord {
|
|
70
|
+
type: 'CLASS';
|
|
71
|
+
exported: boolean;
|
|
72
|
+
superClass?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface MethodNodeRecord extends BaseNodeRecord {
|
|
75
|
+
type: 'METHOD';
|
|
76
|
+
className: string;
|
|
77
|
+
async: boolean;
|
|
78
|
+
static: boolean;
|
|
79
|
+
kind: 'method' | 'get' | 'set' | 'constructor';
|
|
80
|
+
}
|
|
81
|
+
export interface ModuleNodeRecord extends BaseNodeRecord {
|
|
82
|
+
type: 'MODULE';
|
|
83
|
+
relativePath: string;
|
|
84
|
+
contentHash: string;
|
|
85
|
+
language?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ImportNodeRecord extends BaseNodeRecord {
|
|
88
|
+
type: 'IMPORT';
|
|
89
|
+
source: string;
|
|
90
|
+
specifiers: ImportSpecifier[];
|
|
91
|
+
isDefault?: boolean;
|
|
92
|
+
isNamespace?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface ImportSpecifier {
|
|
95
|
+
local: string;
|
|
96
|
+
imported?: string;
|
|
97
|
+
type: 'default' | 'named' | 'namespace';
|
|
98
|
+
}
|
|
99
|
+
export interface ExportNodeRecord extends BaseNodeRecord {
|
|
100
|
+
type: 'EXPORT';
|
|
101
|
+
exportedName: string;
|
|
102
|
+
localName?: string;
|
|
103
|
+
isDefault?: boolean;
|
|
104
|
+
source?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface VariableNodeRecord extends BaseNodeRecord {
|
|
107
|
+
type: 'VARIABLE';
|
|
108
|
+
kind: 'var' | 'let' | 'const';
|
|
109
|
+
exported: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface CallNodeRecord extends BaseNodeRecord {
|
|
112
|
+
type: 'CALL';
|
|
113
|
+
callee: string;
|
|
114
|
+
arguments?: number;
|
|
115
|
+
isMethodCall?: boolean;
|
|
116
|
+
objectName?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface ServiceNodeRecord extends BaseNodeRecord {
|
|
119
|
+
type: 'SERVICE';
|
|
120
|
+
projectPath: string;
|
|
121
|
+
}
|
|
122
|
+
export interface ScopeNodeRecord extends BaseNodeRecord {
|
|
123
|
+
type: 'SCOPE';
|
|
124
|
+
scopeType: 'function' | 'block' | 'class' | 'module' | 'global';
|
|
125
|
+
parentScopeId?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface HttpRouteNodeRecord extends BaseNodeRecord {
|
|
128
|
+
type: 'http:route';
|
|
129
|
+
method: string;
|
|
130
|
+
path: string;
|
|
131
|
+
handler?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface DbQueryNodeRecord extends BaseNodeRecord {
|
|
134
|
+
type: 'db:query';
|
|
135
|
+
query: string;
|
|
136
|
+
operation: 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE' | 'UNKNOWN';
|
|
137
|
+
}
|
|
138
|
+
export interface EventListenerNodeRecord extends BaseNodeRecord {
|
|
139
|
+
type: 'event:listener';
|
|
140
|
+
eventName: string;
|
|
141
|
+
objectName: string;
|
|
142
|
+
}
|
|
143
|
+
export type GuaranteePriority = 'critical' | 'important' | 'observed' | 'tracked';
|
|
144
|
+
export type GuaranteeStatus = 'discovered' | 'reviewed' | 'active' | 'changing' | 'deprecated';
|
|
145
|
+
export interface GuaranteeNodeRecord extends BaseNodeRecord {
|
|
146
|
+
type: 'guarantee:queue' | 'guarantee:api' | 'guarantee:permission';
|
|
147
|
+
priority: GuaranteePriority;
|
|
148
|
+
status: GuaranteeStatus;
|
|
149
|
+
owner?: string;
|
|
150
|
+
schema?: Record<string, unknown>;
|
|
151
|
+
condition?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
createdAt?: number;
|
|
154
|
+
updatedAt?: number;
|
|
155
|
+
}
|
|
156
|
+
export type NodeRecord = FunctionNodeRecord | ClassNodeRecord | MethodNodeRecord | ModuleNodeRecord | ImportNodeRecord | ExportNodeRecord | VariableNodeRecord | CallNodeRecord | ServiceNodeRecord | ScopeNodeRecord | HttpRouteNodeRecord | DbQueryNodeRecord | EventListenerNodeRecord | GuaranteeNodeRecord | BaseNodeRecord;
|
|
157
|
+
export declare function isNamespacedType(nodeType: string): boolean;
|
|
158
|
+
export declare function getNamespace(nodeType: string): string | null;
|
|
159
|
+
export declare function getBaseName(nodeType: string): string;
|
|
160
|
+
export declare function isEndpointType(nodeType: string): boolean;
|
|
161
|
+
export declare function isSideEffectType(nodeType: string): boolean;
|
|
162
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CA+BZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAGpE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CA+BlB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGtF,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,kBAAkB,GAAG,MAAM,CAAC;AAIlE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,IAAI,EAAE,UAAU,CAAC;IACjB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,MAAM,GAAG,OAAO,CAI1D"}
|
package/dist/nodes.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node Types - graph node type definitions
|
|
3
|
+
*/
|
|
4
|
+
// === BASE NODE TYPES ===
|
|
5
|
+
export const NODE_TYPE = {
|
|
6
|
+
// Core code entities
|
|
7
|
+
FUNCTION: 'FUNCTION',
|
|
8
|
+
CLASS: 'CLASS',
|
|
9
|
+
METHOD: 'METHOD',
|
|
10
|
+
VARIABLE: 'VARIABLE',
|
|
11
|
+
PARAMETER: 'PARAMETER',
|
|
12
|
+
CONSTANT: 'CONSTANT',
|
|
13
|
+
LITERAL: 'LITERAL',
|
|
14
|
+
EXPRESSION: 'EXPRESSION',
|
|
15
|
+
// Module system
|
|
16
|
+
MODULE: 'MODULE',
|
|
17
|
+
IMPORT: 'IMPORT',
|
|
18
|
+
EXPORT: 'EXPORT',
|
|
19
|
+
// Call graph
|
|
20
|
+
CALL: 'CALL',
|
|
21
|
+
// Project structure
|
|
22
|
+
PROJECT: 'PROJECT',
|
|
23
|
+
SERVICE: 'SERVICE',
|
|
24
|
+
FILE: 'FILE',
|
|
25
|
+
SCOPE: 'SCOPE',
|
|
26
|
+
// External dependencies
|
|
27
|
+
EXTERNAL: 'EXTERNAL',
|
|
28
|
+
EXTERNAL_MODULE: 'EXTERNAL_MODULE',
|
|
29
|
+
// Generic side effects
|
|
30
|
+
SIDE_EFFECT: 'SIDE_EFFECT',
|
|
31
|
+
};
|
|
32
|
+
// === NAMESPACED NODE TYPES ===
|
|
33
|
+
export const NAMESPACED_TYPE = {
|
|
34
|
+
// HTTP (generic)
|
|
35
|
+
HTTP_ROUTE: 'http:route',
|
|
36
|
+
HTTP_REQUEST: 'http:request',
|
|
37
|
+
// Express.js
|
|
38
|
+
EXPRESS_ROUTER: 'express:router',
|
|
39
|
+
EXPRESS_MIDDLEWARE: 'express:middleware',
|
|
40
|
+
EXPRESS_MOUNT: 'express:mount',
|
|
41
|
+
// Socket.IO
|
|
42
|
+
SOCKETIO_EMIT: 'socketio:emit',
|
|
43
|
+
SOCKETIO_ON: 'socketio:on',
|
|
44
|
+
SOCKETIO_NAMESPACE: 'socketio:namespace',
|
|
45
|
+
// Database
|
|
46
|
+
DB_QUERY: 'db:query',
|
|
47
|
+
DB_CONNECTION: 'db:connection',
|
|
48
|
+
// Filesystem
|
|
49
|
+
FS_READ: 'fs:read',
|
|
50
|
+
FS_WRITE: 'fs:write',
|
|
51
|
+
FS_OPERATION: 'fs:operation',
|
|
52
|
+
// Network
|
|
53
|
+
NET_REQUEST: 'net:request',
|
|
54
|
+
NET_STDIO: 'net:stdio',
|
|
55
|
+
// Events
|
|
56
|
+
EVENT_LISTENER: 'event:listener',
|
|
57
|
+
EVENT_EMIT: 'event:emit',
|
|
58
|
+
};
|
|
59
|
+
// === HELPER FUNCTIONS ===
|
|
60
|
+
export function isNamespacedType(nodeType) {
|
|
61
|
+
return nodeType?.includes(':') ?? false;
|
|
62
|
+
}
|
|
63
|
+
export function getNamespace(nodeType) {
|
|
64
|
+
if (!nodeType?.includes(':'))
|
|
65
|
+
return null;
|
|
66
|
+
return nodeType.split(':')[0];
|
|
67
|
+
}
|
|
68
|
+
export function getBaseName(nodeType) {
|
|
69
|
+
if (!nodeType)
|
|
70
|
+
return '';
|
|
71
|
+
if (!nodeType.includes(':'))
|
|
72
|
+
return nodeType;
|
|
73
|
+
return nodeType.split(':').slice(1).join(':');
|
|
74
|
+
}
|
|
75
|
+
export function isEndpointType(nodeType) {
|
|
76
|
+
const ns = getNamespace(nodeType);
|
|
77
|
+
return ns === 'http' || ns === 'express' || ns === 'socketio';
|
|
78
|
+
}
|
|
79
|
+
export function isSideEffectType(nodeType) {
|
|
80
|
+
if (nodeType === NODE_TYPE.SIDE_EFFECT)
|
|
81
|
+
return true;
|
|
82
|
+
const ns = getNamespace(nodeType);
|
|
83
|
+
return ns === 'db' || ns === 'fs' || ns === 'net';
|
|
84
|
+
}
|