@siglo/ide-analysis 0.0.0-stage → 1.0.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 +22 -0
- package/README.md +45 -2
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +125 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/mapper.d.ts +12 -0
- package/dist/mapper.d.ts.map +1 -0
- package/dist/mapper.js +72 -0
- package/dist/mapper.js.map +1 -0
- package/dist/parser.d.ts +14 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +164 -0
- package/dist/parser.js.map +1 -0
- package/dist/patterns/step-detector.d.ts +23 -0
- package/dist/patterns/step-detector.d.ts.map +1 -0
- package/dist/patterns/step-detector.js +331 -0
- package/dist/patterns/step-detector.js.map +1 -0
- package/dist/patterns/workflow-detector.d.ts +5 -0
- package/dist/patterns/workflow-detector.d.ts.map +1 -0
- package/dist/patterns/workflow-detector.js +697 -0
- package/dist/patterns/workflow-detector.js.map +1 -0
- package/package.json +51 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Jerico de guzman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
# Temporary Holding Version
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
## Static step coverage
|
|
3
|
+
|
|
4
|
+
The package scan covers the step-producing exports in `core`, `http`, `ai`,
|
|
5
|
+
`notifications`, and `crypto`:
|
|
6
|
+
|
|
7
|
+
| Package | Supported forms |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| core | `Step.create`, `new Step`, compatibility `Func`/`Chain` constructors and `.create`, inline actions |
|
|
10
|
+
| core composition | `flow`, `pipe`, `Step.flow`, `Step.pipe`, nested flows, sequential arrays |
|
|
11
|
+
| core combinators | `parallel`, `all`, `allSettled`, `race`, `branch`, `when`, `map`, including corresponding `Step`/`Func`/`Chain` static helpers |
|
|
12
|
+
| core durable | `wait`, `waitForEvent`, including static helpers |
|
|
13
|
+
| http | `httpStep`, `new HttpStep` |
|
|
14
|
+
| ai | `aiStep`, `new AiStep` |
|
|
15
|
+
| notifications | `sendNotificationStep`, `sendInteractiveApprovalStep` |
|
|
16
|
+
| crypto | `verifyWebhookStep`, `encryptFieldsStep`, `decryptFieldsStep`, `maskFieldsStep`, and their exported constructors |
|
|
17
|
+
|
|
18
|
+
The inspector receives static operational properties, including HTTP retries,
|
|
19
|
+
map concurrency, parallel mode/merge strategy, wait duration/event timeout, and
|
|
20
|
+
crypto field paths. Fluent timeout, compensation, cache, validation, hooks,
|
|
21
|
+
network policy, and idempotency configuration is recognized. Source expressions
|
|
22
|
+
are displayed without execution. Runtime collections are represented by a map
|
|
23
|
+
body rather than expanded into an invented number of items.
|
|
24
|
+
|
|
25
|
+
Queue consumers, web framework integrations, scheduler dispatchers, storage
|
|
26
|
+
adapters, monitoring, and testing helpers are integrations, not additional graph
|
|
27
|
+
step factories.
|
|
28
|
+
|
|
29
|
+
The parser remains syntax-based: arbitrary factory execution, imported step
|
|
30
|
+
implementations, renamed imports, dynamic branch maps, and runtime configuration
|
|
31
|
+
values are not resolved. Standalone assignment statements that mutate a step
|
|
32
|
+
are not folded into its declaration configuration.
|
|
33
|
+
|
|
34
|
+
### Workflow properties
|
|
35
|
+
|
|
36
|
+
Workflow summaries and the active graph document carry declared flow properties
|
|
37
|
+
for `.timeout(...)`, `.version(...)`, `.networkPolicy(...)`, and `.monitor(...)`.
|
|
38
|
+
Chained configuration and separate calls on known local flow variables are
|
|
39
|
+
recognized in source order. Step configuration stays separate, and composed
|
|
40
|
+
flows do not inherit a nested flow's declared execution defaults. Runtime
|
|
41
|
+
`.run(...)`/`.execute(...)` options are not reported as declared defaults.
|
|
42
|
+
|
|
43
|
+
Click a workflow label in the canvas to inspect its deadline, schema version,
|
|
44
|
+
network perimeter, monitor, and graph nodes. Dynamic settings remain source
|
|
45
|
+
expressions. The header's `r` value is a source document revision; schema
|
|
46
|
+
versions appear in workflow badges and the workflow inspector.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const readline_1 = __importDefault(require("readline"));
|
|
8
|
+
const ide_protocol_1 = require("@siglo/ide-protocol");
|
|
9
|
+
const parser_1 = require("./parser");
|
|
10
|
+
const SERVER_VERSION = '1.0.0';
|
|
11
|
+
const PROTOCOL_VERSION = '1.0.0';
|
|
12
|
+
const SUPPORTED_SYNTAX_MATRIX = [
|
|
13
|
+
'flow',
|
|
14
|
+
'workflow',
|
|
15
|
+
'pipe',
|
|
16
|
+
'Step.create',
|
|
17
|
+
'new Step',
|
|
18
|
+
'defineStep',
|
|
19
|
+
'Func.create',
|
|
20
|
+
'new Func',
|
|
21
|
+
'Chain.create',
|
|
22
|
+
'new Chain',
|
|
23
|
+
'then',
|
|
24
|
+
'parallel',
|
|
25
|
+
'all',
|
|
26
|
+
'allSettled',
|
|
27
|
+
'race',
|
|
28
|
+
'branch',
|
|
29
|
+
'when',
|
|
30
|
+
'map',
|
|
31
|
+
'fallback',
|
|
32
|
+
'compensate',
|
|
33
|
+
'wait',
|
|
34
|
+
'waitForEvent',
|
|
35
|
+
'httpStep',
|
|
36
|
+
'new HttpStep',
|
|
37
|
+
'verifyWebhookStep',
|
|
38
|
+
'sendNotificationStep',
|
|
39
|
+
'sendInteractiveApprovalStep',
|
|
40
|
+
'aiStep',
|
|
41
|
+
'new AiStep',
|
|
42
|
+
'encryptFieldsStep',
|
|
43
|
+
'decryptFieldsStep',
|
|
44
|
+
'maskFieldsStep',
|
|
45
|
+
];
|
|
46
|
+
const rl = readline_1.default.createInterface({
|
|
47
|
+
input: process.stdin,
|
|
48
|
+
output: process.stdout,
|
|
49
|
+
terminal: false,
|
|
50
|
+
});
|
|
51
|
+
rl.on('line', (line) => {
|
|
52
|
+
const trimmed = line.trim();
|
|
53
|
+
if (!trimmed)
|
|
54
|
+
return;
|
|
55
|
+
try {
|
|
56
|
+
const message = JSON.parse(trimmed);
|
|
57
|
+
if (!(0, ide_protocol_1.isJsonRpcRequest)(message)) {
|
|
58
|
+
send((0, ide_protocol_1.createErrorResponse)(null, ide_protocol_1.JsonRpcErrorCode.InvalidRequest, 'Invalid JSON-RPC 2.0 Request'));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
handleRequest(message);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
send((0, ide_protocol_1.createErrorResponse)(null, ide_protocol_1.JsonRpcErrorCode.ParseError, 'JSON parse error', String(err?.message || err)));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function handleRequest(req) {
|
|
68
|
+
const { id, method, params } = req;
|
|
69
|
+
switch (method) {
|
|
70
|
+
case ide_protocol_1.PROTOCOL_METHODS.INITIALIZE: {
|
|
71
|
+
send((0, ide_protocol_1.createResponse)(id, {
|
|
72
|
+
serverVersion: SERVER_VERSION,
|
|
73
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
74
|
+
supportedSyntaxMatrix: SUPPORTED_SYNTAX_MATRIX,
|
|
75
|
+
}));
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case ide_protocol_1.PROTOCOL_METHODS.DISCOVER_WORKFLOWS: {
|
|
79
|
+
const workflows = (0, parser_1.discoverWorkflows)(params || {});
|
|
80
|
+
send((0, ide_protocol_1.createResponse)(id, { workflows }));
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case ide_protocol_1.PROTOCOL_METHODS.GET_GRAPH: {
|
|
84
|
+
if (!params || !params.uri) {
|
|
85
|
+
send((0, ide_protocol_1.createErrorResponse)(id, ide_protocol_1.JsonRpcErrorCode.InvalidParams, 'Missing uri in params'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const graph = (0, parser_1.parseWorkflowFile)({
|
|
89
|
+
uri: params.uri,
|
|
90
|
+
documentVersion: params.documentVersion ?? 1,
|
|
91
|
+
content: params.content,
|
|
92
|
+
workflowName: params.workflowName,
|
|
93
|
+
});
|
|
94
|
+
send((0, ide_protocol_1.createResponse)(id, graph));
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case ide_protocol_1.PROTOCOL_METHODS.RESOLVE_LOCATION: {
|
|
98
|
+
if (!params || !params.uri || !params.position) {
|
|
99
|
+
send((0, ide_protocol_1.createErrorResponse)(id, ide_protocol_1.JsonRpcErrorCode.InvalidParams, 'Missing uri or position in params'));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const graph = (0, parser_1.parseWorkflowFile)({
|
|
103
|
+
uri: params.uri,
|
|
104
|
+
content: params.content,
|
|
105
|
+
workflowName: params.workflowName,
|
|
106
|
+
});
|
|
107
|
+
const resolved = (0, parser_1.resolveLocationInDocument)(graph, params.position);
|
|
108
|
+
send((0, ide_protocol_1.createResponse)(id, resolved));
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case ide_protocol_1.PROTOCOL_METHODS.SHUTDOWN: {
|
|
112
|
+
send((0, ide_protocol_1.createResponse)(id, { success: true }));
|
|
113
|
+
process.exit(0);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
default: {
|
|
117
|
+
send((0, ide_protocol_1.createErrorResponse)(id, ide_protocol_1.JsonRpcErrorCode.MethodNotFound, `Method not found: ${method}`));
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function send(obj) {
|
|
123
|
+
process.stdout.write(JSON.stringify(obj) + '\n');
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;;;;AAEA,wDAAgC;AAChC,sDAM6B;AAC7B,qCAA2F;AAE3F,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,gBAAgB,GA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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mapper"), exports);
|
|
18
|
+
__exportStar(require("./parser"), exports);
|
|
19
|
+
__exportStar(require("./patterns/step-detector"), exports);
|
|
20
|
+
__exportStar(require("./patterns/workflow-detector"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,2DAAyC;AACzC,+DAA6C"}
|
package/dist/mapper.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SourceFile, Node as TsNode } from 'typescript';
|
|
2
|
+
import type { SourcePosition, SourceRange } from '@siglo/ide-protocol';
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes file URIs and file system paths to standard POSIX-like file:// URI or normalized path.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeUri(pathOrUri: string): string;
|
|
7
|
+
export declare function toFilePath(pathOrUri: string): string;
|
|
8
|
+
export declare function getSourcePosition(sourceFile: SourceFile, position: number): SourcePosition;
|
|
9
|
+
export declare function getSourceRange(sourceFile: SourceFile, node: TsNode): SourceRange;
|
|
10
|
+
export declare function isPositionInRange(pos: SourcePosition, range: SourceRange): boolean;
|
|
11
|
+
export declare function generateDeterministicNodeId(stepName: string, range: SourceRange): string;
|
|
12
|
+
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../src/mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgBtD;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWpD;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAG1F;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAOhF;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAWlF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAGxF"}
|
package/dist/mapper.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeUri = normalizeUri;
|
|
4
|
+
exports.toFilePath = toFilePath;
|
|
5
|
+
exports.getSourcePosition = getSourcePosition;
|
|
6
|
+
exports.getSourceRange = getSourceRange;
|
|
7
|
+
exports.isPositionInRange = isPositionInRange;
|
|
8
|
+
exports.generateDeterministicNodeId = generateDeterministicNodeId;
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes file URIs and file system paths to standard POSIX-like file:// URI or normalized path.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeUri(pathOrUri) {
|
|
13
|
+
if (!pathOrUri)
|
|
14
|
+
return '';
|
|
15
|
+
let normalized = pathOrUri.replace(/\\/g, '/');
|
|
16
|
+
if (normalized.startsWith('file://')) {
|
|
17
|
+
// Decode URI components
|
|
18
|
+
try {
|
|
19
|
+
normalized = decodeURI(normalized);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// ignore
|
|
23
|
+
}
|
|
24
|
+
return normalized;
|
|
25
|
+
}
|
|
26
|
+
if (!normalized.startsWith('/')) {
|
|
27
|
+
normalized = '/' + normalized;
|
|
28
|
+
}
|
|
29
|
+
return `file://${normalized}`;
|
|
30
|
+
}
|
|
31
|
+
function toFilePath(pathOrUri) {
|
|
32
|
+
if (!pathOrUri)
|
|
33
|
+
return '';
|
|
34
|
+
let path = pathOrUri;
|
|
35
|
+
if (path.startsWith('file://')) {
|
|
36
|
+
path = path.slice(7);
|
|
37
|
+
}
|
|
38
|
+
// Windows file:///C:/path -> C:/path
|
|
39
|
+
if (/^\/[a-zA-Z]:/.test(path)) {
|
|
40
|
+
path = path.slice(1);
|
|
41
|
+
}
|
|
42
|
+
return path.replace(/\\/g, '/');
|
|
43
|
+
}
|
|
44
|
+
function getSourcePosition(sourceFile, position) {
|
|
45
|
+
const { line, character } = sourceFile.getLineAndCharacterOfPosition(position);
|
|
46
|
+
return { line, character };
|
|
47
|
+
}
|
|
48
|
+
function getSourceRange(sourceFile, node) {
|
|
49
|
+
const startPos = node.getStart(sourceFile);
|
|
50
|
+
const endPos = node.getEnd();
|
|
51
|
+
return {
|
|
52
|
+
start: getSourcePosition(sourceFile, startPos),
|
|
53
|
+
end: getSourcePosition(sourceFile, endPos),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function isPositionInRange(pos, range) {
|
|
57
|
+
if (pos.line < range.start.line || pos.line > range.end.line) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (pos.line === range.start.line && pos.character < range.start.character) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (pos.line === range.end.line && pos.character > range.end.character) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
function generateDeterministicNodeId(stepName, range) {
|
|
69
|
+
const cleanName = stepName.replace(/[^a-zA-Z0-9_]/g, '_') || 'anonymous';
|
|
70
|
+
return `step_${cleanName}_L${range.start.line + 1}_C${range.start.character + 1}`;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.js","sourceRoot":"","sources":["../src/mapper.ts"],"names":[],"mappings":";;AAMA,oCAgBC;AAED,gCAWC;AAED,8CAGC;AAED,wCAOC;AAED,8CAWC;AAED,kEAGC;AAhED;;GAEG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/C,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,wBAAwB;QACxB,IAAI,CAAC;YACH,UAAU,GAAG,S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AAU,EAAE,MAAM,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAC,GAAmB,EAAE,KAAkB;IACvE,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,2BAA2B,CAAC,QAAgB,EAAE,KAAkB;IAC9E,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,WAAW,CAAC;IACzE,OAAO,QAAQ,SAAS,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;AACpF,CAAC"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GraphDocument, SourcePosition, ResolveLocationResult, DiscoveredWorkflow } from '@siglo/ide-protocol';
|
|
2
|
+
export interface ParseOptions {
|
|
3
|
+
uri: string;
|
|
4
|
+
documentVersion?: number;
|
|
5
|
+
content?: string;
|
|
6
|
+
workflowName?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseWorkflowFile(options: ParseOptions): GraphDocument;
|
|
9
|
+
export declare function resolveLocationInDocument(doc: GraphDocument, pos: SourcePosition): ResolveLocationResult;
|
|
10
|
+
export declare function discoverWorkflows(params: {
|
|
11
|
+
documentUri?: string;
|
|
12
|
+
workspaceUri?: string;
|
|
13
|
+
}): DiscoveredWorkflow[];
|
|
14
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EAEb,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,aAAa,CA0DtE;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,cAAc,GAClB,qBAAqB,CAsBvB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,EAAE,CAiF/G"}
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseWorkflowFile = parseWorkflowFile;
|
|
7
|
+
exports.resolveLocationInDocument = resolveLocationInDocument;
|
|
8
|
+
exports.discoverWorkflows = discoverWorkflows;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
const mapper_1 = require("./mapper");
|
|
13
|
+
const workflow_detector_1 = require("./patterns/workflow-detector");
|
|
14
|
+
function parseWorkflowFile(options) {
|
|
15
|
+
const uri = (0, mapper_1.normalizeUri)(options.uri);
|
|
16
|
+
const filePath = (0, mapper_1.toFilePath)(options.uri);
|
|
17
|
+
const documentVersion = options.documentVersion ?? 1;
|
|
18
|
+
let sourceText = options.content;
|
|
19
|
+
if (sourceText === undefined) {
|
|
20
|
+
try {
|
|
21
|
+
sourceText = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
sourceText = '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Pure static syntax-only AST creation. Never executes any JavaScript.
|
|
28
|
+
const sourceFile = typescript_1.default.createSourceFile(filePath, sourceText, typescript_1.default.ScriptTarget.Latest, true, typescript_1.default.ScriptKind.TS);
|
|
29
|
+
const workflows = (0, workflow_detector_1.analyzeWorkflowsInSourceFile)(sourceFile, uri, documentVersion);
|
|
30
|
+
if (workflows.length === 0) {
|
|
31
|
+
return {
|
|
32
|
+
uri,
|
|
33
|
+
documentVersion,
|
|
34
|
+
workflowName: path_1.default.basename(filePath, path_1.default.extname(filePath)) || 'workflow',
|
|
35
|
+
nodes: [],
|
|
36
|
+
edges: [],
|
|
37
|
+
unresolved: [],
|
|
38
|
+
diagnostics: [],
|
|
39
|
+
workflows: [],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const workflowSummaries = workflows.map((w) => ({
|
|
43
|
+
name: w.workflowName,
|
|
44
|
+
properties: w.properties,
|
|
45
|
+
nodes: w.nodes,
|
|
46
|
+
edges: w.edges,
|
|
47
|
+
unresolved: w.unresolved,
|
|
48
|
+
diagnostics: w.diagnostics,
|
|
49
|
+
}));
|
|
50
|
+
let activeFlow = workflows[workflows.length - 1];
|
|
51
|
+
if (options.workflowName) {
|
|
52
|
+
const found = workflows.find((w) => w.workflowName === options.workflowName);
|
|
53
|
+
if (found) {
|
|
54
|
+
activeFlow = found;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
...activeFlow,
|
|
59
|
+
workflows: workflowSummaries,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function resolveLocationInDocument(doc, pos) {
|
|
63
|
+
// Check nodes first
|
|
64
|
+
for (const node of doc.nodes) {
|
|
65
|
+
if ((0, mapper_1.isPositionInRange)(pos, node.location) || (0, mapper_1.isPositionInRange)(pos, node.declarationRange)) {
|
|
66
|
+
return {
|
|
67
|
+
nodeId: node.id,
|
|
68
|
+
range: node.location,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Check unresolved nodes
|
|
73
|
+
for (const un of doc.unresolved) {
|
|
74
|
+
if ((0, mapper_1.isPositionInRange)(pos, un.location)) {
|
|
75
|
+
return {
|
|
76
|
+
nodeId: un.id,
|
|
77
|
+
range: un.location,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
function discoverWorkflows(params) {
|
|
84
|
+
const results = [];
|
|
85
|
+
if (params.documentUri) {
|
|
86
|
+
const filePath = (0, mapper_1.toFilePath)(params.documentUri);
|
|
87
|
+
let content;
|
|
88
|
+
try {
|
|
89
|
+
content = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
content = '';
|
|
93
|
+
}
|
|
94
|
+
const sourceFile = typescript_1.default.createSourceFile(filePath, content, typescript_1.default.ScriptTarget.Latest, true, typescript_1.default.ScriptKind.TS);
|
|
95
|
+
const workflows = (0, workflow_detector_1.analyzeWorkflowsInSourceFile)(sourceFile, (0, mapper_1.normalizeUri)(params.documentUri), 1);
|
|
96
|
+
for (const w of workflows) {
|
|
97
|
+
if (w.nodes.length > 0) {
|
|
98
|
+
results.push({
|
|
99
|
+
id: `${w.workflowName}_${path_1.default.basename(filePath)}`,
|
|
100
|
+
name: w.workflowName,
|
|
101
|
+
uri: w.uri,
|
|
102
|
+
range: w.nodes[0].location,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
108
|
+
if (params.workspaceUri) {
|
|
109
|
+
const rootDir = (0, mapper_1.toFilePath)(params.workspaceUri);
|
|
110
|
+
if (!fs_1.default.existsSync(rootDir)) {
|
|
111
|
+
return results;
|
|
112
|
+
}
|
|
113
|
+
const filesToScan = [];
|
|
114
|
+
const IGNORED_DIRS = new Set(['node_modules', 'dist', '.git', 'coverage', '.idea', 'build']);
|
|
115
|
+
function scanDir(dir, depth = 0) {
|
|
116
|
+
if (depth > 8 || filesToScan.length >= 100)
|
|
117
|
+
return;
|
|
118
|
+
try {
|
|
119
|
+
const entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
120
|
+
for (const entry of entries) {
|
|
121
|
+
if (entry.isDirectory()) {
|
|
122
|
+
if (!IGNORED_DIRS.has(entry.name)) {
|
|
123
|
+
scanDir(path_1.default.join(dir, entry.name), depth + 1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (entry.isFile() && (entry.name.endsWith('.ts') || entry.name.endsWith('.workflow.ts'))) {
|
|
127
|
+
filesToScan.push(path_1.default.join(dir, entry.name));
|
|
128
|
+
if (filesToScan.length >= 100)
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// ignore permission or unreadable dirs
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
scanDir(rootDir);
|
|
138
|
+
for (const file of filesToScan) {
|
|
139
|
+
try {
|
|
140
|
+
const content = fs_1.default.readFileSync(file, 'utf-8');
|
|
141
|
+
// Quick heuristic check before parsing AST
|
|
142
|
+
if (content.includes('flow(') || content.includes('workflow(') || content.includes('Step.create(')) {
|
|
143
|
+
const sourceFile = typescript_1.default.createSourceFile(file, content, typescript_1.default.ScriptTarget.Latest, true, typescript_1.default.ScriptKind.TS);
|
|
144
|
+
const workflows = (0, workflow_detector_1.analyzeWorkflowsInSourceFile)(sourceFile, (0, mapper_1.normalizeUri)(file), 1);
|
|
145
|
+
for (const w of workflows) {
|
|
146
|
+
if (w.nodes.length > 0) {
|
|
147
|
+
results.push({
|
|
148
|
+
id: `${w.workflowName}_${path_1.default.basename(file)}`,
|
|
149
|
+
name: w.workflowName,
|
|
150
|
+
uri: w.uri,
|
|
151
|
+
range: w.nodes[0]?.location || { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } },
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// ignore
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return results;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":";;;;;AAoBA,8CA0DC;AAED,8DAyBC;AAED,8CAiFC;AA5LD,4CAAoB;AACpB,gDAAwB;AACxB,4DAA4B;AAQ5B,qCAAuE;AACvE,oEAA4E;AAS5E,SAAgB,iBAAiB,CAAC,OAAqB;IACrD,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,CAAC,CAAC;IAErD,IAAI,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,IAAI,U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
2
|
+
import type { GraphNode, UnresolvedNode } from '@siglo/ide-protocol';
|
|
3
|
+
export type DetectedStep = {
|
|
4
|
+
kind: 'node';
|
|
5
|
+
node: GraphNode;
|
|
6
|
+
variableName?: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'unresolved';
|
|
9
|
+
unresolved: UnresolvedNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function isEcosystemStepCallee(name: string): GraphNode['stepKind'] | null;
|
|
12
|
+
export declare function detectStepFromExpression(expr: ts.Expression, sourceFile: ts.SourceFile, enclosingRange?: {
|
|
13
|
+
start: {
|
|
14
|
+
line: number;
|
|
15
|
+
character: number;
|
|
16
|
+
};
|
|
17
|
+
end: {
|
|
18
|
+
line: number;
|
|
19
|
+
character: number;
|
|
20
|
+
};
|
|
21
|
+
}): DetectedStep | null;
|
|
22
|
+
export declare function extractDisplayProperties(obj: ts.ObjectLiteralExpression, sourceFile: ts.SourceFile): Record<string, string>;
|
|
23
|
+
//# sourceMappingURL=step-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-detector.d.ts","sourceRoot":"","sources":["../../src/patterns/step-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAG7F,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,cAAc,CAAA;CAAE,CAAC;AAEvD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CA+BhF;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,cAAc,CAAC,EAAE;IAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACxG,YAAY,GAAG,IAAI,CA4LrB;AAiCD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,EAAE,CAAC,uBAAuB,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ3H"}
|