@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.cjs CHANGED
@@ -15747,7 +15747,7 @@ function date4(params) {
15747
15747
  // ../../../node_modules/zod/v4/classic/external.js
15748
15748
  config(en_default());
15749
15749
 
15750
- // ../../ir-core/dist/chunk-TEXSN75M.js
15750
+ // ../../ir-core/dist/chunk-XUXN6DIX.js
15751
15751
  function gqlIdentityKey(typeName, fieldName) {
15752
15752
  return `gql:${typeName}.${fieldName}`;
15753
15753
  }
@@ -15757,6 +15757,9 @@ function fnIdentityKey(packageName, exportPath) {
15757
15757
  function busIdentityKey(messageBus, subject) {
15758
15758
  return `bus:${messageBus} ${subject}`;
15759
15759
  }
15760
+ function metricIdentityKey(metricSystem, metricType) {
15761
+ return `metric:${metricSystem} ${metricType}`;
15762
+ }
15760
15763
  function defineBoundarySemantics(definition) {
15761
15764
  return definition;
15762
15765
  }
@@ -15794,6 +15797,9 @@ var FunctionCallSemanticsSchema = external_exports.object({
15794
15797
  var functionCallSemantics = defineBoundarySemantics({
15795
15798
  name: "function-call",
15796
15799
  schema: FunctionCallSemanticsSchema,
15800
+ // A call that never leaves the process does not produce a span, and
15801
+ // the conventions do not name one. All of it is ours.
15802
+ semconv: {},
15797
15803
  behavior: {
15798
15804
  /** A call returns a value, which is not a status and a body. */
15799
15805
  exchangesHttpResponses: false,
@@ -15826,6 +15832,10 @@ var GraphqlOperationSemanticsSchema = external_exports.object({
15826
15832
  var graphqlOperationSemantics = defineBoundarySemantics({
15827
15833
  name: "graphql-operation",
15828
15834
  schema: GraphqlOperationSemanticsSchema,
15835
+ semconv: {
15836
+ operationName: { name: "graphql.operation.name" },
15837
+ operationType: { name: "graphql.operation.type" }
15838
+ },
15829
15839
  behavior: {
15830
15840
  /**
15831
15841
  * An operation gets a data-and-errors document back, which the
@@ -15856,6 +15866,9 @@ var GraphqlResolverSemanticsSchema = external_exports.object({
15856
15866
  var graphqlResolverSemantics = defineBoundarySemantics({
15857
15867
  name: "graphql-resolver",
15858
15868
  schema: GraphqlResolverSemanticsSchema,
15869
+ // The conventions name the operation a client sent, not the
15870
+ // resolver the server ran for one field of it.
15871
+ semconv: {},
15859
15872
  behavior: {
15860
15873
  /** A resolver returns a field value, not a status and a body. */
15861
15874
  exchangesHttpResponses: false,
@@ -15891,13 +15904,19 @@ function channelsPair(a, b) {
15891
15904
  var MessageBusSemanticsSchema = external_exports.object({
15892
15905
  name: external_exports.literal("message-bus"),
15893
15906
  messageBus: external_exports.enum([
15894
- "sqs",
15895
- "sns",
15907
+ // The conventions spell the two AWS buses this way, one with an
15908
+ // underscore and one with a dot, so these are their strings and
15909
+ // not a typo.
15910
+ "aws_sqs",
15911
+ "aws.sns",
15896
15912
  "s3",
15897
15913
  "eventbridge",
15898
15914
  "bullmq",
15899
15915
  "kafka",
15900
- "nats"
15916
+ "nats",
15917
+ "cloudflare-queues",
15918
+ "cloudflare-cron",
15919
+ "cloudflare-tail"
15901
15920
  ]),
15902
15921
  /**
15903
15922
  * Stable channel identifier: a CFN logical id, a queue or topic name,
@@ -15910,6 +15929,10 @@ var MessageBusSemanticsSchema = external_exports.object({
15910
15929
  var messageBusSemantics = defineBoundarySemantics({
15911
15930
  name: "message-bus",
15912
15931
  schema: MessageBusSemanticsSchema,
15932
+ semconv: {
15933
+ messageBus: { name: "messaging.system" },
15934
+ channel: { name: "messaging.destination.name" }
15935
+ },
15913
15936
  behavior: {
15914
15937
  /** A message goes onto the channel and nothing comes back. */
15915
15938
  exchangesHttpResponses: false,
@@ -15967,6 +15990,36 @@ var messageBusSemantics = defineBoundarySemantics({
15967
15990
  }
15968
15991
  }
15969
15992
  });
15993
+ var MetricSemanticsSchema = external_exports.object({
15994
+ name: external_exports.literal("metric"),
15995
+ /** Which system the series lives in: cloud-monitoring, cloudwatch. */
15996
+ metricSystem: external_exports.string(),
15997
+ /**
15998
+ * The type string the system knows the metric by, spelled the way
15999
+ * both sides spell it. Null when the source states one this reader
16000
+ * could not settle, as with a query it could not read: a metric
16001
+ * nobody could name pairs with nothing rather than with whatever
16002
+ * happens to share its source text.
16003
+ */
16004
+ metricType: external_exports.string().nullable()
16005
+ });
16006
+ var metricSemantics = defineBoundarySemantics({
16007
+ name: "metric",
16008
+ schema: MetricSemanticsSchema,
16009
+ // OpenTelemetry knows a metric by its instrument name, and has no
16010
+ // attribute for the system it lives in or the type string it goes by.
16011
+ semconv: {},
16012
+ behavior: {
16013
+ exchangesHttpResponses: false,
16014
+ reportsUnpairedItself: false,
16015
+ identityKey(semantics) {
16016
+ if (semantics.metricType === null) {
16017
+ return null;
16018
+ }
16019
+ return metricIdentityKey(semantics.metricSystem, semantics.metricType);
16020
+ }
16021
+ }
16022
+ });
15970
16023
  var RestSemanticsSchema = external_exports.object({
15971
16024
  name: external_exports.literal("rest"),
15972
16025
  /**
@@ -16022,6 +16075,14 @@ function routePathAdmits(declaredPath, requestPath) {
16022
16075
  var restSemantics = defineBoundarySemantics({
16023
16076
  name: "rest",
16024
16077
  schema: RestSemanticsSchema,
16078
+ semconv: {
16079
+ // A span states the one method a request used, so a route that
16080
+ // responds to every method has nothing to compare.
16081
+ method: { name: "http.request.method", placeholderValues: ["*"] },
16082
+ path: { name: "http.route" }
16083
+ // declaredResponses is a list, and http.response.status_code is
16084
+ // the one status a request got back.
16085
+ },
16025
16086
  behavior: {
16026
16087
  /** A request goes out, a status and a body come back. */
16027
16088
  exchangesHttpResponses: true,
@@ -16097,7 +16158,8 @@ var DeployableUnitSchema = external_exports.object({
16097
16158
  "lambda",
16098
16159
  "ecs-task",
16099
16160
  "container",
16100
- "k8s-deployment"
16161
+ "k8s-deployment",
16162
+ "worker"
16101
16163
  ]),
16102
16164
  // An empty name would agree with every other empty name, so a unit
16103
16165
  // with no name has to leave the field off instead.
@@ -16109,6 +16171,10 @@ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
16109
16171
  var runtimeConfigSemantics = defineBoundarySemantics({
16110
16172
  name: "runtime-config",
16111
16173
  schema: RuntimeConfigSemanticsSchema,
16174
+ // service.name and cloud.resource_id name the same deployable, but
16175
+ // instanceName is the deployment template's logical id, which is
16176
+ // neither of those strings.
16177
+ semconv: {},
16112
16178
  behavior: {
16113
16179
  /** A process reads its config at startup, and nothing replies. */
16114
16180
  exchangesHttpResponses: false,
@@ -16119,9 +16185,9 @@ var runtimeConfigSemantics = defineBoundarySemantics({
16119
16185
  var StorageSemanticsSchema = external_exports.object({
16120
16186
  name: external_exports.literal("storage"),
16121
16187
  /**
16122
- * Which store this is: postgres, mysql, sqlite, dynamodb. Two
16123
- * products' containers can share a name, so this keeps them apart,
16124
- * and it is what a finding message calls the store.
16188
+ * Which store this is: postgresql, mysql, aws.dynamodb, or our own
16189
+ * word for one OpenTelemetry never named, such as s3. Two products'
16190
+ * containers can share a name, so this keeps them apart.
16125
16191
  */
16126
16192
  storageSystem: external_exports.string(),
16127
16193
  /**
@@ -16149,6 +16215,14 @@ var StorageSemanticsSchema = external_exports.object({
16149
16215
  var storageSemantics = defineBoundarySemantics({
16150
16216
  name: "storage",
16151
16217
  schema: StorageSemanticsSchema,
16218
+ semconv: {
16219
+ storageSystem: { name: "db.system.name" },
16220
+ // "default" is our word for a source that named no database.
16221
+ scope: { name: "db.namespace", placeholderValues: ["default"] },
16222
+ container: { name: "db.collection.name" }
16223
+ // A secondary index has no attribute of its own, so accessPath
16224
+ // stays our word.
16225
+ },
16152
16226
  behavior: {
16153
16227
  /** A query returns rows or items, not a status and a body. */
16154
16228
  exchangesHttpResponses: false,
@@ -16163,7 +16237,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
16163
16237
  graphqlOperationSemantics.schema,
16164
16238
  runtimeConfigSemantics.schema,
16165
16239
  storageSemantics.schema,
16166
- messageBusSemantics.schema
16240
+ messageBusSemantics.schema,
16241
+ metricSemantics.schema
16167
16242
  ]);
16168
16243
  var DEFINITIONS = [
16169
16244
  restSemantics,
@@ -16172,7 +16247,8 @@ var DEFINITIONS = [
16172
16247
  graphqlOperationSemantics,
16173
16248
  runtimeConfigSemantics,
16174
16249
  storageSemantics,
16175
- messageBusSemantics
16250
+ messageBusSemantics,
16251
+ metricSemantics
16176
16252
  ];
16177
16253
  var BY_NAME = new Map(
16178
16254
  DEFINITIONS.map((d) => [d.name, d])
@@ -16407,35 +16483,202 @@ var import_datalog2 = require("@suss/datalog");
16407
16483
 
16408
16484
  // ../../resolution/dist/index.js
16409
16485
  var import_datalog = require("@suss/datalog");
16486
+ var VALUE_STEP = (0, import_datalog.constant)("value");
16487
+ var RESULT_STEP = (0, import_datalog.constant)("result");
16410
16488
  var RESOLUTION_RULES = [
16411
- // A value comes to itself; every chain ends at something written out
16412
- // in source, a function or an object.
16489
+ // Aliasing: const x = y, or an identifier referencing a declaration.
16490
+ // A language with a hop of its own, like JavaScript's `.bind`, states
16491
+ // it as a step too, or every question but `comesTo` misses it.
16492
+ (0, import_datalog.rule)("stepsTo", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP], [(0, import_datalog.lit)("binds", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"))]),
16493
+ // A name written more than once has the value the last write left
16494
+ // there. The adapter works out which write that is and stays quiet
16495
+ // when control flow decides, so such a name steps nowhere at all.
16496
+ (0, import_datalog.rule)(
16497
+ "stepsTo",
16498
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP],
16499
+ [(0, import_datalog.lit)("endsHolding", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"))]
16500
+ ),
16501
+ // An import steps to what the module exports under that name.
16502
+ (0, import_datalog.rule)(
16503
+ "stepsTo",
16504
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("value"), VALUE_STEP],
16505
+ [
16506
+ (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16507
+ (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value"))
16508
+ ]
16509
+ ),
16510
+ // A parameter steps to what a call passes it. A function called from
16511
+ // several places leaves its parameter with more than one value, and a
16512
+ // caller that needs those apart asks `paramAt`.
16513
+ (0, import_datalog.rule)(
16514
+ "stepsTo",
16515
+ [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("a"), VALUE_STEP],
16516
+ [(0, import_datalog.lit)("passesArgument", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a"))]
16517
+ ),
16518
+ // Reading a property steps to what the object contains under that
16519
+ // name, whichever way the object arrived: `routes.list` off a name,
16520
+ // or `make(body).handle` off a call.
16521
+ (0, import_datalog.rule)(
16522
+ "stepsTo",
16523
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("held"), VALUE_STEP],
16524
+ [
16525
+ (0, import_datalog.lit)("readsProperty", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("o"), (0, import_datalog.variable)("n")),
16526
+ (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")),
16527
+ (0, import_datalog.lit)("contains", (0, import_datalog.variable)("obj"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held"))
16528
+ ]
16529
+ ),
16530
+ // Calling a class makes one of it, so the call steps to the class and
16531
+ // a method read off the result is the one the class declares. The
16532
+ // caveat below is about a factory function, and a class is not one.
16533
+ (0, import_datalog.rule)(
16534
+ "stepsTo",
16535
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("cls"), VALUE_STEP],
16536
+ [
16537
+ (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16538
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("cls")),
16539
+ (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("cls"))
16540
+ ]
16541
+ ),
16542
+ // Wrapper transparency, derived: calling a factory that returns a
16543
+ // function which calls its parameter k steps to argument k.
16544
+ (0, import_datalog.rule)(
16545
+ "stepsTo",
16546
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("a"), VALUE_STEP],
16547
+ [
16548
+ (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16549
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16550
+ (0, import_datalog.lit)("unwraps", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k")),
16551
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16552
+ ]
16553
+ ),
16554
+ // Wrapper transparency, declared: a pack says this callee wraps
16555
+ // argument k. The callee has to come from the library the pack said,
16556
+ // so a local object spelled the same way is not mistaken for it.
16557
+ (0, import_datalog.rule)(
16558
+ "stepsTo",
16559
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("a"), VALUE_STEP],
16560
+ [
16561
+ (0, import_datalog.lit)("calleeName", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n")),
16562
+ (0, import_datalog.lit)("unwrapsByName", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("k")),
16563
+ (0, import_datalog.lit)("wrapperModule", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("m")),
16564
+ (0, import_datalog.lit)("calleeOrigin", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("m")),
16565
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16566
+ ]
16567
+ ),
16568
+ // The one step that runs a function forwards: a call steps to what
16569
+ // the function it invokes returns.
16570
+ (0, import_datalog.rule)(
16571
+ "stepsTo",
16572
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("ret"), RESULT_STEP],
16573
+ [(0, import_datalog.lit)("invokes", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")), (0, import_datalog.lit)("returnsValue", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("ret"))]
16574
+ ),
16575
+ // Where a walk gets to, and whether it ran a call on the way. A value
16576
+ // step keeps whatever the rest of the walk was, and a result step
16577
+ // makes the whole walk one that ran a call.
16578
+ (0, import_datalog.rule)(
16579
+ "reaches",
16580
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind")],
16581
+ [(0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind"))]
16582
+ ),
16583
+ (0, import_datalog.rule)(
16584
+ "reaches",
16585
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind")],
16586
+ [
16587
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP),
16588
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind"))
16589
+ ]
16590
+ ),
16591
+ // Two rules rather than one leaving the rest of the walk's kind free.
16592
+ // A free kind is a second question about the same relation, and a
16593
+ // demand-driven run then derives both to answer either.
16594
+ (0, import_datalog.rule)(
16595
+ "reaches",
16596
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP],
16597
+ [
16598
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), RESULT_STEP),
16599
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), VALUE_STEP)
16600
+ ]
16601
+ ),
16602
+ (0, import_datalog.rule)(
16603
+ "reaches",
16604
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP],
16605
+ [
16606
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), RESULT_STEP),
16607
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), RESULT_STEP)
16608
+ ]
16609
+ ),
16610
+ // What a value comes down to: the walk that never ran a call, stopped
16611
+ // at a function or an object. Something already written out comes to
16612
+ // itself, and every other walk ends at one of those.
16413
16613
  (0, import_datalog.rule)("comesTo", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("func", (0, import_datalog.variable)("x"))]),
16414
16614
  (0, import_datalog.rule)("comesTo", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("x"))]),
16415
- // Aliasing: const x = y, or an identifier referencing a declaration.
16416
16615
  (0, import_datalog.rule)(
16417
16616
  "comesTo",
16418
16617
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16419
- [(0, import_datalog.lit)("binds", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y")), (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"))]
16618
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), VALUE_STEP), (0, import_datalog.lit)("func", (0, import_datalog.variable)("z"))]
16420
16619
  ),
16421
- // A name written more than once has the value the last write left
16422
- // there, and `binds` says nothing about it. The adapter works out
16423
- // which write that is, in its own language's terms, and stays quiet
16424
- // when control flow decides. A name it stays quiet about comes to no
16425
- // value, which is the answer.
16426
16620
  (0, import_datalog.rule)(
16427
16621
  "comesTo",
16428
16622
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16429
- [(0, import_datalog.lit)("endsHolding", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y")), (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"))]
16623
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), VALUE_STEP), (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("z"))]
16430
16624
  ),
16431
- // An import comes to what the module exports under that name.
16625
+ // The same stopping condition, for the walk that ran a call. A call
16626
+ // gets no `comesTo` answer on purpose: coming back with what a
16627
+ // factory returned would fight the unwrapping answer.
16432
16628
  (0, import_datalog.rule)(
16433
- "comesTo",
16629
+ "givesBack",
16630
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16631
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP), (0, import_datalog.lit)("func", (0, import_datalog.variable)("z"))]
16632
+ ),
16633
+ (0, import_datalog.rule)(
16634
+ "givesBack",
16434
16635
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16636
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP), (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("z"))]
16637
+ ),
16638
+ // Following a value to the expression it is written as, whatever kind
16639
+ // that is. A GraphQL document is neither a function nor an object, so
16640
+ // `comesTo` never reaches one.
16641
+ (0, import_datalog.rule)("isWrittenAs", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("writtenValue", (0, import_datalog.variable)("x"))]),
16642
+ (0, import_datalog.rule)("isWrittenAs", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("x"))]),
16643
+ (0, import_datalog.rule)(
16644
+ "isWrittenAs",
16645
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16646
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), VALUE_STEP), (0, import_datalog.lit)("writtenValue", (0, import_datalog.variable)("z"))]
16647
+ ),
16648
+ (0, import_datalog.rule)(
16649
+ "isWrittenAs",
16650
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16651
+ [(0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), VALUE_STEP), (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("z"))]
16652
+ ),
16653
+ // What one call site put in a parameter, told apart from what the
16654
+ // other callers passed.
16655
+ (0, import_datalog.rule)(
16656
+ "paramAt",
16657
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16435
16658
  [
16436
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16437
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value")),
16438
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("z"))
16659
+ (0, import_datalog.lit)("passesArgument", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")),
16660
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16661
+ ]
16662
+ ),
16663
+ // An argument arriving at the parameter it is passed to, by position
16664
+ // or by the name the caller wrote, keeping the call it went through
16665
+ // so `paramAt` can tell two call sites apart.
16666
+ (0, import_datalog.rule)(
16667
+ "passesArgument",
16668
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")],
16669
+ [
16670
+ (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p")),
16671
+ (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16672
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16673
+ ]
16674
+ ),
16675
+ (0, import_datalog.rule)(
16676
+ "passesArgument",
16677
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")],
16678
+ [
16679
+ (0, import_datalog.lit)("paramNamed", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("p")),
16680
+ (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16681
+ (0, import_datalog.lit)("callKeywordArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("a"))
16439
16682
  ]
16440
16683
  ),
16441
16684
  // What a module exports: directly, or through re-export chains.
@@ -16460,12 +16703,22 @@ var RESOLUTION_RULES = [
16460
16703
  (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value"))
16461
16704
  ]
16462
16705
  ),
16463
- // The object an expression refers to. A name arrives at one by
16464
- // following `comesTo` through aliases and imports. A factory call
16465
- // arrives at one through what the function it calls returns; the
16466
- // call itself is given no `comesTo`, since a factory call usually IS
16467
- // the wrapper and answering with the raw returned function would
16468
- // fight the unwraps answer.
16706
+ // The function a call runs, written from the call's side because a
16707
+ // caller asking what a call gives back has the call in hand.
16708
+ (0, import_datalog.rule)(
16709
+ "invokes",
16710
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")],
16711
+ [(0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")), (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f"))]
16712
+ ),
16713
+ // The callee is itself a call: `daoBuilder()()`.
16714
+ (0, import_datalog.rule)(
16715
+ "invokes",
16716
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")],
16717
+ [(0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")), (0, import_datalog.lit)("givesBack", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f"))]
16718
+ ),
16719
+ // The object an expression refers to: a name through `comesTo`, a
16720
+ // factory call through what it gives back. Naming the step is what
16721
+ // makes `routes.list` and `make(body).handle` one rule.
16469
16722
  (0, import_datalog.rule)(
16470
16723
  "objectOf",
16471
16724
  [(0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")],
@@ -16473,14 +16726,8 @@ var RESOLUTION_RULES = [
16473
16726
  ),
16474
16727
  (0, import_datalog.rule)(
16475
16728
  "objectOf",
16476
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("obj")],
16477
- [
16478
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16479
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16480
- (0, import_datalog.lit)("returnsValue", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("ret")),
16481
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("ret"), (0, import_datalog.variable)("obj")),
16482
- (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("obj"))
16483
- ]
16729
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("obj")],
16730
+ [(0, import_datalog.lit)("givesBack", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("obj")), (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("obj"))]
16484
16731
  ),
16485
16732
  // Which calls a function, found by the name the call is written as
16486
16733
  // rather than by resolving every callee in the project. A caller knows
@@ -16501,40 +16748,16 @@ var RESOLUTION_RULES = [
16501
16748
  (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c"))
16502
16749
  ]
16503
16750
  ),
16504
- // A function whose return is itself a call arrives at the same object
16505
- // that call does, so a chain passing through two factories settles.
16506
- (0, import_datalog.rule)(
16507
- "objectOf",
16508
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("obj")],
16509
- [
16510
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16511
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16512
- (0, import_datalog.lit)("returnsValue", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("ret")),
16513
- (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("ret"), (0, import_datalog.variable)("obj"))
16514
- ]
16515
- ),
16516
- // An argument reaches the parameter it is passed to, by position or
16517
- // by the name the caller wrote. A function called from several places
16518
- // leaves its parameter with more than one value, and the caller
16519
- // decides what to do about that.
16520
- (0, import_datalog.rule)(
16521
- "comesTo",
16522
- [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16523
- [
16524
- (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p")),
16525
- (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16526
- (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a")),
16527
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16528
- ]
16529
- ),
16751
+ // The same, for a language whose adapter writes the import down as a
16752
+ // declaration and the call's callee as the name referring to it.
16530
16753
  (0, import_datalog.rule)(
16531
- "comesTo",
16532
- [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16754
+ "callsFunction",
16755
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")],
16533
16756
  [
16534
- (0, import_datalog.lit)("paramNamed", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("p")),
16535
- (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16536
- (0, import_datalog.lit)("callKeywordArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("a")),
16537
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16757
+ (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("f")),
16758
+ (0, import_datalog.lit)("imports", (0, import_datalog.variable)("d"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16759
+ (0, import_datalog.lit)("binds", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("d")),
16760
+ (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c"))
16538
16761
  ]
16539
16762
  ),
16540
16763
  // What an object contains, its base class included, so a method the base
@@ -16556,33 +16779,8 @@ var RESOLUTION_RULES = [
16556
16779
  (0, import_datalog.lit)("contains", (0, import_datalog.variable)("baseCls"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held"))
16557
16780
  ]
16558
16781
  ),
16559
- // Calling a class makes one of it, and reading a method off the
16560
- // result finds the method the class declares. The caveat above is
16561
- // about a factory function, and a class is not one.
16562
- (0, import_datalog.rule)(
16563
- "comesTo",
16564
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("cls")],
16565
- [
16566
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16567
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("cls")),
16568
- (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("cls"))
16569
- ]
16570
- ),
16571
- // Reading a property comes to what the object holds under that name,
16572
- // whichever way the object arrived: `routes.list` off a name, or
16573
- // `make(body).handle` off a call.
16574
- (0, import_datalog.rule)(
16575
- "comesTo",
16576
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16577
- [
16578
- (0, import_datalog.lit)("readsProperty", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("o"), (0, import_datalog.variable)("n")),
16579
- (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")),
16580
- (0, import_datalog.lit)("contains", (0, import_datalog.variable)("obj"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held")),
16581
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("held"), (0, import_datalog.variable)("z"))
16582
- ]
16583
- ),
16584
- // Wrapper transparency, derived: calling a factory that returns a
16585
- // function which calls its parameter k comes to argument k.
16782
+ // Which function a factory returns, and which of its parameters that
16783
+ // function calls: together they are what makes it a wrapper.
16586
16784
  (0, import_datalog.rule)(
16587
16785
  "returnsFunc",
16588
16786
  [(0, import_datalog.variable)("f"), (0, import_datalog.variable)("g")],
@@ -16643,56 +16841,20 @@ var RESOLUTION_RULES = [
16643
16841
  (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p"))
16644
16842
  ]
16645
16843
  ),
16646
- (0, import_datalog.rule)(
16647
- "comesTo",
16648
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("h")],
16649
- [
16650
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16651
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16652
- (0, import_datalog.lit)("unwraps", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k")),
16653
- (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a")),
16654
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("h"))
16655
- ]
16656
- ),
16657
- // Wrapper transparency, declared: a pack says this callee wraps
16658
- // argument k, whatever its implementation looks like. The callee has
16659
- // to have been imported from the library the pack named, so a local
16660
- // object spelled the same way is not mistaken for it.
16661
- (0, import_datalog.rule)(
16662
- "comesTo",
16663
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("h")],
16664
- [
16665
- (0, import_datalog.lit)("calleeName", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n")),
16666
- (0, import_datalog.lit)("unwrapsByName", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("k")),
16667
- (0, import_datalog.lit)("wrapperModule", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("m")),
16668
- (0, import_datalog.lit)("calleeOrigin", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("m")),
16669
- (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a")),
16670
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("h"))
16671
- ]
16672
- ),
16673
16844
  // Where a name comes from, when what it refers to lives outside the
16674
- // source being read. `comesTo` ends at something written out, so it
16675
- // never reaches a library's own function, and a project's alias of a
16676
- // library name has no answer at all. This follows the same aliases
16677
- // and barrels in the other direction and answers with the module and
16678
- // the name that module exports.
16845
+ // source being read. A walk ends at something written out in source,
16846
+ // so it never reaches a library's own function.
16679
16847
  (0, import_datalog.rule)(
16680
16848
  "comesFrom",
16681
16849
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16682
16850
  [(0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))]
16683
16851
  ),
16684
- (0, import_datalog.rule)(
16685
- "comesFrom",
16686
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16687
- [(0, import_datalog.lit)("binds", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y")), (0, import_datalog.lit)("comesFrom", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))]
16688
- ),
16689
16852
  (0, import_datalog.rule)(
16690
16853
  "comesFrom",
16691
16854
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16692
16855
  [
16693
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n2")),
16694
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n2"), (0, import_datalog.variable)("value")),
16695
- (0, import_datalog.lit)("comesFrom", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))
16856
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP),
16857
+ (0, import_datalog.lit)("imports", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))
16696
16858
  ]
16697
16859
  ),
16698
16860
  // Calling f ends up calling the name n that module m exports. One hop
@@ -16728,36 +16890,6 @@ var RESOLUTION_RULES = [
16728
16890
  "resolves",
16729
16891
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16730
16892
  [(0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")), (0, import_datalog.lit)("func", (0, import_datalog.variable)("z"))]
16731
- ),
16732
- // Following a name to the expression it is written as. A separate
16733
- // relation rather than a widening of `comesTo`, so a caller asking
16734
- // the older question never sees a new answer: a factory call already
16735
- // has an unwrapping answer, and letting it also answer with itself
16736
- // would make that pair ambiguous.
16737
- //
16738
- // The two seeds are the two ways an expression can be written out. An
16739
- // object literal is one of them, and it is the shape a generated
16740
- // GraphQL document takes.
16741
- (0, import_datalog.rule)("isWrittenAs", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("writtenValue", (0, import_datalog.variable)("x"))]),
16742
- (0, import_datalog.rule)("isWrittenAs", [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("x")], [(0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("x"))]),
16743
- (0, import_datalog.rule)(
16744
- "isWrittenAs",
16745
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16746
- [(0, import_datalog.lit)("binds", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y")), (0, import_datalog.lit)("isWrittenAs", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"))]
16747
- ),
16748
- (0, import_datalog.rule)(
16749
- "isWrittenAs",
16750
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16751
- [(0, import_datalog.lit)("endsHolding", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y")), (0, import_datalog.lit)("isWrittenAs", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"))]
16752
- ),
16753
- (0, import_datalog.rule)(
16754
- "isWrittenAs",
16755
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16756
- [
16757
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16758
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value")),
16759
- (0, import_datalog.lit)("isWrittenAs", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("z"))
16760
- ]
16761
16893
  )
16762
16894
  ];
16763
16895
  var RESOLUTION_QUESTIONS = [
@@ -16789,6 +16921,13 @@ var RESOLUTION_QUESTIONS = [
16789
16921
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16790
16922
  [(0, import_datalog.lit)("wanted", (0, import_datalog.variable)("x")), (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"))]
16791
16923
  ),
16924
+ // Keyed by the parameter, since that is what a caller has in hand
16925
+ // when it wants the call sites told apart.
16926
+ (0, import_datalog.rule)(
16927
+ "wantedParamAt",
16928
+ [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("r"), (0, import_datalog.variable)("z")],
16929
+ [(0, import_datalog.lit)("wanted", (0, import_datalog.variable)("p")), (0, import_datalog.lit)("paramAt", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("z"))]
16930
+ ),
16792
16931
  (0, import_datalog.rule)(
16793
16932
  "wantedComesFrom",
16794
16933
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],