@suss/adapter-python 0.8.0 → 0.10.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/README.md +1 -1
- package/dist/index.cjs +296 -171
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +297 -172
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -15703,7 +15703,7 @@ function date4(params) {
|
|
|
15703
15703
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15704
15704
|
config(en_default());
|
|
15705
15705
|
|
|
15706
|
-
// ../../ir-core/dist/chunk-
|
|
15706
|
+
// ../../ir-core/dist/chunk-HBAMPBAO.js
|
|
15707
15707
|
function gqlIdentityKey(typeName, fieldName) {
|
|
15708
15708
|
return `gql:${typeName}.${fieldName}`;
|
|
15709
15709
|
}
|
|
@@ -15713,6 +15713,9 @@ function fnIdentityKey(packageName, exportPath) {
|
|
|
15713
15713
|
function busIdentityKey(messageBus, subject) {
|
|
15714
15714
|
return `bus:${messageBus} ${subject}`;
|
|
15715
15715
|
}
|
|
15716
|
+
function metricIdentityKey(metricSystem, metricType) {
|
|
15717
|
+
return `metric:${metricSystem} ${metricType}`;
|
|
15718
|
+
}
|
|
15716
15719
|
function defineBoundarySemantics(definition) {
|
|
15717
15720
|
return definition;
|
|
15718
15721
|
}
|
|
@@ -15750,6 +15753,9 @@ var FunctionCallSemanticsSchema = external_exports.object({
|
|
|
15750
15753
|
var functionCallSemantics = defineBoundarySemantics({
|
|
15751
15754
|
name: "function-call",
|
|
15752
15755
|
schema: FunctionCallSemanticsSchema,
|
|
15756
|
+
// A call that never leaves the process does not produce a span, and
|
|
15757
|
+
// the conventions do not name one. All of it is ours.
|
|
15758
|
+
semconv: {},
|
|
15753
15759
|
behavior: {
|
|
15754
15760
|
/** A call returns a value, which is not a status and a body. */
|
|
15755
15761
|
exchangesHttpResponses: false,
|
|
@@ -15782,6 +15788,10 @@ var GraphqlOperationSemanticsSchema = external_exports.object({
|
|
|
15782
15788
|
var graphqlOperationSemantics = defineBoundarySemantics({
|
|
15783
15789
|
name: "graphql-operation",
|
|
15784
15790
|
schema: GraphqlOperationSemanticsSchema,
|
|
15791
|
+
semconv: {
|
|
15792
|
+
operationName: { name: "graphql.operation.name" },
|
|
15793
|
+
operationType: { name: "graphql.operation.type" }
|
|
15794
|
+
},
|
|
15785
15795
|
behavior: {
|
|
15786
15796
|
/**
|
|
15787
15797
|
* An operation gets a data-and-errors document back, which the
|
|
@@ -15812,6 +15822,9 @@ var GraphqlResolverSemanticsSchema = external_exports.object({
|
|
|
15812
15822
|
var graphqlResolverSemantics = defineBoundarySemantics({
|
|
15813
15823
|
name: "graphql-resolver",
|
|
15814
15824
|
schema: GraphqlResolverSemanticsSchema,
|
|
15825
|
+
// The conventions name the operation a client sent, not the
|
|
15826
|
+
// resolver the server ran for one field of it.
|
|
15827
|
+
semconv: {},
|
|
15815
15828
|
behavior: {
|
|
15816
15829
|
/** A resolver returns a field value, not a status and a body. */
|
|
15817
15830
|
exchangesHttpResponses: false,
|
|
@@ -15847,8 +15860,11 @@ function channelsPair(a, b) {
|
|
|
15847
15860
|
var MessageBusSemanticsSchema = external_exports.object({
|
|
15848
15861
|
name: external_exports.literal("message-bus"),
|
|
15849
15862
|
messageBus: external_exports.enum([
|
|
15850
|
-
|
|
15851
|
-
|
|
15863
|
+
// The conventions spell the two AWS buses this way, one with an
|
|
15864
|
+
// underscore and one with a dot, so these are their strings and
|
|
15865
|
+
// not a typo.
|
|
15866
|
+
"aws_sqs",
|
|
15867
|
+
"aws.sns",
|
|
15852
15868
|
"s3",
|
|
15853
15869
|
"eventbridge",
|
|
15854
15870
|
"bullmq",
|
|
@@ -15869,6 +15885,10 @@ var MessageBusSemanticsSchema = external_exports.object({
|
|
|
15869
15885
|
var messageBusSemantics = defineBoundarySemantics({
|
|
15870
15886
|
name: "message-bus",
|
|
15871
15887
|
schema: MessageBusSemanticsSchema,
|
|
15888
|
+
semconv: {
|
|
15889
|
+
messageBus: { name: "messaging.system" },
|
|
15890
|
+
channel: { name: "messaging.destination.name" }
|
|
15891
|
+
},
|
|
15872
15892
|
behavior: {
|
|
15873
15893
|
/** A message goes onto the channel and nothing comes back. */
|
|
15874
15894
|
exchangesHttpResponses: false,
|
|
@@ -15926,6 +15946,36 @@ var messageBusSemantics = defineBoundarySemantics({
|
|
|
15926
15946
|
}
|
|
15927
15947
|
}
|
|
15928
15948
|
});
|
|
15949
|
+
var MetricSemanticsSchema = external_exports.object({
|
|
15950
|
+
name: external_exports.literal("metric"),
|
|
15951
|
+
/** Which system the series lives in: cloud-monitoring, cloudwatch. */
|
|
15952
|
+
metricSystem: external_exports.string(),
|
|
15953
|
+
/**
|
|
15954
|
+
* The type string the system knows the metric by, spelled the way
|
|
15955
|
+
* both sides spell it. Null when the source states one this reader
|
|
15956
|
+
* could not settle, as with a query it could not read: a metric
|
|
15957
|
+
* nobody could name pairs with nothing rather than with whatever
|
|
15958
|
+
* happens to share its source text.
|
|
15959
|
+
*/
|
|
15960
|
+
metricType: external_exports.string().nullable()
|
|
15961
|
+
});
|
|
15962
|
+
var metricSemantics = defineBoundarySemantics({
|
|
15963
|
+
name: "metric",
|
|
15964
|
+
schema: MetricSemanticsSchema,
|
|
15965
|
+
// OpenTelemetry knows a metric by its instrument name, and has no
|
|
15966
|
+
// attribute for the system it lives in or the type string it goes by.
|
|
15967
|
+
semconv: {},
|
|
15968
|
+
behavior: {
|
|
15969
|
+
exchangesHttpResponses: false,
|
|
15970
|
+
reportsUnpairedItself: false,
|
|
15971
|
+
identityKey(semantics) {
|
|
15972
|
+
if (semantics.metricType === null) {
|
|
15973
|
+
return null;
|
|
15974
|
+
}
|
|
15975
|
+
return metricIdentityKey(semantics.metricSystem, semantics.metricType);
|
|
15976
|
+
}
|
|
15977
|
+
}
|
|
15978
|
+
});
|
|
15929
15979
|
var RestSemanticsSchema = external_exports.object({
|
|
15930
15980
|
name: external_exports.literal("rest"),
|
|
15931
15981
|
/**
|
|
@@ -15981,6 +16031,14 @@ function routePathAdmits(declaredPath, requestPath) {
|
|
|
15981
16031
|
var restSemantics = defineBoundarySemantics({
|
|
15982
16032
|
name: "rest",
|
|
15983
16033
|
schema: RestSemanticsSchema,
|
|
16034
|
+
semconv: {
|
|
16035
|
+
// A span states the one method a request used, so a route that
|
|
16036
|
+
// responds to every method has nothing to compare.
|
|
16037
|
+
method: { name: "http.request.method", placeholderValues: ["*"] },
|
|
16038
|
+
path: { name: "http.route" }
|
|
16039
|
+
// declaredResponses is a list, and http.response.status_code is
|
|
16040
|
+
// the one status a request got back.
|
|
16041
|
+
},
|
|
15984
16042
|
behavior: {
|
|
15985
16043
|
/** A request goes out, a status and a body come back. */
|
|
15986
16044
|
exchangesHttpResponses: true,
|
|
@@ -16069,6 +16127,10 @@ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
|
|
|
16069
16127
|
var runtimeConfigSemantics = defineBoundarySemantics({
|
|
16070
16128
|
name: "runtime-config",
|
|
16071
16129
|
schema: RuntimeConfigSemanticsSchema,
|
|
16130
|
+
// service.name and cloud.resource_id name the same deployable, but
|
|
16131
|
+
// instanceName is the deployment template's logical id, which is
|
|
16132
|
+
// neither of those strings.
|
|
16133
|
+
semconv: {},
|
|
16072
16134
|
behavior: {
|
|
16073
16135
|
/** A process reads its config at startup, and nothing replies. */
|
|
16074
16136
|
exchangesHttpResponses: false,
|
|
@@ -16079,9 +16141,9 @@ var runtimeConfigSemantics = defineBoundarySemantics({
|
|
|
16079
16141
|
var StorageSemanticsSchema = external_exports.object({
|
|
16080
16142
|
name: external_exports.literal("storage"),
|
|
16081
16143
|
/**
|
|
16082
|
-
* Which store this is:
|
|
16083
|
-
*
|
|
16084
|
-
*
|
|
16144
|
+
* Which store this is: postgresql, mysql, aws.dynamodb, or our own
|
|
16145
|
+
* word for one OpenTelemetry never named, such as s3. Two products'
|
|
16146
|
+
* containers can share a name, so this keeps them apart.
|
|
16085
16147
|
*/
|
|
16086
16148
|
storageSystem: external_exports.string(),
|
|
16087
16149
|
/**
|
|
@@ -16094,7 +16156,9 @@ var StorageSemanticsSchema = external_exports.object({
|
|
|
16094
16156
|
* The table, bucket, collection, or index, as the source declares
|
|
16095
16157
|
* it, or null when the source states one this reader could not
|
|
16096
16158
|
* settle. A null container pairs with nothing, rather than with
|
|
16097
|
-
* whatever its source text happens to spell.
|
|
16159
|
+
* whatever its source text happens to spell. The string is in the
|
|
16160
|
+
* boundary-name syntax: a literal, a pattern with `{}` holes, or a
|
|
16161
|
+
* reference, and `parseBoundaryName` is the one reader of it.
|
|
16098
16162
|
*/
|
|
16099
16163
|
container: external_exports.string().nullable(),
|
|
16100
16164
|
/**
|
|
@@ -16109,6 +16173,14 @@ var StorageSemanticsSchema = external_exports.object({
|
|
|
16109
16173
|
var storageSemantics = defineBoundarySemantics({
|
|
16110
16174
|
name: "storage",
|
|
16111
16175
|
schema: StorageSemanticsSchema,
|
|
16176
|
+
semconv: {
|
|
16177
|
+
storageSystem: { name: "db.system.name" },
|
|
16178
|
+
// "default" is our word for a source that named no database.
|
|
16179
|
+
scope: { name: "db.namespace", placeholderValues: ["default"] },
|
|
16180
|
+
container: { name: "db.collection.name" }
|
|
16181
|
+
// A secondary index has no attribute of its own, so accessPath
|
|
16182
|
+
// stays our word.
|
|
16183
|
+
},
|
|
16112
16184
|
behavior: {
|
|
16113
16185
|
/** A query returns rows or items, not a status and a body. */
|
|
16114
16186
|
exchangesHttpResponses: false,
|
|
@@ -16123,7 +16195,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
|
|
|
16123
16195
|
graphqlOperationSemantics.schema,
|
|
16124
16196
|
runtimeConfigSemantics.schema,
|
|
16125
16197
|
storageSemantics.schema,
|
|
16126
|
-
messageBusSemantics.schema
|
|
16198
|
+
messageBusSemantics.schema,
|
|
16199
|
+
metricSemantics.schema
|
|
16127
16200
|
]);
|
|
16128
16201
|
var DEFINITIONS = [
|
|
16129
16202
|
restSemantics,
|
|
@@ -16132,7 +16205,8 @@ var DEFINITIONS = [
|
|
|
16132
16205
|
graphqlOperationSemantics,
|
|
16133
16206
|
runtimeConfigSemantics,
|
|
16134
16207
|
storageSemantics,
|
|
16135
|
-
messageBusSemantics
|
|
16208
|
+
messageBusSemantics,
|
|
16209
|
+
metricSemantics
|
|
16136
16210
|
];
|
|
16137
16211
|
var BY_NAME = new Map(
|
|
16138
16212
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -16366,36 +16440,203 @@ function statementIn(call) {
|
|
|
16366
16440
|
import { deriveOnDemand, evaluate } from "@suss/datalog";
|
|
16367
16441
|
|
|
16368
16442
|
// ../../resolution/dist/index.js
|
|
16369
|
-
import { lit, rule, variable as v } from "@suss/datalog";
|
|
16443
|
+
import { constant, lit, rule, variable as v } from "@suss/datalog";
|
|
16444
|
+
var VALUE_STEP = constant("value");
|
|
16445
|
+
var RESULT_STEP = constant("result");
|
|
16370
16446
|
var RESOLUTION_RULES = [
|
|
16371
|
-
//
|
|
16372
|
-
//
|
|
16447
|
+
// Aliasing: const x = y, or an identifier referencing a declaration.
|
|
16448
|
+
// A language with a hop of its own, like JavaScript's `.bind`, states
|
|
16449
|
+
// it as a step too, or every question but `comesTo` misses it.
|
|
16450
|
+
rule("stepsTo", [v("x"), v("y"), VALUE_STEP], [lit("binds", v("x"), v("y"))]),
|
|
16451
|
+
// A name written more than once has the value the last write left
|
|
16452
|
+
// there. The adapter works out which write that is and stays quiet
|
|
16453
|
+
// when control flow decides, so such a name steps nowhere at all.
|
|
16454
|
+
rule(
|
|
16455
|
+
"stepsTo",
|
|
16456
|
+
[v("x"), v("y"), VALUE_STEP],
|
|
16457
|
+
[lit("endsHolding", v("x"), v("y"))]
|
|
16458
|
+
),
|
|
16459
|
+
// An import steps to what the module exports under that name.
|
|
16460
|
+
rule(
|
|
16461
|
+
"stepsTo",
|
|
16462
|
+
[v("x"), v("value"), VALUE_STEP],
|
|
16463
|
+
[
|
|
16464
|
+
lit("imports", v("x"), v("m"), v("n")),
|
|
16465
|
+
lit("moduleExport", v("m"), v("n"), v("value"))
|
|
16466
|
+
]
|
|
16467
|
+
),
|
|
16468
|
+
// A parameter steps to what a call passes it. A function called from
|
|
16469
|
+
// several places leaves its parameter with more than one value, and a
|
|
16470
|
+
// caller that needs those apart asks `paramAt`.
|
|
16471
|
+
rule(
|
|
16472
|
+
"stepsTo",
|
|
16473
|
+
[v("p"), v("a"), VALUE_STEP],
|
|
16474
|
+
[lit("passesArgument", v("r"), v("p"), v("a"))]
|
|
16475
|
+
),
|
|
16476
|
+
// Reading a property steps to what the object contains under that
|
|
16477
|
+
// name, whichever way the object arrived: `routes.list` off a name,
|
|
16478
|
+
// or `make(body).handle` off a call.
|
|
16479
|
+
rule(
|
|
16480
|
+
"stepsTo",
|
|
16481
|
+
[v("x"), v("held"), VALUE_STEP],
|
|
16482
|
+
[
|
|
16483
|
+
lit("readsProperty", v("x"), v("o"), v("n")),
|
|
16484
|
+
lit("objectOf", v("o"), v("obj")),
|
|
16485
|
+
lit("contains", v("obj"), v("n"), v("held"))
|
|
16486
|
+
]
|
|
16487
|
+
),
|
|
16488
|
+
// Calling a class makes one of it, so the call steps to the class and
|
|
16489
|
+
// a method read off the result is the one the class declares. The
|
|
16490
|
+
// caveat below is about a factory function, and a class is not one.
|
|
16491
|
+
rule(
|
|
16492
|
+
"stepsTo",
|
|
16493
|
+
[v("r"), v("cls"), VALUE_STEP],
|
|
16494
|
+
[
|
|
16495
|
+
lit("call", v("r"), v("c")),
|
|
16496
|
+
lit("comesTo", v("c"), v("cls")),
|
|
16497
|
+
lit("objectValue", v("cls"))
|
|
16498
|
+
]
|
|
16499
|
+
),
|
|
16500
|
+
// Wrapper transparency, derived: calling a factory that returns a
|
|
16501
|
+
// function which calls its parameter k steps to argument k.
|
|
16502
|
+
rule(
|
|
16503
|
+
"stepsTo",
|
|
16504
|
+
[v("r"), v("a"), VALUE_STEP],
|
|
16505
|
+
[
|
|
16506
|
+
lit("call", v("r"), v("c")),
|
|
16507
|
+
lit("comesTo", v("c"), v("f")),
|
|
16508
|
+
lit("unwraps", v("f"), v("k")),
|
|
16509
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16510
|
+
]
|
|
16511
|
+
),
|
|
16512
|
+
// Wrapper transparency, declared: a pack says this callee wraps
|
|
16513
|
+
// argument k. The callee has to come from the library the pack said,
|
|
16514
|
+
// so a local object spelled the same way is not mistaken for it.
|
|
16515
|
+
rule(
|
|
16516
|
+
"stepsTo",
|
|
16517
|
+
[v("r"), v("a"), VALUE_STEP],
|
|
16518
|
+
[
|
|
16519
|
+
lit("calleeName", v("r"), v("n")),
|
|
16520
|
+
lit("unwrapsByName", v("n"), v("k")),
|
|
16521
|
+
lit("wrapperModule", v("n"), v("m")),
|
|
16522
|
+
lit("calleeOrigin", v("r"), v("m")),
|
|
16523
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16524
|
+
]
|
|
16525
|
+
),
|
|
16526
|
+
// The one step that runs a function forwards: a call steps to what
|
|
16527
|
+
// the function it invokes returns.
|
|
16528
|
+
rule(
|
|
16529
|
+
"stepsTo",
|
|
16530
|
+
[v("r"), v("ret"), RESULT_STEP],
|
|
16531
|
+
[lit("invokes", v("r"), v("f")), lit("returnsValue", v("f"), v("ret"))]
|
|
16532
|
+
),
|
|
16533
|
+
// Where a walk gets to, and whether it ran a call on the way. A value
|
|
16534
|
+
// step keeps whatever the rest of the walk was, and a result step
|
|
16535
|
+
// makes the whole walk one that ran a call.
|
|
16536
|
+
rule(
|
|
16537
|
+
"reaches",
|
|
16538
|
+
[v("x"), v("z"), v("kind")],
|
|
16539
|
+
[lit("stepsTo", v("x"), v("z"), v("kind"))]
|
|
16540
|
+
),
|
|
16541
|
+
rule(
|
|
16542
|
+
"reaches",
|
|
16543
|
+
[v("x"), v("z"), v("kind")],
|
|
16544
|
+
[
|
|
16545
|
+
lit("stepsTo", v("x"), v("y"), VALUE_STEP),
|
|
16546
|
+
lit("reaches", v("y"), v("z"), v("kind"))
|
|
16547
|
+
]
|
|
16548
|
+
),
|
|
16549
|
+
// Two rules rather than one leaving the rest of the walk's kind free.
|
|
16550
|
+
// A free kind is a second question about the same relation, and a
|
|
16551
|
+
// demand-driven run then derives both to answer either.
|
|
16552
|
+
rule(
|
|
16553
|
+
"reaches",
|
|
16554
|
+
[v("x"), v("z"), RESULT_STEP],
|
|
16555
|
+
[
|
|
16556
|
+
lit("stepsTo", v("x"), v("y"), RESULT_STEP),
|
|
16557
|
+
lit("reaches", v("y"), v("z"), VALUE_STEP)
|
|
16558
|
+
]
|
|
16559
|
+
),
|
|
16560
|
+
rule(
|
|
16561
|
+
"reaches",
|
|
16562
|
+
[v("x"), v("z"), RESULT_STEP],
|
|
16563
|
+
[
|
|
16564
|
+
lit("stepsTo", v("x"), v("y"), RESULT_STEP),
|
|
16565
|
+
lit("reaches", v("y"), v("z"), RESULT_STEP)
|
|
16566
|
+
]
|
|
16567
|
+
),
|
|
16568
|
+
// What a value comes down to: the walk that never ran a call, stopped
|
|
16569
|
+
// at a function or an object. Something already written out comes to
|
|
16570
|
+
// itself, and every other walk ends at one of those.
|
|
16373
16571
|
rule("comesTo", [v("x"), v("x")], [lit("func", v("x"))]),
|
|
16374
16572
|
rule("comesTo", [v("x"), v("x")], [lit("objectValue", v("x"))]),
|
|
16375
|
-
// Aliasing: const x = y, or an identifier referencing a declaration.
|
|
16376
16573
|
rule(
|
|
16377
16574
|
"comesTo",
|
|
16378
16575
|
[v("x"), v("z")],
|
|
16379
|
-
[lit("
|
|
16576
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("func", v("z"))]
|
|
16380
16577
|
),
|
|
16381
|
-
// A name written more than once has the value the last write left
|
|
16382
|
-
// there, and `binds` says nothing about it. The adapter works out
|
|
16383
|
-
// which write that is, in its own language's terms, and stays quiet
|
|
16384
|
-
// when control flow decides. A name it stays quiet about comes to no
|
|
16385
|
-
// value, which is the answer.
|
|
16386
16578
|
rule(
|
|
16387
16579
|
"comesTo",
|
|
16388
16580
|
[v("x"), v("z")],
|
|
16389
|
-
[lit("
|
|
16581
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("objectValue", v("z"))]
|
|
16390
16582
|
),
|
|
16391
|
-
//
|
|
16583
|
+
// The same stopping condition, for the walk that ran a call. A call
|
|
16584
|
+
// gets no `comesTo` answer on purpose: coming back with what a
|
|
16585
|
+
// factory returned would fight the unwrapping answer.
|
|
16392
16586
|
rule(
|
|
16393
|
-
"
|
|
16587
|
+
"givesBack",
|
|
16588
|
+
[v("x"), v("z")],
|
|
16589
|
+
[lit("reaches", v("x"), v("z"), RESULT_STEP), lit("func", v("z"))]
|
|
16590
|
+
),
|
|
16591
|
+
rule(
|
|
16592
|
+
"givesBack",
|
|
16394
16593
|
[v("x"), v("z")],
|
|
16594
|
+
[lit("reaches", v("x"), v("z"), RESULT_STEP), lit("objectValue", v("z"))]
|
|
16595
|
+
),
|
|
16596
|
+
// Following a value to the expression it is written as, whatever kind
|
|
16597
|
+
// that is. A GraphQL document is neither a function nor an object, so
|
|
16598
|
+
// `comesTo` never reaches one.
|
|
16599
|
+
rule("isWrittenAs", [v("x"), v("x")], [lit("writtenValue", v("x"))]),
|
|
16600
|
+
rule("isWrittenAs", [v("x"), v("x")], [lit("objectValue", v("x"))]),
|
|
16601
|
+
rule(
|
|
16602
|
+
"isWrittenAs",
|
|
16603
|
+
[v("x"), v("z")],
|
|
16604
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("writtenValue", v("z"))]
|
|
16605
|
+
),
|
|
16606
|
+
rule(
|
|
16607
|
+
"isWrittenAs",
|
|
16608
|
+
[v("x"), v("z")],
|
|
16609
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("objectValue", v("z"))]
|
|
16610
|
+
),
|
|
16611
|
+
// What one call site put in a parameter, told apart from what the
|
|
16612
|
+
// other callers passed.
|
|
16613
|
+
rule(
|
|
16614
|
+
"paramAt",
|
|
16615
|
+
[v("r"), v("p"), v("z")],
|
|
16395
16616
|
[
|
|
16396
|
-
lit("
|
|
16397
|
-
lit("
|
|
16398
|
-
|
|
16617
|
+
lit("passesArgument", v("r"), v("p"), v("a")),
|
|
16618
|
+
lit("comesTo", v("a"), v("z"))
|
|
16619
|
+
]
|
|
16620
|
+
),
|
|
16621
|
+
// An argument arriving at the parameter it is passed to, by position
|
|
16622
|
+
// or by the name the caller wrote, keeping the call it went through
|
|
16623
|
+
// so `paramAt` can tell two call sites apart.
|
|
16624
|
+
rule(
|
|
16625
|
+
"passesArgument",
|
|
16626
|
+
[v("r"), v("p"), v("a")],
|
|
16627
|
+
[
|
|
16628
|
+
lit("paramOf", v("f"), v("k"), v("p")),
|
|
16629
|
+
lit("callsFunction", v("r"), v("f")),
|
|
16630
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16631
|
+
]
|
|
16632
|
+
),
|
|
16633
|
+
rule(
|
|
16634
|
+
"passesArgument",
|
|
16635
|
+
[v("r"), v("p"), v("a")],
|
|
16636
|
+
[
|
|
16637
|
+
lit("paramNamed", v("f"), v("n"), v("p")),
|
|
16638
|
+
lit("callsFunction", v("r"), v("f")),
|
|
16639
|
+
lit("callKeywordArg", v("r"), v("n"), v("a"))
|
|
16399
16640
|
]
|
|
16400
16641
|
),
|
|
16401
16642
|
// What a module exports: directly, or through re-export chains.
|
|
@@ -16420,12 +16661,22 @@ var RESOLUTION_RULES = [
|
|
|
16420
16661
|
lit("moduleExport", v("m2"), v("n"), v("value"))
|
|
16421
16662
|
]
|
|
16422
16663
|
),
|
|
16423
|
-
// The
|
|
16424
|
-
//
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16664
|
+
// The function a call runs, written from the call's side because a
|
|
16665
|
+
// caller asking what a call gives back has the call in hand.
|
|
16666
|
+
rule(
|
|
16667
|
+
"invokes",
|
|
16668
|
+
[v("r"), v("f")],
|
|
16669
|
+
[lit("call", v("r"), v("c")), lit("comesTo", v("c"), v("f"))]
|
|
16670
|
+
),
|
|
16671
|
+
// The callee is itself a call: `daoBuilder()()`.
|
|
16672
|
+
rule(
|
|
16673
|
+
"invokes",
|
|
16674
|
+
[v("r"), v("f")],
|
|
16675
|
+
[lit("call", v("r"), v("c")), lit("givesBack", v("c"), v("f"))]
|
|
16676
|
+
),
|
|
16677
|
+
// The object an expression refers to: a name through `comesTo`, a
|
|
16678
|
+
// factory call through what it gives back. Naming the step is what
|
|
16679
|
+
// makes `routes.list` and `make(body).handle` one rule.
|
|
16429
16680
|
rule(
|
|
16430
16681
|
"objectOf",
|
|
16431
16682
|
[v("o"), v("obj")],
|
|
@@ -16433,14 +16684,8 @@ var RESOLUTION_RULES = [
|
|
|
16433
16684
|
),
|
|
16434
16685
|
rule(
|
|
16435
16686
|
"objectOf",
|
|
16436
|
-
[v("
|
|
16437
|
-
[
|
|
16438
|
-
lit("call", v("r"), v("c")),
|
|
16439
|
-
lit("comesTo", v("c"), v("f")),
|
|
16440
|
-
lit("returnsValue", v("f"), v("ret")),
|
|
16441
|
-
lit("comesTo", v("ret"), v("obj")),
|
|
16442
|
-
lit("objectValue", v("obj"))
|
|
16443
|
-
]
|
|
16687
|
+
[v("x"), v("obj")],
|
|
16688
|
+
[lit("givesBack", v("x"), v("obj")), lit("objectValue", v("obj"))]
|
|
16444
16689
|
),
|
|
16445
16690
|
// Which calls a function, found by the name the call is written as
|
|
16446
16691
|
// rather than by resolving every callee in the project. A caller knows
|
|
@@ -16473,42 +16718,6 @@ var RESOLUTION_RULES = [
|
|
|
16473
16718
|
lit("call", v("r"), v("c"))
|
|
16474
16719
|
]
|
|
16475
16720
|
),
|
|
16476
|
-
// A function whose return is itself a call arrives at the same object
|
|
16477
|
-
// that call does, so a chain passing through two factories settles.
|
|
16478
|
-
rule(
|
|
16479
|
-
"objectOf",
|
|
16480
|
-
[v("r"), v("obj")],
|
|
16481
|
-
[
|
|
16482
|
-
lit("call", v("r"), v("c")),
|
|
16483
|
-
lit("comesTo", v("c"), v("f")),
|
|
16484
|
-
lit("returnsValue", v("f"), v("ret")),
|
|
16485
|
-
lit("objectOf", v("ret"), v("obj"))
|
|
16486
|
-
]
|
|
16487
|
-
),
|
|
16488
|
-
// An argument reaches the parameter it is passed to, by position or
|
|
16489
|
-
// by the name the caller wrote. A function called from several places
|
|
16490
|
-
// leaves its parameter with more than one value, and the caller
|
|
16491
|
-
// decides what to do about that.
|
|
16492
|
-
rule(
|
|
16493
|
-
"comesTo",
|
|
16494
|
-
[v("p"), v("z")],
|
|
16495
|
-
[
|
|
16496
|
-
lit("paramOf", v("f"), v("k"), v("p")),
|
|
16497
|
-
lit("callsFunction", v("r"), v("f")),
|
|
16498
|
-
lit("callArg", v("r"), v("k"), v("a")),
|
|
16499
|
-
lit("comesTo", v("a"), v("z"))
|
|
16500
|
-
]
|
|
16501
|
-
),
|
|
16502
|
-
rule(
|
|
16503
|
-
"comesTo",
|
|
16504
|
-
[v("p"), v("z")],
|
|
16505
|
-
[
|
|
16506
|
-
lit("paramNamed", v("f"), v("n"), v("p")),
|
|
16507
|
-
lit("callsFunction", v("r"), v("f")),
|
|
16508
|
-
lit("callKeywordArg", v("r"), v("n"), v("a")),
|
|
16509
|
-
lit("comesTo", v("a"), v("z"))
|
|
16510
|
-
]
|
|
16511
|
-
),
|
|
16512
16721
|
// What an object contains, its base class included, so a method the base
|
|
16513
16722
|
// declares is found on a subclass that never overrode it. A method both
|
|
16514
16723
|
// declare gives two, and the caller decides. This is its own relation
|
|
@@ -16528,33 +16737,8 @@ var RESOLUTION_RULES = [
|
|
|
16528
16737
|
lit("contains", v("baseCls"), v("n"), v("held"))
|
|
16529
16738
|
]
|
|
16530
16739
|
),
|
|
16531
|
-
//
|
|
16532
|
-
//
|
|
16533
|
-
// about a factory function, and a class is not one.
|
|
16534
|
-
rule(
|
|
16535
|
-
"comesTo",
|
|
16536
|
-
[v("r"), v("cls")],
|
|
16537
|
-
[
|
|
16538
|
-
lit("call", v("r"), v("c")),
|
|
16539
|
-
lit("comesTo", v("c"), v("cls")),
|
|
16540
|
-
lit("objectValue", v("cls"))
|
|
16541
|
-
]
|
|
16542
|
-
),
|
|
16543
|
-
// Reading a property comes to what the object holds under that name,
|
|
16544
|
-
// whichever way the object arrived: `routes.list` off a name, or
|
|
16545
|
-
// `make(body).handle` off a call.
|
|
16546
|
-
rule(
|
|
16547
|
-
"comesTo",
|
|
16548
|
-
[v("x"), v("z")],
|
|
16549
|
-
[
|
|
16550
|
-
lit("readsProperty", v("x"), v("o"), v("n")),
|
|
16551
|
-
lit("objectOf", v("o"), v("obj")),
|
|
16552
|
-
lit("contains", v("obj"), v("n"), v("held")),
|
|
16553
|
-
lit("comesTo", v("held"), v("z"))
|
|
16554
|
-
]
|
|
16555
|
-
),
|
|
16556
|
-
// Wrapper transparency, derived: calling a factory that returns a
|
|
16557
|
-
// function which calls its parameter k comes to argument k.
|
|
16740
|
+
// Which function a factory returns, and which of its parameters that
|
|
16741
|
+
// function calls: together they are what makes it a wrapper.
|
|
16558
16742
|
rule(
|
|
16559
16743
|
"returnsFunc",
|
|
16560
16744
|
[v("f"), v("g")],
|
|
@@ -16615,56 +16799,20 @@ var RESOLUTION_RULES = [
|
|
|
16615
16799
|
lit("paramOf", v("f"), v("k"), v("p"))
|
|
16616
16800
|
]
|
|
16617
16801
|
),
|
|
16618
|
-
rule(
|
|
16619
|
-
"comesTo",
|
|
16620
|
-
[v("r"), v("h")],
|
|
16621
|
-
[
|
|
16622
|
-
lit("call", v("r"), v("c")),
|
|
16623
|
-
lit("comesTo", v("c"), v("f")),
|
|
16624
|
-
lit("unwraps", v("f"), v("k")),
|
|
16625
|
-
lit("callArg", v("r"), v("k"), v("a")),
|
|
16626
|
-
lit("comesTo", v("a"), v("h"))
|
|
16627
|
-
]
|
|
16628
|
-
),
|
|
16629
|
-
// Wrapper transparency, declared: a pack says this callee wraps
|
|
16630
|
-
// argument k, whatever its implementation looks like. The callee has
|
|
16631
|
-
// to have been imported from the library the pack named, so a local
|
|
16632
|
-
// object spelled the same way is not mistaken for it.
|
|
16633
|
-
rule(
|
|
16634
|
-
"comesTo",
|
|
16635
|
-
[v("r"), v("h")],
|
|
16636
|
-
[
|
|
16637
|
-
lit("calleeName", v("r"), v("n")),
|
|
16638
|
-
lit("unwrapsByName", v("n"), v("k")),
|
|
16639
|
-
lit("wrapperModule", v("n"), v("m")),
|
|
16640
|
-
lit("calleeOrigin", v("r"), v("m")),
|
|
16641
|
-
lit("callArg", v("r"), v("k"), v("a")),
|
|
16642
|
-
lit("comesTo", v("a"), v("h"))
|
|
16643
|
-
]
|
|
16644
|
-
),
|
|
16645
16802
|
// Where a name comes from, when what it refers to lives outside the
|
|
16646
|
-
// source being read.
|
|
16647
|
-
// never reaches a library's own function
|
|
16648
|
-
// library name has no answer at all. This follows the same aliases
|
|
16649
|
-
// and barrels in the other direction and answers with the module and
|
|
16650
|
-
// the name that module exports.
|
|
16803
|
+
// source being read. A walk ends at something written out in source,
|
|
16804
|
+
// so it never reaches a library's own function.
|
|
16651
16805
|
rule(
|
|
16652
16806
|
"comesFrom",
|
|
16653
16807
|
[v("x"), v("m"), v("n")],
|
|
16654
16808
|
[lit("imports", v("x"), v("m"), v("n"))]
|
|
16655
16809
|
),
|
|
16656
|
-
rule(
|
|
16657
|
-
"comesFrom",
|
|
16658
|
-
[v("x"), v("m"), v("n")],
|
|
16659
|
-
[lit("binds", v("x"), v("y")), lit("comesFrom", v("y"), v("m"), v("n"))]
|
|
16660
|
-
),
|
|
16661
16810
|
rule(
|
|
16662
16811
|
"comesFrom",
|
|
16663
16812
|
[v("x"), v("m"), v("n")],
|
|
16664
16813
|
[
|
|
16665
|
-
lit("
|
|
16666
|
-
lit("
|
|
16667
|
-
lit("comesFrom", v("value"), v("m"), v("n"))
|
|
16814
|
+
lit("reaches", v("x"), v("y"), VALUE_STEP),
|
|
16815
|
+
lit("imports", v("y"), v("m"), v("n"))
|
|
16668
16816
|
]
|
|
16669
16817
|
),
|
|
16670
16818
|
// Calling f ends up calling the name n that module m exports. One hop
|
|
@@ -16700,36 +16848,6 @@ var RESOLUTION_RULES = [
|
|
|
16700
16848
|
"resolves",
|
|
16701
16849
|
[v("x"), v("z")],
|
|
16702
16850
|
[lit("comesTo", v("x"), v("z")), lit("func", v("z"))]
|
|
16703
|
-
),
|
|
16704
|
-
// Following a name to the expression it is written as. A separate
|
|
16705
|
-
// relation rather than a widening of `comesTo`, so a caller asking
|
|
16706
|
-
// the older question never sees a new answer: a factory call already
|
|
16707
|
-
// has an unwrapping answer, and letting it also answer with itself
|
|
16708
|
-
// would make that pair ambiguous.
|
|
16709
|
-
//
|
|
16710
|
-
// The two seeds are the two ways an expression can be written out. An
|
|
16711
|
-
// object literal is one of them, and it is the shape a generated
|
|
16712
|
-
// GraphQL document takes.
|
|
16713
|
-
rule("isWrittenAs", [v("x"), v("x")], [lit("writtenValue", v("x"))]),
|
|
16714
|
-
rule("isWrittenAs", [v("x"), v("x")], [lit("objectValue", v("x"))]),
|
|
16715
|
-
rule(
|
|
16716
|
-
"isWrittenAs",
|
|
16717
|
-
[v("x"), v("z")],
|
|
16718
|
-
[lit("binds", v("x"), v("y")), lit("isWrittenAs", v("y"), v("z"))]
|
|
16719
|
-
),
|
|
16720
|
-
rule(
|
|
16721
|
-
"isWrittenAs",
|
|
16722
|
-
[v("x"), v("z")],
|
|
16723
|
-
[lit("endsHolding", v("x"), v("y")), lit("isWrittenAs", v("y"), v("z"))]
|
|
16724
|
-
),
|
|
16725
|
-
rule(
|
|
16726
|
-
"isWrittenAs",
|
|
16727
|
-
[v("x"), v("z")],
|
|
16728
|
-
[
|
|
16729
|
-
lit("imports", v("x"), v("m"), v("n")),
|
|
16730
|
-
lit("moduleExport", v("m"), v("n"), v("value")),
|
|
16731
|
-
lit("isWrittenAs", v("value"), v("z"))
|
|
16732
|
-
]
|
|
16733
16851
|
)
|
|
16734
16852
|
];
|
|
16735
16853
|
var RESOLUTION_QUESTIONS = [
|
|
@@ -16761,6 +16879,13 @@ var RESOLUTION_QUESTIONS = [
|
|
|
16761
16879
|
[v("x"), v("z")],
|
|
16762
16880
|
[lit("wanted", v("x")), lit("objectOf", v("x"), v("z"))]
|
|
16763
16881
|
),
|
|
16882
|
+
// Keyed by the parameter, since that is what a caller has in hand
|
|
16883
|
+
// when it wants the call sites told apart.
|
|
16884
|
+
rule(
|
|
16885
|
+
"wantedParamAt",
|
|
16886
|
+
[v("p"), v("r"), v("z")],
|
|
16887
|
+
[lit("wanted", v("p")), lit("paramAt", v("r"), v("p"), v("z"))]
|
|
16888
|
+
),
|
|
16764
16889
|
rule(
|
|
16765
16890
|
"wantedComesFrom",
|
|
16766
16891
|
[v("x"), v("m"), v("n")],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-python",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Python language adapter for suss — parses source with tree-sitter (WASM), resolves names with a lexical binder, and emits raw extractions for the suss pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"typecheck": "tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@suss/behavioral-ir": "0.
|
|
51
|
-
"@suss/datalog": "0.
|
|
52
|
-
"@suss/extractor": "0.
|
|
53
|
-
"@suss/sql": "0.
|
|
50
|
+
"@suss/behavioral-ir": "0.10.0",
|
|
51
|
+
"@suss/datalog": "0.10.0",
|
|
52
|
+
"@suss/extractor": "0.10.0",
|
|
53
|
+
"@suss/sql": "0.10.0",
|
|
54
54
|
"web-tree-sitter": "^0.26.11"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|