@suss/adapter-typescript 0.5.10 → 0.6.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 CHANGED
@@ -54,7 +54,8 @@ __export(index_exports, {
54
54
  readContract: () => readContract,
55
55
  readContractForClientCall: () => readContractForClientCall,
56
56
  resolveAliasedSymbol: () => resolveAliasedSymbol,
57
- resolveSubject: () => resolveSubject
57
+ resolveSubject: () => resolveSubject,
58
+ rootIdentifier: () => rootIdentifier
58
59
  });
59
60
  module.exports = __toCommonJS(index_exports);
60
61
 
@@ -2430,7 +2431,7 @@ function dispatchAccessRecognizers(root, recognizers, isStop, resolveWrittenValu
2430
2431
  traversal.skip();
2431
2432
  return;
2432
2433
  }
2433
- if (!import_ts_morph12.Node.isPropertyAccessExpression(node) && !import_ts_morph12.Node.isCallExpression(node)) {
2434
+ if (!import_ts_morph12.Node.isPropertyAccessExpression(node) && !import_ts_morph12.Node.isCallExpression(node) && !import_ts_morph12.Node.isTaggedTemplateExpression(node)) {
2434
2435
  return;
2435
2436
  }
2436
2437
  const ctx = {
@@ -4004,10 +4005,59 @@ function writesToBindingUncached(declaration) {
4004
4005
  }
4005
4006
  return { values, inOrder: writesRunInOrder(declaration, writes) };
4006
4007
  }
4008
+ function writesToField(declaration) {
4009
+ const remembered = byDeclaration.get(declaration);
4010
+ if (remembered !== void 0) {
4011
+ return remembered;
4012
+ }
4013
+ const answer = writesToFieldUncached(declaration);
4014
+ byDeclaration.set(declaration, answer);
4015
+ return answer;
4016
+ }
4017
+ function writesToFieldUncached(declaration) {
4018
+ const initializer = declaration.getInitializer();
4019
+ const assignments = assignmentsTo(declaration);
4020
+ if (assignments.length === 0) {
4021
+ return {
4022
+ values: initializer === void 0 ? [] : [initializer],
4023
+ inOrder: true
4024
+ };
4025
+ }
4026
+ const values = [];
4027
+ for (const write of assignments) {
4028
+ if (write.value === null) {
4029
+ return { values: [], inOrder: false };
4030
+ }
4031
+ values.push(write.value);
4032
+ }
4033
+ const withInitializer = initializer === void 0 ? values : [initializer, ...values];
4034
+ return {
4035
+ values: withInitializer,
4036
+ inOrder: assignments.every(
4037
+ (write) => writeRunsInConstructor(declaration, write)
4038
+ )
4039
+ };
4040
+ }
4041
+ function writeRunsInConstructor(declaration, write) {
4042
+ const statement = statementOf(write.node);
4043
+ if (statement === null) {
4044
+ return false;
4045
+ }
4046
+ const body = statement.getParent();
4047
+ if (body === void 0 || !import_ts_morph18.Node.isBlock(body)) {
4048
+ return false;
4049
+ }
4050
+ const owner = body.getParent();
4051
+ return owner !== void 0 && import_ts_morph18.Node.isConstructorDeclaration(owner) && owner.getParent() === declaration.getParent();
4052
+ }
4007
4053
  function isWrittenAgain(declaration) {
4008
4054
  return assignmentsTo(declaration).length > 0;
4009
4055
  }
4010
4056
  function assignmentsTo(declaration) {
4057
+ if (import_ts_morph18.Node.isPropertyDeclaration(declaration)) {
4058
+ const sourceFile2 = declaration.getSourceFile();
4059
+ return sourceFile2.isDeclarationFile() ? [] : assignmentsInFile(sourceFile2).get(declaration) ?? [];
4060
+ }
4011
4061
  if (declaration.getVariableStatement()?.getDeclarationKind() === import_ts_morph18.VariableDeclarationKind.Const) {
4012
4062
  return [];
4013
4063
  }
@@ -4047,7 +4097,7 @@ function writeAt(node) {
4047
4097
  if (import_ts_morph18.Node.isBinaryExpression(node)) {
4048
4098
  const operator = node.getOperatorToken().getKind();
4049
4099
  const target = node.getLeft();
4050
- if (!isAssignmentOperator(operator) || !import_ts_morph18.Node.isIdentifier(target)) {
4100
+ if (!isAssignmentOperator(operator) || !(import_ts_morph18.Node.isIdentifier(target) || import_ts_morph18.Node.isPropertyAccessExpression(target))) {
4051
4101
  return null;
4052
4102
  }
4053
4103
  const value = operator === import_ts_morph18.SyntaxKind.EqualsToken ? node.getRight() : null;
@@ -4064,13 +4114,14 @@ function writeAt(node) {
4064
4114
  return null;
4065
4115
  }
4066
4116
  function declarationsOf(name) {
4067
- const symbol = name.getSymbol();
4117
+ const nameNode = import_ts_morph18.Node.isPropertyAccessExpression(name) ? name.getNameNode() : name;
4118
+ const symbol = nameNode.getSymbol();
4068
4119
  if (symbol === void 0) {
4069
4120
  return [];
4070
4121
  }
4071
4122
  const declarations = [];
4072
4123
  for (const declaration of symbol.getDeclarations()) {
4073
- if (import_ts_morph18.Node.isVariableDeclaration(declaration)) {
4124
+ if (import_ts_morph18.Node.isVariableDeclaration(declaration) || import_ts_morph18.Node.isPropertyDeclaration(declaration)) {
4074
4125
  declarations.push(declaration);
4075
4126
  }
4076
4127
  }
@@ -5338,13 +5389,13 @@ function extractEndpointContract(endpointNode, pattern, framework) {
5338
5389
  continue;
5339
5390
  }
5340
5391
  const propName = prop.getName();
5341
- if (propName === "method") {
5392
+ if (propName === pattern.methodProperty) {
5342
5393
  const val = prop.getInitializer();
5343
5394
  if (val !== void 0 && import_ts_morph25.Node.isStringLiteral(val)) {
5344
5395
  method = val.getLiteralValue();
5345
5396
  }
5346
5397
  }
5347
- if (propName === "path") {
5398
+ if (propName === pattern.pathProperty) {
5348
5399
  const val = prop.getInitializer();
5349
5400
  if (val !== void 0 && import_ts_morph25.Node.isStringLiteral(val)) {
5350
5401
  path11 = val.getLiteralValue();
@@ -6092,6 +6143,14 @@ function emitBindingValues(db, table, declaration) {
6092
6143
  }
6093
6144
  fact(db, "endsHolding", declarationId, emitValue(db, table, last));
6094
6145
  }
6146
+ function emitFieldValues(db, table, declaration) {
6147
+ const { values, inOrder } = writesToField(declaration);
6148
+ const last = values[values.length - 1];
6149
+ if (!inOrder || last === void 0) {
6150
+ return;
6151
+ }
6152
+ fact(db, "binds", nodeId(declaration), emitValue(db, table, last));
6153
+ }
6095
6154
  function emitBindingElementFacts(db, table, element) {
6096
6155
  const id = nodeId(element);
6097
6156
  table.byId.set(id, element);
@@ -6167,6 +6226,11 @@ function emitReferenceFacts(db, table, reference) {
6167
6226
  emitBindingValues(db, table, declaration);
6168
6227
  continue;
6169
6228
  }
6229
+ if (import_ts_morph28.Node.isPropertyDeclaration(declaration)) {
6230
+ fact(db, "binds", referenceId, declarationId);
6231
+ emitFieldValues(db, table, declaration);
6232
+ continue;
6233
+ }
6170
6234
  if (import_ts_morph28.Node.isParameterDeclaration(declaration)) {
6171
6235
  fact(db, "binds", referenceId, declarationId);
6172
6236
  continue;
@@ -8656,6 +8720,9 @@ function trackFactoryBindings(sourceFile, recognize) {
8656
8720
  }
8657
8721
 
8658
8722
  // src/discovery/packageImport.ts
8723
+ function isLanguageLib(file) {
8724
+ return /[\\/]typescript[\\/]lib[\\/]lib\..*\.d\.ts$/.test(file.getFilePath());
8725
+ }
8659
8726
  function splitPackageSpec(spec) {
8660
8727
  if (spec.startsWith("@")) {
8661
8728
  const parts2 = spec.split("/");
@@ -8773,6 +8840,9 @@ function discoverPackageImports(sourceFile, match, kind) {
8773
8840
  if (subjectProvenance === null) {
8774
8841
  return null;
8775
8842
  }
8843
+ if (!methodComesFromSource(callee)) {
8844
+ return subjectProvenance;
8845
+ }
8776
8846
  return {
8777
8847
  packageName: subjectProvenance.packageName,
8778
8848
  exportPath: [...subjectProvenance.exportPath, callee.getName()]
@@ -8780,6 +8850,15 @@ function discoverPackageImports(sourceFile, match, kind) {
8780
8850
  }
8781
8851
  return null;
8782
8852
  }
8853
+ function methodComesFromSource(callee) {
8854
+ const declarations = callee.getNameNode().getSymbol()?.getDeclarations();
8855
+ if (declarations === void 0 || declarations.length === 0) {
8856
+ return true;
8857
+ }
8858
+ return declarations.some(
8859
+ (declaration) => !isLanguageLib(declaration.getSourceFile())
8860
+ );
8861
+ }
8783
8862
  const results = [];
8784
8863
  const seen = /* @__PURE__ */ new Set();
8785
8864
  sourceFile.forEachDescendant((node) => {
@@ -10380,8 +10459,8 @@ function bindingLabel(binding) {
10380
10459
  if (semantics.name === "rest") {
10381
10460
  return `${semantics.method} ${semantics.path}`;
10382
10461
  }
10383
- if (semantics.name === "storage-relational") {
10384
- return `${semantics.storageSystem}:${semantics.table}`;
10462
+ if (semantics.name === "storage") {
10463
+ return `${semantics.storageSystem}:${semantics.container}`;
10385
10464
  }
10386
10465
  if (semantics.name === "message-bus") {
10387
10466
  return `${semantics.messageBus}:${semantics.channel}`;
@@ -10615,7 +10694,9 @@ function extractReachableSummary(candidate, options, recognizers) {
10615
10694
  unit,
10616
10695
  reachablePack,
10617
10696
  recognizers.invocation,
10618
- recognizers.access
10697
+ recognizers.access,
10698
+ void 0,
10699
+ recognizers.resolveWrittenValue
10619
10700
  );
10620
10701
  raw.boundaryBinding = (0, import_behavioral_ir4.functionCallBinding)({
10621
10702
  transport: "in-process",
@@ -13055,7 +13136,8 @@ function createTypeScriptAdapter(config) {
13055
13136
  config.frameworks,
13056
13137
  tallies
13057
13138
  ),
13058
- access: collectAccessRecognizers(config.frameworks, tallies)
13139
+ access: collectAccessRecognizers(config.frameworks, tallies),
13140
+ resolveWrittenValue: (value) => resolution.resolveWrittenValue(value)
13059
13141
  }
13060
13142
  )
13061
13143
  ) : withSubUnits;
@@ -13367,6 +13449,13 @@ function readStringArg(arg) {
13367
13449
  }
13368
13450
  return candidate.value;
13369
13451
  }
13452
+ function rootIdentifier(node) {
13453
+ let current2 = node;
13454
+ while (import_ts_morph57.Node.isPropertyAccessExpression(current2)) {
13455
+ current2 = current2.getExpression();
13456
+ }
13457
+ return import_ts_morph57.Node.isIdentifier(current2) ? current2 : null;
13458
+ }
13370
13459
 
13371
13460
  // src/packHealth.ts
13372
13461
  function stagesOf(funnel) {
@@ -13505,5 +13594,6 @@ function formatPackHealth(checks, audiences) {
13505
13594
  readContract,
13506
13595
  readContractForClientCall,
13507
13596
  resolveAliasedSymbol,
13508
- resolveSubject
13597
+ resolveSubject,
13598
+ rootIdentifier
13509
13599
  });
package/dist/index.d.cts CHANGED
@@ -640,6 +640,12 @@ interface ConfiguredCallContext {
640
640
  * with the wrong consumer, which is worse than missing the producer.
641
641
  */
642
642
  declare function readConfiguredCall(call: CallExpression, ctx: ConfiguredCallContext, spec: ConfiguredCallSpec): ConfiguredCallRead | null;
643
+ /**
644
+ * The identifier a property-access chain starts from, so `client.send`
645
+ * and `sqs.client.send` both come back as the name a pack can look up.
646
+ * Null when the chain starts from something else, a call or a literal.
647
+ */
648
+ declare function rootIdentifier(node: Node): Node | null;
643
649
 
644
650
  interface ContractReadResult {
645
651
  declaredContract: RawDeclaredContract;
@@ -946,4 +952,4 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
946
952
  version?: string;
947
953
  }>): string;
948
954
 
949
- export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, resolveAliasedSymbol, resolveSubject };
955
+ export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, resolveAliasedSymbol, resolveSubject, rootIdentifier };
package/dist/index.d.ts CHANGED
@@ -640,6 +640,12 @@ interface ConfiguredCallContext {
640
640
  * with the wrong consumer, which is worse than missing the producer.
641
641
  */
642
642
  declare function readConfiguredCall(call: CallExpression, ctx: ConfiguredCallContext, spec: ConfiguredCallSpec): ConfiguredCallRead | null;
643
+ /**
644
+ * The identifier a property-access chain starts from, so `client.send`
645
+ * and `sqs.client.send` both come back as the name a pack can look up.
646
+ * Null when the chain starts from something else, a call or a literal.
647
+ */
648
+ declare function rootIdentifier(node: Node): Node | null;
643
649
 
644
650
  interface ContractReadResult {
645
651
  declaredContract: RawDeclaredContract;
@@ -946,4 +952,4 @@ declare function computeAdapterPacksDigest(packVersions: ReadonlyArray<{
946
952
  version?: string;
947
953
  }>): string;
948
954
 
949
- export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, resolveAliasedSymbol, resolveSubject };
955
+ export { ADAPTER_VERSION, type CacheDiagnostic, type CacheLookup, type ClientCallSite, type ConfiguredCallContext, type ConfiguredCallRead, type ConfiguredCallSpec, type ContractReadResult, type DiscoveredUnit, type EmptyStage, type ExtractionReport, type FoundTerminal, type FunctionRoot, type HealthCheck, type HealthViolation, type PackFunnel, ResolutionStore, type Timer, type TimingReport, type TsDiscoveryContext, type TsJsxAttributeLocation, type TsSubUnitContext, type TypeScriptAdapter, type TypeScriptAdapterConfig, collectAncestorBranches, collectClientFieldAccesses, computeAdapterPacksDigest, computeContentHash, createProjectWithoutTsconfig, createTsDiscoveryContext, createTsSubUnitContext, createTypeScriptAdapter, discoverUnits, evaluatePackHealth, exportedDeclarationsOf, extractCodeStructure, extractRawBranches, findNearestTsconfig, findTerminals, formatPackHealth, isImportedFrom, parseConditionExpression, readConfiguredCall, readContract, readContractForClientCall, resolveAliasedSymbol, resolveSubject, rootIdentifier };
package/dist/index.js CHANGED
@@ -2394,7 +2394,7 @@ function dispatchAccessRecognizers(root, recognizers, isStop, resolveWrittenValu
2394
2394
  traversal.skip();
2395
2395
  return;
2396
2396
  }
2397
- if (!Node11.isPropertyAccessExpression(node) && !Node11.isCallExpression(node)) {
2397
+ if (!Node11.isPropertyAccessExpression(node) && !Node11.isCallExpression(node) && !Node11.isTaggedTemplateExpression(node)) {
2398
2398
  return;
2399
2399
  }
2400
2400
  const ctx = {
@@ -3975,10 +3975,59 @@ function writesToBindingUncached(declaration) {
3975
3975
  }
3976
3976
  return { values, inOrder: writesRunInOrder(declaration, writes) };
3977
3977
  }
3978
+ function writesToField(declaration) {
3979
+ const remembered = byDeclaration.get(declaration);
3980
+ if (remembered !== void 0) {
3981
+ return remembered;
3982
+ }
3983
+ const answer = writesToFieldUncached(declaration);
3984
+ byDeclaration.set(declaration, answer);
3985
+ return answer;
3986
+ }
3987
+ function writesToFieldUncached(declaration) {
3988
+ const initializer = declaration.getInitializer();
3989
+ const assignments = assignmentsTo(declaration);
3990
+ if (assignments.length === 0) {
3991
+ return {
3992
+ values: initializer === void 0 ? [] : [initializer],
3993
+ inOrder: true
3994
+ };
3995
+ }
3996
+ const values = [];
3997
+ for (const write of assignments) {
3998
+ if (write.value === null) {
3999
+ return { values: [], inOrder: false };
4000
+ }
4001
+ values.push(write.value);
4002
+ }
4003
+ const withInitializer = initializer === void 0 ? values : [initializer, ...values];
4004
+ return {
4005
+ values: withInitializer,
4006
+ inOrder: assignments.every(
4007
+ (write) => writeRunsInConstructor(declaration, write)
4008
+ )
4009
+ };
4010
+ }
4011
+ function writeRunsInConstructor(declaration, write) {
4012
+ const statement = statementOf(write.node);
4013
+ if (statement === null) {
4014
+ return false;
4015
+ }
4016
+ const body = statement.getParent();
4017
+ if (body === void 0 || !Node17.isBlock(body)) {
4018
+ return false;
4019
+ }
4020
+ const owner = body.getParent();
4021
+ return owner !== void 0 && Node17.isConstructorDeclaration(owner) && owner.getParent() === declaration.getParent();
4022
+ }
3978
4023
  function isWrittenAgain(declaration) {
3979
4024
  return assignmentsTo(declaration).length > 0;
3980
4025
  }
3981
4026
  function assignmentsTo(declaration) {
4027
+ if (Node17.isPropertyDeclaration(declaration)) {
4028
+ const sourceFile2 = declaration.getSourceFile();
4029
+ return sourceFile2.isDeclarationFile() ? [] : assignmentsInFile(sourceFile2).get(declaration) ?? [];
4030
+ }
3982
4031
  if (declaration.getVariableStatement()?.getDeclarationKind() === VariableDeclarationKind.Const) {
3983
4032
  return [];
3984
4033
  }
@@ -4018,7 +4067,7 @@ function writeAt(node) {
4018
4067
  if (Node17.isBinaryExpression(node)) {
4019
4068
  const operator = node.getOperatorToken().getKind();
4020
4069
  const target = node.getLeft();
4021
- if (!isAssignmentOperator(operator) || !Node17.isIdentifier(target)) {
4070
+ if (!isAssignmentOperator(operator) || !(Node17.isIdentifier(target) || Node17.isPropertyAccessExpression(target))) {
4022
4071
  return null;
4023
4072
  }
4024
4073
  const value = operator === SyntaxKind5.EqualsToken ? node.getRight() : null;
@@ -4035,13 +4084,14 @@ function writeAt(node) {
4035
4084
  return null;
4036
4085
  }
4037
4086
  function declarationsOf(name) {
4038
- const symbol = name.getSymbol();
4087
+ const nameNode = Node17.isPropertyAccessExpression(name) ? name.getNameNode() : name;
4088
+ const symbol = nameNode.getSymbol();
4039
4089
  if (symbol === void 0) {
4040
4090
  return [];
4041
4091
  }
4042
4092
  const declarations = [];
4043
4093
  for (const declaration of symbol.getDeclarations()) {
4044
- if (Node17.isVariableDeclaration(declaration)) {
4094
+ if (Node17.isVariableDeclaration(declaration) || Node17.isPropertyDeclaration(declaration)) {
4045
4095
  declarations.push(declaration);
4046
4096
  }
4047
4097
  }
@@ -5309,13 +5359,13 @@ function extractEndpointContract(endpointNode, pattern, framework) {
5309
5359
  continue;
5310
5360
  }
5311
5361
  const propName = prop.getName();
5312
- if (propName === "method") {
5362
+ if (propName === pattern.methodProperty) {
5313
5363
  const val = prop.getInitializer();
5314
5364
  if (val !== void 0 && Node24.isStringLiteral(val)) {
5315
5365
  method = val.getLiteralValue();
5316
5366
  }
5317
5367
  }
5318
- if (propName === "path") {
5368
+ if (propName === pattern.pathProperty) {
5319
5369
  const val = prop.getInitializer();
5320
5370
  if (val !== void 0 && Node24.isStringLiteral(val)) {
5321
5371
  path11 = val.getLiteralValue();
@@ -6070,6 +6120,14 @@ function emitBindingValues(db, table, declaration) {
6070
6120
  }
6071
6121
  fact(db, "endsHolding", declarationId, emitValue(db, table, last));
6072
6122
  }
6123
+ function emitFieldValues(db, table, declaration) {
6124
+ const { values, inOrder } = writesToField(declaration);
6125
+ const last = values[values.length - 1];
6126
+ if (!inOrder || last === void 0) {
6127
+ return;
6128
+ }
6129
+ fact(db, "binds", nodeId(declaration), emitValue(db, table, last));
6130
+ }
6073
6131
  function emitBindingElementFacts(db, table, element) {
6074
6132
  const id = nodeId(element);
6075
6133
  table.byId.set(id, element);
@@ -6145,6 +6203,11 @@ function emitReferenceFacts(db, table, reference) {
6145
6203
  emitBindingValues(db, table, declaration);
6146
6204
  continue;
6147
6205
  }
6206
+ if (Node26.isPropertyDeclaration(declaration)) {
6207
+ fact(db, "binds", referenceId, declarationId);
6208
+ emitFieldValues(db, table, declaration);
6209
+ continue;
6210
+ }
6148
6211
  if (Node26.isParameterDeclaration(declaration)) {
6149
6212
  fact(db, "binds", referenceId, declarationId);
6150
6213
  continue;
@@ -8640,6 +8703,9 @@ function trackFactoryBindings(sourceFile, recognize) {
8640
8703
  }
8641
8704
 
8642
8705
  // src/discovery/packageImport.ts
8706
+ function isLanguageLib(file) {
8707
+ return /[\\/]typescript[\\/]lib[\\/]lib\..*\.d\.ts$/.test(file.getFilePath());
8708
+ }
8643
8709
  function splitPackageSpec(spec) {
8644
8710
  if (spec.startsWith("@")) {
8645
8711
  const parts2 = spec.split("/");
@@ -8757,6 +8823,9 @@ function discoverPackageImports(sourceFile, match, kind) {
8757
8823
  if (subjectProvenance === null) {
8758
8824
  return null;
8759
8825
  }
8826
+ if (!methodComesFromSource(callee)) {
8827
+ return subjectProvenance;
8828
+ }
8760
8829
  return {
8761
8830
  packageName: subjectProvenance.packageName,
8762
8831
  exportPath: [...subjectProvenance.exportPath, callee.getName()]
@@ -8764,6 +8833,15 @@ function discoverPackageImports(sourceFile, match, kind) {
8764
8833
  }
8765
8834
  return null;
8766
8835
  }
8836
+ function methodComesFromSource(callee) {
8837
+ const declarations = callee.getNameNode().getSymbol()?.getDeclarations();
8838
+ if (declarations === void 0 || declarations.length === 0) {
8839
+ return true;
8840
+ }
8841
+ return declarations.some(
8842
+ (declaration) => !isLanguageLib(declaration.getSourceFile())
8843
+ );
8844
+ }
8767
8845
  const results = [];
8768
8846
  const seen = /* @__PURE__ */ new Set();
8769
8847
  sourceFile.forEachDescendant((node) => {
@@ -10381,8 +10459,8 @@ function bindingLabel(binding) {
10381
10459
  if (semantics.name === "rest") {
10382
10460
  return `${semantics.method} ${semantics.path}`;
10383
10461
  }
10384
- if (semantics.name === "storage-relational") {
10385
- return `${semantics.storageSystem}:${semantics.table}`;
10462
+ if (semantics.name === "storage") {
10463
+ return `${semantics.storageSystem}:${semantics.container}`;
10386
10464
  }
10387
10465
  if (semantics.name === "message-bus") {
10388
10466
  return `${semantics.messageBus}:${semantics.channel}`;
@@ -10616,7 +10694,9 @@ function extractReachableSummary(candidate, options, recognizers) {
10616
10694
  unit,
10617
10695
  reachablePack,
10618
10696
  recognizers.invocation,
10619
- recognizers.access
10697
+ recognizers.access,
10698
+ void 0,
10699
+ recognizers.resolveWrittenValue
10620
10700
  );
10621
10701
  raw.boundaryBinding = functionCallBinding({
10622
10702
  transport: "in-process",
@@ -13062,7 +13142,8 @@ function createTypeScriptAdapter(config) {
13062
13142
  config.frameworks,
13063
13143
  tallies
13064
13144
  ),
13065
- access: collectAccessRecognizers(config.frameworks, tallies)
13145
+ access: collectAccessRecognizers(config.frameworks, tallies),
13146
+ resolveWrittenValue: (value) => resolution.resolveWrittenValue(value)
13066
13147
  }
13067
13148
  )
13068
13149
  ) : withSubUnits;
@@ -13379,6 +13460,13 @@ function readStringArg(arg) {
13379
13460
  }
13380
13461
  return candidate.value;
13381
13462
  }
13463
+ function rootIdentifier(node) {
13464
+ let current2 = node;
13465
+ while (Node54.isPropertyAccessExpression(current2)) {
13466
+ current2 = current2.getExpression();
13467
+ }
13468
+ return Node54.isIdentifier(current2) ? current2 : null;
13469
+ }
13382
13470
 
13383
13471
  // src/packHealth.ts
13384
13472
  function stagesOf(funnel) {
@@ -13516,5 +13604,6 @@ export {
13516
13604
  readContract,
13517
13605
  readContractForClientCall,
13518
13606
  resolveAliasedSymbol,
13519
- resolveSubject
13607
+ resolveSubject,
13608
+ rootIdentifier
13520
13609
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/adapter-typescript",
3
- "version": "0.5.10",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript adapter for suss — walks source files with ts-morph and emits raw extractions for the suss pipeline.",
6
6
  "keywords": [
@@ -46,10 +46,10 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@suss/behavioral-ir": "0.5.10",
50
- "@suss/datalog": "0.5.10",
51
- "@suss/extractor": "0.5.10",
52
- "@suss/resolution": "0.5.10",
49
+ "@suss/behavioral-ir": "0.6.0",
50
+ "@suss/datalog": "0.6.0",
51
+ "@suss/extractor": "0.6.0",
52
+ "@suss/resolution": "0.6.0",
53
53
  "graphql": "^16.8.0",
54
54
  "picomatch": "^4.0.4",
55
55
  "ts-morph": "^23.0.0"