carrick 0.3.161 → 0.3.163
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/contract.d.ts +8 -0
- package/dist/contract.js.map +1 -1
- package/dist/facts/store.d.ts +12 -0
- package/dist/facts/store.js +15 -0
- package/dist/facts/store.js.map +1 -1
- package/dist/held/daemon.d.ts +8 -0
- package/dist/held/daemon.js.map +1 -1
- package/dist/held/early.d.ts +1 -1
- package/dist/held/early.js +89 -11
- package/dist/held/early.js.map +1 -1
- package/dist/held/message-rows.d.ts +3 -0
- package/dist/held/message-rows.js +41 -0
- package/dist/held/message-rows.js.map +1 -0
- package/dist/held/place.d.ts +11 -2
- package/dist/held/place.js +4 -1
- package/dist/held/place.js.map +1 -1
- package/dist/held/runtime.d.ts +1 -1
- package/dist/held/runtime.js +75 -17
- package/dist/held/runtime.js.map +1 -1
- package/dist/held/shadow.d.ts +2 -0
- package/dist/held/shadow.js.map +1 -1
- package/dist/hook/confirm.js +40 -21
- package/dist/hook/confirm.js.map +1 -1
- package/dist/init/codex.d.ts +1 -1
- package/dist/init/codex.js +8 -4
- package/dist/init/codex.js.map +1 -1
- package/dist/init/doctor.d.ts +10 -13
- package/dist/init/doctor.js +26 -92
- package/dist/init/doctor.js.map +1 -1
- package/dist/init/launcher.d.ts +35 -0
- package/dist/init/launcher.js +85 -0
- package/dist/init/launcher.js.map +1 -0
- package/dist/init/outdated.d.ts +3 -4
- package/dist/init/outdated.js +19 -8
- package/dist/init/outdated.js.map +1 -1
- package/dist/init/remove.js +4 -0
- package/dist/init/remove.js.map +1 -1
- package/dist/init/repo-copies.d.ts +1 -1
- package/dist/init/repo-copies.js +13 -4
- package/dist/init/repo-copies.js.map +1 -1
- package/dist/init/run.js +17 -26
- package/dist/init/run.js.map +1 -1
- package/dist/init/self-update.js +7 -4
- package/dist/init/self-update.js.map +1 -1
- package/dist/init/settings.d.ts +0 -34
- package/dist/init/settings.js +11 -45
- package/dist/init/settings.js.map +1 -1
- package/dist/init/task-skills.d.ts +1 -1
- package/dist/init/task-skills.js +1 -0
- package/dist/init/task-skills.js.map +1 -1
- package/dist/render.d.ts +6 -0
- package/dist/render.js +27 -7
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/hooks/carrick-hook.sh +122 -0
- package/plugin/hooks/hooks.json +8 -8
- package/sidecar/dist/src/capture/anchors.d.ts +2 -2
- package/sidecar/dist/src/capture/anchors.js +25 -10
- package/sidecar/dist/src/capture/api.d.ts +10 -0
- package/sidecar/dist/src/capture/check-classify.d.ts +11 -4
- package/sidecar/dist/src/capture/check-classify.js +65 -25
- package/sidecar/dist/src/capture/check-fields.d.ts +2 -1
- package/sidecar/dist/src/capture/check-fields.js +10 -2
- package/sidecar/dist/src/capture/check-probe.d.ts +82 -25
- package/sidecar/dist/src/capture/check-probe.js +106 -37
- package/sidecar/dist/src/capture/index.d.ts +3 -2
- package/sidecar/dist/src/capture/index.js +14 -2
- package/sidecar/dist/src/capture/reply-status.d.ts +86 -0
- package/sidecar/dist/src/capture/reply-status.js +255 -0
- package/sidecar/dist/src/capture/site-node.d.ts +34 -0
- package/sidecar/dist/src/capture/site-node.js +258 -0
- package/sidecar/dist/src/engine-stamp.json +1 -1
- package/sidecar/dist/src/held-shadow.d.ts +23 -2
- package/sidecar/dist/src/held-shadow.js +42 -8
- package/sidecar/dist/src/stated-params.d.ts +3 -2
- package/sidecar/dist/src/type-inferrer.d.ts +91 -55
- package/sidecar/dist/src/type-inferrer.js +350 -218
- package/sidecar/dist/src/types.d.ts +10 -0
- package/sidecar/dist/src/validators.d.ts +150 -28
- package/sidecar/dist/src/validators.js +15 -1
- package/templates/carrick-hook.sh +122 -0
- package/templates/skills/carrick-audit.md +97 -0
- package/templates/skills/carrick-census.md +73 -87
|
@@ -53,6 +53,8 @@ export interface ShadowResult {
|
|
|
53
53
|
* scan's judge answer "what travels" the same way.
|
|
54
54
|
*/
|
|
55
55
|
wire: string[];
|
|
56
|
+
/** The judge's message rules for a socket payload, as declarations to append beside `tolerances` (`heldMessageWire`). */
|
|
57
|
+
message: string[];
|
|
56
58
|
/** The judge's three tolerances, read from its own code (`judgeTolerances('__carrick_')`): declarations to append beside `wire`. */
|
|
57
59
|
tolerances: JudgeTolerances;
|
|
58
60
|
/**
|
|
@@ -99,8 +101,8 @@ export interface HeldGraphql {
|
|
|
99
101
|
* `E` the caller's expected type;
|
|
100
102
|
* - `__carrick_GqlSentS<S, E, R>`: the scalar form, `R` the root's leaf
|
|
101
103
|
* (`leaves`); it reads `__carrick_GqlTypes` (`types_decl`). A
|
|
102
|
-
* declared-void caller states no contract, and is kept;
|
|
103
|
-
*
|
|
104
|
+
* declared-void caller states no contract, and is kept; where the wire
|
|
105
|
+
* form does not assign, the judge's declared line decides (carrick#4726).
|
|
104
106
|
*
|
|
105
107
|
* `scalar` adds the scalar form's lines; they name `__carrick_GqlTypes`, so
|
|
106
108
|
* they are written only when the table is declared.
|
|
@@ -112,3 +114,22 @@ export declare function heldGraphqlWire(scalar: boolean): string[];
|
|
|
112
114
|
* every such leaf reaches, and the declarations.
|
|
113
115
|
*/
|
|
114
116
|
export declare function heldGraphql(types: GraphqlTypes, roots: GraphqlRoot[]): HeldGraphql;
|
|
117
|
+
/**
|
|
118
|
+
* The judge's message rules (a socket payload: the emitter is `sent`, the
|
|
119
|
+
* listener `expected`) as declarations a held check appends beside `tolerances`
|
|
120
|
+
* (prefix `__carrick_`). Every rule is the judge's own text (`check-probe.ts`):
|
|
121
|
+
*
|
|
122
|
+
* - `__carrick_IsAny`, `__carrick_IsUnknown`, `__carrick_IsNever`
|
|
123
|
+
* (`topTypeDeclarations`);
|
|
124
|
+
* - `__carrick_MsgSent<S, E>`, `S` the emitter's payload and `E` the
|
|
125
|
+
* listener's parameter. Where the judge reads a gate unverifiable (a top,
|
|
126
|
+
* bottom or void type on either side) the answer is `E`, so the check is
|
|
127
|
+
* silent; otherwise it is the sent type with the absent body dropped where
|
|
128
|
+
* the listener requires none (`absentBodyRule`, tolerant form, because the
|
|
129
|
+
* listener's `absent_body_tolerated` mark is not stored: silent where the
|
|
130
|
+
* judge without the mark would speak). A socket payload travels as
|
|
131
|
+
* declared (`wireFormFor`), so no wire transform is applied.
|
|
132
|
+
*
|
|
133
|
+
* It reads `__carrick_IsVoid` (`tolerances.declarations`).
|
|
134
|
+
*/
|
|
135
|
+
export declare function heldMessageWire(): string[];
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import * as fs from 'node:fs';
|
|
27
27
|
import * as path from 'node:path';
|
|
28
28
|
import { ts } from 'ts-morph';
|
|
29
|
-
import { WriteGuard, graphqlComparandLeafRule, graphqlComparandRule, graphqlExpectedRule,
|
|
29
|
+
import { WriteGuard, absentBodyApplies, absentBodyRule, graphqlComparandLeafRule, graphqlComparandRule, graphqlExpectedRule, graphqlDeclaredDeclarations, graphqlDeclaredRule, graphqlGenericDeclarations, graphqlLeafWalkDeclarations, graphqlReachableFields, graphqlRootLeaf, graphqlScalarWireRule, judgeTscPath, jsonWireDeclarations, jsonWireRule, judgeTolerances, topTypeDeclarations, fitOptionsOf, judgeFitOptions, wireFormFor, } from './capture/index.js';
|
|
30
30
|
/** The platform package's executable, `@typescript/typescript-<platform>-<arch>/lib/tsc`. */
|
|
31
31
|
const NATIVE_TSC = /[\\/]@typescript[\\/]typescript-[^\\/]+[\\/]lib[\\/]tsc(\.exe)?$/;
|
|
32
32
|
/** `judgeTscPath()` when it is the native executable, else null (no held compiler). */
|
|
@@ -203,6 +203,7 @@ export function writeShadow(loader, outDir, graphql) {
|
|
|
203
203
|
wire: heldWire(),
|
|
204
204
|
...(graphql === undefined ? {} : { graphql: heldGraphql(graphql.types, graphql.roots) }),
|
|
205
205
|
tolerances: judgeTolerances('__carrick_'),
|
|
206
|
+
message: heldMessageWire(),
|
|
206
207
|
options: { service: fitOptionsOf(compilerOptions), judge: judgeFitOptions() },
|
|
207
208
|
native_tsc: nativeTscPath(),
|
|
208
209
|
};
|
|
@@ -223,8 +224,8 @@ export function heldWire() {
|
|
|
223
224
|
* `E` the caller's expected type;
|
|
224
225
|
* - `__carrick_GqlSentS<S, E, R>`: the scalar form, `R` the root's leaf
|
|
225
226
|
* (`leaves`); it reads `__carrick_GqlTypes` (`types_decl`). A
|
|
226
|
-
* declared-void caller states no contract, and is kept;
|
|
227
|
-
*
|
|
227
|
+
* declared-void caller states no contract, and is kept; where the wire
|
|
228
|
+
* form does not assign, the judge's declared line decides (carrick#4726).
|
|
228
229
|
*
|
|
229
230
|
* `scalar` adds the scalar form's lines; they name `__carrick_GqlTypes`, so
|
|
230
231
|
* they are written only when the table is declared.
|
|
@@ -249,11 +250,12 @@ export function heldGraphqlWire(scalar) {
|
|
|
249
250
|
`type ${p}GqlComparandLeaf<S, E, R> = ${graphqlComparandLeafRule('S', 'E', relaxed, 'R', p)};`,
|
|
250
251
|
`type ${p}GqlWireForm<S, E, R> = ${graphqlScalarWireRule(comparand, relaxed, leaf, p)};`,
|
|
251
252
|
`type ${p}GqlWire<S, E, R> = ${form};`,
|
|
252
|
-
// carrick#
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
// carrick#4726: the judge's declared line. Where the wire form does not
|
|
254
|
+
// assign, the held form sends what the judge's decisive line sends: the
|
|
255
|
+
// wire type with the fields the root record lacks or converts in the type
|
|
256
|
+
// the served schema declares.
|
|
257
|
+
...graphqlDeclaredDeclarations(p),
|
|
258
|
+
`type ${p}GqlSentS<S, E, R> = ${p}IsVoid<E> extends true ? E : ${graphqlDeclaredRule(`${p}GqlWire<S, E, R>`, relaxed, leaf, p)};`,
|
|
257
259
|
];
|
|
258
260
|
}
|
|
259
261
|
/**
|
|
@@ -279,6 +281,38 @@ export function heldGraphql(types, roots) {
|
|
|
279
281
|
leaves,
|
|
280
282
|
};
|
|
281
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* The judge's message rules (a socket payload: the emitter is `sent`, the
|
|
286
|
+
* listener `expected`) as declarations a held check appends beside `tolerances`
|
|
287
|
+
* (prefix `__carrick_`). Every rule is the judge's own text (`check-probe.ts`):
|
|
288
|
+
*
|
|
289
|
+
* - `__carrick_IsAny`, `__carrick_IsUnknown`, `__carrick_IsNever`
|
|
290
|
+
* (`topTypeDeclarations`);
|
|
291
|
+
* - `__carrick_MsgSent<S, E>`, `S` the emitter's payload and `E` the
|
|
292
|
+
* listener's parameter. Where the judge reads a gate unverifiable (a top,
|
|
293
|
+
* bottom or void type on either side) the answer is `E`, so the check is
|
|
294
|
+
* silent; otherwise it is the sent type with the absent body dropped where
|
|
295
|
+
* the listener requires none (`absentBodyRule`, tolerant form, because the
|
|
296
|
+
* listener's `absent_body_tolerated` mark is not stored: silent where the
|
|
297
|
+
* judge without the mark would speak). A socket payload travels as
|
|
298
|
+
* declared (`wireFormFor`), so no wire transform is applied.
|
|
299
|
+
*
|
|
300
|
+
* It reads `__carrick_IsVoid` (`tolerances.declarations`).
|
|
301
|
+
*/
|
|
302
|
+
export function heldMessageWire() {
|
|
303
|
+
const p = '__carrick_';
|
|
304
|
+
if (!absentBodyApplies('socket', 'response'))
|
|
305
|
+
throw new Error('the absent-body rule no longer reads a socket payload');
|
|
306
|
+
const wire = wireFormFor('socket', 'response', 'consumer');
|
|
307
|
+
const sent = wire === 'json' ? `${p}Wire<S, E>` : 'S';
|
|
308
|
+
const body = absentBodyRule(sent, 'E', true);
|
|
309
|
+
const top = (t) => `${p}IsAny<${t}> extends true ? true : ${p}IsUnknown<${t}> extends true ? true : ${p}IsNever<${t}> extends true ? true : ${p}IsVoid<${t}>`;
|
|
310
|
+
return [
|
|
311
|
+
...topTypeDeclarations(p),
|
|
312
|
+
`type ${p}MsgSilent<T> = ${top('T')};`,
|
|
313
|
+
`type ${p}MsgSent<S, E> = ${p}MsgSilent<E> extends true ? E : ${p}MsgSilent<S> extends true ? E : ${body};`,
|
|
314
|
+
];
|
|
315
|
+
}
|
|
282
316
|
function safeRealpath(p) {
|
|
283
317
|
try {
|
|
284
318
|
return fs.realpathSync(p);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { Node, type ArrowFunction, type CallExpression, type FunctionDeclaration, type FunctionExpression, type MethodDeclaration, type ParameterDeclaration, type Symbol as TsSymbol, type Type } from 'ts-morph';
|
|
19
19
|
import { type LabelledMembers } from './library-claims.js';
|
|
20
20
|
import type { ClaimSlot } from './types.js';
|
|
21
|
+
import type { ReplyStatus } from './capture/index.js';
|
|
21
22
|
/** A function a handler can be: what the inferrer follows a registration to. */
|
|
22
23
|
export type HandlerFunction = FunctionDeclaration | ArrowFunction | FunctionExpression | MethodDeclaration;
|
|
23
24
|
/** What a handler's parameters state about the request body. */
|
|
@@ -36,9 +37,9 @@ export interface StatedReply {
|
|
|
36
37
|
at: Node;
|
|
37
38
|
}
|
|
38
39
|
/** The status a send's own chain states, as the inferrer reads it. */
|
|
39
|
-
export type ChainStatus = (call: CallExpression) =>
|
|
40
|
+
export type ChainStatus = (call: CallExpression) => ReplyStatus | undefined;
|
|
40
41
|
/** The status a value states, read as a send's status argument is: `undecided` when it states none. */
|
|
41
|
-
export type ValueStatus = (value: Node) =>
|
|
42
|
+
export type ValueStatus = (value: Node) => ReplyStatus;
|
|
42
43
|
/** The node a value is read from: `JSON.stringify(x)` is read as `x`. */
|
|
43
44
|
export type PayloadNode = (value: Node) => Node;
|
|
44
45
|
export declare class StatedParams {
|
|
@@ -96,6 +96,12 @@ export declare class TypeInferrer {
|
|
|
96
96
|
* named one. The open-parameter check (carrick#4201) reads it.
|
|
97
97
|
*/
|
|
98
98
|
private readonly printedTypes;
|
|
99
|
+
/**
|
|
100
|
+
* The type the source states for a call result whose text is that
|
|
101
|
+
* statement (a cast, an annotation, a narrowing). The consumer floor
|
|
102
|
+
* (carrick#4513 P1) reads it beside the printed type.
|
|
103
|
+
*/
|
|
104
|
+
private readonly statedTypes;
|
|
99
105
|
private readonly unwidenedLimits;
|
|
100
106
|
private readonly now;
|
|
101
107
|
/**
|
|
@@ -227,6 +233,16 @@ export declare class TypeInferrer {
|
|
|
227
233
|
* the node it named. Lines do not move (an insertion holds no newline).
|
|
228
234
|
*/
|
|
229
235
|
private mappedRequest;
|
|
236
|
+
/**
|
|
237
|
+
* Stale-position T2: the request this route row is read with, or why it
|
|
238
|
+
* has no reading. Only a producer route request that carries its handler's
|
|
239
|
+
* lines (`handler_lines`) and is located by text is checked, by the
|
|
240
|
+
* capture's rule (`anchorInHandler`). A node found outside the handler and
|
|
241
|
+
* what its return reaches, whose text names one answer inside them, is
|
|
242
|
+
* read there: the request comes back with that node's line, and is used
|
|
243
|
+
* only if the locator, asked again at that line, finds exactly that node.
|
|
244
|
+
*/
|
|
245
|
+
private anchoredRequest;
|
|
230
246
|
/**
|
|
231
247
|
* Infer a single type from a request
|
|
232
248
|
*/
|
|
@@ -245,6 +261,24 @@ export declare class TypeInferrer {
|
|
|
245
261
|
* (`enclosingTypeParameterIn` starts from the anchor's parent).
|
|
246
262
|
*/
|
|
247
263
|
private withoutOpenTypeParameter;
|
|
264
|
+
/**
|
|
265
|
+
* What a consumer's call result is when it is no body (carrick#4513 P1),
|
|
266
|
+
* read after `await` (`Promise` and other thenables peeled):
|
|
267
|
+
* - a bare type parameter, other than a polymorphic `this`: only the
|
|
268
|
+
* callers of whatever declares it set it, a library class's own `T`
|
|
269
|
+
* included;
|
|
270
|
+
* - a union member, nullish ones aside, that is an instance of a generic
|
|
271
|
+
* class an installed package declares (a result, future or page class
|
|
272
|
+
* around the body). JSON never builds a class instance, so the class is
|
|
273
|
+
* the library's carrier of the body, and its declaration prints its own
|
|
274
|
+
* parameters open. A class without type parameters (an SDK's data
|
|
275
|
+
* class) and a TypeScript lib type (`ArrayBuffer`, `Date`) are kept.
|
|
276
|
+
*/
|
|
277
|
+
private consumerFloorOf;
|
|
278
|
+
/** The name of the generic class an installed package declares that `type` is an instance of. */
|
|
279
|
+
private genericLibraryClassOf;
|
|
280
|
+
/** The decided answer for a call result that is a generic library class instance (carrick#4513 P1). */
|
|
281
|
+
private libraryClassAbstain;
|
|
248
282
|
/**
|
|
249
283
|
* The name of a type parameter `type` holds that a declaration around
|
|
250
284
|
* `node`, or `node` itself, declares. A function or class read at itself is
|
|
@@ -393,6 +427,31 @@ export declare class TypeInferrer {
|
|
|
393
427
|
* no success body and the row abstains.
|
|
394
428
|
*/
|
|
395
429
|
private responseOfDeclaredHandler;
|
|
430
|
+
/**
|
|
431
|
+
* The decided answer of a declared handler none of whose replies carries a
|
|
432
|
+
* success body, or `undefined` when one might (reply-status T2a).
|
|
433
|
+
*
|
|
434
|
+
* Every branch of what the handler returns (`responseReturnedExpressions`,
|
|
435
|
+
* conditionals split; a returned call whose callbacks' returns are already
|
|
436
|
+
* listed, such as `.match(ok, err)`, is a container and not judged itself)
|
|
437
|
+
* must be a reply that states an error or redirect status
|
|
438
|
+
* (`replyStatus`, chain read), or a reply stating a success status that
|
|
439
|
+
* carries no body: no first argument, `null`, `undefined`, or an init
|
|
440
|
+
* object (`statesResponseInit`). A branch counts as a reply only when it
|
|
441
|
+
* is the located send, makes the same call as the located send (callee
|
|
442
|
+
* root and member, so `reply.status(400).send(x)` matches
|
|
443
|
+
* `reply.status(410).send(y)`), or types as framework machinery: a status
|
|
444
|
+
* read off an argument of any other call (`clip(rows, 404)`) is no reply's
|
|
445
|
+
* status. A status no source states (`new Response(null)`, `next()`) or a
|
|
446
|
+
* computed one keeps the row undecided.
|
|
447
|
+
*/
|
|
448
|
+
private noSuccessPayloadOf;
|
|
449
|
+
/**
|
|
450
|
+
* What a send calls, as two sends of one reply API share it: `new` and the
|
|
451
|
+
* constructor's text, or the root of the callee chain and the member
|
|
452
|
+
* called (`reply.status(400).send` -> `reply…send`), or the callee's text.
|
|
453
|
+
*/
|
|
454
|
+
private sendCalleeKey;
|
|
396
455
|
/**
|
|
397
456
|
* The call inside one of `returned` that the located expression is, or is
|
|
398
457
|
* an argument of: the send a located payload was handed to. `undefined`
|
|
@@ -414,7 +473,7 @@ export declare class TypeInferrer {
|
|
|
414
473
|
* True when a located call hands back the reply of the registration handler
|
|
415
474
|
* it sits in (`handsBackHandlerParameter`, `isRegisteredHandler`), is
|
|
416
475
|
* handed a status-shaped value, read as a chain's status call is read
|
|
417
|
-
* (`
|
|
476
|
+
* (`valueStatus`, as `chainStatus` reads it), and does not take any
|
|
418
477
|
* value in that slot (`takesAnyValue`): `reply.code(204)`,
|
|
419
478
|
* `res.status(204)`. Such a call states a status and names no body
|
|
420
479
|
* (carrick#4300); a send of a number (`reply.send(count)`) keeps its
|
|
@@ -423,7 +482,7 @@ export declare class TypeInferrer {
|
|
|
423
482
|
private locatedStatusHandsBackReply;
|
|
424
483
|
/**
|
|
425
484
|
* The one status-only shape: a call that hands one of the handler's
|
|
426
|
-
* parameters back, is handed a status-shaped value (`
|
|
485
|
+
* parameters back, is handed a status-shaped value (`valueStatus`), and
|
|
427
486
|
* does not take any value in that slot (`takesAnyValue`). Read by the
|
|
428
487
|
* located-call check and by `returnsHandlerParameterType` (carrick#4341).
|
|
429
488
|
*/
|
|
@@ -483,7 +542,7 @@ export declare class TypeInferrer {
|
|
|
483
542
|
* expression selects the HANDLER: the function that contains it, on a row
|
|
484
543
|
* whose line is a route registration. Its returned sends are enumerated
|
|
485
544
|
* (conditional branches split), each is classified by the status it states
|
|
486
|
-
* (`
|
|
545
|
+
* (`replyStatus`), the error and redirect branches are dropped, and
|
|
487
546
|
* the success bodies are joined exactly as the payload walk joins return
|
|
488
547
|
* statements.
|
|
489
548
|
*
|
|
@@ -654,7 +713,34 @@ export declare class TypeInferrer {
|
|
|
654
713
|
* holds nothing the call binds.
|
|
655
714
|
*/
|
|
656
715
|
private callResultAtThroughCall;
|
|
716
|
+
/**
|
|
717
|
+
* The type of `call` as the call `through_call` names instantiates the
|
|
718
|
+
* wrapper it is made in (carrick#4375): `typeAtThroughCall`, with no
|
|
719
|
+
* answer recorded. A request that names no call, or a call that binds
|
|
720
|
+
* nothing the type holds, reads the call's own type.
|
|
721
|
+
*/
|
|
722
|
+
private callTypeAsCallerBinds;
|
|
723
|
+
/**
|
|
724
|
+
* A call's result as the caller reads it. A request made below a wrapper
|
|
725
|
+
* (`through_call` names the call that reaches the wrapper) is read at the
|
|
726
|
+
* call it names, where the caller states what it reads, in two cases:
|
|
727
|
+
*
|
|
728
|
+
* - the read below finds only transport (a decided `machinery_envelope`,
|
|
729
|
+
* or the response object itself, stated by nothing): the wrapper hands
|
|
730
|
+
* the transport on, and the body is read off it by its caller;
|
|
731
|
+
* - the caller chooses a raw text body: a text read of the value, or a
|
|
732
|
+
* text format passed at the call (carrick#4513). A raw text body has no
|
|
733
|
+
* JSON shape, so the mark is read at the deciding call whichever call
|
|
734
|
+
* the type came from.
|
|
735
|
+
*
|
|
736
|
+
* A read below the wrapper that finds a body keeps it.
|
|
737
|
+
*/
|
|
657
738
|
private inferCallResult;
|
|
739
|
+
/** The read states nothing but transport: a decided envelope, or the response object unstated. */
|
|
740
|
+
private readIsOnlyTransport;
|
|
741
|
+
/** The raw-text mark the deciding call states, added to a read that did not carry it. */
|
|
742
|
+
private markedAtDecidingCall;
|
|
743
|
+
private inferCallResultBelowWrapper;
|
|
658
744
|
/**
|
|
659
745
|
* The terminal of a call's def-use walk is a zero-argument `.text()` read of
|
|
660
746
|
* the call's own result (carrick#1842): on its binding (`res.text()`,
|
|
@@ -1585,8 +1671,6 @@ export declare class TypeInferrer {
|
|
|
1585
1671
|
private envelopeOwnStatus;
|
|
1586
1672
|
/** The status an envelope literal's `statusCode` or `status` member states. */
|
|
1587
1673
|
private envelopeLiteralStatus;
|
|
1588
|
-
/** The status a value states, classified as a send's status argument is. */
|
|
1589
|
-
private statusOfValue;
|
|
1590
1674
|
/**
|
|
1591
1675
|
* The value node an object literal gives a member: a property assignment's
|
|
1592
1676
|
* initializer, or a shorthand's own name.
|
|
@@ -1772,56 +1856,8 @@ export declare class TypeInferrer {
|
|
|
1772
1856
|
* something other than an HTTP code, so it stays a payload.
|
|
1773
1857
|
*/
|
|
1774
1858
|
private statesResponseInit;
|
|
1775
|
-
/**
|
|
1776
|
-
|
|
1777
|
-
*
|
|
1778
|
-
* Read in order, and the first that states anything decides:
|
|
1779
|
-
*
|
|
1780
|
-
* 1. an argument past the body that carries a status: a numeric literal
|
|
1781
|
-
* (`send(body, 404)`), an options object (`{ status: 401 }`), or any
|
|
1782
|
-
* expression whose TYPE is a status literal or a union of them
|
|
1783
|
-
* (`let code: 400 | 500`). A numeric argument whose type is a plain
|
|
1784
|
-
* `number` states a status the source does not fix, which is
|
|
1785
|
-
* `variable`: the branch fails open into the union and is logged.
|
|
1786
|
-
* 2. the send call's own RESULT type, when a member of it is typed as a
|
|
1787
|
-
* status literal. A framework that types its sends records the status
|
|
1788
|
-
* there, and a redirect helper's default `302` is only visible there.
|
|
1789
|
-
* A result whose status member spans success and error codes (the
|
|
1790
|
-
* default of a typed `json(body, status?)`) says nothing either way.
|
|
1791
|
-
*
|
|
1792
|
-
* A status in the FIRST argument is a field of the body and is never read.
|
|
1793
|
-
* No method or framework name is consulted anywhere.
|
|
1794
|
-
*/
|
|
1795
|
-
private responseSiteStatus;
|
|
1796
|
-
/**
|
|
1797
|
-
* The status an earlier call of a send's own chain states: the receiver
|
|
1798
|
-
* calls `call` is invoked on (`a.status(401).json(body)` has `a.status(401)`),
|
|
1799
|
-
* innermost last. Each receiver call's first argument is read by the rule
|
|
1800
|
-
* an argument past a body is, so a numeric literal or a literal-typed value
|
|
1801
|
-
* counts and a plain `number` is `variable`. `undefined` when no receiver
|
|
1802
|
-
* call states a status. No method name is consulted: a receiver call that
|
|
1803
|
-
* is handed no status-shaped value says nothing.
|
|
1804
|
-
*/
|
|
1805
|
-
private chainStatus;
|
|
1806
|
-
/**
|
|
1807
|
-
* The HTTP status codes an argument states, `'variable'` when it is a
|
|
1808
|
-
* status-shaped value the source does not fix, or `undefined` when it says
|
|
1809
|
-
* nothing about a status.
|
|
1810
|
-
*
|
|
1811
|
-
* Read from the AST first: `{ status: 400 }` in an argument position widens
|
|
1812
|
-
* to `{ status: number }`, so the literal only survives syntactically. The
|
|
1813
|
-
* type read behind it catches `as const`, hoisted option objects and
|
|
1814
|
-
* literal-typed variables. Only values in the HTTP range count: an
|
|
1815
|
-
* arbitrary number named `status` on a domain object (`{ status: 2 }`)
|
|
1816
|
-
* states nothing about transport.
|
|
1817
|
-
*/
|
|
1818
|
-
private statedStatusCodes;
|
|
1819
|
-
/**
|
|
1820
|
-
* Status codes a send call's result type records: the members (of the
|
|
1821
|
-
* result, or of each part of an intersection result) typed as a status
|
|
1822
|
-
* literal or a union of them. `undefined` when none is.
|
|
1823
|
-
*/
|
|
1824
|
-
private sendResultStatusCodes;
|
|
1859
|
+
/** The raw checker the shared reply-status reader (`capture/reply-status.ts`) reads with. */
|
|
1860
|
+
private replyChecker;
|
|
1825
1861
|
/**
|
|
1826
1862
|
* Peel the wrappers that do not change an expression's payload: parentheses
|
|
1827
1863
|
* and `await`. Unlike `unwrapExpressionNode` this KEEPS `as`/`satisfies`,
|