@suss/adapter-typescript 0.36.0 → 0.37.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,4 +1,4 @@
1
- import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression, Expression, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Identifier } from 'ts-morph';
1
+ import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, ConstructorDeclaration, 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';
@@ -640,7 +640,12 @@ type AppVersioning = {
640
640
  defaultVersion: StatedVersion;
641
641
  };
642
642
 
643
- type FunctionRoot = FunctionDeclaration | FunctionExpression | ArrowFunction | MethodDeclaration;
643
+ /**
644
+ * A function a unit is built on. A constructor is one, since `new
645
+ * Client()` runs its body and its parameters' defaults the way a call
646
+ * runs a function's.
647
+ */
648
+ type FunctionRoot = FunctionDeclaration | FunctionExpression | ArrowFunction | MethodDeclaration | ConstructorDeclaration;
644
649
  /**
645
650
  * Public API: returns RawCondition[] with structured: null.
646
651
  * Use collectAncestorConditionInfos when you need the Expression nodes.
@@ -1398,7 +1403,7 @@ interface ResponseHandOffOptions {
1398
1403
  type CallAccountingOutcome = "invocation" | "terminal" | "unreachable" | "unrecorded";
1399
1404
  /** One call the invocation walk visited, and where it ended up. */
1400
1405
  interface CallAccountingEntry {
1401
- readonly node: CallExpression;
1406
+ readonly node: CallExpression | NewExpression;
1402
1407
  readonly callee: string;
1403
1408
  readonly line: number;
1404
1409
  readonly outcome: CallAccountingOutcome;
@@ -1720,6 +1725,8 @@ declare function writtenNodeOf(value: Node, resolution: ResolutionStore | undefi
1720
1725
  * empty" from "could not read" (#123).
1721
1726
  */
1722
1727
  declare function stringValueOf(value: Node, resolution: ResolutionStore | undefined): string | null;
1728
+ /** The one string, number or boolean this value comes to, or null when it does not settle to one. */
1729
+ declare function scalarValueOf(value: Node, resolution: ResolutionStore | undefined): string | number | boolean | null;
1723
1730
  /** The number this value comes to, or null when it does not settle to one. */
1724
1731
  declare function numberValueOf(value: Node, resolution: ResolutionStore | undefined): number | null;
1725
1732
  /**
@@ -2192,6 +2199,13 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
2192
2199
  * presence test has passed.
2193
2200
  */
2194
2201
  declare function isDefaultedAt(node: Node): boolean;
2202
+ /**
2203
+ * The expression that supplies a value when the read comes back empty:
2204
+ * the right side of the `??` or `||` the read falls back through, or a
2205
+ * destructured read's own default, as in `const { X = "d" } = env`.
2206
+ * Null when nothing falls back from the read itself.
2207
+ */
2208
+ declare function fallbackOf(read: Node): Node | null;
2195
2209
 
2196
2210
  /**
2197
2211
  * The expression inside any type-level wrappers: `as` and
@@ -2216,4 +2230,4 @@ declare function climbSyntax(node: Node): Node;
2216
2230
  */
2217
2231
  declare function peelValue(node: Node): Node;
2218
2232
 
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 };
2233
+ 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, fallbackOf, 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, scalarValueOf, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, Symbol, CallExpression, NewExpression, TaggedTemplateExpression, PropertyAccessExpression, Expression, ImportDeclaration, ArrayLiteralExpression, ObjectLiteralExpression, ObjectLiteralElementLike, Identifier } from 'ts-morph';
1
+ import { Node, SourceFile, Project, FunctionDeclaration, FunctionExpression, ArrowFunction, MethodDeclaration, ConstructorDeclaration, 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';
@@ -640,7 +640,12 @@ type AppVersioning = {
640
640
  defaultVersion: StatedVersion;
641
641
  };
642
642
 
643
- type FunctionRoot = FunctionDeclaration | FunctionExpression | ArrowFunction | MethodDeclaration;
643
+ /**
644
+ * A function a unit is built on. A constructor is one, since `new
645
+ * Client()` runs its body and its parameters' defaults the way a call
646
+ * runs a function's.
647
+ */
648
+ type FunctionRoot = FunctionDeclaration | FunctionExpression | ArrowFunction | MethodDeclaration | ConstructorDeclaration;
644
649
  /**
645
650
  * Public API: returns RawCondition[] with structured: null.
646
651
  * Use collectAncestorConditionInfos when you need the Expression nodes.
@@ -1398,7 +1403,7 @@ interface ResponseHandOffOptions {
1398
1403
  type CallAccountingOutcome = "invocation" | "terminal" | "unreachable" | "unrecorded";
1399
1404
  /** One call the invocation walk visited, and where it ended up. */
1400
1405
  interface CallAccountingEntry {
1401
- readonly node: CallExpression;
1406
+ readonly node: CallExpression | NewExpression;
1402
1407
  readonly callee: string;
1403
1408
  readonly line: number;
1404
1409
  readonly outcome: CallAccountingOutcome;
@@ -1720,6 +1725,8 @@ declare function writtenNodeOf(value: Node, resolution: ResolutionStore | undefi
1720
1725
  * empty" from "could not read" (#123).
1721
1726
  */
1722
1727
  declare function stringValueOf(value: Node, resolution: ResolutionStore | undefined): string | null;
1728
+ /** The one string, number or boolean this value comes to, or null when it does not settle to one. */
1729
+ declare function scalarValueOf(value: Node, resolution: ResolutionStore | undefined): string | number | boolean | null;
1723
1730
  /** The number this value comes to, or null when it does not settle to one. */
1724
1731
  declare function numberValueOf(value: Node, resolution: ResolutionStore | undefined): number | null;
1725
1732
  /**
@@ -2192,6 +2199,13 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
2192
2199
  * presence test has passed.
2193
2200
  */
2194
2201
  declare function isDefaultedAt(node: Node): boolean;
2202
+ /**
2203
+ * The expression that supplies a value when the read comes back empty:
2204
+ * the right side of the `??` or `||` the read falls back through, or a
2205
+ * destructured read's own default, as in `const { X = "d" } = env`.
2206
+ * Null when nothing falls back from the read itself.
2207
+ */
2208
+ declare function fallbackOf(read: Node): Node | null;
2195
2209
 
2196
2210
  /**
2197
2211
  * The expression inside any type-level wrappers: `as` and
@@ -2216,4 +2230,4 @@ declare function climbSyntax(node: Node): Node;
2216
2230
  */
2217
2231
  declare function peelValue(node: Node): Node;
2218
2232
 
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 };
2233
+ 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, fallbackOf, 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, scalarValueOf, specifierImportedAs, startsItsOwnScope, stringPropertyOf, stringValueOf, stubEvidence, stubEvidenceIn, symbolBehind, toFunctionRoot, workspaceNameFor, workspaceRootFor, writtenNodeOf, writtenPayloadOf };