carrick 0.3.159 → 0.3.161
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/cli.d.ts +10 -0
- package/dist/cli.js +9 -0
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +25 -9
- package/dist/contract.js +12 -15
- package/dist/contract.js.map +1 -1
- package/dist/diagnostics.d.ts +13 -0
- package/dist/diagnostics.js +18 -2
- package/dist/diagnostics.js.map +1 -1
- package/dist/facts/enabled.d.ts +4 -4
- package/dist/facts/enabled.js +6 -6
- package/dist/facts/store.d.ts +21 -1
- package/dist/facts/store.js +44 -3
- package/dist/facts/store.js.map +1 -1
- package/dist/held/early.d.ts +3 -1
- package/dist/held/early.js +63 -7
- package/dist/held/early.js.map +1 -1
- package/dist/held/place.d.ts +26 -2
- package/dist/held/place.js +40 -3
- package/dist/held/place.js.map +1 -1
- package/dist/held/runtime.d.ts +4 -2
- package/dist/held/runtime.js +121 -18
- package/dist/held/runtime.js.map +1 -1
- package/dist/held/shadow.d.ts +18 -1
- package/dist/held/shadow.js +2 -2
- package/dist/held/shadow.js.map +1 -1
- package/dist/hook/confirm.js +12 -6
- package/dist/hook/confirm.js.map +1 -1
- package/dist/hook/rechecks.d.ts +16 -0
- package/dist/hook/rechecks.js +95 -2
- package/dist/hook/rechecks.js.map +1 -1
- package/dist/hook/refresh.d.ts +3 -3
- package/dist/hook/refresh.js +15 -15
- package/dist/hook/refresh.js.map +1 -1
- package/dist/lens.js +1 -6
- package/dist/lens.js.map +1 -1
- package/dist/render.d.ts +3 -3
- package/dist/render.js +15 -14
- package/dist/render.js.map +1 -1
- package/package.json +7 -7
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/anchors.js +41 -8
- package/sidecar/dist/src/capture/api.d.ts +4 -0
- package/sidecar/dist/src/capture/check-classify.d.ts +6 -0
- package/sidecar/dist/src/capture/check-classify.js +23 -0
- package/sidecar/dist/src/capture/check-fields.d.ts +11 -0
- package/sidecar/dist/src/capture/check-fields.js +107 -0
- package/sidecar/dist/src/capture/check-probe.d.ts +65 -1
- package/sidecar/dist/src/capture/check-probe.js +129 -22
- package/sidecar/dist/src/capture/index.d.ts +2 -2
- package/sidecar/dist/src/capture/index.js +2 -2
- package/sidecar/dist/src/capture/type-reasons.json +4 -0
- package/sidecar/dist/src/engine-stamp.json +1 -1
- package/sidecar/dist/src/held-shadow.d.ts +41 -2
- package/sidecar/dist/src/held-shadow.js +68 -2
- package/sidecar/dist/src/index.js +25 -8
- package/sidecar/dist/src/stated-params.d.ts +9 -1
- package/sidecar/dist/src/stated-params.js +19 -0
- package/sidecar/dist/src/type-inferrer.d.ts +14 -0
- package/sidecar/dist/src/type-inferrer.js +92 -40
- package/sidecar/dist/src/types.d.ts +9 -0
- package/sidecar/dist/src/validators.d.ts +152 -18
- package/sidecar/dist/src/validators.js +1 -0
|
@@ -220,18 +220,126 @@ export function judgeTolerances(prefix) {
|
|
|
220
220
|
* helpers declared before it.
|
|
221
221
|
*/
|
|
222
222
|
export function graphqlScalarDeclarations(reachable, rootLeaf) {
|
|
223
|
+
const [sent, ...walk] = graphqlLeafWalkDeclarations('');
|
|
224
|
+
return [
|
|
225
|
+
sent,
|
|
226
|
+
`type GqlTypes = ${JSON.stringify(reachable)};`,
|
|
227
|
+
`type GqlRootLeaf = ${JSON.stringify(rootLeaf)};`,
|
|
228
|
+
...walk,
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The leaf walk's declarations without the two table lines, namespaced by
|
|
233
|
+
* `prefix` as `jsonWireDeclarations` is: `<p>GqlScalarSent`, `<p>GqlTypeOf`,
|
|
234
|
+
* `<p>GqlFieldOf` and `<p>GqlLeafSent`. They read `<p>GqlTypes`, the service's
|
|
235
|
+
* table, which the caller declares (once per file in the held check). The
|
|
236
|
+
* probe's `GqlScalarSent` comes first, then the three walk lines.
|
|
237
|
+
*/
|
|
238
|
+
export function graphqlLeafWalkDeclarations(prefix) {
|
|
239
|
+
const p = prefix;
|
|
223
240
|
const sent = Object.entries(GRAPHQL_SCALAR_SENT)
|
|
224
241
|
.map(([name, type]) => `${name}: ${type}`)
|
|
225
242
|
.join('; ');
|
|
226
243
|
return [
|
|
227
|
-
`type GqlScalarSent = { ${sent} };`,
|
|
228
|
-
`type
|
|
229
|
-
`type
|
|
230
|
-
`type
|
|
231
|
-
|
|
232
|
-
|
|
244
|
+
`type ${p}GqlScalarSent = { ${sent} };`,
|
|
245
|
+
`type ${p}GqlTypeOf<F> = [F] extends [{ non_null: infer I }] ? ${p}GqlTypeOf<I> : [F] extends [{ type: infer T }] ? T : never;`,
|
|
246
|
+
`type ${p}GqlFieldOf<T, K> = [T] extends [never] ? unknown : [T] extends [keyof ${p}GqlTypes] ? ([K] extends [keyof ${p}GqlTypes[T]] ? ${p}GqlTypes[T][K] : unknown) : unknown;`,
|
|
247
|
+
`type ${p}GqlLeafSent<C, F, D extends number = 15> = [D] extends [never] ? ${p}JsonWire<C> : [unknown] extends [C] ? C : [F] extends [{ non_null: infer I }] ? ${p}GqlLeafSent<C, I, D> : C extends null | undefined ? C : [F] extends [{ list: infer I }] ? (C extends readonly unknown[] ? { [K in keyof C]: ${p}GqlLeafSent<C[K], I, ${p}GqlDepth[D]> } : ${p}JsonWire<C>) : [F] extends [{ scalar: infer N }] ? (N extends keyof ${p}GqlScalarSent ? ${p}GqlScalarSent[N] : ${p}JsonWire<C>) : [F] extends [{ type: infer T }] ? ([T] extends [keyof ${p}GqlTypes] ? (C extends readonly unknown[] ? ${p}JsonWire<C> : C extends (...args: any[]) => any ? C : C extends object ? { [K in keyof C]: ${p}GqlLeafSent<C[K], ${p}GqlFieldOf<T, K>, ${p}GqlDepth[D]> } : ${p}JsonWire<C>) : ${p}JsonWire<C>) : ${p}JsonWire<C>;`,
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The comparison helpers every GraphQL line reads, namespaced by `prefix`:
|
|
252
|
+
* the envelope test (`<p>GqlPayloadOf`, `<p>GqlReadsOuter`), the `__typename`
|
|
253
|
+
* relax (`<p>GqlTypenameOptional`) and the depth bound they share. Ten
|
|
254
|
+
* declarations, in the order the probe writes them. The probe passes `''`,
|
|
255
|
+
* the held check `__carrick_`, so both read one text.
|
|
256
|
+
*/
|
|
257
|
+
export function graphqlGenericDeclarations(prefix) {
|
|
258
|
+
const p = prefix;
|
|
259
|
+
return [
|
|
260
|
+
`type ${p}GqlObjLike<V> = [V] extends [readonly unknown[]] ? ([V] extends [readonly (infer E)[]] ? ([E] extends [readonly unknown[]] ? false : ([E] extends [object] ? true : false)) : false) : ([V] extends [object] ? true : false);`,
|
|
261
|
+
`type ${p}GqlIsUnion<T, U = T> = [T extends unknown ? ([U] extends [T] ? false : true) : never] extends [false] ? false : true;`,
|
|
262
|
+
`type ${p}GqlPayloadKeys<T> = { [K in keyof T]-?: [${p}GqlObjLike<T[K]>] extends [true] ? K : never }[keyof T];`,
|
|
263
|
+
`type ${p}GqlSingleKey<K> = [K] extends [never] ? never : ([${p}GqlIsUnion<K>] extends [false] ? K : never);`,
|
|
264
|
+
`type ${p}GqlPayloadOf<S> = [S] extends [readonly unknown[]] ? never : [${p}GqlIsUnion<S>] extends [true] ? never : [S] extends [object] ? ([${p}GqlSingleKey<${p}GqlPayloadKeys<S>>] extends [never] ? never : S[${p}GqlSingleKey<${p}GqlPayloadKeys<S>> & keyof S]) : never;`,
|
|
265
|
+
`type ${p}GqlNames<T> = T extends object ? keyof T : never;`,
|
|
266
|
+
`type ${p}GqlReadsOuter<S, E> = [Extract<Exclude<${p}GqlNames<S>, ${p}GqlNames<${p}GqlPayloadOf<S>>>, Exclude<${p}GqlNames<E>, '__typename'>>] extends [never] ? false : true;`,
|
|
267
|
+
`type ${p}GqlDepth = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];`,
|
|
268
|
+
`type ${p}GqlTypenameParts<T, D extends number> = { [K in keyof T as K extends '__typename' ? never : K]: ${p}GqlTypenameOptional<T[K], ${p}GqlDepth[D]> } & { [K in keyof T as K extends '__typename' ? K : never]?: T[K] };`,
|
|
269
|
+
`type ${p}GqlTypenameOptional<T, D extends number = 16> = [D] extends [never] ? T : T extends (...args: any[]) => any ? T : T extends object ? ('__typename' extends keyof T ? { [K in keyof ${p}GqlTypenameParts<T, D>]: ${p}GqlTypenameParts<T, D>[K] } : { [K in keyof T]: ${p}GqlTypenameOptional<T[K], ${p}GqlDepth[D]> }) : T;`,
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The consumer's reading with `__typename` optional (carrick#1759): the
|
|
274
|
+
* declared type itself whenever relaxing changes nothing observable.
|
|
275
|
+
*/
|
|
276
|
+
export function graphqlExpectedRule(expected, prefix) {
|
|
277
|
+
return `[${prefix}GqlTypenameOptional<${expected}>] extends [${expected}] ? ${expected} : ${prefix}GqlTypenameOptional<${expected}>`;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The envelope unwrap: the payload under a single-payload envelope, else the
|
|
281
|
+
* sent type. `relaxed` is the text of `graphqlExpectedRule`'s result, a name
|
|
282
|
+
* in the probe and an application in the held check.
|
|
283
|
+
*/
|
|
284
|
+
export function graphqlComparandRule(sent, expected, relaxed, prefix) {
|
|
285
|
+
const p = prefix;
|
|
286
|
+
return `[${sent}] extends [${relaxed}] ? ${sent} : ([${p}GqlPayloadOf<${sent}>] extends [never] ? ${sent} : [${p}GqlReadsOuter<${sent}, ${expected}>] extends [true] ? ${sent} : ${p}GqlPayloadOf<${sent}>)`;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The SDL leaf the comparand is declared as: the root's own, or, after an
|
|
290
|
+
* envelope unwrap, the envelope field's when the SDL declares it.
|
|
291
|
+
*/
|
|
292
|
+
export function graphqlComparandLeafRule(sent, expected, relaxed, rootLeaf, prefix) {
|
|
293
|
+
const p = prefix;
|
|
294
|
+
const field = `${p}GqlFieldOf<${p}GqlTypeOf<${rootLeaf}>, ${p}GqlSingleKey<${p}GqlPayloadKeys<${sent}>>>`;
|
|
295
|
+
return `[${sent}] extends [${relaxed}] ? ${rootLeaf} : ([${p}GqlPayloadOf<${sent}>] extends [never] ? ${rootLeaf} : [${p}GqlReadsOuter<${sent}, ${expected}>] extends [true] ? ${rootLeaf} : ([unknown] extends [${field}] ? ${rootLeaf} : ${field}))`;
|
|
296
|
+
}
|
|
297
|
+
/** The scalar form's wire line over the comparand (carrick#4403): each leaf as its scalar sends it. */
|
|
298
|
+
export function graphqlScalarWireRule(comparand, relaxed, leaf, prefix) {
|
|
299
|
+
const p = prefix;
|
|
300
|
+
return `[${comparand}] extends [${relaxed}] ? ${comparand} : (${p}JsonWireSame<${p}GqlLeafSent<${comparand}, ${leaf}>, ${comparand}> extends true ? ${comparand} : ${p}GqlLeafSent<${comparand}, ${leaf}>)`;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The record-field rule's helpers (carrick#1875), namespaced by `prefix`:
|
|
304
|
+
* `<p>GqlObjectLeaf`, `<p>GqlJsonValueLike`, `<p>GqlNotShape`,
|
|
305
|
+
* `<p>GqlConvertedField` and `<p>GqlSdlFilled`. They read `<p>GqlTypes`,
|
|
306
|
+
* `<p>GqlFieldOf` and `<p>GqlDepth`, so they follow the leaf walk's lines.
|
|
307
|
+
*
|
|
308
|
+
* `GqlSdlFilled<C, F>` is `C` with every field the SDL type `F` declares and
|
|
309
|
+
* the record lacks filled with `any`: a root resolver's record often lacks
|
|
310
|
+
* fields (relations, computed fields) that field resolvers the check does not
|
|
311
|
+
* read supply. A field the SDL does not declare, and a leaf that mismatches
|
|
312
|
+
* beside the absent fields, still fail with the filling, so they stay breaks.
|
|
313
|
+
*
|
|
314
|
+
* Rule G: a field the record HAS is filled too when the SDL types it as an
|
|
315
|
+
* object type (or a list of them, at any depth) and the record's own type for
|
|
316
|
+
* it is not an object shape: a primitive, or a generic JSON value. A field
|
|
317
|
+
* resolver converts it. The JSON value is read by its structure, on the whole
|
|
318
|
+
* field before any union splits: it holds every JSON primitive, and an array
|
|
319
|
+
* of itself and a string-keyed object of itself both assign to it. A field
|
|
320
|
+
* that is, or includes, an object shape is still compared field by field. The
|
|
321
|
+
* root record is never a field, so it is never filled whole.
|
|
322
|
+
*/
|
|
323
|
+
export function graphqlFieldResolverDeclarations(prefix) {
|
|
324
|
+
const p = prefix;
|
|
325
|
+
return [
|
|
326
|
+
`type ${p}GqlObjectLeaf<F> = [F] extends [{ non_null: infer I }] ? ${p}GqlObjectLeaf<I> : [F] extends [{ list: infer I }] ? ${p}GqlObjectLeaf<I> : [F] extends [{ type: infer T }] ? ([T] extends [keyof ${p}GqlTypes] ? true : false) : false;`,
|
|
327
|
+
`type ${p}GqlJsonValueLike<X> = [string | number | boolean] extends [X] ? ([X[]] extends [X] ? ([{ [k: string]: X }] extends [X] ? true : false) : false) : false;`,
|
|
328
|
+
`type ${p}GqlNotShape<X> = [X] extends [never] ? false : [X] extends [string | number | boolean | bigint] ? true : ${p}GqlJsonValueLike<X>;`,
|
|
329
|
+
`type ${p}GqlConvertedField<C, F> = [unknown] extends [C] ? false : [${p}GqlObjectLeaf<F>] extends [true] ? ${p}GqlNotShape<Exclude<C, null | undefined>> : false;`,
|
|
330
|
+
`type ${p}GqlSdlFilled<C, F, D extends number = 15> = [D] extends [never] ? C : [unknown] extends [C] ? C : [F] extends [{ non_null: infer I }] ? ${p}GqlSdlFilled<C, I, D> : C extends null | undefined ? C : [F] extends [{ list: infer I }] ? (C extends readonly unknown[] ? { [K in keyof C]: ${p}GqlSdlFilled<C[K], I, ${p}GqlDepth[D]> } : C) : [F] extends [{ type: infer T }] ? ([T] extends [keyof ${p}GqlTypes] ? (C extends readonly unknown[] ? C : C extends (...args: any[]) => any ? C : C extends object ? { [K in keyof C]: [${p}GqlConvertedField<C[K], ${p}GqlFieldOf<T, K>>] extends [true] ? any : ${p}GqlSdlFilled<C[K], ${p}GqlFieldOf<T, K>, ${p}GqlDepth[D]> } & { [K in Exclude<keyof ${p}GqlTypes[T], keyof C>]: any } : C) : C) : C;`,
|
|
233
331
|
];
|
|
234
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* The record-field gate's question (carrick#1875): true when the wire line
|
|
335
|
+
* fails and the wire type with SDL-declared fields filled
|
|
336
|
+
* (`graphqlFieldResolverDeclarations`) passes, so the verdict hangs on a
|
|
337
|
+
* field resolver nobody read. `wire` is the scalar form's wire type, `leaf`
|
|
338
|
+
* the comparand's SDL leaf.
|
|
339
|
+
*/
|
|
340
|
+
export function graphqlFieldResolverRule(wire, relaxed, leaf, prefix) {
|
|
341
|
+
return `[${wire}] extends [${relaxed}] ? false : [${prefix}GqlSdlFilled<${wire}, ${leaf}>] extends [${relaxed}] ? true : false`;
|
|
342
|
+
}
|
|
235
343
|
export function decisiveAssignmentLine(plan) {
|
|
236
344
|
return plan.wireAssignmentLine ?? plan.assignmentLine;
|
|
237
345
|
}
|
|
@@ -386,15 +494,9 @@ export function buildProbe(spec, packageOf, unwidenedAliasFor, expectedTolerates
|
|
|
386
494
|
// types fail both its array and its object arm), and the comparand is
|
|
387
495
|
// re-gated below anyway — the v2 port of v1's comparand re-guard, so
|
|
388
496
|
// a payload decayed to a top type can never read compatible.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
push(`type GqlSingleKey<K> = [K] extends [never] ? never : ([GqlIsUnion<K>] extends [false] ? K : never);`);
|
|
393
|
-
push(`type GqlPayloadOf<S> = [S] extends [readonly unknown[]] ? never : [GqlIsUnion<S>] extends [true] ? never : [S] extends [object] ? ([GqlSingleKey<GqlPayloadKeys<S>>] extends [never] ? never : S[GqlSingleKey<GqlPayloadKeys<S>> & keyof S]) : never;`);
|
|
394
|
-
// The field names a reading declares: the keys of every object member, so
|
|
395
|
-
// a nullable or union consumer names what each member names.
|
|
396
|
-
push(`type GqlNames<T> = T extends object ? keyof T : never;`);
|
|
397
|
-
push(`type GqlReadsOuter<S, E> = [Extract<Exclude<GqlNames<S>, GqlNames<GqlPayloadOf<S>>>, Exclude<GqlNames<E>, '__typename'>>] extends [never] ? false : true;`);
|
|
497
|
+
// - `GqlNames` is the field names a reading declares: the keys of every
|
|
498
|
+
// object member, so a nullable or union consumer names what each
|
|
499
|
+
// member names.
|
|
398
500
|
// carrick#1759: the server supplies `__typename` on every object a
|
|
399
501
|
// selection asks for, so the consumer's `__typename` is read as OPTIONAL,
|
|
400
502
|
// at any depth. It keeps its declared type: a producer that states a
|
|
@@ -415,11 +517,10 @@ export function buildProbe(spec, packageOf, unwidenedAliasFor, expectedTolerates
|
|
|
415
517
|
// The envelope short-circuit below tests the RELAXED consumer: a consumer
|
|
416
518
|
// that names only fields the payload shares would otherwise fail it on
|
|
417
519
|
// `__typename` alone and unwrap onto that payload.
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
push(`type
|
|
421
|
-
push(`type
|
|
422
|
-
push(`type GqlComparand = [Sent] extends [GqlExpected] ? Sent : ([GqlPayloadOf<Sent>] extends [never] ? Sent : [GqlReadsOuter<Sent, Expected>] extends [true] ? Sent : GqlPayloadOf<Sent>);`);
|
|
520
|
+
for (const line of graphqlGenericDeclarations(''))
|
|
521
|
+
push(line);
|
|
522
|
+
push(`type GqlExpected = ${graphqlExpectedRule('Expected', '')};`);
|
|
523
|
+
push(`type GqlComparand = ${graphqlComparandRule('Sent', 'Expected', 'GqlExpected', '')};`);
|
|
423
524
|
gateLines.set(push(`type _G_comparand_any = Assert<Not<IsAny<GqlComparand>>>;`), 'sent:any');
|
|
424
525
|
gateLines.set(push(`type _G_comparand_unknown = Assert<Not<IsUnknown<GqlComparand>>>;`), 'sent:unknown');
|
|
425
526
|
gateLines.set(push(`type _G_comparand_never = Assert<Not<IsNever<GqlComparand>>>;`), 'sent:never');
|
|
@@ -453,10 +554,16 @@ export function buildProbe(spec, packageOf, unwidenedAliasFor, expectedTolerates
|
|
|
453
554
|
// After a single-payload unwrap the comparand is the payload: its leaf
|
|
454
555
|
// is the envelope field's, when the SDL declares the envelope. When it
|
|
455
556
|
// does not, the root leaf already describes the payload.
|
|
456
|
-
push(`type GqlComparandLeaf =
|
|
457
|
-
push(`type GqlWire =
|
|
557
|
+
push(`type GqlComparandLeaf = ${graphqlComparandLeafRule('Sent', 'Expected', 'GqlExpected', 'GqlRootLeaf', '')};`);
|
|
558
|
+
push(`type GqlWire = ${graphqlScalarWireRule('GqlComparand', 'GqlExpected', 'GqlComparandLeaf', '')};`);
|
|
458
559
|
push(`declare const sentWire: GqlWire;`);
|
|
459
560
|
wireAssignmentLine = push(`const expectedWire: GqlExpected = sentWire;`);
|
|
561
|
+
// carrick#1875: the record-field gate (`graphqlFieldResolverRule`).
|
|
562
|
+
// Every line sits after the wire line, so no line above it moves.
|
|
563
|
+
for (const line of graphqlFieldResolverDeclarations(''))
|
|
564
|
+
push(line);
|
|
565
|
+
push(`type SdlFieldDecides = ${graphqlFieldResolverRule('GqlWire', 'GqlExpected', 'GqlComparandLeaf', '')};`);
|
|
566
|
+
gateLines.set(push(`type _G_sent_field_resolver = Assert<Not<SdlFieldDecides>>;`), 'sent:field_resolver');
|
|
460
567
|
}
|
|
461
568
|
}
|
|
462
569
|
else {
|
|
@@ -55,10 +55,10 @@ export { moduleExport } from './anchors.js';
|
|
|
55
55
|
export { callNamedBy, callResultNamesNoCall, isFrameworkMachinery, nodeByLocatorText, normalizeLocatorText, symbolDeclaredOutside, typeIsOrContainsMachinery, wrapsValueTransparently, type DeclaredOutside, } from './site-node.js';
|
|
56
56
|
export { runCheck, judgeTscPath } from './check.js';
|
|
57
57
|
export type { CheckProgress } from './check.js';
|
|
58
|
-
export { jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor, type JudgeTolerances } from './check-probe.js';
|
|
58
|
+
export { graphqlComparandLeafRule, graphqlComparandRule, graphqlExpectedRule, graphqlFieldResolverDeclarations, graphqlFieldResolverRule, graphqlGenericDeclarations, graphqlLeafWalkDeclarations, graphqlScalarWireRule, jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor, type JudgeTolerances, } from './check-probe.js';
|
|
59
59
|
export { fitOptionsOf, judgeFitOptions, type FitOptions } from './check-workspace.js';
|
|
60
60
|
export { nodeByExpressionText, isPreferredTarget } from './anchors.js';
|
|
61
|
-
export { graphqlDeclaresType, graphqlFieldLeaf, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
|
|
61
|
+
export { graphqlDeclaresType, graphqlFieldLeaf, graphqlReachableFields, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
|
|
62
62
|
export { findDisqualifyingTopTypes } from './deep-walk.js';
|
|
63
63
|
/**
|
|
64
64
|
* The name of THIS capture's surface entry, without an extension
|
|
@@ -79,10 +79,10 @@ export { callNamedBy, callResultNamesNoCall, isFrameworkMachinery, nodeByLocator
|
|
|
79
79
|
// v2 check core ("tsc as the judge"). Same bundle, same seam: the sidecar
|
|
80
80
|
// reaches it only through this door (index.js).
|
|
81
81
|
export { runCheck, judgeTscPath } from './check.js';
|
|
82
|
-
export { jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor } from './check-probe.js';
|
|
82
|
+
export { graphqlComparandLeafRule, graphqlComparandRule, graphqlExpectedRule, graphqlFieldResolverDeclarations, graphqlFieldResolverRule, graphqlGenericDeclarations, graphqlLeafWalkDeclarations, graphqlScalarWireRule, jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor, } from './check-probe.js';
|
|
83
83
|
export { fitOptionsOf, judgeFitOptions } from './check-workspace.js';
|
|
84
84
|
export { nodeByExpressionText, isPreferredTarget } from './anchors.js';
|
|
85
|
-
export { graphqlDeclaresType, graphqlFieldLeaf, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
|
|
85
|
+
export { graphqlDeclaresType, graphqlFieldLeaf, graphqlReachableFields, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
|
|
86
86
|
export { findDisqualifyingTopTypes } from './deep-walk.js';
|
|
87
87
|
const SURFACE_ENTRY_BASENAME = '__carrick_surface__';
|
|
88
88
|
/** Captures made by this process, so each one's entry file has a name of its
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"sentence": "the request read located here is a path parameter or a query the route validates rather than a body, so the scan compared nothing at this site",
|
|
32
32
|
"decided": "always"
|
|
33
33
|
},
|
|
34
|
+
"reply_state": {
|
|
35
|
+
"sentence": "the request read located here is state the server keeps on its reply object, filled by its own code, not what a caller sends, so nothing was compared at this site",
|
|
36
|
+
"decided": "always"
|
|
37
|
+
},
|
|
34
38
|
"projected_value_only": {
|
|
35
39
|
"sentence": "every read of the call's result takes a member out of it, so the site states part of a payload rather than a whole one and the scan compared nothing here",
|
|
36
40
|
"decided": "always"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs_sha256":"
|
|
1
|
+
{"inputs_sha256":"798150f93f1d6f4965b7e52a360a610ef4b12e28ed4eac9e87f74fc1017e2f22"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* shadow).
|
|
25
25
|
*/
|
|
26
26
|
import type { ProjectLoader } from './project-loader.js';
|
|
27
|
-
import { type FitOptions, type JudgeTolerances } from './capture/index.js';
|
|
27
|
+
import { type FitOptions, type GraphqlLeaf, type GraphqlRoot, type GraphqlTypes, type JudgeTolerances } from './capture/index.js';
|
|
28
28
|
/** What `write_shadow` answers. */
|
|
29
29
|
export interface ShadowResult {
|
|
30
30
|
/** Absolute path of the generated `w/tsconfig.json`. */
|
|
@@ -55,6 +55,14 @@ export interface ShadowResult {
|
|
|
55
55
|
wire: string[];
|
|
56
56
|
/** The judge's three tolerances, read from its own code (`judgeTolerances('__carrick_')`): declarations to append beside `wire`. */
|
|
57
57
|
tolerances: JudgeTolerances;
|
|
58
|
+
/**
|
|
59
|
+
* Present when the request carried the service's GraphQL table: the judge's
|
|
60
|
+
* GraphQL rules as declarations (`lines`), the one table declaration they
|
|
61
|
+
* read (`types_decl`, null when no root is read in the scalar form), and the
|
|
62
|
+
* leaf of each root the judge reads in the scalar form, by `Type.field`
|
|
63
|
+
* (`wireFormFor`). A root with no leaf is checked in the JSON form.
|
|
64
|
+
*/
|
|
65
|
+
graphql?: HeldGraphql;
|
|
58
66
|
/** The fit options this shadow program was written with, and the judge's: a held check is armed only when they agree. */
|
|
59
67
|
options: {
|
|
60
68
|
service: FitOptions;
|
|
@@ -70,6 +78,37 @@ export declare function nativeTscPath(tscPath?: string): string | null;
|
|
|
70
78
|
* must be outside the scan root). Reads the program; changes nothing in the
|
|
71
79
|
* checkout.
|
|
72
80
|
*/
|
|
73
|
-
export declare function writeShadow(loader: ProjectLoader, outDir: string
|
|
81
|
+
export declare function writeShadow(loader: ProjectLoader, outDir: string, graphql?: {
|
|
82
|
+
types: GraphqlTypes;
|
|
83
|
+
roots: GraphqlRoot[];
|
|
84
|
+
}): ShadowResult;
|
|
74
85
|
/** The wire declarations and the one rule type a held check appends (prefix `__carrick_`). */
|
|
75
86
|
export declare function heldWire(): string[];
|
|
87
|
+
/** What a held GraphQL check appends (see `ShadowResult.graphql`). */
|
|
88
|
+
export interface HeldGraphql {
|
|
89
|
+
lines: string[];
|
|
90
|
+
types_decl: string | null;
|
|
91
|
+
leaves: Record<string, GraphqlLeaf>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The judge's GraphQL rules as declarations a held check appends beside `wire`
|
|
95
|
+
* and `tolerances` (prefix `__carrick_`). Every rule is the judge's own text
|
|
96
|
+
* (`check-probe.ts`), so a held check and the probe answer from one writer:
|
|
97
|
+
*
|
|
98
|
+
* - `__carrick_GqlSent<S, E>`: the JSON form, `S` the resolver's value and
|
|
99
|
+
* `E` the caller's expected type;
|
|
100
|
+
* - `__carrick_GqlSentS<S, E, R>`: the scalar form, `R` the root's leaf
|
|
101
|
+
* (`leaves`); it reads `__carrick_GqlTypes` (`types_decl`). A
|
|
102
|
+
* declared-void caller states no contract, and is kept; a pair the judge's
|
|
103
|
+
* record-field gate abstains on (carrick#1875) is silent too.
|
|
104
|
+
*
|
|
105
|
+
* `scalar` adds the scalar form's lines; they name `__carrick_GqlTypes`, so
|
|
106
|
+
* they are written only when the table is declared.
|
|
107
|
+
*/
|
|
108
|
+
export declare function heldGraphqlWire(scalar: boolean): string[];
|
|
109
|
+
/**
|
|
110
|
+
* The GraphQL answer for a service's table and roots: a leaf only for a root
|
|
111
|
+
* whose form the judge reads as `graphql_scalars` (`wireFormFor`), the table
|
|
112
|
+
* every such leaf reaches, and the declarations.
|
|
113
|
+
*/
|
|
114
|
+
export declare function heldGraphql(types: GraphqlTypes, roots: GraphqlRoot[]): HeldGraphql;
|
|
@@ -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, judgeTscPath, jsonWireDeclarations, jsonWireRule, judgeTolerances, fitOptionsOf, judgeFitOptions } from './capture/index.js';
|
|
29
|
+
import { WriteGuard, graphqlComparandLeafRule, graphqlComparandRule, graphqlExpectedRule, graphqlFieldResolverDeclarations, graphqlFieldResolverRule, graphqlGenericDeclarations, graphqlLeafWalkDeclarations, graphqlReachableFields, graphqlRootLeaf, graphqlScalarWireRule, judgeTscPath, jsonWireDeclarations, jsonWireRule, judgeTolerances, 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). */
|
|
@@ -53,7 +53,7 @@ function isLibraryFile(program, fileName) {
|
|
|
53
53
|
* must be outside the scan root). Reads the program; changes nothing in the
|
|
54
54
|
* checkout.
|
|
55
55
|
*/
|
|
56
|
-
export function writeShadow(loader, outDir) {
|
|
56
|
+
export function writeShadow(loader, outDir, graphql) {
|
|
57
57
|
const scanRoot = loader.getScanRoot();
|
|
58
58
|
const program = loader.getProject().getProgram().compilerObject;
|
|
59
59
|
const internal = program;
|
|
@@ -201,6 +201,7 @@ export function writeShadow(loader, outDir) {
|
|
|
201
201
|
path_conflicts: pathConflicts,
|
|
202
202
|
bare_specifiers: Object.keys(paths).sort(),
|
|
203
203
|
wire: heldWire(),
|
|
204
|
+
...(graphql === undefined ? {} : { graphql: heldGraphql(graphql.types, graphql.roots) }),
|
|
204
205
|
tolerances: judgeTolerances('__carrick_'),
|
|
205
206
|
options: { service: fitOptionsOf(compilerOptions), judge: judgeFitOptions() },
|
|
206
207
|
native_tsc: nativeTscPath(),
|
|
@@ -213,6 +214,71 @@ export function heldWire() {
|
|
|
213
214
|
`type __carrick_Wire<S, E> = ${jsonWireRule('S', 'E', '__carrick_')};`,
|
|
214
215
|
];
|
|
215
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* The judge's GraphQL rules as declarations a held check appends beside `wire`
|
|
219
|
+
* and `tolerances` (prefix `__carrick_`). Every rule is the judge's own text
|
|
220
|
+
* (`check-probe.ts`), so a held check and the probe answer from one writer:
|
|
221
|
+
*
|
|
222
|
+
* - `__carrick_GqlSent<S, E>`: the JSON form, `S` the resolver's value and
|
|
223
|
+
* `E` the caller's expected type;
|
|
224
|
+
* - `__carrick_GqlSentS<S, E, R>`: the scalar form, `R` the root's leaf
|
|
225
|
+
* (`leaves`); it reads `__carrick_GqlTypes` (`types_decl`). A
|
|
226
|
+
* declared-void caller states no contract, and is kept; a pair the judge's
|
|
227
|
+
* record-field gate abstains on (carrick#1875) is silent too.
|
|
228
|
+
*
|
|
229
|
+
* `scalar` adds the scalar form's lines; they name `__carrick_GqlTypes`, so
|
|
230
|
+
* they are written only when the table is declared.
|
|
231
|
+
*/
|
|
232
|
+
export function heldGraphqlWire(scalar) {
|
|
233
|
+
const p = '__carrick_';
|
|
234
|
+
const relaxed = `${p}GqlExpected<E>`;
|
|
235
|
+
const comparand = `${p}GqlComparand<S, E>`;
|
|
236
|
+
const lines = [
|
|
237
|
+
...graphqlGenericDeclarations(p),
|
|
238
|
+
`type ${p}GqlExpected<E> = ${graphqlExpectedRule('E', p)};`,
|
|
239
|
+
`type ${p}GqlComparand<S, E> = ${graphqlComparandRule('S', 'E', relaxed, p)};`,
|
|
240
|
+
`type ${p}GqlSent<S, E> = ${p}IsVoid<E> extends true ? E : ${p}Wire<${comparand}, ${relaxed}>;`,
|
|
241
|
+
];
|
|
242
|
+
if (!scalar)
|
|
243
|
+
return lines;
|
|
244
|
+
const leaf = `${p}GqlComparandLeaf<S, E, R>`;
|
|
245
|
+
const form = `${p}GqlWireForm<S, E, R>`;
|
|
246
|
+
return [
|
|
247
|
+
...lines,
|
|
248
|
+
...graphqlLeafWalkDeclarations(p),
|
|
249
|
+
`type ${p}GqlComparandLeaf<S, E, R> = ${graphqlComparandLeafRule('S', 'E', relaxed, 'R', p)};`,
|
|
250
|
+
`type ${p}GqlWireForm<S, E, R> = ${graphqlScalarWireRule(comparand, relaxed, leaf, p)};`,
|
|
251
|
+
`type ${p}GqlWire<S, E, R> = ${form};`,
|
|
252
|
+
// carrick#4708: where the judge's record-field gate reads unverifiable (a
|
|
253
|
+
// field resolver nobody read supplies a field), the held form is silent:
|
|
254
|
+
// it returns the relaxed expected type, as the void gate returns `E`.
|
|
255
|
+
...graphqlFieldResolverDeclarations(p),
|
|
256
|
+
`type ${p}GqlSentS<S, E, R> = ${p}IsVoid<E> extends true ? E : (${graphqlFieldResolverRule(`${p}GqlWire<S, E, R>`, relaxed, leaf, p)}) extends true ? ${relaxed} : ${p}GqlWire<S, E, R>;`,
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The GraphQL answer for a service's table and roots: a leaf only for a root
|
|
261
|
+
* whose form the judge reads as `graphql_scalars` (`wireFormFor`), the table
|
|
262
|
+
* every such leaf reaches, and the declarations.
|
|
263
|
+
*/
|
|
264
|
+
export function heldGraphql(types, roots) {
|
|
265
|
+
const leaves = {};
|
|
266
|
+
const reachable = {};
|
|
267
|
+
for (const root of roots) {
|
|
268
|
+
if (wireFormFor('graphql', 'response', 'producer', { graphql: { types, root } }) !== 'graphql_scalars')
|
|
269
|
+
continue;
|
|
270
|
+
const leaf = graphqlRootLeaf(types, root);
|
|
271
|
+
leaves[`${root.type}.${root.field}`] = leaf;
|
|
272
|
+
Object.assign(reachable, graphqlReachableFields(types, leaf));
|
|
273
|
+
}
|
|
274
|
+
const scalar = Object.keys(leaves).length > 0;
|
|
275
|
+
const table = Object.fromEntries(Object.keys(reachable).sort().map((name) => [name, reachable[name]]));
|
|
276
|
+
return {
|
|
277
|
+
lines: heldGraphqlWire(scalar),
|
|
278
|
+
types_decl: scalar ? `type __carrick_GqlTypes = ${JSON.stringify(table)};` : null,
|
|
279
|
+
leaves,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
216
282
|
function safeRealpath(p) {
|
|
217
283
|
try {
|
|
218
284
|
return fs.realpathSync(p);
|
|
@@ -765,7 +765,7 @@ function handleWriteShadow(request) {
|
|
|
765
765
|
try {
|
|
766
766
|
const loader = initializedLoader();
|
|
767
767
|
const startTime = performance.now();
|
|
768
|
-
const result = writeShadow(loader, request.out_dir);
|
|
768
|
+
const result = writeShadow(loader, request.out_dir, request.graphql);
|
|
769
769
|
log(`Wrote the shadow of ${result.own_files.length} own file(s) in ${Math.round(performance.now() - startTime)}ms`);
|
|
770
770
|
return { request_id: request.request_id, status: 'success', ...result };
|
|
771
771
|
}
|
|
@@ -935,7 +935,7 @@ function handleShutdown(request) {
|
|
|
935
935
|
// Schedule exit after response is sent
|
|
936
936
|
setImmediate(() => {
|
|
937
937
|
log('Exiting');
|
|
938
|
-
|
|
938
|
+
exitAfterDrain(0);
|
|
939
939
|
});
|
|
940
940
|
return {
|
|
941
941
|
request_id: request.request_id,
|
|
@@ -999,6 +999,23 @@ function handleRequest(request) {
|
|
|
999
999
|
};
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Exit once every byte already written to stdout has left this process.
|
|
1004
|
+
* `process.exit` drops what a pipe has not taken yet, and a pipe takes 64 KiB
|
|
1005
|
+
* at a time, so an answer larger than that was cut mid-frame. An empty write
|
|
1006
|
+
* is queued behind every earlier one; its callback runs when they are done
|
|
1007
|
+
* (or failed, when the reader is gone). The timer bounds the wait on a reader
|
|
1008
|
+
* that is alive but never reads.
|
|
1009
|
+
*/
|
|
1010
|
+
const DRAIN_LIMIT_MS = 10000;
|
|
1011
|
+
let exiting = false;
|
|
1012
|
+
function exitAfterDrain(code) {
|
|
1013
|
+
if (exiting)
|
|
1014
|
+
return;
|
|
1015
|
+
exiting = true;
|
|
1016
|
+
setTimeout(() => process.exit(code), DRAIN_LIMIT_MS).unref();
|
|
1017
|
+
process.stdout.write('', () => process.exit(code));
|
|
1018
|
+
}
|
|
1002
1019
|
// ===========================================================================
|
|
1003
1020
|
// Response Writer
|
|
1004
1021
|
// ===========================================================================
|
|
@@ -1102,7 +1119,7 @@ function exitWhenParentIsGone() {
|
|
|
1102
1119
|
setInterval(() => {
|
|
1103
1120
|
if (process.ppid !== startedBy) {
|
|
1104
1121
|
log(`parent ${startedBy} is gone, exiting`);
|
|
1105
|
-
|
|
1122
|
+
exitAfterDrain(0);
|
|
1106
1123
|
}
|
|
1107
1124
|
}, PARENT_CHECK_MS).unref();
|
|
1108
1125
|
}
|
|
@@ -1119,17 +1136,17 @@ function main() {
|
|
|
1119
1136
|
rl.on('line', processLine);
|
|
1120
1137
|
rl.on('close', () => {
|
|
1121
1138
|
log('stdin closed, exiting');
|
|
1122
|
-
|
|
1139
|
+
exitAfterDrain(0);
|
|
1123
1140
|
});
|
|
1124
1141
|
exitWhenParentIsGone();
|
|
1125
1142
|
// Handle process signals
|
|
1126
1143
|
process.on('SIGINT', () => {
|
|
1127
1144
|
log('SIGINT received, exiting');
|
|
1128
|
-
|
|
1145
|
+
exitAfterDrain(0);
|
|
1129
1146
|
});
|
|
1130
1147
|
process.on('SIGTERM', () => {
|
|
1131
1148
|
log('SIGTERM received, exiting');
|
|
1132
|
-
|
|
1149
|
+
exitAfterDrain(0);
|
|
1133
1150
|
});
|
|
1134
1151
|
// Fail fast on uncaught errors. Continuing after one means serving later
|
|
1135
1152
|
// requests from a possibly corrupted state and returning garbage types
|
|
@@ -1139,7 +1156,7 @@ function main() {
|
|
|
1139
1156
|
process.on('uncaughtException', (err) => {
|
|
1140
1157
|
logError(`Uncaught exception (exiting): ${err.message}`);
|
|
1141
1158
|
logError(err.stack || '');
|
|
1142
|
-
|
|
1159
|
+
exitAfterDrain(1);
|
|
1143
1160
|
});
|
|
1144
1161
|
process.on('unhandledRejection', (reason) => {
|
|
1145
1162
|
// This log is the last diagnostic before exit, so it must be actionable:
|
|
@@ -1157,7 +1174,7 @@ function main() {
|
|
|
1157
1174
|
}
|
|
1158
1175
|
}
|
|
1159
1176
|
logError(`Unhandled rejection (exiting): ${detail}`);
|
|
1160
|
-
|
|
1177
|
+
exitAfterDrain(1);
|
|
1161
1178
|
});
|
|
1162
1179
|
}
|
|
1163
1180
|
// Start the sidecar
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* type parameter of the reply type. A union of success and error bodies is
|
|
16
16
|
* cut to the variants a success-status send through the parameter carries.
|
|
17
17
|
*/
|
|
18
|
-
import { Node, type ArrowFunction, type CallExpression, type FunctionDeclaration, type FunctionExpression, type MethodDeclaration, type ParameterDeclaration, type Type } from 'ts-morph';
|
|
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
21
|
/** A function a handler can be: what the inferrer follows a registration to. */
|
|
@@ -137,6 +137,14 @@ export declare class StatedParams {
|
|
|
137
137
|
* nothing about this route.
|
|
138
138
|
*/
|
|
139
139
|
private statedPayload;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the type has a member the server labels name as a send or a set:
|
|
142
|
+
* the shape of a reply object (a response, a context that replies). Read
|
|
143
|
+
* from declarations, never from names.
|
|
144
|
+
*/
|
|
145
|
+
holdsReplyMember(type: Type): boolean;
|
|
146
|
+
/** Whether the symbol is a member the server labels name as a request body. */
|
|
147
|
+
isBodyMember(symbol: TsSymbol | undefined): boolean;
|
|
140
148
|
/** The payload slot a labelled send member takes, by any of its declarations. */
|
|
141
149
|
private sendSlotOf;
|
|
142
150
|
/** The payload slot a member set by assignment takes, by any of its declarations. */
|
|
@@ -502,6 +502,25 @@ export class StatedParams {
|
|
|
502
502
|
return 'none';
|
|
503
503
|
return payload ?? 'none';
|
|
504
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Whether the type has a member the server labels name as a send or a set:
|
|
507
|
+
* the shape of a reply object (a response, a context that replies). Read
|
|
508
|
+
* from declarations, never from names.
|
|
509
|
+
*/
|
|
510
|
+
holdsReplyMember(type) {
|
|
511
|
+
if (this.labels.sends.size === 0 && this.labels.sets.size === 0)
|
|
512
|
+
return false;
|
|
513
|
+
return type.getProperties().some((property) => {
|
|
514
|
+
const declarations = (property.getDeclarations() ?? []).map((d) => d.compilerNode);
|
|
515
|
+
return this.sendSlotOf(declarations) !== undefined || this.setSlotOf(declarations) !== undefined;
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/** Whether the symbol is a member the server labels name as a request body. */
|
|
519
|
+
isBodyMember(symbol) {
|
|
520
|
+
if (!symbol || this.labels.bodies.size === 0)
|
|
521
|
+
return false;
|
|
522
|
+
return (symbol.getDeclarations() ?? []).some((d) => this.labels.bodies.has(declarationKey(d.compilerNode)));
|
|
523
|
+
}
|
|
505
524
|
/** The payload slot a labelled send member takes, by any of its declarations. */
|
|
506
525
|
sendSlotOf(declarations) {
|
|
507
526
|
for (const declaration of declarations) {
|
|
@@ -2213,6 +2213,20 @@ export declare class TypeInferrer {
|
|
|
2213
2213
|
/** The property access that reads a member straight off `cast`, parentheses aside. */
|
|
2214
2214
|
private memberReadOffCast;
|
|
2215
2215
|
private inferRequestReadFromHandler;
|
|
2216
|
+
/**
|
|
2217
|
+
* Whether `expression` is a value read off one of `handler`'s own
|
|
2218
|
+
* parameters, named or destructured: the parameter itself, or a member of
|
|
2219
|
+
* it, through parentheses and `!`.
|
|
2220
|
+
*
|
|
2221
|
+
* With `throughReads` (carrick#4709), also a value the handler reads on from
|
|
2222
|
+
* one: through `await`, element access and a cast; a call made on such a
|
|
2223
|
+
* value or handed one (`c.req.json()`, `JSON.parse(raw)`,
|
|
2224
|
+
* `Schema.parse(request.body)`); and one hop through a local the handler
|
|
2225
|
+
* binds from such a read (`const raw = await request.json()`). A literal
|
|
2226
|
+
* the handler builds, or a value made from a local twice removed, is not
|
|
2227
|
+
* one.
|
|
2228
|
+
*/
|
|
2229
|
+
private rootedAtParameterOf;
|
|
2216
2230
|
/**
|
|
2217
2231
|
* The call in a handler that reads the request's body off the platform
|
|
2218
2232
|
* request the handler was handed, or `undefined` (carrick#807).
|