@suss/adapter-typescript 0.5.10 → 0.5.11

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
 
@@ -5338,13 +5339,13 @@ function extractEndpointContract(endpointNode, pattern, framework) {
5338
5339
  continue;
5339
5340
  }
5340
5341
  const propName = prop.getName();
5341
- if (propName === "method") {
5342
+ if (propName === pattern.methodProperty) {
5342
5343
  const val = prop.getInitializer();
5343
5344
  if (val !== void 0 && import_ts_morph25.Node.isStringLiteral(val)) {
5344
5345
  method = val.getLiteralValue();
5345
5346
  }
5346
5347
  }
5347
- if (propName === "path") {
5348
+ if (propName === pattern.pathProperty) {
5348
5349
  const val = prop.getInitializer();
5349
5350
  if (val !== void 0 && import_ts_morph25.Node.isStringLiteral(val)) {
5350
5351
  path11 = val.getLiteralValue();
@@ -13367,6 +13368,13 @@ function readStringArg(arg) {
13367
13368
  }
13368
13369
  return candidate.value;
13369
13370
  }
13371
+ function rootIdentifier(node) {
13372
+ let current2 = node;
13373
+ while (import_ts_morph57.Node.isPropertyAccessExpression(current2)) {
13374
+ current2 = current2.getExpression();
13375
+ }
13376
+ return import_ts_morph57.Node.isIdentifier(current2) ? current2 : null;
13377
+ }
13370
13378
 
13371
13379
  // src/packHealth.ts
13372
13380
  function stagesOf(funnel) {
@@ -13505,5 +13513,6 @@ function formatPackHealth(checks, audiences) {
13505
13513
  readContract,
13506
13514
  readContractForClientCall,
13507
13515
  resolveAliasedSymbol,
13508
- resolveSubject
13516
+ resolveSubject,
13517
+ rootIdentifier
13509
13518
  });
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
@@ -5309,13 +5309,13 @@ function extractEndpointContract(endpointNode, pattern, framework) {
5309
5309
  continue;
5310
5310
  }
5311
5311
  const propName = prop.getName();
5312
- if (propName === "method") {
5312
+ if (propName === pattern.methodProperty) {
5313
5313
  const val = prop.getInitializer();
5314
5314
  if (val !== void 0 && Node24.isStringLiteral(val)) {
5315
5315
  method = val.getLiteralValue();
5316
5316
  }
5317
5317
  }
5318
- if (propName === "path") {
5318
+ if (propName === pattern.pathProperty) {
5319
5319
  const val = prop.getInitializer();
5320
5320
  if (val !== void 0 && Node24.isStringLiteral(val)) {
5321
5321
  path11 = val.getLiteralValue();
@@ -13379,6 +13379,13 @@ function readStringArg(arg) {
13379
13379
  }
13380
13380
  return candidate.value;
13381
13381
  }
13382
+ function rootIdentifier(node) {
13383
+ let current2 = node;
13384
+ while (Node54.isPropertyAccessExpression(current2)) {
13385
+ current2 = current2.getExpression();
13386
+ }
13387
+ return Node54.isIdentifier(current2) ? current2 : null;
13388
+ }
13382
13389
 
13383
13390
  // src/packHealth.ts
13384
13391
  function stagesOf(funnel) {
@@ -13516,5 +13523,6 @@ export {
13516
13523
  readContract,
13517
13524
  readContractForClientCall,
13518
13525
  resolveAliasedSymbol,
13519
- resolveSubject
13526
+ resolveSubject,
13527
+ rootIdentifier
13520
13528
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/adapter-typescript",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
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.5.11",
50
+ "@suss/datalog": "0.5.11",
51
+ "@suss/extractor": "0.5.11",
52
+ "@suss/resolution": "0.5.11",
53
53
  "graphql": "^16.8.0",
54
54
  "picomatch": "^4.0.4",
55
55
  "ts-morph": "^23.0.0"