@suss/ir-core 0.20.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-Dt93kAZT.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-Dt93kAZT.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.
@@ -123,6 +123,16 @@ interface BoundaryBehavior<S extends {
123
123
  * does not apply, and unknown means this declaration cannot settle it.
124
124
  */
125
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;
126
136
  /**
127
137
  * The same boundary with a name the deployment fills in put in.
128
138
  *
@@ -195,6 +205,15 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
195
205
  readonly [IdentityKeyBrand]: "bus";
196
206
  };
197
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;
198
217
  /** `metric:system type`, the key both sides of a metric pair on. */
199
218
  type MetricIdentityKey = `metric:${string} ${string}` & {
200
219
  readonly [IdentityKeyBrand]: "metric";
@@ -208,6 +227,25 @@ declare const MetricSemanticsSchema: z.ZodObject<{
208
227
  }, z.core.$strip>;
209
228
  type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
210
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
+
211
249
  /**
212
250
  * A boundary binding read as OpenTelemetry attributes.
213
251
  *
@@ -242,6 +280,17 @@ declare function semconvAttributes(binding: BoundaryBinding): Record<string, str
242
280
  * rather than in either checker.
243
281
  */
244
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
+ };
245
294
  declare function boundaryKey(binding: BoundaryBinding): string | null;
246
295
  /**
247
296
  * The binding with any filesystem path its semantics state rewritten.
@@ -282,6 +331,12 @@ declare function reportsUnpairedItself(binding: BoundaryBinding): boolean;
282
331
  * unknown means it does, but this declaration cannot settle the question.
283
332
  */
284
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;
285
340
 
286
341
  /**
287
342
  * The boundary-name syntax, parsed and printed in one place.
@@ -392,6 +447,52 @@ declare function referenceOf(name: BoundaryName): Reference | null;
392
447
  */
393
448
  declare function referenceFromName(name: string): Reference | null;
394
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
+
395
496
  /**
396
497
  * Deciding when two message-bus channel strings mean the same thing.
397
498
  *
@@ -474,6 +575,37 @@ declare function dispatchByType<T extends {
474
575
  type: string;
475
576
  }, R>(table: DispatchTable<T, R>, value: T): R;
476
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
+
477
609
  /**
478
610
  * The suppression pipeline, over the smallest finding both checkers share.
479
611
  *
@@ -710,6 +842,18 @@ declare function runtimeConfigBinding(opts: {
710
842
  deploymentTarget: DeployableUnit["deploymentTarget"];
711
843
  instanceName: string;
712
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;
713
857
  /**
714
858
  * Build a storage binding, the side of a store that both a schema
715
859
  * reader and a call site can spell. `transport` defaults to the store's
@@ -748,4 +892,4 @@ declare function metricBinding(opts: {
748
892
  metricType: string | null;
749
893
  }): BoundaryBinding;
750
894
 
751
- 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, withRewrittenPaths };
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-Dt93kAZT.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-Dt93kAZT.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.
@@ -123,6 +123,16 @@ interface BoundaryBehavior<S extends {
123
123
  * does not apply, and unknown means this declaration cannot settle it.
124
124
  */
125
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;
126
136
  /**
127
137
  * The same boundary with a name the deployment fills in put in.
128
138
  *
@@ -195,6 +205,15 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
195
205
  readonly [IdentityKeyBrand]: "bus";
196
206
  };
197
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;
198
217
  /** `metric:system type`, the key both sides of a metric pair on. */
199
218
  type MetricIdentityKey = `metric:${string} ${string}` & {
200
219
  readonly [IdentityKeyBrand]: "metric";
@@ -208,6 +227,25 @@ declare const MetricSemanticsSchema: z.ZodObject<{
208
227
  }, z.core.$strip>;
209
228
  type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
210
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
+
211
249
  /**
212
250
  * A boundary binding read as OpenTelemetry attributes.
213
251
  *
@@ -242,6 +280,17 @@ declare function semconvAttributes(binding: BoundaryBinding): Record<string, str
242
280
  * rather than in either checker.
243
281
  */
244
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
+ };
245
294
  declare function boundaryKey(binding: BoundaryBinding): string | null;
246
295
  /**
247
296
  * The binding with any filesystem path its semantics state rewritten.
@@ -282,6 +331,12 @@ declare function reportsUnpairedItself(binding: BoundaryBinding): boolean;
282
331
  * unknown means it does, but this declaration cannot settle the question.
283
332
  */
284
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;
285
340
 
286
341
  /**
287
342
  * The boundary-name syntax, parsed and printed in one place.
@@ -392,6 +447,52 @@ declare function referenceOf(name: BoundaryName): Reference | null;
392
447
  */
393
448
  declare function referenceFromName(name: string): Reference | null;
394
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
+
395
496
  /**
396
497
  * Deciding when two message-bus channel strings mean the same thing.
397
498
  *
@@ -474,6 +575,37 @@ declare function dispatchByType<T extends {
474
575
  type: string;
475
576
  }, R>(table: DispatchTable<T, R>, value: T): R;
476
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
+
477
609
  /**
478
610
  * The suppression pipeline, over the smallest finding both checkers share.
479
611
  *
@@ -710,6 +842,18 @@ declare function runtimeConfigBinding(opts: {
710
842
  deploymentTarget: DeployableUnit["deploymentTarget"];
711
843
  instanceName: string;
712
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;
713
857
  /**
714
858
  * Build a storage binding, the side of a store that both a schema
715
859
  * reader and a call site can spell. `transport` defaults to the store's
@@ -748,4 +892,4 @@ declare function metricBinding(opts: {
748
892
  metricType: string | null;
749
893
  }): BoundaryBinding;
750
894
 
751
- 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, withRewrittenPaths };
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 };