@suss/ir-core 0.20.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/{chunk-52CH76PE.js → chunk-PPQWK62O.js} +325 -61
- package/dist/index.cjs +442 -205
- package/dist/index.d.cts +321 -112
- package/dist/index.d.ts +321 -112
- package/dist/index.js +135 -144
- package/dist/{schemas-Dt93kAZT.d.cts → schemas-Dn1AzzWd.d.cts} +37 -1
- package/dist/{schemas-Dt93kAZT.d.ts → schemas-Dn1AzzWd.d.ts} +37 -1
- package/dist/schemas.cjs +209 -61
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,155 @@
|
|
|
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
|
|
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
|
|
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
|
+
|
|
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;
|
|
4
153
|
|
|
5
154
|
/**
|
|
6
155
|
* Comparing two TypeShapes structurally.
|
|
@@ -123,6 +272,16 @@ interface BoundaryBehavior<S extends {
|
|
|
123
272
|
* does not apply, and unknown means this declaration cannot settle it.
|
|
124
273
|
*/
|
|
125
274
|
servesRequest?(semantics: S, method: string, path: string): MatchResult;
|
|
275
|
+
/**
|
|
276
|
+
* Whether every request this boundary takes falls inside a pattern
|
|
277
|
+
* something else was registered for. Middleware registered for
|
|
278
|
+
* `/v1/*` runs for `/v1/tenants/{id}` and not for `/health`, so
|
|
279
|
+
* composing it into a unit asks this first.
|
|
280
|
+
*
|
|
281
|
+
* A protocol whose boundaries no pattern addresses leaves this
|
|
282
|
+
* undefined, and nothing registered with a pattern reaches them.
|
|
283
|
+
*/
|
|
284
|
+
withinScope?(semantics: S, scope: string): boolean;
|
|
126
285
|
/**
|
|
127
286
|
* The same boundary with a name the deployment fills in put in.
|
|
128
287
|
*
|
|
@@ -131,16 +290,25 @@ interface BoundaryBehavior<S extends {
|
|
|
131
290
|
* the code. Both parts have to be in before anybody can see that the
|
|
132
291
|
* two sides describe one boundary.
|
|
133
292
|
*
|
|
134
|
-
* `
|
|
135
|
-
* A protocol
|
|
136
|
-
*
|
|
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,
|
|
137
296
|
* which is right whenever nothing needs filling in or nothing can
|
|
138
297
|
* fill it.
|
|
139
298
|
*
|
|
140
299
|
* A protocol whose names are settled in the source leaves this
|
|
141
300
|
* undefined.
|
|
142
301
|
*/
|
|
143
|
-
groundName?(semantics: S,
|
|
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;
|
|
144
312
|
/**
|
|
145
313
|
* Whether a provider produces a status and a body that a consumer
|
|
146
314
|
* reads back. Every protocol has to state this, so that one added
|
|
@@ -195,6 +363,15 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
|
|
|
195
363
|
readonly [IdentityKeyBrand]: "bus";
|
|
196
364
|
};
|
|
197
365
|
declare function busIdentityKey(messageBus: MessageBusSemantics["messageBus"], subject: string): BusIdentityKey;
|
|
366
|
+
/**
|
|
367
|
+
* `unit:platform name`, the key an invoker and the unit it invokes pair
|
|
368
|
+
* on. The platform stays in because two clouds can each deploy
|
|
369
|
+
* something called `Worker` and they are not the same thing.
|
|
370
|
+
*/
|
|
371
|
+
type UnitIdentityKey = `unit:${DeployableUnit["deploymentTarget"]} ${string}` & {
|
|
372
|
+
readonly [IdentityKeyBrand]: "unit";
|
|
373
|
+
};
|
|
374
|
+
declare function unitIdentityKey(deploymentTarget: DeployableUnit["deploymentTarget"], instanceName: string): UnitIdentityKey;
|
|
198
375
|
/** `metric:system type`, the key both sides of a metric pair on. */
|
|
199
376
|
type MetricIdentityKey = `metric:${string} ${string}` & {
|
|
200
377
|
readonly [IdentityKeyBrand]: "metric";
|
|
@@ -208,6 +385,25 @@ declare const MetricSemanticsSchema: z.ZodObject<{
|
|
|
208
385
|
}, z.core.$strip>;
|
|
209
386
|
type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
|
|
210
387
|
|
|
388
|
+
/**
|
|
389
|
+
* `instanceName` is nullable here and required on the unit itself,
|
|
390
|
+
* because only the provider always knows the name. A call that works
|
|
391
|
+
* its callee out at run time still happened, and recording it with no
|
|
392
|
+
* name says so without pairing it against everything.
|
|
393
|
+
*/
|
|
394
|
+
declare const UnitInvocationSemanticsSchema: z.ZodObject<{
|
|
395
|
+
deploymentTarget: z.ZodEnum<{
|
|
396
|
+
lambda: "lambda";
|
|
397
|
+
"ecs-task": "ecs-task";
|
|
398
|
+
container: "container";
|
|
399
|
+
"k8s-deployment": "k8s-deployment";
|
|
400
|
+
worker: "worker";
|
|
401
|
+
}>;
|
|
402
|
+
name: z.ZodLiteral<"unit-invocation">;
|
|
403
|
+
instanceName: z.ZodNullable<z.ZodString>;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
type UnitInvocationSemantics = z.infer<typeof UnitInvocationSemanticsSchema>;
|
|
406
|
+
|
|
211
407
|
/**
|
|
212
408
|
* A boundary binding read as OpenTelemetry attributes.
|
|
213
409
|
*
|
|
@@ -242,6 +438,17 @@ declare function semconvAttributes(binding: BoundaryBinding): Record<string, str
|
|
|
242
438
|
* rather than in either checker.
|
|
243
439
|
*/
|
|
244
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Whether a binding is of one protocol, narrowed to that protocol's
|
|
443
|
+
* own semantics when it is. A caller reaching through the binding to
|
|
444
|
+
* compare the name by hand gets `string | undefined` and no narrowing,
|
|
445
|
+
* so a name that no protocol uses compiles and quietly never matches.
|
|
446
|
+
*/
|
|
447
|
+
declare function bindingIs<N extends Semantics["name"]>(binding: BoundaryBinding | null | undefined, name: N): binding is BoundaryBinding & {
|
|
448
|
+
semantics: Extract<Semantics, {
|
|
449
|
+
name: N;
|
|
450
|
+
}>;
|
|
451
|
+
};
|
|
245
452
|
declare function boundaryKey(binding: BoundaryBinding): string | null;
|
|
246
453
|
/**
|
|
247
454
|
* The binding with any filesystem path its semantics state rewritten.
|
|
@@ -258,7 +465,23 @@ declare function withRewrittenPaths(binding: BoundaryBinding, rewrite: (path: st
|
|
|
258
465
|
* Every protocol that has such a name says how to fill it in, and one
|
|
259
466
|
* whose names are settled in the source keys exactly as before.
|
|
260
467
|
*/
|
|
261
|
-
declare function groundedPairingKey(binding: BoundaryBinding,
|
|
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;
|
|
262
485
|
declare function pairingKey(binding: BoundaryBinding): string | null;
|
|
263
486
|
declare function semanticsAgree(a: Semantics, b: Semantics): boolean;
|
|
264
487
|
declare function boundaryLabel(binding: BoundaryBinding): string | null;
|
|
@@ -282,115 +505,58 @@ declare function reportsUnpairedItself(binding: BoundaryBinding): boolean;
|
|
|
282
505
|
* unknown means it does, but this declaration cannot settle the question.
|
|
283
506
|
*/
|
|
284
507
|
declare function servesRequest(binding: BoundaryBinding, method: string, path: string): MatchResult | null;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* The boundary-name syntax, parsed and printed in one place.
|
|
288
|
-
*
|
|
289
|
-
* A name in a summary means one of three things, told apart by the
|
|
290
|
-
* braces alone: a literal (`orders-v1`), a pattern with deploy-time
|
|
291
|
-
* holes (`{stage}-orders-v1`), or a reference saying where to go and
|
|
292
|
-
* ask (`{location.bucket}`, `{ORDER_TABLE}`). A second parser can
|
|
293
|
-
* disagree about which is which, and a second printer can spell a
|
|
294
|
-
* value this one cannot read back, so everything that touches the
|
|
295
|
-
* braces calls this module: `parseBoundaryName` and
|
|
296
|
-
* `boundaryNameString` are the two directions, and the helpers below
|
|
297
|
-
* are views over them. The package README tells the longer story,
|
|
298
|
-
* including why REST route paths and message-bus channels stay apart.
|
|
299
|
-
*/
|
|
300
|
-
/** One piece of a pattern: text the writer stated, or a hole. */
|
|
301
|
-
type NamePart = {
|
|
302
|
-
type: "text";
|
|
303
|
-
text: string;
|
|
304
|
-
} | {
|
|
305
|
-
type: "hole";
|
|
306
|
-
label: string;
|
|
307
|
-
};
|
|
308
508
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* still pairs with nothing.
|
|
509
|
+
* Whether a wrapper registered for `scope` runs for this boundary.
|
|
510
|
+
* False for a protocol whose boundaries no pattern addresses, so a
|
|
511
|
+
* scoped registration reaches nothing it cannot be shown to cover.
|
|
313
512
|
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
value: string;
|
|
317
|
-
} | {
|
|
318
|
-
type: "pattern";
|
|
319
|
-
parts: NamePart[];
|
|
320
|
-
} | {
|
|
321
|
-
type: "reference";
|
|
322
|
-
path: string[];
|
|
323
|
-
};
|
|
324
|
-
/** What a name string means. The exact inverse of `boundaryNameString`. */
|
|
325
|
-
declare function parseBoundaryName(name: string): BoundaryName;
|
|
326
|
-
/** The one serializer. Everything a summary spells goes through here. */
|
|
327
|
-
declare function boundaryNameString(name: BoundaryName): string;
|
|
328
|
-
/**
|
|
329
|
-
* How a hole is spelled. A reader that assembles a pattern a part at a
|
|
330
|
-
* time, the way the adapter's name reader does, mints each hole here
|
|
331
|
-
* so the spelling cannot drift from the parse above.
|
|
332
|
-
*/
|
|
333
|
-
declare function patternHole(label: string): string;
|
|
334
|
-
/**
|
|
335
|
-
* The name a CloudFormation `Fn::Sub` value states. The array form
|
|
336
|
-
* takes its template from the first element, and the variable map only
|
|
337
|
-
* says where a substitution comes from, which does not change the name.
|
|
338
|
-
*/
|
|
339
|
-
declare function namePatternFromSub(value: unknown): string | null;
|
|
340
|
-
/**
|
|
341
|
-
* Whether a name says only that somebody else knows it. A wrapper that
|
|
342
|
-
* takes its bucket as an argument states `{location.bucket}` and
|
|
343
|
-
* nothing more, which says which parameter to ask rather than which
|
|
344
|
-
* bucket. A name like that agrees with nothing until something grounds
|
|
345
|
-
* it, since otherwise it would agree with every name there is.
|
|
346
|
-
*/
|
|
347
|
-
declare function namesNothing(name: string): boolean;
|
|
348
|
-
/** Whether a name has anything a source left for deploy time to fill. */
|
|
349
|
-
declare function hasNameHole(name: string): boolean;
|
|
350
|
-
/**
|
|
351
|
-
* The form two patterns are compared in: every hole reduced to the same
|
|
352
|
-
* token, since the two sides pick their own name for the parameter.
|
|
353
|
-
*/
|
|
354
|
-
declare function namePatternKey(name: string): string;
|
|
355
|
-
/** How much of a name the writer stated rather than left for deploy time. */
|
|
356
|
-
declare function fixedTextLength(name: string): number;
|
|
357
|
-
/**
|
|
358
|
-
* Whether two names are the same name. Two patterns agree when their
|
|
359
|
-
* fixed parts line up, since a hole on one side meets a hole on the
|
|
360
|
-
* other. A pattern and a concrete name agree when the fixed parts are
|
|
361
|
-
* where the pattern says they are, which is what happens when one side
|
|
362
|
-
* hardcoded what the other parameterized. A reference agrees with
|
|
363
|
-
* nothing on either side.
|
|
364
|
-
*/
|
|
365
|
-
declare function namesAgree(a: string, b: string): boolean;
|
|
366
|
-
/** Where a reference says to go and ask. */
|
|
367
|
-
interface Reference {
|
|
368
|
-
/**
|
|
369
|
-
* The value the code starts from: a parameter of the unit the
|
|
370
|
-
* reference was written in, or a variable the deployment sets. Which
|
|
371
|
-
* of those it is depends on the unit's inputs, so the reader that
|
|
372
|
-
* grounds a reference decides, not the string.
|
|
373
|
-
*/
|
|
374
|
-
root: string;
|
|
375
|
-
/** The fields to read inside it, outermost first. */
|
|
376
|
-
fields: string[];
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* How a reference is written. Null when a part of it is empty, since a
|
|
380
|
-
* reference has to say what to ask about.
|
|
381
|
-
*/
|
|
382
|
-
declare function referenceName(reference: Reference): string | null;
|
|
513
|
+
declare function withinScope(binding: BoundaryBinding, scope: string): boolean;
|
|
514
|
+
|
|
383
515
|
/**
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
516
|
+
* How somebody spells a boundary they want to talk about, and whether
|
|
517
|
+
* what they wrote picks out a given one.
|
|
518
|
+
*
|
|
519
|
+
* The words get cut into tokens, the boundary does too, and a boundary
|
|
520
|
+
* matches when it has every token somebody wrote. So
|
|
521
|
+
* `aws.dynamodb:editions` matches the table and every index on it, and
|
|
522
|
+
* adding `#by-publication` narrows it to the one index.
|
|
523
|
+
*
|
|
524
|
+
* `suss ask`, `suss check --at` and an intent document that says which
|
|
525
|
+
* store a write reaches all read this, so the question and the
|
|
526
|
+
* assertion are spelled and resolved the same way.
|
|
387
527
|
*/
|
|
388
|
-
|
|
528
|
+
|
|
389
529
|
/**
|
|
390
|
-
* The
|
|
391
|
-
*
|
|
392
|
-
|
|
393
|
-
|
|
530
|
+
* The name inside a fully-qualified cloud resource id, and anything
|
|
531
|
+
* else unchanged.
|
|
532
|
+
*
|
|
533
|
+
* `arn:aws:lambda:us-east-1:1234:function:prod-worker` and
|
|
534
|
+
* `projects/p/locations/l/functions/prod-worker` say the same thing as
|
|
535
|
+
* `prod-worker` plus an account and a region. Keeping the whole string
|
|
536
|
+
* makes one deployment's spelling of a resource disagree with
|
|
537
|
+
* another's, so every reader that meets one reduces it here and the two
|
|
538
|
+
* sides compare the part they can both know. A Lambda ARN's trailing
|
|
539
|
+
* alias or version comes off with the rest: the function is the
|
|
540
|
+
* boundary whichever published copy a call reaches.
|
|
541
|
+
*/
|
|
542
|
+
declare function resourceNameIn(spelling: string): string;
|
|
543
|
+
/**
|
|
544
|
+
* The words in a boundary spelling. Separators between parts of a name
|
|
545
|
+
* are cut, and the characters inside one part are left alone, so
|
|
546
|
+
* `by-publication` stays one word and `{id}` and `:id` both come out as
|
|
547
|
+
* `id`.
|
|
548
|
+
*/
|
|
549
|
+
declare function spellingTokens(text: string): string[];
|
|
550
|
+
/** Every word this boundary can be asked about by. */
|
|
551
|
+
declare function bindingTokens(binding: BoundaryBinding): Set<string>;
|
|
552
|
+
/**
|
|
553
|
+
* Whether what somebody typed is the whole of this boundary's name
|
|
554
|
+
* rather than part of it. `POST /articles` is exactly the collection
|
|
555
|
+
* route and only part of `POST /articles/{slug}/comments`.
|
|
556
|
+
*/
|
|
557
|
+
declare function namesBoundaryExactly(subject: string, binding: BoundaryBinding): boolean;
|
|
558
|
+
/** Whether what somebody typed picks out this boundary. */
|
|
559
|
+
declare function namesBoundary(subject: string, binding: BoundaryBinding): boolean;
|
|
394
560
|
|
|
395
561
|
/**
|
|
396
562
|
* Deciding when two message-bus channel strings mean the same thing.
|
|
@@ -474,6 +640,37 @@ declare function dispatchByType<T extends {
|
|
|
474
640
|
type: string;
|
|
475
641
|
}, R>(table: DispatchTable<T, R>, value: T): R;
|
|
476
642
|
|
|
643
|
+
/**
|
|
644
|
+
* What a unit does at a boundary, in the words `suss ask` asks with.
|
|
645
|
+
*
|
|
646
|
+
* `what writes postgresql:invoices` is the question and "this outcome
|
|
647
|
+
* writes postgresql:invoices" is the assertion, so the report, the
|
|
648
|
+
* question parser and an intent doc all have to spell the verbs the
|
|
649
|
+
* same way. They are here rather than beside any one of them.
|
|
650
|
+
*
|
|
651
|
+
* `provides` is the unit's own boundary; `reads`, `writes` and
|
|
652
|
+
* `invokes` are what a call site does at somebody else's. Calling a
|
|
653
|
+
* deployed unit by name is one act, so it gets a verb of its own.
|
|
654
|
+
*/
|
|
655
|
+
|
|
656
|
+
declare const RelationSchema: z.ZodEnum<{
|
|
657
|
+
provides: "provides";
|
|
658
|
+
reads: "reads";
|
|
659
|
+
writes: "writes";
|
|
660
|
+
invokes: "invokes";
|
|
661
|
+
}>;
|
|
662
|
+
type Relation = z.infer<typeof RelationSchema>;
|
|
663
|
+
/**
|
|
664
|
+
* The verbs an effect can have. A boundary a unit serves is not an
|
|
665
|
+
* effect of the unit, so `provides` is not one of them.
|
|
666
|
+
*/
|
|
667
|
+
declare const EffectRelationSchema: z.ZodEnum<{
|
|
668
|
+
reads: "reads";
|
|
669
|
+
writes: "writes";
|
|
670
|
+
invokes: "invokes";
|
|
671
|
+
}>;
|
|
672
|
+
type EffectRelation = z.infer<typeof EffectRelationSchema>;
|
|
673
|
+
|
|
477
674
|
/**
|
|
478
675
|
* The suppression pipeline, over the smallest finding both checkers share.
|
|
479
676
|
*
|
|
@@ -710,6 +907,18 @@ declare function runtimeConfigBinding(opts: {
|
|
|
710
907
|
deploymentTarget: DeployableUnit["deploymentTarget"];
|
|
711
908
|
instanceName: string;
|
|
712
909
|
}): BoundaryBinding;
|
|
910
|
+
/**
|
|
911
|
+
* Build a unit-invocation binding, the boundary between a deployed unit
|
|
912
|
+
* and whatever calls it by name. Transport is `"invoke"` because the
|
|
913
|
+
* call goes through the platform's own invoke API whichever cloud runs
|
|
914
|
+
* the unit.
|
|
915
|
+
*/
|
|
916
|
+
declare function unitInvocationBinding(opts: {
|
|
917
|
+
recognition: string;
|
|
918
|
+
deploymentTarget: DeployableUnit["deploymentTarget"];
|
|
919
|
+
/** Null when this source does not say which unit it invokes. */
|
|
920
|
+
instanceName: string | null;
|
|
921
|
+
}): BoundaryBinding;
|
|
713
922
|
/**
|
|
714
923
|
* Build a storage binding, the side of a store that both a schema
|
|
715
924
|
* reader and a call site can spell. `transport` defaults to the store's
|
|
@@ -748,4 +957,4 @@ declare function metricBinding(opts: {
|
|
|
748
957
|
metricType: string | null;
|
|
749
958
|
}): BoundaryBinding;
|
|
750
959
|
|
|
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 };
|
|
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 };
|