@suss/ir-core 0.19.0 → 0.21.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.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-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';
2
+ import { T as TypeShape, M as MessageBusSemantics, D as DeployableUnit, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology } from './schemas-Dn1AzzWd.cjs';
3
+ export { f as DeployableUnitSchema, E as EVERY_FIELD, 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 storageContainerLabel, y as storageLabel, z as typeDefinitionKey, A as withDefinitionsInlined } from './schemas-Dn1AzzWd.cjs';
4
4
 
5
5
  /**
6
6
  * Comparing two TypeShapes structurally.
@@ -101,6 +101,12 @@ interface BoundaryBehavior<S extends {
101
101
  sidesAgree?(a: S, b: S): boolean;
102
102
  /** The line a reader sees for this boundary. Defaults to `identityKey`. */
103
103
  displayLabel?(semantics: S): string | null;
104
+ /**
105
+ * The semantics with any filesystem path it states rewritten, for
106
+ * the pass that makes a summary's paths project-relative. A
107
+ * protocol that states no path declares nothing here.
108
+ */
109
+ rewritePaths?(semantics: S, rewrite: (path: string) => string): S;
104
110
  /**
105
111
  * The first protocol whose `claims` returns true normalizes a
106
112
  * hand-written suppression boundary, and a string nobody claims is
@@ -117,6 +123,16 @@ interface BoundaryBehavior<S extends {
117
123
  * does not apply, and unknown means this declaration cannot settle it.
118
124
  */
119
125
  servesRequest?(semantics: S, method: string, path: string): MatchResult;
126
+ /**
127
+ * Whether every request this boundary takes falls inside a pattern
128
+ * something else was registered for. Middleware registered for
129
+ * `/v1/*` runs for `/v1/tenants/{id}` and not for `/health`, so
130
+ * composing it into a unit asks this first.
131
+ *
132
+ * A protocol whose boundaries no pattern addresses leaves this
133
+ * undefined, and nothing registered with a pattern reaches them.
134
+ */
135
+ withinScope?(semantics: S, scope: string): boolean;
120
136
  /**
121
137
  * The same boundary with a name the deployment fills in put in.
122
138
  *
@@ -189,6 +205,15 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
189
205
  readonly [IdentityKeyBrand]: "bus";
190
206
  };
191
207
  declare function busIdentityKey(messageBus: MessageBusSemantics["messageBus"], subject: string): BusIdentityKey;
208
+ /**
209
+ * `unit:platform name`, the key an invoker and the unit it invokes pair
210
+ * on. The platform stays in because two clouds can each deploy
211
+ * something called `Worker` and they are not the same thing.
212
+ */
213
+ type UnitIdentityKey = `unit:${DeployableUnit["deploymentTarget"]} ${string}` & {
214
+ readonly [IdentityKeyBrand]: "unit";
215
+ };
216
+ declare function unitIdentityKey(deploymentTarget: DeployableUnit["deploymentTarget"], instanceName: string): UnitIdentityKey;
192
217
  /** `metric:system type`, the key both sides of a metric pair on. */
193
218
  type MetricIdentityKey = `metric:${string} ${string}` & {
194
219
  readonly [IdentityKeyBrand]: "metric";
@@ -202,6 +227,25 @@ declare const MetricSemanticsSchema: z.ZodObject<{
202
227
  }, z.core.$strip>;
203
228
  type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
204
229
 
230
+ /**
231
+ * `instanceName` is nullable here and required on the unit itself,
232
+ * because only the provider always knows the name. A call that works
233
+ * its callee out at run time still happened, and recording it with no
234
+ * name says so without pairing it against everything.
235
+ */
236
+ declare const UnitInvocationSemanticsSchema: z.ZodObject<{
237
+ deploymentTarget: z.ZodEnum<{
238
+ lambda: "lambda";
239
+ "ecs-task": "ecs-task";
240
+ container: "container";
241
+ "k8s-deployment": "k8s-deployment";
242
+ worker: "worker";
243
+ }>;
244
+ name: z.ZodLiteral<"unit-invocation">;
245
+ instanceName: z.ZodNullable<z.ZodString>;
246
+ }, z.core.$strip>;
247
+ type UnitInvocationSemantics = z.infer<typeof UnitInvocationSemanticsSchema>;
248
+
205
249
  /**
206
250
  * A boundary binding read as OpenTelemetry attributes.
207
251
  *
@@ -236,7 +280,24 @@ declare function semconvAttributes(binding: BoundaryBinding): Record<string, str
236
280
  * rather than in either checker.
237
281
  */
238
282
 
283
+ /**
284
+ * Whether a binding is of one protocol, narrowed to that protocol's
285
+ * own semantics when it is. A caller reaching through the binding to
286
+ * compare the name by hand gets `string | undefined` and no narrowing,
287
+ * so a name that no protocol uses compiles and quietly never matches.
288
+ */
289
+ declare function bindingIs<N extends Semantics["name"]>(binding: BoundaryBinding | null | undefined, name: N): binding is BoundaryBinding & {
290
+ semantics: Extract<Semantics, {
291
+ name: N;
292
+ }>;
293
+ };
239
294
  declare function boundaryKey(binding: BoundaryBinding): string | null;
295
+ /**
296
+ * The binding with any filesystem path its semantics state rewritten.
297
+ * The CLI uses it to make a summary's paths project-relative, and each
298
+ * protocol says for itself whether it states one.
299
+ */
300
+ declare function withRewrittenPaths(binding: BoundaryBinding, rewrite: (path: string) => string): BoundaryBinding;
240
301
  /**
241
302
  * The bucket a boundary pairs in, with any name the deployment fills in
242
303
  * put in first.
@@ -270,6 +331,12 @@ declare function reportsUnpairedItself(binding: BoundaryBinding): boolean;
270
331
  * unknown means it does, but this declaration cannot settle the question.
271
332
  */
272
333
  declare function servesRequest(binding: BoundaryBinding, method: string, path: string): MatchResult | null;
334
+ /**
335
+ * Whether a wrapper registered for `scope` runs for this boundary.
336
+ * False for a protocol whose boundaries no pattern addresses, so a
337
+ * scoped registration reaches nothing it cannot be shown to cover.
338
+ */
339
+ declare function withinScope(binding: BoundaryBinding, scope: string): boolean;
273
340
 
274
341
  /**
275
342
  * The boundary-name syntax, parsed and printed in one place.
@@ -380,6 +447,52 @@ declare function referenceOf(name: BoundaryName): Reference | null;
380
447
  */
381
448
  declare function referenceFromName(name: string): Reference | null;
382
449
 
450
+ /**
451
+ * How somebody spells a boundary they want to talk about, and whether
452
+ * what they wrote picks out a given one.
453
+ *
454
+ * The words get cut into tokens, the boundary does too, and a boundary
455
+ * matches when it has every token somebody wrote. So
456
+ * `aws.dynamodb:editions` matches the table and every index on it, and
457
+ * adding `#by-publication` narrows it to the one index.
458
+ *
459
+ * `suss ask`, `suss check --at` and an intent document that says which
460
+ * store a write reaches all read this, so the question and the
461
+ * assertion are spelled and resolved the same way.
462
+ */
463
+
464
+ /**
465
+ * The name inside a fully-qualified cloud resource id, and anything
466
+ * else unchanged.
467
+ *
468
+ * `arn:aws:lambda:us-east-1:1234:function:prod-worker` and
469
+ * `projects/p/locations/l/functions/prod-worker` say the same thing as
470
+ * `prod-worker` plus an account and a region. Keeping the whole string
471
+ * makes one deployment's spelling of a resource disagree with
472
+ * another's, so every reader that meets one reduces it here and the two
473
+ * sides compare the part they can both know. A Lambda ARN's trailing
474
+ * alias or version comes off with the rest: the function is the
475
+ * boundary whichever published copy a call reaches.
476
+ */
477
+ declare function resourceNameIn(spelling: string): string;
478
+ /**
479
+ * The words in a boundary spelling. Separators between parts of a name
480
+ * are cut, and the characters inside one part are left alone, so
481
+ * `by-publication` stays one word and `{id}` and `:id` both come out as
482
+ * `id`.
483
+ */
484
+ declare function spellingTokens(text: string): string[];
485
+ /** Every word this boundary can be asked about by. */
486
+ declare function bindingTokens(binding: BoundaryBinding): Set<string>;
487
+ /**
488
+ * Whether what somebody typed is the whole of this boundary's name
489
+ * rather than part of it. `POST /articles` is exactly the collection
490
+ * route and only part of `POST /articles/{slug}/comments`.
491
+ */
492
+ declare function namesBoundaryExactly(subject: string, binding: BoundaryBinding): boolean;
493
+ /** Whether what somebody typed picks out this boundary. */
494
+ declare function namesBoundary(subject: string, binding: BoundaryBinding): boolean;
495
+
383
496
  /**
384
497
  * Deciding when two message-bus channel strings mean the same thing.
385
498
  *
@@ -462,6 +575,37 @@ declare function dispatchByType<T extends {
462
575
  type: string;
463
576
  }, R>(table: DispatchTable<T, R>, value: T): R;
464
577
 
578
+ /**
579
+ * What a unit does at a boundary, in the words `suss ask` asks with.
580
+ *
581
+ * `what writes postgresql:invoices` is the question and "this outcome
582
+ * writes postgresql:invoices" is the assertion, so the report, the
583
+ * question parser and an intent doc all have to spell the verbs the
584
+ * same way. They are here rather than beside any one of them.
585
+ *
586
+ * `provides` is the unit's own boundary; `reads`, `writes` and
587
+ * `invokes` are what a call site does at somebody else's. Calling a
588
+ * deployed unit by name is one act, so it gets a verb of its own.
589
+ */
590
+
591
+ declare const RelationSchema: z.ZodEnum<{
592
+ provides: "provides";
593
+ reads: "reads";
594
+ writes: "writes";
595
+ invokes: "invokes";
596
+ }>;
597
+ type Relation = z.infer<typeof RelationSchema>;
598
+ /**
599
+ * The verbs an effect can have. A boundary a unit serves is not an
600
+ * effect of the unit, so `provides` is not one of them.
601
+ */
602
+ declare const EffectRelationSchema: z.ZodEnum<{
603
+ reads: "reads";
604
+ writes: "writes";
605
+ invokes: "invokes";
606
+ }>;
607
+ type EffectRelation = z.infer<typeof EffectRelationSchema>;
608
+
465
609
  /**
466
610
  * The suppression pipeline, over the smallest finding both checkers share.
467
611
  *
@@ -698,6 +842,18 @@ declare function runtimeConfigBinding(opts: {
698
842
  deploymentTarget: DeployableUnit["deploymentTarget"];
699
843
  instanceName: string;
700
844
  }): BoundaryBinding;
845
+ /**
846
+ * Build a unit-invocation binding, the boundary between a deployed unit
847
+ * and whatever calls it by name. Transport is `"invoke"` because the
848
+ * call goes through the platform's own invoke API whichever cloud runs
849
+ * the unit.
850
+ */
851
+ declare function unitInvocationBinding(opts: {
852
+ recognition: string;
853
+ deploymentTarget: DeployableUnit["deploymentTarget"];
854
+ /** Null when this source does not say which unit it invokes. */
855
+ instanceName: string | null;
856
+ }): BoundaryBinding;
701
857
  /**
702
858
  * Build a storage binding, the side of a store that both a schema
703
859
  * reader and a call site can spell. `transport` defaults to the store's
@@ -736,4 +892,4 @@ declare function metricBinding(opts: {
736
892
  metricType: string | null;
737
893
  }): BoundaryBinding;
738
894
 
739
- export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, type BoundaryName, type BoundarySemanticsDefinition, type BusIdentityKey, type Channel, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, DeployableUnit, type DispatchTable, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, type NamePart, type ParsedChannel, type Reference, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, boundaryNameString, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseBoundaryName, parseChannel, pathAfterOrigin, patternHole, referenceFromName, referenceName, referenceOf, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, statesAnOrigin, storageBinding, validateRule };
895
+ export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, type BoundaryName, type BoundarySemanticsDefinition, type BusIdentityKey, type Channel, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, DeployableUnit, type DispatchTable, type EffectRelation, EffectRelationSchema, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, type NamePart, type ParsedChannel, type Reference, type Relation, RelationSchema, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, type UnitIdentityKey, type UnitInvocationSemantics, UnitInvocationSemanticsSchema, applySuppressionsToFindings, bindingIs, bindingTokens, bodyShapesMatch, boundaryKey, boundaryLabel, boundaryNameString, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesBoundary, namesBoundaryExactly, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseBoundaryName, parseChannel, pathAfterOrigin, patternHole, referenceFromName, referenceName, referenceOf, reportsUnpairedItself, resourceNameIn, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, spellingTokens, statesAnOrigin, storageBinding, unitIdentityKey, unitInvocationBinding, validateRule, withRewrittenPaths, withinScope };
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-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';
2
+ import { T as TypeShape, M as MessageBusSemantics, D as DeployableUnit, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology } from './schemas-Dn1AzzWd.js';
3
+ export { f as DeployableUnitSchema, E as EVERY_FIELD, 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 storageContainerLabel, y as storageLabel, z as typeDefinitionKey, A as withDefinitionsInlined } from './schemas-Dn1AzzWd.js';
4
4
 
5
5
  /**
6
6
  * Comparing two TypeShapes structurally.
@@ -101,6 +101,12 @@ interface BoundaryBehavior<S extends {
101
101
  sidesAgree?(a: S, b: S): boolean;
102
102
  /** The line a reader sees for this boundary. Defaults to `identityKey`. */
103
103
  displayLabel?(semantics: S): string | null;
104
+ /**
105
+ * The semantics with any filesystem path it states rewritten, for
106
+ * the pass that makes a summary's paths project-relative. A
107
+ * protocol that states no path declares nothing here.
108
+ */
109
+ rewritePaths?(semantics: S, rewrite: (path: string) => string): S;
104
110
  /**
105
111
  * The first protocol whose `claims` returns true normalizes a
106
112
  * hand-written suppression boundary, and a string nobody claims is
@@ -117,6 +123,16 @@ interface BoundaryBehavior<S extends {
117
123
  * does not apply, and unknown means this declaration cannot settle it.
118
124
  */
119
125
  servesRequest?(semantics: S, method: string, path: string): MatchResult;
126
+ /**
127
+ * Whether every request this boundary takes falls inside a pattern
128
+ * something else was registered for. Middleware registered for
129
+ * `/v1/*` runs for `/v1/tenants/{id}` and not for `/health`, so
130
+ * composing it into a unit asks this first.
131
+ *
132
+ * A protocol whose boundaries no pattern addresses leaves this
133
+ * undefined, and nothing registered with a pattern reaches them.
134
+ */
135
+ withinScope?(semantics: S, scope: string): boolean;
120
136
  /**
121
137
  * The same boundary with a name the deployment fills in put in.
122
138
  *
@@ -189,6 +205,15 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
189
205
  readonly [IdentityKeyBrand]: "bus";
190
206
  };
191
207
  declare function busIdentityKey(messageBus: MessageBusSemantics["messageBus"], subject: string): BusIdentityKey;
208
+ /**
209
+ * `unit:platform name`, the key an invoker and the unit it invokes pair
210
+ * on. The platform stays in because two clouds can each deploy
211
+ * something called `Worker` and they are not the same thing.
212
+ */
213
+ type UnitIdentityKey = `unit:${DeployableUnit["deploymentTarget"]} ${string}` & {
214
+ readonly [IdentityKeyBrand]: "unit";
215
+ };
216
+ declare function unitIdentityKey(deploymentTarget: DeployableUnit["deploymentTarget"], instanceName: string): UnitIdentityKey;
192
217
  /** `metric:system type`, the key both sides of a metric pair on. */
193
218
  type MetricIdentityKey = `metric:${string} ${string}` & {
194
219
  readonly [IdentityKeyBrand]: "metric";
@@ -202,6 +227,25 @@ declare const MetricSemanticsSchema: z.ZodObject<{
202
227
  }, z.core.$strip>;
203
228
  type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
204
229
 
230
+ /**
231
+ * `instanceName` is nullable here and required on the unit itself,
232
+ * because only the provider always knows the name. A call that works
233
+ * its callee out at run time still happened, and recording it with no
234
+ * name says so without pairing it against everything.
235
+ */
236
+ declare const UnitInvocationSemanticsSchema: z.ZodObject<{
237
+ deploymentTarget: z.ZodEnum<{
238
+ lambda: "lambda";
239
+ "ecs-task": "ecs-task";
240
+ container: "container";
241
+ "k8s-deployment": "k8s-deployment";
242
+ worker: "worker";
243
+ }>;
244
+ name: z.ZodLiteral<"unit-invocation">;
245
+ instanceName: z.ZodNullable<z.ZodString>;
246
+ }, z.core.$strip>;
247
+ type UnitInvocationSemantics = z.infer<typeof UnitInvocationSemanticsSchema>;
248
+
205
249
  /**
206
250
  * A boundary binding read as OpenTelemetry attributes.
207
251
  *
@@ -236,7 +280,24 @@ declare function semconvAttributes(binding: BoundaryBinding): Record<string, str
236
280
  * rather than in either checker.
237
281
  */
238
282
 
283
+ /**
284
+ * Whether a binding is of one protocol, narrowed to that protocol's
285
+ * own semantics when it is. A caller reaching through the binding to
286
+ * compare the name by hand gets `string | undefined` and no narrowing,
287
+ * so a name that no protocol uses compiles and quietly never matches.
288
+ */
289
+ declare function bindingIs<N extends Semantics["name"]>(binding: BoundaryBinding | null | undefined, name: N): binding is BoundaryBinding & {
290
+ semantics: Extract<Semantics, {
291
+ name: N;
292
+ }>;
293
+ };
239
294
  declare function boundaryKey(binding: BoundaryBinding): string | null;
295
+ /**
296
+ * The binding with any filesystem path its semantics state rewritten.
297
+ * The CLI uses it to make a summary's paths project-relative, and each
298
+ * protocol says for itself whether it states one.
299
+ */
300
+ declare function withRewrittenPaths(binding: BoundaryBinding, rewrite: (path: string) => string): BoundaryBinding;
240
301
  /**
241
302
  * The bucket a boundary pairs in, with any name the deployment fills in
242
303
  * put in first.
@@ -270,6 +331,12 @@ declare function reportsUnpairedItself(binding: BoundaryBinding): boolean;
270
331
  * unknown means it does, but this declaration cannot settle the question.
271
332
  */
272
333
  declare function servesRequest(binding: BoundaryBinding, method: string, path: string): MatchResult | null;
334
+ /**
335
+ * Whether a wrapper registered for `scope` runs for this boundary.
336
+ * False for a protocol whose boundaries no pattern addresses, so a
337
+ * scoped registration reaches nothing it cannot be shown to cover.
338
+ */
339
+ declare function withinScope(binding: BoundaryBinding, scope: string): boolean;
273
340
 
274
341
  /**
275
342
  * The boundary-name syntax, parsed and printed in one place.
@@ -380,6 +447,52 @@ declare function referenceOf(name: BoundaryName): Reference | null;
380
447
  */
381
448
  declare function referenceFromName(name: string): Reference | null;
382
449
 
450
+ /**
451
+ * How somebody spells a boundary they want to talk about, and whether
452
+ * what they wrote picks out a given one.
453
+ *
454
+ * The words get cut into tokens, the boundary does too, and a boundary
455
+ * matches when it has every token somebody wrote. So
456
+ * `aws.dynamodb:editions` matches the table and every index on it, and
457
+ * adding `#by-publication` narrows it to the one index.
458
+ *
459
+ * `suss ask`, `suss check --at` and an intent document that says which
460
+ * store a write reaches all read this, so the question and the
461
+ * assertion are spelled and resolved the same way.
462
+ */
463
+
464
+ /**
465
+ * The name inside a fully-qualified cloud resource id, and anything
466
+ * else unchanged.
467
+ *
468
+ * `arn:aws:lambda:us-east-1:1234:function:prod-worker` and
469
+ * `projects/p/locations/l/functions/prod-worker` say the same thing as
470
+ * `prod-worker` plus an account and a region. Keeping the whole string
471
+ * makes one deployment's spelling of a resource disagree with
472
+ * another's, so every reader that meets one reduces it here and the two
473
+ * sides compare the part they can both know. A Lambda ARN's trailing
474
+ * alias or version comes off with the rest: the function is the
475
+ * boundary whichever published copy a call reaches.
476
+ */
477
+ declare function resourceNameIn(spelling: string): string;
478
+ /**
479
+ * The words in a boundary spelling. Separators between parts of a name
480
+ * are cut, and the characters inside one part are left alone, so
481
+ * `by-publication` stays one word and `{id}` and `:id` both come out as
482
+ * `id`.
483
+ */
484
+ declare function spellingTokens(text: string): string[];
485
+ /** Every word this boundary can be asked about by. */
486
+ declare function bindingTokens(binding: BoundaryBinding): Set<string>;
487
+ /**
488
+ * Whether what somebody typed is the whole of this boundary's name
489
+ * rather than part of it. `POST /articles` is exactly the collection
490
+ * route and only part of `POST /articles/{slug}/comments`.
491
+ */
492
+ declare function namesBoundaryExactly(subject: string, binding: BoundaryBinding): boolean;
493
+ /** Whether what somebody typed picks out this boundary. */
494
+ declare function namesBoundary(subject: string, binding: BoundaryBinding): boolean;
495
+
383
496
  /**
384
497
  * Deciding when two message-bus channel strings mean the same thing.
385
498
  *
@@ -462,6 +575,37 @@ declare function dispatchByType<T extends {
462
575
  type: string;
463
576
  }, R>(table: DispatchTable<T, R>, value: T): R;
464
577
 
578
+ /**
579
+ * What a unit does at a boundary, in the words `suss ask` asks with.
580
+ *
581
+ * `what writes postgresql:invoices` is the question and "this outcome
582
+ * writes postgresql:invoices" is the assertion, so the report, the
583
+ * question parser and an intent doc all have to spell the verbs the
584
+ * same way. They are here rather than beside any one of them.
585
+ *
586
+ * `provides` is the unit's own boundary; `reads`, `writes` and
587
+ * `invokes` are what a call site does at somebody else's. Calling a
588
+ * deployed unit by name is one act, so it gets a verb of its own.
589
+ */
590
+
591
+ declare const RelationSchema: z.ZodEnum<{
592
+ provides: "provides";
593
+ reads: "reads";
594
+ writes: "writes";
595
+ invokes: "invokes";
596
+ }>;
597
+ type Relation = z.infer<typeof RelationSchema>;
598
+ /**
599
+ * The verbs an effect can have. A boundary a unit serves is not an
600
+ * effect of the unit, so `provides` is not one of them.
601
+ */
602
+ declare const EffectRelationSchema: z.ZodEnum<{
603
+ reads: "reads";
604
+ writes: "writes";
605
+ invokes: "invokes";
606
+ }>;
607
+ type EffectRelation = z.infer<typeof EffectRelationSchema>;
608
+
465
609
  /**
466
610
  * The suppression pipeline, over the smallest finding both checkers share.
467
611
  *
@@ -698,6 +842,18 @@ declare function runtimeConfigBinding(opts: {
698
842
  deploymentTarget: DeployableUnit["deploymentTarget"];
699
843
  instanceName: string;
700
844
  }): BoundaryBinding;
845
+ /**
846
+ * Build a unit-invocation binding, the boundary between a deployed unit
847
+ * and whatever calls it by name. Transport is `"invoke"` because the
848
+ * call goes through the platform's own invoke API whichever cloud runs
849
+ * the unit.
850
+ */
851
+ declare function unitInvocationBinding(opts: {
852
+ recognition: string;
853
+ deploymentTarget: DeployableUnit["deploymentTarget"];
854
+ /** Null when this source does not say which unit it invokes. */
855
+ instanceName: string | null;
856
+ }): BoundaryBinding;
701
857
  /**
702
858
  * Build a storage binding, the side of a store that both a schema
703
859
  * reader and a call site can spell. `transport` defaults to the store's
@@ -736,4 +892,4 @@ declare function metricBinding(opts: {
736
892
  metricType: string | null;
737
893
  }): BoundaryBinding;
738
894
 
739
- export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, type BoundaryName, type BoundarySemanticsDefinition, type BusIdentityKey, type Channel, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, DeployableUnit, type DispatchTable, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, type NamePart, type ParsedChannel, type Reference, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, boundaryNameString, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseBoundaryName, parseChannel, pathAfterOrigin, patternHole, referenceFromName, referenceName, referenceOf, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, statesAnOrigin, storageBinding, validateRule };
895
+ export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, type BoundaryName, type BoundarySemanticsDefinition, type BusIdentityKey, type Channel, type ConfidenceInfo, ConfidenceInfoSchema, type ConfidenceLevel, ConfidenceLevelSchema, type ConfidenceSource, ConfidenceSourceSchema, type Corroboration, CorroborationSchema, DeployableUnit, type DispatchTable, type EffectRelation, EffectRelationSchema, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, type NamePart, type ParsedChannel, type Reference, type Relation, RelationSchema, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, type UnitIdentityKey, type UnitInvocationSemantics, UnitInvocationSemanticsSchema, applySuppressionsToFindings, bindingIs, bindingTokens, bodyShapesMatch, boundaryKey, boundaryLabel, boundaryNameString, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesBoundary, namesBoundaryExactly, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseBoundaryName, parseChannel, pathAfterOrigin, patternHole, referenceFromName, referenceName, referenceOf, reportsUnpairedItself, resourceNameIn, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, spellingTokens, statesAnOrigin, storageBinding, unitIdentityKey, unitInvocationBinding, validateRule, withRewrittenPaths, withinScope };