@scoutflo/alert-correlation 0.4.1 → 0.4.3

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.
@@ -1,3 +1,99 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gatewayAlertObservationResolveResponseSchema = exports.gatewayAlertObservationResolveRequestSchema = exports.gatewayAlertObservationEvidenceSchema = exports.gatewayAlertInvestigationContextEnvelopeSchema = exports.gatewayAlertInvestigationContextResponseSchema = exports.gatewayAlertCorrelationDiagnosticsSchema = exports.alertInvestigationContextSchema = exports.alertCorrelationDiagnosticsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const topology_contracts_1 = require("@scoutflo/topology-contracts");
6
+ const alertEvidence_1 = require("./alertEvidence");
7
+ const alertRef_1 = require("./alertRef");
8
+ const decision_1 = require("./decision");
9
+ const facts_1 = require("./facts");
10
+ const recordSchema = zod_1.z.record(zod_1.z.unknown());
11
+ const nonEmptyStringSchema = zod_1.z.string().min(1);
12
+ exports.alertCorrelationDiagnosticsSchema = zod_1.z.object({
13
+ providerDetailFetched: zod_1.z.boolean(),
14
+ evidenceSource: zod_1.z.string().min(1),
15
+ evidenceRef: nonEmptyStringSchema,
16
+ occurrenceId: nonEmptyStringSchema,
17
+ rawTruncated: zod_1.z.boolean(),
18
+ extractorName: nonEmptyStringSchema,
19
+ extractorVersion: nonEmptyStringSchema,
20
+ matcherName: nonEmptyStringSchema.optional(),
21
+ matcherVersion: nonEmptyStringSchema.optional(),
22
+ sourceResourceFound: zod_1.z.boolean(),
23
+ relationshipCount: zod_1.z.number().int().min(0),
24
+ candidateCount: zod_1.z.number().int().min(0),
25
+ selectedTarget: zod_1.z.object({
26
+ type: zod_1.z.enum(['service', 'resource']),
27
+ id: nonEmptyStringSchema,
28
+ }).strict().optional(),
29
+ }).passthrough();
30
+ exports.alertInvestigationContextSchema = zod_1.z.object({
31
+ request: alertEvidence_1.alertOccurrenceRefSchema,
32
+ evidence: alertEvidence_1.alertEvidenceSnapshotSchema,
33
+ time: facts_1.alertTimeWindowSchema,
34
+ presentation: alertEvidence_1.alertEvidencePresentationSchema,
35
+ facts: facts_1.alertCorrelationFactsSchema,
36
+ resolution: decision_1.alertCorrelationDecisionSchema,
37
+ topologySlice: zod_1.z.unknown().nullable(),
38
+ bindingHints: zod_1.z.array(zod_1.z.unknown()),
39
+ diagnostics: exports.alertCorrelationDiagnosticsSchema,
40
+ reasonCodes: zod_1.z.array(nonEmptyStringSchema),
41
+ }).strict();
42
+ exports.gatewayAlertCorrelationDiagnosticsSchema = exports.alertCorrelationDiagnosticsSchema.partial().passthrough();
43
+ exports.gatewayAlertInvestigationContextResponseSchema = zod_1.z.object({
44
+ alertOccurrenceRef: alertEvidence_1.alertOccurrenceRefSchema.optional(),
45
+ request: alertEvidence_1.alertOccurrenceRefSchema.optional(),
46
+ alertRef: alertRef_1.alertRefSchema.optional(),
47
+ evidence: alertEvidence_1.alertEvidenceSnapshotSchema.nullable().optional(),
48
+ source: zod_1.z.object({
49
+ integrationId: nonEmptyStringSchema.optional(),
50
+ provider: nonEmptyStringSchema.optional(),
51
+ }).passthrough().optional(),
52
+ alert: recordSchema.optional(),
53
+ time: facts_1.alertTimeWindowSchema.partial().extend({
54
+ alertTimestamp: zod_1.z.string().datetime().optional(),
55
+ timestamp: zod_1.z.string().datetime().optional(),
56
+ }).passthrough().optional(),
57
+ presentation: alertEvidence_1.alertEvidencePresentationSchema.optional(),
58
+ summary: alertEvidence_1.alertEvidencePresentationSchema.optional(),
59
+ facts: zod_1.z.unknown().optional(),
60
+ resolution: decision_1.alertCorrelationDecisionSchema.partial().extend({
61
+ target: zod_1.z.unknown().optional(),
62
+ candidates: zod_1.z.array(zod_1.z.unknown()).optional(),
63
+ evidence: zod_1.z.array(zod_1.z.unknown()).optional(),
64
+ reasonCodes: zod_1.z.array(nonEmptyStringSchema).optional(),
65
+ facts: zod_1.z.unknown().optional(),
66
+ bindingHints: zod_1.z.union([zod_1.z.array(zod_1.z.unknown()), topology_contracts_1.topologyBindingHintsSchema]).optional(),
67
+ diagnostics: recordSchema.optional(),
68
+ }).passthrough(),
69
+ topologySlice: zod_1.z.unknown().nullable().optional(),
70
+ bindingHints: zod_1.z.union([zod_1.z.array(zod_1.z.unknown()), topology_contracts_1.topologyBindingHintsSchema]).optional(),
71
+ diagnostics: exports.gatewayAlertCorrelationDiagnosticsSchema.optional(),
72
+ reasonCodes: zod_1.z.array(nonEmptyStringSchema).optional(),
73
+ topologyContext: topology_contracts_1.gatewayTopologyContextSchema.optional(),
74
+ }).passthrough();
75
+ exports.gatewayAlertInvestigationContextEnvelopeSchema = zod_1.z.object({
76
+ alertContext: exports.gatewayAlertInvestigationContextResponseSchema,
77
+ }).passthrough();
78
+ exports.gatewayAlertObservationEvidenceSchema = zod_1.z.object({
79
+ observedAt: zod_1.z.string().datetime().optional(),
80
+ startsAt: zod_1.z.string().datetime().optional(),
81
+ endsAt: zod_1.z.string().datetime().optional(),
82
+ state: zod_1.z.string().optional(),
83
+ labels: zod_1.z.record(zod_1.z.string()).optional(),
84
+ annotations: zod_1.z.record(zod_1.z.string()).optional(),
85
+ tags: zod_1.z.record(zod_1.z.string()).optional(),
86
+ providerIds: zod_1.z.record(zod_1.z.string()).optional(),
87
+ sourceUrls: zod_1.z.record(zod_1.z.string()).optional(),
88
+ presentation: alertEvidence_1.alertEvidencePresentationSchema.partial().optional(),
89
+ rawPreview: recordSchema.optional(),
90
+ }).passthrough();
91
+ exports.gatewayAlertObservationResolveRequestSchema = zod_1.z.object({
92
+ alertRef: alertRef_1.alertRefSchema,
93
+ evidence: exports.gatewayAlertObservationEvidenceSchema,
94
+ }).strict();
95
+ exports.gatewayAlertObservationResolveResponseSchema = zod_1.z.object({
96
+ alertOccurrenceRef: alertEvidence_1.alertOccurrenceRefSchema,
97
+ evidence: alertEvidence_1.alertEvidenceSnapshotSchema,
98
+ }).strict();
3
99
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/contracts/context.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/contracts/context.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qEAKsC;AAMtC,mDAIyB;AACzB,yCAA4C;AAG5C,yCAA4D;AAE5D,mCAA6E;AAE7E,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3C,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAElC,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE;IAClC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,WAAW,EAAE,oBAAoB;IACjC,YAAY,EAAE,oBAAoB;IAClC,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;IACzB,aAAa,EAAE,oBAAoB;IACnC,gBAAgB,EAAE,oBAAoB;IACtC,WAAW,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC5C,cAAc,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAC/C,mBAAmB,EAAE,OAAC,CAAC,OAAO,EAAE;IAChC,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,cAAc,EAAE,OAAC,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACrC,EAAE,EAAE,oBAAoB;KACzB,CAAC,CAAC,MAAM,EAAE,C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EAAE,CAAC;AAEJ,QAAA,2CAA2C,GAEpD,OAAC,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,yBAAc;IACxB,QAAQ,EAAE,6CAAqC;CAChD,CAAC,CAAC,MAAM,EAAE,CAAC;AAEC,QAAA,4CAA4C,GAErD,OAAC,CAAC,MAAM,CAAC;IACX,kBAAkB,EAAE,wCAAwB;IAC5C,QAAQ,EAAE,2CAA2B;CACtC,CAAC,CAAC,MAAM,EAAE,CAAC"}
@@ -1,24 +1,250 @@
1
- import type { CorrelationEntityRef, CorrelationStatus as CoreCorrelationStatus } from '@scoutflo/correlation-core';
1
+ import { z } from 'zod';
2
+ import { type CorrelationStatus as CoreCorrelationStatus } from '@scoutflo/correlation-core';
3
+ export declare const alertCorrelationStatusSchema: z.ZodEnum<["resolved", "ambiguous", "degraded", "unresolved", "evidence_available_topology_missing", "insufficient_evidence"]>;
2
4
  export type CorrelationStatus = Extract<CoreCorrelationStatus, 'resolved' | 'ambiguous' | 'degraded' | 'unresolved'> | 'evidence_available_topology_missing' | 'insufficient_evidence';
3
- export interface CorrelationEvidence {
4
- kind: 'relationship_attribute' | 'raw_alert_field' | 'resource_inference' | 'fallback';
5
- factKey?: string;
6
- factValue?: string;
7
- relationshipId?: string;
5
+ export declare const alertCorrelationEvidenceSchema: z.ZodObject<{
6
+ kind: z.ZodEnum<["relationship_attribute", "raw_alert_field", "resource_inference", "fallback"]>;
7
+ factKey: z.ZodOptional<z.ZodString>;
8
+ factValue: z.ZodOptional<z.ZodString>;
9
+ relationshipId: z.ZodOptional<z.ZodString>;
10
+ reason: z.ZodString;
11
+ }, "strict", z.ZodTypeAny, {
12
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
8
13
  reason: string;
9
- }
10
- export interface CorrelationCandidate {
11
- target: CorrelationEntityRef;
12
- name?: string;
14
+ factKey?: string | undefined;
15
+ factValue?: string | undefined;
16
+ relationshipId?: string | undefined;
17
+ }, {
18
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
19
+ reason: string;
20
+ factKey?: string | undefined;
21
+ factValue?: string | undefined;
22
+ relationshipId?: string | undefined;
23
+ }>;
24
+ export type CorrelationEvidence = z.infer<typeof alertCorrelationEvidenceSchema>;
25
+ export declare const alertCorrelationCandidateSchema: z.ZodObject<{
26
+ target: z.ZodObject<{
27
+ type: z.ZodEnum<["service", "resource"]>;
28
+ id: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ type: "service" | "resource";
31
+ id: string;
32
+ }, {
33
+ type: "service" | "resource";
34
+ id: string;
35
+ }>;
36
+ name: z.ZodOptional<z.ZodString>;
37
+ confidence: z.ZodNumber;
38
+ evidence: z.ZodArray<z.ZodObject<{
39
+ kind: z.ZodEnum<["relationship_attribute", "raw_alert_field", "resource_inference", "fallback"]>;
40
+ factKey: z.ZodOptional<z.ZodString>;
41
+ factValue: z.ZodOptional<z.ZodString>;
42
+ relationshipId: z.ZodOptional<z.ZodString>;
43
+ reason: z.ZodString;
44
+ }, "strict", z.ZodTypeAny, {
45
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
46
+ reason: string;
47
+ factKey?: string | undefined;
48
+ factValue?: string | undefined;
49
+ relationshipId?: string | undefined;
50
+ }, {
51
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
52
+ reason: string;
53
+ factKey?: string | undefined;
54
+ factValue?: string | undefined;
55
+ relationshipId?: string | undefined;
56
+ }>, "many">;
57
+ reasonCodes: z.ZodArray<z.ZodString, "many">;
58
+ }, "strict", z.ZodTypeAny, {
59
+ confidence: number;
60
+ target: {
61
+ type: "service" | "resource";
62
+ id: string;
63
+ };
64
+ evidence: {
65
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
66
+ reason: string;
67
+ factKey?: string | undefined;
68
+ factValue?: string | undefined;
69
+ relationshipId?: string | undefined;
70
+ }[];
71
+ reasonCodes: string[];
72
+ name?: string | undefined;
73
+ }, {
74
+ confidence: number;
75
+ target: {
76
+ type: "service" | "resource";
77
+ id: string;
78
+ };
79
+ evidence: {
80
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
81
+ reason: string;
82
+ factKey?: string | undefined;
83
+ factValue?: string | undefined;
84
+ relationshipId?: string | undefined;
85
+ }[];
86
+ reasonCodes: string[];
87
+ name?: string | undefined;
88
+ }>;
89
+ export type CorrelationCandidate = z.infer<typeof alertCorrelationCandidateSchema>;
90
+ export declare const alertCorrelationDecisionSchema: z.ZodObject<{
91
+ status: z.ZodEnum<["resolved", "ambiguous", "degraded", "unresolved", "evidence_available_topology_missing", "insufficient_evidence"]>;
92
+ target: z.ZodNullable<z.ZodObject<{
93
+ type: z.ZodEnum<["service", "resource"]>;
94
+ id: z.ZodString;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: "service" | "resource";
97
+ id: string;
98
+ }, {
99
+ type: "service" | "resource";
100
+ id: string;
101
+ }>>;
102
+ candidates: z.ZodArray<z.ZodObject<{
103
+ target: z.ZodObject<{
104
+ type: z.ZodEnum<["service", "resource"]>;
105
+ id: z.ZodString;
106
+ }, "strip", z.ZodTypeAny, {
107
+ type: "service" | "resource";
108
+ id: string;
109
+ }, {
110
+ type: "service" | "resource";
111
+ id: string;
112
+ }>;
113
+ name: z.ZodOptional<z.ZodString>;
114
+ confidence: z.ZodNumber;
115
+ evidence: z.ZodArray<z.ZodObject<{
116
+ kind: z.ZodEnum<["relationship_attribute", "raw_alert_field", "resource_inference", "fallback"]>;
117
+ factKey: z.ZodOptional<z.ZodString>;
118
+ factValue: z.ZodOptional<z.ZodString>;
119
+ relationshipId: z.ZodOptional<z.ZodString>;
120
+ reason: z.ZodString;
121
+ }, "strict", z.ZodTypeAny, {
122
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
123
+ reason: string;
124
+ factKey?: string | undefined;
125
+ factValue?: string | undefined;
126
+ relationshipId?: string | undefined;
127
+ }, {
128
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
129
+ reason: string;
130
+ factKey?: string | undefined;
131
+ factValue?: string | undefined;
132
+ relationshipId?: string | undefined;
133
+ }>, "many">;
134
+ reasonCodes: z.ZodArray<z.ZodString, "many">;
135
+ }, "strict", z.ZodTypeAny, {
136
+ confidence: number;
137
+ target: {
138
+ type: "service" | "resource";
139
+ id: string;
140
+ };
141
+ evidence: {
142
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
143
+ reason: string;
144
+ factKey?: string | undefined;
145
+ factValue?: string | undefined;
146
+ relationshipId?: string | undefined;
147
+ }[];
148
+ reasonCodes: string[];
149
+ name?: string | undefined;
150
+ }, {
151
+ confidence: number;
152
+ target: {
153
+ type: "service" | "resource";
154
+ id: string;
155
+ };
156
+ evidence: {
157
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
158
+ reason: string;
159
+ factKey?: string | undefined;
160
+ factValue?: string | undefined;
161
+ relationshipId?: string | undefined;
162
+ }[];
163
+ reasonCodes: string[];
164
+ name?: string | undefined;
165
+ }>, "many">;
166
+ evidence: z.ZodArray<z.ZodObject<{
167
+ kind: z.ZodEnum<["relationship_attribute", "raw_alert_field", "resource_inference", "fallback"]>;
168
+ factKey: z.ZodOptional<z.ZodString>;
169
+ factValue: z.ZodOptional<z.ZodString>;
170
+ relationshipId: z.ZodOptional<z.ZodString>;
171
+ reason: z.ZodString;
172
+ }, "strict", z.ZodTypeAny, {
173
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
174
+ reason: string;
175
+ factKey?: string | undefined;
176
+ factValue?: string | undefined;
177
+ relationshipId?: string | undefined;
178
+ }, {
179
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
180
+ reason: string;
181
+ factKey?: string | undefined;
182
+ factValue?: string | undefined;
183
+ relationshipId?: string | undefined;
184
+ }>, "many">;
185
+ confidence: z.ZodNumber;
186
+ reasonCodes: z.ZodArray<z.ZodString, "many">;
187
+ }, "strict", z.ZodTypeAny, {
188
+ status: "resolved" | "ambiguous" | "degraded" | "unresolved" | "evidence_available_topology_missing" | "insufficient_evidence";
13
189
  confidence: number;
14
- evidence: CorrelationEvidence[];
190
+ target: {
191
+ type: "service" | "resource";
192
+ id: string;
193
+ } | null;
194
+ evidence: {
195
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
196
+ reason: string;
197
+ factKey?: string | undefined;
198
+ factValue?: string | undefined;
199
+ relationshipId?: string | undefined;
200
+ }[];
15
201
  reasonCodes: string[];
16
- }
17
- export interface AlertCorrelationDecision {
18
- status: CorrelationStatus;
19
- target: CorrelationEntityRef | null;
20
- candidates: CorrelationCandidate[];
21
- evidence: CorrelationEvidence[];
202
+ candidates: {
203
+ confidence: number;
204
+ target: {
205
+ type: "service" | "resource";
206
+ id: string;
207
+ };
208
+ evidence: {
209
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
210
+ reason: string;
211
+ factKey?: string | undefined;
212
+ factValue?: string | undefined;
213
+ relationshipId?: string | undefined;
214
+ }[];
215
+ reasonCodes: string[];
216
+ name?: string | undefined;
217
+ }[];
218
+ }, {
219
+ status: "resolved" | "ambiguous" | "degraded" | "unresolved" | "evidence_available_topology_missing" | "insufficient_evidence";
22
220
  confidence: number;
221
+ target: {
222
+ type: "service" | "resource";
223
+ id: string;
224
+ } | null;
225
+ evidence: {
226
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
227
+ reason: string;
228
+ factKey?: string | undefined;
229
+ factValue?: string | undefined;
230
+ relationshipId?: string | undefined;
231
+ }[];
23
232
  reasonCodes: string[];
24
- }
233
+ candidates: {
234
+ confidence: number;
235
+ target: {
236
+ type: "service" | "resource";
237
+ id: string;
238
+ };
239
+ evidence: {
240
+ kind: "relationship_attribute" | "raw_alert_field" | "resource_inference" | "fallback";
241
+ reason: string;
242
+ factKey?: string | undefined;
243
+ factValue?: string | undefined;
244
+ relationshipId?: string | undefined;
245
+ }[];
246
+ reasonCodes: string[];
247
+ name?: string | undefined;
248
+ }[];
249
+ }>;
250
+ export type AlertCorrelationDecision = z.infer<typeof alertCorrelationDecisionSchema>;
@@ -1,3 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alertCorrelationDecisionSchema = exports.alertCorrelationCandidateSchema = exports.alertCorrelationEvidenceSchema = exports.alertCorrelationStatusSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const correlation_core_1 = require("@scoutflo/correlation-core");
6
+ exports.alertCorrelationStatusSchema = zod_1.z.enum([
7
+ 'resolved',
8
+ 'ambiguous',
9
+ 'degraded',
10
+ 'unresolved',
11
+ 'evidence_available_topology_missing',
12
+ 'insufficient_evidence',
13
+ ]);
14
+ exports.alertCorrelationEvidenceSchema = zod_1.z.object({
15
+ kind: zod_1.z.enum(['relationship_attribute', 'raw_alert_field', 'resource_inference', 'fallback']),
16
+ factKey: zod_1.z.string().min(1).optional(),
17
+ factValue: zod_1.z.string().optional(),
18
+ relationshipId: zod_1.z.string().min(1).optional(),
19
+ reason: zod_1.z.string().min(1),
20
+ }).strict();
21
+ exports.alertCorrelationCandidateSchema = zod_1.z.object({
22
+ target: correlation_core_1.correlationEntityRefSchema,
23
+ name: zod_1.z.string().min(1).optional(),
24
+ confidence: zod_1.z.number().min(0),
25
+ evidence: zod_1.z.array(exports.alertCorrelationEvidenceSchema),
26
+ reasonCodes: zod_1.z.array(zod_1.z.string().min(1)),
27
+ }).strict();
28
+ exports.alertCorrelationDecisionSchema = zod_1.z.object({
29
+ status: exports.alertCorrelationStatusSchema,
30
+ target: correlation_core_1.correlationEntityRefSchema.nullable(),
31
+ candidates: zod_1.z.array(exports.alertCorrelationCandidateSchema),
32
+ evidence: zod_1.z.array(exports.alertCorrelationEvidenceSchema),
33
+ confidence: zod_1.z.number().min(0),
34
+ reasonCodes: zod_1.z.array(zod_1.z.string().min(1)),
35
+ }).strict();
3
36
  //# sourceMappingURL=decision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../src/contracts/decision.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../src/contracts/decision.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iEAGoC;AAEvB,QAAA,4BAA4B,GAAG,OAAC,CAAC,IAAI,CAAC;IACjD,UAAU;IACV,WAAW;IACX,UAAU;IACV,YAAY;IACZ,qCAAqC;IACrC,uBAAuB;CACxB,CAAC,CAAC;AAOU,QAAA,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,wBAAwB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,UAAU,CAAC,CAAC;IAC7F,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1B,CAAC,CAAC,MAAM,EAAE,CAAC;AAIC,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,6CAA0B;IAClC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,sCAA8B,CAAC;IACjD,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MA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