carrick 0.3.140 → 0.3.141
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/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/argument-modes.d.ts +56 -0
- package/sidecar/dist/src/argument-modes.js +448 -0
- package/sidecar/dist/src/loop-element.d.ts +58 -0
- package/sidecar/dist/src/loop-element.js +307 -0
- package/sidecar/dist/src/response-modes.d.ts +7 -2
- package/sidecar/dist/src/response-modes.js +1 -1
- package/sidecar/dist/src/type-inferrer.d.ts +43 -7
- package/sidecar/dist/src/type-inferrer.js +229 -9
- package/sidecar/dist/src/types.d.ts +8 -0
- package/sidecar/dist/src/validators.d.ts +13 -0
- package/sidecar/dist/src/validators.js +2 -0
- package/templates/skills/carrick-reuse.md +1 -1
|
@@ -27,6 +27,7 @@ import { notePrintedType, PrintedTypes } from './printed-names.js';
|
|
|
27
27
|
import { externalImportsOf, isExternalOrigin } from './origin.js';
|
|
28
28
|
import { reachedOnlyOnFailure } from './failure-path.js';
|
|
29
29
|
import { readResponseModes } from './response-modes.js';
|
|
30
|
+
import { callInto, calledFunction, narrowByArguments } from './argument-modes.js';
|
|
30
31
|
import { functionAtLine } from './function-line-index.js';
|
|
31
32
|
import { attributedDeclaration, installedPackageOf } from './declaration-attribution.js';
|
|
32
33
|
import { endLineOf, startLineOf } from './line-index.js';
|
|
@@ -35,6 +36,7 @@ import { elapsedMs, inferTiming, phaseClock, timedPhase } from './infer-timing.j
|
|
|
35
36
|
import { StatedParams } from './stated-params.js';
|
|
36
37
|
import { bindingToleratesAbsence, handlerToleratesAbsentBody } from './absent-body.js';
|
|
37
38
|
import { replaceFileText } from './program-files.js';
|
|
39
|
+
import { loopElementPick } from './loop-element.js';
|
|
38
40
|
import { classifyStatusCodes, constituents, httpStatus, statesNoBody, statesNoShape, statusKeyCode, statusTableOf, successEntries, } from './capture/index.js';
|
|
39
41
|
import { addedDiagnostics, applyInsertions, fileDiagnostics, literalInsertions, mapBack, mapForward, normalise, pathOf, } from './unwidened.js';
|
|
40
42
|
import { expandTypeStructural, jsonWireType, } from './type-structural-expander.js';
|
|
@@ -422,6 +424,12 @@ const UNWIDENED_BACKSTOP_MS = 30 * 60_000;
|
|
|
422
424
|
* const inferrer = new TypeInferrer({ project });
|
|
423
425
|
* const result = inferrer.infer(requests, extractionConfig);
|
|
424
426
|
*/
|
|
427
|
+
/**
|
|
428
|
+
* The kinds a route row's request is asked as, and so the kinds a loop
|
|
429
|
+
* element is read for (carrick#1029): a response read at the send or as the
|
|
430
|
+
* handler's return, and a request body.
|
|
431
|
+
*/
|
|
432
|
+
const LOOP_ROW_KINDS = new Set(['response_body', 'function_return', 'request_body']);
|
|
425
433
|
export class TypeInferrer {
|
|
426
434
|
project;
|
|
427
435
|
packageOf;
|
|
@@ -484,6 +492,12 @@ export class TypeInferrer {
|
|
|
484
492
|
const bodies = [];
|
|
485
493
|
/** How long each request took, in the order they were done (carrick#1985). */
|
|
486
494
|
const timings = [];
|
|
495
|
+
/**
|
|
496
|
+
* Requests for a route registered once per loop element (carrick#1029),
|
|
497
|
+
* read after everything else, with where each answer goes in the answer
|
|
498
|
+
* order.
|
|
499
|
+
*/
|
|
500
|
+
const loopRows = [];
|
|
487
501
|
for (const request of requests) {
|
|
488
502
|
const slotStarted = performance.now();
|
|
489
503
|
const phasesStarted = phaseClock();
|
|
@@ -509,11 +523,16 @@ export class TypeInferrer {
|
|
|
509
523
|
// while the program the prints were made in is still the project's.
|
|
510
524
|
// The unwidened re-read below records nothing: it prints the same
|
|
511
525
|
// node, and its reading has a budget.
|
|
512
|
-
|
|
513
|
-
|
|
526
|
+
// carrick#1029: a route registered once per loop element is read
|
|
527
|
+
// last. Its reading rewrites its file, and a rewrite forgets every
|
|
528
|
+
// node of the file that the readings below still hold.
|
|
529
|
+
if (this.loopPickFor(request)) {
|
|
530
|
+
loopRows.push({ request, at: inferredTypes.length });
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const result = this.inferRecordingNames(request, extractionConfig);
|
|
514
534
|
if (result) {
|
|
515
535
|
printedLength = result.type_string.length;
|
|
516
|
-
this.recordPrintedNames(result, request, prints);
|
|
517
536
|
inferredTypes.push(result);
|
|
518
537
|
if (request.infer_kind === 'response_body' || request.infer_kind === 'function_return') {
|
|
519
538
|
responses.push({ request, result });
|
|
@@ -601,6 +620,32 @@ export class TypeInferrer {
|
|
|
601
620
|
catch (err) {
|
|
602
621
|
this.logError(`Unwidened reading failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
603
622
|
}
|
|
623
|
+
// The loop rows, each typed for its own element. Not re-read unwidened:
|
|
624
|
+
// that re-read rewrites the original file, where the element is not
|
|
625
|
+
// fixed. Placed back in request order, last first so earlier places hold.
|
|
626
|
+
const loopAnswers = [];
|
|
627
|
+
// Each was counted done, and timed, where it was deferred.
|
|
628
|
+
for (const { request, at } of loopRows) {
|
|
629
|
+
const loc = this.formatRequestLocation(request);
|
|
630
|
+
try {
|
|
631
|
+
const pick = this.loopPickFor(request);
|
|
632
|
+
const result = pick
|
|
633
|
+
? this.inferForLoopElement(request, pick, extractionConfig)
|
|
634
|
+
: this.inferRecordingNames(request, extractionConfig);
|
|
635
|
+
if (result) {
|
|
636
|
+
loopAnswers.push({ at, result });
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
errors.push(`Could not infer type at ${request.file_path}:${loc} (${request.infer_kind})`);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
catch (err) {
|
|
643
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
644
|
+
errors.push(`Error inferring type at ${request.file_path}:${loc}: ${error}`);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
for (const { at, result } of loopAnswers.reverse())
|
|
648
|
+
inferredTypes.splice(at, 0, result);
|
|
604
649
|
return {
|
|
605
650
|
success: errors.length === 0 || inferredTypes.length > 0,
|
|
606
651
|
inferred_types: inferredTypes.length > 0 ? inferredTypes : undefined,
|
|
@@ -686,6 +731,67 @@ export class TypeInferrer {
|
|
|
686
731
|
* carrick#1836: list on `result` the declarations behind the names its text
|
|
687
732
|
* prints that the request's file cannot resolve (`PrintedTypes.namesIn`).
|
|
688
733
|
*/
|
|
734
|
+
/** `inferSingle`, with what the names it prints meant (carrick#1836). */
|
|
735
|
+
inferRecordingNames(request, extractionConfig) {
|
|
736
|
+
const prints = new PrintedTypes();
|
|
737
|
+
const result = prints.during(() => this.inferSingle(request, extractionConfig));
|
|
738
|
+
if (result)
|
|
739
|
+
this.recordPrintedNames(result, request, prints);
|
|
740
|
+
return result;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* carrick#1029: the loop element a route row's path names, when its
|
|
744
|
+
* registration is made once per element of a constant list
|
|
745
|
+
* (`loop-element.ts`). Only a route row that states its path is read.
|
|
746
|
+
*/
|
|
747
|
+
loopPickFor(request) {
|
|
748
|
+
if (!request.route_path)
|
|
749
|
+
return undefined;
|
|
750
|
+
if (!LOOP_ROW_KINDS.has(request.infer_kind))
|
|
751
|
+
return undefined;
|
|
752
|
+
const sourceFile = this.getSourceFile(request.file_path);
|
|
753
|
+
if (!sourceFile)
|
|
754
|
+
return undefined;
|
|
755
|
+
// Every call on the line, outermost first: on `LIST.forEach((x) =>
|
|
756
|
+
// app.get(…))` the loop's own call is the line's first registration-shaped
|
|
757
|
+
// call, and the registration is inside it.
|
|
758
|
+
for (const entry of descendantsOnLine(sourceFile, request.line_number)) {
|
|
759
|
+
if (entry.kind !== SyntaxKind.CallExpression)
|
|
760
|
+
continue;
|
|
761
|
+
const pick = loopElementPick(wrap(sourceFile, entry), request.route_path);
|
|
762
|
+
if (pick)
|
|
763
|
+
return pick;
|
|
764
|
+
}
|
|
765
|
+
return undefined;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* The request inferred with the loop's list rewritten to the one element
|
|
769
|
+
* `pick` names, so the compiler types the handler for that element. The
|
|
770
|
+
* file is restored before returning, and the names the reading prints are
|
|
771
|
+
* recorded while the rewritten program is still the project's. Lines do not
|
|
772
|
+
* move (the rewrite is padded); a span after the list moves by the length
|
|
773
|
+
* the rewrite changed.
|
|
774
|
+
*/
|
|
775
|
+
inferForLoopElement(request, pick, extractionConfig) {
|
|
776
|
+
const original = pick.file.getFullText();
|
|
777
|
+
const delta = pick.text.length - (pick.end - pick.start);
|
|
778
|
+
const moved = (at) => (at !== undefined && at >= pick.end ? at + delta : at);
|
|
779
|
+
const mapped = {
|
|
780
|
+
...request,
|
|
781
|
+
span_start: moved(request.span_start),
|
|
782
|
+
span_end: moved(request.span_end),
|
|
783
|
+
};
|
|
784
|
+
replaceFileText(pick.file, original.slice(0, pick.start) + pick.text + original.slice(pick.end));
|
|
785
|
+
try {
|
|
786
|
+
const result = this.inferRecordingNames(mapped, extractionConfig);
|
|
787
|
+
this.log(`Typed ${request.file_path}:${request.line_number} (${request.infer_kind}) for loop element ` +
|
|
788
|
+
`${pick.index + 1} of ${pick.of}: ${request.route_path}`);
|
|
789
|
+
return result;
|
|
790
|
+
}
|
|
791
|
+
finally {
|
|
792
|
+
replaceFileText(pick.file, original);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
689
795
|
recordPrintedNames(result, request, prints) {
|
|
690
796
|
const sourceFile = this.getSourceFile(request.file_path);
|
|
691
797
|
if (!sourceFile)
|
|
@@ -1076,6 +1182,11 @@ export class TypeInferrer {
|
|
|
1076
1182
|
const returnTypeNode = func.getReturnTypeNode();
|
|
1077
1183
|
const isExplicit = returnTypeNode !== undefined;
|
|
1078
1184
|
let returnType = func.getReturnType();
|
|
1185
|
+
// carrick#2372: a handler that returns its executor's result answers only
|
|
1186
|
+
// the executor's returns its own arguments leave reachable.
|
|
1187
|
+
const byArguments = this.returnNarrowedByArguments(func, this.unwrapPromiseType(returnType));
|
|
1188
|
+
if (byArguments?.type)
|
|
1189
|
+
returnType = byArguments.type;
|
|
1079
1190
|
let typeString = typeText(returnType, func);
|
|
1080
1191
|
/** Reasons for any `any`/`unknown` this inference ends up publishing. */
|
|
1081
1192
|
let provenance;
|
|
@@ -1217,6 +1328,9 @@ export class TypeInferrer {
|
|
|
1217
1328
|
if (provenance && provenance.length > 0) {
|
|
1218
1329
|
inferred.any_provenance = provenance;
|
|
1219
1330
|
}
|
|
1331
|
+
if (byArguments && !byArguments.type && byArguments.tested.length > 0) {
|
|
1332
|
+
this.addArgumentReads(inferred, byArguments.tested);
|
|
1333
|
+
}
|
|
1220
1334
|
// The relation is asked only of the function the row's own line names.
|
|
1221
1335
|
// A locator that binds inside a callback of the handler (`user` in
|
|
1222
1336
|
// `this.users.find((user) => user.id === id)`) reaches this with that
|
|
@@ -1539,7 +1653,12 @@ export class TypeInferrer {
|
|
|
1539
1653
|
'the framework handed the handler; it states no body');
|
|
1540
1654
|
return null;
|
|
1541
1655
|
}
|
|
1542
|
-
|
|
1656
|
+
// carrick#2372: a located call into an executor the route shares answers
|
|
1657
|
+
// only the executor's returns this call's arguments leave reachable.
|
|
1658
|
+
const byArguments = Node.isCallExpression(payloadNode)
|
|
1659
|
+
? this.callNarrowedByArguments(payloadNode, this.unwrapPromiseType(payloadNode.getType()))
|
|
1660
|
+
: undefined;
|
|
1661
|
+
const payloadType = byArguments?.type ?? payloadNode.getType();
|
|
1543
1662
|
let typeString = typeText(payloadType, payloadNode);
|
|
1544
1663
|
const unwrapResult = this.unwrapTypeWithConfig(payloadType, payloadNode, extractionConfig);
|
|
1545
1664
|
if (unwrapResult.wasUnwrapped) {
|
|
@@ -1572,6 +1691,9 @@ export class TypeInferrer {
|
|
|
1572
1691
|
this.relateModelSymbol(request, inferred, [
|
|
1573
1692
|
unwrapResult.wasUnwrapped ? unwrapResult.payloadType : this.unwrapPromiseType(payloadType),
|
|
1574
1693
|
]);
|
|
1694
|
+
if (byArguments && !byArguments.type && byArguments.tested.length > 0) {
|
|
1695
|
+
this.addArgumentReads(inferred, byArguments.tested);
|
|
1696
|
+
}
|
|
1575
1697
|
return inferred;
|
|
1576
1698
|
}
|
|
1577
1699
|
/**
|
|
@@ -1957,7 +2079,7 @@ export class TypeInferrer {
|
|
|
1957
2079
|
return undefined;
|
|
1958
2080
|
branches = returnedBranches;
|
|
1959
2081
|
}
|
|
1960
|
-
|
|
2082
|
+
let survivors = [];
|
|
1961
2083
|
for (const branch of branches) {
|
|
1962
2084
|
const status = branch === locatedBranch ? siteStatus : this.responseSiteStatus(branch, true);
|
|
1963
2085
|
if (status === 'variable') {
|
|
@@ -1970,12 +2092,29 @@ export class TypeInferrer {
|
|
|
1970
2092
|
continue;
|
|
1971
2093
|
survivors.push(branch);
|
|
1972
2094
|
}
|
|
2095
|
+
// carrick#2372: the sends sit in an executor the route's handler calls,
|
|
2096
|
+
// and other routes may call it with other arguments. Keep only the sends
|
|
2097
|
+
// this route's arguments leave reachable.
|
|
2098
|
+
const registered = this.registrationAtLine(sourceFile, request.line_number)?.handler;
|
|
2099
|
+
const routeCall = registered && registered !== func ? callInto(registered, func) : undefined;
|
|
2100
|
+
let argumentReads = [];
|
|
2101
|
+
let narrowed = false;
|
|
2102
|
+
if (routeCall && survivors.length >= 2) {
|
|
2103
|
+
const narrowing = narrowByArguments(func, routeCall, survivors);
|
|
2104
|
+
argumentReads = narrowing.tested;
|
|
2105
|
+
if (narrowing.kept.length > 0 && narrowing.kept.length < survivors.length) {
|
|
2106
|
+
this.log(`Response sends at ${request.file_path}:${request.line_number} narrowed by the ` +
|
|
2107
|
+
`arguments the route passes its executor: ${narrowing.kept.length} of ${survivors.length} kept`);
|
|
2108
|
+
survivors = narrowing.kept;
|
|
2109
|
+
narrowed = true;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
1973
2112
|
// carrick#2463 (D2): an untied row claims "no success payload" only when
|
|
1974
2113
|
// the function it reads keeps a send after the error sends are dropped.
|
|
1975
2114
|
if (!tied && survivors.length === 0)
|
|
1976
2115
|
return undefined;
|
|
1977
2116
|
const locatedDropped = dropped(siteStatus);
|
|
1978
|
-
if (!locatedDropped && survivors.length <= 1)
|
|
2117
|
+
if (!locatedDropped && survivors.length <= 1 && !narrowed)
|
|
1979
2118
|
return undefined;
|
|
1980
2119
|
const recovered = survivors.length > 0
|
|
1981
2120
|
? this.recoverPayloadFromResponseExpressions(survivors, false, this.wireFormatFor(request))
|
|
@@ -1984,7 +2123,7 @@ export class TypeInferrer {
|
|
|
1984
2123
|
if (recovered) {
|
|
1985
2124
|
this.log(`Response locator at ${request.file_path}:${request.line_number} names an error ` +
|
|
1986
2125
|
'or redirect send; publishing the success sends of its handler instead');
|
|
1987
|
-
return this.inferredFromRecoveredPayload(request, recovered);
|
|
2126
|
+
return this.withArgumentReads(this.inferredFromRecoveredPayload(request, recovered), recovered, argumentReads);
|
|
1988
2127
|
}
|
|
1989
2128
|
this.log(`Response locator at ${request.file_path}:${request.line_number} names an error ` +
|
|
1990
2129
|
'or redirect send and its handler sends no success body; abstaining');
|
|
@@ -1996,11 +2135,92 @@ export class TypeInferrer {
|
|
|
1996
2135
|
'or carries no body a JSON contract can describe, so it publishes no success body',
|
|
1997
2136
|
});
|
|
1998
2137
|
}
|
|
1999
|
-
if (recovered && recovered.nodes.some((node) => contains(site, node))) {
|
|
2000
|
-
return this.inferredFromRecoveredPayload(request, recovered);
|
|
2138
|
+
if (recovered && (narrowed || recovered.nodes.some((node) => contains(site, node)))) {
|
|
2139
|
+
return this.withArgumentReads(this.inferredFromRecoveredPayload(request, recovered), recovered, argumentReads);
|
|
2001
2140
|
}
|
|
2002
2141
|
return undefined;
|
|
2003
2142
|
}
|
|
2143
|
+
/**
|
|
2144
|
+
* carrick#2372: what `func` returns when it returns one call into a
|
|
2145
|
+
* function of the program: see `callNarrowedByArguments`.
|
|
2146
|
+
*/
|
|
2147
|
+
returnNarrowedByArguments(func, awaited) {
|
|
2148
|
+
const returned = this.returnedExpressions(func);
|
|
2149
|
+
if (returned.length !== 1)
|
|
2150
|
+
return undefined;
|
|
2151
|
+
let expression = this.peelTransparentExpression(returned[0]);
|
|
2152
|
+
if (Node.isAwaitExpression(expression))
|
|
2153
|
+
expression = this.peelTransparentExpression(expression.getExpression());
|
|
2154
|
+
if (!Node.isCallExpression(expression))
|
|
2155
|
+
return undefined;
|
|
2156
|
+
return this.callNarrowedByArguments(expression, awaited, func);
|
|
2157
|
+
}
|
|
2158
|
+
/**
|
|
2159
|
+
* carrick#2372: the one member of `awaited` (the awaited result type of
|
|
2160
|
+
* `call`) the called function's returns can give for the arguments `call`
|
|
2161
|
+
* passes, and the parameters the callee tests that those arguments state.
|
|
2162
|
+
* `undefined` when `call` runs no function of the program (or runs
|
|
2163
|
+
* `caller` itself), or its result is not a union.
|
|
2164
|
+
*
|
|
2165
|
+
* Each kept return is matched to the union members it is assignable to; a
|
|
2166
|
+
* return that matches none (another union, a call) keeps every member, as
|
|
2167
|
+
* does a narrowing that leaves more than one member.
|
|
2168
|
+
*/
|
|
2169
|
+
callNarrowedByArguments(call, awaited, caller) {
|
|
2170
|
+
if (!awaited.isUnion())
|
|
2171
|
+
return undefined;
|
|
2172
|
+
const callee = calledFunction(call);
|
|
2173
|
+
if (!callee || callee === caller)
|
|
2174
|
+
return undefined;
|
|
2175
|
+
const bodies = this.returnedExpressions(callee).flatMap((body) => this.expandResponseBranches(body, 0));
|
|
2176
|
+
if (bodies.length === 0)
|
|
2177
|
+
return undefined;
|
|
2178
|
+
const narrowing = narrowByArguments(callee, call, bodies);
|
|
2179
|
+
const unchanged = { tested: narrowing.tested };
|
|
2180
|
+
if (narrowing.kept.length === 0 || narrowing.kept.length === bodies.length)
|
|
2181
|
+
return unchanged;
|
|
2182
|
+
const checker = this.project.getTypeChecker().compilerObject;
|
|
2183
|
+
const members = awaited.getUnionTypes();
|
|
2184
|
+
const kept = new Set();
|
|
2185
|
+
for (const body of narrowing.kept) {
|
|
2186
|
+
const bodyType = this.unwrapPromiseType(body.getType());
|
|
2187
|
+
const matches = members.filter((member) => checker.isTypeAssignableTo(bodyType.compilerType, member.compilerType));
|
|
2188
|
+
if (matches.length === 0)
|
|
2189
|
+
return unchanged;
|
|
2190
|
+
for (const member of matches)
|
|
2191
|
+
kept.add(member);
|
|
2192
|
+
}
|
|
2193
|
+
if (kept.size !== 1)
|
|
2194
|
+
return unchanged;
|
|
2195
|
+
const [type] = kept;
|
|
2196
|
+
this.log(`Call at ${call.getSourceFile().getFilePath()}:${call.getStartLineNumber()} narrowed by the ` +
|
|
2197
|
+
`arguments it passes: ${narrowing.kept.length} of ${bodies.length} returns kept`);
|
|
2198
|
+
return { type, tested: narrowing.tested };
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* carrick#2372: a union read from an executor whose bodies depend on
|
|
2202
|
+
* arguments the route passes, where those arguments could not tell the
|
|
2203
|
+
* bodies apart. Each such parameter is listed as an `argument` read, so a
|
|
2204
|
+
* mismatch against the union is not reported as this route's: no call can
|
|
2205
|
+
* say which body the route sends.
|
|
2206
|
+
*/
|
|
2207
|
+
withArgumentReads(inferred, recovered, reads) {
|
|
2208
|
+
if (reads.length === 0 || (recovered?.readTypes?.length ?? 0) < 2)
|
|
2209
|
+
return inferred;
|
|
2210
|
+
return this.addArgumentReads(inferred, reads);
|
|
2211
|
+
}
|
|
2212
|
+
addArgumentReads(inferred, reads) {
|
|
2213
|
+
const merged = new Map();
|
|
2214
|
+
for (const read of inferred.response_modes?.reads ?? [])
|
|
2215
|
+
merged.set(`${read.location}\u0000${read.field}`, read);
|
|
2216
|
+
for (const field of reads)
|
|
2217
|
+
merged.set(`argument\u0000${field}`, { location: 'argument', field });
|
|
2218
|
+
const sorted = [...merged.values()].sort((a, b) => a.location === b.location ? a.field.localeCompare(b.field) : a.location.localeCompare(b.location));
|
|
2219
|
+
// Cases read off the incoming message no longer pick one body: an
|
|
2220
|
+
// argument the route passes also decides it.
|
|
2221
|
+
inferred.response_modes = { reads: sorted };
|
|
2222
|
+
return inferred;
|
|
2223
|
+
}
|
|
2004
2224
|
/**
|
|
2005
2225
|
* The response sends `func` makes as statements (`res.status(409).json(e);`),
|
|
2006
2226
|
* for a handler that sends through a parameter and returns nothing. Only the
|
|
@@ -882,6 +882,14 @@ export interface InferRequestItem {
|
|
|
882
882
|
* part that holds the response body. Read for `call_result`.
|
|
883
883
|
*/
|
|
884
884
|
result?: ResultLabel;
|
|
885
|
+
/**
|
|
886
|
+
* carrick#1029: the route row's own path, sent on a `response_body`,
|
|
887
|
+
* `function_return` or `request_body` request when the row's line serves
|
|
888
|
+
* more than one route. A
|
|
889
|
+
* handler registered once per element of a constant list is typed for the
|
|
890
|
+
* element this path names (`loop-element.ts`).
|
|
891
|
+
*/
|
|
892
|
+
route_path?: string;
|
|
885
893
|
}
|
|
886
894
|
/**
|
|
887
895
|
* Response status
|
|
@@ -77,6 +77,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
|
|
|
77
77
|
}, {
|
|
78
78
|
parse: string;
|
|
79
79
|
}>]>>;
|
|
80
|
+
route_path: z.ZodOptional<z.ZodString>;
|
|
80
81
|
}, "strip", z.ZodTypeAny, {
|
|
81
82
|
file_path: string;
|
|
82
83
|
line_number: number;
|
|
@@ -95,6 +96,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
|
|
|
95
96
|
span_end?: number | undefined;
|
|
96
97
|
expression_text?: string | undefined;
|
|
97
98
|
expression_line?: number | undefined;
|
|
99
|
+
route_path?: string | undefined;
|
|
98
100
|
}, {
|
|
99
101
|
file_path: string;
|
|
100
102
|
line_number: number;
|
|
@@ -113,6 +115,7 @@ export declare const InferRequestItemSchema: z.ZodObject<{
|
|
|
113
115
|
span_end?: number | undefined;
|
|
114
116
|
expression_text?: string | undefined;
|
|
115
117
|
expression_line?: number | undefined;
|
|
118
|
+
route_path?: string | undefined;
|
|
116
119
|
}>;
|
|
117
120
|
/**
|
|
118
121
|
* Per-item locator validation for infer requests.
|
|
@@ -778,6 +781,7 @@ export declare const InferRequestSchema: z.ZodObject<{
|
|
|
778
781
|
}, {
|
|
779
782
|
parse: string;
|
|
780
783
|
}>]>>;
|
|
784
|
+
route_path: z.ZodOptional<z.ZodString>;
|
|
781
785
|
}, "strip", z.ZodTypeAny, {
|
|
782
786
|
file_path: string;
|
|
783
787
|
line_number: number;
|
|
@@ -796,6 +800,7 @@ export declare const InferRequestSchema: z.ZodObject<{
|
|
|
796
800
|
span_end?: number | undefined;
|
|
797
801
|
expression_text?: string | undefined;
|
|
798
802
|
expression_line?: number | undefined;
|
|
803
|
+
route_path?: string | undefined;
|
|
799
804
|
}, {
|
|
800
805
|
file_path: string;
|
|
801
806
|
line_number: number;
|
|
@@ -814,6 +819,7 @@ export declare const InferRequestSchema: z.ZodObject<{
|
|
|
814
819
|
span_end?: number | undefined;
|
|
815
820
|
expression_text?: string | undefined;
|
|
816
821
|
expression_line?: number | undefined;
|
|
822
|
+
route_path?: string | undefined;
|
|
817
823
|
}>, "many">;
|
|
818
824
|
extraction_config: z.ZodOptional<z.ZodObject<{
|
|
819
825
|
rules: z.ZodArray<z.ZodObject<{
|
|
@@ -912,6 +918,7 @@ export declare const InferRequestSchema: z.ZodObject<{
|
|
|
912
918
|
span_end?: number | undefined;
|
|
913
919
|
expression_text?: string | undefined;
|
|
914
920
|
expression_line?: number | undefined;
|
|
921
|
+
route_path?: string | undefined;
|
|
915
922
|
}[];
|
|
916
923
|
extraction_config?: {
|
|
917
924
|
rules: {
|
|
@@ -956,6 +963,7 @@ export declare const InferRequestSchema: z.ZodObject<{
|
|
|
956
963
|
span_end?: number | undefined;
|
|
957
964
|
expression_text?: string | undefined;
|
|
958
965
|
expression_line?: number | undefined;
|
|
966
|
+
route_path?: string | undefined;
|
|
959
967
|
}[];
|
|
960
968
|
extraction_config?: {
|
|
961
969
|
rules: {
|
|
@@ -4322,6 +4330,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
4322
4330
|
}, {
|
|
4323
4331
|
parse: string;
|
|
4324
4332
|
}>]>>;
|
|
4333
|
+
route_path: z.ZodOptional<z.ZodString>;
|
|
4325
4334
|
}, "strip", z.ZodTypeAny, {
|
|
4326
4335
|
file_path: string;
|
|
4327
4336
|
line_number: number;
|
|
@@ -4340,6 +4349,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
4340
4349
|
span_end?: number | undefined;
|
|
4341
4350
|
expression_text?: string | undefined;
|
|
4342
4351
|
expression_line?: number | undefined;
|
|
4352
|
+
route_path?: string | undefined;
|
|
4343
4353
|
}, {
|
|
4344
4354
|
file_path: string;
|
|
4345
4355
|
line_number: number;
|
|
@@ -4358,6 +4368,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
4358
4368
|
span_end?: number | undefined;
|
|
4359
4369
|
expression_text?: string | undefined;
|
|
4360
4370
|
expression_line?: number | undefined;
|
|
4371
|
+
route_path?: string | undefined;
|
|
4361
4372
|
}>, "many">;
|
|
4362
4373
|
extraction_config: z.ZodOptional<z.ZodObject<{
|
|
4363
4374
|
rules: z.ZodArray<z.ZodObject<{
|
|
@@ -4456,6 +4467,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
4456
4467
|
span_end?: number | undefined;
|
|
4457
4468
|
expression_text?: string | undefined;
|
|
4458
4469
|
expression_line?: number | undefined;
|
|
4470
|
+
route_path?: string | undefined;
|
|
4459
4471
|
}[];
|
|
4460
4472
|
extraction_config?: {
|
|
4461
4473
|
rules: {
|
|
@@ -4500,6 +4512,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
4500
4512
|
span_end?: number | undefined;
|
|
4501
4513
|
expression_text?: string | undefined;
|
|
4502
4514
|
expression_line?: number | undefined;
|
|
4515
|
+
route_path?: string | undefined;
|
|
4503
4516
|
}[];
|
|
4504
4517
|
extraction_config?: {
|
|
4505
4518
|
rules: {
|
|
@@ -106,6 +106,8 @@ export const InferRequestItemSchema = z.object({
|
|
|
106
106
|
member: z.string().optional(),
|
|
107
107
|
// The library store's label for the call's result (carrick#2818).
|
|
108
108
|
result: ResultLabelSchema.optional(),
|
|
109
|
+
// The route row's own path, sent where its line serves several (carrick#1029).
|
|
110
|
+
route_path: z.string().min(1).optional(),
|
|
109
111
|
});
|
|
110
112
|
/**
|
|
111
113
|
* Per-item locator validation for infer requests.
|