@suss/ir-core 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/{chunk-WRRENYBR.js → chunk-XUXN6DIX.js} +159 -75
- package/dist/index.cjs +224 -90
- package/dist/index.d.cts +84 -8
- package/dist/index.d.ts +84 -8
- package/dist/index.js +54 -3
- package/dist/{schemas-BLS4PXwc.d.cts → schemas-CGR6qjFf.d.cts} +14 -6
- package/dist/{schemas-BLS4PXwc.d.ts → schemas-CGR6qjFf.d.ts} +14 -6
- package/dist/schemas.cjs +147 -72
- 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.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-
|
|
3
|
-
export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-
|
|
2
|
+
import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-CGR6qjFf.cjs';
|
|
3
|
+
export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Comparing two TypeShapes structurally.
|
|
@@ -49,8 +49,33 @@ declare function bodyShapesMatch(actual: TypeShape, declared: TypeShape): MatchR
|
|
|
49
49
|
* because a published summary has to mean the same thing to a reader
|
|
50
50
|
* who never installed the pack that wrote it. If a pack needs a
|
|
51
51
|
* protocol nobody has defined yet, add a module here.
|
|
52
|
+
*
|
|
53
|
+
* A protocol also says which of its words come from OpenTelemetry's
|
|
54
|
+
* semantic conventions, in `semconv`. The README says why that
|
|
55
|
+
* matters and where it stops.
|
|
52
56
|
*/
|
|
53
57
|
|
|
58
|
+
/** One identity field written as an OpenTelemetry attribute. */
|
|
59
|
+
interface SemconvAttribute {
|
|
60
|
+
/** The attribute name, as the semantic conventions spell it. */
|
|
61
|
+
name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Values suss writes where the source named none. A span never says
|
|
64
|
+
* them, so the projection leaves the attribute off rather than
|
|
65
|
+
* emitting a string that could only ever mismatch.
|
|
66
|
+
*/
|
|
67
|
+
placeholderValues?: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Which identity fields the semantic conventions have an attribute
|
|
71
|
+
* for. A field is absent when they have no attribute for it, or when
|
|
72
|
+
* our value is our own string rather than the one a span gets.
|
|
73
|
+
*/
|
|
74
|
+
type SemconvMapping<S extends {
|
|
75
|
+
name: string;
|
|
76
|
+
}> = {
|
|
77
|
+
readonly [K in Exclude<keyof S, "name">]?: SemconvAttribute;
|
|
78
|
+
};
|
|
54
79
|
/**
|
|
55
80
|
* How one semantics variant keys its boundaries and pairs them up. Each
|
|
56
81
|
* variant fills this in inside its own module, and nothing else in the
|
|
@@ -123,6 +148,11 @@ interface BoundarySemanticsDefinition<Z extends z.ZodType<{
|
|
|
123
148
|
name: z.infer<Z>["name"];
|
|
124
149
|
schema: Z;
|
|
125
150
|
behavior: BoundaryBehavior<z.infer<Z>>;
|
|
151
|
+
/**
|
|
152
|
+
* Every protocol declares this, empty included, so that adding one
|
|
153
|
+
* means deciding where its words come from.
|
|
154
|
+
*/
|
|
155
|
+
semconv: SemconvMapping<z.infer<Z>>;
|
|
126
156
|
}
|
|
127
157
|
|
|
128
158
|
declare const IdentityKeyBrand: unique symbol;
|
|
@@ -141,6 +171,39 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
|
|
|
141
171
|
readonly [IdentityKeyBrand]: "bus";
|
|
142
172
|
};
|
|
143
173
|
declare function busIdentityKey(messageBus: MessageBusSemantics["messageBus"], subject: string): BusIdentityKey;
|
|
174
|
+
/** `metric:system type`, the key both sides of a metric pair on. */
|
|
175
|
+
type MetricIdentityKey = `metric:${string} ${string}` & {
|
|
176
|
+
readonly [IdentityKeyBrand]: "metric";
|
|
177
|
+
};
|
|
178
|
+
declare function metricIdentityKey(metricSystem: string, metricType: string): MetricIdentityKey;
|
|
179
|
+
|
|
180
|
+
declare const MetricSemanticsSchema: z.ZodObject<{
|
|
181
|
+
name: z.ZodLiteral<"metric">;
|
|
182
|
+
metricSystem: z.ZodString;
|
|
183
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A boundary binding read as OpenTelemetry attributes.
|
|
189
|
+
*
|
|
190
|
+
* A summary says what a unit can reach and a span says what it did
|
|
191
|
+
* reach. Joining the two means both sides spelling the boundary the
|
|
192
|
+
* same way, so suss writes the value a span gets wherever the semantic
|
|
193
|
+
* conventions have a word for it, and this projection puts those
|
|
194
|
+
* values under the attributes a trace store already indexes.
|
|
195
|
+
*
|
|
196
|
+
* Which fields those are is each protocol's own declaration, in its
|
|
197
|
+
* module under `semantics/`. Nothing here knows about any protocol.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The attributes a boundary states, by name. A field the source never
|
|
202
|
+
* gave, a placeholder, and a field the conventions have no attribute
|
|
203
|
+
* for are all left out, so every pair here compares byte for byte
|
|
204
|
+
* against the same attribute on a span.
|
|
205
|
+
*/
|
|
206
|
+
declare function semconvAttributes(binding: BoundaryBinding): Record<string, string>;
|
|
144
207
|
|
|
145
208
|
/**
|
|
146
209
|
* Keys for a boundary binding, and whether two of them agree. Every
|
|
@@ -269,12 +332,13 @@ declare function dispatchByType<T extends {
|
|
|
269
332
|
* a template writes `!Sub "${StageName}-orders-v1"` and the code writes
|
|
270
333
|
* `` `${stage}-orders-v1` ``. Neither side states a string, both agree
|
|
271
334
|
* about the fixed text, and each spells the parameter its own way. So a
|
|
272
|
-
* name is written here as fixed text with `{}` holes,
|
|
273
|
-
*
|
|
274
|
-
* parts line up.
|
|
335
|
+
* name is written here as fixed text with `{}` holes, and two names
|
|
336
|
+
* agree when their fixed parts line up.
|
|
275
337
|
*
|
|
276
|
-
* A hole covers a whole parameter rather than one
|
|
277
|
-
* because a name has no separator
|
|
338
|
+
* A hole covers a whole parameter rather than one piece of a name,
|
|
339
|
+
* because a name has no separator every project agrees on. Two
|
|
340
|
+
* patterns that both cover one name are told apart by how much fixed
|
|
341
|
+
* text each states, rather than by narrowing what a hole can cover.
|
|
278
342
|
*/
|
|
279
343
|
/**
|
|
280
344
|
* The name a CloudFormation `Fn::Sub` value states. The array form
|
|
@@ -297,6 +361,8 @@ declare function hasNameHole(name: string): boolean;
|
|
|
297
361
|
* token, since the two sides pick their own name for the parameter.
|
|
298
362
|
*/
|
|
299
363
|
declare function namePatternKey(name: string): string;
|
|
364
|
+
/** How much of a name the writer stated rather than left for deploy time. */
|
|
365
|
+
declare function fixedTextLength(name: string): number;
|
|
300
366
|
/**
|
|
301
367
|
* Whether two names are the same name. Two patterns agree when their
|
|
302
368
|
* fixed parts line up, since a hole on one side meets a hole on the
|
|
@@ -545,5 +611,15 @@ declare function messageBusBinding(opts: {
|
|
|
545
611
|
/** Null when this source does not say which channel. */
|
|
546
612
|
channel: string | null;
|
|
547
613
|
}): BoundaryBinding;
|
|
614
|
+
/**
|
|
615
|
+
* Build a metric binding, the boundary between whatever declares a
|
|
616
|
+
* named series of measurements and whatever reads it back by that name.
|
|
617
|
+
*/
|
|
618
|
+
declare function metricBinding(opts: {
|
|
619
|
+
recognition: string;
|
|
620
|
+
metricSystem: string;
|
|
621
|
+
/** Null when this source states a metric it could not name. */
|
|
622
|
+
metricType: string | null;
|
|
623
|
+
}): BoundaryBinding;
|
|
548
624
|
|
|
549
|
-
export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, 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 ParsedChannel, Semantics, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, hasNameHole, isGraphqlOperationBinding, messageBusBinding, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseChannel, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, servesRequest, storageBinding, validateRule };
|
|
625
|
+
export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, 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 ParsedChannel, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseChannel, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, storageBinding, validateRule };
|
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-
|
|
3
|
-
export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-
|
|
2
|
+
import { T as TypeShape, M as MessageBusSemantics, S as Semantics, B as BoundaryBindingSchema, C as ConfidenceInfoSchema, a as ConfidenceLevelSchema, b as ConfidenceSourceSchema, c as CorroborationSchema, d as SourceLocationSchema, e as MessageBusTechnology, D as DeployableUnit } from './schemas-CGR6qjFf.js';
|
|
3
|
+
export { f as DeployableUnitSchema, F as FunctionCallSemantics, g as FunctionCallSemanticsSchema, G as GraphqlOperationSemantics, h as GraphqlOperationSemanticsSchema, i as GraphqlResolverSemantics, j as GraphqlResolverSemanticsSchema, k as MessageBusSemanticsSchema, R as RestSemantics, l as RestSemanticsSchema, m as RuntimeConfigSemantics, n as RuntimeConfigSemanticsSchema, o as SemanticsSchema, p as StorageSemantics, q as StorageSemanticsSchema, r as TypeShapeSchema, s as ecsContainerInstanceName, t as methodsAgree, u as normalizePath, v as routePathAdmits, w as typeDefinitionKey, x as withDefinitionsInlined } from './schemas-CGR6qjFf.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Comparing two TypeShapes structurally.
|
|
@@ -49,8 +49,33 @@ declare function bodyShapesMatch(actual: TypeShape, declared: TypeShape): MatchR
|
|
|
49
49
|
* because a published summary has to mean the same thing to a reader
|
|
50
50
|
* who never installed the pack that wrote it. If a pack needs a
|
|
51
51
|
* protocol nobody has defined yet, add a module here.
|
|
52
|
+
*
|
|
53
|
+
* A protocol also says which of its words come from OpenTelemetry's
|
|
54
|
+
* semantic conventions, in `semconv`. The README says why that
|
|
55
|
+
* matters and where it stops.
|
|
52
56
|
*/
|
|
53
57
|
|
|
58
|
+
/** One identity field written as an OpenTelemetry attribute. */
|
|
59
|
+
interface SemconvAttribute {
|
|
60
|
+
/** The attribute name, as the semantic conventions spell it. */
|
|
61
|
+
name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Values suss writes where the source named none. A span never says
|
|
64
|
+
* them, so the projection leaves the attribute off rather than
|
|
65
|
+
* emitting a string that could only ever mismatch.
|
|
66
|
+
*/
|
|
67
|
+
placeholderValues?: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Which identity fields the semantic conventions have an attribute
|
|
71
|
+
* for. A field is absent when they have no attribute for it, or when
|
|
72
|
+
* our value is our own string rather than the one a span gets.
|
|
73
|
+
*/
|
|
74
|
+
type SemconvMapping<S extends {
|
|
75
|
+
name: string;
|
|
76
|
+
}> = {
|
|
77
|
+
readonly [K in Exclude<keyof S, "name">]?: SemconvAttribute;
|
|
78
|
+
};
|
|
54
79
|
/**
|
|
55
80
|
* How one semantics variant keys its boundaries and pairs them up. Each
|
|
56
81
|
* variant fills this in inside its own module, and nothing else in the
|
|
@@ -123,6 +148,11 @@ interface BoundarySemanticsDefinition<Z extends z.ZodType<{
|
|
|
123
148
|
name: z.infer<Z>["name"];
|
|
124
149
|
schema: Z;
|
|
125
150
|
behavior: BoundaryBehavior<z.infer<Z>>;
|
|
151
|
+
/**
|
|
152
|
+
* Every protocol declares this, empty included, so that adding one
|
|
153
|
+
* means deciding where its words come from.
|
|
154
|
+
*/
|
|
155
|
+
semconv: SemconvMapping<z.infer<Z>>;
|
|
126
156
|
}
|
|
127
157
|
|
|
128
158
|
declare const IdentityKeyBrand: unique symbol;
|
|
@@ -141,6 +171,39 @@ type BusIdentityKey = `bus:${MessageBusSemantics["messageBus"]} ${string}` & {
|
|
|
141
171
|
readonly [IdentityKeyBrand]: "bus";
|
|
142
172
|
};
|
|
143
173
|
declare function busIdentityKey(messageBus: MessageBusSemantics["messageBus"], subject: string): BusIdentityKey;
|
|
174
|
+
/** `metric:system type`, the key both sides of a metric pair on. */
|
|
175
|
+
type MetricIdentityKey = `metric:${string} ${string}` & {
|
|
176
|
+
readonly [IdentityKeyBrand]: "metric";
|
|
177
|
+
};
|
|
178
|
+
declare function metricIdentityKey(metricSystem: string, metricType: string): MetricIdentityKey;
|
|
179
|
+
|
|
180
|
+
declare const MetricSemanticsSchema: z.ZodObject<{
|
|
181
|
+
name: z.ZodLiteral<"metric">;
|
|
182
|
+
metricSystem: z.ZodString;
|
|
183
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
type MetricSemantics = z.infer<typeof MetricSemanticsSchema>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A boundary binding read as OpenTelemetry attributes.
|
|
189
|
+
*
|
|
190
|
+
* A summary says what a unit can reach and a span says what it did
|
|
191
|
+
* reach. Joining the two means both sides spelling the boundary the
|
|
192
|
+
* same way, so suss writes the value a span gets wherever the semantic
|
|
193
|
+
* conventions have a word for it, and this projection puts those
|
|
194
|
+
* values under the attributes a trace store already indexes.
|
|
195
|
+
*
|
|
196
|
+
* Which fields those are is each protocol's own declaration, in its
|
|
197
|
+
* module under `semantics/`. Nothing here knows about any protocol.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The attributes a boundary states, by name. A field the source never
|
|
202
|
+
* gave, a placeholder, and a field the conventions have no attribute
|
|
203
|
+
* for are all left out, so every pair here compares byte for byte
|
|
204
|
+
* against the same attribute on a span.
|
|
205
|
+
*/
|
|
206
|
+
declare function semconvAttributes(binding: BoundaryBinding): Record<string, string>;
|
|
144
207
|
|
|
145
208
|
/**
|
|
146
209
|
* Keys for a boundary binding, and whether two of them agree. Every
|
|
@@ -269,12 +332,13 @@ declare function dispatchByType<T extends {
|
|
|
269
332
|
* a template writes `!Sub "${StageName}-orders-v1"` and the code writes
|
|
270
333
|
* `` `${stage}-orders-v1` ``. Neither side states a string, both agree
|
|
271
334
|
* about the fixed text, and each spells the parameter its own way. So a
|
|
272
|
-
* name is written here as fixed text with `{}` holes,
|
|
273
|
-
*
|
|
274
|
-
* parts line up.
|
|
335
|
+
* name is written here as fixed text with `{}` holes, and two names
|
|
336
|
+
* agree when their fixed parts line up.
|
|
275
337
|
*
|
|
276
|
-
* A hole covers a whole parameter rather than one
|
|
277
|
-
* because a name has no separator
|
|
338
|
+
* A hole covers a whole parameter rather than one piece of a name,
|
|
339
|
+
* because a name has no separator every project agrees on. Two
|
|
340
|
+
* patterns that both cover one name are told apart by how much fixed
|
|
341
|
+
* text each states, rather than by narrowing what a hole can cover.
|
|
278
342
|
*/
|
|
279
343
|
/**
|
|
280
344
|
* The name a CloudFormation `Fn::Sub` value states. The array form
|
|
@@ -297,6 +361,8 @@ declare function hasNameHole(name: string): boolean;
|
|
|
297
361
|
* token, since the two sides pick their own name for the parameter.
|
|
298
362
|
*/
|
|
299
363
|
declare function namePatternKey(name: string): string;
|
|
364
|
+
/** How much of a name the writer stated rather than left for deploy time. */
|
|
365
|
+
declare function fixedTextLength(name: string): number;
|
|
300
366
|
/**
|
|
301
367
|
* Whether two names are the same name. Two patterns agree when their
|
|
302
368
|
* fixed parts line up, since a hole on one side meets a hole on the
|
|
@@ -545,5 +611,15 @@ declare function messageBusBinding(opts: {
|
|
|
545
611
|
/** Null when this source does not say which channel. */
|
|
546
612
|
channel: string | null;
|
|
547
613
|
}): BoundaryBinding;
|
|
614
|
+
/**
|
|
615
|
+
* Build a metric binding, the boundary between whatever declares a
|
|
616
|
+
* named series of measurements and whatever reads it back by that name.
|
|
617
|
+
*/
|
|
618
|
+
declare function metricBinding(opts: {
|
|
619
|
+
recognition: string;
|
|
620
|
+
metricSystem: string;
|
|
621
|
+
/** Null when this source states a metric it could not name. */
|
|
622
|
+
metricType: string | null;
|
|
623
|
+
}): BoundaryBinding;
|
|
548
624
|
|
|
549
|
-
export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, 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 ParsedChannel, Semantics, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, hasNameHole, isGraphqlOperationBinding, messageBusBinding, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseChannel, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, servesRequest, storageBinding, validateRule };
|
|
625
|
+
export { type BoundaryBehavior, type BoundaryBinding, BoundaryBindingSchema, 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 ParsedChannel, Semantics, type SemconvAttribute, type SemconvMapping, type SourceLocation, SourceLocationSchema, type SuppressableSeverity, type SuppressibleFinding, type SuppressionFile, SuppressionFileSchema, type SuppressionRule, SuppressionRuleSchema, TypeShape, applySuppressionsToFindings, bodyShapesMatch, boundaryKey, boundaryLabel, busIdentityKey, busesAgree, canPair, channelsPair, codeScopePath, countsForThreshold, dispatchByType, displayLabel, exchangesHttpResponses, fileInCodeScope, fixedTextLength, fnIdentityKey, formatChannel, functionCallBinding, gqlIdentityKey, graphqlOperationBinding, graphqlResolverBinding, hasNameHole, isGraphqlOperationBinding, messageBusBinding, metricBinding, metricIdentityKey, namePatternFromSub, namePatternKey, namesAgree, namesNothing, normalizeRuleBoundary, packageExportBinding, pairingKey, parseChannel, reportsUnpairedItself, restBinding, ruleBoundaryMatchesKey, runtimeConfigBinding, semanticsAgree, semconvAttributes, servesRequest, storageBinding, validateRule };
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
GraphqlOperationSemanticsSchema,
|
|
10
10
|
GraphqlResolverSemanticsSchema,
|
|
11
11
|
MessageBusSemanticsSchema,
|
|
12
|
+
MetricSemanticsSchema,
|
|
12
13
|
RestSemanticsSchema,
|
|
13
14
|
RuntimeConfigSemanticsSchema,
|
|
14
15
|
SemanticsSchema,
|
|
@@ -25,12 +26,33 @@ import {
|
|
|
25
26
|
formatChannel,
|
|
26
27
|
gqlIdentityKey,
|
|
27
28
|
methodsAgree,
|
|
29
|
+
metricIdentityKey,
|
|
28
30
|
normalizePath,
|
|
29
31
|
parseChannel,
|
|
30
32
|
routePathAdmits,
|
|
33
|
+
semconvMappingOf,
|
|
31
34
|
typeDefinitionKey,
|
|
32
35
|
withDefinitionsInlined
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-XUXN6DIX.js";
|
|
37
|
+
|
|
38
|
+
// src/semconv.ts
|
|
39
|
+
function semconvAttributes(binding) {
|
|
40
|
+
const semantics = binding.semantics;
|
|
41
|
+
const attributes = {};
|
|
42
|
+
for (const [field, attribute] of Object.entries(
|
|
43
|
+
semconvMappingOf(binding.semantics)
|
|
44
|
+
)) {
|
|
45
|
+
const value = semantics[field];
|
|
46
|
+
if (typeof value !== "string") {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (attribute.placeholderValues?.includes(value) === true) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
attributes[attribute.name] = value;
|
|
53
|
+
}
|
|
54
|
+
return attributes;
|
|
55
|
+
}
|
|
34
56
|
|
|
35
57
|
// src/boundaryKey.ts
|
|
36
58
|
function boundaryKey(binding) {
|
|
@@ -129,9 +151,22 @@ function hasNameHole(name) {
|
|
|
129
151
|
function namePatternKey(name) {
|
|
130
152
|
return name.replace(HOLE, "{}");
|
|
131
153
|
}
|
|
154
|
+
function fixedTextLength(name) {
|
|
155
|
+
return name.replace(HOLE, "").length;
|
|
156
|
+
}
|
|
157
|
+
function isHole(part) {
|
|
158
|
+
return part.startsWith("{") && part.endsWith("}");
|
|
159
|
+
}
|
|
160
|
+
function quote(text) {
|
|
161
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
162
|
+
}
|
|
163
|
+
function holeSource(_following) {
|
|
164
|
+
return ".+";
|
|
165
|
+
}
|
|
132
166
|
function admits(pattern, name) {
|
|
133
|
-
const
|
|
134
|
-
|
|
167
|
+
const parts = pattern.split(/(\{[^}]*\})/);
|
|
168
|
+
const source = parts.map(
|
|
169
|
+
(part, index) => isHole(part) ? holeSource(parts[index + 1] ?? "") : quote(part)
|
|
135
170
|
).join("");
|
|
136
171
|
return new RegExp(`^${source}$`).test(name);
|
|
137
172
|
}
|
|
@@ -520,6 +555,17 @@ function messageBusBinding(opts) {
|
|
|
520
555
|
recognition: opts.recognition
|
|
521
556
|
};
|
|
522
557
|
}
|
|
558
|
+
function metricBinding(opts) {
|
|
559
|
+
return {
|
|
560
|
+
transport: opts.metricSystem,
|
|
561
|
+
semantics: {
|
|
562
|
+
name: "metric",
|
|
563
|
+
metricSystem: opts.metricSystem,
|
|
564
|
+
metricType: namedOrNull(opts.metricType, "metric type")
|
|
565
|
+
},
|
|
566
|
+
recognition: opts.recognition
|
|
567
|
+
};
|
|
568
|
+
}
|
|
523
569
|
export {
|
|
524
570
|
BoundaryBindingSchema,
|
|
525
571
|
ConfidenceInfoSchema,
|
|
@@ -531,6 +577,7 @@ export {
|
|
|
531
577
|
GraphqlOperationSemanticsSchema,
|
|
532
578
|
GraphqlResolverSemanticsSchema,
|
|
533
579
|
MessageBusSemanticsSchema,
|
|
580
|
+
MetricSemanticsSchema,
|
|
534
581
|
RestSemanticsSchema,
|
|
535
582
|
RuntimeConfigSemanticsSchema,
|
|
536
583
|
SemanticsSchema,
|
|
@@ -554,6 +601,7 @@ export {
|
|
|
554
601
|
ecsContainerInstanceName,
|
|
555
602
|
exchangesHttpResponses,
|
|
556
603
|
fileInCodeScope,
|
|
604
|
+
fixedTextLength,
|
|
557
605
|
fnIdentityKey,
|
|
558
606
|
formatChannel,
|
|
559
607
|
functionCallBinding,
|
|
@@ -564,6 +612,8 @@ export {
|
|
|
564
612
|
isGraphqlOperationBinding,
|
|
565
613
|
messageBusBinding,
|
|
566
614
|
methodsAgree,
|
|
615
|
+
metricBinding,
|
|
616
|
+
metricIdentityKey,
|
|
567
617
|
namePatternFromSub,
|
|
568
618
|
namePatternKey,
|
|
569
619
|
namesAgree,
|
|
@@ -579,6 +629,7 @@ export {
|
|
|
579
629
|
ruleBoundaryMatchesKey,
|
|
580
630
|
runtimeConfigBinding,
|
|
581
631
|
semanticsAgree,
|
|
632
|
+
semconvAttributes,
|
|
582
633
|
servesRequest,
|
|
583
634
|
storageBinding,
|
|
584
635
|
typeDefinitionKey,
|
|
@@ -62,8 +62,8 @@ type GraphqlResolverSemantics = z.infer<typeof GraphqlResolverSemanticsSchema>;
|
|
|
62
62
|
declare const MessageBusSemanticsSchema: z.ZodObject<{
|
|
63
63
|
name: z.ZodLiteral<"message-bus">;
|
|
64
64
|
messageBus: z.ZodEnum<{
|
|
65
|
-
|
|
66
|
-
sns: "sns";
|
|
65
|
+
aws_sqs: "aws_sqs";
|
|
66
|
+
"aws.sns": "aws.sns";
|
|
67
67
|
s3: "s3";
|
|
68
68
|
eventbridge: "eventbridge";
|
|
69
69
|
bullmq: "bullmq";
|
|
@@ -139,8 +139,8 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
139
139
|
}, z.core.$strip>, z.ZodObject<{
|
|
140
140
|
name: z.ZodLiteral<"message-bus">;
|
|
141
141
|
messageBus: z.ZodEnum<{
|
|
142
|
-
|
|
143
|
-
sns: "sns";
|
|
142
|
+
aws_sqs: "aws_sqs";
|
|
143
|
+
"aws.sns": "aws.sns";
|
|
144
144
|
s3: "s3";
|
|
145
145
|
eventbridge: "eventbridge";
|
|
146
146
|
bullmq: "bullmq";
|
|
@@ -151,6 +151,10 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
151
151
|
"cloudflare-tail": "cloudflare-tail";
|
|
152
152
|
}>;
|
|
153
153
|
channel: z.ZodNullable<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
|
+
name: z.ZodLiteral<"metric">;
|
|
156
|
+
metricSystem: z.ZodString;
|
|
157
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
154
158
|
}, z.core.$strip>], "name">;
|
|
155
159
|
type Semantics = z.infer<typeof SemanticsSchema>;
|
|
156
160
|
|
|
@@ -334,8 +338,8 @@ declare const BoundaryBindingSchema: z.ZodObject<{
|
|
|
334
338
|
}, z.core.$strip>, z.ZodObject<{
|
|
335
339
|
name: z.ZodLiteral<"message-bus">;
|
|
336
340
|
messageBus: z.ZodEnum<{
|
|
337
|
-
|
|
338
|
-
sns: "sns";
|
|
341
|
+
aws_sqs: "aws_sqs";
|
|
342
|
+
"aws.sns": "aws.sns";
|
|
339
343
|
s3: "s3";
|
|
340
344
|
eventbridge: "eventbridge";
|
|
341
345
|
bullmq: "bullmq";
|
|
@@ -346,6 +350,10 @@ declare const BoundaryBindingSchema: z.ZodObject<{
|
|
|
346
350
|
"cloudflare-tail": "cloudflare-tail";
|
|
347
351
|
}>;
|
|
348
352
|
channel: z.ZodNullable<z.ZodString>;
|
|
353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
+
name: z.ZodLiteral<"metric">;
|
|
355
|
+
metricSystem: z.ZodString;
|
|
356
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
349
357
|
}, z.core.$strip>], "name">;
|
|
350
358
|
recognition: z.ZodString;
|
|
351
359
|
}, z.core.$strip>;
|
|
@@ -62,8 +62,8 @@ type GraphqlResolverSemantics = z.infer<typeof GraphqlResolverSemanticsSchema>;
|
|
|
62
62
|
declare const MessageBusSemanticsSchema: z.ZodObject<{
|
|
63
63
|
name: z.ZodLiteral<"message-bus">;
|
|
64
64
|
messageBus: z.ZodEnum<{
|
|
65
|
-
|
|
66
|
-
sns: "sns";
|
|
65
|
+
aws_sqs: "aws_sqs";
|
|
66
|
+
"aws.sns": "aws.sns";
|
|
67
67
|
s3: "s3";
|
|
68
68
|
eventbridge: "eventbridge";
|
|
69
69
|
bullmq: "bullmq";
|
|
@@ -139,8 +139,8 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
139
139
|
}, z.core.$strip>, z.ZodObject<{
|
|
140
140
|
name: z.ZodLiteral<"message-bus">;
|
|
141
141
|
messageBus: z.ZodEnum<{
|
|
142
|
-
|
|
143
|
-
sns: "sns";
|
|
142
|
+
aws_sqs: "aws_sqs";
|
|
143
|
+
"aws.sns": "aws.sns";
|
|
144
144
|
s3: "s3";
|
|
145
145
|
eventbridge: "eventbridge";
|
|
146
146
|
bullmq: "bullmq";
|
|
@@ -151,6 +151,10 @@ declare const SemanticsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
151
151
|
"cloudflare-tail": "cloudflare-tail";
|
|
152
152
|
}>;
|
|
153
153
|
channel: z.ZodNullable<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
155
|
+
name: z.ZodLiteral<"metric">;
|
|
156
|
+
metricSystem: z.ZodString;
|
|
157
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
154
158
|
}, z.core.$strip>], "name">;
|
|
155
159
|
type Semantics = z.infer<typeof SemanticsSchema>;
|
|
156
160
|
|
|
@@ -334,8 +338,8 @@ declare const BoundaryBindingSchema: z.ZodObject<{
|
|
|
334
338
|
}, z.core.$strip>, z.ZodObject<{
|
|
335
339
|
name: z.ZodLiteral<"message-bus">;
|
|
336
340
|
messageBus: z.ZodEnum<{
|
|
337
|
-
|
|
338
|
-
sns: "sns";
|
|
341
|
+
aws_sqs: "aws_sqs";
|
|
342
|
+
"aws.sns": "aws.sns";
|
|
339
343
|
s3: "s3";
|
|
340
344
|
eventbridge: "eventbridge";
|
|
341
345
|
bullmq: "bullmq";
|
|
@@ -346,6 +350,10 @@ declare const BoundaryBindingSchema: z.ZodObject<{
|
|
|
346
350
|
"cloudflare-tail": "cloudflare-tail";
|
|
347
351
|
}>;
|
|
348
352
|
channel: z.ZodNullable<z.ZodString>;
|
|
353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
+
name: z.ZodLiteral<"metric">;
|
|
355
|
+
metricSystem: z.ZodString;
|
|
356
|
+
metricType: z.ZodNullable<z.ZodString>;
|
|
349
357
|
}, z.core.$strip>], "name">;
|
|
350
358
|
recognition: z.ZodString;
|
|
351
359
|
}, z.core.$strip>;
|