@suss/adapter-python 0.8.0 → 0.9.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 +293 -170
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +294 -171
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -212,7 +212,7 @@ interface StoragePattern {
|
|
|
212
212
|
*/
|
|
213
213
|
queryFunctions?: string[];
|
|
214
214
|
/** Which database the library is talking to, for the boundary binding. */
|
|
215
|
-
storageSystem: "
|
|
215
|
+
storageSystem: "postgresql" | "mysql" | "sqlite";
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* The function a library gives a project for handing the database a
|
|
@@ -226,7 +226,7 @@ interface RawSqlPattern {
|
|
|
226
226
|
/** The functions that take a statement written as SQL. */
|
|
227
227
|
functions: string[];
|
|
228
228
|
/** Which database the library is talking to, for the boundary binding. */
|
|
229
|
-
storageSystem: "
|
|
229
|
+
storageSystem: "postgresql" | "mysql" | "sqlite";
|
|
230
230
|
}
|
|
231
231
|
type PythonDiscoveryPattern = DecoratedClassRoute | DecoratedFunctionRoute;
|
|
232
232
|
/** Conventions both kinds of route share. Each one describes what the library does, never a project's choice. */
|
package/dist/index.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ interface StoragePattern {
|
|
|
212
212
|
*/
|
|
213
213
|
queryFunctions?: string[];
|
|
214
214
|
/** Which database the library is talking to, for the boundary binding. */
|
|
215
|
-
storageSystem: "
|
|
215
|
+
storageSystem: "postgresql" | "mysql" | "sqlite";
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* The function a library gives a project for handing the database a
|
|
@@ -226,7 +226,7 @@ interface RawSqlPattern {
|
|
|
226
226
|
/** The functions that take a statement written as SQL. */
|
|
227
227
|
functions: string[];
|
|
228
228
|
/** Which database the library is talking to, for the boundary binding. */
|
|
229
|
-
storageSystem: "
|
|
229
|
+
storageSystem: "postgresql" | "mysql" | "sqlite";
|
|
230
230
|
}
|
|
231
231
|
type PythonDiscoveryPattern = DecoratedClassRoute | DecoratedFunctionRoute;
|
|
232
232
|
/** Conventions both kinds of route share. Each one describes what the library does, never a project's choice. */
|
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-XUXN6DIX.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
|
/**
|
|
@@ -16109,6 +16171,14 @@ var StorageSemanticsSchema = external_exports.object({
|
|
|
16109
16171
|
var storageSemantics = defineBoundarySemantics({
|
|
16110
16172
|
name: "storage",
|
|
16111
16173
|
schema: StorageSemanticsSchema,
|
|
16174
|
+
semconv: {
|
|
16175
|
+
storageSystem: { name: "db.system.name" },
|
|
16176
|
+
// "default" is our word for a source that named no database.
|
|
16177
|
+
scope: { name: "db.namespace", placeholderValues: ["default"] },
|
|
16178
|
+
container: { name: "db.collection.name" }
|
|
16179
|
+
// A secondary index has no attribute of its own, so accessPath
|
|
16180
|
+
// stays our word.
|
|
16181
|
+
},
|
|
16112
16182
|
behavior: {
|
|
16113
16183
|
/** A query returns rows or items, not a status and a body. */
|
|
16114
16184
|
exchangesHttpResponses: false,
|
|
@@ -16123,7 +16193,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
|
|
|
16123
16193
|
graphqlOperationSemantics.schema,
|
|
16124
16194
|
runtimeConfigSemantics.schema,
|
|
16125
16195
|
storageSemantics.schema,
|
|
16126
|
-
messageBusSemantics.schema
|
|
16196
|
+
messageBusSemantics.schema,
|
|
16197
|
+
metricSemantics.schema
|
|
16127
16198
|
]);
|
|
16128
16199
|
var DEFINITIONS = [
|
|
16129
16200
|
restSemantics,
|
|
@@ -16132,7 +16203,8 @@ var DEFINITIONS = [
|
|
|
16132
16203
|
graphqlOperationSemantics,
|
|
16133
16204
|
runtimeConfigSemantics,
|
|
16134
16205
|
storageSemantics,
|
|
16135
|
-
messageBusSemantics
|
|
16206
|
+
messageBusSemantics,
|
|
16207
|
+
metricSemantics
|
|
16136
16208
|
];
|
|
16137
16209
|
var BY_NAME = new Map(
|
|
16138
16210
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -16366,36 +16438,203 @@ function statementIn(call) {
|
|
|
16366
16438
|
import { deriveOnDemand, evaluate } from "@suss/datalog";
|
|
16367
16439
|
|
|
16368
16440
|
// ../../resolution/dist/index.js
|
|
16369
|
-
import { lit, rule, variable as v } from "@suss/datalog";
|
|
16441
|
+
import { constant, lit, rule, variable as v } from "@suss/datalog";
|
|
16442
|
+
var VALUE_STEP = constant("value");
|
|
16443
|
+
var RESULT_STEP = constant("result");
|
|
16370
16444
|
var RESOLUTION_RULES = [
|
|
16371
|
-
//
|
|
16372
|
-
//
|
|
16445
|
+
// Aliasing: const x = y, or an identifier referencing a declaration.
|
|
16446
|
+
// A language with a hop of its own, like JavaScript's `.bind`, states
|
|
16447
|
+
// it as a step too, or every question but `comesTo` misses it.
|
|
16448
|
+
rule("stepsTo", [v("x"), v("y"), VALUE_STEP], [lit("binds", v("x"), v("y"))]),
|
|
16449
|
+
// A name written more than once has the value the last write left
|
|
16450
|
+
// there. The adapter works out which write that is and stays quiet
|
|
16451
|
+
// when control flow decides, so such a name steps nowhere at all.
|
|
16452
|
+
rule(
|
|
16453
|
+
"stepsTo",
|
|
16454
|
+
[v("x"), v("y"), VALUE_STEP],
|
|
16455
|
+
[lit("endsHolding", v("x"), v("y"))]
|
|
16456
|
+
),
|
|
16457
|
+
// An import steps to what the module exports under that name.
|
|
16458
|
+
rule(
|
|
16459
|
+
"stepsTo",
|
|
16460
|
+
[v("x"), v("value"), VALUE_STEP],
|
|
16461
|
+
[
|
|
16462
|
+
lit("imports", v("x"), v("m"), v("n")),
|
|
16463
|
+
lit("moduleExport", v("m"), v("n"), v("value"))
|
|
16464
|
+
]
|
|
16465
|
+
),
|
|
16466
|
+
// A parameter steps to what a call passes it. A function called from
|
|
16467
|
+
// several places leaves its parameter with more than one value, and a
|
|
16468
|
+
// caller that needs those apart asks `paramAt`.
|
|
16469
|
+
rule(
|
|
16470
|
+
"stepsTo",
|
|
16471
|
+
[v("p"), v("a"), VALUE_STEP],
|
|
16472
|
+
[lit("passesArgument", v("r"), v("p"), v("a"))]
|
|
16473
|
+
),
|
|
16474
|
+
// Reading a property steps to what the object contains under that
|
|
16475
|
+
// name, whichever way the object arrived: `routes.list` off a name,
|
|
16476
|
+
// or `make(body).handle` off a call.
|
|
16477
|
+
rule(
|
|
16478
|
+
"stepsTo",
|
|
16479
|
+
[v("x"), v("held"), VALUE_STEP],
|
|
16480
|
+
[
|
|
16481
|
+
lit("readsProperty", v("x"), v("o"), v("n")),
|
|
16482
|
+
lit("objectOf", v("o"), v("obj")),
|
|
16483
|
+
lit("contains", v("obj"), v("n"), v("held"))
|
|
16484
|
+
]
|
|
16485
|
+
),
|
|
16486
|
+
// Calling a class makes one of it, so the call steps to the class and
|
|
16487
|
+
// a method read off the result is the one the class declares. The
|
|
16488
|
+
// caveat below is about a factory function, and a class is not one.
|
|
16489
|
+
rule(
|
|
16490
|
+
"stepsTo",
|
|
16491
|
+
[v("r"), v("cls"), VALUE_STEP],
|
|
16492
|
+
[
|
|
16493
|
+
lit("call", v("r"), v("c")),
|
|
16494
|
+
lit("comesTo", v("c"), v("cls")),
|
|
16495
|
+
lit("objectValue", v("cls"))
|
|
16496
|
+
]
|
|
16497
|
+
),
|
|
16498
|
+
// Wrapper transparency, derived: calling a factory that returns a
|
|
16499
|
+
// function which calls its parameter k steps to argument k.
|
|
16500
|
+
rule(
|
|
16501
|
+
"stepsTo",
|
|
16502
|
+
[v("r"), v("a"), VALUE_STEP],
|
|
16503
|
+
[
|
|
16504
|
+
lit("call", v("r"), v("c")),
|
|
16505
|
+
lit("comesTo", v("c"), v("f")),
|
|
16506
|
+
lit("unwraps", v("f"), v("k")),
|
|
16507
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16508
|
+
]
|
|
16509
|
+
),
|
|
16510
|
+
// Wrapper transparency, declared: a pack says this callee wraps
|
|
16511
|
+
// argument k. The callee has to come from the library the pack said,
|
|
16512
|
+
// so a local object spelled the same way is not mistaken for it.
|
|
16513
|
+
rule(
|
|
16514
|
+
"stepsTo",
|
|
16515
|
+
[v("r"), v("a"), VALUE_STEP],
|
|
16516
|
+
[
|
|
16517
|
+
lit("calleeName", v("r"), v("n")),
|
|
16518
|
+
lit("unwrapsByName", v("n"), v("k")),
|
|
16519
|
+
lit("wrapperModule", v("n"), v("m")),
|
|
16520
|
+
lit("calleeOrigin", v("r"), v("m")),
|
|
16521
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16522
|
+
]
|
|
16523
|
+
),
|
|
16524
|
+
// The one step that runs a function forwards: a call steps to what
|
|
16525
|
+
// the function it invokes returns.
|
|
16526
|
+
rule(
|
|
16527
|
+
"stepsTo",
|
|
16528
|
+
[v("r"), v("ret"), RESULT_STEP],
|
|
16529
|
+
[lit("invokes", v("r"), v("f")), lit("returnsValue", v("f"), v("ret"))]
|
|
16530
|
+
),
|
|
16531
|
+
// Where a walk gets to, and whether it ran a call on the way. A value
|
|
16532
|
+
// step keeps whatever the rest of the walk was, and a result step
|
|
16533
|
+
// makes the whole walk one that ran a call.
|
|
16534
|
+
rule(
|
|
16535
|
+
"reaches",
|
|
16536
|
+
[v("x"), v("z"), v("kind")],
|
|
16537
|
+
[lit("stepsTo", v("x"), v("z"), v("kind"))]
|
|
16538
|
+
),
|
|
16539
|
+
rule(
|
|
16540
|
+
"reaches",
|
|
16541
|
+
[v("x"), v("z"), v("kind")],
|
|
16542
|
+
[
|
|
16543
|
+
lit("stepsTo", v("x"), v("y"), VALUE_STEP),
|
|
16544
|
+
lit("reaches", v("y"), v("z"), v("kind"))
|
|
16545
|
+
]
|
|
16546
|
+
),
|
|
16547
|
+
// Two rules rather than one leaving the rest of the walk's kind free.
|
|
16548
|
+
// A free kind is a second question about the same relation, and a
|
|
16549
|
+
// demand-driven run then derives both to answer either.
|
|
16550
|
+
rule(
|
|
16551
|
+
"reaches",
|
|
16552
|
+
[v("x"), v("z"), RESULT_STEP],
|
|
16553
|
+
[
|
|
16554
|
+
lit("stepsTo", v("x"), v("y"), RESULT_STEP),
|
|
16555
|
+
lit("reaches", v("y"), v("z"), VALUE_STEP)
|
|
16556
|
+
]
|
|
16557
|
+
),
|
|
16558
|
+
rule(
|
|
16559
|
+
"reaches",
|
|
16560
|
+
[v("x"), v("z"), RESULT_STEP],
|
|
16561
|
+
[
|
|
16562
|
+
lit("stepsTo", v("x"), v("y"), RESULT_STEP),
|
|
16563
|
+
lit("reaches", v("y"), v("z"), RESULT_STEP)
|
|
16564
|
+
]
|
|
16565
|
+
),
|
|
16566
|
+
// What a value comes down to: the walk that never ran a call, stopped
|
|
16567
|
+
// at a function or an object. Something already written out comes to
|
|
16568
|
+
// itself, and every other walk ends at one of those.
|
|
16373
16569
|
rule("comesTo", [v("x"), v("x")], [lit("func", v("x"))]),
|
|
16374
16570
|
rule("comesTo", [v("x"), v("x")], [lit("objectValue", v("x"))]),
|
|
16375
|
-
// Aliasing: const x = y, or an identifier referencing a declaration.
|
|
16376
16571
|
rule(
|
|
16377
16572
|
"comesTo",
|
|
16378
16573
|
[v("x"), v("z")],
|
|
16379
|
-
[lit("
|
|
16574
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("func", v("z"))]
|
|
16380
16575
|
),
|
|
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
16576
|
rule(
|
|
16387
16577
|
"comesTo",
|
|
16388
16578
|
[v("x"), v("z")],
|
|
16389
|
-
[lit("
|
|
16579
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("objectValue", v("z"))]
|
|
16390
16580
|
),
|
|
16391
|
-
//
|
|
16581
|
+
// The same stopping condition, for the walk that ran a call. A call
|
|
16582
|
+
// gets no `comesTo` answer on purpose: coming back with what a
|
|
16583
|
+
// factory returned would fight the unwrapping answer.
|
|
16392
16584
|
rule(
|
|
16393
|
-
"
|
|
16585
|
+
"givesBack",
|
|
16586
|
+
[v("x"), v("z")],
|
|
16587
|
+
[lit("reaches", v("x"), v("z"), RESULT_STEP), lit("func", v("z"))]
|
|
16588
|
+
),
|
|
16589
|
+
rule(
|
|
16590
|
+
"givesBack",
|
|
16394
16591
|
[v("x"), v("z")],
|
|
16592
|
+
[lit("reaches", v("x"), v("z"), RESULT_STEP), lit("objectValue", v("z"))]
|
|
16593
|
+
),
|
|
16594
|
+
// Following a value to the expression it is written as, whatever kind
|
|
16595
|
+
// that is. A GraphQL document is neither a function nor an object, so
|
|
16596
|
+
// `comesTo` never reaches one.
|
|
16597
|
+
rule("isWrittenAs", [v("x"), v("x")], [lit("writtenValue", v("x"))]),
|
|
16598
|
+
rule("isWrittenAs", [v("x"), v("x")], [lit("objectValue", v("x"))]),
|
|
16599
|
+
rule(
|
|
16600
|
+
"isWrittenAs",
|
|
16601
|
+
[v("x"), v("z")],
|
|
16602
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("writtenValue", v("z"))]
|
|
16603
|
+
),
|
|
16604
|
+
rule(
|
|
16605
|
+
"isWrittenAs",
|
|
16606
|
+
[v("x"), v("z")],
|
|
16607
|
+
[lit("reaches", v("x"), v("z"), VALUE_STEP), lit("objectValue", v("z"))]
|
|
16608
|
+
),
|
|
16609
|
+
// What one call site put in a parameter, told apart from what the
|
|
16610
|
+
// other callers passed.
|
|
16611
|
+
rule(
|
|
16612
|
+
"paramAt",
|
|
16613
|
+
[v("r"), v("p"), v("z")],
|
|
16395
16614
|
[
|
|
16396
|
-
lit("
|
|
16397
|
-
lit("
|
|
16398
|
-
|
|
16615
|
+
lit("passesArgument", v("r"), v("p"), v("a")),
|
|
16616
|
+
lit("comesTo", v("a"), v("z"))
|
|
16617
|
+
]
|
|
16618
|
+
),
|
|
16619
|
+
// An argument arriving at the parameter it is passed to, by position
|
|
16620
|
+
// or by the name the caller wrote, keeping the call it went through
|
|
16621
|
+
// so `paramAt` can tell two call sites apart.
|
|
16622
|
+
rule(
|
|
16623
|
+
"passesArgument",
|
|
16624
|
+
[v("r"), v("p"), v("a")],
|
|
16625
|
+
[
|
|
16626
|
+
lit("paramOf", v("f"), v("k"), v("p")),
|
|
16627
|
+
lit("callsFunction", v("r"), v("f")),
|
|
16628
|
+
lit("callArg", v("r"), v("k"), v("a"))
|
|
16629
|
+
]
|
|
16630
|
+
),
|
|
16631
|
+
rule(
|
|
16632
|
+
"passesArgument",
|
|
16633
|
+
[v("r"), v("p"), v("a")],
|
|
16634
|
+
[
|
|
16635
|
+
lit("paramNamed", v("f"), v("n"), v("p")),
|
|
16636
|
+
lit("callsFunction", v("r"), v("f")),
|
|
16637
|
+
lit("callKeywordArg", v("r"), v("n"), v("a"))
|
|
16399
16638
|
]
|
|
16400
16639
|
),
|
|
16401
16640
|
// What a module exports: directly, or through re-export chains.
|
|
@@ -16420,12 +16659,22 @@ var RESOLUTION_RULES = [
|
|
|
16420
16659
|
lit("moduleExport", v("m2"), v("n"), v("value"))
|
|
16421
16660
|
]
|
|
16422
16661
|
),
|
|
16423
|
-
// The
|
|
16424
|
-
//
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16662
|
+
// The function a call runs, written from the call's side because a
|
|
16663
|
+
// caller asking what a call gives back has the call in hand.
|
|
16664
|
+
rule(
|
|
16665
|
+
"invokes",
|
|
16666
|
+
[v("r"), v("f")],
|
|
16667
|
+
[lit("call", v("r"), v("c")), lit("comesTo", v("c"), v("f"))]
|
|
16668
|
+
),
|
|
16669
|
+
// The callee is itself a call: `daoBuilder()()`.
|
|
16670
|
+
rule(
|
|
16671
|
+
"invokes",
|
|
16672
|
+
[v("r"), v("f")],
|
|
16673
|
+
[lit("call", v("r"), v("c")), lit("givesBack", v("c"), v("f"))]
|
|
16674
|
+
),
|
|
16675
|
+
// The object an expression refers to: a name through `comesTo`, a
|
|
16676
|
+
// factory call through what it gives back. Naming the step is what
|
|
16677
|
+
// makes `routes.list` and `make(body).handle` one rule.
|
|
16429
16678
|
rule(
|
|
16430
16679
|
"objectOf",
|
|
16431
16680
|
[v("o"), v("obj")],
|
|
@@ -16433,14 +16682,8 @@ var RESOLUTION_RULES = [
|
|
|
16433
16682
|
),
|
|
16434
16683
|
rule(
|
|
16435
16684
|
"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
|
-
]
|
|
16685
|
+
[v("x"), v("obj")],
|
|
16686
|
+
[lit("givesBack", v("x"), v("obj")), lit("objectValue", v("obj"))]
|
|
16444
16687
|
),
|
|
16445
16688
|
// Which calls a function, found by the name the call is written as
|
|
16446
16689
|
// rather than by resolving every callee in the project. A caller knows
|
|
@@ -16473,42 +16716,6 @@ var RESOLUTION_RULES = [
|
|
|
16473
16716
|
lit("call", v("r"), v("c"))
|
|
16474
16717
|
]
|
|
16475
16718
|
),
|
|
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
16719
|
// What an object contains, its base class included, so a method the base
|
|
16513
16720
|
// declares is found on a subclass that never overrode it. A method both
|
|
16514
16721
|
// declare gives two, and the caller decides. This is its own relation
|
|
@@ -16528,33 +16735,8 @@ var RESOLUTION_RULES = [
|
|
|
16528
16735
|
lit("contains", v("baseCls"), v("n"), v("held"))
|
|
16529
16736
|
]
|
|
16530
16737
|
),
|
|
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.
|
|
16738
|
+
// Which function a factory returns, and which of its parameters that
|
|
16739
|
+
// function calls: together they are what makes it a wrapper.
|
|
16558
16740
|
rule(
|
|
16559
16741
|
"returnsFunc",
|
|
16560
16742
|
[v("f"), v("g")],
|
|
@@ -16615,56 +16797,20 @@ var RESOLUTION_RULES = [
|
|
|
16615
16797
|
lit("paramOf", v("f"), v("k"), v("p"))
|
|
16616
16798
|
]
|
|
16617
16799
|
),
|
|
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
16800
|
// 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.
|
|
16801
|
+
// source being read. A walk ends at something written out in source,
|
|
16802
|
+
// so it never reaches a library's own function.
|
|
16651
16803
|
rule(
|
|
16652
16804
|
"comesFrom",
|
|
16653
16805
|
[v("x"), v("m"), v("n")],
|
|
16654
16806
|
[lit("imports", v("x"), v("m"), v("n"))]
|
|
16655
16807
|
),
|
|
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
16808
|
rule(
|
|
16662
16809
|
"comesFrom",
|
|
16663
16810
|
[v("x"), v("m"), v("n")],
|
|
16664
16811
|
[
|
|
16665
|
-
lit("
|
|
16666
|
-
lit("
|
|
16667
|
-
lit("comesFrom", v("value"), v("m"), v("n"))
|
|
16812
|
+
lit("reaches", v("x"), v("y"), VALUE_STEP),
|
|
16813
|
+
lit("imports", v("y"), v("m"), v("n"))
|
|
16668
16814
|
]
|
|
16669
16815
|
),
|
|
16670
16816
|
// Calling f ends up calling the name n that module m exports. One hop
|
|
@@ -16700,36 +16846,6 @@ var RESOLUTION_RULES = [
|
|
|
16700
16846
|
"resolves",
|
|
16701
16847
|
[v("x"), v("z")],
|
|
16702
16848
|
[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
16849
|
)
|
|
16734
16850
|
];
|
|
16735
16851
|
var RESOLUTION_QUESTIONS = [
|
|
@@ -16761,6 +16877,13 @@ var RESOLUTION_QUESTIONS = [
|
|
|
16761
16877
|
[v("x"), v("z")],
|
|
16762
16878
|
[lit("wanted", v("x")), lit("objectOf", v("x"), v("z"))]
|
|
16763
16879
|
),
|
|
16880
|
+
// Keyed by the parameter, since that is what a caller has in hand
|
|
16881
|
+
// when it wants the call sites told apart.
|
|
16882
|
+
rule(
|
|
16883
|
+
"wantedParamAt",
|
|
16884
|
+
[v("p"), v("r"), v("z")],
|
|
16885
|
+
[lit("wanted", v("p")), lit("paramAt", v("r"), v("p"), v("z"))]
|
|
16886
|
+
),
|
|
16764
16887
|
rule(
|
|
16765
16888
|
"wantedComesFrom",
|
|
16766
16889
|
[v("x"), v("m"), v("n")],
|