@suss/adapter-typescript 0.8.0 → 0.10.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/README.md +36 -0
- package/dist/index.cjs +1258 -350
- package/dist/index.d.cts +44 -10
- package/dist/index.d.ts +44 -10
- package/dist/index.js +1252 -335
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -2,17 +2,41 @@ import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunctio
|
|
|
2
2
|
import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
|
|
3
3
|
import { BehavioralSummary, MessageBusSemantics, DeployableUnit, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* cache.ts: the on-disk extraction cache.
|
|
7
|
+
*
|
|
8
|
+
* A run reuses the previous one's summaries whole when nothing
|
|
9
|
+
* changed, and per file when some files did. The entry directory is
|
|
10
|
+
* named after everything that has to agree before any reuse is sound:
|
|
11
|
+
* schema version, adapter version and code hash, pack versions, the
|
|
12
|
+
* extraction config stamp and the tsconfig path. Inside it, the
|
|
13
|
+
* manifest records a stamp and content hash per file, each summary's
|
|
14
|
+
* owning files, and per owning file the other files its walk read, so
|
|
15
|
+
* a change to any of those re-extracts the owner instead of serving a
|
|
16
|
+
* stale answer. The full design, including what per-file reuse can
|
|
17
|
+
* and cannot promise, is in this package's README.
|
|
18
|
+
*/
|
|
19
|
+
|
|
5
20
|
/** Reported by `lookup`: what the cache decided, and why. */
|
|
6
21
|
interface CacheDiagnostic {
|
|
7
|
-
kind: "hit" | "miss";
|
|
22
|
+
kind: "hit" | "miss" | "partial";
|
|
8
23
|
/**
|
|
9
24
|
* Reason the lookup missed (only set when kind === "miss").
|
|
10
|
-
* `key-changed` means the cache directory
|
|
25
|
+
* `key-changed` means the cache directory contains entries, but none
|
|
11
26
|
* under this run's schema, adapter, packs and tsconfig path.
|
|
12
27
|
* `files-changed` means the include set is not the one the entry
|
|
13
28
|
* was written from.
|
|
14
29
|
*/
|
|
15
30
|
missReason?: "no-manifest" | "key-changed" | "tsconfig-changed" | "files-changed";
|
|
31
|
+
/** Set when kind === "partial". */
|
|
32
|
+
partial?: {
|
|
33
|
+
filesChanged: number;
|
|
34
|
+
filesRemoved: number;
|
|
35
|
+
rootsReused: number;
|
|
36
|
+
rootsReextracted: number;
|
|
37
|
+
rootsDeclined: number;
|
|
38
|
+
summariesReused: number;
|
|
39
|
+
};
|
|
16
40
|
}
|
|
17
41
|
/**
|
|
18
42
|
* Result of a cache lookup. A hit gives back the whole summary set; a miss
|
|
@@ -21,6 +45,7 @@ interface CacheDiagnostic {
|
|
|
21
45
|
type CacheLookup = {
|
|
22
46
|
kind: "hit";
|
|
23
47
|
summaries: BehavioralSummary[];
|
|
48
|
+
projectRoot?: string;
|
|
24
49
|
diagnostic: CacheDiagnostic;
|
|
25
50
|
} | {
|
|
26
51
|
kind: "miss";
|
|
@@ -180,6 +205,8 @@ declare class ResolutionStore {
|
|
|
180
205
|
private readonly fullyExtracted;
|
|
181
206
|
private readonly seededValues;
|
|
182
207
|
private readonly importedNames;
|
|
208
|
+
/** Files the most recent wave walk entered, for the memo to keep. */
|
|
209
|
+
private lastQueryWalked;
|
|
183
210
|
private readonly declarations;
|
|
184
211
|
private readonly graph;
|
|
185
212
|
private stale;
|
|
@@ -313,17 +340,19 @@ interface DiscoveredUnit {
|
|
|
313
340
|
* path.
|
|
314
341
|
*
|
|
315
342
|
* `schemaSdl` is the typeDefs string captured from the same
|
|
316
|
-
* ApolloServer config object the resolver map came from, when
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
343
|
+
* ApolloServer config object the resolver map came from, when we can
|
|
344
|
+
* statically resolve it (string literal or gql-tagged template,
|
|
345
|
+
* inline or const-bound). The adapter puts it on one summary
|
|
346
|
+
* standing for that schema, and `schemaDocument` is the label
|
|
347
|
+
* pointing every resolver at it.
|
|
321
348
|
*/
|
|
322
349
|
resolverInfo?: {
|
|
323
350
|
/** Null when the source never says which type the resolver attaches to. */
|
|
324
351
|
typeName: string | null;
|
|
325
352
|
fieldName: string;
|
|
326
353
|
schemaSdl?: string;
|
|
354
|
+
/** The file whose server config declares the schema. */
|
|
355
|
+
schemaDocument?: string;
|
|
327
356
|
};
|
|
328
357
|
/**
|
|
329
358
|
* Populated by `graphqlHookCall` discovery (GraphQL consumer side).
|
|
@@ -438,6 +467,12 @@ interface MountPrefixIndex {
|
|
|
438
467
|
* couldn't be resolved to a literal prefix and a concrete router.
|
|
439
468
|
*/
|
|
440
469
|
effectivePrefixFor(routerNode: Node): string;
|
|
470
|
+
/**
|
|
471
|
+
* The same resolution by a router's node id, for callers replaying a
|
|
472
|
+
* recorded consumption without the node in hand (the per-file cache
|
|
473
|
+
* re-checks a stored prefix against a rebuilt index this way).
|
|
474
|
+
*/
|
|
475
|
+
prefixForId?(childId: string): string;
|
|
441
476
|
}
|
|
442
477
|
|
|
443
478
|
/**
|
|
@@ -846,9 +881,8 @@ declare function methodDeclaredIn(callee: Node, expectedModule: string): boolean
|
|
|
846
881
|
interface ReadNameOptions {
|
|
847
882
|
/**
|
|
848
883
|
* What to say about a name nothing here settles. `"nothing"` gives
|
|
849
|
-
* null. `"reference"` gives
|
|
850
|
-
*
|
|
851
|
-
* about rather than which bucket this is.
|
|
884
|
+
* null. `"reference"` gives `{location.bucket}`, which says which
|
|
885
|
+
* value to go and ask about rather than which bucket this is.
|
|
852
886
|
*/
|
|
853
887
|
unsettled?: "nothing" | "reference";
|
|
854
888
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,17 +2,41 @@ import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunctio
|
|
|
2
2
|
import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
|
|
3
3
|
import { BehavioralSummary, MessageBusSemantics, DeployableUnit, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* cache.ts: the on-disk extraction cache.
|
|
7
|
+
*
|
|
8
|
+
* A run reuses the previous one's summaries whole when nothing
|
|
9
|
+
* changed, and per file when some files did. The entry directory is
|
|
10
|
+
* named after everything that has to agree before any reuse is sound:
|
|
11
|
+
* schema version, adapter version and code hash, pack versions, the
|
|
12
|
+
* extraction config stamp and the tsconfig path. Inside it, the
|
|
13
|
+
* manifest records a stamp and content hash per file, each summary's
|
|
14
|
+
* owning files, and per owning file the other files its walk read, so
|
|
15
|
+
* a change to any of those re-extracts the owner instead of serving a
|
|
16
|
+
* stale answer. The full design, including what per-file reuse can
|
|
17
|
+
* and cannot promise, is in this package's README.
|
|
18
|
+
*/
|
|
19
|
+
|
|
5
20
|
/** Reported by `lookup`: what the cache decided, and why. */
|
|
6
21
|
interface CacheDiagnostic {
|
|
7
|
-
kind: "hit" | "miss";
|
|
22
|
+
kind: "hit" | "miss" | "partial";
|
|
8
23
|
/**
|
|
9
24
|
* Reason the lookup missed (only set when kind === "miss").
|
|
10
|
-
* `key-changed` means the cache directory
|
|
25
|
+
* `key-changed` means the cache directory contains entries, but none
|
|
11
26
|
* under this run's schema, adapter, packs and tsconfig path.
|
|
12
27
|
* `files-changed` means the include set is not the one the entry
|
|
13
28
|
* was written from.
|
|
14
29
|
*/
|
|
15
30
|
missReason?: "no-manifest" | "key-changed" | "tsconfig-changed" | "files-changed";
|
|
31
|
+
/** Set when kind === "partial". */
|
|
32
|
+
partial?: {
|
|
33
|
+
filesChanged: number;
|
|
34
|
+
filesRemoved: number;
|
|
35
|
+
rootsReused: number;
|
|
36
|
+
rootsReextracted: number;
|
|
37
|
+
rootsDeclined: number;
|
|
38
|
+
summariesReused: number;
|
|
39
|
+
};
|
|
16
40
|
}
|
|
17
41
|
/**
|
|
18
42
|
* Result of a cache lookup. A hit gives back the whole summary set; a miss
|
|
@@ -21,6 +45,7 @@ interface CacheDiagnostic {
|
|
|
21
45
|
type CacheLookup = {
|
|
22
46
|
kind: "hit";
|
|
23
47
|
summaries: BehavioralSummary[];
|
|
48
|
+
projectRoot?: string;
|
|
24
49
|
diagnostic: CacheDiagnostic;
|
|
25
50
|
} | {
|
|
26
51
|
kind: "miss";
|
|
@@ -180,6 +205,8 @@ declare class ResolutionStore {
|
|
|
180
205
|
private readonly fullyExtracted;
|
|
181
206
|
private readonly seededValues;
|
|
182
207
|
private readonly importedNames;
|
|
208
|
+
/** Files the most recent wave walk entered, for the memo to keep. */
|
|
209
|
+
private lastQueryWalked;
|
|
183
210
|
private readonly declarations;
|
|
184
211
|
private readonly graph;
|
|
185
212
|
private stale;
|
|
@@ -313,17 +340,19 @@ interface DiscoveredUnit {
|
|
|
313
340
|
* path.
|
|
314
341
|
*
|
|
315
342
|
* `schemaSdl` is the typeDefs string captured from the same
|
|
316
|
-
* ApolloServer config object the resolver map came from, when
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
343
|
+
* ApolloServer config object the resolver map came from, when we can
|
|
344
|
+
* statically resolve it (string literal or gql-tagged template,
|
|
345
|
+
* inline or const-bound). The adapter puts it on one summary
|
|
346
|
+
* standing for that schema, and `schemaDocument` is the label
|
|
347
|
+
* pointing every resolver at it.
|
|
321
348
|
*/
|
|
322
349
|
resolverInfo?: {
|
|
323
350
|
/** Null when the source never says which type the resolver attaches to. */
|
|
324
351
|
typeName: string | null;
|
|
325
352
|
fieldName: string;
|
|
326
353
|
schemaSdl?: string;
|
|
354
|
+
/** The file whose server config declares the schema. */
|
|
355
|
+
schemaDocument?: string;
|
|
327
356
|
};
|
|
328
357
|
/**
|
|
329
358
|
* Populated by `graphqlHookCall` discovery (GraphQL consumer side).
|
|
@@ -438,6 +467,12 @@ interface MountPrefixIndex {
|
|
|
438
467
|
* couldn't be resolved to a literal prefix and a concrete router.
|
|
439
468
|
*/
|
|
440
469
|
effectivePrefixFor(routerNode: Node): string;
|
|
470
|
+
/**
|
|
471
|
+
* The same resolution by a router's node id, for callers replaying a
|
|
472
|
+
* recorded consumption without the node in hand (the per-file cache
|
|
473
|
+
* re-checks a stored prefix against a rebuilt index this way).
|
|
474
|
+
*/
|
|
475
|
+
prefixForId?(childId: string): string;
|
|
441
476
|
}
|
|
442
477
|
|
|
443
478
|
/**
|
|
@@ -846,9 +881,8 @@ declare function methodDeclaredIn(callee: Node, expectedModule: string): boolean
|
|
|
846
881
|
interface ReadNameOptions {
|
|
847
882
|
/**
|
|
848
883
|
* What to say about a name nothing here settles. `"nothing"` gives
|
|
849
|
-
* null. `"reference"` gives
|
|
850
|
-
*
|
|
851
|
-
* about rather than which bucket this is.
|
|
884
|
+
* null. `"reference"` gives `{location.bucket}`, which says which
|
|
885
|
+
* value to go and ask about rather than which bucket this is.
|
|
852
886
|
*/
|
|
853
887
|
unsettled?: "nothing" | "reference";
|
|
854
888
|
/**
|