@suss/ir-core 0.19.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-HSJYPBJU.js → chunk-QHFMZPEG.js} +148 -52
- package/dist/index.cjs +279 -67
- package/dist/index.d.cts +159 -3
- package/dist/index.d.ts +159 -3
- package/dist/index.js +125 -15
- package/dist/{schemas-k-169oiY.d.cts → schemas-Dn1AzzWd.d.cts} +41 -1
- package/dist/{schemas-k-169oiY.d.ts → schemas-Dn1AzzWd.d.ts} +41 -1
- package/dist/schemas.cjs +142 -52
- 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,11 +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
|
-
withDefinitionsInlined: () => withDefinitionsInlined
|
|
114
|
+
withDefinitionsInlined: () => withDefinitionsInlined,
|
|
115
|
+
withRewrittenPaths: () => withRewrittenPaths,
|
|
116
|
+
withinScope: () => withinScope
|
|
101
117
|
});
|
|
102
118
|
module.exports = __toCommonJS(index_exports);
|
|
103
119
|
|
|
@@ -150,15 +166,18 @@ function fnIdentityKey(packageName, exportPath) {
|
|
|
150
166
|
function busIdentityKey(messageBus, subject) {
|
|
151
167
|
return `bus:${messageBus} ${subject}`;
|
|
152
168
|
}
|
|
169
|
+
function unitIdentityKey(deploymentTarget, instanceName) {
|
|
170
|
+
return `unit:${deploymentTarget} ${instanceName}`;
|
|
171
|
+
}
|
|
153
172
|
function metricIdentityKey(metricSystem, metricType) {
|
|
154
173
|
return `metric:${metricSystem} ${metricType}`;
|
|
155
174
|
}
|
|
156
175
|
|
|
157
176
|
// src/schemas.ts
|
|
158
|
-
var
|
|
177
|
+
var import_zod12 = require("zod");
|
|
159
178
|
|
|
160
179
|
// src/semantics/registry.ts
|
|
161
|
-
var
|
|
180
|
+
var import_zod11 = require("zod");
|
|
162
181
|
|
|
163
182
|
// src/semantics/functionCall.ts
|
|
164
183
|
var import_zod2 = require("zod");
|
|
@@ -210,14 +229,24 @@ var functionCallSemantics = defineBoundarySemantics({
|
|
|
210
229
|
*/
|
|
211
230
|
canPair: () => true,
|
|
212
231
|
/**
|
|
213
|
-
* `"fn:<package>::<exportPath>"` when both are set
|
|
214
|
-
*
|
|
215
|
-
*
|
|
232
|
+
* `"fn:<package>::<exportPath>"` when both are set, and
|
|
233
|
+
* `"fn:<module>::<exportName>"` for an in-repo unit that states its
|
|
234
|
+
* module, the way a server action does. Components and bare
|
|
235
|
+
* handlers state neither and have no key at all.
|
|
216
236
|
*/
|
|
237
|
+
rewritePaths(semantics, rewrite) {
|
|
238
|
+
if (semantics.module === void 0) {
|
|
239
|
+
return semantics;
|
|
240
|
+
}
|
|
241
|
+
return { ...semantics, module: rewrite(semantics.module) };
|
|
242
|
+
},
|
|
217
243
|
identityKey(semantics) {
|
|
218
244
|
if (semantics.package !== void 0 && semantics.exportPath !== void 0 && semantics.exportPath.length > 0) {
|
|
219
245
|
return fnIdentityKey(semantics.package, semantics.exportPath);
|
|
220
246
|
}
|
|
247
|
+
if (semantics.module !== void 0 && semantics.exportName !== void 0) {
|
|
248
|
+
return fnIdentityKey(semantics.module, [semantics.exportName]);
|
|
249
|
+
}
|
|
221
250
|
return null;
|
|
222
251
|
}
|
|
223
252
|
}
|
|
@@ -558,6 +587,14 @@ var restSemantics = defineBoundarySemantics({
|
|
|
558
587
|
}
|
|
559
588
|
return routePathAdmits(semantics.path, path) ? "match" : "nomatch";
|
|
560
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
|
+
},
|
|
561
598
|
/**
|
|
562
599
|
* A call whose base URL the deployment fills in, resolved to the
|
|
563
600
|
* path it reaches.
|
|
@@ -693,12 +730,71 @@ var storageSemantics = defineBoundarySemantics({
|
|
|
693
730
|
/** A query returns rows or items, not a status and a body. */
|
|
694
731
|
exchangesHttpResponses: false,
|
|
695
732
|
reportsUnpairedItself: false,
|
|
696
|
-
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
|
+
}
|
|
697
793
|
}
|
|
698
794
|
});
|
|
699
795
|
|
|
700
796
|
// src/semantics/registry.ts
|
|
701
|
-
var SemanticsSchema =
|
|
797
|
+
var SemanticsSchema = import_zod11.z.discriminatedUnion("name", [
|
|
702
798
|
restSemantics.schema,
|
|
703
799
|
functionCallSemantics.schema,
|
|
704
800
|
graphqlResolverSemantics.schema,
|
|
@@ -706,7 +802,8 @@ var SemanticsSchema = import_zod10.z.discriminatedUnion("name", [
|
|
|
706
802
|
runtimeConfigSemantics.schema,
|
|
707
803
|
storageSemantics.schema,
|
|
708
804
|
messageBusSemantics.schema,
|
|
709
|
-
metricSemantics.schema
|
|
805
|
+
metricSemantics.schema,
|
|
806
|
+
unitInvocationSemantics.schema
|
|
710
807
|
]);
|
|
711
808
|
var DEFINITIONS = [
|
|
712
809
|
restSemantics,
|
|
@@ -716,7 +813,8 @@ var DEFINITIONS = [
|
|
|
716
813
|
runtimeConfigSemantics,
|
|
717
814
|
storageSemantics,
|
|
718
815
|
messageBusSemantics,
|
|
719
|
-
metricSemantics
|
|
816
|
+
metricSemantics,
|
|
817
|
+
unitInvocationSemantics
|
|
720
818
|
];
|
|
721
819
|
var BY_NAME = new Map(
|
|
722
820
|
DEFINITIONS.map((d) => [d.name, d])
|
|
@@ -739,31 +837,40 @@ function allBehaviors() {
|
|
|
739
837
|
}
|
|
740
838
|
|
|
741
839
|
// src/schemas.ts
|
|
742
|
-
var ConfidenceSourceSchema =
|
|
840
|
+
var ConfidenceSourceSchema = import_zod12.z.enum([
|
|
743
841
|
"inferred_static",
|
|
744
842
|
"inferred_ai",
|
|
745
843
|
"declared",
|
|
746
844
|
"derived"
|
|
747
845
|
]);
|
|
748
|
-
var ConfidenceLevelSchema =
|
|
749
|
-
var CorroborationSchema =
|
|
750
|
-
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"]),
|
|
751
849
|
/** Executions that produced a verdict for this claim. */
|
|
752
|
-
runs:
|
|
850
|
+
runs: import_zod12.z.number(),
|
|
753
851
|
/** Present when refuted: the input and observation that disagreed. */
|
|
754
|
-
counterexample:
|
|
852
|
+
counterexample: import_zod12.z.unknown().optional(),
|
|
755
853
|
/** Present when untested: why no verdict was reachable. */
|
|
756
|
-
reason:
|
|
854
|
+
reason: import_zod12.z.string().optional()
|
|
757
855
|
});
|
|
758
|
-
var ConfidenceInfoSchema =
|
|
856
|
+
var ConfidenceInfoSchema = import_zod12.z.object({
|
|
759
857
|
source: ConfidenceSourceSchema,
|
|
760
858
|
level: ConfidenceLevelSchema,
|
|
761
859
|
corroboration: CorroborationSchema.optional()
|
|
762
860
|
});
|
|
763
|
-
var SourceLocationSchema =
|
|
764
|
-
file:
|
|
765
|
-
|
|
766
|
-
|
|
861
|
+
var SourceLocationSchema = import_zod12.z.object({
|
|
862
|
+
file: import_zod12.z.string(),
|
|
863
|
+
/** Line numbers, for a person reading the summary or an editor link. */
|
|
864
|
+
range: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }),
|
|
865
|
+
/**
|
|
866
|
+
* Character offsets of the unit in its file. Identity and joins
|
|
867
|
+
* measure with these, since two functions can share a line and never
|
|
868
|
+
* an offset range; the line `range` above is the presentation of the
|
|
869
|
+
* same place. Absent on summaries no source position backs, a
|
|
870
|
+
* contract artifact's say.
|
|
871
|
+
*/
|
|
872
|
+
span: import_zod12.z.object({ start: import_zod12.z.number(), end: import_zod12.z.number() }).optional(),
|
|
873
|
+
exportName: import_zod12.z.string().nullable(),
|
|
767
874
|
/**
|
|
768
875
|
* The project the extract was pointed at, by the name that project
|
|
769
876
|
* calls itself.
|
|
@@ -773,47 +880,47 @@ var SourceLocationSchema = import_zod11.z.object({
|
|
|
773
880
|
* summaries puts them on top of each other. This field is what tells
|
|
774
881
|
* them apart, and what a reader groups by.
|
|
775
882
|
*/
|
|
776
|
-
workspace:
|
|
883
|
+
workspace: import_zod12.z.string().optional()
|
|
777
884
|
});
|
|
778
|
-
var BoundaryBindingSchema =
|
|
779
|
-
transport:
|
|
885
|
+
var BoundaryBindingSchema = import_zod12.z.object({
|
|
886
|
+
transport: import_zod12.z.string(),
|
|
780
887
|
semantics: SemanticsSchema,
|
|
781
|
-
recognition:
|
|
888
|
+
recognition: import_zod12.z.string()
|
|
782
889
|
});
|
|
783
890
|
function typeDefinitionKey(ref) {
|
|
784
891
|
return ref.def ?? null;
|
|
785
892
|
}
|
|
786
|
-
var TypeShapeSchema =
|
|
787
|
-
() =>
|
|
788
|
-
|
|
789
|
-
type:
|
|
790
|
-
properties:
|
|
791
|
-
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()
|
|
792
899
|
}),
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
type:
|
|
797
|
-
value:
|
|
798
|
-
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()
|
|
799
906
|
}),
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
type:
|
|
808
|
-
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)
|
|
809
916
|
}),
|
|
810
|
-
|
|
811
|
-
type:
|
|
812
|
-
name:
|
|
813
|
-
from:
|
|
814
|
-
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()
|
|
815
922
|
}),
|
|
816
|
-
|
|
923
|
+
import_zod12.z.object({ type: import_zod12.z.literal("unknown") })
|
|
817
924
|
])
|
|
818
925
|
);
|
|
819
926
|
var MAX_DEFINITION_DEPTH = 6;
|
|
@@ -877,9 +984,22 @@ function semconvAttributes(binding) {
|
|
|
877
984
|
}
|
|
878
985
|
|
|
879
986
|
// src/boundaryKey.ts
|
|
987
|
+
function bindingIs(binding, name) {
|
|
988
|
+
return binding?.semantics.name === name;
|
|
989
|
+
}
|
|
880
990
|
function boundaryKey(binding) {
|
|
881
991
|
return behaviorOf(binding.semantics).identityKey(binding.semantics);
|
|
882
992
|
}
|
|
993
|
+
function withRewrittenPaths(binding, rewrite) {
|
|
994
|
+
const behavior = behaviorOf(binding.semantics);
|
|
995
|
+
if (behavior.rewritePaths === void 0) {
|
|
996
|
+
return binding;
|
|
997
|
+
}
|
|
998
|
+
return {
|
|
999
|
+
...binding,
|
|
1000
|
+
semantics: behavior.rewritePaths(binding.semantics, rewrite)
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
883
1003
|
function groundedPairingKey(binding, deployedAs) {
|
|
884
1004
|
const behavior = behaviorOf(binding.semantics);
|
|
885
1005
|
const grounded = behavior.groundName?.(binding.semantics, deployedAs) ?? null;
|
|
@@ -934,6 +1054,10 @@ function servesRequest(binding, method, path) {
|
|
|
934
1054
|
}
|
|
935
1055
|
return serves(binding.semantics, method, path);
|
|
936
1056
|
}
|
|
1057
|
+
function withinScope(binding, scope) {
|
|
1058
|
+
const within = behaviorOf(binding.semantics).withinScope;
|
|
1059
|
+
return within === void 0 ? false : within(binding.semantics, scope);
|
|
1060
|
+
}
|
|
937
1061
|
|
|
938
1062
|
// src/dispatch.ts
|
|
939
1063
|
function dispatchByType(table, value) {
|
|
@@ -1070,6 +1194,57 @@ function referenceFromName(name) {
|
|
|
1070
1194
|
return referenceOf(parseBoundaryName(name));
|
|
1071
1195
|
}
|
|
1072
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
|
+
|
|
1073
1248
|
// src/codeScope.ts
|
|
1074
1249
|
function codeScopePath(raw) {
|
|
1075
1250
|
return raw.trim().replace(/^\.\//, "").replace(/\/+$/, "");
|
|
@@ -1083,26 +1258,36 @@ function fileInCodeScope(file, scope) {
|
|
|
1083
1258
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
1084
1259
|
}
|
|
1085
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
|
+
|
|
1086
1271
|
// src/suppressions.ts
|
|
1087
|
-
var
|
|
1088
|
-
var SuppressionSideSchema =
|
|
1089
|
-
summary:
|
|
1090
|
-
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()
|
|
1091
1276
|
}).optional();
|
|
1092
|
-
var SuppressionRuleSchema =
|
|
1277
|
+
var SuppressionRuleSchema = import_zod14.z.object({
|
|
1093
1278
|
/**
|
|
1094
1279
|
* The finding kind to match, behavioural or intent. It is an open
|
|
1095
1280
|
* string here because this package is below both IRs, and the loader
|
|
1096
1281
|
* is what validates it against the published kind enums.
|
|
1097
1282
|
*/
|
|
1098
|
-
kind:
|
|
1283
|
+
kind: import_zod14.z.string().optional(),
|
|
1099
1284
|
/**
|
|
1100
1285
|
* Boundary as a human-readable key, e.g. "GET /pet/{petId}" or
|
|
1101
1286
|
* "fn:@acme/api::getUser". REST keys are normalized via the same
|
|
1102
1287
|
* path normalizer the checkers use, so `:id` and `{id}` compare
|
|
1103
1288
|
* equal.
|
|
1104
1289
|
*/
|
|
1105
|
-
boundary:
|
|
1290
|
+
boundary: import_zod14.z.string().optional(),
|
|
1106
1291
|
/**
|
|
1107
1292
|
* Consumer-side discriminators, the narrowest useful match. These
|
|
1108
1293
|
* mean something only for behavioural findings: a rule that
|
|
@@ -1125,15 +1310,15 @@ var SuppressionRuleSchema = import_zod12.z.object({
|
|
|
1125
1310
|
* kind-only or boundary-only matches, which also silence future
|
|
1126
1311
|
* regressions in that category.
|
|
1127
1312
|
*/
|
|
1128
|
-
scope:
|
|
1313
|
+
scope: import_zod14.z.enum(["narrow", "broad"]).default("narrow"),
|
|
1129
1314
|
/** Required human-written justification. */
|
|
1130
|
-
reason:
|
|
1315
|
+
reason: import_zod14.z.string().min(1),
|
|
1131
1316
|
/** What to do when a finding matches. */
|
|
1132
|
-
effect:
|
|
1317
|
+
effect: import_zod14.z.enum(["mark", "downgrade", "hide"]).default("mark")
|
|
1133
1318
|
}).strict();
|
|
1134
|
-
var SuppressionFileSchema =
|
|
1135
|
-
version:
|
|
1136
|
-
rules:
|
|
1319
|
+
var SuppressionFileSchema = import_zod14.z.object({
|
|
1320
|
+
version: import_zod14.z.literal(1),
|
|
1321
|
+
rules: import_zod14.z.array(SuppressionRuleSchema)
|
|
1137
1322
|
}).strict();
|
|
1138
1323
|
function validateRule(rule) {
|
|
1139
1324
|
if (rule.scope === "broad") {
|
|
@@ -1423,6 +1608,17 @@ function runtimeConfigBinding(opts) {
|
|
|
1423
1608
|
recognition: opts.recognition
|
|
1424
1609
|
};
|
|
1425
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
|
+
}
|
|
1426
1622
|
function storageBinding(opts) {
|
|
1427
1623
|
return {
|
|
1428
1624
|
transport: opts.transport ?? opts.storageSystem,
|
|
@@ -1466,11 +1662,14 @@ function metricBinding(opts) {
|
|
|
1466
1662
|
ConfidenceSourceSchema,
|
|
1467
1663
|
CorroborationSchema,
|
|
1468
1664
|
DeployableUnitSchema,
|
|
1665
|
+
EVERY_FIELD,
|
|
1666
|
+
EffectRelationSchema,
|
|
1469
1667
|
FunctionCallSemanticsSchema,
|
|
1470
1668
|
GraphqlOperationSemanticsSchema,
|
|
1471
1669
|
GraphqlResolverSemanticsSchema,
|
|
1472
1670
|
MessageBusSemanticsSchema,
|
|
1473
1671
|
MetricSemanticsSchema,
|
|
1672
|
+
RelationSchema,
|
|
1474
1673
|
RestSemanticsSchema,
|
|
1475
1674
|
RuntimeConfigSemanticsSchema,
|
|
1476
1675
|
SemanticsSchema,
|
|
@@ -1479,7 +1678,10 @@ function metricBinding(opts) {
|
|
|
1479
1678
|
SuppressionFileSchema,
|
|
1480
1679
|
SuppressionRuleSchema,
|
|
1481
1680
|
TypeShapeSchema,
|
|
1681
|
+
UnitInvocationSemanticsSchema,
|
|
1482
1682
|
applySuppressionsToFindings,
|
|
1683
|
+
bindingIs,
|
|
1684
|
+
bindingTokens,
|
|
1483
1685
|
bodyShapesMatch,
|
|
1484
1686
|
boundaryKey,
|
|
1485
1687
|
boundaryLabel,
|
|
@@ -1512,6 +1714,8 @@ function metricBinding(opts) {
|
|
|
1512
1714
|
namePatternFromSub,
|
|
1513
1715
|
namePatternKey,
|
|
1514
1716
|
namesAgree,
|
|
1717
|
+
namesBoundary,
|
|
1718
|
+
namesBoundaryExactly,
|
|
1515
1719
|
namesNothing,
|
|
1516
1720
|
normalizePath,
|
|
1517
1721
|
normalizeRuleBoundary,
|
|
@@ -1526,6 +1730,7 @@ function metricBinding(opts) {
|
|
|
1526
1730
|
referenceName,
|
|
1527
1731
|
referenceOf,
|
|
1528
1732
|
reportsUnpairedItself,
|
|
1733
|
+
resourceNameIn,
|
|
1529
1734
|
restBinding,
|
|
1530
1735
|
routePathAdmits,
|
|
1531
1736
|
ruleBoundaryMatchesKey,
|
|
@@ -1533,9 +1738,16 @@ function metricBinding(opts) {
|
|
|
1533
1738
|
semanticsAgree,
|
|
1534
1739
|
semconvAttributes,
|
|
1535
1740
|
servesRequest,
|
|
1741
|
+
spellingTokens,
|
|
1536
1742
|
statesAnOrigin,
|
|
1537
1743
|
storageBinding,
|
|
1744
|
+
storageContainerLabel,
|
|
1745
|
+
storageLabel,
|
|
1538
1746
|
typeDefinitionKey,
|
|
1747
|
+
unitIdentityKey,
|
|
1748
|
+
unitInvocationBinding,
|
|
1539
1749
|
validateRule,
|
|
1540
|
-
withDefinitionsInlined
|
|
1750
|
+
withDefinitionsInlined,
|
|
1751
|
+
withRewrittenPaths,
|
|
1752
|
+
withinScope
|
|
1541
1753
|
});
|