@suss/extractor 0.9.0 → 0.11.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.d.cts CHANGED
@@ -1,246 +1,5 @@
1
1
  import { Effect, MessageBusSemantics, DeployableUnit, Predicate, BehavioralSummary, TypeShape, RenderNode, CodeUnitKind, BoundaryBinding, GraphqlDeclaredContract, ConfidenceInfo, Transition, Gap, Input, Output } from '@suss/behavioral-ir';
2
2
 
3
- /**
4
- * The language-neutral form the path engine walks: statement kind, condition
5
- * handle, children, and exit kind. Each language's adapter lowers its own AST
6
- * into this, and the path enumeration never touches a language-specific node
7
- * again.
8
- *
9
- * The `Cond` type parameter is the language's own handle for a condition
10
- * expression (a ts-morph Expression for TypeScript, a tree-sitter node for a
11
- * language added later). The engine passes it through untouched for a caller
12
- * to parse afterwards, and never looks inside it.
13
- */
14
- /** Where a condition came from, in terms of what that branch's body does. */
15
- type ConditionSource = "explicit" | "earlyReturn" | "earlyThrow" | "catchBlock";
16
- /** Whether a statement's own subtree leaves the unit by returning or throwing. A throw anywhere beats a return anywhere. Never set for break or continue. */
17
- type ExitKind = "return" | "throw" | null;
18
- /**
19
- * A test the engine passes through without looking inside: its display text
20
- * plus the language's own expression handle. The handle is null for a
21
- * synthetic condition, such as a loop's "some iteration of" marker or a
22
- * switch group's disjunction text.
23
- */
24
- interface ConditionHandle<Cond> {
25
- readonly sourceText: string;
26
- readonly expression: Cond | null;
27
- }
28
- /** One condition attached to a caller-visible transition. */
29
- interface ConditionInfo<Cond> {
30
- readonly sourceText: string;
31
- readonly polarity: "positive" | "negative";
32
- readonly source: ConditionSource;
33
- readonly expression: Cond | null;
34
- }
35
- /** A statement list: an if arm, a loop body, a try/catch/finally block. */
36
- type StatementBlock<Cond> = readonly StructuredStatement<Cond>[];
37
- /**
38
- * One switch or match case group, already merged out of the language's own
39
- * grammar (TypeScript stacks several empty-bodied labels on top of the
40
- * clause that finally has a body, and the lowering step folds that
41
- * into one group with a joined condition). `condition` is null for the
42
- * default or wildcard group. `body` has any language-specific
43
- * statement that ends a fallthrough (a trailing break) already stripped
44
- * out, and `hasTrailingBreak` records whether one was there.
45
- */
46
- interface CaseGroup<Cond> {
47
- readonly condition: ConditionHandle<Cond> | null;
48
- readonly hasTrailingBreak: boolean;
49
- readonly body: StatementBlock<Cond>;
50
- }
51
- /**
52
- * One statement in the unit's control flow, already lowered out of the
53
- * source language. Every variant has the same four things on it:
54
- * `kind` says which construct it is, `condition` (where
55
- * one applies) is the opaque test, the block and group fields are its
56
- * children, and `exitKind` is worked out by the lowering step (a deep
57
- * scan of the statement's own subtree for a return or throw, skipping
58
- * nested function bodies, the same scan every language needs in order to
59
- * tell an early return from an early throw).
60
- */
61
- type StructuredStatement<Cond = unknown> = {
62
- readonly kind: "if";
63
- readonly condition: ConditionHandle<Cond>;
64
- readonly thenBody: StatementBlock<Cond>;
65
- /** null when the source has no else/elif tail at all. */
66
- readonly elseBody: StatementBlock<Cond> | null;
67
- readonly exitKind: ExitKind;
68
- } | {
69
- readonly kind: "switch";
70
- /** Source order; at most one group has a null (default) condition. */
71
- readonly groups: readonly CaseGroup<Cond>[];
72
- readonly exitKind: ExitKind;
73
- } | {
74
- readonly kind: "loop";
75
- /** Display text for the loop header. The engine builds two synthetic conditions out of it: "some iteration of: ..." and "loop exited via ...: ...". */
76
- readonly condition: ConditionHandle<Cond>;
77
- readonly body: StatementBlock<Cond>;
78
- readonly exitKind: ExitKind;
79
- } | {
80
- readonly kind: "try";
81
- readonly tryBody: StatementBlock<Cond>;
82
- readonly catchBody: StatementBlock<Cond> | null;
83
- /** Here only so it can be validated. A finally that exits, or that contains a terminal the caller gave us, is not modeled, and its own conditions are never enumerated. */
84
- readonly finallyBody: StatementBlock<Cond> | null;
85
- readonly exitKind: ExitKind;
86
- } | {
87
- readonly kind: "exit";
88
- readonly exit: "return" | "throw" | "break" | "continue";
89
- readonly exitKind: ExitKind;
90
- } | {
91
- /** Anything else: expression statements, declarations, and any statement the enumeration does not branch on. */
92
- readonly kind: "opaque";
93
- readonly exitKind: ExitKind;
94
- };
95
-
96
- /**
97
- * `Reading<T>`: what a reader found, in the four states a source can leave a
98
- * value in.
99
- *
100
- * A reader that returns `T | null` makes null mean three things at once: the
101
- * source left the value out, the source states it and the reader could not
102
- * evaluate it, or several candidates matched and the reader picked none.
103
- * Each needs something different said about it on the summary, and the type
104
- * does not show which the reader meant, so every new reader decides it again
105
- * and some of them decide wrong.
106
- *
107
- * The rule that turns a reading into a claim, a library default, or a gap
108
- * lives in the summary builder in this package and is not exported.
109
- */
110
- /** Where in a file a value is written, as byte offsets into that file. */
111
- interface SourceRange {
112
- start: number;
113
- end: number;
114
- }
115
- /**
116
- * What a reader found where a value could be. `written` is the only state
117
- * with a value a summary may claim, and the other three each say something
118
- * different about why there is no claim to make.
119
- */
120
- type Reading<T> = {
121
- kind: "written";
122
- value: T;
123
- range: SourceRange;
124
- } | {
125
- kind: "absent";
126
- } | {
127
- kind: "unreadable";
128
- reason: string;
129
- range: SourceRange;
130
- } | {
131
- kind: "ambiguous";
132
- candidates: readonly T[];
133
- reason: string;
134
- range: SourceRange;
135
- };
136
- /** The source gives this value, here, and the reader read it. */
137
- declare function writtenReading<T>(value: T, range: SourceRange): Reading<T>;
138
- /**
139
- * The source says nothing where this value could be. A library that defines
140
- * a default for it may still supply one, and the summary builder applies
141
- * that default only when a pack declares it as data.
142
- */
143
- declare const absentReading: Reading<never>;
144
- /**
145
- * The source gives the value and the reader could not evaluate it. The
146
- * reason is the sentence somebody reading the summary will see, so write it
147
- * about what could not be read rather than about the code.
148
- */
149
- declare function unreadableReading<T>(reason: string, range: SourceRange): Reading<T>;
150
- /**
151
- * Several values could be right and the reader picked none. Keeping the
152
- * candidates leaves what was found available to whoever later teaches the
153
- * reader how to choose, and every step afterwards keeps them too.
154
- *
155
- * The range is where somebody should look to see the ambiguity. An ambiguity
156
- * often spans more than one place (two mounts of one router, in two files),
157
- * so give the site the reading was taken at, the same one an `unreadable`
158
- * reading here would have given.
159
- */
160
- declare function ambiguousReading<T>(candidates: readonly T[], reason: string, range: SourceRange): Reading<T>;
161
- /**
162
- * A reading paired with what the library does when the source says nothing.
163
- * Only a pack may supply that default, so the value a summary claims for an
164
- * unstated field is library-defined and lives in the pack alongside
165
- * everything else the pack already declares.
166
- */
167
- interface DefaultedReading<T> {
168
- /** What the source said. */
169
- reading: Reading<T>;
170
- /**
171
- * The value the library applies when the source gives none, as the pack
172
- * declared it. Leave it out when the library defines no default, and then
173
- * a source that says nothing gets no claim.
174
- */
175
- libraryDefault?: T;
176
- }
177
- /**
178
- * The same reading with its value in another form. A written value goes
179
- * through `f` and keeps its range. An ambiguous reading's candidates go
180
- * through `f` too, so the alternatives end up in the same form as the
181
- * chosen value would. Absent and unreadable readings pass through
182
- * unchanged, since neither one has a value to convert.
183
- */
184
- declare function mapReading<T, U>(reading: Reading<T>, f: (value: T) => U): Reading<U>;
185
- /**
186
- * Read further from what this reading found. `f` runs on a written
187
- * value with the range it was written at, so a step that turns out to
188
- * be unreadable can say so against the same syntax.
189
- *
190
- * `f` runs on each of an ambiguous reading's candidates too, and the ones
191
- * that do read come back as the candidates of an ambiguous reading with the
192
- * same reason. That way the alternatives stay next to the chosen value all
193
- * the way to the summary, instead of being dropped at the first step
194
- * that reads further.
195
- */
196
- declare function andThenReading<T, U>(reading: Reading<T>, f: (value: T, range: SourceRange) => Reading<U>): Reading<U>;
197
- /**
198
- * Which of several readings a claim comes from, for a value a library lets
199
- * a source give in more than one place.
200
- */
201
- interface ChosenReading<T> {
202
- /**
203
- * The reading a claim comes from: the first that was written, or if none
204
- * was, the first that failed to read, or absent when all of them were
205
- * absent.
206
- */
207
- reading: Reading<T>;
208
- /**
209
- * The readings the choice passed over that nobody could resolve. A later
210
- * reading supplying the value does not settle what an earlier one said
211
- * and could not be read, so these still go to the
212
- * builder and their reasons still reach the summary.
213
- */
214
- passedOver: readonly Reading<T>[];
215
- }
216
- /**
217
- * Choose among readings of the same value, taking the first that was
218
- * written. Nothing is thrown away: whatever the choice passed over and
219
- * could not read comes back next to it in `passedOver`, so a
220
- * `response_model` nobody could read still lands as a gap even when the
221
- * return annotation after it supplies the type.
222
- */
223
- declare function firstWrittenReading<T>(readings: readonly Reading<T>[]): ChosenReading<T>;
224
- /**
225
- * What a written reading found, for a reader that has to read further from
226
- * it before anything is claimed. A route's path template gives the
227
- * parameters that decide what each of the handler's parameters is, and
228
- * that has to be settled before there is a summary field to fill in.
229
- *
230
- * This applies no default and gives no reason, so most of what a summary
231
- * says must not be written from it. Hand the reading to the
232
- * builder instead, and the fixed rule gets applied to it once, somewhere
233
- * review can see it.
234
- *
235
- * The identity fields of a boundary binding are the exception, and the path
236
- * this reads is one of them. A binding either says where a unit is or says
237
- * nothing and pairs with nothing, and no pack declares a
238
- * default for what a boundary is called, so the value the builder would
239
- * put there is the value this gives back. Hand the reading over as well and
240
- * the reason still becomes a gap.
241
- */
242
- declare function valueToReadFurtherFrom<T>(reading: Reading<T>): T | null;
243
-
244
3
  /**
245
4
  * The `PatternPack` interface, which is what a framework pack gives a language
246
5
  * adapter. The pack says WHAT to look for (which import, which call, which
@@ -464,10 +223,10 @@ type DiscoveryMatch = {
464
223
  *
465
224
  * The adapter fills in `DiscoveredUnit.resolverInfo` so the binding
466
225
  * comes out as `graphql-resolver(typeName, fieldName)`.
467
- * `typeName` resolves from the class decorator's first argument
468
- * (`@Resolver(() => User)` gives `"User"`), or from
469
- * `methodDecoratorTypeMap` when the class decorator has no
470
- * argument. `fieldName` comes from the method decorator's `{ name }`
226
+ * `typeName` resolves from `methodDecoratorTypeMap` when the
227
+ * method decorator is in it, and otherwise from the class
228
+ * decorator's first argument (`@Resolver(() => User)` gives
229
+ * `"User"`). `fieldName` comes from the method decorator's `{ name }`
471
230
  * option when that is set, and otherwise from the method name.
472
231
  */
473
232
  type: "decoratedMethod";
@@ -489,10 +248,10 @@ type DiscoveryMatch = {
489
248
  classDecorators: string[];
490
249
  methodDecorators: string[];
491
250
  /**
492
- * Maps a method decorator to the type its field belongs to when the
493
- * class decorator does not say. NestJS puts `@Query` on the root
251
+ * Maps a method decorator to the type its field belongs to, for the
252
+ * decorators that settle it. NestJS puts `@Query` on the root
494
253
  * `Query` type and `@Mutation` on `Mutation` no matter what the class
495
- * says, so those two settle it themselves.
254
+ * says, so an entry here wins over the class decorator's argument.
496
255
  *
497
256
  * When the map leaves a decorator out and the class decorator gives no
498
257
  * type either, nothing here works out which type owns the field. The
@@ -1053,6 +812,8 @@ type ResponsePropertyMeaning = {
1053
812
  } | {
1054
813
  type: "headers";
1055
814
  };
815
+ /** Whether a refused request comes back as a response or as an exception. */
816
+ type FailureDelivery = "response" | "exception";
1056
817
  interface ResponsePropertyMapping {
1057
818
  /** Property or method name on the response (e.g. "ok", "status", "json") */
1058
819
  name: string;
@@ -1121,6 +882,14 @@ interface PatternPack {
1121
882
  * `.json()` into a structured IR construct instead of leaving it opaque.
1122
883
  */
1123
884
  responseSemantics?: ResponsePropertyMapping[];
885
+ /**
886
+ * How this client hands back a response the server refused. `fetch`
887
+ * returns one and the caller reads the status off it. axios and ky
888
+ * reject instead, so every non-2xx reaches the caller through a
889
+ * `catch` and there is no status for a guard to read. Defaults to
890
+ * `"response"`.
891
+ */
892
+ failureDelivery?: FailureDelivery;
1124
893
  /**
1125
894
  * Synthesize extra code units out of a parent unit's body, for when one
1126
895
  * construct the user wrote implicitly spawns several units the runtime
@@ -1298,6 +1067,25 @@ interface PatternPack {
1298
1067
  importModule: string;
1299
1068
  importName: string;
1300
1069
  uriProperty: string;
1070
+ /**
1071
+ * How this constructor's cache option installs a fragment
1072
+ * registry, for the library whose client can supply fragment
1073
+ * definitions at run time. `cacheProperty` is the construction
1074
+ * option the cache is passed in, `cacheConstructor` the cache
1075
+ * class, and `registryProperty` the cache option that installs
1076
+ * the registry. The adapter reads every construction and records
1077
+ * whether a registry is configured, absent, or unreadable; a
1078
+ * construction it cannot read counts as unreadable, never as
1079
+ * absent.
1080
+ */
1081
+ fragmentRegistry?: {
1082
+ cacheProperty: string;
1083
+ cacheConstructor: {
1084
+ importModule: string;
1085
+ importName: string;
1086
+ };
1087
+ registryProperty: string;
1088
+ };
1301
1089
  }>;
1302
1090
  /**
1303
1091
  * Which service a client talks to, keyed by the endpoint the
@@ -1474,6 +1262,255 @@ interface DiscoveredSubUnit {
1474
1262
  metadata?: Record<string, unknown>;
1475
1263
  }
1476
1264
 
1265
+ /**
1266
+ * The language-neutral form the path engine walks: statement kind, condition
1267
+ * handle, children, and exit kind. Each language's adapter lowers its own AST
1268
+ * into this, and the path enumeration never touches a language-specific node
1269
+ * again.
1270
+ *
1271
+ * The `Cond` type parameter is the language's own handle for a condition
1272
+ * expression (a ts-morph Expression for TypeScript, a tree-sitter node for a
1273
+ * language added later). The engine passes it through untouched for a caller
1274
+ * to parse afterwards, and never looks inside it.
1275
+ */
1276
+ /** Where a condition came from, in terms of what that branch's body does. */
1277
+ type ConditionSource = "explicit" | "earlyReturn" | "earlyThrow" | "catchBlock";
1278
+ /** Whether a statement's own subtree leaves the unit by returning or throwing. A throw anywhere beats a return anywhere. Never set for break or continue. */
1279
+ type ExitKind = "return" | "throw" | null;
1280
+ /**
1281
+ * A test the engine passes through without looking inside: its display text
1282
+ * plus the language's own expression handle. The handle is null for a
1283
+ * synthetic condition, such as a loop's "some iteration of" marker or a
1284
+ * switch group's disjunction text.
1285
+ */
1286
+ interface ConditionHandle<Cond> {
1287
+ readonly sourceText: string;
1288
+ readonly expression: Cond | null;
1289
+ }
1290
+ /** One condition attached to a caller-visible transition. */
1291
+ interface ConditionInfo<Cond> {
1292
+ readonly sourceText: string;
1293
+ readonly polarity: "positive" | "negative";
1294
+ readonly source: ConditionSource;
1295
+ readonly expression: Cond | null;
1296
+ }
1297
+ /** A statement list: an if arm, a loop body, a try/catch/finally block. */
1298
+ type StatementBlock<Cond> = readonly StructuredStatement<Cond>[];
1299
+ /**
1300
+ * One switch or match case group, already merged out of the language's own
1301
+ * grammar (TypeScript stacks several empty-bodied labels on top of the
1302
+ * clause that finally has a body, and the lowering step folds that
1303
+ * into one group with a joined condition). `condition` is null for the
1304
+ * default or wildcard group. `body` has any language-specific
1305
+ * statement that ends a fallthrough (a trailing break) already stripped
1306
+ * out, and `hasTrailingBreak` records whether one was there.
1307
+ */
1308
+ interface CaseGroup<Cond> {
1309
+ readonly condition: ConditionHandle<Cond> | null;
1310
+ readonly hasTrailingBreak: boolean;
1311
+ readonly body: StatementBlock<Cond>;
1312
+ }
1313
+ /**
1314
+ * What every lowered statement has on it, whichever construct it is.
1315
+ *
1316
+ * The lowering works `exitKind` out by scanning the statement's own
1317
+ * subtree for a return or a throw, skipping every nested function body.
1318
+ *
1319
+ * `callbacks` is the bodies of the functions this statement passes to
1320
+ * calls it makes, as far as the language counts those as running for the
1321
+ * enclosing unit. The engine walks them on the same path as the
1322
+ * statement, so their branches are the unit's branches. Their `return`
1323
+ * is not the unit's, so a path that ends inside one continues past the
1324
+ * statement. A lowering that leaves the field out behaves as it did
1325
+ * before there was one.
1326
+ */
1327
+ interface LoweredStatementParts<Cond> {
1328
+ readonly exitKind: ExitKind;
1329
+ readonly callbacks?: readonly StatementBlock<Cond>[];
1330
+ }
1331
+ /**
1332
+ * One statement in the unit's control flow, already lowered out of the
1333
+ * source language. `kind` says which construct it is, `condition` (where
1334
+ * one applies) is the opaque test, and the block and group fields are its
1335
+ * children. `LoweredStatementParts` describes the rest.
1336
+ */
1337
+ type StructuredStatement<Cond = unknown> = (LoweredStatementParts<Cond> & {
1338
+ readonly kind: "if";
1339
+ readonly condition: ConditionHandle<Cond>;
1340
+ readonly thenBody: StatementBlock<Cond>;
1341
+ /** null when the source has no else/elif tail at all. */
1342
+ readonly elseBody: StatementBlock<Cond> | null;
1343
+ }) | (LoweredStatementParts<Cond> & {
1344
+ readonly kind: "switch";
1345
+ /** Source order; at most one group has a null (default) condition. */
1346
+ readonly groups: readonly CaseGroup<Cond>[];
1347
+ }) | (LoweredStatementParts<Cond> & {
1348
+ readonly kind: "loop";
1349
+ /** Display text for the loop header. The engine builds two synthetic conditions out of it: "some iteration of: ..." and "loop exited via ...: ...". */
1350
+ readonly condition: ConditionHandle<Cond>;
1351
+ readonly body: StatementBlock<Cond>;
1352
+ }) | (LoweredStatementParts<Cond> & {
1353
+ readonly kind: "try";
1354
+ readonly tryBody: StatementBlock<Cond>;
1355
+ readonly catchBody: StatementBlock<Cond> | null;
1356
+ /** Here only so it can be validated. A finally that exits, or that contains a terminal the caller gave us, is not modeled, and its own conditions are never enumerated. */
1357
+ readonly finallyBody: StatementBlock<Cond> | null;
1358
+ }) | (LoweredStatementParts<Cond> & {
1359
+ readonly kind: "exit";
1360
+ readonly exit: "return" | "throw" | "break" | "continue";
1361
+ }) | (LoweredStatementParts<Cond> & {
1362
+ /** Anything else: expression statements, declarations, and any statement the enumeration does not branch on. */
1363
+ readonly kind: "opaque";
1364
+ });
1365
+
1366
+ /**
1367
+ * `Reading<T>`: what a reader found, in the four states a source can leave a
1368
+ * value in.
1369
+ *
1370
+ * A reader that returns `T | null` makes null mean three things at once: the
1371
+ * source left the value out, the source states it and the reader could not
1372
+ * evaluate it, or several candidates matched and the reader picked none.
1373
+ * Each needs something different said about it on the summary, and the type
1374
+ * does not show which the reader meant, so every new reader decides it again
1375
+ * and some of them decide wrong.
1376
+ *
1377
+ * The rule that turns a reading into a claim, a library default, or a gap
1378
+ * lives in the summary builder in this package and is not exported.
1379
+ */
1380
+ /** Where in a file a value is written, as byte offsets into that file. */
1381
+ interface SourceRange {
1382
+ start: number;
1383
+ end: number;
1384
+ }
1385
+ /**
1386
+ * What a reader found where a value could be. `written` is the only state
1387
+ * with a value a summary may claim, and the other three each say something
1388
+ * different about why there is no claim to make.
1389
+ */
1390
+ type Reading<T> = {
1391
+ kind: "written";
1392
+ value: T;
1393
+ range: SourceRange;
1394
+ } | {
1395
+ kind: "absent";
1396
+ } | {
1397
+ kind: "unreadable";
1398
+ reason: string;
1399
+ range: SourceRange;
1400
+ } | {
1401
+ kind: "ambiguous";
1402
+ candidates: readonly T[];
1403
+ reason: string;
1404
+ range: SourceRange;
1405
+ };
1406
+ /** The source gives this value, here, and the reader read it. */
1407
+ declare function writtenReading<T>(value: T, range: SourceRange): Reading<T>;
1408
+ /**
1409
+ * The source says nothing where this value could be. A library that defines
1410
+ * a default for it may still supply one, and the summary builder applies
1411
+ * that default only when a pack declares it as data.
1412
+ */
1413
+ declare const absentReading: Reading<never>;
1414
+ /**
1415
+ * The source gives the value and the reader could not evaluate it. The
1416
+ * reason is the sentence somebody reading the summary will see, so write it
1417
+ * about what could not be read rather than about the code.
1418
+ */
1419
+ declare function unreadableReading<T>(reason: string, range: SourceRange): Reading<T>;
1420
+ /**
1421
+ * Several values could be right and the reader picked none. Keeping the
1422
+ * candidates leaves what was found available to whoever later teaches the
1423
+ * reader how to choose, and every step afterwards keeps them too.
1424
+ *
1425
+ * The range is where somebody should look to see the ambiguity. An ambiguity
1426
+ * often spans more than one place (two mounts of one router, in two files),
1427
+ * so give the site the reading was taken at, the same one an `unreadable`
1428
+ * reading here would have given.
1429
+ */
1430
+ declare function ambiguousReading<T>(candidates: readonly T[], reason: string, range: SourceRange): Reading<T>;
1431
+ /**
1432
+ * A reading paired with what the library does when the source says nothing.
1433
+ * Only a pack may supply that default, so the value a summary claims for an
1434
+ * unstated field is library-defined and lives in the pack alongside
1435
+ * everything else the pack already declares.
1436
+ */
1437
+ interface DefaultedReading<T> {
1438
+ /** What the source said. */
1439
+ reading: Reading<T>;
1440
+ /**
1441
+ * The value the library applies when the source gives none, as the pack
1442
+ * declared it. Leave it out when the library defines no default, and then
1443
+ * a source that says nothing gets no claim.
1444
+ */
1445
+ libraryDefault?: T;
1446
+ }
1447
+ /**
1448
+ * The same reading with its value in another form. A written value goes
1449
+ * through `f` and keeps its range. An ambiguous reading's candidates go
1450
+ * through `f` too, so the alternatives end up in the same form as the
1451
+ * chosen value would. Absent and unreadable readings pass through
1452
+ * unchanged, since neither one has a value to convert.
1453
+ */
1454
+ declare function mapReading<T, U>(reading: Reading<T>, f: (value: T) => U): Reading<U>;
1455
+ /**
1456
+ * Read further from what this reading found. `f` runs on a written
1457
+ * value with the range it was written at, so a step that turns out to
1458
+ * be unreadable can say so against the same syntax.
1459
+ *
1460
+ * `f` runs on each of an ambiguous reading's candidates too, and the ones
1461
+ * that do read come back as the candidates of an ambiguous reading with the
1462
+ * same reason. That way the alternatives stay next to the chosen value all
1463
+ * the way to the summary, instead of being dropped at the first step
1464
+ * that reads further.
1465
+ */
1466
+ declare function andThenReading<T, U>(reading: Reading<T>, f: (value: T, range: SourceRange) => Reading<U>): Reading<U>;
1467
+ /**
1468
+ * Which of several readings a claim comes from, for a value a library lets
1469
+ * a source give in more than one place.
1470
+ */
1471
+ interface ChosenReading<T> {
1472
+ /**
1473
+ * The reading a claim comes from: the first that was written, or if none
1474
+ * was, the first that failed to read, or absent when all of them were
1475
+ * absent.
1476
+ */
1477
+ reading: Reading<T>;
1478
+ /**
1479
+ * The readings the choice passed over that nobody could resolve. A later
1480
+ * reading supplying the value does not settle what an earlier one said
1481
+ * and could not be read, so these still go to the
1482
+ * builder and their reasons still reach the summary.
1483
+ */
1484
+ passedOver: readonly Reading<T>[];
1485
+ }
1486
+ /**
1487
+ * Choose among readings of the same value, taking the first that was
1488
+ * written. Nothing is thrown away: whatever the choice passed over and
1489
+ * could not read comes back next to it in `passedOver`, so a
1490
+ * `response_model` nobody could read still lands as a gap even when the
1491
+ * return annotation after it supplies the type.
1492
+ */
1493
+ declare function firstWrittenReading<T>(readings: readonly Reading<T>[]): ChosenReading<T>;
1494
+ /**
1495
+ * What a written reading found, for a reader that has to read further from
1496
+ * it before anything is claimed. A route's path template gives the
1497
+ * parameters that decide what each of the handler's parameters is, and
1498
+ * that has to be settled before there is a summary field to fill in.
1499
+ *
1500
+ * This applies no default and gives no reason, so most of what a summary
1501
+ * says must not be written from it. Hand the reading to the
1502
+ * builder instead, and the fixed rule gets applied to it once, somewhere
1503
+ * review can see it.
1504
+ *
1505
+ * The identity fields of a boundary binding are the exception, and the path
1506
+ * this reads is one of them. A binding either says where a unit is or says
1507
+ * nothing and pairs with nothing, and no pack declares a
1508
+ * default for what a boundary is called, so the value the builder would
1509
+ * put there is the value this gives back. Hand the reading over as well and
1510
+ * the reason still becomes a gap.
1511
+ */
1512
+ declare function valueToReadFurtherFrom<T>(reading: Reading<T>): T | null;
1513
+
1477
1514
  /**
1478
1515
  * Small helpers for pattern packs that are built the same way.
1479
1516
  *
@@ -1865,13 +1902,23 @@ interface RawCodeStructure {
1865
1902
  bodyAccessors?: string[];
1866
1903
  /** The same, for the status: `status` for fetch and for axios. */
1867
1904
  statusAccessors?: string[];
1905
+ /** The same, for the success flag: `ok` for fetch, nothing for axios. */
1906
+ successAccessors?: string[];
1907
+ /** Whether this client's non-2xx arrives as a response or a rejection. */
1908
+ failureDelivery?: FailureDelivery;
1868
1909
  /** Left exactly as written, because the extractor does not depend on
1869
1910
  * graphql-js. The parsing happens at check time. */
1870
1911
  graphqlDocument?: string;
1871
1912
  graphqlSchemaSdl?: string;
1913
+ /** The document this unit was read out of, when something else read out of
1914
+ * the same document states what this one relies on. */
1915
+ sourceDocumentLabel?: string;
1872
1916
  /** The extractor cannot derive this. An adapter that has the SDL and knows
1873
1917
  * which field the resolver serves fills it in. */
1874
1918
  graphqlDeclaredContract?: GraphqlDeclaredContract;
1919
+ /** Fragment spreads in `graphqlDocument` with no definition in it, so a
1920
+ * partially read document is marked rather than passed off as whole. */
1921
+ graphqlUnresolvedFragments?: string[];
1875
1922
  /** Set when a document reference was recognized but its body could not be
1876
1923
  * read, so an unreadable document is accounted for instead of dropped. */
1877
1924
  graphqlUnresolvedDocument?: {
@@ -1917,4 +1964,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
1917
1964
  declare function effectToIR(effect: RawEffect): Effect;
1918
1965
  declare function paramToInput(param: RawParameter): Input;
1919
1966
 
1920
- export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
1967
+ export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, type FailureDelivery, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, type LoweredStatementParts, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };