@suss/ir-core 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,7 +23,7 @@ const binding = restBinding({
23
23
 
24
24
  ## Message-bus channels
25
25
 
26
- A channel is a subject, optionally qualified by the bus that carries it, written `${bus}#${subject}`. Two channels pair when their subjects are equal and their buses agree, and buses agree when they are the same or when either side does not know its bus.
26
+ A channel is a subject, optionally qualified by the bus it travels on, written `${bus}#${subject}`. Two channels pair when their subjects are equal and their buses agree, and buses agree when they are the same or when either side does not know its bus.
27
27
 
28
28
  The two sides rarely know the same amount. A CloudFormation template gives both the bus and the detail-type, and it goes out of its way to distinguish one bus from another, so when a side does know its bus we keep that precision. Code usually knows only the subject: the code pack reads `subject: 'order.placed'` from a handler's config, but which bus actually reaches that handler is deployment configuration the code never mentions. So `default#order.placed` pairs with `order.placed`, while `staging#order.placed` does not pair with `default#order.placed`.
29
29
 
@@ -41,7 +41,7 @@ A container or an access path in a summary is a string that means one of three t
41
41
 
42
42
  `boundaryName.ts` owns the syntax in both directions. `parseBoundaryName` turns a string into the discriminated `BoundaryName` value, `boundaryNameString` turns one back into exactly the string it came from, and everything else, `namesAgree`, `namesNothing`, `fixedTextLength`, `referenceName`, `referenceFromName`, is a view over that pair. Nothing outside the module reads or writes the braces itself: a second parser can disagree about which of the three a string is, and a second printer can spell a value the parser cannot read back. Both have happened. The two halves of caller grounding once spelled a reference differently and never met (#456), which is why writing one and reading one are the same module rather than a format each side implements for itself. `check:name-syntax` in CI keeps it that way.
43
43
 
44
- The wire format is the string. Summaries on disk carry `orders-v1`, `{stage}-orders-v1`, `{location.table}` unchanged, so nothing about this layout is a schema change, and an old summary reads the same as a new one.
44
+ The wire format is the string. Summaries on disk contain `orders-v1`, `{stage}-orders-v1`, `{location.table}` unchanged, so nothing about this layout is a schema change, and an old summary reads the same as a new one.
45
45
 
46
46
  ### How two names pair
47
47
 
@@ -338,6 +338,9 @@ function normalizePath(path) {
338
338
  );
339
339
  return normalized;
340
340
  }
341
+ function pathShape(path) {
342
+ return normalizePath(path).replace(/\{[^}]*\}/g, "{}");
343
+ }
341
344
  function methodsAgree(a, b) {
342
345
  if (a === null || b === null) {
343
346
  return false;
@@ -389,12 +392,17 @@ var restSemantics = defineBoundarySemantics({
389
392
  * settles it inside the bucket. The identity key stays what a reader
390
393
  * sees and a suppression targets ("GET /users", "* /users"), and
391
394
  * this key groups what a reader still tells apart.
395
+ *
396
+ * A parameter's name goes too. A spec written by hand says
397
+ * `{userId}` where the Express route that serves it says `:id`, and
398
+ * both match the same requests, so pairing on the name gave two
399
+ * boundaries that never met and a run with nothing to report.
392
400
  */
393
401
  pairingKey(semantics) {
394
402
  if (semantics.method === null || semantics.path === null) {
395
403
  return null;
396
404
  }
397
- return `rest ${normalizePath(semantics.path)}`;
405
+ return `rest ${pathShape(semantics.path)}`;
398
406
  },
399
407
  sidesAgree(a, b) {
400
408
  return methodsAgree(a.method, b.method);
@@ -712,6 +720,7 @@ export {
712
720
  MetricSemanticsSchema,
713
721
  RestSemanticsSchema,
714
722
  normalizePath,
723
+ pathShape,
715
724
  methodsAgree,
716
725
  routePathAdmits,
717
726
  DeployableUnitSchema,
package/dist/index.cjs CHANGED
@@ -78,6 +78,7 @@ __export(index_exports, {
78
78
  pairingKey: () => pairingKey,
79
79
  parseBoundaryName: () => parseBoundaryName,
80
80
  parseChannel: () => parseChannel,
81
+ pathShape: () => pathShape,
81
82
  patternHole: () => patternHole,
82
83
  referenceFromName: () => referenceFromName,
83
84
  referenceName: () => referenceName,
@@ -437,6 +438,9 @@ function normalizePath(path) {
437
438
  );
438
439
  return normalized;
439
440
  }
441
+ function pathShape(path) {
442
+ return normalizePath(path).replace(/\{[^}]*\}/g, "{}");
443
+ }
440
444
  function methodsAgree(a, b) {
441
445
  if (a === null || b === null) {
442
446
  return false;
@@ -488,12 +492,17 @@ var restSemantics = defineBoundarySemantics({
488
492
  * settles it inside the bucket. The identity key stays what a reader
489
493
  * sees and a suppression targets ("GET /users", "* /users"), and
490
494
  * this key groups what a reader still tells apart.
495
+ *
496
+ * A parameter's name goes too. A spec written by hand says
497
+ * `{userId}` where the Express route that serves it says `:id`, and
498
+ * both match the same requests, so pairing on the name gave two
499
+ * boundaries that never met and a run with nothing to report.
491
500
  */
492
501
  pairingKey(semantics) {
493
502
  if (semantics.method === null || semantics.path === null) {
494
503
  return null;
495
504
  }
496
- return `rest ${normalizePath(semantics.path)}`;
505
+ return `rest ${pathShape(semantics.path)}`;
497
506
  },
498
507
  sidesAgree(a, b) {
499
508
  return methodsAgree(a.method, b.method);
@@ -1449,6 +1458,7 @@ function metricBinding(opts) {
1449
1458
  pairingKey,
1450
1459
  parseBoundaryName,
1451
1460
  parseChannel,
1461
+ pathShape,
1452
1462
  patternHole,
1453
1463
  referenceFromName,
1454
1464
  referenceName,
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-CGR6qjFf.cjs';
3
- export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.cjs';
2
+ import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-k-169oiY.cjs';
3
+ export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as pathShape, w as routePathAdmits, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.cjs';
4
4
 
5
5
  /**
6
6
  * Comparing two TypeShapes structurally.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-CGR6qjFf.js';
3
- export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.js';
2
+ import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-k-169oiY.js';
3
+ export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as pathShape, w as routePathAdmits, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.js';
4
4
 
5
5
  /**
6
6
  * Comparing two TypeShapes structurally.
package/dist/index.js CHANGED
@@ -29,11 +29,12 @@ import {
29
29
  metricIdentityKey,
30
30
  normalizePath,
31
31
  parseChannel,
32
+ pathShape,
32
33
  routePathAdmits,
33
34
  semconvMappingOf,
34
35
  typeDefinitionKey,
35
36
  withDefinitionsInlined
36
- } from "./chunk-HBAMPBAO.js";
37
+ } from "./chunk-AQYS5AC6.js";
37
38
 
38
39
  // src/semconv.ts
39
40
  function semconvAttributes(binding) {
@@ -688,6 +689,7 @@ export {
688
689
  pairingKey,
689
690
  parseBoundaryName,
690
691
  parseChannel,
692
+ pathShape,
691
693
  patternHole,
692
694
  referenceFromName,
693
695
  referenceName,
@@ -173,6 +173,14 @@ type RestSemantics = z.infer<typeof RestSemanticsSchema>;
173
173
  * - Lowercases the static segments (params stay case-sensitive)
174
174
  */
175
175
  declare function normalizePath(path: string): string;
176
+ /**
177
+ * A path with every parameter reduced to its position. `/users/{id}`
178
+ * and `/users/:userId` both come out `/users/{}`, which is the set of
179
+ * requests each one serves, and what deciding whether two sides
180
+ * describe one endpoint rests on. The name a parameter is written
181
+ * under is worth keeping in a report and worth nothing in a comparison.
182
+ */
183
+ declare function pathShape(path: string): string;
176
184
  /**
177
185
  * Whether two REST methods mean the same thing. Equal methods agree,
178
186
  * and `"*"` agrees with any stated method, because a handler that
@@ -443,4 +451,4 @@ declare const TypeShapeSchema: z.ZodType<TypeShape>;
443
451
  */
444
452
  declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
445
453
 
446
- export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, routePathAdmits as v, typeDefinitionKey as w, withDefinitionsInlined as x };
454
+ export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, typeDefinitionKey as x, withDefinitionsInlined as y };
@@ -173,6 +173,14 @@ type RestSemantics = z.infer<typeof RestSemanticsSchema>;
173
173
  * - Lowercases the static segments (params stay case-sensitive)
174
174
  */
175
175
  declare function normalizePath(path: string): string;
176
+ /**
177
+ * A path with every parameter reduced to its position. `/users/{id}`
178
+ * and `/users/:userId` both come out `/users/{}`, which is the set of
179
+ * requests each one serves, and what deciding whether two sides
180
+ * describe one endpoint rests on. The name a parameter is written
181
+ * under is worth keeping in a report and worth nothing in a comparison.
182
+ */
183
+ declare function pathShape(path: string): string;
176
184
  /**
177
185
  * Whether two REST methods mean the same thing. Equal methods agree,
178
186
  * and `"*"` agrees with any stated method, because a handler that
@@ -443,4 +451,4 @@ declare const TypeShapeSchema: z.ZodType<TypeShape>;
443
451
  */
444
452
  declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
445
453
 
446
- export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, routePathAdmits as v, typeDefinitionKey as w, withDefinitionsInlined as x };
454
+ export { BoundaryBindingSchema as B, ConfidenceInfoSchema as C, type DeployableUnit as D, type FunctionCallSemantics as F, type GraphqlOperationSemantics as G, type MessageBusSemantics as M, type RestSemantics as R, type Semantics as S, type TypeShape as T, ConfidenceLevelSchema as a, ConfidenceSourceSchema as b, CorroborationSchema as c, SourceLocationSchema as d, type MessageBusTechnology as e, DeployableUnitSchema as f, FunctionCallSemanticsSchema as g, GraphqlOperationSemanticsSchema as h, type GraphqlResolverSemantics as i, GraphqlResolverSemanticsSchema as j, MessageBusSemanticsSchema as k, RestSemanticsSchema as l, type RuntimeConfigSemantics as m, RuntimeConfigSemanticsSchema as n, SemanticsSchema as o, type StorageSemantics as p, StorageSemanticsSchema as q, TypeShapeSchema as r, ecsContainerInstanceName as s, methodsAgree as t, normalizePath as u, pathShape as v, routePathAdmits as w, typeDefinitionKey as x, withDefinitionsInlined as y };
package/dist/schemas.cjs CHANGED
@@ -373,6 +373,9 @@ function normalizePath(path) {
373
373
  );
374
374
  return normalized;
375
375
  }
376
+ function pathShape(path) {
377
+ return normalizePath(path).replace(/\{[^}]*\}/g, "{}");
378
+ }
376
379
  function methodsAgree(a, b) {
377
380
  if (a === null || b === null) {
378
381
  return false;
@@ -424,12 +427,17 @@ var restSemantics = defineBoundarySemantics({
424
427
  * settles it inside the bucket. The identity key stays what a reader
425
428
  * sees and a suppression targets ("GET /users", "* /users"), and
426
429
  * this key groups what a reader still tells apart.
430
+ *
431
+ * A parameter's name goes too. A spec written by hand says
432
+ * `{userId}` where the Express route that serves it says `:id`, and
433
+ * both match the same requests, so pairing on the name gave two
434
+ * boundaries that never met and a run with nothing to report.
427
435
  */
428
436
  pairingKey(semantics) {
429
437
  if (semantics.method === null || semantics.path === null) {
430
438
  return null;
431
439
  }
432
- return `rest ${normalizePath(semantics.path)}`;
440
+ return `rest ${pathShape(semantics.path)}`;
433
441
  },
434
442
  sidesAgree(a, b) {
435
443
  return methodsAgree(a.method, b.method);
@@ -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-CGR6qjFf.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, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.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-CGR6qjFf.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, x as typeDefinitionKey, y as withDefinitionsInlined } from './schemas-k-169oiY.js';
package/dist/schemas.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  TypeShapeSchema,
18
18
  typeDefinitionKey,
19
19
  withDefinitionsInlined
20
- } from "./chunk-HBAMPBAO.js";
20
+ } from "./chunk-AQYS5AC6.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.10.0",
3
+ "version": "0.12.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": [