@suss/ir-core 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/schemas.cjs CHANGED
@@ -40,10 +40,10 @@ __export(schemas_exports, {
40
40
  withDefinitionsInlined: () => withDefinitionsInlined
41
41
  });
42
42
  module.exports = __toCommonJS(schemas_exports);
43
- var import_zod10 = require("zod");
43
+ var import_zod11 = require("zod");
44
44
 
45
45
  // src/semantics/registry.ts
46
- var import_zod9 = require("zod");
46
+ var import_zod10 = require("zod");
47
47
 
48
48
  // src/semantics/functionCall.ts
49
49
  var import_zod = require("zod");
@@ -58,6 +58,9 @@ function fnIdentityKey(packageName, exportPath) {
58
58
  function busIdentityKey(messageBus, subject) {
59
59
  return `bus:${messageBus} ${subject}`;
60
60
  }
61
+ function metricIdentityKey(metricSystem, metricType) {
62
+ return `metric:${metricSystem} ${metricType}`;
63
+ }
61
64
 
62
65
  // src/semantics/definition.ts
63
66
  function defineBoundarySemantics(definition) {
@@ -99,6 +102,9 @@ var FunctionCallSemanticsSchema = import_zod.z.object({
99
102
  var functionCallSemantics = defineBoundarySemantics({
100
103
  name: "function-call",
101
104
  schema: FunctionCallSemanticsSchema,
105
+ // A call that never leaves the process does not produce a span, and
106
+ // the conventions do not name one. All of it is ours.
107
+ semconv: {},
102
108
  behavior: {
103
109
  /** A call returns a value, which is not a status and a body. */
104
110
  exchangesHttpResponses: false,
@@ -134,6 +140,10 @@ var GraphqlOperationSemanticsSchema = import_zod2.z.object({
134
140
  var graphqlOperationSemantics = defineBoundarySemantics({
135
141
  name: "graphql-operation",
136
142
  schema: GraphqlOperationSemanticsSchema,
143
+ semconv: {
144
+ operationName: { name: "graphql.operation.name" },
145
+ operationType: { name: "graphql.operation.type" }
146
+ },
137
147
  behavior: {
138
148
  /**
139
149
  * An operation gets a data-and-errors document back, which the
@@ -167,6 +177,9 @@ var GraphqlResolverSemanticsSchema = import_zod3.z.object({
167
177
  var graphqlResolverSemantics = defineBoundarySemantics({
168
178
  name: "graphql-resolver",
169
179
  schema: GraphqlResolverSemanticsSchema,
180
+ // The conventions name the operation a client sent, not the
181
+ // resolver the server ran for one field of it.
182
+ semconv: {},
170
183
  behavior: {
171
184
  /** A resolver returns a field value, not a status and a body. */
172
185
  exchangesHttpResponses: false,
@@ -209,8 +222,11 @@ function channelsPair(a, b) {
209
222
  var MessageBusSemanticsSchema = import_zod4.z.object({
210
223
  name: import_zod4.z.literal("message-bus"),
211
224
  messageBus: import_zod4.z.enum([
212
- "sqs",
213
- "sns",
225
+ // The conventions spell the two AWS buses this way, one with an
226
+ // underscore and one with a dot, so these are their strings and
227
+ // not a typo.
228
+ "aws_sqs",
229
+ "aws.sns",
214
230
  "s3",
215
231
  "eventbridge",
216
232
  "bullmq",
@@ -231,6 +247,10 @@ var MessageBusSemanticsSchema = import_zod4.z.object({
231
247
  var messageBusSemantics = defineBoundarySemantics({
232
248
  name: "message-bus",
233
249
  schema: MessageBusSemanticsSchema,
250
+ semconv: {
251
+ messageBus: { name: "messaging.system" },
252
+ channel: { name: "messaging.destination.name" }
253
+ },
234
254
  behavior: {
235
255
  /** A message goes onto the channel and nothing comes back. */
236
256
  exchangesHttpResponses: false,
@@ -289,25 +309,58 @@ var messageBusSemantics = defineBoundarySemantics({
289
309
  }
290
310
  });
291
311
 
292
- // src/semantics/rest.ts
312
+ // src/semantics/metric.ts
293
313
  var import_zod5 = require("zod");
294
- var RestSemanticsSchema = import_zod5.z.object({
295
- name: import_zod5.z.literal("rest"),
314
+ var MetricSemanticsSchema = import_zod5.z.object({
315
+ name: import_zod5.z.literal("metric"),
316
+ /** Which system the series lives in: cloud-monitoring, cloudwatch. */
317
+ metricSystem: import_zod5.z.string(),
318
+ /**
319
+ * The type string the system knows the metric by, spelled the way
320
+ * both sides spell it. Null when the source states one this reader
321
+ * could not settle, as with a query it could not read: a metric
322
+ * nobody could name pairs with nothing rather than with whatever
323
+ * happens to share its source text.
324
+ */
325
+ metricType: import_zod5.z.string().nullable()
326
+ });
327
+ var metricSemantics = defineBoundarySemantics({
328
+ name: "metric",
329
+ schema: MetricSemanticsSchema,
330
+ // OpenTelemetry knows a metric by its instrument name, and has no
331
+ // attribute for the system it lives in or the type string it goes by.
332
+ semconv: {},
333
+ behavior: {
334
+ exchangesHttpResponses: false,
335
+ reportsUnpairedItself: false,
336
+ identityKey(semantics) {
337
+ if (semantics.metricType === null) {
338
+ return null;
339
+ }
340
+ return metricIdentityKey(semantics.metricSystem, semantics.metricType);
341
+ }
342
+ }
343
+ });
344
+
345
+ // src/semantics/rest.ts
346
+ var import_zod6 = require("zod");
347
+ var RestSemanticsSchema = import_zod6.z.object({
348
+ name: import_zod6.z.literal("rest"),
296
349
  /**
297
350
  * Uppercase HTTP method ("GET", "POST", …), `"*"` for a handler that
298
351
  * responds to every method, or null when this source does not say
299
352
  * which method.
300
353
  */
301
- method: import_zod5.z.string().min(1).nullable(),
354
+ method: import_zod6.z.string().min(1).nullable(),
302
355
  /** Normalized route path ("/users/{id}"), or null when this source does not give one. */
303
- path: import_zod5.z.string().min(1).nullable(),
356
+ path: import_zod6.z.string().min(1).nullable(),
304
357
  /**
305
358
  * Status codes the producing source explicitly declared (OpenAPI
306
359
  * responses, CFN MethodResponses, ts-rest router statuses). They are
307
360
  * kept here so the pairing layer can see them without unwrapping any
308
361
  * metadata. Absent, or empty, for a source that was inferred.
309
362
  */
310
- declaredResponses: import_zod5.z.array(import_zod5.z.number()).optional()
363
+ declaredResponses: import_zod6.z.array(import_zod6.z.number()).optional()
311
364
  });
312
365
  function normalizePath(path) {
313
366
  let normalized = path.replace(/:([a-zA-Z_]\w*)/g, "{$1}");
@@ -346,6 +399,14 @@ function routePathAdmits(declaredPath, requestPath) {
346
399
  var restSemantics = defineBoundarySemantics({
347
400
  name: "rest",
348
401
  schema: RestSemanticsSchema,
402
+ semconv: {
403
+ // A span states the one method a request used, so a route that
404
+ // responds to every method has nothing to compare.
405
+ method: { name: "http.request.method", placeholderValues: ["*"] },
406
+ path: { name: "http.route" }
407
+ // declaredResponses is a list, and http.response.status_code is
408
+ // the one status a request got back.
409
+ },
349
410
  behavior: {
350
411
  /** A request goes out, a status and a body come back. */
351
412
  exchangesHttpResponses: true,
@@ -418,12 +479,12 @@ var restSemantics = defineBoundarySemantics({
418
479
  });
419
480
 
420
481
  // src/semantics/runtimeConfig.ts
421
- var import_zod7 = require("zod");
482
+ var import_zod8 = require("zod");
422
483
 
423
484
  // src/deployableUnit.ts
424
- var import_zod6 = require("zod");
425
- var DeployableUnitSchema = import_zod6.z.object({
426
- deploymentTarget: import_zod6.z.enum([
485
+ var import_zod7 = require("zod");
486
+ var DeployableUnitSchema = import_zod7.z.object({
487
+ deploymentTarget: import_zod7.z.enum([
427
488
  "lambda",
428
489
  "ecs-task",
429
490
  "container",
@@ -432,16 +493,20 @@ var DeployableUnitSchema = import_zod6.z.object({
432
493
  ]),
433
494
  // An empty name would agree with every other empty name, so a unit
434
495
  // with no name has to leave the field off instead.
435
- instanceName: import_zod6.z.string().min(1)
496
+ instanceName: import_zod7.z.string().min(1)
436
497
  });
437
498
 
438
499
  // src/semantics/runtimeConfig.ts
439
500
  var RuntimeConfigSemanticsSchema = DeployableUnitSchema.extend({
440
- name: import_zod7.z.literal("runtime-config")
501
+ name: import_zod8.z.literal("runtime-config")
441
502
  });
442
503
  var runtimeConfigSemantics = defineBoundarySemantics({
443
504
  name: "runtime-config",
444
505
  schema: RuntimeConfigSemanticsSchema,
506
+ // service.name and cloud.resource_id name the same deployable, but
507
+ // instanceName is the deployment template's logical id, which is
508
+ // neither of those strings.
509
+ semconv: {},
445
510
  behavior: {
446
511
  /** A process reads its config at startup, and nothing replies. */
447
512
  exchangesHttpResponses: false,
@@ -451,28 +516,30 @@ var runtimeConfigSemantics = defineBoundarySemantics({
451
516
  });
452
517
 
453
518
  // src/semantics/storage.ts
454
- var import_zod8 = require("zod");
455
- var StorageSemanticsSchema = import_zod8.z.object({
456
- name: import_zod8.z.literal("storage"),
519
+ var import_zod9 = require("zod");
520
+ var StorageSemanticsSchema = import_zod9.z.object({
521
+ name: import_zod9.z.literal("storage"),
457
522
  /**
458
- * Which store this is: postgres, mysql, sqlite, dynamodb. Two
459
- * products' containers can share a name, so this keeps them apart,
460
- * and it is what a finding message calls the store.
523
+ * Which store this is: postgresql, mysql, aws.dynamodb, or our own
524
+ * word for one OpenTelemetry never named, such as s3. Two products'
525
+ * containers can share a name, so this keeps them apart.
461
526
  */
462
- storageSystem: import_zod8.z.string(),
527
+ storageSystem: import_zod9.z.string(),
463
528
  /**
464
529
  * The ORM, schema, or deployment scope. A single-database setup uses
465
530
  * `"default"`, and a monorepo with several schemas gives each one its
466
531
  * own value.
467
532
  */
468
- scope: import_zod8.z.string(),
533
+ scope: import_zod9.z.string(),
469
534
  /**
470
535
  * The table, bucket, collection, or index, as the source declares
471
536
  * it, or null when the source states one this reader could not
472
537
  * settle. A null container pairs with nothing, rather than with
473
- * whatever its source text happens to spell.
538
+ * whatever its source text happens to spell. The string is in the
539
+ * boundary-name syntax: a literal, a pattern with `{}` holes, or a
540
+ * reference, and `parseBoundaryName` is the one reader of it.
474
541
  */
475
- container: import_zod8.z.string().nullable(),
542
+ container: import_zod9.z.string().nullable(),
476
543
  /**
477
544
  * A secondary way into the container, a DynamoDB global secondary
478
545
  * index or an Elasticsearch alias, each with its own key fields.
@@ -480,11 +547,19 @@ var StorageSemanticsSchema = import_zod8.z.object({
480
547
  * index and a query through the table are different accesses, so
481
548
  * they pair separately.
482
549
  */
483
- accessPath: import_zod8.z.string().nullable()
550
+ accessPath: import_zod9.z.string().nullable()
484
551
  });
485
552
  var storageSemantics = defineBoundarySemantics({
486
553
  name: "storage",
487
554
  schema: StorageSemanticsSchema,
555
+ semconv: {
556
+ storageSystem: { name: "db.system.name" },
557
+ // "default" is our word for a source that named no database.
558
+ scope: { name: "db.namespace", placeholderValues: ["default"] },
559
+ container: { name: "db.collection.name" }
560
+ // A secondary index has no attribute of its own, so accessPath
561
+ // stays our word.
562
+ },
488
563
  behavior: {
489
564
  /** A query returns rows or items, not a status and a body. */
490
565
  exchangesHttpResponses: false,
@@ -494,14 +569,15 @@ var storageSemantics = defineBoundarySemantics({
494
569
  });
495
570
 
496
571
  // src/semantics/registry.ts
497
- var SemanticsSchema = import_zod9.z.discriminatedUnion("name", [
572
+ var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
498
573
  restSemantics.schema,
499
574
  functionCallSemantics.schema,
500
575
  graphqlResolverSemantics.schema,
501
576
  graphqlOperationSemantics.schema,
502
577
  runtimeConfigSemantics.schema,
503
578
  storageSemantics.schema,
504
- messageBusSemantics.schema
579
+ messageBusSemantics.schema,
580
+ metricSemantics.schema
505
581
  ]);
506
582
  var DEFINITIONS = [
507
583
  restSemantics,
@@ -510,38 +586,39 @@ var DEFINITIONS = [
510
586
  graphqlOperationSemantics,
511
587
  runtimeConfigSemantics,
512
588
  storageSemantics,
513
- messageBusSemantics
589
+ messageBusSemantics,
590
+ metricSemantics
514
591
  ];
515
592
  var BY_NAME = new Map(
516
593
  DEFINITIONS.map((d) => [d.name, d])
517
594
  );
518
595
 
519
596
  // src/schemas.ts
520
- var ConfidenceSourceSchema = import_zod10.z.enum([
597
+ var ConfidenceSourceSchema = import_zod11.z.enum([
521
598
  "inferred_static",
522
599
  "inferred_ai",
523
600
  "declared",
524
601
  "derived"
525
602
  ]);
526
- var ConfidenceLevelSchema = import_zod10.z.enum(["high", "medium", "low"]);
527
- var CorroborationSchema = import_zod10.z.object({
528
- outcome: import_zod10.z.enum(["observed", "refuted", "untested"]),
603
+ var ConfidenceLevelSchema = import_zod11.z.enum(["high", "medium", "low"]);
604
+ var CorroborationSchema = import_zod11.z.object({
605
+ outcome: import_zod11.z.enum(["observed", "refuted", "untested"]),
529
606
  /** Executions that produced a verdict for this claim. */
530
- runs: import_zod10.z.number(),
607
+ runs: import_zod11.z.number(),
531
608
  /** Present when refuted: the input and observation that disagreed. */
532
- counterexample: import_zod10.z.unknown().optional(),
609
+ counterexample: import_zod11.z.unknown().optional(),
533
610
  /** Present when untested: why no verdict was reachable. */
534
- reason: import_zod10.z.string().optional()
611
+ reason: import_zod11.z.string().optional()
535
612
  });
536
- var ConfidenceInfoSchema = import_zod10.z.object({
613
+ var ConfidenceInfoSchema = import_zod11.z.object({
537
614
  source: ConfidenceSourceSchema,
538
615
  level: ConfidenceLevelSchema,
539
616
  corroboration: CorroborationSchema.optional()
540
617
  });
541
- var SourceLocationSchema = import_zod10.z.object({
542
- file: import_zod10.z.string(),
543
- range: import_zod10.z.object({ start: import_zod10.z.number(), end: import_zod10.z.number() }),
544
- exportName: import_zod10.z.string().nullable(),
618
+ var SourceLocationSchema = import_zod11.z.object({
619
+ file: import_zod11.z.string(),
620
+ range: import_zod11.z.object({ start: import_zod11.z.number(), end: import_zod11.z.number() }),
621
+ exportName: import_zod11.z.string().nullable(),
545
622
  /**
546
623
  * The project the extract was pointed at, by the name that project
547
624
  * calls itself.
@@ -551,47 +628,47 @@ var SourceLocationSchema = import_zod10.z.object({
551
628
  * summaries puts them on top of each other. This field is what tells
552
629
  * them apart, and what a reader groups by.
553
630
  */
554
- workspace: import_zod10.z.string().optional()
631
+ workspace: import_zod11.z.string().optional()
555
632
  });
556
- var BoundaryBindingSchema = import_zod10.z.object({
557
- transport: import_zod10.z.string(),
633
+ var BoundaryBindingSchema = import_zod11.z.object({
634
+ transport: import_zod11.z.string(),
558
635
  semantics: SemanticsSchema,
559
- recognition: import_zod10.z.string()
636
+ recognition: import_zod11.z.string()
560
637
  });
561
638
  function typeDefinitionKey(ref) {
562
639
  return ref.def ?? null;
563
640
  }
564
- var TypeShapeSchema = import_zod10.z.lazy(
565
- () => import_zod10.z.discriminatedUnion("type", [
566
- import_zod10.z.object({
567
- type: import_zod10.z.literal("record"),
568
- properties: import_zod10.z.record(import_zod10.z.string(), TypeShapeSchema),
569
- spreads: import_zod10.z.array(import_zod10.z.object({ sourceText: import_zod10.z.string() })).optional()
641
+ var TypeShapeSchema = import_zod11.z.lazy(
642
+ () => import_zod11.z.discriminatedUnion("type", [
643
+ import_zod11.z.object({
644
+ type: import_zod11.z.literal("record"),
645
+ properties: import_zod11.z.record(import_zod11.z.string(), TypeShapeSchema),
646
+ spreads: import_zod11.z.array(import_zod11.z.object({ sourceText: import_zod11.z.string() })).optional()
570
647
  }),
571
- import_zod10.z.object({ type: import_zod10.z.literal("dictionary"), values: TypeShapeSchema }),
572
- import_zod10.z.object({ type: import_zod10.z.literal("array"), items: TypeShapeSchema }),
573
- import_zod10.z.object({
574
- type: import_zod10.z.literal("literal"),
575
- value: import_zod10.z.union([import_zod10.z.string(), import_zod10.z.number(), import_zod10.z.boolean()]),
576
- raw: import_zod10.z.string().optional()
648
+ import_zod11.z.object({ type: import_zod11.z.literal("dictionary"), values: TypeShapeSchema }),
649
+ import_zod11.z.object({ type: import_zod11.z.literal("array"), items: TypeShapeSchema }),
650
+ import_zod11.z.object({
651
+ type: import_zod11.z.literal("literal"),
652
+ value: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.number(), import_zod11.z.boolean()]),
653
+ raw: import_zod11.z.string().optional()
577
654
  }),
578
- import_zod10.z.object({ type: import_zod10.z.literal("text") }),
579
- import_zod10.z.object({ type: import_zod10.z.literal("integer") }),
580
- import_zod10.z.object({ type: import_zod10.z.literal("number") }),
581
- import_zod10.z.object({ type: import_zod10.z.literal("boolean") }),
582
- import_zod10.z.object({ type: import_zod10.z.literal("null") }),
583
- import_zod10.z.object({ type: import_zod10.z.literal("undefined") }),
584
- import_zod10.z.object({
585
- type: import_zod10.z.literal("union"),
586
- variants: import_zod10.z.array(TypeShapeSchema)
655
+ import_zod11.z.object({ type: import_zod11.z.literal("text") }),
656
+ import_zod11.z.object({ type: import_zod11.z.literal("integer") }),
657
+ import_zod11.z.object({ type: import_zod11.z.literal("number") }),
658
+ import_zod11.z.object({ type: import_zod11.z.literal("boolean") }),
659
+ import_zod11.z.object({ type: import_zod11.z.literal("null") }),
660
+ import_zod11.z.object({ type: import_zod11.z.literal("undefined") }),
661
+ import_zod11.z.object({
662
+ type: import_zod11.z.literal("union"),
663
+ variants: import_zod11.z.array(TypeShapeSchema)
587
664
  }),
588
- import_zod10.z.object({
589
- type: import_zod10.z.literal("ref"),
590
- name: import_zod10.z.string(),
591
- from: import_zod10.z.string().optional(),
592
- def: import_zod10.z.string().optional()
665
+ import_zod11.z.object({
666
+ type: import_zod11.z.literal("ref"),
667
+ name: import_zod11.z.string(),
668
+ from: import_zod11.z.string().optional(),
669
+ def: import_zod11.z.string().optional()
593
670
  }),
594
- import_zod10.z.object({ type: import_zod10.z.literal("unknown") })
671
+ import_zod11.z.object({ type: import_zod11.z.literal("unknown") })
595
672
  ])
596
673
  );
597
674
  var MAX_DEFINITION_DEPTH = 6;
@@ -1,2 +1,2 @@
1
1
  import 'zod';
2
- export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-BLS4PXwc.cjs';
2
+ export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.cjs';
package/dist/schemas.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'zod';
2
- export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-BLS4PXwc.js';
2
+ export { B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, f as DeployableUnitSchema, g as FunctionCallSemanticsSchema, h as GraphqlOperationSemanticsSchema, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, l as RestSemanticsSchema, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, d as SourceLocationSchema, q as StorageSemanticsSchema, T as TypeShape, r as TypeShapeSchema, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.js';
package/dist/schemas.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  TypeShapeSchema,
18
18
  typeDefinitionKey,
19
19
  withDefinitionsInlined
20
- } from "./chunk-WRRENYBR.js";
20
+ } from "./chunk-HBAMPBAO.js";
21
21
  export {
22
22
  BoundaryBindingSchema,
23
23
  ConfidenceInfoSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/ir-core",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Shared IR primitives for suss — type shapes, boundary bindings, source locations, and confidence. Imported by both @suss/behavioral-ir and @suss/intent-ir so neither depends on the other.",
6
6
  "keywords": [