@suss/adapter-typescript 0.11.0 → 0.13.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,8 +1,10 @@
1
- import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression } from 'ts-morph';
2
- import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
1
+ import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression } from 'ts-morph';
2
+ import { PackDeclarations, 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
  import { Proof, Atom } from '@suss/datalog';
5
5
  import { ResolutionExplanation } from '@suss/resolution';
6
+ import { AstCapableOps } from '@suss/recognize/ast';
7
+ import { CallOps } from '@suss/recognize';
6
8
 
7
9
  /**
8
10
  * cache.ts: the on-disk extraction cache.
@@ -123,20 +125,30 @@ interface PackFunnel {
123
125
  /**
124
126
  * Bound summaries on the provider side of their boundary.
125
127
  *
126
- * Transitions say what a unit does with a request, which only a
127
- * provider can say. A consumer records what it reads back from the
128
- * response instead, and that goes on the summary's metadata. Measuring
129
- * a client pack against transitions would report every working one as
130
- * having extracted nothing.
128
+ * Kept apart from the count below because a provider that produced
129
+ * no transitions is a different problem from a client that produced
130
+ * none.
131
131
  */
132
132
  providerSummaries: number;
133
- /** Provider summaries with at least one transition. */
133
+ /**
134
+ * Summaries with at least one transition, of any role. A provider's
135
+ * transitions say what it does with a request and a client's say what
136
+ * it expects back, so a pack whose summaries have none has bound
137
+ * something and described nothing either way.
138
+ */
134
139
  summariesWithBehavior: number;
135
140
  /**
136
141
  * Where one of this pack's hooks threw. Every count above is a floor
137
142
  * while this is non-empty.
138
143
  */
139
144
  failures: PackFailure[];
145
+ /**
146
+ * What the pack wrote as data rather than as code, or null for a pack
147
+ * written as a hand-rolled walk. This is the one thing in the funnel
148
+ * that no run produces: it is the pack's own shape, and it is here so
149
+ * the migration onto the declared surface can be measured.
150
+ */
151
+ declarations: PackDeclarations | null;
140
152
  }
141
153
  interface ExtractionReport {
142
154
  /** Files in the tsconfig include set, or null when the caller supplied a Project. */
@@ -295,6 +307,9 @@ declare class ResolutionStore {
295
307
  * Two candidates give null, since ambiguity is nothing. The value
296
308
  * itself is never a result either, or an identifier whose chain went
297
309
  * nowhere would come back as itself.
310
+ *
311
+ * An answer has to be an expression, which leaves out the class a
312
+ * construction makes an instance of. The README says why.
298
313
  */
299
314
  private lookupWritten;
300
315
  /**
@@ -926,13 +941,14 @@ interface HealthCheck {
926
941
  /** The property being checked, as something either true or false. */
927
942
  name: string;
928
943
  /**
929
- * The heading printed when this check finds something.
944
+ * The short word this check reports under, kebab-case.
930
945
  *
931
- * `name` is written as an assertion, so printing it above the
932
- * violations would say "no pack collides with itself" and then list a
933
- * pack colliding with itself.
946
+ * It is the first column of every line the check prints, so a reader
947
+ * works out what it means once and recognises it after that. `name`
948
+ * is written as an assertion and would read backwards over a list of
949
+ * things failing it.
934
950
  */
935
- whenBroken: string;
951
+ code: string;
936
952
  /**
937
953
  * Who the finding is addressed to.
938
954
  *
@@ -946,6 +962,26 @@ interface HealthCheck {
946
962
  audience: "run" | "pack";
947
963
  violations: HealthViolation[];
948
964
  }
965
+ /**
966
+ * What one pack paid for what it matches.
967
+ *
968
+ * Expressiveness is bought link by link, and #542 asks for the price to
969
+ * be printed. A pack with every link written as data runs on any
970
+ * adapter with the executor ops. A link written as a function runs only
971
+ * where its own language does, and one that reads the syntax tree is
972
+ * the floor. All three are allowed, and this says which is which.
973
+ */
974
+ interface PackGradient {
975
+ pack: string;
976
+ /** Links written as data, across every declaration. */
977
+ dataLinks: number;
978
+ /** Links written as a function, as "declaration.question". */
979
+ functionLinks: string[];
980
+ /** Links whose function reads the adapter's own syntax tree. */
981
+ astLinks: string[];
982
+ /** Declarations shipped without a line of code to run against them. */
983
+ withoutExample: string[];
984
+ }
949
985
  /**
950
986
  * Run every health check over one extraction report and return what
951
987
  * fired, grouped by which check caught it.
@@ -973,6 +1009,116 @@ declare function formatPackHealth(checks: ReadonlyArray<HealthCheck>, audiences:
973
1009
  */
974
1010
  declare function parseConditionExpression(expr: Expression, depth?: number): Predicate | null;
975
1011
 
1012
+ /**
1013
+ * What this adapter can tell a declared pack about a call.
1014
+ *
1015
+ * Every question here was already worked out somewhere in this adapter,
1016
+ * once per pack that needed it. Collecting them behind the one
1017
+ * interface `@suss/recognize` declares is what lets a pack stop being a
1018
+ * walk over ts-morph and start being data.
1019
+ *
1020
+ * Two of the receiver origins are implemented. The migration plan for
1021
+ * #542 lists four more, and each one adds an entry to `ORIGIN` beside
1022
+ * the union member it matches.
1023
+ */
1024
+
1025
+ /**
1026
+ * A call, a construction, or a tagged template, which all ask the same
1027
+ * questions. A tagged template is a call the source wrote without
1028
+ * parentheses: the tag is the callee and the template is the one
1029
+ * argument, which is how a pack reaches a statement written that way
1030
+ * without a second grammar for it.
1031
+ */
1032
+ type Called = CallExpression | NewExpression | TaggedTemplateExpression;
1033
+ /** One-hop lookup from a written name to the value it was bound to. */
1034
+ type Resolve = (value: Node) => Node | null;
1035
+ /** What a declared pack can ask about one TypeScript call. */
1036
+ declare function callOpsFor(call: Called, resolveWrittenValue?: Resolve): AstCapableOps;
1037
+
1038
+ /**
1039
+ * Context handed to TypeScript-adapter access recognizers: sister
1040
+ * to TsInvocationRecognizerContext but for property-access nodes.
1041
+ * No `extractArgs` since property accesses don't take arguments.
1042
+ */
1043
+ interface TsAccessRecognizerContext {
1044
+ /** The property-access expression itself. */
1045
+ access: Node;
1046
+ /** Source file the access lives in. */
1047
+ sourceFile: SourceFile;
1048
+ /**
1049
+ * One-hop lookup from a written name to the value it was bound to,
1050
+ * from the run's facts (#300). Gives null when the run has no store,
1051
+ * and the recognizer's own pattern match runs on the raw node.
1052
+ */
1053
+ resolveWrittenValue: (value: Node) => Node | null;
1054
+ /**
1055
+ * What a declared pack asks about this node, when the node is a call
1056
+ * or a tagged template. This walk visits property accesses as well,
1057
+ * and there is no call there to ask about, so a declared pack
1058
+ * standing on one is handed nothing and matches nothing.
1059
+ */
1060
+ ops?: CallOps;
1061
+ }
1062
+ /**
1063
+ * Context handed to TypeScript-adapter recognizers. Recognizers in
1064
+ * `@suss/framework-prisma` (and other packs) receive this and use
1065
+ * the type-checker / source-file primitives to decide whether the
1066
+ * call site matches their semantics. `extractArgs` reuses the same
1067
+ * `EffectArg` builder the adapter uses for `invocation` effects, so
1068
+ * recognizers don't have to re-implement literal/object/identifier
1069
+ * shape extraction.
1070
+ */
1071
+ interface TsInvocationRecognizerContext {
1072
+ /** The call expression itself (also passed as the first arg). */
1073
+ call: CallExpression;
1074
+ /** Source file the call lives in. Useful for import resolution. */
1075
+ sourceFile: SourceFile;
1076
+ /**
1077
+ * Convert the call's arguments to `EffectArg[]` using the same
1078
+ * literal / object / identifier extraction the adapter applies to
1079
+ * `invocation` effects. Recognizers call this when they want
1080
+ * field-level shape (e.g. Prisma's `select: { id: true }`).
1081
+ */
1082
+ extractArgs(): EffectArg[];
1083
+ /**
1084
+ * Whether `identifier` was introduced by an import of
1085
+ * `expectedModule`. Recognizers use this to tell a library's export
1086
+ * apart from a local class that happens to share its name.
1087
+ *
1088
+ * Named, default, and namespace imports all match. So does an import
1089
+ * through a project-local barrel that re-exports the module: the
1090
+ * aliased symbol is still in the package that declared it.
1091
+ */
1092
+ isImportedFrom(identifier: Node, expectedModule: string): boolean;
1093
+ /**
1094
+ * The expression `value` is written as, followed through const
1095
+ * bindings, imports, and re-export barrels. A recognizer asks this
1096
+ * before claiming the source does not name something:
1097
+ *
1098
+ * const url = "https://sqs/.../orders";
1099
+ * client.send(new SendMessageCommand({ QueueUrl: url }));
1100
+ *
1101
+ * Resolving `url` gives back the string literal, and the recognizer's
1102
+ * own pattern match runs on that. Null when the value has no written
1103
+ * form (a parameter, a call result), which is exactly when null on the
1104
+ * binding is correct.
1105
+ */
1106
+ resolveWrittenValue(value: Node): Node | null;
1107
+ /**
1108
+ * What a declared pack asks about this call, in the vocabulary
1109
+ * `@suss/recognize` defines. A pack written as a chain of data links
1110
+ * reads only this; the members above are what a pack written as code
1111
+ * reaches for.
1112
+ */
1113
+ ops: CallOps;
1114
+ }
1115
+ /**
1116
+ * Everything a recognizer may ask about one call site.
1117
+ *
1118
+ * A pack's tests build it here too, so a pack that passes them has run
1119
+ * against the context extraction gives it.
1120
+ */
1121
+ declare function invocationContextFor(call: CallExpression, resolveWrittenValue?: (value: Node) => Node | null): TsInvocationRecognizerContext;
976
1122
  declare function isImportedFrom(identifier: Node, expectedModule: string): boolean;
977
1123
  /**
978
1124
  * Whether `expectedModule` declares the method a call goes to. A pack
@@ -987,6 +1133,17 @@ declare function isImportedFrom(identifier: Node, expectedModule: string): boole
987
1133
  * from it.
988
1134
  */
989
1135
  declare function methodDeclaredIn(callee: Node, expectedModule: string, resolve?: (value: Node) => Node | null): boolean;
1136
+ /** The nodes this walk stops at, which is every shape a pack can guard. */
1137
+ type Accessed = PropertyAccessExpression | CallExpression | TaggedTemplateExpression;
1138
+ /**
1139
+ * What one node is handed. The ops are built on the first read rather
1140
+ * than up front, the way the invocation walk builds them: most nodes
1141
+ * reach no declared pack, and a pack written as code never asks.
1142
+ *
1143
+ * A pack's tests build it here too, so a pack that passes them has run
1144
+ * against the context extraction gives it.
1145
+ */
1146
+ declare function accessContextFor(node: Accessed, sourceFile: SourceFile, resolveWrittenValue?: (value: Node) => Node | null): TsAccessRecognizerContext;
990
1147
 
991
1148
  /**
992
1149
  * What a name-valued expression says, as fixed text with a hole for
@@ -1175,4 +1332,4 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
1175
1332
  version?: string;
1176
1333
  }>): string;
1177
1334
 
1178
- export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExplainCallableOptions, type ExplainStats, type ExplainedResolution, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, type ReadNameOptions, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, type ValueLocation, type WhyExplained, WhySession, type WhySessionOptions, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, methodDeclaredIn, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, workspaceRootFor };
1335
+ export { ADAPTER_VERSION, type Accessed, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExplainCallableOptions, type ExplainStats, type ExplainedResolution, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, type PackGradient, type ReadNameOptions, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, type ValueLocation, type WhyExplained, WhySession, type WhySessionOptions, accessContextFor, callOpsFor, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, invocationContextFor, isImportedFrom, methodDeclaredIn, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, workspaceRootFor };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression } from 'ts-morph';
2
- import { TransparentWrapper, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, LanguageAdapter, PatternPack, ExtractorOptions, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, RawBranch, EffectArg, RawDeclaredContract, ContractPattern, ResponsePropertyMapping } from '@suss/extractor';
1
+ import { SourceFile, Node, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, CallExpression, Project, Symbol, Expression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression } from 'ts-morph';
2
+ import { PackDeclarations, 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
  import { Proof, Atom } from '@suss/datalog';
5
5
  import { ResolutionExplanation } from '@suss/resolution';
6
+ import { AstCapableOps } from '@suss/recognize/ast';
7
+ import { CallOps } from '@suss/recognize';
6
8
 
7
9
  /**
8
10
  * cache.ts: the on-disk extraction cache.
@@ -123,20 +125,30 @@ interface PackFunnel {
123
125
  /**
124
126
  * Bound summaries on the provider side of their boundary.
125
127
  *
126
- * Transitions say what a unit does with a request, which only a
127
- * provider can say. A consumer records what it reads back from the
128
- * response instead, and that goes on the summary's metadata. Measuring
129
- * a client pack against transitions would report every working one as
130
- * having extracted nothing.
128
+ * Kept apart from the count below because a provider that produced
129
+ * no transitions is a different problem from a client that produced
130
+ * none.
131
131
  */
132
132
  providerSummaries: number;
133
- /** Provider summaries with at least one transition. */
133
+ /**
134
+ * Summaries with at least one transition, of any role. A provider's
135
+ * transitions say what it does with a request and a client's say what
136
+ * it expects back, so a pack whose summaries have none has bound
137
+ * something and described nothing either way.
138
+ */
134
139
  summariesWithBehavior: number;
135
140
  /**
136
141
  * Where one of this pack's hooks threw. Every count above is a floor
137
142
  * while this is non-empty.
138
143
  */
139
144
  failures: PackFailure[];
145
+ /**
146
+ * What the pack wrote as data rather than as code, or null for a pack
147
+ * written as a hand-rolled walk. This is the one thing in the funnel
148
+ * that no run produces: it is the pack's own shape, and it is here so
149
+ * the migration onto the declared surface can be measured.
150
+ */
151
+ declarations: PackDeclarations | null;
140
152
  }
141
153
  interface ExtractionReport {
142
154
  /** Files in the tsconfig include set, or null when the caller supplied a Project. */
@@ -295,6 +307,9 @@ declare class ResolutionStore {
295
307
  * Two candidates give null, since ambiguity is nothing. The value
296
308
  * itself is never a result either, or an identifier whose chain went
297
309
  * nowhere would come back as itself.
310
+ *
311
+ * An answer has to be an expression, which leaves out the class a
312
+ * construction makes an instance of. The README says why.
298
313
  */
299
314
  private lookupWritten;
300
315
  /**
@@ -926,13 +941,14 @@ interface HealthCheck {
926
941
  /** The property being checked, as something either true or false. */
927
942
  name: string;
928
943
  /**
929
- * The heading printed when this check finds something.
944
+ * The short word this check reports under, kebab-case.
930
945
  *
931
- * `name` is written as an assertion, so printing it above the
932
- * violations would say "no pack collides with itself" and then list a
933
- * pack colliding with itself.
946
+ * It is the first column of every line the check prints, so a reader
947
+ * works out what it means once and recognises it after that. `name`
948
+ * is written as an assertion and would read backwards over a list of
949
+ * things failing it.
934
950
  */
935
- whenBroken: string;
951
+ code: string;
936
952
  /**
937
953
  * Who the finding is addressed to.
938
954
  *
@@ -946,6 +962,26 @@ interface HealthCheck {
946
962
  audience: "run" | "pack";
947
963
  violations: HealthViolation[];
948
964
  }
965
+ /**
966
+ * What one pack paid for what it matches.
967
+ *
968
+ * Expressiveness is bought link by link, and #542 asks for the price to
969
+ * be printed. A pack with every link written as data runs on any
970
+ * adapter with the executor ops. A link written as a function runs only
971
+ * where its own language does, and one that reads the syntax tree is
972
+ * the floor. All three are allowed, and this says which is which.
973
+ */
974
+ interface PackGradient {
975
+ pack: string;
976
+ /** Links written as data, across every declaration. */
977
+ dataLinks: number;
978
+ /** Links written as a function, as "declaration.question". */
979
+ functionLinks: string[];
980
+ /** Links whose function reads the adapter's own syntax tree. */
981
+ astLinks: string[];
982
+ /** Declarations shipped without a line of code to run against them. */
983
+ withoutExample: string[];
984
+ }
949
985
  /**
950
986
  * Run every health check over one extraction report and return what
951
987
  * fired, grouped by which check caught it.
@@ -973,6 +1009,116 @@ declare function formatPackHealth(checks: ReadonlyArray<HealthCheck>, audiences:
973
1009
  */
974
1010
  declare function parseConditionExpression(expr: Expression, depth?: number): Predicate | null;
975
1011
 
1012
+ /**
1013
+ * What this adapter can tell a declared pack about a call.
1014
+ *
1015
+ * Every question here was already worked out somewhere in this adapter,
1016
+ * once per pack that needed it. Collecting them behind the one
1017
+ * interface `@suss/recognize` declares is what lets a pack stop being a
1018
+ * walk over ts-morph and start being data.
1019
+ *
1020
+ * Two of the receiver origins are implemented. The migration plan for
1021
+ * #542 lists four more, and each one adds an entry to `ORIGIN` beside
1022
+ * the union member it matches.
1023
+ */
1024
+
1025
+ /**
1026
+ * A call, a construction, or a tagged template, which all ask the same
1027
+ * questions. A tagged template is a call the source wrote without
1028
+ * parentheses: the tag is the callee and the template is the one
1029
+ * argument, which is how a pack reaches a statement written that way
1030
+ * without a second grammar for it.
1031
+ */
1032
+ type Called = CallExpression | NewExpression | TaggedTemplateExpression;
1033
+ /** One-hop lookup from a written name to the value it was bound to. */
1034
+ type Resolve = (value: Node) => Node | null;
1035
+ /** What a declared pack can ask about one TypeScript call. */
1036
+ declare function callOpsFor(call: Called, resolveWrittenValue?: Resolve): AstCapableOps;
1037
+
1038
+ /**
1039
+ * Context handed to TypeScript-adapter access recognizers: sister
1040
+ * to TsInvocationRecognizerContext but for property-access nodes.
1041
+ * No `extractArgs` since property accesses don't take arguments.
1042
+ */
1043
+ interface TsAccessRecognizerContext {
1044
+ /** The property-access expression itself. */
1045
+ access: Node;
1046
+ /** Source file the access lives in. */
1047
+ sourceFile: SourceFile;
1048
+ /**
1049
+ * One-hop lookup from a written name to the value it was bound to,
1050
+ * from the run's facts (#300). Gives null when the run has no store,
1051
+ * and the recognizer's own pattern match runs on the raw node.
1052
+ */
1053
+ resolveWrittenValue: (value: Node) => Node | null;
1054
+ /**
1055
+ * What a declared pack asks about this node, when the node is a call
1056
+ * or a tagged template. This walk visits property accesses as well,
1057
+ * and there is no call there to ask about, so a declared pack
1058
+ * standing on one is handed nothing and matches nothing.
1059
+ */
1060
+ ops?: CallOps;
1061
+ }
1062
+ /**
1063
+ * Context handed to TypeScript-adapter recognizers. Recognizers in
1064
+ * `@suss/framework-prisma` (and other packs) receive this and use
1065
+ * the type-checker / source-file primitives to decide whether the
1066
+ * call site matches their semantics. `extractArgs` reuses the same
1067
+ * `EffectArg` builder the adapter uses for `invocation` effects, so
1068
+ * recognizers don't have to re-implement literal/object/identifier
1069
+ * shape extraction.
1070
+ */
1071
+ interface TsInvocationRecognizerContext {
1072
+ /** The call expression itself (also passed as the first arg). */
1073
+ call: CallExpression;
1074
+ /** Source file the call lives in. Useful for import resolution. */
1075
+ sourceFile: SourceFile;
1076
+ /**
1077
+ * Convert the call's arguments to `EffectArg[]` using the same
1078
+ * literal / object / identifier extraction the adapter applies to
1079
+ * `invocation` effects. Recognizers call this when they want
1080
+ * field-level shape (e.g. Prisma's `select: { id: true }`).
1081
+ */
1082
+ extractArgs(): EffectArg[];
1083
+ /**
1084
+ * Whether `identifier` was introduced by an import of
1085
+ * `expectedModule`. Recognizers use this to tell a library's export
1086
+ * apart from a local class that happens to share its name.
1087
+ *
1088
+ * Named, default, and namespace imports all match. So does an import
1089
+ * through a project-local barrel that re-exports the module: the
1090
+ * aliased symbol is still in the package that declared it.
1091
+ */
1092
+ isImportedFrom(identifier: Node, expectedModule: string): boolean;
1093
+ /**
1094
+ * The expression `value` is written as, followed through const
1095
+ * bindings, imports, and re-export barrels. A recognizer asks this
1096
+ * before claiming the source does not name something:
1097
+ *
1098
+ * const url = "https://sqs/.../orders";
1099
+ * client.send(new SendMessageCommand({ QueueUrl: url }));
1100
+ *
1101
+ * Resolving `url` gives back the string literal, and the recognizer's
1102
+ * own pattern match runs on that. Null when the value has no written
1103
+ * form (a parameter, a call result), which is exactly when null on the
1104
+ * binding is correct.
1105
+ */
1106
+ resolveWrittenValue(value: Node): Node | null;
1107
+ /**
1108
+ * What a declared pack asks about this call, in the vocabulary
1109
+ * `@suss/recognize` defines. A pack written as a chain of data links
1110
+ * reads only this; the members above are what a pack written as code
1111
+ * reaches for.
1112
+ */
1113
+ ops: CallOps;
1114
+ }
1115
+ /**
1116
+ * Everything a recognizer may ask about one call site.
1117
+ *
1118
+ * A pack's tests build it here too, so a pack that passes them has run
1119
+ * against the context extraction gives it.
1120
+ */
1121
+ declare function invocationContextFor(call: CallExpression, resolveWrittenValue?: (value: Node) => Node | null): TsInvocationRecognizerContext;
976
1122
  declare function isImportedFrom(identifier: Node, expectedModule: string): boolean;
977
1123
  /**
978
1124
  * Whether `expectedModule` declares the method a call goes to. A pack
@@ -987,6 +1133,17 @@ declare function isImportedFrom(identifier: Node, expectedModule: string): boole
987
1133
  * from it.
988
1134
  */
989
1135
  declare function methodDeclaredIn(callee: Node, expectedModule: string, resolve?: (value: Node) => Node | null): boolean;
1136
+ /** The nodes this walk stops at, which is every shape a pack can guard. */
1137
+ type Accessed = PropertyAccessExpression | CallExpression | TaggedTemplateExpression;
1138
+ /**
1139
+ * What one node is handed. The ops are built on the first read rather
1140
+ * than up front, the way the invocation walk builds them: most nodes
1141
+ * reach no declared pack, and a pack written as code never asks.
1142
+ *
1143
+ * A pack's tests build it here too, so a pack that passes them has run
1144
+ * against the context extraction gives it.
1145
+ */
1146
+ declare function accessContextFor(node: Accessed, sourceFile: SourceFile, resolveWrittenValue?: (value: Node) => Node | null): TsAccessRecognizerContext;
990
1147
 
991
1148
  /**
992
1149
  * What a name-valued expression says, as fixed text with a hole for
@@ -1175,4 +1332,4 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
1175
1332
  version?: string;
1176
1333
  }>): string;
1177
1334
 
1178
- export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExplainCallableOptions, type ExplainStats, type ExplainedResolution, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, type ReadNameOptions, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, type ValueLocation, type WhyExplained, WhySession, type WhySessionOptions, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, methodDeclaredIn, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, workspaceRootFor };
1335
+ export { ADAPTER_VERSION, type Accessed, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExplainCallableOptions, type ExplainStats, type ExplainedResolution, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, type PackGradient, type ReadNameOptions, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, type ValueLocation, type WhyExplained, WhySession, type WhySessionOptions, accessContextFor, callOpsFor, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, invocationContextFor, isImportedFrom, methodDeclaredIn, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, readName, resolveAliasedSymbol, resolveSubject, rootIdentifier, workspaceRootFor };