@saptools/service-flow 0.1.59 → 0.1.61
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/CHANGELOG.md +10 -0
- package/dist/{chunk-GLZSDBRG.js → chunk-BGD7UYJN.js} +5 -16
- package/dist/chunk-BGD7UYJN.js.map +1 -0
- package/dist/cli.js +9 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/parsers/outbound-call-parser.ts +8 -15
- package/src/parsers/symbol-parser.ts +11 -1
- package/dist/chunk-GLZSDBRG.js.map +0 -1
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -57,18 +57,6 @@ function queryRunEvidence(
|
|
|
57
57
|
} : {}),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function extractQueryEntity(expr: string): string | undefined {
|
|
61
|
-
const source = ts.createSourceFile('query.ts', `const __query = (${expr});`, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
62
|
-
const initializers = variableInitializers(source);
|
|
63
|
-
let found: string | undefined;
|
|
64
|
-
const visit = (node: ts.Node): void => {
|
|
65
|
-
if (found) return;
|
|
66
|
-
if (ts.isParenthesizedExpression(node)) found = queryEntityFromAst(node.expression, initializers);
|
|
67
|
-
ts.forEachChild(node, visit);
|
|
68
|
-
};
|
|
69
|
-
visit(source);
|
|
70
|
-
return found;
|
|
71
|
-
}
|
|
72
60
|
function queryWarning(expr: string): string {
|
|
73
61
|
if (/^\s*[`'"]/.test(expr)) return 'raw_sql_or_cql_expression';
|
|
74
62
|
if (/^\s*\w+\s*$/.test(expr)) return 'query_variable_without_static_initializer';
|
|
@@ -387,7 +375,7 @@ export function classifyOutboundCallsInSource(source: ts.SourceFile, filePath: s
|
|
|
387
375
|
const objectArg = node.arguments[0];
|
|
388
376
|
if (objectArg && ts.isObjectLiteralExpression(objectArg)) {
|
|
389
377
|
const receiver = receiverName(expr.expression);
|
|
390
|
-
const
|
|
378
|
+
const queryExpression = propertyInitializer(objectArg, 'query');
|
|
391
379
|
const method = stripQuotes(resolveExpression(propertyInitializer(objectArg, 'method'), node, 'literal').value ?? objectPropertyText(objectArg, 'method') ?? 'POST');
|
|
392
380
|
const pathExpr = propertyInitializer(objectArg, 'path') ?? propertyInitializer(objectArg, 'event');
|
|
393
381
|
const pathAnalysis = analyzeOperationPath(pathExpr, node, method);
|
|
@@ -398,8 +386,13 @@ export function classifyOutboundCallsInSource(source: ts.SourceFile, filePath: s
|
|
|
398
386
|
const entityCallTypes: Record<string, OutboundCallFact['callType']> = { entity_mutation: 'remote_entity_mutation', entity_delete: 'remote_entity_delete', entity_media: 'remote_entity_media', entity_candidate: 'remote_entity_candidate' };
|
|
399
387
|
const entityCallType = entityCallTypes[intent.kind];
|
|
400
388
|
const isODataQueryRead = method.toUpperCase() === 'GET' && ['entity_query', 'entity_key_read', 'entity_navigation_query'].includes(intent.kind);
|
|
401
|
-
const
|
|
402
|
-
|
|
389
|
+
const queryEntity = queryExpression
|
|
390
|
+
? queryEntityFromAst(queryExpression, initializers)
|
|
391
|
+
: isODataQueryRead ? intent.entitySegment : undefined;
|
|
392
|
+
const unresolvedReason = queryExpression
|
|
393
|
+
? queryEntity ? undefined : queryWarning(queryExpression.getText(source))
|
|
394
|
+
: pathExpr ? pathUnresolvedReason(pathAnalysis) : undefined;
|
|
395
|
+
add(node, { callType: queryExpression ? 'remote_query' : entityCallType ?? (isODataQueryRead ? 'remote_query' : 'remote_action'), serviceVariableName: receiver, method, operationPathExpr, queryEntity, payloadSummary: summarizeExpression(objectArg.getText(source)), confidence: op || queryExpression ? 0.8 : 0.4, unresolvedReason }, { receiver, classifier: 'service_client_send_object', operationPathExpression: shorthandPath ? op : undefined, rawPathExpression: pathAnalysis.rawExpression, literalPathSource: literalPathSource(pathAnalysis), odataPathIntent: operationPathExpr ? intent : undefined, pathAnalysis, staticPathCandidates: legacyPathCandidates(pathAnalysis), parserWarning: unresolvedReason });
|
|
403
396
|
} else {
|
|
404
397
|
const receiver = receiverName(expr.expression);
|
|
405
398
|
const rootReceiver = rootReceiverName(expr.expression);
|
|
@@ -242,7 +242,17 @@ export async function parseExecutableSymbols(
|
|
|
242
242
|
if (localName) addSymbol('method', localName, node, parentClass);
|
|
243
243
|
} else if (ts.isPropertyDeclaration(node) && parentClass && node.initializer && (ts.isArrowFunction(node.initializer) || ts.isFunctionExpression(node.initializer))) {
|
|
244
244
|
const localName = nameOf(node.name);
|
|
245
|
-
if (localName)
|
|
245
|
+
if (localName) {
|
|
246
|
+
const flags = ts.getCombinedModifierFlags(node);
|
|
247
|
+
const staticPublicExported = exportedClasses.has(parentClass) && (flags & ts.ModifierFlags.Static) !== 0 && (flags & ts.ModifierFlags.Private) === 0 && (flags & ts.ModifierFlags.Protected) === 0;
|
|
248
|
+
const isArrow = ts.isArrowFunction(node.initializer);
|
|
249
|
+
const memberKind = isArrow
|
|
250
|
+
? (staticPublicExported ? 'static_arrow_function' : 'arrow_function_property')
|
|
251
|
+
: (staticPublicExported ? 'static_function_expression' : 'function_expression_property');
|
|
252
|
+
addSymbol('method', localName, node.initializer, parentClass, staticPublicExported ? `${parentClass}.${localName}` : undefined, staticPublicExported
|
|
253
|
+
? { source: 'exported_class_member', exportedClass: parentClass, memberKind }
|
|
254
|
+
: { source: 'class_property_function', memberKind });
|
|
255
|
+
}
|
|
246
256
|
} else if (ts.isFunctionDeclaration(node) && node.name) addSymbol('function', node.name.text, node, undefined, exported(node) ? node.name.text : undefined);
|
|
247
257
|
else if (ts.isVariableStatement(node)) {
|
|
248
258
|
for (const d of node.declarationList.declarations) {
|