@suss/ir-core 0.21.0 → 0.21.1

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
@@ -2,6 +2,155 @@ import { z } from 'zod';
2
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
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
+ /**
6
+ * The boundary-name syntax, parsed and printed in one place.
7
+ *
8
+ * A name in a summary means one of three things, told apart by the
9
+ * braces alone: a literal (`orders-v1`), a pattern with deploy-time
10
+ * holes (`{stage}-orders-v1`), or a reference saying where to go and
11
+ * ask (`{location.bucket}`, `{ORDER_TABLE}`). A second parser can
12
+ * disagree about which is which, and a second printer can spell a
13
+ * value this one cannot read back, so everything that touches the
14
+ * braces calls this module: `parseBoundaryName` and
15
+ * `boundaryNameString` are the two directions, and the helpers below
16
+ * are views over them. The package README tells the longer story,
17
+ * including why REST route paths and message-bus channels stay apart.
18
+ */
19
+ /** One piece of a pattern: text the writer stated, or a hole. */
20
+ type NamePart = {
21
+ type: "text";
22
+ text: string;
23
+ } | {
24
+ type: "hole";
25
+ label: string;
26
+ };
27
+ /**
28
+ * What a name string means. A `reference` keeps its raw dot-separated
29
+ * path, and `referenceOf` is the view that checks the parts are all
30
+ * present, so a malformed spelling still classifies as a reference and
31
+ * still pairs with nothing.
32
+ */
33
+ type BoundaryName = {
34
+ type: "literal";
35
+ value: string;
36
+ } | {
37
+ type: "pattern";
38
+ parts: NamePart[];
39
+ } | {
40
+ type: "reference";
41
+ path: string[];
42
+ };
43
+ /** What a name string means. The exact inverse of `boundaryNameString`. */
44
+ declare function parseBoundaryName(name: string): BoundaryName;
45
+ /** The one serializer. Everything a summary spells goes through here. */
46
+ declare function boundaryNameString(name: BoundaryName): string;
47
+ /**
48
+ * How a hole is spelled. A reader that assembles a pattern a part at a
49
+ * time, the way the adapter's name reader does, mints each hole here
50
+ * so the spelling cannot drift from the parse above.
51
+ */
52
+ declare function patternHole(label: string): string;
53
+ /**
54
+ * The name a CloudFormation `Fn::Sub` value states. The array form
55
+ * takes its template from the first element, and the variable map only
56
+ * says where a substitution comes from, which does not change the name.
57
+ */
58
+ declare function namePatternFromSub(value: unknown): string | null;
59
+ /**
60
+ * Whether a name says only that somebody else knows it. A wrapper that
61
+ * takes its bucket as an argument states `{location.bucket}` and
62
+ * nothing more, which says which parameter to ask rather than which
63
+ * bucket. A name like that agrees with nothing until something grounds
64
+ * it, since otherwise it would agree with every name there is.
65
+ */
66
+ declare function namesNothing(name: string): boolean;
67
+ /** Whether a name has anything a source left for deploy time to fill. */
68
+ declare function hasNameHole(name: string): boolean;
69
+ /**
70
+ * The form two patterns are compared in: every hole reduced to the same
71
+ * token, since the two sides pick their own name for the parameter.
72
+ */
73
+ declare function namePatternKey(name: string): string;
74
+ /** How much of a name the writer stated rather than left for deploy time. */
75
+ declare function fixedTextLength(name: string): number;
76
+ /**
77
+ * Whether two names are the same name. Two patterns agree when their
78
+ * fixed parts line up, since a hole on one side meets a hole on the
79
+ * other. A pattern and a concrete name agree when the fixed parts are
80
+ * where the pattern says they are, which is what happens when one side
81
+ * hardcoded what the other parameterized. A reference agrees with
82
+ * nothing on either side.
83
+ */
84
+ declare function namesAgree(a: string, b: string): boolean;
85
+ /** Where a reference says to go and ask. */
86
+ interface Reference {
87
+ /**
88
+ * The value the code starts from: a parameter of the unit the
89
+ * reference was written in, or a variable the deployment sets. Which
90
+ * of those it is depends on the unit's inputs, so the reader that
91
+ * grounds a reference decides, not the string.
92
+ */
93
+ root: string;
94
+ /** The fields to read inside it, outermost first. */
95
+ fields: string[];
96
+ }
97
+ /**
98
+ * How a reference is written. Null when a part of it is empty, since a
99
+ * reference has to say what to ask about.
100
+ */
101
+ declare function referenceName(reference: Reference): string | null;
102
+ /**
103
+ * The place a parsed reference says to ask, or null for a name that is
104
+ * not a reference, or for a reference with a part missing, which says
105
+ * nothing anybody could answer.
106
+ */
107
+ declare function referenceOf(name: BoundaryName): Reference | null;
108
+ /**
109
+ * The reference a name states, or null when the name states a name
110
+ * rather than where to go and ask.
111
+ */
112
+ declare function referenceFromName(name: string): Reference | null;
113
+
114
+ /**
115
+ * What the deployment running a piece of code fills its variables in
116
+ * with.
117
+ *
118
+ * A queue URL, a function name and a table name only exist once a stack
119
+ * is deployed, so the source reaches them through a variable and the
120
+ * template says what that variable is. Every protocol whose name has a
121
+ * hole in it asks the same two questions here, and whoever knows which
122
+ * deployment runs the code fills them in.
123
+ *
124
+ * The interface is declared next to the protocols because a protocol
125
+ * has to ask without knowing what a summary is. `@suss/behavioral-ir`
126
+ * works the values out from a set of summaries.
127
+ */
128
+
129
+ interface Deployment {
130
+ /**
131
+ * Which variable a reference asks about, or null when what settles it
132
+ * is an argument a caller passes rather than anything the deployment
133
+ * says.
134
+ */
135
+ variableFor(reference: Reference): string | null;
136
+ /**
137
+ * The string this deployment sets that variable to. Null when it sets
138
+ * nothing, and null when two deployments of this code set it to
139
+ * different strings, since picking one of two would be a guess.
140
+ */
141
+ setTo(reference: Reference): string | null;
142
+ /**
143
+ * The declared resource this deployment wires that variable to, by
144
+ * the name the resource is declared under. A template that writes
145
+ * `!Ref ArchiveWorker` says which unit an invoke reaches without ever
146
+ * writing the deployed function's name, and that logical id is what
147
+ * the unit's own summary is keyed by.
148
+ */
149
+ pointsAt(reference: Reference): string | null;
150
+ }
151
+ /** A deployment that settles nothing, for a run with no template in it. */
152
+ declare const NOTHING_DEPLOYED: Deployment;
153
+
5
154
  /**
6
155
  * Comparing two TypeShapes structurally.
7
156
  *
@@ -141,16 +290,25 @@ interface BoundaryBehavior<S extends {
141
290
  * the code. Both parts have to be in before anybody can see that the
142
291
  * two sides describe one boundary.
143
292
  *
144
- * `deployedAs` is already scoped to the unit this boundary belongs to.
145
- * A protocol asks for a variable and gets back what this deployment
146
- * sets it to, or null. Return null to leave the boundary as it is,
293
+ * `deployment` is already scoped to the unit this boundary belongs
294
+ * to. A protocol hands over the reference its name states and gets
295
+ * back what fills it in, or null. Return null to leave it as it is,
147
296
  * which is right whenever nothing needs filling in or nothing can
148
297
  * fill it.
149
298
  *
150
299
  * A protocol whose names are settled in the source leaves this
151
300
  * undefined.
152
301
  */
153
- groundName?(semantics: S, deployedAs: (variable: string) => string | null): S | null;
302
+ groundName?(semantics: S, deployment: Deployment): S | null;
303
+ /**
304
+ * Where this boundary's name says to go and ask, when it says that
305
+ * rather than a name. A caller that has to explain why two sides did
306
+ * not meet reads it to say which input would settle them.
307
+ *
308
+ * A protocol that defines `groundName` defines this too, and the
309
+ * same reference is what `groundName` hands over.
310
+ */
311
+ nameReference?(semantics: S): Reference | null;
154
312
  /**
155
313
  * Whether a provider produces a status and a body that a consumer
156
314
  * reads back. Every protocol has to state this, so that one added
@@ -307,7 +465,23 @@ declare function withRewrittenPaths(binding: BoundaryBinding, rewrite: (path: st
307
465
  * Every protocol that has such a name says how to fill it in, and one
308
466
  * whose names are settled in the source keys exactly as before.
309
467
  */
310
- declare function groundedPairingKey(binding: BoundaryBinding, deployedAs: (variable: string) => string | null): string | null;
468
+ declare function groundedPairingKey(binding: BoundaryBinding, deployment: Deployment): string | null;
469
+ /**
470
+ * The same boundary, with whatever the deployment fills in put in.
471
+ *
472
+ * Everything that reads a boundary's name for a person to see goes
473
+ * through here first: the pairing pass, the drafter that writes an
474
+ * intent document, and the intent checker that reads one back. A step
475
+ * only one of them took would have the drafter write a name the
476
+ * checker then argued with.
477
+ */
478
+ declare function groundBinding(binding: BoundaryBinding, deployment: Deployment): BoundaryBinding;
479
+ /**
480
+ * Where this boundary's name says to go and ask, or null when the
481
+ * source stated a name outright. A report that has to say why two
482
+ * sides did not meet reads it to say which input would settle them.
483
+ */
484
+ declare function nameReference(binding: BoundaryBinding): Reference | null;
311
485
  declare function pairingKey(binding: BoundaryBinding): string | null;
312
486
  declare function semanticsAgree(a: Semantics, b: Semantics): boolean;
313
487
  declare function boundaryLabel(binding: BoundaryBinding): string | null;
@@ -338,115 +512,6 @@ declare function servesRequest(binding: BoundaryBinding, method: string, path: s
338
512
  */
339
513
  declare function withinScope(binding: BoundaryBinding, scope: string): boolean;
340
514
 
341
- /**
342
- * The boundary-name syntax, parsed and printed in one place.
343
- *
344
- * A name in a summary means one of three things, told apart by the
345
- * braces alone: a literal (`orders-v1`), a pattern with deploy-time
346
- * holes (`{stage}-orders-v1`), or a reference saying where to go and
347
- * ask (`{location.bucket}`, `{ORDER_TABLE}`). A second parser can
348
- * disagree about which is which, and a second printer can spell a
349
- * value this one cannot read back, so everything that touches the
350
- * braces calls this module: `parseBoundaryName` and
351
- * `boundaryNameString` are the two directions, and the helpers below
352
- * are views over them. The package README tells the longer story,
353
- * including why REST route paths and message-bus channels stay apart.
354
- */
355
- /** One piece of a pattern: text the writer stated, or a hole. */
356
- type NamePart = {
357
- type: "text";
358
- text: string;
359
- } | {
360
- type: "hole";
361
- label: string;
362
- };
363
- /**
364
- * What a name string means. A `reference` keeps its raw dot-separated
365
- * path, and `referenceOf` is the view that checks the parts are all
366
- * present, so a malformed spelling still classifies as a reference and
367
- * still pairs with nothing.
368
- */
369
- type BoundaryName = {
370
- type: "literal";
371
- value: string;
372
- } | {
373
- type: "pattern";
374
- parts: NamePart[];
375
- } | {
376
- type: "reference";
377
- path: string[];
378
- };
379
- /** What a name string means. The exact inverse of `boundaryNameString`. */
380
- declare function parseBoundaryName(name: string): BoundaryName;
381
- /** The one serializer. Everything a summary spells goes through here. */
382
- declare function boundaryNameString(name: BoundaryName): string;
383
- /**
384
- * How a hole is spelled. A reader that assembles a pattern a part at a
385
- * time, the way the adapter's name reader does, mints each hole here
386
- * so the spelling cannot drift from the parse above.
387
- */
388
- declare function patternHole(label: string): string;
389
- /**
390
- * The name a CloudFormation `Fn::Sub` value states. The array form
391
- * takes its template from the first element, and the variable map only
392
- * says where a substitution comes from, which does not change the name.
393
- */
394
- declare function namePatternFromSub(value: unknown): string | null;
395
- /**
396
- * Whether a name says only that somebody else knows it. A wrapper that
397
- * takes its bucket as an argument states `{location.bucket}` and
398
- * nothing more, which says which parameter to ask rather than which
399
- * bucket. A name like that agrees with nothing until something grounds
400
- * it, since otherwise it would agree with every name there is.
401
- */
402
- declare function namesNothing(name: string): boolean;
403
- /** Whether a name has anything a source left for deploy time to fill. */
404
- declare function hasNameHole(name: string): boolean;
405
- /**
406
- * The form two patterns are compared in: every hole reduced to the same
407
- * token, since the two sides pick their own name for the parameter.
408
- */
409
- declare function namePatternKey(name: string): string;
410
- /** How much of a name the writer stated rather than left for deploy time. */
411
- declare function fixedTextLength(name: string): number;
412
- /**
413
- * Whether two names are the same name. Two patterns agree when their
414
- * fixed parts line up, since a hole on one side meets a hole on the
415
- * other. A pattern and a concrete name agree when the fixed parts are
416
- * where the pattern says they are, which is what happens when one side
417
- * hardcoded what the other parameterized. A reference agrees with
418
- * nothing on either side.
419
- */
420
- declare function namesAgree(a: string, b: string): boolean;
421
- /** Where a reference says to go and ask. */
422
- interface Reference {
423
- /**
424
- * The value the code starts from: a parameter of the unit the
425
- * reference was written in, or a variable the deployment sets. Which
426
- * of those it is depends on the unit's inputs, so the reader that
427
- * grounds a reference decides, not the string.
428
- */
429
- root: string;
430
- /** The fields to read inside it, outermost first. */
431
- fields: string[];
432
- }
433
- /**
434
- * How a reference is written. Null when a part of it is empty, since a
435
- * reference has to say what to ask about.
436
- */
437
- declare function referenceName(reference: Reference): string | null;
438
- /**
439
- * The place a parsed reference says to ask, or null for a name that is
440
- * not a reference, or for a reference with a part missing, which says
441
- * nothing anybody could answer.
442
- */
443
- declare function referenceOf(name: BoundaryName): Reference | null;
444
- /**
445
- * The reference a name states, or null when the name states a name
446
- * rather than where to go and ask.
447
- */
448
- declare function referenceFromName(name: string): Reference | null;
449
-
450
515
  /**
451
516
  * How somebody spells a boundary they want to talk about, and whether
452
517
  * what they wrote picks out a given one.
@@ -892,4 +957,4 @@ declare function metricBinding(opts: {
892
957
  metricType: string | null;
893
958
  }): BoundaryBinding;
894
959
 
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 };
960
+ 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 Deployment, type DispatchTable, type EffectRelation, EffectRelationSchema, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, NOTHING_DEPLOYED, 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, groundBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, nameReference, 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
@@ -2,6 +2,155 @@ import { z } from 'zod';
2
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
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
+ /**
6
+ * The boundary-name syntax, parsed and printed in one place.
7
+ *
8
+ * A name in a summary means one of three things, told apart by the
9
+ * braces alone: a literal (`orders-v1`), a pattern with deploy-time
10
+ * holes (`{stage}-orders-v1`), or a reference saying where to go and
11
+ * ask (`{location.bucket}`, `{ORDER_TABLE}`). A second parser can
12
+ * disagree about which is which, and a second printer can spell a
13
+ * value this one cannot read back, so everything that touches the
14
+ * braces calls this module: `parseBoundaryName` and
15
+ * `boundaryNameString` are the two directions, and the helpers below
16
+ * are views over them. The package README tells the longer story,
17
+ * including why REST route paths and message-bus channels stay apart.
18
+ */
19
+ /** One piece of a pattern: text the writer stated, or a hole. */
20
+ type NamePart = {
21
+ type: "text";
22
+ text: string;
23
+ } | {
24
+ type: "hole";
25
+ label: string;
26
+ };
27
+ /**
28
+ * What a name string means. A `reference` keeps its raw dot-separated
29
+ * path, and `referenceOf` is the view that checks the parts are all
30
+ * present, so a malformed spelling still classifies as a reference and
31
+ * still pairs with nothing.
32
+ */
33
+ type BoundaryName = {
34
+ type: "literal";
35
+ value: string;
36
+ } | {
37
+ type: "pattern";
38
+ parts: NamePart[];
39
+ } | {
40
+ type: "reference";
41
+ path: string[];
42
+ };
43
+ /** What a name string means. The exact inverse of `boundaryNameString`. */
44
+ declare function parseBoundaryName(name: string): BoundaryName;
45
+ /** The one serializer. Everything a summary spells goes through here. */
46
+ declare function boundaryNameString(name: BoundaryName): string;
47
+ /**
48
+ * How a hole is spelled. A reader that assembles a pattern a part at a
49
+ * time, the way the adapter's name reader does, mints each hole here
50
+ * so the spelling cannot drift from the parse above.
51
+ */
52
+ declare function patternHole(label: string): string;
53
+ /**
54
+ * The name a CloudFormation `Fn::Sub` value states. The array form
55
+ * takes its template from the first element, and the variable map only
56
+ * says where a substitution comes from, which does not change the name.
57
+ */
58
+ declare function namePatternFromSub(value: unknown): string | null;
59
+ /**
60
+ * Whether a name says only that somebody else knows it. A wrapper that
61
+ * takes its bucket as an argument states `{location.bucket}` and
62
+ * nothing more, which says which parameter to ask rather than which
63
+ * bucket. A name like that agrees with nothing until something grounds
64
+ * it, since otherwise it would agree with every name there is.
65
+ */
66
+ declare function namesNothing(name: string): boolean;
67
+ /** Whether a name has anything a source left for deploy time to fill. */
68
+ declare function hasNameHole(name: string): boolean;
69
+ /**
70
+ * The form two patterns are compared in: every hole reduced to the same
71
+ * token, since the two sides pick their own name for the parameter.
72
+ */
73
+ declare function namePatternKey(name: string): string;
74
+ /** How much of a name the writer stated rather than left for deploy time. */
75
+ declare function fixedTextLength(name: string): number;
76
+ /**
77
+ * Whether two names are the same name. Two patterns agree when their
78
+ * fixed parts line up, since a hole on one side meets a hole on the
79
+ * other. A pattern and a concrete name agree when the fixed parts are
80
+ * where the pattern says they are, which is what happens when one side
81
+ * hardcoded what the other parameterized. A reference agrees with
82
+ * nothing on either side.
83
+ */
84
+ declare function namesAgree(a: string, b: string): boolean;
85
+ /** Where a reference says to go and ask. */
86
+ interface Reference {
87
+ /**
88
+ * The value the code starts from: a parameter of the unit the
89
+ * reference was written in, or a variable the deployment sets. Which
90
+ * of those it is depends on the unit's inputs, so the reader that
91
+ * grounds a reference decides, not the string.
92
+ */
93
+ root: string;
94
+ /** The fields to read inside it, outermost first. */
95
+ fields: string[];
96
+ }
97
+ /**
98
+ * How a reference is written. Null when a part of it is empty, since a
99
+ * reference has to say what to ask about.
100
+ */
101
+ declare function referenceName(reference: Reference): string | null;
102
+ /**
103
+ * The place a parsed reference says to ask, or null for a name that is
104
+ * not a reference, or for a reference with a part missing, which says
105
+ * nothing anybody could answer.
106
+ */
107
+ declare function referenceOf(name: BoundaryName): Reference | null;
108
+ /**
109
+ * The reference a name states, or null when the name states a name
110
+ * rather than where to go and ask.
111
+ */
112
+ declare function referenceFromName(name: string): Reference | null;
113
+
114
+ /**
115
+ * What the deployment running a piece of code fills its variables in
116
+ * with.
117
+ *
118
+ * A queue URL, a function name and a table name only exist once a stack
119
+ * is deployed, so the source reaches them through a variable and the
120
+ * template says what that variable is. Every protocol whose name has a
121
+ * hole in it asks the same two questions here, and whoever knows which
122
+ * deployment runs the code fills them in.
123
+ *
124
+ * The interface is declared next to the protocols because a protocol
125
+ * has to ask without knowing what a summary is. `@suss/behavioral-ir`
126
+ * works the values out from a set of summaries.
127
+ */
128
+
129
+ interface Deployment {
130
+ /**
131
+ * Which variable a reference asks about, or null when what settles it
132
+ * is an argument a caller passes rather than anything the deployment
133
+ * says.
134
+ */
135
+ variableFor(reference: Reference): string | null;
136
+ /**
137
+ * The string this deployment sets that variable to. Null when it sets
138
+ * nothing, and null when two deployments of this code set it to
139
+ * different strings, since picking one of two would be a guess.
140
+ */
141
+ setTo(reference: Reference): string | null;
142
+ /**
143
+ * The declared resource this deployment wires that variable to, by
144
+ * the name the resource is declared under. A template that writes
145
+ * `!Ref ArchiveWorker` says which unit an invoke reaches without ever
146
+ * writing the deployed function's name, and that logical id is what
147
+ * the unit's own summary is keyed by.
148
+ */
149
+ pointsAt(reference: Reference): string | null;
150
+ }
151
+ /** A deployment that settles nothing, for a run with no template in it. */
152
+ declare const NOTHING_DEPLOYED: Deployment;
153
+
5
154
  /**
6
155
  * Comparing two TypeShapes structurally.
7
156
  *
@@ -141,16 +290,25 @@ interface BoundaryBehavior<S extends {
141
290
  * the code. Both parts have to be in before anybody can see that the
142
291
  * two sides describe one boundary.
143
292
  *
144
- * `deployedAs` is already scoped to the unit this boundary belongs to.
145
- * A protocol asks for a variable and gets back what this deployment
146
- * sets it to, or null. Return null to leave the boundary as it is,
293
+ * `deployment` is already scoped to the unit this boundary belongs
294
+ * to. A protocol hands over the reference its name states and gets
295
+ * back what fills it in, or null. Return null to leave it as it is,
147
296
  * which is right whenever nothing needs filling in or nothing can
148
297
  * fill it.
149
298
  *
150
299
  * A protocol whose names are settled in the source leaves this
151
300
  * undefined.
152
301
  */
153
- groundName?(semantics: S, deployedAs: (variable: string) => string | null): S | null;
302
+ groundName?(semantics: S, deployment: Deployment): S | null;
303
+ /**
304
+ * Where this boundary's name says to go and ask, when it says that
305
+ * rather than a name. A caller that has to explain why two sides did
306
+ * not meet reads it to say which input would settle them.
307
+ *
308
+ * A protocol that defines `groundName` defines this too, and the
309
+ * same reference is what `groundName` hands over.
310
+ */
311
+ nameReference?(semantics: S): Reference | null;
154
312
  /**
155
313
  * Whether a provider produces a status and a body that a consumer
156
314
  * reads back. Every protocol has to state this, so that one added
@@ -307,7 +465,23 @@ declare function withRewrittenPaths(binding: BoundaryBinding, rewrite: (path: st
307
465
  * Every protocol that has such a name says how to fill it in, and one
308
466
  * whose names are settled in the source keys exactly as before.
309
467
  */
310
- declare function groundedPairingKey(binding: BoundaryBinding, deployedAs: (variable: string) => string | null): string | null;
468
+ declare function groundedPairingKey(binding: BoundaryBinding, deployment: Deployment): string | null;
469
+ /**
470
+ * The same boundary, with whatever the deployment fills in put in.
471
+ *
472
+ * Everything that reads a boundary's name for a person to see goes
473
+ * through here first: the pairing pass, the drafter that writes an
474
+ * intent document, and the intent checker that reads one back. A step
475
+ * only one of them took would have the drafter write a name the
476
+ * checker then argued with.
477
+ */
478
+ declare function groundBinding(binding: BoundaryBinding, deployment: Deployment): BoundaryBinding;
479
+ /**
480
+ * Where this boundary's name says to go and ask, or null when the
481
+ * source stated a name outright. A report that has to say why two
482
+ * sides did not meet reads it to say which input would settle them.
483
+ */
484
+ declare function nameReference(binding: BoundaryBinding): Reference | null;
311
485
  declare function pairingKey(binding: BoundaryBinding): string | null;
312
486
  declare function semanticsAgree(a: Semantics, b: Semantics): boolean;
313
487
  declare function boundaryLabel(binding: BoundaryBinding): string | null;
@@ -338,115 +512,6 @@ declare function servesRequest(binding: BoundaryBinding, method: string, path: s
338
512
  */
339
513
  declare function withinScope(binding: BoundaryBinding, scope: string): boolean;
340
514
 
341
- /**
342
- * The boundary-name syntax, parsed and printed in one place.
343
- *
344
- * A name in a summary means one of three things, told apart by the
345
- * braces alone: a literal (`orders-v1`), a pattern with deploy-time
346
- * holes (`{stage}-orders-v1`), or a reference saying where to go and
347
- * ask (`{location.bucket}`, `{ORDER_TABLE}`). A second parser can
348
- * disagree about which is which, and a second printer can spell a
349
- * value this one cannot read back, so everything that touches the
350
- * braces calls this module: `parseBoundaryName` and
351
- * `boundaryNameString` are the two directions, and the helpers below
352
- * are views over them. The package README tells the longer story,
353
- * including why REST route paths and message-bus channels stay apart.
354
- */
355
- /** One piece of a pattern: text the writer stated, or a hole. */
356
- type NamePart = {
357
- type: "text";
358
- text: string;
359
- } | {
360
- type: "hole";
361
- label: string;
362
- };
363
- /**
364
- * What a name string means. A `reference` keeps its raw dot-separated
365
- * path, and `referenceOf` is the view that checks the parts are all
366
- * present, so a malformed spelling still classifies as a reference and
367
- * still pairs with nothing.
368
- */
369
- type BoundaryName = {
370
- type: "literal";
371
- value: string;
372
- } | {
373
- type: "pattern";
374
- parts: NamePart[];
375
- } | {
376
- type: "reference";
377
- path: string[];
378
- };
379
- /** What a name string means. The exact inverse of `boundaryNameString`. */
380
- declare function parseBoundaryName(name: string): BoundaryName;
381
- /** The one serializer. Everything a summary spells goes through here. */
382
- declare function boundaryNameString(name: BoundaryName): string;
383
- /**
384
- * How a hole is spelled. A reader that assembles a pattern a part at a
385
- * time, the way the adapter's name reader does, mints each hole here
386
- * so the spelling cannot drift from the parse above.
387
- */
388
- declare function patternHole(label: string): string;
389
- /**
390
- * The name a CloudFormation `Fn::Sub` value states. The array form
391
- * takes its template from the first element, and the variable map only
392
- * says where a substitution comes from, which does not change the name.
393
- */
394
- declare function namePatternFromSub(value: unknown): string | null;
395
- /**
396
- * Whether a name says only that somebody else knows it. A wrapper that
397
- * takes its bucket as an argument states `{location.bucket}` and
398
- * nothing more, which says which parameter to ask rather than which
399
- * bucket. A name like that agrees with nothing until something grounds
400
- * it, since otherwise it would agree with every name there is.
401
- */
402
- declare function namesNothing(name: string): boolean;
403
- /** Whether a name has anything a source left for deploy time to fill. */
404
- declare function hasNameHole(name: string): boolean;
405
- /**
406
- * The form two patterns are compared in: every hole reduced to the same
407
- * token, since the two sides pick their own name for the parameter.
408
- */
409
- declare function namePatternKey(name: string): string;
410
- /** How much of a name the writer stated rather than left for deploy time. */
411
- declare function fixedTextLength(name: string): number;
412
- /**
413
- * Whether two names are the same name. Two patterns agree when their
414
- * fixed parts line up, since a hole on one side meets a hole on the
415
- * other. A pattern and a concrete name agree when the fixed parts are
416
- * where the pattern says they are, which is what happens when one side
417
- * hardcoded what the other parameterized. A reference agrees with
418
- * nothing on either side.
419
- */
420
- declare function namesAgree(a: string, b: string): boolean;
421
- /** Where a reference says to go and ask. */
422
- interface Reference {
423
- /**
424
- * The value the code starts from: a parameter of the unit the
425
- * reference was written in, or a variable the deployment sets. Which
426
- * of those it is depends on the unit's inputs, so the reader that
427
- * grounds a reference decides, not the string.
428
- */
429
- root: string;
430
- /** The fields to read inside it, outermost first. */
431
- fields: string[];
432
- }
433
- /**
434
- * How a reference is written. Null when a part of it is empty, since a
435
- * reference has to say what to ask about.
436
- */
437
- declare function referenceName(reference: Reference): string | null;
438
- /**
439
- * The place a parsed reference says to ask, or null for a name that is
440
- * not a reference, or for a reference with a part missing, which says
441
- * nothing anybody could answer.
442
- */
443
- declare function referenceOf(name: BoundaryName): Reference | null;
444
- /**
445
- * The reference a name states, or null when the name states a name
446
- * rather than where to go and ask.
447
- */
448
- declare function referenceFromName(name: string): Reference | null;
449
-
450
515
  /**
451
516
  * How somebody spells a boundary they want to talk about, and whether
452
517
  * what they wrote picks out a given one.
@@ -892,4 +957,4 @@ declare function metricBinding(opts: {
892
957
  metricType: string | null;
893
958
  }): BoundaryBinding;
894
959
 
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 };
960
+ 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 Deployment, type DispatchTable, type EffectRelation, EffectRelationSchema, type FindingSuppression, type FnIdentityKey, type GqlIdentityKey, type MatchResult, MessageBusSemantics, MessageBusTechnology, type MetricIdentityKey, type MetricSemantics, MetricSemanticsSchema, NOTHING_DEPLOYED, 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, groundBinding, groundedPairingKey, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, nameReference, 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 };