@suss/adapter-python 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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-WRRENYBR.js
15750
+ // ../../ir-core/dist/chunk-HBAMPBAO.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,8 +15904,11 @@ 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",
@@ -15913,6 +15929,10 @@ var MessageBusSemanticsSchema = external_exports.object({
15913
15929
  var messageBusSemantics = defineBoundarySemantics({
15914
15930
  name: "message-bus",
15915
15931
  schema: MessageBusSemanticsSchema,
15932
+ semconv: {
15933
+ messageBus: { name: "messaging.system" },
15934
+ channel: { name: "messaging.destination.name" }
15935
+ },
15916
15936
  behavior: {
15917
15937
  /** A message goes onto the channel and nothing comes back. */
15918
15938
  exchangesHttpResponses: false,
@@ -15970,6 +15990,36 @@ var messageBusSemantics = defineBoundarySemantics({
15970
15990
  }
15971
15991
  }
15972
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
+ });
15973
16023
  var RestSemanticsSchema = external_exports.object({
15974
16024
  name: external_exports.literal("rest"),
15975
16025
  /**
@@ -16025,6 +16075,14 @@ function routePathAdmits(declaredPath, requestPath) {
16025
16075
  var restSemantics = defineBoundarySemantics({
16026
16076
  name: "rest",
16027
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
+ },
16028
16086
  behavior: {
16029
16087
  /** A request goes out, a status and a body come back. */
16030
16088
  exchangesHttpResponses: true,
@@ -16113,6 +16171,10 @@ var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
16113
16171
  var runtimeConfigSemantics = defineBoundarySemantics({
16114
16172
  name: "runtime-config",
16115
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: {},
16116
16178
  behavior: {
16117
16179
  /** A process reads its config at startup, and nothing replies. */
16118
16180
  exchangesHttpResponses: false,
@@ -16123,9 +16185,9 @@ var runtimeConfigSemantics = defineBoundarySemantics({
16123
16185
  var StorageSemanticsSchema = external_exports.object({
16124
16186
  name: external_exports.literal("storage"),
16125
16187
  /**
16126
- * Which store this is: postgres, mysql, sqlite, dynamodb. Two
16127
- * products' containers can share a name, so this keeps them apart,
16128
- * 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.
16129
16191
  */
16130
16192
  storageSystem: external_exports.string(),
16131
16193
  /**
@@ -16138,7 +16200,9 @@ var StorageSemanticsSchema = external_exports.object({
16138
16200
  * The table, bucket, collection, or index, as the source declares
16139
16201
  * it, or null when the source states one this reader could not
16140
16202
  * settle. A null container pairs with nothing, rather than with
16141
- * whatever its source text happens to spell.
16203
+ * whatever its source text happens to spell. The string is in the
16204
+ * boundary-name syntax: a literal, a pattern with `{}` holes, or a
16205
+ * reference, and `parseBoundaryName` is the one reader of it.
16142
16206
  */
16143
16207
  container: external_exports.string().nullable(),
16144
16208
  /**
@@ -16153,6 +16217,14 @@ var StorageSemanticsSchema = external_exports.object({
16153
16217
  var storageSemantics = defineBoundarySemantics({
16154
16218
  name: "storage",
16155
16219
  schema: StorageSemanticsSchema,
16220
+ semconv: {
16221
+ storageSystem: { name: "db.system.name" },
16222
+ // "default" is our word for a source that named no database.
16223
+ scope: { name: "db.namespace", placeholderValues: ["default"] },
16224
+ container: { name: "db.collection.name" }
16225
+ // A secondary index has no attribute of its own, so accessPath
16226
+ // stays our word.
16227
+ },
16156
16228
  behavior: {
16157
16229
  /** A query returns rows or items, not a status and a body. */
16158
16230
  exchangesHttpResponses: false,
@@ -16167,7 +16239,8 @@ var SemanticsSchema = external_exports.discriminatedUnion("name", [
16167
16239
  graphqlOperationSemantics.schema,
16168
16240
  runtimeConfigSemantics.schema,
16169
16241
  storageSemantics.schema,
16170
- messageBusSemantics.schema
16242
+ messageBusSemantics.schema,
16243
+ metricSemantics.schema
16171
16244
  ]);
16172
16245
  var DEFINITIONS = [
16173
16246
  restSemantics,
@@ -16176,7 +16249,8 @@ var DEFINITIONS = [
16176
16249
  graphqlOperationSemantics,
16177
16250
  runtimeConfigSemantics,
16178
16251
  storageSemantics,
16179
- messageBusSemantics
16252
+ messageBusSemantics,
16253
+ metricSemantics
16180
16254
  ];
16181
16255
  var BY_NAME = new Map(
16182
16256
  DEFINITIONS.map((d) => [d.name, d])
@@ -16411,35 +16485,202 @@ var import_datalog2 = require("@suss/datalog");
16411
16485
 
16412
16486
  // ../../resolution/dist/index.js
16413
16487
  var import_datalog = require("@suss/datalog");
16488
+ var VALUE_STEP = (0, import_datalog.constant)("value");
16489
+ var RESULT_STEP = (0, import_datalog.constant)("result");
16414
16490
  var RESOLUTION_RULES = [
16415
- // A value comes to itself; every chain ends at something written out
16416
- // in source, a function or an object.
16491
+ // Aliasing: const x = y, or an identifier referencing a declaration.
16492
+ // A language with a hop of its own, like JavaScript's `.bind`, states
16493
+ // it as a step too, or every question but `comesTo` misses it.
16494
+ (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"))]),
16495
+ // A name written more than once has the value the last write left
16496
+ // there. The adapter works out which write that is and stays quiet
16497
+ // when control flow decides, so such a name steps nowhere at all.
16498
+ (0, import_datalog.rule)(
16499
+ "stepsTo",
16500
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP],
16501
+ [(0, import_datalog.lit)("endsHolding", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"))]
16502
+ ),
16503
+ // An import steps to what the module exports under that name.
16504
+ (0, import_datalog.rule)(
16505
+ "stepsTo",
16506
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("value"), VALUE_STEP],
16507
+ [
16508
+ (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16509
+ (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value"))
16510
+ ]
16511
+ ),
16512
+ // A parameter steps to what a call passes it. A function called from
16513
+ // several places leaves its parameter with more than one value, and a
16514
+ // caller that needs those apart asks `paramAt`.
16515
+ (0, import_datalog.rule)(
16516
+ "stepsTo",
16517
+ [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("a"), VALUE_STEP],
16518
+ [(0, import_datalog.lit)("passesArgument", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a"))]
16519
+ ),
16520
+ // Reading a property steps to what the object contains under that
16521
+ // name, whichever way the object arrived: `routes.list` off a name,
16522
+ // or `make(body).handle` off a call.
16523
+ (0, import_datalog.rule)(
16524
+ "stepsTo",
16525
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("held"), VALUE_STEP],
16526
+ [
16527
+ (0, import_datalog.lit)("readsProperty", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("o"), (0, import_datalog.variable)("n")),
16528
+ (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")),
16529
+ (0, import_datalog.lit)("contains", (0, import_datalog.variable)("obj"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held"))
16530
+ ]
16531
+ ),
16532
+ // Calling a class makes one of it, so the call steps to the class and
16533
+ // a method read off the result is the one the class declares. The
16534
+ // caveat below is about a factory function, and a class is not one.
16535
+ (0, import_datalog.rule)(
16536
+ "stepsTo",
16537
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("cls"), VALUE_STEP],
16538
+ [
16539
+ (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16540
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("cls")),
16541
+ (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("cls"))
16542
+ ]
16543
+ ),
16544
+ // Wrapper transparency, derived: calling a factory that returns a
16545
+ // function which calls its parameter k steps to argument k.
16546
+ (0, import_datalog.rule)(
16547
+ "stepsTo",
16548
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("a"), VALUE_STEP],
16549
+ [
16550
+ (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16551
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16552
+ (0, import_datalog.lit)("unwraps", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k")),
16553
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16554
+ ]
16555
+ ),
16556
+ // Wrapper transparency, declared: a pack says this callee wraps
16557
+ // argument k. The callee has to come from the library the pack said,
16558
+ // so a local object spelled the same way is not mistaken for it.
16559
+ (0, import_datalog.rule)(
16560
+ "stepsTo",
16561
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("a"), VALUE_STEP],
16562
+ [
16563
+ (0, import_datalog.lit)("calleeName", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n")),
16564
+ (0, import_datalog.lit)("unwrapsByName", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("k")),
16565
+ (0, import_datalog.lit)("wrapperModule", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("m")),
16566
+ (0, import_datalog.lit)("calleeOrigin", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("m")),
16567
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16568
+ ]
16569
+ ),
16570
+ // The one step that runs a function forwards: a call steps to what
16571
+ // the function it invokes returns.
16572
+ (0, import_datalog.rule)(
16573
+ "stepsTo",
16574
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("ret"), RESULT_STEP],
16575
+ [(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"))]
16576
+ ),
16577
+ // Where a walk gets to, and whether it ran a call on the way. A value
16578
+ // step keeps whatever the rest of the walk was, and a result step
16579
+ // makes the whole walk one that ran a call.
16580
+ (0, import_datalog.rule)(
16581
+ "reaches",
16582
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind")],
16583
+ [(0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind"))]
16584
+ ),
16585
+ (0, import_datalog.rule)(
16586
+ "reaches",
16587
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind")],
16588
+ [
16589
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP),
16590
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), (0, import_datalog.variable)("kind"))
16591
+ ]
16592
+ ),
16593
+ // Two rules rather than one leaving the rest of the walk's kind free.
16594
+ // A free kind is a second question about the same relation, and a
16595
+ // demand-driven run then derives both to answer either.
16596
+ (0, import_datalog.rule)(
16597
+ "reaches",
16598
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP],
16599
+ [
16600
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), RESULT_STEP),
16601
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), VALUE_STEP)
16602
+ ]
16603
+ ),
16604
+ (0, import_datalog.rule)(
16605
+ "reaches",
16606
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z"), RESULT_STEP],
16607
+ [
16608
+ (0, import_datalog.lit)("stepsTo", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), RESULT_STEP),
16609
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("z"), RESULT_STEP)
16610
+ ]
16611
+ ),
16612
+ // What a value comes down to: the walk that never ran a call, stopped
16613
+ // at a function or an object. Something already written out comes to
16614
+ // itself, and every other walk ends at one of those.
16417
16615
  (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"))]),
16418
16616
  (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"))]),
16419
- // Aliasing: const x = y, or an identifier referencing a declaration.
16420
16617
  (0, import_datalog.rule)(
16421
16618
  "comesTo",
16422
16619
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16423
- [(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"))]
16620
+ [(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"))]
16424
16621
  ),
16425
- // A name written more than once has the value the last write left
16426
- // there, and `binds` says nothing about it. The adapter works out
16427
- // which write that is, in its own language's terms, and stays quiet
16428
- // when control flow decides. A name it stays quiet about comes to no
16429
- // value, which is the answer.
16430
16622
  (0, import_datalog.rule)(
16431
16623
  "comesTo",
16432
16624
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16433
- [(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"))]
16625
+ [(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"))]
16434
16626
  ),
16435
- // An import comes to what the module exports under that name.
16627
+ // The same stopping condition, for the walk that ran a call. A call
16628
+ // gets no `comesTo` answer on purpose: coming back with what a
16629
+ // factory returned would fight the unwrapping answer.
16436
16630
  (0, import_datalog.rule)(
16437
- "comesTo",
16631
+ "givesBack",
16632
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16633
+ [(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"))]
16634
+ ),
16635
+ (0, import_datalog.rule)(
16636
+ "givesBack",
16438
16637
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16638
+ [(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"))]
16639
+ ),
16640
+ // Following a value to the expression it is written as, whatever kind
16641
+ // that is. A GraphQL document is neither a function nor an object, so
16642
+ // `comesTo` never reaches one.
16643
+ (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"))]),
16644
+ (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"))]),
16645
+ (0, import_datalog.rule)(
16646
+ "isWrittenAs",
16647
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16648
+ [(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"))]
16649
+ ),
16650
+ (0, import_datalog.rule)(
16651
+ "isWrittenAs",
16652
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16653
+ [(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"))]
16654
+ ),
16655
+ // What one call site put in a parameter, told apart from what the
16656
+ // other callers passed.
16657
+ (0, import_datalog.rule)(
16658
+ "paramAt",
16659
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16439
16660
  [
16440
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16441
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value")),
16442
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("z"))
16661
+ (0, import_datalog.lit)("passesArgument", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")),
16662
+ (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16663
+ ]
16664
+ ),
16665
+ // An argument arriving at the parameter it is passed to, by position
16666
+ // or by the name the caller wrote, keeping the call it went through
16667
+ // so `paramAt` can tell two call sites apart.
16668
+ (0, import_datalog.rule)(
16669
+ "passesArgument",
16670
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")],
16671
+ [
16672
+ (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p")),
16673
+ (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16674
+ (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a"))
16675
+ ]
16676
+ ),
16677
+ (0, import_datalog.rule)(
16678
+ "passesArgument",
16679
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("p"), (0, import_datalog.variable)("a")],
16680
+ [
16681
+ (0, import_datalog.lit)("paramNamed", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("p")),
16682
+ (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16683
+ (0, import_datalog.lit)("callKeywordArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("a"))
16443
16684
  ]
16444
16685
  ),
16445
16686
  // What a module exports: directly, or through re-export chains.
@@ -16464,12 +16705,22 @@ var RESOLUTION_RULES = [
16464
16705
  (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value"))
16465
16706
  ]
16466
16707
  ),
16467
- // The object an expression refers to. A name arrives at one by
16468
- // following `comesTo` through aliases and imports. A factory call
16469
- // arrives at one through what the function it calls returns; the
16470
- // call itself is given no `comesTo`, since a factory call usually IS
16471
- // the wrapper and answering with the raw returned function would
16472
- // fight the unwraps answer.
16708
+ // The function a call runs, written from the call's side because a
16709
+ // caller asking what a call gives back has the call in hand.
16710
+ (0, import_datalog.rule)(
16711
+ "invokes",
16712
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")],
16713
+ [(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"))]
16714
+ ),
16715
+ // The callee is itself a call: `daoBuilder()()`.
16716
+ (0, import_datalog.rule)(
16717
+ "invokes",
16718
+ [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")],
16719
+ [(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"))]
16720
+ ),
16721
+ // The object an expression refers to: a name through `comesTo`, a
16722
+ // factory call through what it gives back. Naming the step is what
16723
+ // makes `routes.list` and `make(body).handle` one rule.
16473
16724
  (0, import_datalog.rule)(
16474
16725
  "objectOf",
16475
16726
  [(0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")],
@@ -16477,14 +16728,8 @@ var RESOLUTION_RULES = [
16477
16728
  ),
16478
16729
  (0, import_datalog.rule)(
16479
16730
  "objectOf",
16480
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("obj")],
16481
- [
16482
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16483
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16484
- (0, import_datalog.lit)("returnsValue", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("ret")),
16485
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("ret"), (0, import_datalog.variable)("obj")),
16486
- (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("obj"))
16487
- ]
16731
+ [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("obj")],
16732
+ [(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"))]
16488
16733
  ),
16489
16734
  // Which calls a function, found by the name the call is written as
16490
16735
  // rather than by resolving every callee in the project. A caller knows
@@ -16517,42 +16762,6 @@ var RESOLUTION_RULES = [
16517
16762
  (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c"))
16518
16763
  ]
16519
16764
  ),
16520
- // A function whose return is itself a call arrives at the same object
16521
- // that call does, so a chain passing through two factories settles.
16522
- (0, import_datalog.rule)(
16523
- "objectOf",
16524
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("obj")],
16525
- [
16526
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16527
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16528
- (0, import_datalog.lit)("returnsValue", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("ret")),
16529
- (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("ret"), (0, import_datalog.variable)("obj"))
16530
- ]
16531
- ),
16532
- // An argument reaches the parameter it is passed to, by position or
16533
- // by the name the caller wrote. A function called from several places
16534
- // leaves its parameter with more than one value, and the caller
16535
- // decides what to do about that.
16536
- (0, import_datalog.rule)(
16537
- "comesTo",
16538
- [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16539
- [
16540
- (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p")),
16541
- (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16542
- (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a")),
16543
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16544
- ]
16545
- ),
16546
- (0, import_datalog.rule)(
16547
- "comesTo",
16548
- [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("z")],
16549
- [
16550
- (0, import_datalog.lit)("paramNamed", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("p")),
16551
- (0, import_datalog.lit)("callsFunction", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("f")),
16552
- (0, import_datalog.lit)("callKeywordArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("a")),
16553
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("z"))
16554
- ]
16555
- ),
16556
16765
  // What an object contains, its base class included, so a method the base
16557
16766
  // declares is found on a subclass that never overrode it. A method both
16558
16767
  // declare gives two, and the caller decides. This is its own relation
@@ -16572,33 +16781,8 @@ var RESOLUTION_RULES = [
16572
16781
  (0, import_datalog.lit)("contains", (0, import_datalog.variable)("baseCls"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held"))
16573
16782
  ]
16574
16783
  ),
16575
- // Calling a class makes one of it, and reading a method off the
16576
- // result finds the method the class declares. The caveat above is
16577
- // about a factory function, and a class is not one.
16578
- (0, import_datalog.rule)(
16579
- "comesTo",
16580
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("cls")],
16581
- [
16582
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16583
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("cls")),
16584
- (0, import_datalog.lit)("objectValue", (0, import_datalog.variable)("cls"))
16585
- ]
16586
- ),
16587
- // Reading a property comes to what the object holds under that name,
16588
- // whichever way the object arrived: `routes.list` off a name, or
16589
- // `make(body).handle` off a call.
16590
- (0, import_datalog.rule)(
16591
- "comesTo",
16592
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16593
- [
16594
- (0, import_datalog.lit)("readsProperty", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("o"), (0, import_datalog.variable)("n")),
16595
- (0, import_datalog.lit)("objectOf", (0, import_datalog.variable)("o"), (0, import_datalog.variable)("obj")),
16596
- (0, import_datalog.lit)("contains", (0, import_datalog.variable)("obj"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("held")),
16597
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("held"), (0, import_datalog.variable)("z"))
16598
- ]
16599
- ),
16600
- // Wrapper transparency, derived: calling a factory that returns a
16601
- // function which calls its parameter k comes to argument k.
16784
+ // Which function a factory returns, and which of its parameters that
16785
+ // function calls: together they are what makes it a wrapper.
16602
16786
  (0, import_datalog.rule)(
16603
16787
  "returnsFunc",
16604
16788
  [(0, import_datalog.variable)("f"), (0, import_datalog.variable)("g")],
@@ -16659,56 +16843,20 @@ var RESOLUTION_RULES = [
16659
16843
  (0, import_datalog.lit)("paramOf", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("p"))
16660
16844
  ]
16661
16845
  ),
16662
- (0, import_datalog.rule)(
16663
- "comesTo",
16664
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("h")],
16665
- [
16666
- (0, import_datalog.lit)("call", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("c")),
16667
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("c"), (0, import_datalog.variable)("f")),
16668
- (0, import_datalog.lit)("unwraps", (0, import_datalog.variable)("f"), (0, import_datalog.variable)("k")),
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
- // Wrapper transparency, declared: a pack says this callee wraps
16674
- // argument k, whatever its implementation looks like. The callee has
16675
- // to have been imported from the library the pack named, so a local
16676
- // object spelled the same way is not mistaken for it.
16677
- (0, import_datalog.rule)(
16678
- "comesTo",
16679
- [(0, import_datalog.variable)("r"), (0, import_datalog.variable)("h")],
16680
- [
16681
- (0, import_datalog.lit)("calleeName", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("n")),
16682
- (0, import_datalog.lit)("unwrapsByName", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("k")),
16683
- (0, import_datalog.lit)("wrapperModule", (0, import_datalog.variable)("n"), (0, import_datalog.variable)("m")),
16684
- (0, import_datalog.lit)("calleeOrigin", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("m")),
16685
- (0, import_datalog.lit)("callArg", (0, import_datalog.variable)("r"), (0, import_datalog.variable)("k"), (0, import_datalog.variable)("a")),
16686
- (0, import_datalog.lit)("comesTo", (0, import_datalog.variable)("a"), (0, import_datalog.variable)("h"))
16687
- ]
16688
- ),
16689
16846
  // Where a name comes from, when what it refers to lives outside the
16690
- // source being read. `comesTo` ends at something written out, so it
16691
- // never reaches a library's own function, and a project's alias of a
16692
- // library name has no answer at all. This follows the same aliases
16693
- // and barrels in the other direction and answers with the module and
16694
- // the name that module exports.
16847
+ // source being read. A walk ends at something written out in source,
16848
+ // so it never reaches a library's own function.
16695
16849
  (0, import_datalog.rule)(
16696
16850
  "comesFrom",
16697
16851
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16698
16852
  [(0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))]
16699
16853
  ),
16700
- (0, import_datalog.rule)(
16701
- "comesFrom",
16702
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16703
- [(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"))]
16704
- ),
16705
16854
  (0, import_datalog.rule)(
16706
16855
  "comesFrom",
16707
16856
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],
16708
16857
  [
16709
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n2")),
16710
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m2"), (0, import_datalog.variable)("n2"), (0, import_datalog.variable)("value")),
16711
- (0, import_datalog.lit)("comesFrom", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))
16858
+ (0, import_datalog.lit)("reaches", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("y"), VALUE_STEP),
16859
+ (0, import_datalog.lit)("imports", (0, import_datalog.variable)("y"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"))
16712
16860
  ]
16713
16861
  ),
16714
16862
  // Calling f ends up calling the name n that module m exports. One hop
@@ -16744,36 +16892,6 @@ var RESOLUTION_RULES = [
16744
16892
  "resolves",
16745
16893
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16746
16894
  [(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"))]
16747
- ),
16748
- // Following a name to the expression it is written as. A separate
16749
- // relation rather than a widening of `comesTo`, so a caller asking
16750
- // the older question never sees a new answer: a factory call already
16751
- // has an unwrapping answer, and letting it also answer with itself
16752
- // would make that pair ambiguous.
16753
- //
16754
- // The two seeds are the two ways an expression can be written out. An
16755
- // object literal is one of them, and it is the shape a generated
16756
- // GraphQL document takes.
16757
- (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"))]),
16758
- (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"))]),
16759
- (0, import_datalog.rule)(
16760
- "isWrittenAs",
16761
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16762
- [(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"))]
16763
- ),
16764
- (0, import_datalog.rule)(
16765
- "isWrittenAs",
16766
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16767
- [(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"))]
16768
- ),
16769
- (0, import_datalog.rule)(
16770
- "isWrittenAs",
16771
- [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16772
- [
16773
- (0, import_datalog.lit)("imports", (0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")),
16774
- (0, import_datalog.lit)("moduleExport", (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n"), (0, import_datalog.variable)("value")),
16775
- (0, import_datalog.lit)("isWrittenAs", (0, import_datalog.variable)("value"), (0, import_datalog.variable)("z"))
16776
- ]
16777
16895
  )
16778
16896
  ];
16779
16897
  var RESOLUTION_QUESTIONS = [
@@ -16805,6 +16923,13 @@ var RESOLUTION_QUESTIONS = [
16805
16923
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("z")],
16806
16924
  [(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"))]
16807
16925
  ),
16926
+ // Keyed by the parameter, since that is what a caller has in hand
16927
+ // when it wants the call sites told apart.
16928
+ (0, import_datalog.rule)(
16929
+ "wantedParamAt",
16930
+ [(0, import_datalog.variable)("p"), (0, import_datalog.variable)("r"), (0, import_datalog.variable)("z")],
16931
+ [(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"))]
16932
+ ),
16808
16933
  (0, import_datalog.rule)(
16809
16934
  "wantedComesFrom",
16810
16935
  [(0, import_datalog.variable)("x"), (0, import_datalog.variable)("m"), (0, import_datalog.variable)("n")],