@closerepo/sentinel-contracts 1.0.0 → 1.1.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/index.d.ts +340 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
declare const sentinelContractVersion: 1;
|
|
4
4
|
declare const sentinelHealthReportMaximumBytes: number;
|
|
5
5
|
declare const sentinelHealthReportMaximumComponents = 64;
|
|
6
|
+
declare const sentinelHealthReportMaximumCapabilities = 64;
|
|
6
7
|
declare const sentinelEventIdSchema: z.ZodUUID;
|
|
7
8
|
declare const sentinelEvidenceSchema: z.ZodObject<{
|
|
8
9
|
label: z.ZodEnum<{
|
|
@@ -877,6 +878,158 @@ declare const sentinelHealthReportSchema: z.ZodObject<{
|
|
|
877
878
|
}, z.core.$strict>>;
|
|
878
879
|
}, z.core.$strict>>;
|
|
879
880
|
}, z.core.$strict>;
|
|
881
|
+
declare const sentinelRuntimeCapabilityObservationSchema: z.ZodObject<{
|
|
882
|
+
capabilityKey: z.ZodString;
|
|
883
|
+
state: z.ZodEnum<{
|
|
884
|
+
enabled: "enabled";
|
|
885
|
+
disabled: "disabled";
|
|
886
|
+
}>;
|
|
887
|
+
}, z.core.$strict>;
|
|
888
|
+
declare const sentinelHealthReportV2Schema: z.ZodObject<{
|
|
889
|
+
contractVersion: z.ZodLiteral<2>;
|
|
890
|
+
projectId: z.ZodString;
|
|
891
|
+
environment: z.ZodString;
|
|
892
|
+
runtimeInstanceId: z.ZodString;
|
|
893
|
+
reportId: z.ZodUUID;
|
|
894
|
+
sequence: z.ZodNumber;
|
|
895
|
+
observedAt: z.ZodISODateTime;
|
|
896
|
+
components: z.ZodArray<z.ZodObject<{
|
|
897
|
+
componentKey: z.ZodString;
|
|
898
|
+
componentClass: z.ZodString;
|
|
899
|
+
state: z.ZodEnum<{
|
|
900
|
+
unknown: "unknown";
|
|
901
|
+
failed: "failed";
|
|
902
|
+
unavailable: "unavailable";
|
|
903
|
+
degraded: "degraded";
|
|
904
|
+
healthy: "healthy";
|
|
905
|
+
}>;
|
|
906
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
907
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
908
|
+
key: z.ZodString;
|
|
909
|
+
value: z.ZodNumber;
|
|
910
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
911
|
+
bytes: "bytes";
|
|
912
|
+
count: "count";
|
|
913
|
+
milliseconds: "milliseconds";
|
|
914
|
+
percent: "percent";
|
|
915
|
+
ratio: "ratio";
|
|
916
|
+
}>>;
|
|
917
|
+
}, z.core.$strict>>;
|
|
918
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
919
|
+
episodeId: z.ZodUUID;
|
|
920
|
+
attempt: z.ZodNumber;
|
|
921
|
+
terminal: z.ZodBoolean;
|
|
922
|
+
operation: z.ZodString;
|
|
923
|
+
stage: z.ZodString;
|
|
924
|
+
code: z.ZodString;
|
|
925
|
+
summary: z.ZodString;
|
|
926
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
927
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
928
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
929
|
+
}, z.core.$strict>>;
|
|
930
|
+
}, z.core.$strict>>;
|
|
931
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
932
|
+
capabilityKey: z.ZodString;
|
|
933
|
+
state: z.ZodEnum<{
|
|
934
|
+
enabled: "enabled";
|
|
935
|
+
disabled: "disabled";
|
|
936
|
+
}>;
|
|
937
|
+
}, z.core.$strict>>;
|
|
938
|
+
}, z.core.$strict>;
|
|
939
|
+
declare const sentinelHealthReportAnySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
940
|
+
contractVersion: z.ZodLiteral<1>;
|
|
941
|
+
projectId: z.ZodString;
|
|
942
|
+
environment: z.ZodString;
|
|
943
|
+
runtimeInstanceId: z.ZodString;
|
|
944
|
+
reportId: z.ZodUUID;
|
|
945
|
+
sequence: z.ZodNumber;
|
|
946
|
+
observedAt: z.ZodISODateTime;
|
|
947
|
+
components: z.ZodArray<z.ZodObject<{
|
|
948
|
+
componentKey: z.ZodString;
|
|
949
|
+
componentClass: z.ZodString;
|
|
950
|
+
state: z.ZodEnum<{
|
|
951
|
+
unknown: "unknown";
|
|
952
|
+
failed: "failed";
|
|
953
|
+
unavailable: "unavailable";
|
|
954
|
+
degraded: "degraded";
|
|
955
|
+
healthy: "healthy";
|
|
956
|
+
}>;
|
|
957
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
958
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
959
|
+
key: z.ZodString;
|
|
960
|
+
value: z.ZodNumber;
|
|
961
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
962
|
+
bytes: "bytes";
|
|
963
|
+
count: "count";
|
|
964
|
+
milliseconds: "milliseconds";
|
|
965
|
+
percent: "percent";
|
|
966
|
+
ratio: "ratio";
|
|
967
|
+
}>>;
|
|
968
|
+
}, z.core.$strict>>;
|
|
969
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
970
|
+
episodeId: z.ZodUUID;
|
|
971
|
+
attempt: z.ZodNumber;
|
|
972
|
+
terminal: z.ZodBoolean;
|
|
973
|
+
operation: z.ZodString;
|
|
974
|
+
stage: z.ZodString;
|
|
975
|
+
code: z.ZodString;
|
|
976
|
+
summary: z.ZodString;
|
|
977
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
978
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
979
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
980
|
+
}, z.core.$strict>>;
|
|
981
|
+
}, z.core.$strict>>;
|
|
982
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
983
|
+
contractVersion: z.ZodLiteral<2>;
|
|
984
|
+
projectId: z.ZodString;
|
|
985
|
+
environment: z.ZodString;
|
|
986
|
+
runtimeInstanceId: z.ZodString;
|
|
987
|
+
reportId: z.ZodUUID;
|
|
988
|
+
sequence: z.ZodNumber;
|
|
989
|
+
observedAt: z.ZodISODateTime;
|
|
990
|
+
components: z.ZodArray<z.ZodObject<{
|
|
991
|
+
componentKey: z.ZodString;
|
|
992
|
+
componentClass: z.ZodString;
|
|
993
|
+
state: z.ZodEnum<{
|
|
994
|
+
unknown: "unknown";
|
|
995
|
+
failed: "failed";
|
|
996
|
+
unavailable: "unavailable";
|
|
997
|
+
degraded: "degraded";
|
|
998
|
+
healthy: "healthy";
|
|
999
|
+
}>;
|
|
1000
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
1001
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
1002
|
+
key: z.ZodString;
|
|
1003
|
+
value: z.ZodNumber;
|
|
1004
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
1005
|
+
bytes: "bytes";
|
|
1006
|
+
count: "count";
|
|
1007
|
+
milliseconds: "milliseconds";
|
|
1008
|
+
percent: "percent";
|
|
1009
|
+
ratio: "ratio";
|
|
1010
|
+
}>>;
|
|
1011
|
+
}, z.core.$strict>>;
|
|
1012
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
1013
|
+
episodeId: z.ZodUUID;
|
|
1014
|
+
attempt: z.ZodNumber;
|
|
1015
|
+
terminal: z.ZodBoolean;
|
|
1016
|
+
operation: z.ZodString;
|
|
1017
|
+
stage: z.ZodString;
|
|
1018
|
+
code: z.ZodString;
|
|
1019
|
+
summary: z.ZodString;
|
|
1020
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
1021
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
1022
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
1023
|
+
}, z.core.$strict>>;
|
|
1024
|
+
}, z.core.$strict>>;
|
|
1025
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
1026
|
+
capabilityKey: z.ZodString;
|
|
1027
|
+
state: z.ZodEnum<{
|
|
1028
|
+
enabled: "enabled";
|
|
1029
|
+
disabled: "disabled";
|
|
1030
|
+
}>;
|
|
1031
|
+
}, z.core.$strict>>;
|
|
1032
|
+
}, z.core.$strict>]>;
|
|
880
1033
|
declare const sentinelHealthReportAuthenticationSchema: z.ZodObject<{
|
|
881
1034
|
timestamp: z.ZodISODateTime;
|
|
882
1035
|
nonce: z.ZodUUID;
|
|
@@ -934,9 +1087,184 @@ declare const sentinelHealthReportSubmissionSchema: z.ZodObject<{
|
|
|
934
1087
|
signature: z.ZodString;
|
|
935
1088
|
}, z.core.$strict>;
|
|
936
1089
|
}, z.core.$strict>;
|
|
1090
|
+
declare const sentinelHealthReportSubmissionV2Schema: z.ZodObject<{
|
|
1091
|
+
contractVersion: z.ZodLiteral<2>;
|
|
1092
|
+
report: z.ZodObject<{
|
|
1093
|
+
contractVersion: z.ZodLiteral<2>;
|
|
1094
|
+
projectId: z.ZodString;
|
|
1095
|
+
environment: z.ZodString;
|
|
1096
|
+
runtimeInstanceId: z.ZodString;
|
|
1097
|
+
reportId: z.ZodUUID;
|
|
1098
|
+
sequence: z.ZodNumber;
|
|
1099
|
+
observedAt: z.ZodISODateTime;
|
|
1100
|
+
components: z.ZodArray<z.ZodObject<{
|
|
1101
|
+
componentKey: z.ZodString;
|
|
1102
|
+
componentClass: z.ZodString;
|
|
1103
|
+
state: z.ZodEnum<{
|
|
1104
|
+
unknown: "unknown";
|
|
1105
|
+
failed: "failed";
|
|
1106
|
+
unavailable: "unavailable";
|
|
1107
|
+
degraded: "degraded";
|
|
1108
|
+
healthy: "healthy";
|
|
1109
|
+
}>;
|
|
1110
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
1111
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
1112
|
+
key: z.ZodString;
|
|
1113
|
+
value: z.ZodNumber;
|
|
1114
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
1115
|
+
bytes: "bytes";
|
|
1116
|
+
count: "count";
|
|
1117
|
+
milliseconds: "milliseconds";
|
|
1118
|
+
percent: "percent";
|
|
1119
|
+
ratio: "ratio";
|
|
1120
|
+
}>>;
|
|
1121
|
+
}, z.core.$strict>>;
|
|
1122
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
1123
|
+
episodeId: z.ZodUUID;
|
|
1124
|
+
attempt: z.ZodNumber;
|
|
1125
|
+
terminal: z.ZodBoolean;
|
|
1126
|
+
operation: z.ZodString;
|
|
1127
|
+
stage: z.ZodString;
|
|
1128
|
+
code: z.ZodString;
|
|
1129
|
+
summary: z.ZodString;
|
|
1130
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
1131
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
1132
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
1133
|
+
}, z.core.$strict>>;
|
|
1134
|
+
}, z.core.$strict>>;
|
|
1135
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
1136
|
+
capabilityKey: z.ZodString;
|
|
1137
|
+
state: z.ZodEnum<{
|
|
1138
|
+
enabled: "enabled";
|
|
1139
|
+
disabled: "disabled";
|
|
1140
|
+
}>;
|
|
1141
|
+
}, z.core.$strict>>;
|
|
1142
|
+
}, z.core.$strict>;
|
|
1143
|
+
authentication: z.ZodObject<{
|
|
1144
|
+
timestamp: z.ZodISODateTime;
|
|
1145
|
+
nonce: z.ZodUUID;
|
|
1146
|
+
signature: z.ZodString;
|
|
1147
|
+
}, z.core.$strict>;
|
|
1148
|
+
}, z.core.$strict>;
|
|
1149
|
+
declare const sentinelHealthReportSubmissionAnySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1150
|
+
contractVersion: z.ZodLiteral<1>;
|
|
1151
|
+
report: z.ZodObject<{
|
|
1152
|
+
contractVersion: z.ZodLiteral<1>;
|
|
1153
|
+
projectId: z.ZodString;
|
|
1154
|
+
environment: z.ZodString;
|
|
1155
|
+
runtimeInstanceId: z.ZodString;
|
|
1156
|
+
reportId: z.ZodUUID;
|
|
1157
|
+
sequence: z.ZodNumber;
|
|
1158
|
+
observedAt: z.ZodISODateTime;
|
|
1159
|
+
components: z.ZodArray<z.ZodObject<{
|
|
1160
|
+
componentKey: z.ZodString;
|
|
1161
|
+
componentClass: z.ZodString;
|
|
1162
|
+
state: z.ZodEnum<{
|
|
1163
|
+
unknown: "unknown";
|
|
1164
|
+
failed: "failed";
|
|
1165
|
+
unavailable: "unavailable";
|
|
1166
|
+
degraded: "degraded";
|
|
1167
|
+
healthy: "healthy";
|
|
1168
|
+
}>;
|
|
1169
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
1170
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
1171
|
+
key: z.ZodString;
|
|
1172
|
+
value: z.ZodNumber;
|
|
1173
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
1174
|
+
bytes: "bytes";
|
|
1175
|
+
count: "count";
|
|
1176
|
+
milliseconds: "milliseconds";
|
|
1177
|
+
percent: "percent";
|
|
1178
|
+
ratio: "ratio";
|
|
1179
|
+
}>>;
|
|
1180
|
+
}, z.core.$strict>>;
|
|
1181
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
1182
|
+
episodeId: z.ZodUUID;
|
|
1183
|
+
attempt: z.ZodNumber;
|
|
1184
|
+
terminal: z.ZodBoolean;
|
|
1185
|
+
operation: z.ZodString;
|
|
1186
|
+
stage: z.ZodString;
|
|
1187
|
+
code: z.ZodString;
|
|
1188
|
+
summary: z.ZodString;
|
|
1189
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
1190
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
1191
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
1192
|
+
}, z.core.$strict>>;
|
|
1193
|
+
}, z.core.$strict>>;
|
|
1194
|
+
}, z.core.$strict>;
|
|
1195
|
+
authentication: z.ZodObject<{
|
|
1196
|
+
timestamp: z.ZodISODateTime;
|
|
1197
|
+
nonce: z.ZodUUID;
|
|
1198
|
+
signature: z.ZodString;
|
|
1199
|
+
}, z.core.$strict>;
|
|
1200
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1201
|
+
contractVersion: z.ZodLiteral<2>;
|
|
1202
|
+
report: z.ZodObject<{
|
|
1203
|
+
contractVersion: z.ZodLiteral<2>;
|
|
1204
|
+
projectId: z.ZodString;
|
|
1205
|
+
environment: z.ZodString;
|
|
1206
|
+
runtimeInstanceId: z.ZodString;
|
|
1207
|
+
reportId: z.ZodUUID;
|
|
1208
|
+
sequence: z.ZodNumber;
|
|
1209
|
+
observedAt: z.ZodISODateTime;
|
|
1210
|
+
components: z.ZodArray<z.ZodObject<{
|
|
1211
|
+
componentKey: z.ZodString;
|
|
1212
|
+
componentClass: z.ZodString;
|
|
1213
|
+
state: z.ZodEnum<{
|
|
1214
|
+
unknown: "unknown";
|
|
1215
|
+
failed: "failed";
|
|
1216
|
+
unavailable: "unavailable";
|
|
1217
|
+
degraded: "degraded";
|
|
1218
|
+
healthy: "healthy";
|
|
1219
|
+
}>;
|
|
1220
|
+
lastSuccessAt: z.ZodNullable<z.ZodISODateTime>;
|
|
1221
|
+
facts: z.ZodArray<z.ZodObject<{
|
|
1222
|
+
key: z.ZodString;
|
|
1223
|
+
value: z.ZodNumber;
|
|
1224
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
1225
|
+
bytes: "bytes";
|
|
1226
|
+
count: "count";
|
|
1227
|
+
milliseconds: "milliseconds";
|
|
1228
|
+
percent: "percent";
|
|
1229
|
+
ratio: "ratio";
|
|
1230
|
+
}>>;
|
|
1231
|
+
}, z.core.$strict>>;
|
|
1232
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
1233
|
+
episodeId: z.ZodUUID;
|
|
1234
|
+
attempt: z.ZodNumber;
|
|
1235
|
+
terminal: z.ZodBoolean;
|
|
1236
|
+
operation: z.ZodString;
|
|
1237
|
+
stage: z.ZodString;
|
|
1238
|
+
code: z.ZodString;
|
|
1239
|
+
summary: z.ZodString;
|
|
1240
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
1241
|
+
upstreamStatus: z.ZodOptional<z.ZodNumber>;
|
|
1242
|
+
upstreamCode: z.ZodOptional<z.ZodString>;
|
|
1243
|
+
}, z.core.$strict>>;
|
|
1244
|
+
}, z.core.$strict>>;
|
|
1245
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
1246
|
+
capabilityKey: z.ZodString;
|
|
1247
|
+
state: z.ZodEnum<{
|
|
1248
|
+
enabled: "enabled";
|
|
1249
|
+
disabled: "disabled";
|
|
1250
|
+
}>;
|
|
1251
|
+
}, z.core.$strict>>;
|
|
1252
|
+
}, z.core.$strict>;
|
|
1253
|
+
authentication: z.ZodObject<{
|
|
1254
|
+
timestamp: z.ZodISODateTime;
|
|
1255
|
+
nonce: z.ZodUUID;
|
|
1256
|
+
signature: z.ZodString;
|
|
1257
|
+
}, z.core.$strict>;
|
|
1258
|
+
}, z.core.$strict>]>;
|
|
937
1259
|
declare function sentinelHealthReportSignatureInput(submission: Pick<SentinelHealthReportSubmission, 'contractVersion' | 'report'> & {
|
|
938
1260
|
authentication: Pick<SentinelHealthReportAuthentication, 'timestamp' | 'nonce'>;
|
|
939
1261
|
}): string;
|
|
1262
|
+
declare function sentinelHealthReportV2SignatureInput(submission: Pick<SentinelHealthReportSubmissionV2, 'contractVersion' | 'report'> & {
|
|
1263
|
+
authentication: Pick<SentinelHealthReportAuthentication, 'timestamp' | 'nonce'>;
|
|
1264
|
+
}): string;
|
|
1265
|
+
declare function sentinelHealthReportAnySignatureInput(submission: Pick<SentinelHealthReportSubmissionAny, 'contractVersion' | 'report'> & {
|
|
1266
|
+
authentication: Pick<SentinelHealthReportAuthentication, 'timestamp' | 'nonce'>;
|
|
1267
|
+
}): string;
|
|
940
1268
|
declare const sentinelHealthReportRejectionCodeSchema: z.ZodEnum<{
|
|
941
1269
|
authentication_failed: "authentication_failed";
|
|
942
1270
|
identity_not_registered: "identity_not_registered";
|
|
@@ -978,6 +1306,12 @@ declare const sentinelHealthReportIngestResultSchema: z.ZodDiscriminatedUnion<[z
|
|
|
978
1306
|
interface SentinelHealthReportServiceV1 {
|
|
979
1307
|
reportHealth(submission: SentinelHealthReportSubmission): Promise<SentinelHealthReportIngestResult>;
|
|
980
1308
|
}
|
|
1309
|
+
interface SentinelHealthReportServiceV2 {
|
|
1310
|
+
reportHealth(submission: SentinelHealthReportSubmissionV2): Promise<SentinelHealthReportIngestResult>;
|
|
1311
|
+
}
|
|
1312
|
+
interface SentinelHealthReportServiceAny {
|
|
1313
|
+
reportHealth(submission: SentinelHealthReportSubmissionAny): Promise<SentinelHealthReportIngestResult>;
|
|
1314
|
+
}
|
|
981
1315
|
type SentinelAction = z.infer<typeof sentinelActionSchema>;
|
|
982
1316
|
type SentinelAlertPolicy = z.infer<typeof sentinelAlertPolicySchema>;
|
|
983
1317
|
type SentinelDeliveryReceipt = z.infer<typeof sentinelDeliveryReceiptSchema>;
|
|
@@ -997,9 +1331,14 @@ type SentinelHealthComponent = z.infer<typeof sentinelHealthComponentSchema>;
|
|
|
997
1331
|
type SentinelHealthFailure = z.infer<typeof sentinelHealthFailureSchema>;
|
|
998
1332
|
type SentinelHealthMetricFact = z.infer<typeof sentinelHealthMetricFactSchema>;
|
|
999
1333
|
type SentinelHealthReport = z.infer<typeof sentinelHealthReportSchema>;
|
|
1334
|
+
type SentinelHealthReportV2 = z.infer<typeof sentinelHealthReportV2Schema>;
|
|
1335
|
+
type SentinelHealthReportAny = z.infer<typeof sentinelHealthReportAnySchema>;
|
|
1000
1336
|
type SentinelHealthReportAuthentication = z.infer<typeof sentinelHealthReportAuthenticationSchema>;
|
|
1001
1337
|
type SentinelHealthReportIngestResult = z.infer<typeof sentinelHealthReportIngestResultSchema>;
|
|
1002
1338
|
type SentinelHealthReportRejectionCode = z.infer<typeof sentinelHealthReportRejectionCodeSchema>;
|
|
1003
1339
|
type SentinelHealthReportSubmission = z.infer<typeof sentinelHealthReportSubmissionSchema>;
|
|
1340
|
+
type SentinelHealthReportSubmissionV2 = z.infer<typeof sentinelHealthReportSubmissionV2Schema>;
|
|
1341
|
+
type SentinelHealthReportSubmissionAny = z.infer<typeof sentinelHealthReportSubmissionAnySchema>;
|
|
1342
|
+
type SentinelRuntimeCapabilityObservation = z.infer<typeof sentinelRuntimeCapabilityObservationSchema>;
|
|
1004
1343
|
//#endregion
|
|
1005
|
-
export { SentinelAction, SentinelAlertPolicy, SentinelDeliveryReceipt, SentinelEnvironmentBinding, SentinelHealthComponent, SentinelHealthFailure, SentinelHealthMetricFact, SentinelHealthReport, SentinelHealthReportAuthentication, SentinelHealthReportIngestResult, SentinelHealthReportRejectionCode, SentinelHealthReportServiceV1, SentinelHealthReportSubmission, SentinelIncidentEvent, SentinelPolicyAction, SentinelProjectManifest, SentinelQueueEvent, SentinelQueueMetrics, SentinelReceiverFailureCode, SentinelRegistration, SentinelRegistrationCommand, SentinelRule, SentinelRuntimeStatus, SentinelTestEvent, sentinelActionSchema, sentinelAlertPolicySchema, sentinelContractVersion, sentinelDeliveryReceiptSchema, sentinelDiagnosticSchema, sentinelEnvironmentBindingSchema, sentinelEventIdSchema, sentinelEvidenceSchema, sentinelHealthComponentSchema, sentinelHealthFailureSchema, sentinelHealthMetricFactSchema, sentinelHealthReportAuthenticationSchema, sentinelHealthReportIngestResultSchema, sentinelHealthReportMaximumBytes, sentinelHealthReportMaximumComponents, sentinelHealthReportRejectionCodeSchema, sentinelHealthReportSchema, sentinelHealthReportSignatureInput, sentinelHealthReportSubmissionSchema, sentinelIncidentEventSchema, sentinelPolicyActionSchema, sentinelProjectManifestSchema, sentinelQueueEventIdentityInput, sentinelQueueEventSchema, sentinelQueueMetricsSchema, sentinelReceiverFailureCodeSchema, sentinelReceiverStateSchema, sentinelRegistrationCommandSchema, sentinelRegistrationSchema, sentinelRuleSchema, sentinelRunbookSchema, sentinelRuntimeStatusSchema, sentinelTestEventSchema };
|
|
1344
|
+
export { SentinelAction, SentinelAlertPolicy, SentinelDeliveryReceipt, SentinelEnvironmentBinding, SentinelHealthComponent, SentinelHealthFailure, SentinelHealthMetricFact, SentinelHealthReport, SentinelHealthReportAny, SentinelHealthReportAuthentication, SentinelHealthReportIngestResult, SentinelHealthReportRejectionCode, SentinelHealthReportServiceAny, SentinelHealthReportServiceV1, SentinelHealthReportServiceV2, SentinelHealthReportSubmission, SentinelHealthReportSubmissionAny, SentinelHealthReportSubmissionV2, SentinelHealthReportV2, SentinelIncidentEvent, SentinelPolicyAction, SentinelProjectManifest, SentinelQueueEvent, SentinelQueueMetrics, SentinelReceiverFailureCode, SentinelRegistration, SentinelRegistrationCommand, SentinelRule, SentinelRuntimeCapabilityObservation, SentinelRuntimeStatus, SentinelTestEvent, sentinelActionSchema, sentinelAlertPolicySchema, sentinelContractVersion, sentinelDeliveryReceiptSchema, sentinelDiagnosticSchema, sentinelEnvironmentBindingSchema, sentinelEventIdSchema, sentinelEvidenceSchema, sentinelHealthComponentSchema, sentinelHealthFailureSchema, sentinelHealthMetricFactSchema, sentinelHealthReportAnySchema, sentinelHealthReportAnySignatureInput, sentinelHealthReportAuthenticationSchema, sentinelHealthReportIngestResultSchema, sentinelHealthReportMaximumBytes, sentinelHealthReportMaximumCapabilities, sentinelHealthReportMaximumComponents, sentinelHealthReportRejectionCodeSchema, sentinelHealthReportSchema, sentinelHealthReportSignatureInput, sentinelHealthReportSubmissionAnySchema, sentinelHealthReportSubmissionSchema, sentinelHealthReportSubmissionV2Schema, sentinelHealthReportV2Schema, sentinelHealthReportV2SignatureInput, sentinelIncidentEventSchema, sentinelPolicyActionSchema, sentinelProjectManifestSchema, sentinelQueueEventIdentityInput, sentinelQueueEventSchema, sentinelQueueMetricsSchema, sentinelReceiverFailureCodeSchema, sentinelReceiverStateSchema, sentinelRegistrationCommandSchema, sentinelRegistrationSchema, sentinelRuleSchema, sentinelRunbookSchema, sentinelRuntimeCapabilityObservationSchema, sentinelRuntimeStatusSchema, sentinelTestEventSchema };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=1,n=32*1024,r=64,i=t=>e.string().trim().min(1).max(t),a=e.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),o=e.string().regex(/^[a-z][A-Za-z0-9_]{0,63}$/),s=e.uuid(),c=s,l=e.url().refine(e=>e.startsWith(`https://`),`must use HTTPS`),u=e.object({label:e.enum([`Observed value`,`Warning threshold`,`Critical threshold`]),value:e.number().finite().nonnegative()}).strict(),d=e.object({label:i(80),url:l}).strict(),f=e.object({type:e.literal(`none`)}).strict(),p=e.object({type:e.literal(`live_command`),command:i(500).regex(/^abuse apply\b/).refine(e=>e.endsWith(` --apply`),`must end with --apply`)}).strict(),m=e.object({type:e.literal(`test_preview`),summary:i(300).refine(e=>!e.includes(`--apply`),`must not contain --apply`)}).strict(),h=e.discriminatedUnion(`type`,[f,p,m]),g=e.object({contractVersion:e.literal(1),projectId:a,environment:a,incidentId:c,eventId:c,kind:e.enum([`firing`,`reminder`,`resolved`]),severity:e.enum([`warning`,`critical`]),signalClass:e.enum([`attack`,`service`]),signal:a,title:i(120),occurredAt:e.iso.datetime(),evidence:e.array(u).max(8),runbook:d,statusCommand:i(300).regex(/^sentinel status\b/),receiverKeys:e.array(a).min(1).max(16),action:h}).strict(),_=g.extend({mode:e.literal(`live`)}).superRefine((e,t)=>{e.signalClass===`service`&&e.action.type!==`none`&&t.addIssue({code:`custom`,message:`service events cannot contain an operational action`,path:[`action`]}),e.action.type===`test_preview`&&t.addIssue({code:`custom`,message:`live events cannot contain a test preview`,path:[`action`]})}),v=g.extend({mode:e.literal(`test`),action:e.discriminatedUnion(`type`,[f,m])}).strict(),y=e.union([_,v]);function b(e){let t=y.parse(e);return JSON.stringify(t)}const x=e.enum([`delivery_interrupted`,`provider_rejected`,`provider_timeout`,`provider_unavailable`,`receiver_missing`,`synthetic_retry`]),S=e.object({receiverKey:a,state:e.enum([`pending`,`delivering`,`delivered`,`failed`]),attempts:e.number().int().min(0).max(4),failureCode:x.nullable(),leaseExpiresAt:e.iso.datetime().nullable(),lastAttemptAt:e.iso.datetime().nullable()}).strict().superRefine((e,t)=>{e.state===`failed`&&e.failureCode===null&&t.addIssue({code:`custom`,message:`failed receivers require failureCode`,path:[`failureCode`]}),e.state!==`failed`&&e.failureCode!==null&&t.addIssue({code:`custom`,message:`only failed receivers can carry failureCode`,path:[`failureCode`]})}),C=e.object({contractVersion:e.literal(1),projectId:a,environment:a,eventId:c,state:e.enum([`pending`,`retrying`,`partial`,`delivered`,`failed`,`unavailable`]),reason:e.enum([`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`receipt_unavailable`]),receivers:e.array(S).max(16),updatedAt:e.iso.datetime()}).strict(),w=e.object({code:a,state:e.enum([`degraded`,`failed`,`unknown`,`warning`]),summary:i(300),suggestedCommand:i(500).optional()}).strict(),T=e.object({contractVersion:e.literal(1),projectId:a,environment:a,registration:e.object({enabled:e.boolean(),mode:e.enum([`disabled`,`shadow`,`live`]),policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),sourceRevision:i(160)}).strict(),rules:e.array(e.object({id:a,semanticDigest:e.string().regex(/^[a-f0-9]{64}$/),enabled:e.boolean(),state:e.enum([`closed`,`firing`,`idle`,`unknown`]),severity:e.enum([`warning`,`critical`]).nullable(),incidentId:c.nullable(),lastEvaluatedAt:e.iso.datetime().nullable(),lastEventId:c.nullable()}).strict()).max(64),deliveries:e.array(C).max(64),heartbeat:e.object({state:e.enum([`healthy`,`stale`,`unavailable`]),lastCompletedAt:e.iso.datetime().nullable()}).strict(),diagnostics:e.array(w).max(32)}).strict(),E=e.object({state:e.enum([`available`,`unavailable`]),backlogCount:e.number().int().nonnegative().nullable(),backlogBytes:e.number().int().nonnegative().nullable(),oldestMessageAt:e.iso.datetime().nullable(),retentionSeconds:e.number().int().positive().nullable()}).strict(),D=e.string().regex(/^[A-Z][A-Z0-9_]{2,127}$/),O=e.string().max(240).regex(/^(?![A-Za-z]:|\/|.*(?:^|\/)\.\.(?:\/|$)).+\.json$/),k=e.object({mode:e.enum([`disabled`,`shadow`,`live`]),statusUrlEnv:D,statusHmacSecretEnv:D,healthReportHmacSecretEnv:D.optional(),opsAccountIdEnv:D,provisionApiTokenEnv:D,statusApiTokenEnv:D,analyticsAccountIdEnv:D,analyticsApiTokenEnv:D,analyticsDataset:a,workerName:a,queueName:a,dlqName:a,registrationQueueName:a,registrationDlqName:a,notificationWorkerName:a,healthchecksProvisionApiKeyEnv:D.optional(),healthchecksPingUrlEnv:D.optional(),healthchecksStatusApiKeyEnv:D.optional()}).strict().superRefine((e,t)=>{let n=[e.healthchecksProvisionApiKeyEnv,e.healthchecksPingUrlEnv,e.healthchecksStatusApiKeyEnv].filter(Boolean);n.length>0&&n.length!==3&&t.addIssue({code:`custom`,message:`Healthchecks provision, status and ping URL references must be configured together`,path:[`healthchecksProvisionApiKeyEnv`]})}),A=e.object({contractVersion:e.literal(1),projectId:a,policy:O,environments:e.record(a,k)}).strict().superRefine((e,t)=>{Object.keys(e.environments).length===0&&t.addIssue({code:`custom`,message:`at least one environment is required`,path:[`environments`]})}),j=e.object({type:e.literal(`abuse`),project:e.string().regex(/^[a-zA-Z0-9._/-]{1,120}$/),target:a,action:a,layer:a,ttl:e.string().regex(/^[1-9][0-9]{0,4}[smhd]$/).optional()}).strict(),M=e.discriminatedUnion(`type`,[f,j]),N=e.object({id:a,enabled:e.boolean(),signalClass:e.enum([`attack`,`service`]),signal:e.object({type:e.enum([`operation_count`,`worker_error_ratio`,`edge_security_spike`,`provider_health`]),operation:o.optional(),operations:e.array(o).min(1).max(16).optional(),outcomes:e.array(e.enum([`committed`,`accepted_noop`,`rejected`,`failed`])).max(4).optional(),minimumSample:e.number().int().positive().optional()}).strict(),windowMinutes:e.number().int().min(5).max(1440),thresholds:e.object({warning:e.number().nonnegative(),critical:e.number().positive()}).strict().refine(e=>e.critical>e.warning,`critical must exceed warning`),recovery:e.object({healthyEvaluations:e.number().int().min(1).max(24)}).strict(),reminders:e.object({warningMinutes:e.number().int().min(5).max(10080),criticalMinutes:e.number().int().min(5).max(10080)}).strict(),runbook:d,receiverKeys:e.array(a).min(1).max(16),actions:e.object({warning:M,critical:M}).strict()}).strict().superRefine((e,t)=>{e.signal.operation&&e.signal.operations&&t.addIssue({code:`custom`,message:`signal cannot define both operation and operations`,path:[`signal`]}),e.signal.type===`operation_count`&&!e.signal.operation&&!e.signal.operations&&t.addIssue({code:`custom`,message:`operation_count requires operation or operations`,path:[`signal`]}),e.signal.type===`provider_health`&&e.thresholds.warning>1&&t.addIssue({code:`custom`,message:`provider_health warning threshold must be at most 1`,path:[`thresholds`,`warning`]}),e.signalClass===`service`&&(e.actions.warning.type!==`none`||e.actions.critical.type!==`none`)&&t.addIssue({code:`custom`,message:`service rules cannot configure abuse actions`,path:[`actions`]})}),P=e.object({contractVersion:e.literal(1),evaluationMinutes:e.number().int().min(5).max(60),rules:e.array(N).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`duplicate rule id ${i.id}`,path:[`rules`,r,`id`]}),n.add(i.id)}),F=e.object({analytics:e.object({accountIdBinding:D,dataset:a,index:i(160),tokenBinding:D}).strict(),enabled:e.boolean(),environment:a,mode:e.enum([`disabled`,`shadow`,`live`]),policy:P,policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectId:a,projectedAt:e.iso.datetime(),sourceRevision:i(160),healthReportHmacSecretBinding:D.optional()}).strict().refine(e=>e.enabled===(e.mode!==`disabled`),{message:`enabled must match registration mode`,path:[`enabled`]}).superRefine((e,t)=>{e.mode===`live`&&!e.policy.rules.some(e=>e.enabled&&e.signal.type===`provider_health`)&&t.addIssue({code:`custom`,message:`Live registration requires an enabled provider_health rule`,path:[`policy`,`rules`]})}),I=e.object({commandId:c,contractVersion:e.literal(1),expectedPreviousDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),kind:e.literal(`registration_upsert`),registration:F}).strict(),L=e.string().trim().min(1).max(160),R=e.object({key:a,value:e.number().finite().nonnegative(),unit:e.enum([`bytes`,`count`,`milliseconds`,`percent`,`ratio`]).optional()}).strict(),z=e.object({episodeId:s,attempt:e.number().int().min(1).max(1e3),terminal:e.boolean(),operation:o,stage:a,code:a,summary:i(300),correlationId:L.optional(),upstreamStatus:e.number().int().min(100).max(599).optional(),upstreamCode:a.optional()}).strict(),B=e.object({componentKey:a,componentClass:a,state:e.enum([`healthy`,`degraded`,`failed`,`unavailable`,`unknown`]),lastSuccessAt:e.iso.datetime().nullable(),facts:e.array(R).max(16),failure:z.nullable()}).strict().superRefine((e,t)=>{e.state===`healthy`&&e.failure!==null&&t.addIssue({code:`custom`,message:`healthy components cannot carry a current failure`,path:[`failure`]}),(e.state===`failed`||e.state===`unavailable`)&&e.failure===null&&t.addIssue({code:`custom`,message:`failed and unavailable components require a current failure`,path:[`failure`]})}),V=e.object({contractVersion:e.literal(1),projectId:a,environment:a,runtimeInstanceId:a,reportId:s,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(B).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey)}),H=e.object({timestamp:e.iso.datetime(),nonce:s,signature:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),U=e.object({contractVersion:e.literal(1),report:V,authentication:H}).strict();function W(e){let t=U.omit({authentication:!0}).extend({authentication:H.omit({signature:!0})}).parse(e);return JSON.stringify(t)}const G=e.enum([`authentication_failed`,`identity_not_registered`,`nonce_replayed`,`report_invalid`,`runtime_identity_mismatch`,`sequence_invalid`,`size_exceeded`,`timestamp_out_of_range`,`unexpected_failure`]),K=e.discriminatedUnion(`outcome`,[e.object({outcome:e.literal(`accepted`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`duplicate`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`out_of_order`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`rejected`),rejectionCode:G,summary:i(300)}).strict()]);export{h as sentinelActionSchema,P as sentinelAlertPolicySchema,t as sentinelContractVersion,C as sentinelDeliveryReceiptSchema,w as sentinelDiagnosticSchema,k as sentinelEnvironmentBindingSchema,s as sentinelEventIdSchema,u as sentinelEvidenceSchema,B as sentinelHealthComponentSchema,z as sentinelHealthFailureSchema,R as sentinelHealthMetricFactSchema,H as sentinelHealthReportAuthenticationSchema,K as sentinelHealthReportIngestResultSchema,n as sentinelHealthReportMaximumBytes,r as sentinelHealthReportMaximumComponents,G as sentinelHealthReportRejectionCodeSchema,V as sentinelHealthReportSchema,W as sentinelHealthReportSignatureInput,U as sentinelHealthReportSubmissionSchema,_ as sentinelIncidentEventSchema,M as sentinelPolicyActionSchema,A as sentinelProjectManifestSchema,b as sentinelQueueEventIdentityInput,y as sentinelQueueEventSchema,E as sentinelQueueMetricsSchema,x as sentinelReceiverFailureCodeSchema,S as sentinelReceiverStateSchema,I as sentinelRegistrationCommandSchema,F as sentinelRegistrationSchema,N as sentinelRuleSchema,d as sentinelRunbookSchema,T as sentinelRuntimeStatusSchema,v as sentinelTestEventSchema};
|
|
1
|
+
import{z as e}from"zod";const t=1,n=32*1024,r=64,i=64,a=t=>e.string().trim().min(1).max(t),o=e.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),s=e.string().regex(/^[a-z][A-Za-z0-9_]{0,63}$/),c=e.uuid(),l=c,u=e.url().refine(e=>e.startsWith(`https://`),`must use HTTPS`),d=e.object({label:e.enum([`Observed value`,`Warning threshold`,`Critical threshold`]),value:e.number().finite().nonnegative()}).strict(),f=e.object({label:a(80),url:u}).strict(),p=e.object({type:e.literal(`none`)}).strict(),m=e.object({type:e.literal(`live_command`),command:a(500).regex(/^abuse apply\b/).refine(e=>e.endsWith(` --apply`),`must end with --apply`)}).strict(),h=e.object({type:e.literal(`test_preview`),summary:a(300).refine(e=>!e.includes(`--apply`),`must not contain --apply`)}).strict(),g=e.discriminatedUnion(`type`,[p,m,h]),_=e.object({contractVersion:e.literal(1),projectId:o,environment:o,incidentId:l,eventId:l,kind:e.enum([`firing`,`reminder`,`resolved`]),severity:e.enum([`warning`,`critical`]),signalClass:e.enum([`attack`,`service`]),signal:o,title:a(120),occurredAt:e.iso.datetime(),evidence:e.array(d).max(8),runbook:f,statusCommand:a(300).regex(/^sentinel status\b/),receiverKeys:e.array(o).min(1).max(16),action:g}).strict(),v=_.extend({mode:e.literal(`live`)}).superRefine((e,t)=>{e.signalClass===`service`&&e.action.type!==`none`&&t.addIssue({code:`custom`,message:`service events cannot contain an operational action`,path:[`action`]}),e.action.type===`test_preview`&&t.addIssue({code:`custom`,message:`live events cannot contain a test preview`,path:[`action`]})}),y=_.extend({mode:e.literal(`test`),action:e.discriminatedUnion(`type`,[p,h])}).strict(),b=e.union([v,y]);function x(e){let t=b.parse(e);return JSON.stringify(t)}const S=e.enum([`delivery_interrupted`,`provider_rejected`,`provider_timeout`,`provider_unavailable`,`receiver_missing`,`synthetic_retry`]),C=e.object({receiverKey:o,state:e.enum([`pending`,`delivering`,`delivered`,`failed`]),attempts:e.number().int().min(0).max(4),failureCode:S.nullable(),leaseExpiresAt:e.iso.datetime().nullable(),lastAttemptAt:e.iso.datetime().nullable()}).strict().superRefine((e,t)=>{e.state===`failed`&&e.failureCode===null&&t.addIssue({code:`custom`,message:`failed receivers require failureCode`,path:[`failureCode`]}),e.state!==`failed`&&e.failureCode!==null&&t.addIssue({code:`custom`,message:`only failed receivers can carry failureCode`,path:[`failureCode`]})}),w=e.object({contractVersion:e.literal(1),projectId:o,environment:o,eventId:l,state:e.enum([`pending`,`retrying`,`partial`,`delivered`,`failed`,`unavailable`]),reason:e.enum([`in_progress`,`partial_delivery`,`complete`,`retry_exhausted`,`receipt_unavailable`]),receivers:e.array(C).max(16),updatedAt:e.iso.datetime()}).strict(),T=e.object({code:o,state:e.enum([`degraded`,`failed`,`unknown`,`warning`]),summary:a(300),suggestedCommand:a(500).optional()}).strict(),E=e.object({contractVersion:e.literal(1),projectId:o,environment:o,registration:e.object({enabled:e.boolean(),mode:e.enum([`disabled`,`shadow`,`live`]),policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),sourceRevision:a(160)}).strict(),rules:e.array(e.object({id:o,semanticDigest:e.string().regex(/^[a-f0-9]{64}$/),enabled:e.boolean(),state:e.enum([`closed`,`firing`,`idle`,`unknown`]),severity:e.enum([`warning`,`critical`]).nullable(),incidentId:l.nullable(),lastEvaluatedAt:e.iso.datetime().nullable(),lastEventId:l.nullable()}).strict()).max(64),deliveries:e.array(w).max(64),heartbeat:e.object({state:e.enum([`healthy`,`stale`,`unavailable`]),lastCompletedAt:e.iso.datetime().nullable()}).strict(),diagnostics:e.array(T).max(32)}).strict(),D=e.object({state:e.enum([`available`,`unavailable`]),backlogCount:e.number().int().nonnegative().nullable(),backlogBytes:e.number().int().nonnegative().nullable(),oldestMessageAt:e.iso.datetime().nullable(),retentionSeconds:e.number().int().positive().nullable()}).strict(),O=e.string().regex(/^[A-Z][A-Z0-9_]{2,127}$/),k=e.string().max(240).regex(/^(?![A-Za-z]:|\/|.*(?:^|\/)\.\.(?:\/|$)).+\.json$/),A=e.object({mode:e.enum([`disabled`,`shadow`,`live`]),statusUrlEnv:O,statusHmacSecretEnv:O,healthReportHmacSecretEnv:O.optional(),opsAccountIdEnv:O,provisionApiTokenEnv:O,statusApiTokenEnv:O,analyticsAccountIdEnv:O,analyticsApiTokenEnv:O,analyticsDataset:o,workerName:o,queueName:o,dlqName:o,registrationQueueName:o,registrationDlqName:o,notificationWorkerName:o,healthchecksProvisionApiKeyEnv:O.optional(),healthchecksPingUrlEnv:O.optional(),healthchecksStatusApiKeyEnv:O.optional()}).strict().superRefine((e,t)=>{let n=[e.healthchecksProvisionApiKeyEnv,e.healthchecksPingUrlEnv,e.healthchecksStatusApiKeyEnv].filter(Boolean);n.length>0&&n.length!==3&&t.addIssue({code:`custom`,message:`Healthchecks provision, status and ping URL references must be configured together`,path:[`healthchecksProvisionApiKeyEnv`]})}),j=e.object({contractVersion:e.literal(1),projectId:o,policy:k,environments:e.record(o,A)}).strict().superRefine((e,t)=>{Object.keys(e.environments).length===0&&t.addIssue({code:`custom`,message:`at least one environment is required`,path:[`environments`]})}),M=e.object({type:e.literal(`abuse`),project:e.string().regex(/^[a-zA-Z0-9._/-]{1,120}$/),target:o,action:o,layer:o,ttl:e.string().regex(/^[1-9][0-9]{0,4}[smhd]$/).optional()}).strict(),N=e.discriminatedUnion(`type`,[p,M]),P=e.object({id:o,enabled:e.boolean(),signalClass:e.enum([`attack`,`service`]),signal:e.object({type:e.enum([`operation_count`,`worker_error_ratio`,`edge_security_spike`,`provider_health`]),operation:s.optional(),operations:e.array(s).min(1).max(16).optional(),outcomes:e.array(e.enum([`committed`,`accepted_noop`,`rejected`,`failed`])).max(4).optional(),minimumSample:e.number().int().positive().optional()}).strict(),windowMinutes:e.number().int().min(5).max(1440),thresholds:e.object({warning:e.number().nonnegative(),critical:e.number().positive()}).strict().refine(e=>e.critical>e.warning,`critical must exceed warning`),recovery:e.object({healthyEvaluations:e.number().int().min(1).max(24)}).strict(),reminders:e.object({warningMinutes:e.number().int().min(5).max(10080),criticalMinutes:e.number().int().min(5).max(10080)}).strict(),runbook:f,receiverKeys:e.array(o).min(1).max(16),actions:e.object({warning:N,critical:N}).strict()}).strict().superRefine((e,t)=>{e.signal.operation&&e.signal.operations&&t.addIssue({code:`custom`,message:`signal cannot define both operation and operations`,path:[`signal`]}),e.signal.type===`operation_count`&&!e.signal.operation&&!e.signal.operations&&t.addIssue({code:`custom`,message:`operation_count requires operation or operations`,path:[`signal`]}),e.signal.type===`provider_health`&&e.thresholds.warning>1&&t.addIssue({code:`custom`,message:`provider_health warning threshold must be at most 1`,path:[`thresholds`,`warning`]}),e.signalClass===`service`&&(e.actions.warning.type!==`none`||e.actions.critical.type!==`none`)&&t.addIssue({code:`custom`,message:`service rules cannot configure abuse actions`,path:[`actions`]})}),F=e.object({contractVersion:e.literal(1),evaluationMinutes:e.number().int().min(5).max(60),rules:e.array(P).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.rules.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`duplicate rule id ${i.id}`,path:[`rules`,r,`id`]}),n.add(i.id)}),I=e.object({analytics:e.object({accountIdBinding:O,dataset:o,index:a(160),tokenBinding:O}).strict(),enabled:e.boolean(),environment:o,mode:e.enum([`disabled`,`shadow`,`live`]),policy:F,policyDigest:e.string().regex(/^[a-f0-9]{64}$/),projectionDigest:e.string().regex(/^[a-f0-9]{64}$/),projectId:o,projectedAt:e.iso.datetime(),sourceRevision:a(160),healthReportHmacSecretBinding:O.optional()}).strict().refine(e=>e.enabled===(e.mode!==`disabled`),{message:`enabled must match registration mode`,path:[`enabled`]}).superRefine((e,t)=>{e.mode===`live`&&!e.policy.rules.some(e=>e.enabled&&e.signal.type===`provider_health`)&&t.addIssue({code:`custom`,message:`Live registration requires an enabled provider_health rule`,path:[`policy`,`rules`]})}),L=e.object({commandId:l,contractVersion:e.literal(1),expectedPreviousDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),kind:e.literal(`registration_upsert`),registration:I}).strict(),R=e.string().trim().min(1).max(160),z=e.object({key:o,value:e.number().finite().nonnegative(),unit:e.enum([`bytes`,`count`,`milliseconds`,`percent`,`ratio`]).optional()}).strict(),B=e.object({episodeId:c,attempt:e.number().int().min(1).max(1e3),terminal:e.boolean(),operation:s,stage:o,code:o,summary:a(300),correlationId:R.optional(),upstreamStatus:e.number().int().min(100).max(599).optional(),upstreamCode:o.optional()}).strict(),V=e.object({componentKey:o,componentClass:o,state:e.enum([`healthy`,`degraded`,`failed`,`unavailable`,`unknown`]),lastSuccessAt:e.iso.datetime().nullable(),facts:e.array(z).max(16),failure:B.nullable()}).strict().superRefine((e,t)=>{e.state===`healthy`&&e.failure!==null&&t.addIssue({code:`custom`,message:`healthy components cannot carry a current failure`,path:[`failure`]}),(e.state===`failed`||e.state===`unavailable`)&&e.failure===null&&t.addIssue({code:`custom`,message:`failed and unavailable components require a current failure`,path:[`failure`]})}),H=e.object({contractVersion:e.literal(1),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(V).min(1).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey)}),U=e.object({capabilityKey:o,state:e.enum([`enabled`,`disabled`])}).strict(),W=e.object({contractVersion:e.literal(2),projectId:o,environment:o,runtimeInstanceId:o,reportId:c,sequence:e.number().int().min(1).max(2**53-1),observedAt:e.iso.datetime(),components:e.array(V).min(1).max(64),capabilities:e.array(U).max(64)}).strict().superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.components.entries())n.has(i.componentKey)&&t.addIssue({code:`custom`,message:`duplicate component key ${i.componentKey}`,path:[`components`,r,`componentKey`]}),n.add(i.componentKey);let r=new Set;for(let[n,i]of e.capabilities.entries())r.has(i.capabilityKey)&&t.addIssue({code:`custom`,message:`duplicate capability key ${i.capabilityKey}`,path:[`capabilities`,n,`capabilityKey`]}),r.add(i.capabilityKey)}),G=e.union([H,W]),K=e.object({timestamp:e.iso.datetime(),nonce:c,signature:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),q=e.object({contractVersion:e.literal(1),report:H,authentication:K}).strict(),J=e.object({contractVersion:e.literal(2),report:W,authentication:K}).strict(),Y=e.union([q,J]);function X(e){let t=q.omit({authentication:!0}).extend({authentication:K.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function Z(e){let t=J.omit({authentication:!0}).extend({authentication:K.omit({signature:!0})}).parse(e);return JSON.stringify(t)}function Q(e){return e.contractVersion===1?X(e):Z(e)}const $=e.enum([`authentication_failed`,`identity_not_registered`,`nonce_replayed`,`report_invalid`,`runtime_identity_mismatch`,`sequence_invalid`,`size_exceeded`,`timestamp_out_of_range`,`unexpected_failure`]),ee=e.discriminatedUnion(`outcome`,[e.object({outcome:e.literal(`accepted`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`duplicate`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`out_of_order`),acceptedSequence:e.number().int().min(1).max(2**53-1),receivedAt:e.iso.datetime()}).strict(),e.object({outcome:e.literal(`rejected`),rejectionCode:$,summary:a(300)}).strict()]);export{g as sentinelActionSchema,F as sentinelAlertPolicySchema,t as sentinelContractVersion,w as sentinelDeliveryReceiptSchema,T as sentinelDiagnosticSchema,A as sentinelEnvironmentBindingSchema,c as sentinelEventIdSchema,d as sentinelEvidenceSchema,V as sentinelHealthComponentSchema,B as sentinelHealthFailureSchema,z as sentinelHealthMetricFactSchema,G as sentinelHealthReportAnySchema,Q as sentinelHealthReportAnySignatureInput,K as sentinelHealthReportAuthenticationSchema,ee as sentinelHealthReportIngestResultSchema,n as sentinelHealthReportMaximumBytes,i as sentinelHealthReportMaximumCapabilities,r as sentinelHealthReportMaximumComponents,$ as sentinelHealthReportRejectionCodeSchema,H as sentinelHealthReportSchema,X as sentinelHealthReportSignatureInput,Y as sentinelHealthReportSubmissionAnySchema,q as sentinelHealthReportSubmissionSchema,J as sentinelHealthReportSubmissionV2Schema,W as sentinelHealthReportV2Schema,Z as sentinelHealthReportV2SignatureInput,v as sentinelIncidentEventSchema,N as sentinelPolicyActionSchema,j as sentinelProjectManifestSchema,x as sentinelQueueEventIdentityInput,b as sentinelQueueEventSchema,D as sentinelQueueMetricsSchema,S as sentinelReceiverFailureCodeSchema,C as sentinelReceiverStateSchema,L as sentinelRegistrationCommandSchema,I as sentinelRegistrationSchema,P as sentinelRuleSchema,f as sentinelRunbookSchema,U as sentinelRuntimeCapabilityObservationSchema,E as sentinelRuntimeStatusSchema,y as sentinelTestEventSchema};
|