@suss/adapter-python 0.7.2 → 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/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-TEXSN75M.js
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,13 +15860,19 @@ 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
- "sqs",
15851
- "sns",
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",
15855
15871
  "kafka",
15856
- "nats"
15872
+ "nats",
15873
+ "cloudflare-queues",
15874
+ "cloudflare-cron",
15875
+ "cloudflare-tail"
15857
15876
  ]),
15858
15877
  /**
15859
15878
  * Stable channel identifier: a CFN logical id, a queue or topic name,
@@ -15866,6 +15885,10 @@ var MessageBusSemanticsSchema = external_exports.object({
15866
15885
  var messageBusSemantics = defineBoundarySemantics({
15867
15886
  name: "message-bus",
15868
15887
  schema: MessageBusSemanticsSchema,
15888
+ semconv: {
15889
+ messageBus: { name: "messaging.system" },
15890
+ channel: { name: "messaging.destination.name" }
15891
+ },
15869
15892
  behavior: {
15870
15893
  /** A message goes onto the channel and nothing comes back. */
15871
15894
  exchangesHttpResponses: false,
@@ -15923,6 +15946,36 @@ var messageBusSemantics = defineBoundarySemantics({
15923
15946
  }
15924
15947
  }
15925
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
+ });
15926
15979
  var RestSemanticsSchema = external_exports.object({
15927
15980
  name: external_exports.literal("rest"),
15928
15981
  /**
@@ -15978,6 +16031,14 @@ function routePathAdmits(declaredPath, requestPath) {
15978
16031
  var restSemantics = defineBoundarySemantics({
15979
16032
  name: "rest",
15980
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
+ },
15981
16042
  behavior: {
15982
16043
  /** A request goes out, a status and a body come back. */
15983
16044
  exchangesHttpResponses: true,
@@ -16053,7 +16114,8 @@ var DeployableUnitSchema = external_exports.object({
16053
16114
  "lambda",
16054
16115
  "ecs-task",
16055
16116
  "container",
16056
- "k8s-deployment"
16117
+ "k8s-deployment",
16118
+ "worker"
16057
16119
  ]),
16058
16120
  // An empty name would agree with every other empty name, so a unit
16059
16121
  // with no name has to leave the field off instead.
@@ -16065,6 +16127,10 @@ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
16065
16127
  var runtimeConfigSemantics = defineBoundarySemantics({
16066
16128
  name: "runtime-config",
16067
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: {},
16068
16134
  behavior: {
16069
16135
  /** A process reads its config at startup, and nothing replies. */
16070
16136
  exchangesHttpResponses: false,
@@ -16075,9 +16141,9 @@ var runtimeConfigSemantics = defineBoundarySemantics({
16075
16141
  var StorageSemanticsSchema = external_exports.object({
16076
16142
  name: external_exports.literal("storage"),
16077
16143
  /**
16078
- * Which store this is: postgres, mysql, sqlite, dynamodb. Two
16079
- * products' containers can share a name, so this keeps them apart,
16080
- * and it is what a finding message calls the store.
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.
16081
16147
  */
16082
16148
  storageSystem: external_exports.string(),
16083
16149
  /**
@@ -16105,6 +16171,14 @@ var StorageSemanticsSchema = external_exports.object({
16105
16171
  var storageSemantics = defineBoundarySemantics({
16106
16172
  name: "storage",
16107
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
+ },
16108
16182
  behavior: {
16109
16183
  /** A query returns rows or items, not a status and a body. */
16110
16184
  exchangesHttpResponses: false,
@@ -16119,7 +16193,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
16119
16193
  graphqlOperationSemantics.schema,
16120
16194
  runtimeConfigSemantics.schema,
16121
16195
  storageSemantics.schema,
16122
- messageBusSemantics.schema
16196
+ messageBusSemantics.schema,
16197
+ metricSemantics.schema
16123
16198
  ]);
16124
16199
  var DEFINITIONS = [
16125
16200
  restSemantics,
@@ -16128,7 +16203,8 @@ var DEFINITIONS = [
16128
16203
  graphqlOperationSemantics,
16129
16204
  runtimeConfigSemantics,
16130
16205
  storageSemantics,
16131
- messageBusSemantics
16206
+ messageBusSemantics,
16207
+ metricSemantics
16132
16208
  ];
16133
16209
  var BY_NAME = new Map(
16134
16210
  DEFINITIONS.map((d) => [d.name, d])
@@ -16362,36 +16438,203 @@ function statementIn(call) {
16362
16438
  import { deriveOnDemand, evaluate } from "@suss/datalog";
16363
16439
 
16364
16440
  // ../../resolution/dist/index.js
16365
- 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");
16366
16444
  var RESOLUTION_RULES = [
16367
- // A value comes to itself; every chain ends at something written out
16368
- // in source, a function or an object.
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.
16369
16569
  rule("comesTo", [v("x"), v("x")], [lit("func", v("x"))]),
16370
16570
  rule("comesTo", [v("x"), v("x")], [lit("objectValue", v("x"))]),
16371
- // Aliasing: const x = y, or an identifier referencing a declaration.
16372
16571
  rule(
16373
16572
  "comesTo",
16374
16573
  [v("x"), v("z")],
16375
- [lit("binds", v("x"), v("y")), lit("comesTo", v("y"), v("z"))]
16574
+ [lit("reaches", v("x"), v("z"), VALUE_STEP), lit("func", v("z"))]
16376
16575
  ),
16377
- // A name written more than once has the value the last write left
16378
- // there, and `binds` says nothing about it. The adapter works out
16379
- // which write that is, in its own language's terms, and stays quiet
16380
- // when control flow decides. A name it stays quiet about comes to no
16381
- // value, which is the answer.
16382
16576
  rule(
16383
16577
  "comesTo",
16384
16578
  [v("x"), v("z")],
16385
- [lit("endsHolding", v("x"), v("y")), lit("comesTo", v("y"), v("z"))]
16579
+ [lit("reaches", v("x"), v("z"), VALUE_STEP), lit("objectValue", v("z"))]
16386
16580
  ),
16387
- // An import comes to what the module exports under that name.
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.
16388
16584
  rule(
16389
- "comesTo",
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",
16390
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")],
16391
16614
  [
16392
- lit("imports", v("x"), v("m"), v("n")),
16393
- lit("moduleExport", v("m"), v("n"), v("value")),
16394
- lit("comesTo", v("value"), v("z"))
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"))
16395
16638
  ]
16396
16639
  ),
16397
16640
  // What a module exports: directly, or through re-export chains.
@@ -16416,12 +16659,22 @@ var RESOLUTION_RULES = [
16416
16659
  lit("moduleExport", v("m2"), v("n"), v("value"))
16417
16660
  ]
16418
16661
  ),
16419
- // The object an expression refers to. A name arrives at one by
16420
- // following `comesTo` through aliases and imports. A factory call
16421
- // arrives at one through what the function it calls returns; the
16422
- // call itself is given no `comesTo`, since a factory call usually IS
16423
- // the wrapper and answering with the raw returned function would
16424
- // fight the unwraps answer.
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.
16425
16678
  rule(
16426
16679
  "objectOf",
16427
16680
  [v("o"), v("obj")],
@@ -16429,14 +16682,8 @@ var RESOLUTION_RULES = [
16429
16682
  ),
16430
16683
  rule(
16431
16684
  "objectOf",
16432
- [v("r"), v("obj")],
16433
- [
16434
- lit("call", v("r"), v("c")),
16435
- lit("comesTo", v("c"), v("f")),
16436
- lit("returnsValue", v("f"), v("ret")),
16437
- lit("comesTo", v("ret"), v("obj")),
16438
- lit("objectValue", v("obj"))
16439
- ]
16685
+ [v("x"), v("obj")],
16686
+ [lit("givesBack", v("x"), v("obj")), lit("objectValue", v("obj"))]
16440
16687
  ),
16441
16688
  // Which calls a function, found by the name the call is written as
16442
16689
  // rather than by resolving every callee in the project. A caller knows
@@ -16457,40 +16704,16 @@ var RESOLUTION_RULES = [
16457
16704
  lit("call", v("r"), v("c"))
16458
16705
  ]
16459
16706
  ),
16460
- // A function whose return is itself a call arrives at the same object
16461
- // that call does, so a chain passing through two factories settles.
16462
- rule(
16463
- "objectOf",
16464
- [v("r"), v("obj")],
16465
- [
16466
- lit("call", v("r"), v("c")),
16467
- lit("comesTo", v("c"), v("f")),
16468
- lit("returnsValue", v("f"), v("ret")),
16469
- lit("objectOf", v("ret"), v("obj"))
16470
- ]
16471
- ),
16472
- // An argument reaches the parameter it is passed to, by position or
16473
- // by the name the caller wrote. A function called from several places
16474
- // leaves its parameter with more than one value, and the caller
16475
- // decides what to do about that.
16476
- rule(
16477
- "comesTo",
16478
- [v("p"), v("z")],
16479
- [
16480
- lit("paramOf", v("f"), v("k"), v("p")),
16481
- lit("callsFunction", v("r"), v("f")),
16482
- lit("callArg", v("r"), v("k"), v("a")),
16483
- lit("comesTo", v("a"), v("z"))
16484
- ]
16485
- ),
16707
+ // The same, for a language whose adapter writes the import down as a
16708
+ // declaration and the call's callee as the name referring to it.
16486
16709
  rule(
16487
- "comesTo",
16488
- [v("p"), v("z")],
16710
+ "callsFunction",
16711
+ [v("r"), v("f")],
16489
16712
  [
16490
- lit("paramNamed", v("f"), v("n"), v("p")),
16491
- lit("callsFunction", v("r"), v("f")),
16492
- lit("callKeywordArg", v("r"), v("n"), v("a")),
16493
- lit("comesTo", v("a"), v("z"))
16713
+ lit("moduleExport", v("m"), v("n"), v("f")),
16714
+ lit("imports", v("d"), v("m"), v("n")),
16715
+ lit("binds", v("c"), v("d")),
16716
+ lit("call", v("r"), v("c"))
16494
16717
  ]
16495
16718
  ),
16496
16719
  // What an object contains, its base class included, so a method the base
@@ -16512,33 +16735,8 @@ var RESOLUTION_RULES = [
16512
16735
  lit("contains", v("baseCls"), v("n"), v("held"))
16513
16736
  ]
16514
16737
  ),
16515
- // Calling a class makes one of it, and reading a method off the
16516
- // result finds the method the class declares. The caveat above is
16517
- // about a factory function, and a class is not one.
16518
- rule(
16519
- "comesTo",
16520
- [v("r"), v("cls")],
16521
- [
16522
- lit("call", v("r"), v("c")),
16523
- lit("comesTo", v("c"), v("cls")),
16524
- lit("objectValue", v("cls"))
16525
- ]
16526
- ),
16527
- // Reading a property comes to what the object holds under that name,
16528
- // whichever way the object arrived: `routes.list` off a name, or
16529
- // `make(body).handle` off a call.
16530
- rule(
16531
- "comesTo",
16532
- [v("x"), v("z")],
16533
- [
16534
- lit("readsProperty", v("x"), v("o"), v("n")),
16535
- lit("objectOf", v("o"), v("obj")),
16536
- lit("contains", v("obj"), v("n"), v("held")),
16537
- lit("comesTo", v("held"), v("z"))
16538
- ]
16539
- ),
16540
- // Wrapper transparency, derived: calling a factory that returns a
16541
- // 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.
16542
16740
  rule(
16543
16741
  "returnsFunc",
16544
16742
  [v("f"), v("g")],
@@ -16599,56 +16797,20 @@ var RESOLUTION_RULES = [
16599
16797
  lit("paramOf", v("f"), v("k"), v("p"))
16600
16798
  ]
16601
16799
  ),
16602
- rule(
16603
- "comesTo",
16604
- [v("r"), v("h")],
16605
- [
16606
- lit("call", v("r"), v("c")),
16607
- lit("comesTo", v("c"), v("f")),
16608
- lit("unwraps", v("f"), v("k")),
16609
- lit("callArg", v("r"), v("k"), v("a")),
16610
- lit("comesTo", v("a"), v("h"))
16611
- ]
16612
- ),
16613
- // Wrapper transparency, declared: a pack says this callee wraps
16614
- // argument k, whatever its implementation looks like. The callee has
16615
- // to have been imported from the library the pack named, so a local
16616
- // object spelled the same way is not mistaken for it.
16617
- rule(
16618
- "comesTo",
16619
- [v("r"), v("h")],
16620
- [
16621
- lit("calleeName", v("r"), v("n")),
16622
- lit("unwrapsByName", v("n"), v("k")),
16623
- lit("wrapperModule", v("n"), v("m")),
16624
- lit("calleeOrigin", v("r"), v("m")),
16625
- lit("callArg", v("r"), v("k"), v("a")),
16626
- lit("comesTo", v("a"), v("h"))
16627
- ]
16628
- ),
16629
16800
  // Where a name comes from, when what it refers to lives outside the
16630
- // source being read. `comesTo` ends at something written out, so it
16631
- // never reaches a library's own function, and a project's alias of a
16632
- // library name has no answer at all. This follows the same aliases
16633
- // and barrels in the other direction and answers with the module and
16634
- // 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.
16635
16803
  rule(
16636
16804
  "comesFrom",
16637
16805
  [v("x"), v("m"), v("n")],
16638
16806
  [lit("imports", v("x"), v("m"), v("n"))]
16639
16807
  ),
16640
- rule(
16641
- "comesFrom",
16642
- [v("x"), v("m"), v("n")],
16643
- [lit("binds", v("x"), v("y")), lit("comesFrom", v("y"), v("m"), v("n"))]
16644
- ),
16645
16808
  rule(
16646
16809
  "comesFrom",
16647
16810
  [v("x"), v("m"), v("n")],
16648
16811
  [
16649
- lit("imports", v("x"), v("m2"), v("n2")),
16650
- lit("moduleExport", v("m2"), v("n2"), v("value")),
16651
- 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"))
16652
16814
  ]
16653
16815
  ),
16654
16816
  // Calling f ends up calling the name n that module m exports. One hop
@@ -16684,36 +16846,6 @@ var RESOLUTION_RULES = [
16684
16846
  "resolves",
16685
16847
  [v("x"), v("z")],
16686
16848
  [lit("comesTo", v("x"), v("z")), lit("func", v("z"))]
16687
- ),
16688
- // Following a name to the expression it is written as. A separate
16689
- // relation rather than a widening of `comesTo`, so a caller asking
16690
- // the older question never sees a new answer: a factory call already
16691
- // has an unwrapping answer, and letting it also answer with itself
16692
- // would make that pair ambiguous.
16693
- //
16694
- // The two seeds are the two ways an expression can be written out. An
16695
- // object literal is one of them, and it is the shape a generated
16696
- // GraphQL document takes.
16697
- rule("isWrittenAs", [v("x"), v("x")], [lit("writtenValue", v("x"))]),
16698
- rule("isWrittenAs", [v("x"), v("x")], [lit("objectValue", v("x"))]),
16699
- rule(
16700
- "isWrittenAs",
16701
- [v("x"), v("z")],
16702
- [lit("binds", v("x"), v("y")), lit("isWrittenAs", v("y"), v("z"))]
16703
- ),
16704
- rule(
16705
- "isWrittenAs",
16706
- [v("x"), v("z")],
16707
- [lit("endsHolding", v("x"), v("y")), lit("isWrittenAs", v("y"), v("z"))]
16708
- ),
16709
- rule(
16710
- "isWrittenAs",
16711
- [v("x"), v("z")],
16712
- [
16713
- lit("imports", v("x"), v("m"), v("n")),
16714
- lit("moduleExport", v("m"), v("n"), v("value")),
16715
- lit("isWrittenAs", v("value"), v("z"))
16716
- ]
16717
16849
  )
16718
16850
  ];
16719
16851
  var RESOLUTION_QUESTIONS = [
@@ -16745,6 +16877,13 @@ var RESOLUTION_QUESTIONS = [
16745
16877
  [v("x"), v("z")],
16746
16878
  [lit("wanted", v("x")), lit("objectOf", v("x"), v("z"))]
16747
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
+ ),
16748
16887
  rule(
16749
16888
  "wantedComesFrom",
16750
16889
  [v("x"), v("m"), v("n")],