@saptools/service-flow 0.1.67 → 0.1.68
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/README.md +20 -8
- package/TECHNICAL-NOTE.md +27 -0
- package/dist/{chunk-ZQABU7MR.js → chunk-AEM4JY22.js} +12676 -6714
- package/dist/chunk-AEM4JY22.js.map +1 -0
- package/dist/cli.js +2325 -413
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +61 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/cli/003-doctor-package-resolution.ts +68 -0
- package/src/cli/doctor.ts +25 -14
- package/src/db/000-call-fact-repository.ts +475 -342
- package/src/db/001-fact-lifecycle.ts +60 -30
- package/src/db/002-fact-json-inventory.ts +169 -0
- package/src/db/003-current-fact-semantics.ts +698 -0
- package/src/db/004-package-target-invalidation.ts +173 -0
- package/src/db/005-schema-structure.ts +201 -0
- package/src/db/006-relative-symbol-resolution.ts +443 -0
- package/src/db/007-package-fact-semantics.ts +573 -0
- package/src/db/008-relative-fact-semantics.ts +207 -0
- package/src/db/009-binding-fact-semantics.ts +347 -0
- package/src/db/010-package-symbol-surface-semantics.ts +320 -0
- package/src/db/011-symbol-call-semantics.ts +144 -0
- package/src/db/012-binding-reference-proof.ts +264 -0
- package/src/db/migrations.ts +16 -3
- package/src/db/repositories.ts +113 -6
- package/src/db/schema.ts +4 -2
- package/src/index.ts +12 -0
- package/src/indexer/repository-indexer.ts +72 -11
- package/src/indexer/workspace-indexer.ts +123 -32
- package/src/linker/003-package-import-symbol-resolver.ts +363 -131
- package/src/linker/004-event-subscription-handler-linker.ts +2 -0
- package/src/linker/005-odata-path-structure.ts +371 -0
- package/src/linker/cross-repo-linker.ts +2 -1
- package/src/linker/odata-path-normalizer.ts +273 -180
- package/src/linker/service-resolver.ts +197 -77
- package/src/parsers/002-symbol-import-bindings.ts +516 -0
- package/src/parsers/003-package-public-surface.ts +661 -0
- package/src/parsers/004-fact-identity.ts +108 -0
- package/src/parsers/005-event-subscription-facts.ts +281 -0
- package/src/parsers/006-binding-identity.ts +343 -0
- package/src/parsers/007-source-fact-reconciliation.ts +105 -0
- package/src/parsers/008-package-surface-publication.ts +82 -0
- package/src/parsers/009-symbol-call-facts.ts +528 -0
- package/src/parsers/010-package-public-surface-analysis.ts +352 -0
- package/src/parsers/011-binding-lexical-scope.ts +583 -0
- package/src/parsers/012-package-fact-contract.ts +306 -0
- package/src/parsers/013-executable-body-eligibility.ts +35 -0
- package/src/parsers/014-service-binding-helper-flow.ts +240 -0
- package/src/parsers/015-service-binding-collector.ts +693 -0
- package/src/parsers/016-local-symbol-reference.ts +261 -0
- package/src/parsers/017-symbol-derived-contexts.ts +268 -0
- package/src/parsers/018-package-commonjs-syntax.ts +142 -0
- package/src/parsers/019-binding-assignment-targets.ts +76 -0
- package/src/parsers/020-stable-local-value.ts +217 -0
- package/src/parsers/021-binding-visibility.ts +152 -0
- package/src/parsers/operation-path-analysis.ts +6 -1
- package/src/parsers/outbound-call-parser.ts +19 -6
- package/src/parsers/package-json-parser.ts +45 -3
- package/src/parsers/service-binding-parser-helpers.ts +86 -15
- package/src/parsers/service-binding-parser.ts +147 -597
- package/src/parsers/symbol-parser.ts +482 -353
- package/src/trace/002-trace-diagnostics.ts +36 -1
- package/src/trace/016-compact-projector.ts +16 -17
- package/src/trace/020-compact-field-projection.ts +48 -37
- package/src/trace/021-compact-decision-normalization.ts +105 -0
- package/src/trace/022-trace-fact-preflight.ts +21 -0
- package/src/trace/023-nested-event-scopes.ts +23 -0
- package/src/trace/024-compact-observation-decision.ts +76 -0
- package/src/trace/025-trace-implementation-scope.ts +123 -0
- package/src/trace/026-trace-start-scope.ts +335 -0
- package/src/trace/027-trace-scope-execution.ts +566 -0
- package/src/trace/028-trace-operation-execution.ts +336 -0
- package/src/trace/029-trace-start-implementation.ts +172 -0
- package/src/trace/trace-engine.ts +122 -624
- package/src/types.ts +56 -0
- package/src/utils/001-placeholders.ts +188 -10
- package/src/version.ts +1 -1
- package/dist/chunk-ZQABU7MR.js.map +0 -1
|
@@ -47,24 +47,95 @@ function placeholders(value?: string): string[] {
|
|
|
47
47
|
return extractPlaceholderKeys(value);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
type ConnectFact = Omit<
|
|
51
|
+
HelperBinding,
|
|
52
|
+
'exportedName' | 'sourceFile' | 'sourceLine'
|
|
53
|
+
>;
|
|
54
|
+
|
|
55
|
+
function connectMethod(
|
|
56
|
+
call: ts.CallExpression,
|
|
57
|
+
): 'to' | 'messaging' | undefined {
|
|
58
|
+
const expression = call.expression;
|
|
59
|
+
if (!ts.isPropertyAccessExpression(expression)
|
|
60
|
+
|| !['to', 'messaging'].includes(expression.name.text)) return undefined;
|
|
61
|
+
const receiver = expression.expression;
|
|
62
|
+
if (!ts.isPropertyAccessExpression(receiver)
|
|
63
|
+
|| receiver.name.text !== 'connect'
|
|
64
|
+
|| receiver.expression.getText() !== 'cds') return undefined;
|
|
65
|
+
return expression.name.text === 'messaging' ? 'messaging' : 'to';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function connectObject(
|
|
69
|
+
first: ts.Expression,
|
|
70
|
+
second: ts.Expression | undefined,
|
|
71
|
+
): ts.ObjectLiteralExpression | undefined {
|
|
72
|
+
if (ts.isObjectLiteralExpression(first)) return first;
|
|
73
|
+
return second && ts.isObjectLiteralExpression(second)
|
|
74
|
+
? second
|
|
75
|
+
: undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function connectNames(
|
|
79
|
+
method: 'to' | 'messaging',
|
|
80
|
+
first: ts.Expression,
|
|
81
|
+
): { alias?: string; aliasExpr?: string } {
|
|
82
|
+
if (ts.isStringLiteralLike(first)
|
|
83
|
+
|| ts.isNoSubstitutionTemplateLiteral(first))
|
|
84
|
+
return { alias: first.text };
|
|
85
|
+
if (ts.isObjectLiteralExpression(first))
|
|
86
|
+
return method === 'messaging' ? { alias: 'messaging' } : {};
|
|
87
|
+
return { aliasExpr: stringValue(first) };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function literalConnectFact(
|
|
91
|
+
first: ts.Expression,
|
|
92
|
+
object: ts.ObjectLiteralExpression | undefined,
|
|
93
|
+
): ConnectFact | undefined {
|
|
94
|
+
if (object || (!ts.isStringLiteralLike(first)
|
|
95
|
+
&& !ts.isNoSubstitutionTemplateLiteral(first))) return undefined;
|
|
96
|
+
return { alias: first.text, isDynamic: false, placeholders: [] };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function dynamicConnectFact(
|
|
100
|
+
placeholdersFound: readonly string[],
|
|
101
|
+
expressions: { destinationExpr?: string; servicePathExpr?: string },
|
|
102
|
+
): boolean {
|
|
103
|
+
return placeholdersFound.length > 0
|
|
104
|
+
|| (!expressions.destinationExpr && !expressions.servicePathExpr);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function connectFactFromCall(
|
|
108
|
+
call: ts.CallExpression,
|
|
109
|
+
): ConnectFact | undefined {
|
|
110
|
+
const method = connectMethod(call);
|
|
111
|
+
if (!method) return undefined;
|
|
55
112
|
const first = call.arguments[0];
|
|
56
|
-
if (!first)
|
|
113
|
+
if (!first)
|
|
114
|
+
return method === 'messaging'
|
|
115
|
+
? { alias: 'messaging', isDynamic: false, placeholders: [] }
|
|
116
|
+
: undefined;
|
|
57
117
|
const second = call.arguments[1];
|
|
58
|
-
const objectArg =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
118
|
+
const objectArg = connectObject(first, second);
|
|
119
|
+
const names = connectNames(method, first);
|
|
120
|
+
const literal = literalConnectFact(first, objectArg);
|
|
121
|
+
if (literal) return literal;
|
|
122
|
+
if (!objectArg && names.aliasExpr) return {
|
|
123
|
+
aliasExpr: names.aliasExpr,
|
|
124
|
+
isDynamic: true,
|
|
125
|
+
placeholders: placeholders(names.aliasExpr),
|
|
126
|
+
};
|
|
65
127
|
const expressions = objectArg ? objectExpressions(objectArg) : {};
|
|
66
|
-
const ph = [
|
|
67
|
-
|
|
128
|
+
const ph = [
|
|
129
|
+
...placeholders(names.aliasExpr ?? names.alias),
|
|
130
|
+
...placeholders(expressions.destinationExpr),
|
|
131
|
+
...placeholders(expressions.servicePathExpr),
|
|
132
|
+
];
|
|
133
|
+
return {
|
|
134
|
+
...names,
|
|
135
|
+
...expressions,
|
|
136
|
+
isDynamic: dynamicConnectFact(ph, expressions),
|
|
137
|
+
placeholders: ph,
|
|
138
|
+
};
|
|
68
139
|
}
|
|
69
140
|
|
|
70
141
|
function objectExpressions(objectArg: ts.ObjectLiteralExpression): { destinationExpr?: string; servicePathExpr?: string } {
|