@suss/extractor 0.16.0 → 0.18.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
@@ -129,6 +129,16 @@ function nested(value, depth) {
129
129
  }
130
130
  return valuesIn(value, depth + 1);
131
131
  }
132
+ function mergeInputReads(derived, syntactic) {
133
+ const found = /* @__PURE__ */ new Map();
134
+ for (const read of [...derived, ...syntactic]) {
135
+ const key = `${read.input}\0${read.path.join(".")}`;
136
+ if (!found.has(key)) {
137
+ found.set(key, read);
138
+ }
139
+ }
140
+ return [...found.values()];
141
+ }
132
142
 
133
143
  // src/packHelpers.ts
134
144
  function httpRouteDiscovery(opts) {
@@ -844,10 +854,13 @@ function assembleSummary(raw, options = DEFAULT_OPTIONS) {
844
854
  const confidence = assessConfidence(raw);
845
855
  const inputs = raw.parameters.map(paramToInput);
846
856
  const metadata = buildMetadata(raw);
847
- const reads = inputReadsOf({
848
- conditions: transitions.map((t) => t.conditions),
849
- values: transitions.flatMap((t) => valuesOfOutput(t.output))
850
- });
857
+ const reads = mergeInputReads(
858
+ inputReadsOf({
859
+ conditions: transitions.map((t) => t.conditions),
860
+ values: transitions.flatMap((t) => valuesOfOutput(t.output))
861
+ }),
862
+ raw.extraInputReads ?? []
863
+ );
851
864
  return {
852
865
  kind: raw.identity.kind,
853
866
  location: {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,26 @@
1
1
  import { Effect, MessageBusSemantics, DeployableUnit, Predicate, BehavioralSummary, TypeShape, RenderNode, CodeUnitKind, BoundaryBinding, GraphqlDeclaredContract, ConfidenceInfo, Transition, Gap, Input, Output } from '@suss/behavioral-ir';
2
2
 
3
+ /**
4
+ * What a unit reads out of what it was given.
5
+ *
6
+ * A summary already describes this, but only as a chain of `derived` nodes
7
+ * nested one inside the next, which anyone who wants the list has to walk
8
+ * themselves. The `path` on an input reference is empty, so querying the
9
+ * field that looks like the answer gives nothing back.
10
+ *
11
+ * This module flattens that into the list directly: everything a unit reaches
12
+ * for through its inputs, once each, in the order somebody would say them out
13
+ * loud. It goes on the summary as `inputReads`.
14
+ */
15
+
16
+ /** One thing a unit read, and the way it reached it. */
17
+ interface InputRead {
18
+ /** The input it came through, by the name the inputs table uses. */
19
+ input: string;
20
+ /** The properties walked to reach it, outermost first. */
21
+ path: string[];
22
+ }
23
+
3
24
  /**
4
25
  * The `PatternPack` interface, which is what a framework pack gives a language
5
26
  * adapter. The pack says WHAT to look for (which import, which call, which
@@ -2248,6 +2269,12 @@ interface RawCodeStructure {
2248
2269
  */
2249
2270
  bodyContent?: BodyContent;
2250
2271
  dependencyCalls: RawDependencyCall[];
2272
+ /**
2273
+ * Reads the adapter saw in the body that never flow into a condition
2274
+ * or an output value, a render tree's `props.title` say. Merged into
2275
+ * `inputReads` beside the derived ones.
2276
+ */
2277
+ extraInputReads?: InputRead[];
2251
2278
  declaredContract: RawDeclaredContract | null;
2252
2279
  /** The property a consumer goes through to get at the body, `data` for
2253
2280
  * axios say, so the checker can unwrap it without knowing each pack. */
@@ -2316,4 +2343,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
2316
2343
  declare function effectToIR(effect: RawEffect): Effect;
2317
2344
  declare function paramToInput(param: RawParameter): Input;
2318
2345
 
2319
- export { type AccessRecognizer, type AstCapableOps, type BindingExtraction, type BodyContent, type CallOps, type CaseGroup, type ChannelSource, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, type FailureDelivery, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, type LoweredStatementParts, type OpsCarrier, type PackDeclarations, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ReceiverOrigin, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, registrationHelperDiscovery, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
2346
+ export { type AccessRecognizer, type AstCapableOps, type BindingExtraction, type BodyContent, type CallOps, type CaseGroup, type ChannelSource, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, type FailureDelivery, IdMap, IdSet, type Identified, type InputMappingPattern, type InputRead, type InvocationRecognizer, type LanguageAdapter, type LoweredStatementParts, type OpsCarrier, type PackDeclarations, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ReceiverOrigin, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, registrationHelperDiscovery, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,26 @@
1
1
  import { Effect, MessageBusSemantics, DeployableUnit, Predicate, BehavioralSummary, TypeShape, RenderNode, CodeUnitKind, BoundaryBinding, GraphqlDeclaredContract, ConfidenceInfo, Transition, Gap, Input, Output } from '@suss/behavioral-ir';
2
2
 
3
+ /**
4
+ * What a unit reads out of what it was given.
5
+ *
6
+ * A summary already describes this, but only as a chain of `derived` nodes
7
+ * nested one inside the next, which anyone who wants the list has to walk
8
+ * themselves. The `path` on an input reference is empty, so querying the
9
+ * field that looks like the answer gives nothing back.
10
+ *
11
+ * This module flattens that into the list directly: everything a unit reaches
12
+ * for through its inputs, once each, in the order somebody would say them out
13
+ * loud. It goes on the summary as `inputReads`.
14
+ */
15
+
16
+ /** One thing a unit read, and the way it reached it. */
17
+ interface InputRead {
18
+ /** The input it came through, by the name the inputs table uses. */
19
+ input: string;
20
+ /** The properties walked to reach it, outermost first. */
21
+ path: string[];
22
+ }
23
+
3
24
  /**
4
25
  * The `PatternPack` interface, which is what a framework pack gives a language
5
26
  * adapter. The pack says WHAT to look for (which import, which call, which
@@ -2248,6 +2269,12 @@ interface RawCodeStructure {
2248
2269
  */
2249
2270
  bodyContent?: BodyContent;
2250
2271
  dependencyCalls: RawDependencyCall[];
2272
+ /**
2273
+ * Reads the adapter saw in the body that never flow into a condition
2274
+ * or an output value, a render tree's `props.title` say. Merged into
2275
+ * `inputReads` beside the derived ones.
2276
+ */
2277
+ extraInputReads?: InputRead[];
2251
2278
  declaredContract: RawDeclaredContract | null;
2252
2279
  /** The property a consumer goes through to get at the body, `data` for
2253
2280
  * axios say, so the checker can unwrap it without knowing each pack. */
@@ -2316,4 +2343,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
2316
2343
  declare function effectToIR(effect: RawEffect): Effect;
2317
2344
  declare function paramToInput(param: RawParameter): Input;
2318
2345
 
2319
- export { type AccessRecognizer, type AstCapableOps, type BindingExtraction, type BodyContent, type CallOps, type CaseGroup, type ChannelSource, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, type FailureDelivery, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, type LoweredStatementParts, type OpsCarrier, type PackDeclarations, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ReceiverOrigin, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, registrationHelperDiscovery, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
2346
+ export { type AccessRecognizer, type AstCapableOps, type BindingExtraction, type BodyContent, type CallOps, type CaseGroup, type ChannelSource, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ConstructedFrom, type ContractPattern, type DeclaredBinding, type DeclaredBy, type DeclaredMatch, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, type FailureDelivery, IdMap, IdSet, type Identified, type InputMappingPattern, type InputRead, type InvocationRecognizer, type LanguageAdapter, type LoweredStatementParts, type OpsCarrier, type PackDeclarations, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ReceiverOrigin, type RegistrationHelper, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, type UnsettledName, type ValueEntry, type ValueOps, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, registrationHelperDiscovery, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
package/dist/index.js CHANGED
@@ -86,6 +86,16 @@ function nested(value, depth) {
86
86
  }
87
87
  return valuesIn(value, depth + 1);
88
88
  }
89
+ function mergeInputReads(derived, syntactic) {
90
+ const found = /* @__PURE__ */ new Map();
91
+ for (const read of [...derived, ...syntactic]) {
92
+ const key = `${read.input}\0${read.path.join(".")}`;
93
+ if (!found.has(key)) {
94
+ found.set(key, read);
95
+ }
96
+ }
97
+ return [...found.values()];
98
+ }
89
99
 
90
100
  // src/packHelpers.ts
91
101
  function httpRouteDiscovery(opts) {
@@ -801,10 +811,13 @@ function assembleSummary(raw, options = DEFAULT_OPTIONS) {
801
811
  const confidence = assessConfidence(raw);
802
812
  const inputs = raw.parameters.map(paramToInput);
803
813
  const metadata = buildMetadata(raw);
804
- const reads = inputReadsOf({
805
- conditions: transitions.map((t) => t.conditions),
806
- values: transitions.flatMap((t) => valuesOfOutput(t.output))
807
- });
814
+ const reads = mergeInputReads(
815
+ inputReadsOf({
816
+ conditions: transitions.map((t) => t.conditions),
817
+ values: transitions.flatMap((t) => valuesOfOutput(t.output))
818
+ }),
819
+ raw.extraInputReads ?? []
820
+ );
808
821
  return {
809
822
  kind: raw.identity.kind,
810
823
  location: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/extractor",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "description": "Framework-agnostic extraction pipeline that turns raw extractions into suss behavioral summaries.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "typecheck": "tsc --noEmit"
46
46
  },
47
47
  "dependencies": {
48
- "@suss/behavioral-ir": "0.16.0"
48
+ "@suss/behavioral-ir": "0.18.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsup": "*",