@suss/extractor 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 +13 -0
- package/dist/index.d.cts +28 -10
- package/dist/index.d.ts +28 -10
- package/dist/index.js +12 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
sharedGatingConditions: () => sharedGatingConditions,
|
|
42
42
|
terminalToOutput: () => terminalToOutput,
|
|
43
43
|
unreadableReading: () => unreadableReading,
|
|
44
|
+
unwrapJsonStringify: () => unwrapJsonStringify,
|
|
44
45
|
valueToReadFurtherFrom: () => valueToReadFurtherFrom,
|
|
45
46
|
writtenReading: () => writtenReading
|
|
46
47
|
});
|
|
@@ -153,6 +154,17 @@ function httpRouteDiscovery(opts) {
|
|
|
153
154
|
requiresImport: [opts.importModule]
|
|
154
155
|
}));
|
|
155
156
|
}
|
|
157
|
+
function unwrapJsonStringify(body) {
|
|
158
|
+
if (body === null || typeof body !== "object") {
|
|
159
|
+
return body;
|
|
160
|
+
}
|
|
161
|
+
const candidate = body;
|
|
162
|
+
if (candidate.kind !== "call" || candidate.callee !== "JSON.stringify") {
|
|
163
|
+
return body;
|
|
164
|
+
}
|
|
165
|
+
const inner = candidate.args?.[0];
|
|
166
|
+
return inner ?? body;
|
|
167
|
+
}
|
|
156
168
|
|
|
157
169
|
// src/paths/enumeratePaths.ts
|
|
158
170
|
var MAX_PATHS = 256;
|
|
@@ -1070,6 +1082,7 @@ function paramToInput(param) {
|
|
|
1070
1082
|
sharedGatingConditions,
|
|
1071
1083
|
terminalToOutput,
|
|
1072
1084
|
unreadableReading,
|
|
1085
|
+
unwrapJsonStringify,
|
|
1073
1086
|
valueToReadFurtherFrom,
|
|
1074
1087
|
writtenReading
|
|
1075
1088
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -942,6 +942,14 @@ interface ContractPattern {
|
|
|
942
942
|
/** The property on the contract object with the responses map on it */
|
|
943
943
|
property: string;
|
|
944
944
|
};
|
|
945
|
+
/**
|
|
946
|
+
* The properties an endpoint states its HTTP method and path under.
|
|
947
|
+
* Both ts-rest and zod-openapi happen to spell them `method` and
|
|
948
|
+
* `path`, but they are the library's words, so the pack says them
|
|
949
|
+
* and the adapter reads whatever it is told.
|
|
950
|
+
*/
|
|
951
|
+
methodProperty: string;
|
|
952
|
+
pathProperty: string;
|
|
945
953
|
paramsExtraction?: {
|
|
946
954
|
property: string;
|
|
947
955
|
};
|
|
@@ -1312,17 +1320,20 @@ interface PatternPack {
|
|
|
1312
1320
|
}>;
|
|
1313
1321
|
/**
|
|
1314
1322
|
* Per-property-access recognizers, the counterpart to
|
|
1315
|
-
* `invocationRecognizers
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1323
|
+
* `invocationRecognizers`. Use these for patterns that read a value
|
|
1324
|
+
* through property access without invoking it: `process.env.X`
|
|
1325
|
+
* env-var reads, `Date.now()`-style time reads (which is actually a
|
|
1326
|
+
* call, see invocationRecognizers), bare `module.constant` reads.
|
|
1327
|
+
*
|
|
1328
|
+
* A recognizer here is handed a property access, a call, or a tagged
|
|
1329
|
+
* template, and guards its own shapes. The tagged template is there
|
|
1330
|
+
* for a library that takes its whole argument as one, the way
|
|
1331
|
+
* `prisma.$queryRaw` and `gql` do.
|
|
1321
1332
|
*
|
|
1322
1333
|
* The scope rules are the same as for invocationRecognizers: it fires
|
|
1323
|
-
* on every
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1334
|
+
* on every such node in the function body and skips nested function
|
|
1335
|
+
* bodies. The emission contract is the same, so effects land on the
|
|
1336
|
+
* enclosing default-branch transition.
|
|
1326
1337
|
*
|
|
1327
1338
|
* The arguments are opaque here and narrowed by the adapter, for the
|
|
1328
1339
|
* same reason as in invocationRecognizers.
|
|
@@ -1506,6 +1517,13 @@ declare function httpRouteDiscovery(opts: {
|
|
|
1506
1517
|
*/
|
|
1507
1518
|
mount?: DiscoveryPattern["mount"];
|
|
1508
1519
|
}): DiscoveryPattern[];
|
|
1520
|
+
/**
|
|
1521
|
+
* The payload behind a `JSON.stringify(...)` call, or the argument
|
|
1522
|
+
* unchanged when it is anything else. A producer serializes its message
|
|
1523
|
+
* before sending it, and the shape worth comparing across the boundary
|
|
1524
|
+
* is what went in, not the string that came out.
|
|
1525
|
+
*/
|
|
1526
|
+
declare function unwrapJsonStringify(body: EffectArg | null): EffectArg | null;
|
|
1509
1527
|
|
|
1510
1528
|
/**
|
|
1511
1529
|
* The path engine, written against `StructuredStatement` rather than any one
|
|
@@ -1897,4 +1915,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
|
|
|
1897
1915
|
declare function effectToIR(effect: RawEffect): Effect;
|
|
1898
1916
|
declare function paramToInput(param: RawParameter): Input;
|
|
1899
1917
|
|
|
1900
|
-
export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, valueToReadFurtherFrom, writtenReading };
|
|
1918
|
+
export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
|
package/dist/index.d.ts
CHANGED
|
@@ -942,6 +942,14 @@ interface ContractPattern {
|
|
|
942
942
|
/** The property on the contract object with the responses map on it */
|
|
943
943
|
property: string;
|
|
944
944
|
};
|
|
945
|
+
/**
|
|
946
|
+
* The properties an endpoint states its HTTP method and path under.
|
|
947
|
+
* Both ts-rest and zod-openapi happen to spell them `method` and
|
|
948
|
+
* `path`, but they are the library's words, so the pack says them
|
|
949
|
+
* and the adapter reads whatever it is told.
|
|
950
|
+
*/
|
|
951
|
+
methodProperty: string;
|
|
952
|
+
pathProperty: string;
|
|
945
953
|
paramsExtraction?: {
|
|
946
954
|
property: string;
|
|
947
955
|
};
|
|
@@ -1312,17 +1320,20 @@ interface PatternPack {
|
|
|
1312
1320
|
}>;
|
|
1313
1321
|
/**
|
|
1314
1322
|
* Per-property-access recognizers, the counterpart to
|
|
1315
|
-
* `invocationRecognizers
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1323
|
+
* `invocationRecognizers`. Use these for patterns that read a value
|
|
1324
|
+
* through property access without invoking it: `process.env.X`
|
|
1325
|
+
* env-var reads, `Date.now()`-style time reads (which is actually a
|
|
1326
|
+
* call, see invocationRecognizers), bare `module.constant` reads.
|
|
1327
|
+
*
|
|
1328
|
+
* A recognizer here is handed a property access, a call, or a tagged
|
|
1329
|
+
* template, and guards its own shapes. The tagged template is there
|
|
1330
|
+
* for a library that takes its whole argument as one, the way
|
|
1331
|
+
* `prisma.$queryRaw` and `gql` do.
|
|
1321
1332
|
*
|
|
1322
1333
|
* The scope rules are the same as for invocationRecognizers: it fires
|
|
1323
|
-
* on every
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1334
|
+
* on every such node in the function body and skips nested function
|
|
1335
|
+
* bodies. The emission contract is the same, so effects land on the
|
|
1336
|
+
* enclosing default-branch transition.
|
|
1326
1337
|
*
|
|
1327
1338
|
* The arguments are opaque here and narrowed by the adapter, for the
|
|
1328
1339
|
* same reason as in invocationRecognizers.
|
|
@@ -1506,6 +1517,13 @@ declare function httpRouteDiscovery(opts: {
|
|
|
1506
1517
|
*/
|
|
1507
1518
|
mount?: DiscoveryPattern["mount"];
|
|
1508
1519
|
}): DiscoveryPattern[];
|
|
1520
|
+
/**
|
|
1521
|
+
* The payload behind a `JSON.stringify(...)` call, or the argument
|
|
1522
|
+
* unchanged when it is anything else. A producer serializes its message
|
|
1523
|
+
* before sending it, and the shape worth comparing across the boundary
|
|
1524
|
+
* is what went in, not the string that came out.
|
|
1525
|
+
*/
|
|
1526
|
+
declare function unwrapJsonStringify(body: EffectArg | null): EffectArg | null;
|
|
1509
1527
|
|
|
1510
1528
|
/**
|
|
1511
1529
|
* The path engine, written against `StructuredStatement` rather than any one
|
|
@@ -1897,4 +1915,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
|
|
|
1897
1915
|
declare function effectToIR(effect: RawEffect): Effect;
|
|
1898
1916
|
declare function paramToInput(param: RawParameter): Input;
|
|
1899
1917
|
|
|
1900
|
-
export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, valueToReadFurtherFrom, writtenReading };
|
|
1918
|
+
export { type AccessRecognizer, type BindingExtraction, type BodyContent, type CaseGroup, type ChosenReading, type ConditionHandle, type ConditionInfo, type ConditionSource, type ContractPattern, type DefaultedReading, type DiscoveredCustomUnit, type DiscoveredSubUnit, type DiscoveredSubUnitParent, type DiscoveryMatch, type DiscoveryPattern, type EffectArg, type ExitKind, type ExtractorOptions, IdMap, IdSet, type Identified, type InputMappingPattern, type InvocationRecognizer, type LanguageAdapter, PathBudgetExceeded, type PatternPack, type RawBranch, type RawCodeStructure, type RawCondition, type RawDeclaredContract, type RawDependencyCall, type RawEffect, type RawParameter, type RawTerminal, type Reading, type ResponsePropertyMapping, type ResponsePropertyMeaning, type SourceRange, type StatementBlock, type StructuredPathConditionsInput, type StructuredPathConditionsResult, type StructuredStatement, type TerminalExtraction, type TerminalMatch, type TerminalPattern, type TransparentWrapper, UnmodeledFlow, absentReading, ambiguousReading, andThenReading, assembleSummary, assessConfidence, detectGaps, effectToIR, enumerateOrDegrade, enumerateStructuredPaths, firstWrittenReading, httpRouteDiscovery, makeTransitionId, mapReading, paramToInput, sharedGatingConditions, terminalToOutput, unreadableReading, unwrapJsonStringify, valueToReadFurtherFrom, writtenReading };
|
package/dist/index.js
CHANGED
|
@@ -111,6 +111,17 @@ function httpRouteDiscovery(opts) {
|
|
|
111
111
|
requiresImport: [opts.importModule]
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
|
+
function unwrapJsonStringify(body) {
|
|
115
|
+
if (body === null || typeof body !== "object") {
|
|
116
|
+
return body;
|
|
117
|
+
}
|
|
118
|
+
const candidate = body;
|
|
119
|
+
if (candidate.kind !== "call" || candidate.callee !== "JSON.stringify") {
|
|
120
|
+
return body;
|
|
121
|
+
}
|
|
122
|
+
const inner = candidate.args?.[0];
|
|
123
|
+
return inner ?? body;
|
|
124
|
+
}
|
|
114
125
|
|
|
115
126
|
// src/paths/enumeratePaths.ts
|
|
116
127
|
var MAX_PATHS = 256;
|
|
@@ -1027,6 +1038,7 @@ export {
|
|
|
1027
1038
|
sharedGatingConditions,
|
|
1028
1039
|
terminalToOutput,
|
|
1029
1040
|
unreadableReading,
|
|
1041
|
+
unwrapJsonStringify,
|
|
1030
1042
|
valueToReadFurtherFrom,
|
|
1031
1043
|
writtenReading
|
|
1032
1044
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/extractor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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.
|
|
48
|
+
"@suss/behavioral-ir": "0.6.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"tsup": "*",
|