@suss/adapter-typescript 0.35.0 → 0.36.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.cjs +854 -375
- package/dist/index.d.cts +44 -2
- package/dist/index.d.ts +44 -2
- package/dist/index.js +843 -359
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression, Expression, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Identifier } from 'ts-morph';
|
|
2
2
|
import { PatternPack, TransparentWrapper, ParameterSupplier, VersionPlacement, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, ArgumentParser, StatedSlot, AstCapableOps, CallOps, EffectArg, LanguageAdapter, ExtractorOptions, TimingReport, CacheDiagnostic, ExtractionReport, DeclaredModule, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, ResponsePropertyMapping, RawBranch, KeepsArms, configuredCallOption, RawDeclaredContract, ContractPattern } from '@suss/extractor';
|
|
3
3
|
export { EmptyStage, ExtractionReport, PackFunnel, Timer, TimingReport, computeContentHash } from '@suss/extractor';
|
|
4
4
|
import { MessageBusSemantics, DeployableUnit, UnfollowedCall, WrapperReference, Effect, BehavioralSummary, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
@@ -13,6 +13,11 @@ interface RuntimeSpellings {
|
|
|
13
13
|
exitCalls: readonly string[];
|
|
14
14
|
exitCodeWrites: readonly string[];
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The dotted path an expression spells, when every part of it is an
|
|
18
|
+
* identifier or it starts at `import.meta`, as `import.meta.env` does.
|
|
19
|
+
*/
|
|
20
|
+
declare function dottedPathOf(expression: Node): string | null;
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* A library's own module, written into the project by that library's
|
|
@@ -664,6 +669,34 @@ declare function hasBody(fn: Node): boolean;
|
|
|
664
669
|
*/
|
|
665
670
|
declare function declarationsBehind(symbol: Symbol | undefined): Node[];
|
|
666
671
|
|
|
672
|
+
/**
|
|
673
|
+
* graphqlCallClient.ts: the client an operation's own call passes, read
|
|
674
|
+
* at that one call.
|
|
675
|
+
*
|
|
676
|
+
* Apollo sends a hook's operation through the client the app provides,
|
|
677
|
+
* unless the call passes a `client` option, and an imperative
|
|
678
|
+
* `client.query` goes through the client it is called on. A project
|
|
679
|
+
* hook that picks the client from an option of its own decides per
|
|
680
|
+
* caller, so the caller's arguments are bound before the choice is
|
|
681
|
+
* read. Each client construction the packs describe is replaced by a
|
|
682
|
+
* token of its own, and the evaluator says which token the choice comes
|
|
683
|
+
* out as. The README beside this file says what becomes of an operation
|
|
684
|
+
* whose choice stays open.
|
|
685
|
+
*/
|
|
686
|
+
|
|
687
|
+
/** Where one operation's call takes its client. */
|
|
688
|
+
interface GraphqlCallSite {
|
|
689
|
+
/** The library call that sends the operation. */
|
|
690
|
+
call: CallExpression;
|
|
691
|
+
/** The project's own wrapper calls between the unit and `call`, innermost first. */
|
|
692
|
+
through: CallExpression[];
|
|
693
|
+
/** The client is the receiver of `call`, or an option in one of its arguments. */
|
|
694
|
+
client: "receiver" | {
|
|
695
|
+
argument: number;
|
|
696
|
+
property: string;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
667
700
|
interface ClientCallSite {
|
|
668
701
|
callExpression: CallExpression;
|
|
669
702
|
/** Method name on the client object (e.g. "getUser"), null for bare calls like fetch() */
|
|
@@ -784,6 +817,8 @@ interface DiscoveredUnit {
|
|
|
784
817
|
reason: string;
|
|
785
818
|
};
|
|
786
819
|
};
|
|
820
|
+
/** Where the operation's call takes its client, read once the pack's client constructions are known. */
|
|
821
|
+
graphqlCall?: GraphqlCallSite;
|
|
787
822
|
/**
|
|
788
823
|
* Populated by `packageExports` discovery. Has the package identity
|
|
789
824
|
* the adapter uses to build a `function-call` binding
|
|
@@ -1411,6 +1446,13 @@ declare function readTsconfigFileList(tsConfigFilePath: string): string[];
|
|
|
1411
1446
|
|
|
1412
1447
|
/** The suffixes this adapter reads, JavaScript included. */
|
|
1413
1448
|
declare const SOURCE_SUFFIXES: readonly [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
1449
|
+
/**
|
|
1450
|
+
* Dependencies, build output and other languages' environments. `suss
|
|
1451
|
+
* init` skips the same folders, so a file it never saw as source is not
|
|
1452
|
+
* read here either. A Python virtualenv can contain thousands of
|
|
1453
|
+
* JavaScript files that belong to its packages.
|
|
1454
|
+
*/
|
|
1455
|
+
declare const SKIP_DIRECTORIES: ReadonlySet<string>;
|
|
1414
1456
|
/**
|
|
1415
1457
|
* A Project covering `rootDir`, for a codebase with no tsconfig to read.
|
|
1416
1458
|
* Returns the project and the files it loaded.
|
|
@@ -2174,4 +2216,4 @@ declare function climbSyntax(node: Node): Node;
|
|
|
2174
2216
|
*/
|
|
2175
2217
|
declare function peelValue(node: Node): Node;
|
|
2176
2218
|
|
|
2177
|
-
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FilePlace, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, type ReceiverType, type RefreshReport, ResolutionStore, SOURCE_SUFFIXES, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsAccessRecognizerContext, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, type WrittenPayload, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, numberValueOf, objectLiteralOf, parseConditionExpression, pathFromRun, peelSyntax, peelValue, placeOutsideRun, projectPlaceOf, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, readTsconfigFileList, receiverTypesOf, resolveAliasedSymbol, resolveSubject, rootIdentifier, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };
|
|
2219
|
+
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FilePlace, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, type ReceiverType, type RefreshReport, ResolutionStore, SKIP_DIRECTORIES, SOURCE_SUFFIXES, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsAccessRecognizerContext, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, type WrittenPayload, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, dottedPathOf, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, numberValueOf, objectLiteralOf, parseConditionExpression, pathFromRun, peelSyntax, peelValue, placeOutsideRun, projectPlaceOf, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, readTsconfigFileList, receiverTypesOf, resolveAliasedSymbol, resolveSubject, rootIdentifier, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression, Expression, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Identifier } from 'ts-morph';
|
|
2
2
|
import { PatternPack, TransparentWrapper, ParameterSupplier, VersionPlacement, RawCondition, DiscoveryPattern, TerminalPattern, InputMappingPattern, ArgumentParser, StatedSlot, AstCapableOps, CallOps, EffectArg, LanguageAdapter, ExtractorOptions, TimingReport, CacheDiagnostic, ExtractionReport, DeclaredModule, InvocationRecognizer, AccessRecognizer, RawCodeStructure, RawTerminal, ResponsePropertyMapping, RawBranch, KeepsArms, configuredCallOption, RawDeclaredContract, ContractPattern } from '@suss/extractor';
|
|
3
3
|
export { EmptyStage, ExtractionReport, PackFunnel, Timer, TimingReport, computeContentHash } from '@suss/extractor';
|
|
4
4
|
import { MessageBusSemantics, DeployableUnit, UnfollowedCall, WrapperReference, Effect, BehavioralSummary, BoundaryBinding, Predicate, TypeShape, ValueRef } from '@suss/behavioral-ir';
|
|
@@ -13,6 +13,11 @@ interface RuntimeSpellings {
|
|
|
13
13
|
exitCalls: readonly string[];
|
|
14
14
|
exitCodeWrites: readonly string[];
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The dotted path an expression spells, when every part of it is an
|
|
18
|
+
* identifier or it starts at `import.meta`, as `import.meta.env` does.
|
|
19
|
+
*/
|
|
20
|
+
declare function dottedPathOf(expression: Node): string | null;
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* A library's own module, written into the project by that library's
|
|
@@ -664,6 +669,34 @@ declare function hasBody(fn: Node): boolean;
|
|
|
664
669
|
*/
|
|
665
670
|
declare function declarationsBehind(symbol: Symbol | undefined): Node[];
|
|
666
671
|
|
|
672
|
+
/**
|
|
673
|
+
* graphqlCallClient.ts: the client an operation's own call passes, read
|
|
674
|
+
* at that one call.
|
|
675
|
+
*
|
|
676
|
+
* Apollo sends a hook's operation through the client the app provides,
|
|
677
|
+
* unless the call passes a `client` option, and an imperative
|
|
678
|
+
* `client.query` goes through the client it is called on. A project
|
|
679
|
+
* hook that picks the client from an option of its own decides per
|
|
680
|
+
* caller, so the caller's arguments are bound before the choice is
|
|
681
|
+
* read. Each client construction the packs describe is replaced by a
|
|
682
|
+
* token of its own, and the evaluator says which token the choice comes
|
|
683
|
+
* out as. The README beside this file says what becomes of an operation
|
|
684
|
+
* whose choice stays open.
|
|
685
|
+
*/
|
|
686
|
+
|
|
687
|
+
/** Where one operation's call takes its client. */
|
|
688
|
+
interface GraphqlCallSite {
|
|
689
|
+
/** The library call that sends the operation. */
|
|
690
|
+
call: CallExpression;
|
|
691
|
+
/** The project's own wrapper calls between the unit and `call`, innermost first. */
|
|
692
|
+
through: CallExpression[];
|
|
693
|
+
/** The client is the receiver of `call`, or an option in one of its arguments. */
|
|
694
|
+
client: "receiver" | {
|
|
695
|
+
argument: number;
|
|
696
|
+
property: string;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
667
700
|
interface ClientCallSite {
|
|
668
701
|
callExpression: CallExpression;
|
|
669
702
|
/** Method name on the client object (e.g. "getUser"), null for bare calls like fetch() */
|
|
@@ -784,6 +817,8 @@ interface DiscoveredUnit {
|
|
|
784
817
|
reason: string;
|
|
785
818
|
};
|
|
786
819
|
};
|
|
820
|
+
/** Where the operation's call takes its client, read once the pack's client constructions are known. */
|
|
821
|
+
graphqlCall?: GraphqlCallSite;
|
|
787
822
|
/**
|
|
788
823
|
* Populated by `packageExports` discovery. Has the package identity
|
|
789
824
|
* the adapter uses to build a `function-call` binding
|
|
@@ -1411,6 +1446,13 @@ declare function readTsconfigFileList(tsConfigFilePath: string): string[];
|
|
|
1411
1446
|
|
|
1412
1447
|
/** The suffixes this adapter reads, JavaScript included. */
|
|
1413
1448
|
declare const SOURCE_SUFFIXES: readonly [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
1449
|
+
/**
|
|
1450
|
+
* Dependencies, build output and other languages' environments. `suss
|
|
1451
|
+
* init` skips the same folders, so a file it never saw as source is not
|
|
1452
|
+
* read here either. A Python virtualenv can contain thousands of
|
|
1453
|
+
* JavaScript files that belong to its packages.
|
|
1454
|
+
*/
|
|
1455
|
+
declare const SKIP_DIRECTORIES: ReadonlySet<string>;
|
|
1414
1456
|
/**
|
|
1415
1457
|
* A Project covering `rootDir`, for a codebase with no tsconfig to read.
|
|
1416
1458
|
* Returns the project and the files it loaded.
|
|
@@ -2174,4 +2216,4 @@ declare function climbSyntax(node: Node): Node;
|
|
|
2174
2216
|
*/
|
|
2175
2217
|
declare function peelValue(node: Node): Node;
|
|
2176
2218
|
|
|
2177
|
-
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FilePlace, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, type ReceiverType, type RefreshReport, ResolutionStore, SOURCE_SUFFIXES, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsAccessRecognizerContext, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, type WrittenPayload, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, numberValueOf, objectLiteralOf, parseConditionExpression, pathFromRun, peelSyntax, peelValue, placeOutsideRun, projectPlaceOf, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, readTsconfigFileList, receiverTypesOf, resolveAliasedSymbol, resolveSubject, rootIdentifier, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };
|
|
2219
|
+
export { ADAPTER_VERSION, type Accessed, type CallAccountingEntry, type CallAccountingOutcome, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DescentBarriers, type DiscoveredUnit, type EnvironmentNamers, type ExplainCallableOptions, type ExplainedResolution, type FilePlace, type FoundTerminal, type FunctionRoot, GENERIC_TERMINALS, type ImportScanOptions, NO_BARRIERS, type ObservedStubCall, type RawBranchResult, type ReadNameOptions, type ReceiverType, type RefreshReport, ResolutionStore, SKIP_DIRECTORIES, SOURCE_SUFFIXES, type StubCallEvidence, type StubEvidenceOptions, TSCONFIG_NAMES, type TsAccessRecognizerContext, type TsDiscoveryContext, type TsInvocationRecognizerContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, TypeScriptWhySession, type WhySessionOptions, type WrittenPayload, accessContextFor, arrayLiteralOf, buildProjectHelperIndex, callOpsFor, climbSyntax, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, couldNameAValue, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, declarationsBehind, discoverUnits, dottedPathOf, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findEnclosingFunction, findNearestTsconfig, findTerminals, functionTargetOf, functionValueOf, hasBody, importDeclarationsOf, importedNamesOf, importedRootsOf, invocationContextFor, isDefaultedAt, isImportedFrom, methodDeclaredIn, namedImportsOf, numberValueOf, objectLiteralOf, parseConditionExpression, pathFromRun, peelSyntax, peelValue, placeOutsideRun, projectPlaceOf, propertiesOf, propertyFunctionOf, propertyNameOf, propertyOf, propertyValueOf, readConfiguredCall, readContract, readContractForClientCall, readName, readTsconfigFileList, receiverTypesOf, resolveAliasedSymbol, resolveSubject, rootIdentifier, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };
|