@suss/ir-core 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-52CH76PE.js → chunk-QHFMZPEG.js} +127 -50
- package/dist/index.cjs +246 -65
- package/dist/index.d.cts +147 -3
- package/dist/index.d.ts +147 -3
- package/dist/index.js +114 -15
- 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 +121 -50
- 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.cjs
CHANGED
|
@@ -26,11 +26,14 @@ __export(index_exports, {
|
|
|
26
26
|
ConfidenceSourceSchema: () => ConfidenceSourceSchema,
|
|
27
27
|
CorroborationSchema: () => CorroborationSchema,
|
|
28
28
|
DeployableUnitSchema: () => DeployableUnitSchema,
|
|
29
|
+
EVERY_FIELD: () => EVERY_FIELD,
|
|
30
|
+
EffectRelationSchema: () => EffectRelationSchema,
|
|
29
31
|
FunctionCallSemanticsSchema: () => FunctionCallSemanticsSchema,
|
|
30
32
|
GraphqlOperationSemanticsSchema: () => GraphqlOperationSemanticsSchema,
|
|
31
33
|
GraphqlResolverSemanticsSchema: () => GraphqlResolverSemanticsSchema,
|
|
32
34
|
MessageBusSemanticsSchema: () => MessageBusSemanticsSchema,
|
|
33
35
|
MetricSemanticsSchema: () => MetricSemanticsSchema,
|
|
36
|
+
RelationSchema: () => RelationSchema,
|
|
34
37
|
RestSemanticsSchema: () => RestSemanticsSchema,
|
|
35
38
|
RuntimeConfigSemanticsSchema: () => RuntimeConfigSemanticsSchema,
|
|
36
39
|
SemanticsSchema: () => SemanticsSchema,
|
|
@@ -39,7 +42,10 @@ __export(index_exports, {
|
|
|
39
42
|
SuppressionFileSchema: () => SuppressionFileSchema,
|
|
40
43
|
SuppressionRuleSchema: () => SuppressionRuleSchema,
|
|
41
44
|
TypeShapeSchema: () => TypeShapeSchema,
|
|
45
|
+
UnitInvocationSemanticsSchema: () => UnitInvocationSemanticsSchema,
|
|
42
46
|
applySuppressionsToFindings: () => applySuppressionsToFindings,
|
|
47
|
+
bindingIs: () => bindingIs,
|
|
48
|
+
bindingTokens: () => bindingTokens,
|
|
43
49
|
bodyShapesMatch: () => bodyShapesMatch,
|
|
44
50
|
boundaryKey: () => boundaryKey,
|
|
45
51
|
boundaryLabel: () => boundaryLabel,
|
|
@@ -72,6 +78,8 @@ __export(index_exports, {
|
|
|
72
78
|
namePatternFromSub: () => namePatternFromSub,
|
|
73
79
|
namePatternKey: () => namePatternKey,
|
|
74
80
|
namesAgree: () => namesAgree,
|
|
81
|
+
namesBoundary: () => namesBoundary,
|
|
82
|
+
namesBoundaryExactly: () => namesBoundaryExactly,
|
|
75
83
|
namesNothing: () => namesNothing,
|
|
76
84
|
normalizePath: () => normalizePath,
|
|
77
85
|
normalizeRuleBoundary: () => normalizeRuleBoundary,
|
|
@@ -86,6 +94,7 @@ __export(index_exports, {
|
|
|
86
94
|
referenceName: () => referenceName,
|
|
87
95
|
referenceOf: () => referenceOf,
|
|
88
96
|
reportsUnpairedItself: () => reportsUnpairedItself,
|
|
97
|
+
resourceNameIn: () => resourceNameIn,
|
|
89
98
|
restBinding: () => restBinding,
|
|
90
99
|
routePathAdmits: () => routePathAdmits,
|
|
91
100
|
ruleBoundaryMatchesKey: () => ruleBoundaryMatchesKey,
|
|
@@ -93,12 +102,18 @@ __export(index_exports, {
|
|
|
93
102
|
semanticsAgree: () => semanticsAgree,
|
|
94
103
|
semconvAttributes: () => semconvAttributes,
|
|
95
104
|
servesRequest: () => servesRequest,
|
|
105
|
+
spellingTokens: () => spellingTokens,
|
|
96
106
|
statesAnOrigin: () => statesAnOrigin,
|
|
97
107
|
storageBinding: () => storageBinding,
|
|
108
|
+
storageContainerLabel: () => storageContainerLabel,
|
|
109
|
+
storageLabel: () => storageLabel,
|
|
98
110
|
typeDefinitionKey: () => typeDefinitionKey,
|
|
111
|
+
unitIdentityKey: () => unitIdentityKey,
|
|
112
|
+
unitInvocationBinding: () => unitInvocationBinding,
|
|
99
113
|
validateRule: () => validateRule,
|
|
100
114
|
withDefinitionsInlined: () => withDefinitionsInlined,
|
|
101
|
-
withRewrittenPaths: () => withRewrittenPaths
|
|
115
|
+
withRewrittenPaths: () => withRewrittenPaths,
|
|
116
|
+
withinScope: () => withinScope
|
|
102
117
|
});
|
|
103
118
|
module.exports = __toCommonJS(index_exports);
|
|
104
119
|
|
|
@@ -151,15 +166,18 @@ function fnIdentityKey(packageName, exportPath) {
|
|
|
151
166
|
function busIdentityKey(messageBus, subject) {
|
|
152
167
|
return `bus:${messageBus} ${subject}`;
|
|
153
168
|
}
|
|
169
|
+
function unitIdentityKey(deploymentTarget, instanceName) {
|
|
170
|
+
return `unit:${deploymentTarget} ${instanceName}`;
|
|
171
|
+
}
|
|
154
172
|
function metricIdentityKey(metricSystem, metricType) {
|
|
155
173
|
return `metric:${metricSystem} ${metricType}`;
|
|
156
174
|
}
|
|
157
175
|
|
|
158
176
|
// src/schemas.ts
|
|
159
|
-
var
|
|
177
|
+
var import_zod12 = require("zod");
|
|
160
178
|
|
|
161
179
|
// src/semantics/registry.ts
|
|
162
|
-
var
|
|
180
|
+
var import_zod11 = require("zod");
|
|
163
181
|
|
|
164
182
|
// src/semantics/functionCall.ts
|
|
165
183
|
var import_zod2 = require("zod");
|
|
@@ -569,6 +587,14 @@ var restSemantics = defineBoundarySemantics({
|
|
|
569
587
|
}
|
|
570
588
|
return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
|
|
571
589
|
},
|
|
590
|
+
/**
|
|
591
|
+
* A route the registration pattern admits is inside it. A route
|
|
592
|
+
* whose path this source never gave is left outside, because
|
|
593
|
+
* nothing here can show it is one the pattern covers.
|
|
594
|
+
*/
|
|
595
|
+
withinScope(semantics, scope) {
|
|
596
|
+
return semantics.path !== null && routePathAdmits(scope, semantics.path);
|
|
597
|
+
},
|
|
572
598
|
/**
|
|
573
599
|
* A call whose base URL the deployment fills in, resolved to the
|
|
574
600
|
* path it reaches.
|
|
@@ -704,12 +730,71 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
704
730
|
/** A query returns rows or items, not a status and a body. */
|
|
705
731
|
exchangesHttpResponses: false,
|
|
706
732
|
reportsUnpairedItself: false,
|
|
707
|
-
identityKey: () => null
|
|
733
|
+
identityKey: () => null,
|
|
734
|
+
displayLabel: storageLabel
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
function storageLabel(semantics) {
|
|
738
|
+
return `${semantics.storageSystem}:${storageContainerLabel(semantics)}`;
|
|
739
|
+
}
|
|
740
|
+
var EVERY_FIELD = "*";
|
|
741
|
+
function storageContainerLabel(semantics) {
|
|
742
|
+
const container = semantics.container ?? "<unnamed container>";
|
|
743
|
+
const addressed = semantics.accessPath === null ? container : `${container}#${semantics.accessPath}`;
|
|
744
|
+
return semantics.scope === "default" ? addressed : `${semantics.scope}/${addressed}`;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// src/semantics/unitInvocation.ts
|
|
748
|
+
var import_zod10 = require("zod");
|
|
749
|
+
var UnitInvocationSemanticsSchema = DeployableUnitSchema.extend({
|
|
750
|
+
name: import_zod10.z.literal("unit-invocation"),
|
|
751
|
+
instanceName: DeployableUnitSchema.shape.instanceName.nullable()
|
|
752
|
+
});
|
|
753
|
+
var unitInvocationSemantics = defineBoundarySemantics({
|
|
754
|
+
name: "unit-invocation",
|
|
755
|
+
schema: UnitInvocationSemanticsSchema,
|
|
756
|
+
// faas.name is the deployed function's own name and instanceName is
|
|
757
|
+
// the deployment template's logical id, which is a different string.
|
|
758
|
+
// Runtime config leaves the pair off for the same reason.
|
|
759
|
+
semconv: {},
|
|
760
|
+
behavior: {
|
|
761
|
+
/**
|
|
762
|
+
* A synchronous invoke gives back whatever the handler returned,
|
|
763
|
+
* which is a value rather than a status and a body. A handler's
|
|
764
|
+
* return only becomes an HTTP response under a proxy integration,
|
|
765
|
+
* and that route gets a REST binding instead of this one.
|
|
766
|
+
*/
|
|
767
|
+
exchangesHttpResponses: false,
|
|
768
|
+
/**
|
|
769
|
+
* A unit nothing in the run invokes is the ordinary case, since
|
|
770
|
+
* most services are reached from a stack suss never read. So an
|
|
771
|
+
* uninvoked unit stays in the generic unmatched list rather than
|
|
772
|
+
* being reported as a problem here.
|
|
773
|
+
*/
|
|
774
|
+
reportsUnpairedItself: false,
|
|
775
|
+
identityKey(semantics) {
|
|
776
|
+
if (semantics.instanceName === null) {
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
779
|
+
return unitIdentityKey(
|
|
780
|
+
semantics.deploymentTarget,
|
|
781
|
+
semantics.instanceName
|
|
782
|
+
);
|
|
783
|
+
},
|
|
784
|
+
displayLabel(semantics) {
|
|
785
|
+
if (semantics.instanceName === null) {
|
|
786
|
+
return `unit:${semantics.deploymentTarget} (named at runtime)`;
|
|
787
|
+
}
|
|
788
|
+
return unitIdentityKey(
|
|
789
|
+
semantics.deploymentTarget,
|
|
790
|
+
semantics.instanceName
|
|
791
|
+
);
|
|
792
|
+
}
|
|
708
793
|
}
|
|
709
794
|
});
|
|
710
795
|
|
|
711
796
|
// src/semantics/registry.ts
|
|
712
|
-
var SemanticsSchema =
|
|
797
|
+
var SemanticsSchema = import_zod11.z.discriminatedUnion("name", [
|
|
713
798
|
restSemantics.schema,
|
|
714
799
|
functionCallSemantics.schema,
|
|
715
800
|
graphqlResolverSemantics.schema,
|
|
@@ -717,7 +802,8 @@ var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
|
|
|
717
802
|
runtimeConfigSemantics.schema,
|
|
718
803
|
storageSemantics.schema,
|
|
719
804
|
messageBusSemantics.schema,
|
|
720
|
-
metricSemantics.schema
|
|
805
|
+
metricSemantics.schema,
|
|
806
|
+
unitInvocationSemantics.schema
|
|
721
807
|
]);
|
|
722
808
|
var DEFINITIONS = [
|
|
723
809
|
restSemantics,
|
|
@@ -727,7 +813,8 @@ var DEFINITIONS = [
|
|
|
727
813
|
runtimeConfigSemantics,
|
|
728
814
|
storageSemantics,
|
|
729
815
|
messageBusSemantics,
|
|
730
|
-
metricSemantics
|
|
816
|
+
metricSemantics,
|
|
817
|
+
unitInvocationSemantics
|
|
731
818
|
];
|
|
732
819
|
var BY_NAME = new Map(
|
|
733
820
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -750,31 +837,31 @@ function allBehaviors() {
|
|
|
750
837
|
}
|
|
751
838
|
|
|
752
839
|
// src/schemas.ts
|
|
753
|
-
var ConfidenceSourceSchema =
|
|
840
|
+
var ConfidenceSourceSchema = import_zod12.z.enum([
|
|
754
841
|
"inferred_static",
|
|
755
842
|
"inferred_ai",
|
|
756
843
|
"declared",
|
|
757
844
|
"derived"
|
|
758
845
|
]);
|
|
759
|
-
var ConfidenceLevelSchema =
|
|
760
|
-
var CorroborationSchema =
|
|
761
|
-
outcome:
|
|
846
|
+
var ConfidenceLevelSchema = import_zod12.z.enum(["high", "medium", "low"]);
|
|
847
|
+
var CorroborationSchema = import_zod12.z.object({
|
|
848
|
+
outcome: import_zod12.z.enum(["observed", "refuted", "untested"]),
|
|
762
849
|
/** Executions that produced a verdict for this claim. */
|
|
763
|
-
runs:
|
|
850
|
+
runs: import_zod12.z.number(),
|
|
764
851
|
/** Present when refuted: the input and observation that disagreed. */
|
|
765
|
-
counterexample:
|
|
852
|
+
counterexample: import_zod12.z.unknown().optional(),
|
|
766
853
|
/** Present when untested: why no verdict was reachable. */
|
|
767
|
-
reason:
|
|
854
|
+
reason: import_zod12.z.string().optional()
|
|
768
855
|
});
|
|
769
|
-
var ConfidenceInfoSchema =
|
|
856
|
+
var ConfidenceInfoSchema = import_zod12.z.object({
|
|
770
857
|
source: ConfidenceSourceSchema,
|
|
771
858
|
level: ConfidenceLevelSchema,
|
|
772
859
|
corroboration: CorroborationSchema.optional()
|
|
773
860
|
});
|
|
774
|
-
var SourceLocationSchema =
|
|
775
|
-
file:
|
|
861
|
+
var SourceLocationSchema = import_zod12.z.object({
|
|
862
|
+
file: import_zod12.z.string(),
|
|
776
863
|
/** Line numbers, for a person reading the summary or an editor link. */
|
|
777
|
-
range:
|
|
864
|
+
range: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }),
|
|
778
865
|
/**
|
|
779
866
|
* Character offsets of the unit in its file. Identity and joins
|
|
780
867
|
* measure with these, since two functions can share a line and never
|
|
@@ -782,8 +869,8 @@ var SourceLocationSchema = import_zod11.z.object({
|
|
|
782
869
|
* same place. Absent on summaries no source position backs, a
|
|
783
870
|
* contract artifact's say.
|
|
784
871
|
*/
|
|
785
|
-
span:
|
|
786
|
-
exportName:
|
|
872
|
+
span: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }).optional(),
|
|
873
|
+
exportName: import_zod12.z.string().nullable(),
|
|
787
874
|
/**
|
|
788
875
|
* The project the extract was pointed at, by the name that project
|
|
789
876
|
* calls itself.
|
|
@@ -793,47 +880,47 @@ var SourceLocationSchema = import_zod11.z.object({
|
|
|
793
880
|
* summaries puts them on top of each other. This field is what tells
|
|
794
881
|
* them apart, and what a reader groups by.
|
|
795
882
|
*/
|
|
796
|
-
workspace:
|
|
883
|
+
workspace: import_zod12.z.string().optional()
|
|
797
884
|
});
|
|
798
|
-
var BoundaryBindingSchema =
|
|
799
|
-
transport:
|
|
885
|
+
var BoundaryBindingSchema = import_zod12.z.object({
|
|
886
|
+
transport: import_zod12.z.string(),
|
|
800
887
|
semantics: SemanticsSchema,
|
|
801
|
-
recognition:
|
|
888
|
+
recognition: import_zod12.z.string()
|
|
802
889
|
});
|
|
803
890
|
function typeDefinitionKey(ref) {
|
|
804
891
|
return ref.def ?? null;
|
|
805
892
|
}
|
|
806
|
-
var TypeShapeSchema =
|
|
807
|
-
() =>
|
|
808
|
-
|
|
809
|
-
type:
|
|
810
|
-
properties:
|
|
811
|
-
spreads:
|
|
893
|
+
var TypeShapeSchema = import_zod12.z.lazy(
|
|
894
|
+
() => import_zod12.z.discriminatedUnion("type", [
|
|
895
|
+
import_zod12.z.object({
|
|
896
|
+
type: import_zod12.z.literal("record"),
|
|
897
|
+
properties: import_zod12.z.record(import_zod12.z.string(), TypeShapeSchema),
|
|
898
|
+
spreads: import_zod12.z.array(import_zod12.z.object({ sourceText: import_zod12.z.string() })).optional()
|
|
812
899
|
}),
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
type:
|
|
817
|
-
value:
|
|
818
|
-
raw:
|
|
900
|
+
import_zod12.z.object({ type: import_zod12.z.literal("dictionary"), values: TypeShapeSchema }),
|
|
901
|
+
import_zod12.z.object({ type: import_zod12.z.literal("array"), items: TypeShapeSchema }),
|
|
902
|
+
import_zod12.z.object({
|
|
903
|
+
type: import_zod12.z.literal("literal"),
|
|
904
|
+
value: import_zod12.z.union([import_zod12.z.string(), import_zod12.z.number(), import_zod12.z.boolean()]),
|
|
905
|
+
raw: import_zod12.z.string().optional()
|
|
819
906
|
}),
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
type:
|
|
828
|
-
variants:
|
|
907
|
+
import_zod12.z.object({ type: import_zod12.z.literal("text") }),
|
|
908
|
+
import_zod12.z.object({ type: import_zod12.z.literal("integer") }),
|
|
909
|
+
import_zod12.z.object({ type: import_zod12.z.literal("number") }),
|
|
910
|
+
import_zod12.z.object({ type: import_zod12.z.literal("boolean") }),
|
|
911
|
+
import_zod12.z.object({ type: import_zod12.z.literal("null") }),
|
|
912
|
+
import_zod12.z.object({ type: import_zod12.z.literal("undefined") }),
|
|
913
|
+
import_zod12.z.object({
|
|
914
|
+
type: import_zod12.z.literal("union"),
|
|
915
|
+
variants: import_zod12.z.array(TypeShapeSchema)
|
|
829
916
|
}),
|
|
830
|
-
|
|
831
|
-
type:
|
|
832
|
-
name:
|
|
833
|
-
from:
|
|
834
|
-
def:
|
|
917
|
+
import_zod12.z.object({
|
|
918
|
+
type: import_zod12.z.literal("ref"),
|
|
919
|
+
name: import_zod12.z.string(),
|
|
920
|
+
from: import_zod12.z.string().optional(),
|
|
921
|
+
def: import_zod12.z.string().optional()
|
|
835
922
|
}),
|
|
836
|
-
|
|
923
|
+
import_zod12.z.object({ type: import_zod12.z.literal("unknown") })
|
|
837
924
|
])
|
|
838
925
|
);
|
|
839
926
|
var MAX_DEFINITION_DEPTH = 6;
|
|
@@ -897,6 +984,9 @@ function semconvAttributes(binding) {
|
|
|
897
984
|
}
|
|
898
985
|
|
|
899
986
|
// src/boundaryKey.ts
|
|
987
|
+
function bindingIs(binding, name) {
|
|
988
|
+
return binding?.semantics.name === name;
|
|
989
|
+
}
|
|
900
990
|
function boundaryKey(binding) {
|
|
901
991
|
return behaviorOf(binding.semantics).identityKey(binding.semantics);
|
|
902
992
|
}
|
|
@@ -964,6 +1054,10 @@ function servesRequest(binding, method, path) {
|
|
|
964
1054
|
}
|
|
965
1055
|
return serves(binding.semantics, method, path);
|
|
966
1056
|
}
|
|
1057
|
+
function withinScope(binding, scope) {
|
|
1058
|
+
const within = behaviorOf(binding.semantics).withinScope;
|
|
1059
|
+
return within === void 0 ? false : within(binding.semantics, scope);
|
|
1060
|
+
}
|
|
967
1061
|
|
|
968
1062
|
// src/dispatch.ts
|
|
969
1063
|
function dispatchByType(table, value) {
|
|
@@ -1100,6 +1194,57 @@ function referenceFromName(name) {
|
|
|
1100
1194
|
return referenceOf(parseBoundaryName(name));
|
|
1101
1195
|
}
|
|
1102
1196
|
|
|
1197
|
+
// src/boundarySpelling.ts
|
|
1198
|
+
function resourceNameIn(spelling) {
|
|
1199
|
+
if (spelling.startsWith("arn:")) {
|
|
1200
|
+
const segments2 = spelling.split(":");
|
|
1201
|
+
return segments2[6] ?? segments2[5] ?? spelling;
|
|
1202
|
+
}
|
|
1203
|
+
const segments = spelling.split("/");
|
|
1204
|
+
if (segments.length >= 4 && segments.length % 2 === 0) {
|
|
1205
|
+
return segments[segments.length - 1] ?? spelling;
|
|
1206
|
+
}
|
|
1207
|
+
return spelling;
|
|
1208
|
+
}
|
|
1209
|
+
function spellingTokens(text) {
|
|
1210
|
+
return text.toLowerCase().replace(/[{}]/g, " ").split(/[\s:#,()/]+/).filter((token) => token.length > 0);
|
|
1211
|
+
}
|
|
1212
|
+
function bindingTokens(binding) {
|
|
1213
|
+
const tokens = new Set(spellingTokens(displayLabel(binding)));
|
|
1214
|
+
for (const value of Object.values(binding.semantics)) {
|
|
1215
|
+
if (typeof value === "string") {
|
|
1216
|
+
for (const token of spellingTokens(value)) {
|
|
1217
|
+
tokens.add(token);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
for (const token of [...tokens]) {
|
|
1222
|
+
for (const part of token.split(".")) {
|
|
1223
|
+
tokens.add(part);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return tokens;
|
|
1227
|
+
}
|
|
1228
|
+
function namesBoundaryExactly(subject, binding) {
|
|
1229
|
+
const wanted = new Set(spellingTokens(subject));
|
|
1230
|
+
if (wanted.size === 0) {
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
1233
|
+
const spelled = new Set(spellingTokens(displayLabel(binding)));
|
|
1234
|
+
if (spelled.size !== wanted.size) {
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
return [...spelled].every((token) => wanted.has(token));
|
|
1238
|
+
}
|
|
1239
|
+
function namesBoundary(subject, binding) {
|
|
1240
|
+
const wanted = spellingTokens(subject);
|
|
1241
|
+
if (wanted.length === 0) {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
const tokens = bindingTokens(binding);
|
|
1245
|
+
return wanted.every((token) => tokens.has(token));
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1103
1248
|
// src/codeScope.ts
|
|
1104
1249
|
function codeScopePath(raw) {
|
|
1105
1250
|
return raw.trim().replace(/^\.\//, "").replace(/\/+$/, "");
|
|
@@ -1113,26 +1258,36 @@ function fileInCodeScope(file, scope) {
|
|
|
1113
1258
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
1114
1259
|
}
|
|
1115
1260
|
|
|
1261
|
+
// src/relation.ts
|
|
1262
|
+
var import_zod13 = require("zod");
|
|
1263
|
+
var RelationSchema = import_zod13.z.enum([
|
|
1264
|
+
"provides",
|
|
1265
|
+
"reads",
|
|
1266
|
+
"writes",
|
|
1267
|
+
"invokes"
|
|
1268
|
+
]);
|
|
1269
|
+
var EffectRelationSchema = RelationSchema.exclude(["provides"]);
|
|
1270
|
+
|
|
1116
1271
|
// src/suppressions.ts
|
|
1117
|
-
var
|
|
1118
|
-
var SuppressionSideSchema =
|
|
1119
|
-
summary:
|
|
1120
|
-
transitionId:
|
|
1272
|
+
var import_zod14 = require("zod");
|
|
1273
|
+
var SuppressionSideSchema = import_zod14.z.object({
|
|
1274
|
+
summary: import_zod14.z.string().optional(),
|
|
1275
|
+
transitionId: import_zod14.z.string().optional()
|
|
1121
1276
|
}).optional();
|
|
1122
|
-
var SuppressionRuleSchema =
|
|
1277
|
+
var SuppressionRuleSchema = import_zod14.z.object({
|
|
1123
1278
|
/**
|
|
1124
1279
|
* The finding kind to match, behavioural or intent. It is an open
|
|
1125
1280
|
* string here because this package is below both IRs, and the loader
|
|
1126
1281
|
* is what validates it against the published kind enums.
|
|
1127
1282
|
*/
|
|
1128
|
-
kind:
|
|
1283
|
+
kind: import_zod14.z.string().optional(),
|
|
1129
1284
|
/**
|
|
1130
1285
|
* Boundary as a human-readable key, e.g. "GET /pet/{petId}" or
|
|
1131
1286
|
* "fn:@acme/api::getUser". REST keys are normalized via the same
|
|
1132
1287
|
* path normalizer the checkers use, so `:id` and `{id}` compare
|
|
1133
1288
|
* equal.
|
|
1134
1289
|
*/
|
|
1135
|
-
boundary:
|
|
1290
|
+
boundary: import_zod14.z.string().optional(),
|
|
1136
1291
|
/**
|
|
1137
1292
|
* Consumer-side discriminators, the narrowest useful match. These
|
|
1138
1293
|
* mean something only for behavioural findings: a rule that
|
|
@@ -1155,15 +1310,15 @@ var SuppressionRuleSchema = import_zod12.z.object({
|
|
|
1155
1310
|
* kind-only or boundary-only matches, which also silence future
|
|
1156
1311
|
* regressions in that category.
|
|
1157
1312
|
*/
|
|
1158
|
-
scope:
|
|
1313
|
+
scope: import_zod14.z.enum(["narrow", "broad"]).default("narrow"),
|
|
1159
1314
|
/** Required human-written justification. */
|
|
1160
|
-
reason:
|
|
1315
|
+
reason: import_zod14.z.string().min(1),
|
|
1161
1316
|
/** What to do when a finding matches. */
|
|
1162
|
-
effect:
|
|
1317
|
+
effect: import_zod14.z.enum(["mark", "downgrade", "hide"]).default("mark")
|
|
1163
1318
|
}).strict();
|
|
1164
|
-
var SuppressionFileSchema =
|
|
1165
|
-
version:
|
|
1166
|
-
rules:
|
|
1319
|
+
var SuppressionFileSchema = import_zod14.z.object({
|
|
1320
|
+
version: import_zod14.z.literal(1),
|
|
1321
|
+
rules: import_zod14.z.array(SuppressionRuleSchema)
|
|
1167
1322
|
}).strict();
|
|
1168
1323
|
function validateRule(rule) {
|
|
1169
1324
|
if (rule.scope === "broad") {
|
|
@@ -1453,6 +1608,17 @@ function runtimeConfigBinding(opts) {
|
|
|
1453
1608
|
recognition: opts.recognition
|
|
1454
1609
|
};
|
|
1455
1610
|
}
|
|
1611
|
+
function unitInvocationBinding(opts) {
|
|
1612
|
+
return {
|
|
1613
|
+
transport: "invoke",
|
|
1614
|
+
semantics: {
|
|
1615
|
+
name: "unit-invocation",
|
|
1616
|
+
deploymentTarget: opts.deploymentTarget,
|
|
1617
|
+
instanceName: namedOrNull(opts.instanceName, "invoked unit")
|
|
1618
|
+
},
|
|
1619
|
+
recognition: opts.recognition
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1456
1622
|
function storageBinding(opts) {
|
|
1457
1623
|
return {
|
|
1458
1624
|
transport: opts.transport ?? opts.storageSystem,
|
|
@@ -1496,11 +1662,14 @@ function metricBinding(opts) {
|
|
|
1496
1662
|
ConfidenceSourceSchema,
|
|
1497
1663
|
CorroborationSchema,
|
|
1498
1664
|
DeployableUnitSchema,
|
|
1665
|
+
EVERY_FIELD,
|
|
1666
|
+
EffectRelationSchema,
|
|
1499
1667
|
FunctionCallSemanticsSchema,
|
|
1500
1668
|
GraphqlOperationSemanticsSchema,
|
|
1501
1669
|
GraphqlResolverSemanticsSchema,
|
|
1502
1670
|
MessageBusSemanticsSchema,
|
|
1503
1671
|
MetricSemanticsSchema,
|
|
1672
|
+
RelationSchema,
|
|
1504
1673
|
RestSemanticsSchema,
|
|
1505
1674
|
RuntimeConfigSemanticsSchema,
|
|
1506
1675
|
SemanticsSchema,
|
|
@@ -1509,7 +1678,10 @@ function metricBinding(opts) {
|
|
|
1509
1678
|
SuppressionFileSchema,
|
|
1510
1679
|
SuppressionRuleSchema,
|
|
1511
1680
|
TypeShapeSchema,
|
|
1681
|
+
UnitInvocationSemanticsSchema,
|
|
1512
1682
|
applySuppressionsToFindings,
|
|
1683
|
+
bindingIs,
|
|
1684
|
+
bindingTokens,
|
|
1513
1685
|
bodyShapesMatch,
|
|
1514
1686
|
boundaryKey,
|
|
1515
1687
|
boundaryLabel,
|
|
@@ -1542,6 +1714,8 @@ function metricBinding(opts) {
|
|
|
1542
1714
|
namePatternFromSub,
|
|
1543
1715
|
namePatternKey,
|
|
1544
1716
|
namesAgree,
|
|
1717
|
+
namesBoundary,
|
|
1718
|
+
namesBoundaryExactly,
|
|
1545
1719
|
namesNothing,
|
|
1546
1720
|
normalizePath,
|
|
1547
1721
|
normalizeRuleBoundary,
|
|
@@ -1556,6 +1730,7 @@ function metricBinding(opts) {
|
|
|
1556
1730
|
referenceName,
|
|
1557
1731
|
referenceOf,
|
|
1558
1732
|
reportsUnpairedItself,
|
|
1733
|
+
resourceNameIn,
|
|
1559
1734
|
restBinding,
|
|
1560
1735
|
routePathAdmits,
|
|
1561
1736
|
ruleBoundaryMatchesKey,
|
|
@@ -1563,10 +1738,16 @@ function metricBinding(opts) {
|
|
|
1563
1738
|
semanticsAgree,
|
|
1564
1739
|
semconvAttributes,
|
|
1565
1740
|
servesRequest,
|
|
1741
|
+
spellingTokens,
|
|
1566
1742
|
statesAnOrigin,
|
|
1567
1743
|
storageBinding,
|
|
1744
|
+
storageContainerLabel,
|
|
1745
|
+
storageLabel,
|
|
1568
1746
|
typeDefinitionKey,
|
|
1747
|
+
unitIdentityKey,
|
|
1748
|
+
unitInvocationBinding,
|
|
1569
1749
|
validateRule,
|
|
1570
1750
|
withDefinitionsInlined,
|
|
1571
|
-
withRewrittenPaths
|
|
1751
|
+
withRewrittenPaths,
|
|
1752
|
+
withinScope
|
|
1572
1753
|
});
|