@suss/extractor 0.34.0 → 0.35.0
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/dist/index.cjs +1101 -207
- package/dist/index.d.cts +323 -23
- package/dist/index.d.ts +323 -23
- package/dist/index.js +1085 -201
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, MessageBusSemantics, DeployableUnit, CodeUnitKind, RequestSpellingMetadata, BehavioralSummary, Predicate, ValueRef,
|
|
1
|
+
import { Effect, MessageBusSemantics, DeployableUnit, CodeUnitKind, RequestSpellingMetadata, BehavioralSummary, TypeShape, Predicate, ValueRef, RenderNode, ProvenanceSlot, BoundaryBinding, WrapperReference, TestMetadata, GraphqlDeclaredContract, ConfidenceInfo, Transition, Gap, Input, Output } from '@suss/behavioral-ir';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -390,11 +390,32 @@ type DiscoveryMatch = {
|
|
|
390
390
|
* `defaultStatusCodes`.
|
|
391
391
|
*/
|
|
392
392
|
statusCodeDecorator?: string;
|
|
393
|
+
/**
|
|
394
|
+
* The number each of a library's own status constants is, by the
|
|
395
|
+
* path of the export (`HttpStatus.NO_CONTENT`), for when the
|
|
396
|
+
* library is not installed and its declaration cannot give them.
|
|
397
|
+
* `importModule` says which module exports them.
|
|
398
|
+
*/
|
|
399
|
+
statusCodeConstants?: Record<string, number>;
|
|
393
400
|
/**
|
|
394
401
|
* The call that puts one path in front of every route the
|
|
395
402
|
* application serves, NestJS's `app.setGlobalPrefix("api")`.
|
|
396
403
|
*/
|
|
397
404
|
globalPrefix?: GlobalPrefixCall;
|
|
405
|
+
/**
|
|
406
|
+
* How a route states an API version and how the application serves
|
|
407
|
+
* one, NestJS's `@Controller({ version })` with
|
|
408
|
+
* `app.enableVersioning()`.
|
|
409
|
+
*/
|
|
410
|
+
versioning?: RouteVersioning;
|
|
411
|
+
/**
|
|
412
|
+
* Decorators, on the route's method or its class, that list a
|
|
413
|
+
* status the route can respond with, such as `@nestjs/swagger`'s
|
|
414
|
+
* `@ApiNotFoundResponse()`. A generated spec declares these
|
|
415
|
+
* statuses because of the decorators, so a check does not expect a
|
|
416
|
+
* path to produce them.
|
|
417
|
+
*/
|
|
418
|
+
declaredStatuses?: DeclaredStatusDecorators;
|
|
398
419
|
} | {
|
|
399
420
|
/**
|
|
400
421
|
* A `for-of` loop over a literal array of route specs, read as one
|
|
@@ -675,6 +696,14 @@ type BindingExtraction = {
|
|
|
675
696
|
} | {
|
|
676
697
|
type: "fromClientMethod";
|
|
677
698
|
};
|
|
699
|
+
/**
|
|
700
|
+
* Which argument is the request's options object, for a call that
|
|
701
|
+
* takes one: fetch's second argument, the config axios takes after the
|
|
702
|
+
* URL or after the body. The pack's `redirectOption` is read off it.
|
|
703
|
+
*/
|
|
704
|
+
options?: {
|
|
705
|
+
position: number;
|
|
706
|
+
};
|
|
678
707
|
};
|
|
679
708
|
/**
|
|
680
709
|
* Where a declared channel's spelling comes from.
|
|
@@ -793,6 +822,61 @@ interface GlobalPrefixCall {
|
|
|
793
822
|
methods: Record<number, string>;
|
|
794
823
|
};
|
|
795
824
|
}
|
|
825
|
+
/** Decorators that list a status a route can respond with. */
|
|
826
|
+
interface DeclaredStatusDecorators {
|
|
827
|
+
/** The modules the decorators are imported from. */
|
|
828
|
+
importModule: string | string[];
|
|
829
|
+
/**
|
|
830
|
+
* The status each decorator declares, or null for one that reads the
|
|
831
|
+
* status from `statusKey` in its options object, `@ApiResponse({ status })`.
|
|
832
|
+
*/
|
|
833
|
+
decorators: Readonly<Record<string, number | null>>;
|
|
834
|
+
statusKey: string;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Where an application puts the version a route serves. `path` puts it
|
|
838
|
+
* in the URL as a segment. `outsidePath` reads it from somewhere else
|
|
839
|
+
* in the request, such as a header, so every version of a route shares
|
|
840
|
+
* one path.
|
|
841
|
+
*/
|
|
842
|
+
type VersionPlacement = "path" | "outsidePath";
|
|
843
|
+
/**
|
|
844
|
+
* API versions on decorated routes. A route serves the versions its own
|
|
845
|
+
* method decorator states, or else the ones its class decorator's
|
|
846
|
+
* options state, or else the application's default. The application
|
|
847
|
+
* ignores every version until a call on it turns versioning on.
|
|
848
|
+
*/
|
|
849
|
+
interface RouteVersioning {
|
|
850
|
+
/** The key in the class decorator's options object, NestJS's `version`. */
|
|
851
|
+
option: string;
|
|
852
|
+
/** A method decorator imported from `importModule` that sets one route's version, NestJS's `Version`. */
|
|
853
|
+
decorator: string;
|
|
854
|
+
/** The export from `importModule` that means every version, NestJS's `VERSION_NEUTRAL`. */
|
|
855
|
+
neutral: string;
|
|
856
|
+
/** The call on the application that turns versioning on, NestJS's `enableVersioning`. */
|
|
857
|
+
call: Pick<GlobalPrefixCall, "method" | "application">;
|
|
858
|
+
/** The key in the call's options that says the placement. */
|
|
859
|
+
typeKey: string;
|
|
860
|
+
/**
|
|
861
|
+
* The placement each of the library's constants means, by the path of
|
|
862
|
+
* the export (`VersioningType.URI`), and by the number the constant is
|
|
863
|
+
* equal to when the library is installed.
|
|
864
|
+
*/
|
|
865
|
+
types: Readonly<Record<string, VersionPlacement>>;
|
|
866
|
+
typeNumbers: Readonly<Record<number, VersionPlacement>>;
|
|
867
|
+
/** The placement when the call takes no options at all. */
|
|
868
|
+
defaultType: VersionPlacement;
|
|
869
|
+
/**
|
|
870
|
+
* The key for the text put before a version in the path, and the text
|
|
871
|
+
* when the options leave it out. `false` there means no text at all.
|
|
872
|
+
*/
|
|
873
|
+
pathPrefix: {
|
|
874
|
+
key: string;
|
|
875
|
+
default: string;
|
|
876
|
+
};
|
|
877
|
+
/** The key for the versions a route that states none serves. */
|
|
878
|
+
defaultVersionKey: string;
|
|
879
|
+
}
|
|
796
880
|
/** A wrapper handed to the routable's constructor as an option. */
|
|
797
881
|
interface WrapperOptionRegistration extends WrapperFunctionShape {
|
|
798
882
|
/** The option the wrapper is under, e.g. "defaultHook". */
|
|
@@ -924,6 +1008,12 @@ type TerminalMatch = {
|
|
|
924
1008
|
*/
|
|
925
1009
|
type: "parameterCall";
|
|
926
1010
|
parameterPosition: number;
|
|
1011
|
+
/**
|
|
1012
|
+
* The parameter belongs to the function this unit is written
|
|
1013
|
+
* inside, the way a wrapper factory's closure calls the handler
|
|
1014
|
+
* the factory was given.
|
|
1015
|
+
*/
|
|
1016
|
+
ofEnclosingFunction?: boolean;
|
|
927
1017
|
};
|
|
928
1018
|
interface TerminalExtraction {
|
|
929
1019
|
statusCode?: {
|
|
@@ -1100,6 +1190,18 @@ type ResponsePropertyMeaning = {
|
|
|
1100
1190
|
};
|
|
1101
1191
|
/** Whether a refused request comes back as a response or as an exception. */
|
|
1102
1192
|
type FailureDelivery = "response" | "exception";
|
|
1193
|
+
/** Whether the client follows a redirect itself or hands the 3xx to the caller. */
|
|
1194
|
+
type RedirectDelivery = "followed" | "response";
|
|
1195
|
+
/**
|
|
1196
|
+
* The request option that decides, for one call, whether the client
|
|
1197
|
+
* follows a redirect: `redirect` for fetch, `maxRedirects` for axios,
|
|
1198
|
+
* `allow_redirects` for requests. A call that sets it to one of
|
|
1199
|
+
* `handsBack` gets the 3xx, and any other value it settles on follows.
|
|
1200
|
+
*/
|
|
1201
|
+
interface RedirectOption {
|
|
1202
|
+
name: string;
|
|
1203
|
+
handsBack: ReadonlyArray<string | number | boolean>;
|
|
1204
|
+
}
|
|
1103
1205
|
interface ResponsePropertyMapping {
|
|
1104
1206
|
/** Property or method name on the response (e.g. "ok", "status", "json") */
|
|
1105
1207
|
name: string;
|
|
@@ -1221,6 +1323,15 @@ interface PatternPack {
|
|
|
1221
1323
|
* `"response"`.
|
|
1222
1324
|
*/
|
|
1223
1325
|
failureDelivery?: FailureDelivery;
|
|
1326
|
+
/**
|
|
1327
|
+
* What this client does with a redirect by default. `fetch` and axios
|
|
1328
|
+
* follow it, so the caller only ever sees the response at the end of
|
|
1329
|
+
* the chain. httpx and Faraday hand the 3xx back. Defaults to
|
|
1330
|
+
* `"response"`.
|
|
1331
|
+
*/
|
|
1332
|
+
redirectDelivery?: RedirectDelivery;
|
|
1333
|
+
/** The option one call sets to change `redirectDelivery` for itself. */
|
|
1334
|
+
redirectOption?: RedirectOption;
|
|
1224
1335
|
/**
|
|
1225
1336
|
* Build extra code units from a parent unit's body, for callbacks the
|
|
1226
1337
|
* runtime schedules that are not top-level declarations: React event
|
|
@@ -1967,6 +2078,70 @@ declare function runsBefore(effectLine: number, terminalEndLine: number): boolea
|
|
|
1967
2078
|
*/
|
|
1968
2079
|
declare function markReturnsAsExitCode(summaries: readonly BehavioralSummary[], returnsTheCode: ReadonlySet<string>, workspaceRoot?: string): void;
|
|
1969
2080
|
|
|
2081
|
+
/**
|
|
2082
|
+
* Splices a project helper's paths into the caller that handed it a
|
|
2083
|
+
* value, so a client caller that leaves its status test to a helper
|
|
2084
|
+
* still shows which statuses it handles.
|
|
2085
|
+
*
|
|
2086
|
+
* resp = requests.get(url)
|
|
2087
|
+
* return check_response(resp)
|
|
2088
|
+
*
|
|
2089
|
+
* Each adapter finds the call, reads the helper's paths with the
|
|
2090
|
+
* caller's terminals, and says which parameter got which value. Splitting
|
|
2091
|
+
* the caller's branch along those paths is the same in every language,
|
|
2092
|
+
* so it lives here.
|
|
2093
|
+
*/
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Past this many paths a helper is doing more than reading a response,
|
|
2097
|
+
* and multiplying every caller path by it would bury the caller's own.
|
|
2098
|
+
*/
|
|
2099
|
+
declare const MAX_HELPER_PATHS = 16;
|
|
2100
|
+
/**
|
|
2101
|
+
* The caller's branch split along each path of the helper called at
|
|
2102
|
+
* `at`. A throw or an exit in the helper ends the caller at the call,
|
|
2103
|
+
* and a path that returns goes on to the caller's own ending.
|
|
2104
|
+
*/
|
|
2105
|
+
declare function throughHelper(branch: RawBranch, at: {
|
|
2106
|
+
start: number;
|
|
2107
|
+
end: number;
|
|
2108
|
+
}, helperBranches: readonly RawBranch[]): RawBranch[];
|
|
2109
|
+
/**
|
|
2110
|
+
* The fields two readers of one response read between them, as the
|
|
2111
|
+
* records of field names a branch's `expectedInput` lists.
|
|
2112
|
+
*/
|
|
2113
|
+
declare function mergeReadShapes(a: TypeShape | null, b: TypeShape | null): TypeShape | null;
|
|
2114
|
+
/** One call in a caller's body that hands a helper the response, in source order. */
|
|
2115
|
+
interface HandOffSite {
|
|
2116
|
+
/** The helper's paths, in the caller's terms. */
|
|
2117
|
+
helper: readonly RawBranch[];
|
|
2118
|
+
preconditions?: readonly RawCondition[] | undefined;
|
|
2119
|
+
/** The line the statement holding the call starts on, which decides whether a branch reaches it. */
|
|
2120
|
+
line: number;
|
|
2121
|
+
/** The lines the call is written on. */
|
|
2122
|
+
at: {
|
|
2123
|
+
start: number;
|
|
2124
|
+
end: number;
|
|
2125
|
+
};
|
|
2126
|
+
/** A call in a `finally` runs on every path, even one that left before it. */
|
|
2127
|
+
alwaysRuns?: boolean;
|
|
2128
|
+
}
|
|
2129
|
+
/**
|
|
2130
|
+
* The branch split at each hand-off on it, in source order. A path that
|
|
2131
|
+
* ended in one helper goes no further, so the hand-offs after it are not
|
|
2132
|
+
* asked about on that path.
|
|
2133
|
+
*/
|
|
2134
|
+
declare function splitAtHandOffs(branch: RawBranch, sites: readonly HandOffSite[], from?: number): RawBranch[];
|
|
2135
|
+
/**
|
|
2136
|
+
* A helper's paths with each test on a parameter it was handed turned
|
|
2137
|
+
* into a test on the caller's variable, keyed parameter to variable.
|
|
2138
|
+
* Null when no path tests what it was handed, or when there are too many
|
|
2139
|
+
* paths to splice. This is for an adapter that writes a variable's value
|
|
2140
|
+
* as a dependency on the variable's name, the way the caller's own tests
|
|
2141
|
+
* on it are written.
|
|
2142
|
+
*/
|
|
2143
|
+
declare function helperPathsOnVariables(helperBranches: readonly RawBranch[], passed: ReadonlyMap<string, string>): RawBranch[] | null;
|
|
2144
|
+
|
|
1970
2145
|
/**
|
|
1971
2146
|
* Writes `metadata.moduleImports` on a set of summaries.
|
|
1972
2147
|
*
|
|
@@ -2201,7 +2376,17 @@ interface StructuredPathConditionsInput<Cond, Terminal> {
|
|
|
2201
2376
|
* where a terminal is.
|
|
2202
2377
|
*/
|
|
2203
2378
|
terminalsByStmt: ReadonlyMap<StructuredStatement<Cond>, readonly Terminal[]>;
|
|
2379
|
+
/**
|
|
2380
|
+
* The tests whose arms go on as separate paths after they rejoin, so
|
|
2381
|
+
* a terminal later in the body is reached once under each arm. A
|
|
2382
|
+
* client's caller keeps the arms of a test on the response status,
|
|
2383
|
+
* since which statuses it handles is the point of reading it, even
|
|
2384
|
+
* when neither arm returns. Every other test is merged away as usual.
|
|
2385
|
+
*/
|
|
2386
|
+
keepsArms?: KeepsArms<Cond>;
|
|
2204
2387
|
}
|
|
2388
|
+
/** Whether the arms of the test written as this condition go on as separate paths. */
|
|
2389
|
+
type KeepsArms<Cond> = (condition: Cond) => boolean;
|
|
2205
2390
|
interface StructuredPathConditionsResult<Cond, Terminal> {
|
|
2206
2391
|
/** The paths to each terminal, keyed by the caller's own terminal handle. */
|
|
2207
2392
|
byTerminal: Map<Terminal, ConditionInfo<Cond>[][]>;
|
|
@@ -2305,13 +2490,12 @@ declare class EnclosingNodes<T extends ParsedNode<T>> {
|
|
|
2305
2490
|
* more places for a statement than anyone remembers to list. So an adapter
|
|
2306
2491
|
* does not list the containers to descend into. The walk visits every
|
|
2307
2492
|
* named child, and the adapter only lists the nodes whose body belongs to
|
|
2308
|
-
* what they declare, because that list is short
|
|
2309
|
-
*
|
|
2493
|
+
* what they declare, because that list is short.
|
|
2494
|
+
*
|
|
2495
|
+
* The adapter also says how to read a node's children. Its parser's own
|
|
2496
|
+
* getters keep the array they build on the node, so each adapter reads
|
|
2497
|
+
* children through one accessor of its own that leaves nothing behind.
|
|
2310
2498
|
*/
|
|
2311
|
-
/** The one thing the walk needs from a parse tree node. */
|
|
2312
|
-
interface WalkableNode<T> {
|
|
2313
|
-
readonly namedChildren: ReadonlyArray<T | null>;
|
|
2314
|
-
}
|
|
2315
2499
|
/**
|
|
2316
2500
|
* Returned by `into` for a node whose children the walk should leave
|
|
2317
2501
|
* unread, such as one whose body belongs to what it declares. It is a
|
|
@@ -2325,12 +2509,14 @@ interface NodeVisitor<T, C> {
|
|
|
2325
2509
|
/** What to carry into this node's children, or `SKIP_CHILDREN` to leave them unread. */
|
|
2326
2510
|
into(node: T, carried: C): C | typeof SKIP_CHILDREN;
|
|
2327
2511
|
}
|
|
2512
|
+
/** A node's named children in source order, read by the adapter's own accessor. */
|
|
2513
|
+
type ChildrenOf<T> = (node: T) => readonly T[];
|
|
2328
2514
|
/**
|
|
2329
2515
|
* Every named node under `root`, depth first and in source order, with a
|
|
2330
2516
|
* value the visitor updates as the walk descends. `root` itself is not
|
|
2331
2517
|
* visited, because a caller starts from the body it is reading.
|
|
2332
2518
|
*/
|
|
2333
|
-
declare function walkDescendants<T
|
|
2519
|
+
declare function walkDescendants<T, C>(root: T, carried: C, childrenOf: ChildrenOf<T>, visitor: NodeVisitor<T, C>): void;
|
|
2334
2520
|
|
|
2335
2521
|
/**
|
|
2336
2522
|
* The project root when nothing declares one.
|
|
@@ -2342,6 +2528,15 @@ declare function walkDescendants<T extends WalkableNode<T>, C>(root: T, carried:
|
|
|
2342
2528
|
/** The deepest directory containing every file, or undefined when they share no absolute root. */
|
|
2343
2529
|
declare function commonDirectoryOf(files: ReadonlyArray<string>): string | undefined;
|
|
2344
2530
|
|
|
2531
|
+
/**
|
|
2532
|
+
* What a client call does with a redirect once the adapter has read the
|
|
2533
|
+
* value the call gives the pack's redirect option. Each adapter reads
|
|
2534
|
+
* the value in its own language, and all of them decide the same way.
|
|
2535
|
+
*/
|
|
2536
|
+
|
|
2537
|
+
/** `"response"` when the value is one that hands the 3xx back, and `"followed"` otherwise. */
|
|
2538
|
+
declare function redirectDeliveryWhenSet(option: RedirectOption, value: string | number | boolean): RedirectDelivery;
|
|
2539
|
+
|
|
2345
2540
|
/**
|
|
2346
2541
|
* Which files a test pack reads. `suss extract --intent` hands a test
|
|
2347
2542
|
* pack the files the PRDs list under `coveredBy`, written the way the
|
|
@@ -2416,17 +2611,45 @@ interface LanguageAdapter {
|
|
|
2416
2611
|
extractAll(): Promise<BehavioralSummary[]>;
|
|
2417
2612
|
}
|
|
2418
2613
|
|
|
2614
|
+
/**
|
|
2615
|
+
* The code hash a cache key uses for an adapter or a pack: a hash of its
|
|
2616
|
+
* built file and of every file that file loads from suss's own packages.
|
|
2617
|
+
*
|
|
2618
|
+
* An adapter runs the value evaluator and the resolution rules, and a pack
|
|
2619
|
+
* runs the compiler for its declarations, so the hash follows the import
|
|
2620
|
+
* statements in the built files outward and a rebuild of any package it
|
|
2621
|
+
* reaches changes it. A chunk the bundler split out is a relative import
|
|
2622
|
+
* and is followed too. Imports of other libraries are not followed.
|
|
2623
|
+
*
|
|
2624
|
+
* A package is resolved from the file that imports it, with the export
|
|
2625
|
+
* conditions of that import, so the hash covers the build the process
|
|
2626
|
+
* loaded and not its CommonJS twin.
|
|
2627
|
+
*/
|
|
2628
|
+
interface CodeHasher {
|
|
2629
|
+
/** The files the code hash reads for `entryFile`, that file first. */
|
|
2630
|
+
codeFiles(entryFile: string): string[];
|
|
2631
|
+
/** Empty when `entryFile` cannot be read, the same as a run from source. */
|
|
2632
|
+
codeHash(entryFile: string): string;
|
|
2633
|
+
}
|
|
2634
|
+
/** A hasher reads each file once and keeps what it found. */
|
|
2635
|
+
declare function createCodeHasher(): CodeHasher;
|
|
2636
|
+
/**
|
|
2637
|
+
* The hasher an adapter and the packs of one process share. A process
|
|
2638
|
+
* loads each module once, so what it read stays true for the process.
|
|
2639
|
+
*/
|
|
2640
|
+
declare const processCodeHasher: CodeHasher;
|
|
2641
|
+
|
|
2419
2642
|
/**
|
|
2420
2643
|
* The language-neutral half of an adapter's cache key.
|
|
2421
2644
|
*
|
|
2422
2645
|
* Each adapter calls `createAdapterStamp` once, with its own
|
|
2423
2646
|
* `import.meta.url` and its hand-bumped version, and keeps the result for
|
|
2424
2647
|
* the life of the process. The stamp hashes the adapter's dist file and
|
|
2425
|
-
* every
|
|
2426
|
-
*
|
|
2427
|
-
*
|
|
2428
|
-
*
|
|
2429
|
-
*
|
|
2648
|
+
* every file it loads from suss's own packages, found by following its
|
|
2649
|
+
* imports. A release that changes any of them invalidates an older cache,
|
|
2650
|
+
* and so does a local rebuild, with no version bump. Running from source
|
|
2651
|
+
* leaves no dist file to hash, so that mode turns the cache off. This
|
|
2652
|
+
* package's DESIGN.md describes the cache.
|
|
2430
2653
|
*/
|
|
2431
2654
|
|
|
2432
2655
|
/**
|
|
@@ -2470,11 +2693,11 @@ declare function createAdapterStamp(config: {
|
|
|
2470
2693
|
version: string;
|
|
2471
2694
|
}): AdapterStamp;
|
|
2472
2695
|
/**
|
|
2473
|
-
* The hash for a bundle directory: the bundle itself plus every
|
|
2474
|
-
*
|
|
2696
|
+
* The hash for a bundle directory: the bundle itself plus every file it
|
|
2697
|
+
* loads from suss's packages. Empty when the directory has no bundle in
|
|
2475
2698
|
* it, as happens when running from source.
|
|
2476
2699
|
*/
|
|
2477
|
-
declare function computeDistHashFrom(dir: string): string;
|
|
2700
|
+
declare function computeDistHashFrom(dir: string, hasher?: CodeHasher): string;
|
|
2478
2701
|
/**
|
|
2479
2702
|
* Content hash of the given files, in the order they arrive. Empty when
|
|
2480
2703
|
* the list is empty or a file cannot be read, so a caller that could not
|
|
@@ -2512,6 +2735,8 @@ interface ExtractionConfig {
|
|
|
2512
2735
|
importRoots?: readonly string[] | undefined;
|
|
2513
2736
|
/** The modules the project lists, which decide which units discovery finds. */
|
|
2514
2737
|
modules?: readonly SettledModule[] | undefined;
|
|
2738
|
+
/** The directory the run walks when it walks only part of its project. */
|
|
2739
|
+
walkedDirectory?: string | undefined;
|
|
2515
2740
|
}
|
|
2516
2741
|
/**
|
|
2517
2742
|
* The run options as one part of the cache key, so a run never reads an
|
|
@@ -2537,12 +2762,12 @@ declare function runDigest(packsDigest: string, packs: ReadonlyArray<{
|
|
|
2537
2762
|
* A run reuses the previous run's summaries whole when nothing changed,
|
|
2538
2763
|
* and per file when some files did. The entry directory's name is a hash
|
|
2539
2764
|
* of the schema version, the adapter and packs digest, and the config
|
|
2540
|
-
* path
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
2545
|
-
* design notes describe the cache in full.
|
|
2765
|
+
* path. The manifest inside records a stamp and content hash per file,
|
|
2766
|
+
* the files each summary belongs to, and the other files each walk read.
|
|
2767
|
+
* The summaries are in one shard per source file, beside an index of the
|
|
2768
|
+
* boundaries and calls in each. An adapter's own data on a file's record,
|
|
2769
|
+
* `meta`, goes in a file of its own, and the cache never reads it. The
|
|
2770
|
+
* package's design notes describe the cache in full.
|
|
2546
2771
|
*/
|
|
2547
2772
|
|
|
2548
2773
|
/**
|
|
@@ -2694,6 +2919,12 @@ interface CacheInput {
|
|
|
2694
2919
|
*/
|
|
2695
2920
|
configPath?: string;
|
|
2696
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Each summary owned by the walked file it is written in, or by no file
|
|
2924
|
+
* when it is written outside every walked file. For an adapter that
|
|
2925
|
+
* replays its own per-file records rather than calling `reuse`.
|
|
2926
|
+
*/
|
|
2927
|
+
declare function ownersWhereWritten(summaries: readonly BehavioralSummary[], walkedFileOf: (locationFile: string) => string | undefined): string[][];
|
|
2697
2928
|
/**
|
|
2698
2929
|
* A cache layer rooted at `cacheDir`. With `null`, every lookup misses and
|
|
2699
2930
|
* `write` does nothing, for a one-shot extract where the cache would only
|
|
@@ -2701,6 +2932,28 @@ interface CacheInput {
|
|
|
2701
2932
|
*/
|
|
2702
2933
|
declare function createCacheLayer<Meta = unknown, UnitData = unknown>(cacheDir: string | null): CacheLayer<Meta, UnitData>;
|
|
2703
2934
|
|
|
2935
|
+
/**
|
|
2936
|
+
* Where suss keeps the files it writes for itself while it reads a
|
|
2937
|
+
* project: the extraction cache, and the record the MCP server leaves for
|
|
2938
|
+
* the plugin's hooks.
|
|
2939
|
+
*
|
|
2940
|
+
* By default they go under `.suss` in the project, which fails in a
|
|
2941
|
+
* checkout the process may only read. `SUSS_CACHE_DIR` moves them
|
|
2942
|
+
* somewhere else. The `--cache-dir` flag and the MCP server's argument
|
|
2943
|
+
* set the same variable for the process, so one setting reaches every
|
|
2944
|
+
* adapter and a flag wins over the variable already in the environment.
|
|
2945
|
+
*
|
|
2946
|
+
* Several projects can share one chosen directory, so each project gets a
|
|
2947
|
+
* subdirectory whose name is a hash of its path.
|
|
2948
|
+
*/
|
|
2949
|
+
declare const CACHE_DIR_ENV = "SUSS_CACHE_DIR";
|
|
2950
|
+
/** The directory the environment names, made absolute, or null when it names none. */
|
|
2951
|
+
declare function chosenCacheRoot(): string | null;
|
|
2952
|
+
/** The extraction cache for the files read under `projectDir`. */
|
|
2953
|
+
declare function extractionCacheDirFor(projectDir: string): string;
|
|
2954
|
+
/** The file where the server for `projectDir` says how to reach it. */
|
|
2955
|
+
declare function liveRecordFor(projectDir: string): string;
|
|
2956
|
+
|
|
2704
2957
|
/**
|
|
2705
2958
|
* Whether a write after `statAt` could leave this file's mtime and size
|
|
2706
2959
|
* where the stat saw them, because its last change was that recent.
|
|
@@ -2928,6 +3181,15 @@ declare function buildUngatedExtractionReport(args: {
|
|
|
2928
3181
|
summaries: ReadonlyArray<BehavioralSummary>;
|
|
2929
3182
|
}): ExtractionReport;
|
|
2930
3183
|
|
|
3184
|
+
/**
|
|
3185
|
+
* A directory suss writes for itself, such as the extraction cache, can
|
|
3186
|
+
* land in any package of a repository, where a root `.gitignore` entry
|
|
3187
|
+
* for `/.suss` does not reach. A `.gitignore` of `*` inside it keeps it
|
|
3188
|
+
* out of version control wherever it is, the way pytest's cache does.
|
|
3189
|
+
*/
|
|
3190
|
+
/** Creates `dir` and a `.gitignore` of `*` in it. A `.gitignore` already there is kept. */
|
|
3191
|
+
declare function makeIgnoredDirectory(dir: string): void;
|
|
3192
|
+
|
|
2931
3193
|
/**
|
|
2932
3194
|
* Parses a process keeps between runs of one project, by file.
|
|
2933
3195
|
*
|
|
@@ -3015,6 +3277,26 @@ interface PackGradient {
|
|
|
3015
3277
|
}
|
|
3016
3278
|
/** The gradient for every pack in a run that declared anything. */
|
|
3017
3279
|
declare function packGradients(report: ExtractionReport): PackGradient[];
|
|
3280
|
+
/**
|
|
3281
|
+
* A pack the run asked for that reads nothing until a project option is
|
|
3282
|
+
* set, such as the directory a GraphQL pack looks classes up under.
|
|
3283
|
+
* `example` is a config file's JSON text with a value that works for a
|
|
3284
|
+
* project laid out the way the library's generator leaves it.
|
|
3285
|
+
*/
|
|
3286
|
+
interface PackConfigNeed {
|
|
3287
|
+
pack: string;
|
|
3288
|
+
option: string;
|
|
3289
|
+
example: string;
|
|
3290
|
+
}
|
|
3291
|
+
/**
|
|
3292
|
+
* Packs the run left out because their option was missing.
|
|
3293
|
+
*
|
|
3294
|
+
* Without the option the pack has no way to find anything, and the rest
|
|
3295
|
+
* of the run looks the same as it would for a project the pack has
|
|
3296
|
+
* nothing to say about. The pack is not part of the extraction report,
|
|
3297
|
+
* since it never ran, so the caller passes these in.
|
|
3298
|
+
*/
|
|
3299
|
+
declare function packConfigCheck(needs: ReadonlyArray<PackConfigNeed>): HealthCheck;
|
|
3018
3300
|
/**
|
|
3019
3301
|
* Run every health check over one extraction report and return what
|
|
3020
3302
|
* fired, grouped by which check caught it.
|
|
@@ -3402,6 +3684,13 @@ interface RawTerminal {
|
|
|
3402
3684
|
shape: TypeShape | null;
|
|
3403
3685
|
} | null;
|
|
3404
3686
|
exceptionType: string | null;
|
|
3687
|
+
/** On a throw, what the exception inherits from, where the adapter read it. */
|
|
3688
|
+
exceptionAncestry?: {
|
|
3689
|
+
ancestors: string[];
|
|
3690
|
+
incomplete: boolean;
|
|
3691
|
+
};
|
|
3692
|
+
/** On a throw, the status the framework sends when no handler catches it. */
|
|
3693
|
+
statusWhenUncaught?: number;
|
|
3405
3694
|
message: string | null;
|
|
3406
3695
|
/** Set on a throw whose pack declared the thrown status is the wire response. */
|
|
3407
3696
|
producesResponse?: boolean;
|
|
@@ -3614,6 +3903,10 @@ interface RawCodeStructure {
|
|
|
3614
3903
|
successAccessors?: string[];
|
|
3615
3904
|
/** Whether this client's non-2xx arrives as a response or a rejection. */
|
|
3616
3905
|
failureDelivery?: FailureDelivery;
|
|
3906
|
+
/** Whether this client follows a redirect or hands the 3xx back. */
|
|
3907
|
+
redirectDelivery?: RedirectDelivery;
|
|
3908
|
+
/** Statuses the handler's own code lists as possible responses, such as FastAPI's `responses=`. */
|
|
3909
|
+
declaredStatuses?: number[];
|
|
3617
3910
|
/** Left exactly as written, because the extractor does not depend on
|
|
3618
3911
|
* graphql-js. The parsing happens at check time. */
|
|
3619
3912
|
graphqlDocument?: string;
|
|
@@ -3654,6 +3947,13 @@ interface RawCodeStructure {
|
|
|
3654
3947
|
* `unreadOutcome` gap, so no checker counts it against the unit.
|
|
3655
3948
|
*/
|
|
3656
3949
|
unreadBinding?: string;
|
|
3950
|
+
/**
|
|
3951
|
+
* Why the adapter could not read this unit's body, when reading it threw.
|
|
3952
|
+
* The summary keeps the unit's identity and binding, and the reason comes
|
|
3953
|
+
* out as an `unreadOutcome` gap, so an empty body is not taken for one
|
|
3954
|
+
* that does nothing.
|
|
3955
|
+
*/
|
|
3956
|
+
readFailure?: string;
|
|
3657
3957
|
/**
|
|
3658
3958
|
* Readings the adapter passed along without collapsing. This module writes
|
|
3659
3959
|
* the reason for any that came back unreadable or ambiguous. Written and
|
|
@@ -3689,4 +3989,4 @@ declare function rawConditionToPredicate(c: RawCondition): Predicate;
|
|
|
3689
3989
|
declare function effectToIR(effect: RawEffect): Effect;
|
|
3690
3990
|
declare function paramToInput(param: RawParameter): Input;
|
|
3691
3991
|
|
|
3692
|
-
export { type AccessRecognizer, type AdapterCodeStamp, type AdapterStamp, type ArgumentParser, type AstCapableOps, type BindingExtraction, type BodyContent, type CacheAttribution, type CacheDiagnostic, type CacheInput, type CacheLayer, type CacheLookup, type CallOps, type CaseGroup, type ChannelSource, type ChosenReading, type ClassOps, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DeclaredModule, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type EmptyStage, EnclosingNodes, type ExitKind, type ExtractionConfig, type ExtractionReport, type ExtractorOptions, type FailureDelivery, type GlobalPrefixCall, type HealthCheck, type HealthViolation, type HelperDeclarations, type HelperSearch, type HelperSink, type HelperValue, IdMap, IdSet, type Identified, type InputMappingPattern, type InputRead, type InvocationRecognizer, KeptParses, type LanguageAdapter, type LoweredStatementParts, MAX_ENTRIES, MAX_PATHS, MODULE_SURFACE_RECOGNITION, type ModuleInitOptions, type NodeVisitor, type OpsCarrier, type PackDeclarations, type PackFailure, type PackFunnel, type PackGradient, type PackTally, type ParameterSupplier, type ParsedNode, type PartialPlan, PathBudgetExceeded, type PatternPack, type ProjectHelper, type ProjectHelpers, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawProvenance, type RawTerminal, type Reading, type ReceiverOrigin, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type RootRecord, SKIP_CHILDREN, type SettledModule, type SourceRange, type SourceSpelling, type StatedSlot, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TestCaseMatch, type Timer, type TimingReport, type TransparentWrapper, type UnitRecord, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, type
|
|
3992
|
+
export { type AccessRecognizer, type AdapterCodeStamp, type AdapterStamp, type ArgumentParser, type AstCapableOps, type BindingExtraction, type BodyContent, CACHE_DIR_ENV, type CacheAttribution, type CacheDiagnostic, type CacheInput, type CacheLayer, type CacheLookup, type CallOps, type CaseGroup, type ChannelSource, type ChildrenOf, type ChosenReading, type ClassOps, type CodeHasher, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DeclaredModule, type DeclaredStatusDecorators, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type EmptyStage, EnclosingNodes, type ExitKind, type ExtractionConfig, type ExtractionReport, type ExtractorOptions, type FailureDelivery, type GlobalPrefixCall, type HandOffSite, type HealthCheck, type HealthViolation, type HelperDeclarations, type HelperSearch, type HelperSink, type HelperValue, IdMap, IdSet, type Identified, type InputMappingPattern, type InputRead, type InvocationRecognizer, type KeepsArms, KeptParses, type LanguageAdapter, type LoweredStatementParts, MAX_ENTRIES, MAX_HELPER_PATHS, MAX_PATHS, MODULE_SURFACE_RECOGNITION, type ModuleInitOptions, type NodeVisitor, type OpsCarrier, type PackConfigNeed, type PackDeclarations, type PackFailure, type PackFunnel, type PackGradient, type PackTally, type ParameterSupplier, type ParsedNode, type PartialPlan, PathBudgetExceeded, type PatternPack, type ProjectHelper, type ProjectHelpers, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawProvenance, type RawTerminal, type Reading, type ReceiverOrigin, type RedirectDelivery, type RedirectOption, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type RootRecord, type RouteVersioning, SKIP_CHILDREN, type SettledModule, type SourceRange, type SourceSpelling, type StatedSlot, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TestCaseMatch, type Timer, type TimingReport, type TransparentWrapper, type UnitRecord, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, type VersionPlacement, type WalkEnd, type WrapperMethodRegistration, type WrapperOptionRegistration, type WrapperRegistration, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, buildUngatedExtractionReport, chosenCacheRoot, commonDirectoryOf, composeWrappers, computeContentHash, computeDistHashFrom, configuredCallOption, createAdapterStamp, createCacheLayer, createCodeHasher, createPackTallies, createTimer, detectGaps, effectToIR, emptyTally, enumerateOrDegrade, enumerateStructuredPaths, evaluatePackHealth, extractionCacheDirFor, extractionConfigStamp, firstWrittenReading, formatPackHealth, guardsHoldOn, helperPathsOnVariables, httpRouteDiscovery, isListedTestFile, liveRecordFor, makeIgnoredDirectory, makeTransitionId, mapReading, markReturnsAsExitCode, matchesTestFileName, mergeReadShapes, moduleInitStructure, moduleOfFile, noopTimer, ownersWhereWritten, packConfigCheck, packGradients, paramToInput, processCodeHasher, projectFileStamp, rawConditionToPredicate, recordPackFailure, redirectDeliveryWhenSet, registrationHelperDiscovery, routeHelperIndex, runDigest, runsBefore, scopeOption, settleModules, sharedGatingConditions, sourceRefsOf, splitAtHandOffs, stampMayMissAWrite, stampModuleImports, stampModules, storageSystemOption, summaryCountsByPack, tallyUnit, terminalToOutput, throughHelper, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, walkDescendants, wrapperDiscovery, writtenReading };
|