@suss/extractor 0.5.9 → 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 +13 -0
- package/dist/index.d.cts +52 -2
- package/dist/index.d.ts +52 -2
- 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
|
};
|
|
@@ -1276,6 +1284,40 @@ interface PatternPack {
|
|
|
1276
1284
|
* `"Sentry.wrapHandler"`.
|
|
1277
1285
|
*/
|
|
1278
1286
|
transparentWrappers?: TransparentWrapper[];
|
|
1287
|
+
/**
|
|
1288
|
+
* How this library's client object is constructed, so an operation
|
|
1289
|
+
* summary can say which endpoint its calls go to. Each entry is a
|
|
1290
|
+
* constructor or factory imported from `importModule`, with
|
|
1291
|
+
* `uriProperty` the option key whose value is the endpoint. The
|
|
1292
|
+
* adapter reads every construction in the project and stamps the
|
|
1293
|
+
* client on each operation summary when exactly one distinct client
|
|
1294
|
+
* exists; two or more distinct clients abstain, since a hook call
|
|
1295
|
+
* does not say which one it goes through.
|
|
1296
|
+
*/
|
|
1297
|
+
graphqlClients?: Array<{
|
|
1298
|
+
importModule: string;
|
|
1299
|
+
importName: string;
|
|
1300
|
+
uriProperty: string;
|
|
1301
|
+
}>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Which service a client talks to, keyed by the endpoint the
|
|
1304
|
+
* construction was read with: the uri literal, or the written
|
|
1305
|
+
* expression when the value is computed. The value is the provider
|
|
1306
|
+
* workspace name. This is deployment knowledge, so it comes from the
|
|
1307
|
+
* pack's own per-project config rather than from the library.
|
|
1308
|
+
*/
|
|
1309
|
+
graphqlClientBindings?: Record<string, string>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Which service the operations in a set of files talk to, for a
|
|
1312
|
+
* project whose one frontend uses two clients. A hook call does not
|
|
1313
|
+
* say which client it goes through, so when the sole-client rule
|
|
1314
|
+
* cannot decide, these globs do: an operation whose file matches
|
|
1315
|
+
* gets the entry's workspace. First matching entry wins.
|
|
1316
|
+
*/
|
|
1317
|
+
graphqlOperationScopes?: Array<{
|
|
1318
|
+
files: string[];
|
|
1319
|
+
workspace: string;
|
|
1320
|
+
}>;
|
|
1279
1321
|
/**
|
|
1280
1322
|
* Per-property-access recognizers, the counterpart to
|
|
1281
1323
|
* `invocationRecognizers`, firing on `PropertyAccessExpression`
|
|
@@ -1387,7 +1429,8 @@ interface DiscoveredCustomUnit {
|
|
|
1387
1429
|
*/
|
|
1388
1430
|
channelInfo?: {
|
|
1389
1431
|
messageBus: MessageBusSemantics["messageBus"];
|
|
1390
|
-
channel
|
|
1432
|
+
/** Null when the pack knows the wire but not the channel on it. */
|
|
1433
|
+
channel: string | null;
|
|
1391
1434
|
};
|
|
1392
1435
|
/** The thing that gets deployed and runs this unit, when known. */
|
|
1393
1436
|
deployableUnit?: DeployableUnit;
|
|
@@ -1471,6 +1514,13 @@ declare function httpRouteDiscovery(opts: {
|
|
|
1471
1514
|
*/
|
|
1472
1515
|
mount?: DiscoveryPattern["mount"];
|
|
1473
1516
|
}): DiscoveryPattern[];
|
|
1517
|
+
/**
|
|
1518
|
+
* The payload behind a `JSON.stringify(...)` call, or the argument
|
|
1519
|
+
* unchanged when it is anything else. A producer serializes its message
|
|
1520
|
+
* before sending it, and the shape worth comparing across the boundary
|
|
1521
|
+
* is what went in, not the string that came out.
|
|
1522
|
+
*/
|
|
1523
|
+
declare function unwrapJsonStringify(body: EffectArg | null): EffectArg | null;
|
|
1474
1524
|
|
|
1475
1525
|
/**
|
|
1476
1526
|
* The path engine, written against `StructuredStatement` rather than any one
|
|
@@ -1862,4 +1912,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
|
|
|
1862
1912
|
declare function effectToIR(effect: RawEffect): Effect;
|
|
1863
1913
|
declare function paramToInput(param: RawParameter): Input;
|
|
1864
1914
|
|
|
1865
|
-
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 };
|
|
1915
|
+
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
|
};
|
|
@@ -1276,6 +1284,40 @@ interface PatternPack {
|
|
|
1276
1284
|
* `"Sentry.wrapHandler"`.
|
|
1277
1285
|
*/
|
|
1278
1286
|
transparentWrappers?: TransparentWrapper[];
|
|
1287
|
+
/**
|
|
1288
|
+
* How this library's client object is constructed, so an operation
|
|
1289
|
+
* summary can say which endpoint its calls go to. Each entry is a
|
|
1290
|
+
* constructor or factory imported from `importModule`, with
|
|
1291
|
+
* `uriProperty` the option key whose value is the endpoint. The
|
|
1292
|
+
* adapter reads every construction in the project and stamps the
|
|
1293
|
+
* client on each operation summary when exactly one distinct client
|
|
1294
|
+
* exists; two or more distinct clients abstain, since a hook call
|
|
1295
|
+
* does not say which one it goes through.
|
|
1296
|
+
*/
|
|
1297
|
+
graphqlClients?: Array<{
|
|
1298
|
+
importModule: string;
|
|
1299
|
+
importName: string;
|
|
1300
|
+
uriProperty: string;
|
|
1301
|
+
}>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Which service a client talks to, keyed by the endpoint the
|
|
1304
|
+
* construction was read with: the uri literal, or the written
|
|
1305
|
+
* expression when the value is computed. The value is the provider
|
|
1306
|
+
* workspace name. This is deployment knowledge, so it comes from the
|
|
1307
|
+
* pack's own per-project config rather than from the library.
|
|
1308
|
+
*/
|
|
1309
|
+
graphqlClientBindings?: Record<string, string>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Which service the operations in a set of files talk to, for a
|
|
1312
|
+
* project whose one frontend uses two clients. A hook call does not
|
|
1313
|
+
* say which client it goes through, so when the sole-client rule
|
|
1314
|
+
* cannot decide, these globs do: an operation whose file matches
|
|
1315
|
+
* gets the entry's workspace. First matching entry wins.
|
|
1316
|
+
*/
|
|
1317
|
+
graphqlOperationScopes?: Array<{
|
|
1318
|
+
files: string[];
|
|
1319
|
+
workspace: string;
|
|
1320
|
+
}>;
|
|
1279
1321
|
/**
|
|
1280
1322
|
* Per-property-access recognizers, the counterpart to
|
|
1281
1323
|
* `invocationRecognizers`, firing on `PropertyAccessExpression`
|
|
@@ -1387,7 +1429,8 @@ interface DiscoveredCustomUnit {
|
|
|
1387
1429
|
*/
|
|
1388
1430
|
channelInfo?: {
|
|
1389
1431
|
messageBus: MessageBusSemantics["messageBus"];
|
|
1390
|
-
channel
|
|
1432
|
+
/** Null when the pack knows the wire but not the channel on it. */
|
|
1433
|
+
channel: string | null;
|
|
1391
1434
|
};
|
|
1392
1435
|
/** The thing that gets deployed and runs this unit, when known. */
|
|
1393
1436
|
deployableUnit?: DeployableUnit;
|
|
@@ -1471,6 +1514,13 @@ declare function httpRouteDiscovery(opts: {
|
|
|
1471
1514
|
*/
|
|
1472
1515
|
mount?: DiscoveryPattern["mount"];
|
|
1473
1516
|
}): DiscoveryPattern[];
|
|
1517
|
+
/**
|
|
1518
|
+
* The payload behind a `JSON.stringify(...)` call, or the argument
|
|
1519
|
+
* unchanged when it is anything else. A producer serializes its message
|
|
1520
|
+
* before sending it, and the shape worth comparing across the boundary
|
|
1521
|
+
* is what went in, not the string that came out.
|
|
1522
|
+
*/
|
|
1523
|
+
declare function unwrapJsonStringify(body: EffectArg | null): EffectArg | null;
|
|
1474
1524
|
|
|
1475
1525
|
/**
|
|
1476
1526
|
* The path engine, written against `StructuredStatement` rather than any one
|
|
@@ -1862,4 +1912,4 @@ declare function terminalToOutput(terminal: RawTerminal): Output;
|
|
|
1862
1912
|
declare function effectToIR(effect: RawEffect): Effect;
|
|
1863
1913
|
declare function paramToInput(param: RawParameter): Input;
|
|
1864
1914
|
|
|
1865
|
-
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 };
|
|
1915
|
+
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.5.
|
|
3
|
+
"version": "0.5.11",
|
|
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.5.
|
|
48
|
+
"@suss/behavioral-ir": "0.5.11"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"tsup": "*",
|