checkly 8.14.1 → 8.15.0-prerelease-cdf176f
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/ai-context/context.d.ts +18 -0
- package/dist/ai-context/context.js +89 -0
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/skills-command/references/configure-grpc-monitors.md +37 -0
- package/dist/ai-context/skills-command/references/configure-playwright-checks.md +5 -5
- package/dist/ai-context/skills-command/references/configure-ssl-monitors.md +39 -0
- package/dist/ai-context/skills-command/references/configure-traceroute-monitors.md +36 -0
- package/dist/ai-context/skills-command/references/configure.md +9 -0
- package/dist/commands/checks/stats.js +1 -0
- package/dist/commands/checks/stats.js.map +1 -1
- package/dist/commands/deploy.js +25 -16
- package/dist/commands/deploy.js.map +1 -1
- package/dist/constants.d.ts +4 -1
- package/dist/constants.js +3 -0
- package/dist/constants.js.map +1 -1
- package/dist/constructs/api-assertion-codegen.js +2 -2
- package/dist/constructs/api-assertion-codegen.js.map +1 -1
- package/dist/constructs/api-assertion.d.ts +3 -3
- package/dist/constructs/check-codegen.d.ts +6 -0
- package/dist/constructs/check-codegen.js +24 -0
- package/dist/constructs/check-codegen.js.map +1 -1
- package/dist/constructs/dns-assertion-codegen.js +2 -2
- package/dist/constructs/dns-assertion-codegen.js.map +1 -1
- package/dist/constructs/dns-assertion.d.ts +3 -3
- package/dist/constructs/dns-request.d.ts +2 -2
- package/dist/constructs/grpc-assertion-codegen.d.ts +3 -0
- package/dist/constructs/grpc-assertion-codegen.js +33 -0
- package/dist/constructs/grpc-assertion-codegen.js.map +1 -0
- package/dist/constructs/grpc-assertion-validation.d.ts +13 -0
- package/dist/constructs/grpc-assertion-validation.js +53 -0
- package/dist/constructs/grpc-assertion-validation.js.map +1 -0
- package/dist/constructs/grpc-assertion.d.ts +61 -0
- package/dist/constructs/grpc-assertion.js +71 -0
- package/dist/constructs/grpc-assertion.js.map +1 -0
- package/dist/constructs/grpc-monitor-codegen.d.ts +13 -0
- package/dist/constructs/grpc-monitor-codegen.js +34 -0
- package/dist/constructs/grpc-monitor-codegen.js.map +1 -0
- package/dist/constructs/grpc-monitor.d.ts +83 -0
- package/dist/constructs/grpc-monitor.js +56 -0
- package/dist/constructs/grpc-monitor.js.map +1 -0
- package/dist/constructs/grpc-request-codegen.d.ts +4 -0
- package/dist/constructs/grpc-request-codegen.js +68 -0
- package/dist/constructs/grpc-request-codegen.js.map +1 -0
- package/dist/constructs/grpc-request.d.ts +137 -0
- package/dist/constructs/grpc-request.js +2 -0
- package/dist/constructs/grpc-request.js.map +1 -0
- package/dist/constructs/icmp-assertion-codegen.js +2 -2
- package/dist/constructs/icmp-assertion-codegen.js.map +1 -1
- package/dist/constructs/icmp-assertion.d.ts +1 -1
- package/dist/constructs/icmp-request.d.ts +2 -2
- package/dist/constructs/index.d.ts +9 -0
- package/dist/constructs/index.js +9 -0
- package/dist/constructs/index.js.map +1 -1
- package/dist/constructs/internal/assertion-codegen.d.ts +11 -0
- package/dist/constructs/internal/assertion-codegen.js +39 -0
- package/dist/constructs/internal/assertion-codegen.js.map +1 -1
- package/dist/constructs/internal/assertion-validation.d.ts +3 -0
- package/dist/constructs/internal/assertion-validation.js +17 -0
- package/dist/constructs/internal/assertion-validation.js.map +1 -0
- package/dist/constructs/internal/assertion.d.ts +17 -11
- package/dist/constructs/internal/assertion.js +39 -38
- package/dist/constructs/internal/assertion.js.map +1 -1
- package/dist/constructs/internal/common-diagnostics.d.ts +1 -0
- package/dist/constructs/internal/common-diagnostics.js +14 -0
- package/dist/constructs/internal/common-diagnostics.js.map +1 -1
- package/dist/constructs/ssl-assertion-codegen.d.ts +3 -0
- package/dist/constructs/ssl-assertion-codegen.js +36 -0
- package/dist/constructs/ssl-assertion-codegen.js.map +1 -0
- package/dist/constructs/ssl-assertion-validation.d.ts +13 -0
- package/dist/constructs/ssl-assertion-validation.js +49 -0
- package/dist/constructs/ssl-assertion-validation.js.map +1 -0
- package/dist/constructs/ssl-assertion.d.ts +197 -0
- package/dist/constructs/ssl-assertion.js +267 -0
- package/dist/constructs/ssl-assertion.js.map +1 -0
- package/dist/constructs/ssl-monitor-codegen.d.ts +36 -0
- package/dist/constructs/ssl-monitor-codegen.js +51 -0
- package/dist/constructs/ssl-monitor-codegen.js.map +1 -0
- package/dist/constructs/ssl-monitor.d.ts +89 -0
- package/dist/constructs/ssl-monitor.js +73 -0
- package/dist/constructs/ssl-monitor.js.map +1 -0
- package/dist/constructs/ssl-request-codegen.d.ts +4 -0
- package/dist/constructs/ssl-request-codegen.js +48 -0
- package/dist/constructs/ssl-request-codegen.js.map +1 -0
- package/dist/constructs/ssl-request.d.ts +143 -0
- package/dist/constructs/ssl-request.js +2 -0
- package/dist/constructs/ssl-request.js.map +1 -0
- package/dist/constructs/tcp-monitor-codegen.js +2 -2
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor.d.ts +1 -1
- package/dist/constructs/traceroute-assertion-codegen.d.ts +3 -0
- package/dist/constructs/traceroute-assertion-codegen.js +17 -0
- package/dist/constructs/traceroute-assertion-codegen.js.map +1 -0
- package/dist/constructs/traceroute-assertion-validation.d.ts +11 -0
- package/dist/constructs/traceroute-assertion-validation.js +77 -0
- package/dist/constructs/traceroute-assertion-validation.js.map +1 -0
- package/dist/constructs/traceroute-assertion.d.ts +67 -0
- package/dist/constructs/traceroute-assertion.js +96 -0
- package/dist/constructs/traceroute-assertion.js.map +1 -0
- package/dist/constructs/traceroute-monitor-codegen.d.ts +13 -0
- package/dist/constructs/traceroute-monitor-codegen.js +34 -0
- package/dist/constructs/traceroute-monitor-codegen.js.map +1 -0
- package/dist/constructs/traceroute-monitor.d.ts +83 -0
- package/dist/constructs/traceroute-monitor.js +54 -0
- package/dist/constructs/traceroute-monitor.js.map +1 -0
- package/dist/constructs/traceroute-request-codegen.d.ts +4 -0
- package/dist/constructs/traceroute-request-codegen.js +41 -0
- package/dist/constructs/traceroute-request-codegen.js.map +1 -0
- package/dist/constructs/traceroute-request.d.ts +81 -0
- package/dist/constructs/traceroute-request.js +2 -0
- package/dist/constructs/traceroute-request.js.map +1 -0
- package/dist/constructs/url-assertion-codegen.js +2 -2
- package/dist/constructs/url-assertion-codegen.js.map +1 -1
- package/dist/formatters/assertion-line.d.ts +27 -0
- package/dist/formatters/assertion-line.js +126 -0
- package/dist/formatters/assertion-line.js.map +1 -0
- package/dist/formatters/batch-stats.js +20 -1
- package/dist/formatters/batch-stats.js.map +1 -1
- package/dist/formatters/check-result-detail.js +604 -1
- package/dist/formatters/check-result-detail.js.map +1 -1
- package/dist/helpers/cli-mode.d.ts +2 -2
- package/dist/helpers/cli-mode.js +103 -11
- package/dist/helpers/cli-mode.js.map +1 -1
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +58 -0
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/util.js +192 -89
- package/dist/reporters/util.js.map +1 -1
- package/dist/rest/analytics.js +6 -0
- package/dist/rest/analytics.js.map +1 -1
- package/dist/rest/batch-analytics.d.ts +1 -0
- package/dist/rest/batch-analytics.js.map +1 -1
- package/dist/rest/check-results.d.ts +75 -1
- package/dist/rest/check-results.js.map +1 -1
- package/dist/rest/projects.d.ts +1 -1
- package/dist/services/check-parser/bundler.d.ts +6 -0
- package/dist/services/check-parser/bundler.js +8 -0
- package/dist/services/check-parser/bundler.js.map +1 -1
- package/dist/services/check-parser/cache-hash.d.ts +24 -2
- package/dist/services/check-parser/cache-hash.js +45 -3
- package/dist/services/check-parser/cache-hash.js.map +1 -1
- package/dist/services/check-parser/package-files/resolver.d.ts +6 -1
- package/dist/services/check-parser/package-files/resolver.js +19 -0
- package/dist/services/check-parser/package-files/resolver.js.map +1 -1
- package/dist/services/util.d.ts +4 -0
- package/dist/services/util.js +4 -0
- package/dist/services/util.js.map +1 -1
- package/oclif.manifest.json +214 -208
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-assertion.js","sour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;IACH,MAAM,CAAC,kBAAkB;QACvB,OAAO,IAAI,kCAAkC,EAAE,CAAA;IACjD,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,WAAW;QAChB,OAAO,IAAI,2BAA2B,EAAE,CAAA;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Codegen, Context } from './internal/codegen/index.js';
|
|
2
|
+
import { MonitorResource } from './monitor-codegen.js';
|
|
3
|
+
import { SslAssertion } from './ssl-assertion.js';
|
|
4
|
+
import { IPFamily } from './ip.js';
|
|
5
|
+
import { SecurityBaseline, SslClientCertificateMode } from './ssl-request.js';
|
|
6
|
+
/**
|
|
7
|
+
* Wire-format shape of the SSL request as returned by the Checkly API.
|
|
8
|
+
* hostname/port/ipFamily live inside sslConfig on the wire; the construct
|
|
9
|
+
* exposes them at different levels. degradedResponseTime/maxResponseTime
|
|
10
|
+
* live at the resource top level, not inside sslConfig.
|
|
11
|
+
*/
|
|
12
|
+
export interface SslMonitorWireRequest {
|
|
13
|
+
sslConfig: {
|
|
14
|
+
hostname: string;
|
|
15
|
+
port?: number;
|
|
16
|
+
ipFamily?: IPFamily;
|
|
17
|
+
serverName?: string;
|
|
18
|
+
skipChainValidation?: boolean;
|
|
19
|
+
handshakeTimeoutMs?: number;
|
|
20
|
+
alertDaysBeforeExpiry?: number;
|
|
21
|
+
clientCertificateMode?: SslClientCertificateMode;
|
|
22
|
+
securityBaseline?: SecurityBaseline;
|
|
23
|
+
};
|
|
24
|
+
sslClientCertificateId?: string;
|
|
25
|
+
assertions?: Array<SslAssertion>;
|
|
26
|
+
}
|
|
27
|
+
export interface SslMonitorResource extends MonitorResource {
|
|
28
|
+
checkType: 'SSL';
|
|
29
|
+
request: SslMonitorWireRequest;
|
|
30
|
+
degradedResponseTime?: number;
|
|
31
|
+
maxResponseTime?: number;
|
|
32
|
+
}
|
|
33
|
+
export declare class SslMonitorCodegen extends Codegen<SslMonitorResource> {
|
|
34
|
+
describe(resource: SslMonitorResource): string;
|
|
35
|
+
gencode(logicalId: string, resource: SslMonitorResource, context: Context): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Codegen } from './internal/codegen/index.js';
|
|
2
|
+
import { expr, ident } from '../sourcegen/index.js';
|
|
3
|
+
import { buildMonitorProps } from './monitor-codegen.js';
|
|
4
|
+
import { valueForSslRequest } from './ssl-request-codegen.js';
|
|
5
|
+
const construct = 'SslMonitor';
|
|
6
|
+
export class SslMonitorCodegen extends Codegen {
|
|
7
|
+
describe(resource) {
|
|
8
|
+
return `SSL Monitor: ${resource.name}`;
|
|
9
|
+
}
|
|
10
|
+
gencode(logicalId, resource, context) {
|
|
11
|
+
const filePath = context.filePath('resources/ssl-monitors', resource.name, {
|
|
12
|
+
tags: resource.tags,
|
|
13
|
+
unique: true,
|
|
14
|
+
});
|
|
15
|
+
const file = this.program.generatedConstructFile(filePath.fullPath);
|
|
16
|
+
file.namedImport(construct, 'checkly/constructs');
|
|
17
|
+
// Map wire format to new construct shape
|
|
18
|
+
const wireReq = resource.request;
|
|
19
|
+
const constructRequest = {
|
|
20
|
+
hostname: wireReq.sslConfig.hostname,
|
|
21
|
+
port: wireReq.sslConfig.port,
|
|
22
|
+
ipFamily: wireReq.sslConfig.ipFamily,
|
|
23
|
+
sslConfig: {
|
|
24
|
+
serverName: wireReq.sslConfig.serverName,
|
|
25
|
+
sslClientCertificateId: wireReq.sslClientCertificateId,
|
|
26
|
+
skipChainValidation: wireReq.sslConfig.skipChainValidation,
|
|
27
|
+
handshakeTimeout: wireReq.sslConfig.handshakeTimeoutMs,
|
|
28
|
+
alertDaysBeforeExpiry: wireReq.sslConfig.alertDaysBeforeExpiry,
|
|
29
|
+
clientCertificateMode: wireReq.sslConfig.clientCertificateMode,
|
|
30
|
+
securityBaseline: wireReq.sslConfig.securityBaseline,
|
|
31
|
+
},
|
|
32
|
+
assertions: wireReq.assertions,
|
|
33
|
+
};
|
|
34
|
+
file.section(expr(ident(construct), builder => {
|
|
35
|
+
builder.new(builder => {
|
|
36
|
+
builder.string(logicalId);
|
|
37
|
+
builder.object(builder => {
|
|
38
|
+
if (resource.degradedResponseTime !== undefined) {
|
|
39
|
+
builder.number('degradedResponseTime', resource.degradedResponseTime);
|
|
40
|
+
}
|
|
41
|
+
if (resource.maxResponseTime !== undefined) {
|
|
42
|
+
builder.number('maxResponseTime', resource.maxResponseTime);
|
|
43
|
+
}
|
|
44
|
+
buildMonitorProps(this.program, file, builder, resource, context);
|
|
45
|
+
builder.value('request', valueForSslRequest(this.program, file, context, constructRequest));
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ssl-monitor-codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-monitor-codegen.js","sourceRoot":"","sources":["../../src/constructs/ssl-monitor-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,sBAAsB,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAmC7D,MAAM,SAAS,GAAG,YAAY,CAAA;AAE9B,MAAM,OAAO,iBAAkB,SAAQ,OAA2B;IAChE,QAAQ,CAAE,QAA4B;QACpC,OAAO,gBAAgB,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxC,CAAC;IAED,OAAO,CAAE,SAAiB,EAAE,QAA4B,EAAE,OAAgB;QACxE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,wBAAwB,EAAE,QAAQ,CAAC,IAAI,EAAE;YACzE,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM,EAAE,IAAI;SACb,CAAC,CAAA;QAEF,MAAM,I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CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;wBAC3C,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAA;oBAC7D,CAAC;oBAED,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;oBAEjE,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAA;gBAC7F,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Monitor, MonitorProps } from './monitor.js';
|
|
2
|
+
import { Diagnostics } from './diagnostics.js';
|
|
3
|
+
import { SslRequest } from './ssl-request.js';
|
|
4
|
+
export interface SslMonitorProps extends MonitorProps {
|
|
5
|
+
/**
|
|
6
|
+
* Determines the request that the monitor is going to run.
|
|
7
|
+
*/
|
|
8
|
+
request: SslRequest;
|
|
9
|
+
/**
|
|
10
|
+
* The handshake time in milliseconds above which the monitor is considered
|
|
11
|
+
* degraded.
|
|
12
|
+
*
|
|
13
|
+
* @minimum 0
|
|
14
|
+
* @maximum 30000
|
|
15
|
+
* @defaultValue 3000
|
|
16
|
+
*/
|
|
17
|
+
degradedResponseTime?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The handshake time in milliseconds above which the monitor is considered
|
|
20
|
+
* failing. Must be greater than or equal to `degradedResponseTime`.
|
|
21
|
+
*
|
|
22
|
+
* @minimum 0
|
|
23
|
+
* @maximum 30000
|
|
24
|
+
* @defaultValue 10000
|
|
25
|
+
*/
|
|
26
|
+
maxResponseTime?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates an SSL Monitor
|
|
30
|
+
*/
|
|
31
|
+
export declare class SslMonitor extends Monitor {
|
|
32
|
+
request: SslRequest;
|
|
33
|
+
degradedResponseTime?: number;
|
|
34
|
+
maxResponseTime?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Constructs the SSL Monitor instance
|
|
37
|
+
*
|
|
38
|
+
* @param logicalId unique project-scoped resource name identification
|
|
39
|
+
* @param props configuration properties
|
|
40
|
+
*
|
|
41
|
+
* {@link https://www.checklyhq.com/docs/constructs/ssl-monitor/ Read more in the docs}
|
|
42
|
+
*/
|
|
43
|
+
constructor(logicalId: string, props: SslMonitorProps);
|
|
44
|
+
describe(): string;
|
|
45
|
+
validate(diagnostics: Diagnostics): Promise<void>;
|
|
46
|
+
synthesize(): {
|
|
47
|
+
checkType: string;
|
|
48
|
+
request: {
|
|
49
|
+
sslConfig: {
|
|
50
|
+
hostname: string;
|
|
51
|
+
port: number | undefined;
|
|
52
|
+
ipFamily: import("./ip.js").IPFamily | undefined;
|
|
53
|
+
serverName: string | undefined;
|
|
54
|
+
skipChainValidation: boolean | undefined;
|
|
55
|
+
handshakeTimeoutMs: number | undefined;
|
|
56
|
+
alertDaysBeforeExpiry: number | undefined;
|
|
57
|
+
clientCertificateMode: import("./ssl-request.js").SslClientCertificateMode | undefined;
|
|
58
|
+
securityBaseline: import("./ssl-request.js").SecurityBaseline | undefined;
|
|
59
|
+
};
|
|
60
|
+
sslClientCertificateId: string | undefined;
|
|
61
|
+
assertions: import("./ssl-assertion.js").SslAssertion[] | undefined;
|
|
62
|
+
};
|
|
63
|
+
degradedResponseTime: number | undefined;
|
|
64
|
+
maxResponseTime: number | undefined;
|
|
65
|
+
doubleCheck: boolean;
|
|
66
|
+
activated: boolean | undefined;
|
|
67
|
+
muted: boolean | undefined;
|
|
68
|
+
shouldFail: boolean | undefined;
|
|
69
|
+
locations: (keyof import("../index.js").Region)[] | undefined;
|
|
70
|
+
privateLocations: undefined;
|
|
71
|
+
tags: string[] | undefined;
|
|
72
|
+
frequency: number | undefined;
|
|
73
|
+
frequencyOffset: number | undefined;
|
|
74
|
+
groupId: import("./ref.js").Ref | null;
|
|
75
|
+
retryStrategy: import("./retry-strategy.js").LinearRetryStrategy | import("./retry-strategy.js").ExponentialRetryStrategy | import("./retry-strategy.js").FixedRetryStrategy | import("./retry-strategy.js").SingleRetryRetryStrategy | null | undefined;
|
|
76
|
+
alertSettings: import("./alert-escalation-policy.js").AlertEscalation | undefined;
|
|
77
|
+
useGlobalAlertSettings: boolean | undefined;
|
|
78
|
+
runParallel: boolean | undefined;
|
|
79
|
+
triggerIncident: {
|
|
80
|
+
serviceId: import("./ref.js").Ref;
|
|
81
|
+
severity: "MINOR" | "MEDIUM" | "MAJOR" | "CRITICAL";
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
notifySubscribers: boolean;
|
|
85
|
+
} | undefined;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
name: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Monitor } from './monitor.js';
|
|
2
|
+
import { Session } from './session.js';
|
|
3
|
+
import { validateResponseTimes } from './internal/common-diagnostics.js';
|
|
4
|
+
import { validateSslAssertion } from './ssl-assertion-validation.js';
|
|
5
|
+
import { RequiredPropertyDiagnostic } from './construct-diagnostics.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates an SSL Monitor
|
|
8
|
+
*/
|
|
9
|
+
export class SslMonitor extends Monitor {
|
|
10
|
+
request;
|
|
11
|
+
degradedResponseTime;
|
|
12
|
+
maxResponseTime;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs the SSL Monitor instance
|
|
15
|
+
*
|
|
16
|
+
* @param logicalId unique project-scoped resource name identification
|
|
17
|
+
* @param props configuration properties
|
|
18
|
+
*
|
|
19
|
+
* {@link https://www.checklyhq.com/docs/constructs/ssl-monitor/ Read more in the docs}
|
|
20
|
+
*/
|
|
21
|
+
constructor(logicalId, props) {
|
|
22
|
+
super(logicalId, props);
|
|
23
|
+
this.request = props.request;
|
|
24
|
+
this.degradedResponseTime = props.degradedResponseTime;
|
|
25
|
+
this.maxResponseTime = props.maxResponseTime;
|
|
26
|
+
Session.registerConstruct(this);
|
|
27
|
+
this.addSubscriptions();
|
|
28
|
+
this.addPrivateLocationCheckAssignments();
|
|
29
|
+
}
|
|
30
|
+
describe() {
|
|
31
|
+
return `SslMonitor:${this.logicalId}`;
|
|
32
|
+
}
|
|
33
|
+
async validate(diagnostics) {
|
|
34
|
+
await super.validate(diagnostics);
|
|
35
|
+
const config = this.request.sslConfig;
|
|
36
|
+
if (config?.sslClientCertificateId === undefined && config?.clientCertificateMode === 'explicit') {
|
|
37
|
+
diagnostics.add(new RequiredPropertyDiagnostic('sslClientCertificateId', new Error(`A value for "sslClientCertificateId" is required when "clientCertificateMode" is "explicit".`)));
|
|
38
|
+
}
|
|
39
|
+
await validateResponseTimes(diagnostics, this, {
|
|
40
|
+
degradedResponseTime: 30_000,
|
|
41
|
+
maxResponseTime: 30_000,
|
|
42
|
+
// Backend default applied when maxResponseTime is omitted.
|
|
43
|
+
defaultMaxResponseTime: 10_000,
|
|
44
|
+
});
|
|
45
|
+
for (const [index, assertion] of (this.request.assertions ?? []).entries()) {
|
|
46
|
+
validateSslAssertion(diagnostics, assertion, index);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
synthesize() {
|
|
50
|
+
return {
|
|
51
|
+
...super.synthesize(),
|
|
52
|
+
checkType: 'SSL',
|
|
53
|
+
request: {
|
|
54
|
+
sslConfig: {
|
|
55
|
+
hostname: this.request.hostname,
|
|
56
|
+
port: this.request.port,
|
|
57
|
+
ipFamily: this.request.ipFamily,
|
|
58
|
+
serverName: this.request.sslConfig.serverName,
|
|
59
|
+
skipChainValidation: this.request.sslConfig.skipChainValidation,
|
|
60
|
+
handshakeTimeoutMs: this.request.sslConfig.handshakeTimeout,
|
|
61
|
+
alertDaysBeforeExpiry: this.request.sslConfig.alertDaysBeforeExpiry,
|
|
62
|
+
clientCertificateMode: this.request.sslConfig.clientCertificateMode,
|
|
63
|
+
securityBaseline: this.request.sslConfig.securityBaseline,
|
|
64
|
+
},
|
|
65
|
+
sslClientCertificateId: this.request.sslConfig.sslClientCertificateId,
|
|
66
|
+
assertions: this.request.assertions,
|
|
67
|
+
},
|
|
68
|
+
degradedResponseTime: this.degradedResponseTime,
|
|
69
|
+
maxResponseTime: this.maxResponseTime,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ssl-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-monitor.js","sourceRoot":"","sources":["../../src/constructs/ssl-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AA6BvE;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAY;IACnB,oBAAoB,CAAS;IAC7B,eAAe,CAAS;IAExB;;;;;;;OAOG;IAEH,YAAa,SAAiB,EAAE,KAAsB;QACpD,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAEvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAA;QACtD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAA;QAE5C,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACvB,IAAI,CAAC,kCAAkC,EAAE,CAAA;IAC3C,CAAC;IAED,QAAQ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,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,gBAAgB;oBAC3D,qBAAqB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,qBAAqB;oBACnE,qBAAqB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,qBAAqB;oBACnE,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,gBAAgB;iBAC1D;gBACD,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,sBAAsB;gBACrE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;aACpC;YACD,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;YAC/C,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GeneratedFile, Program, Value } from '../sourcegen/index.js';
|
|
2
|
+
import { SslRequest } from './ssl-request.js';
|
|
3
|
+
import { Context } from './internal/codegen/index.js';
|
|
4
|
+
export declare function valueForSslRequest(program: Program, genfile: GeneratedFile, context: Context, request: SslRequest): Value;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { object, unknown } from '../sourcegen/index.js';
|
|
2
|
+
import { valueForSslAssertion } from './ssl-assertion-codegen.js';
|
|
3
|
+
export function valueForSslRequest(program, genfile, context, request) {
|
|
4
|
+
return object(builder => {
|
|
5
|
+
builder.string('hostname', request.hostname);
|
|
6
|
+
if (request.port !== undefined && request.port !== 443) {
|
|
7
|
+
builder.number('port', request.port);
|
|
8
|
+
}
|
|
9
|
+
if (request.ipFamily && request.ipFamily !== 'IPv4') {
|
|
10
|
+
builder.string('ipFamily', request.ipFamily);
|
|
11
|
+
}
|
|
12
|
+
const config = request.sslConfig;
|
|
13
|
+
builder.object('sslConfig', builder => {
|
|
14
|
+
if (config.serverName) {
|
|
15
|
+
builder.string('serverName', config.serverName);
|
|
16
|
+
}
|
|
17
|
+
if (config.sslClientCertificateId) {
|
|
18
|
+
builder.string('sslClientCertificateId', config.sslClientCertificateId);
|
|
19
|
+
}
|
|
20
|
+
if (config.skipChainValidation) {
|
|
21
|
+
builder.boolean('skipChainValidation', config.skipChainValidation);
|
|
22
|
+
}
|
|
23
|
+
if (config.handshakeTimeout !== undefined) {
|
|
24
|
+
builder.number('handshakeTimeout', config.handshakeTimeout);
|
|
25
|
+
}
|
|
26
|
+
if (config.alertDaysBeforeExpiry !== undefined) {
|
|
27
|
+
builder.number('alertDaysBeforeExpiry', config.alertDaysBeforeExpiry);
|
|
28
|
+
}
|
|
29
|
+
if (config.clientCertificateMode) {
|
|
30
|
+
builder.string('clientCertificateMode', config.clientCertificateMode);
|
|
31
|
+
}
|
|
32
|
+
if (config.securityBaseline) {
|
|
33
|
+
builder.value('securityBaseline', unknown(config.securityBaseline));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (request.assertions) {
|
|
37
|
+
const assertions = request.assertions;
|
|
38
|
+
if (assertions.length > 0) {
|
|
39
|
+
builder.array('assertions', builder => {
|
|
40
|
+
for (const assertion of assertions) {
|
|
41
|
+
builder.value(valueForSslAssertion(genfile, assertion));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=ssl-request-codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-request-codegen.js","sourceRoot":"","sources":["../../src/constructs/ssl-request-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAW,OAAO,EAAS,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAIjE,MAAM,UAAU,kBAAkB,CAChC,OAAgB,EAChB,OAAsB,EACtB,OAAgB,EAChB,OAAmB;IAEnB,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO,CA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AE,CAAC;gBACjC,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,qBAAqB,CAAC,CAAA;YACvE,CAAC;YAED,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBAC5B,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAA;YACrE,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;YACrC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;oBACpC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;wBACnC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;oBACzD,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { SslAssertion } from './ssl-assertion.js';
|
|
2
|
+
import { IPFamily } from './ip.js';
|
|
3
|
+
/**
|
|
4
|
+
* The severity applied to an SSL security-baseline rule.
|
|
5
|
+
*
|
|
6
|
+
* - `fail` marks the monitor as failing when the rule is violated.
|
|
7
|
+
* - `degrade` marks the monitor as degraded when the rule is violated.
|
|
8
|
+
* - `ignore` disables the rule.
|
|
9
|
+
*/
|
|
10
|
+
export type SslBaselineSeverity = 'fail' | 'degrade' | 'ignore';
|
|
11
|
+
/**
|
|
12
|
+
* A baseline rule whose value is a TLS version string (e.g. `TLS1.2`/`TLS1.3`).
|
|
13
|
+
*/
|
|
14
|
+
export interface SslBaselineTlsRule {
|
|
15
|
+
value?: string;
|
|
16
|
+
severity?: SslBaselineSeverity;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A baseline rule whose value is a key size in bits.
|
|
20
|
+
*/
|
|
21
|
+
export interface SslBaselineKeySizeRule {
|
|
22
|
+
value?: number;
|
|
23
|
+
severity?: SslBaselineSeverity;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A baseline rule that only carries a severity.
|
|
27
|
+
*/
|
|
28
|
+
export interface SslBaselineSeverityRule {
|
|
29
|
+
severity?: SslBaselineSeverity;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The SSL security baseline — a set of enforceable and advisory rules. Provide
|
|
33
|
+
* one only to override the server-side default baseline; omit it to inherit the
|
|
34
|
+
* account default.
|
|
35
|
+
*/
|
|
36
|
+
export interface SecurityBaseline {
|
|
37
|
+
/**
|
|
38
|
+
* Whether the security baseline is enforced. The server defaults this to
|
|
39
|
+
* `true` when omitted.
|
|
40
|
+
*/
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
minTLSVersion?: SslBaselineTlsRule;
|
|
43
|
+
minKeySizeBits?: SslBaselineKeySizeRule;
|
|
44
|
+
weakSignatureAlgorithm?: SslBaselineSeverityRule;
|
|
45
|
+
weakCipherSuite?: SslBaselineSeverityRule;
|
|
46
|
+
knownBadCA?: SslBaselineSeverityRule;
|
|
47
|
+
recommendedTLSVersion?: SslBaselineTlsRule;
|
|
48
|
+
recommendedKeySizeBits?: SslBaselineKeySizeRule;
|
|
49
|
+
ocspMustStapleRespected?: SslBaselineSeverityRule;
|
|
50
|
+
sctPresent?: SslBaselineSeverityRule;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The mutual-TLS client-certificate mode.
|
|
54
|
+
*
|
|
55
|
+
* - `auto` lets Checkly select a stored certificate.
|
|
56
|
+
* - `explicit` uses the certificate referenced by `sslClientCertificateId`.
|
|
57
|
+
*
|
|
58
|
+
* Omit to inherit the account default (no certificate sent).
|
|
59
|
+
*/
|
|
60
|
+
export type SslClientCertificateMode = 'auto' | 'explicit';
|
|
61
|
+
/**
|
|
62
|
+
* SSL-specific configuration nested inside an SSL monitor's request.
|
|
63
|
+
*/
|
|
64
|
+
export interface SslConfig {
|
|
65
|
+
/**
|
|
66
|
+
* An optional SNI server name to send in the TLS handshake. Defaults to
|
|
67
|
+
* `hostname` when unset.
|
|
68
|
+
*/
|
|
69
|
+
serverName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The ID of the stored client certificate to present. Required when
|
|
72
|
+
* `clientCertificateMode` is `explicit`.
|
|
73
|
+
*/
|
|
74
|
+
sslClientCertificateId?: string;
|
|
75
|
+
/**
|
|
76
|
+
* When true, the certificate chain is not validated against trusted roots
|
|
77
|
+
* (the certificate is still inspected for expiry and the security baseline).
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue false
|
|
80
|
+
*/
|
|
81
|
+
skipChainValidation?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The number of milliseconds to wait for the TLS handshake to complete before
|
|
84
|
+
* timing out.
|
|
85
|
+
*
|
|
86
|
+
* @minimum 1000
|
|
87
|
+
* @maximum 30000
|
|
88
|
+
* @defaultValue 10000
|
|
89
|
+
*/
|
|
90
|
+
handshakeTimeout?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Raise an alert when the certificate is within this many days of expiry.
|
|
93
|
+
*
|
|
94
|
+
* @minimum 1
|
|
95
|
+
* @maximum 365
|
|
96
|
+
* @defaultValue 20
|
|
97
|
+
*/
|
|
98
|
+
alertDaysBeforeExpiry?: number;
|
|
99
|
+
/**
|
|
100
|
+
* The mutual-TLS client-certificate mode. Omit to inherit the account default
|
|
101
|
+
* (no certificate sent).
|
|
102
|
+
*/
|
|
103
|
+
clientCertificateMode?: SslClientCertificateMode;
|
|
104
|
+
/**
|
|
105
|
+
* The SSL security baseline. Omit to inherit the account default baseline.
|
|
106
|
+
*/
|
|
107
|
+
securityBaseline?: SecurityBaseline;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Configuration for SSL requests.
|
|
111
|
+
* Defines the connection parameters and validation rules.
|
|
112
|
+
*/
|
|
113
|
+
export interface SslRequest {
|
|
114
|
+
/**
|
|
115
|
+
* The hostname to connect to and validate the TLS certificate of. Do not
|
|
116
|
+
* include a scheme or a port in this value.
|
|
117
|
+
*
|
|
118
|
+
* @example "example.com"
|
|
119
|
+
*/
|
|
120
|
+
hostname: string;
|
|
121
|
+
/**
|
|
122
|
+
* The port number to connect to.
|
|
123
|
+
*
|
|
124
|
+
* @minimum 1
|
|
125
|
+
* @maximum 65535
|
|
126
|
+
* @defaultValue 443
|
|
127
|
+
*/
|
|
128
|
+
port?: number;
|
|
129
|
+
/**
|
|
130
|
+
* The IP family to use when executing the check.
|
|
131
|
+
*
|
|
132
|
+
* @defaultValue "IPv4"
|
|
133
|
+
*/
|
|
134
|
+
ipFamily?: IPFamily;
|
|
135
|
+
/**
|
|
136
|
+
* The SSL-specific configuration for the connection.
|
|
137
|
+
*/
|
|
138
|
+
sslConfig: SslConfig;
|
|
139
|
+
/**
|
|
140
|
+
* Assertions to validate the TLS certificate.
|
|
141
|
+
*/
|
|
142
|
+
assertions?: Array<SslAssertion>;
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-request.js","sourceRoot":"","sources":["../../src/constructs/ssl-request.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expr, ident } from '../sourcegen/index.js';
|
|
2
|
-
import { valueForGeneralAssertion, valueForNumericAssertion } from './internal/assertion-codegen.js';
|
|
2
|
+
import { unsupportedAssertionSource, valueForGeneralAssertion, valueForNumericAssertion } from './internal/assertion-codegen.js';
|
|
3
3
|
import { Codegen } from './internal/codegen/index.js';
|
|
4
4
|
import { buildMonitorProps } from './monitor-codegen.js';
|
|
5
5
|
export function valueForTcpAssertion(genfile, assertion) {
|
|
@@ -10,7 +10,7 @@ export function valueForTcpAssertion(genfile, assertion) {
|
|
|
10
10
|
case 'RESPONSE_TIME':
|
|
11
11
|
return valueForNumericAssertion('TcpAssertionBuilder', 'responseTime', assertion);
|
|
12
12
|
default:
|
|
13
|
-
|
|
13
|
+
return unsupportedAssertionSource(assertion.source, 'TCP');
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const construct = 'TcpMonitor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcp-monitor-codegen.js","sourceRoot":"","sources":["../../src/constructs/tcp-monitor-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,KAAK,EAAS,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"tcp-monitor-codegen.js","sourceRoot":"","sources":["../../src/constructs/tcp-monitor-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,KAAK,EAAS,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAChI,OAAO,EAAE,OAAO,EAAW,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAmB,MAAM,sBAAsB,CAAA;AAUzE,MAAM,UAAU,oBAAoB,CAAE,OAAsB,EAAE,SAAuB;IACnF,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,oBAAoB,CAAC,CAAA;IAEhE,QAAQ,SAAS,CAAC,MAAM,EAAE,CAAC;QACzB,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,CAAC,CAAA;QACnF,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,CAAC,CAAA;QACnF;YACE,OAAO,0BAA0B,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC9D,CAAC;AACH,CA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OAAO,CAAC,EAAE;wBAClC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACrD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;wBAE7C,IAAI,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;4BAC9B,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACvD,CAAC;wBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;4BAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;wBAC/C,CAAC;wBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;4BAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;4BAC9C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gCAC1B,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE;oCACpC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;wCACnC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;oCACtD,CAAC;gCACH,CAAC,CAAC,CAAA;4BACJ,CAAC;wBACH,CAAC;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
|
|
@@ -25,7 +25,7 @@ export declare class TcpAssertionBuilder {
|
|
|
25
25
|
* @param property Optional property path for response data
|
|
26
26
|
* @returns A general assertion builder for response data content
|
|
27
27
|
*/
|
|
28
|
-
static responseData(property?: string): GeneralAssertionBuilder<TcpAssertionSource>;
|
|
28
|
+
static responseData(property?: string): GeneralAssertionBuilder<TcpAssertionSource, string | number | boolean>;
|
|
29
29
|
/**
|
|
30
30
|
* Creates an assertion builder for TCP response time.
|
|
31
31
|
* @returns A numeric assertion builder for response time in milliseconds
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { unsupportedAssertionSource, valueForNumericAssertion } from './internal/assertion-codegen.js';
|
|
2
|
+
export function valueForTracerouteAssertion(genfile, assertion) {
|
|
3
|
+
genfile.namedImport('TracerouteAssertionBuilder', 'checkly/constructs');
|
|
4
|
+
switch (assertion.source) {
|
|
5
|
+
case 'RESPONSE_TIME':
|
|
6
|
+
return valueForNumericAssertion('TracerouteAssertionBuilder', 'responseTime', assertion, {
|
|
7
|
+
hasProperty: true,
|
|
8
|
+
});
|
|
9
|
+
case 'HOP_COUNT':
|
|
10
|
+
return valueForNumericAssertion('TracerouteAssertionBuilder', 'hopCount', assertion);
|
|
11
|
+
case 'PACKET_LOSS':
|
|
12
|
+
return valueForNumericAssertion('TracerouteAssertionBuilder', 'packetLoss', assertion);
|
|
13
|
+
default:
|
|
14
|
+
return unsupportedAssertionSource(assertion.source, 'traceroute');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=traceroute-assertion-codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceroute-assertion-codegen.js","sourceRoot":"","sources":["../../src/constructs/traceroute-assertion-codegen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAGtG,MAAM,UAAU,2BAA2B,CAAE,OAAsB,EAAE,SAA8B;IACjG,OAAO,CAAC,WAAW,CAAC,4BAA4B,EAAE,oBAAoB,CAAC,CAAA;IAEvE,QAAQ,SAAS,CAAC,MAAM,EAAE,CAAC;QACzB,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,4BAA4B,EAAE,cAAc,EAAE,SAAS,EAAE;gBACvF,WAAW,EAAE,IAAI;aAClB,CAAC,CAAA;QACJ,KAAK,WAAW;YACd,OAAO,wBAAwB,CAAC,4BAA4B,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;QACtF,KAAK,aAAa;YAChB,OAAO,wBAAwB,CAAC,4BAA4B,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;QACxF;YACE,OAAO,0BAA0B,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Diagnostics } from './diagnostics.js';
|
|
2
|
+
import { TracerouteAssertion } from './traceroute-assertion.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reports traceroute assertions whose source, property or comparison the backend
|
|
5
|
+
* does not accept.
|
|
6
|
+
*
|
|
7
|
+
* Assertions written as plain object literals bypass TracerouteAssertionBuilder and
|
|
8
|
+
* are type-legal, because the fields are declared as plain strings. The backend
|
|
9
|
+
* rejects the invalid combinations with a 400, so they are caught here instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateTracerouteAssertion(diagnostics: Diagnostics, assertion: TracerouteAssertion, index: number): void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { addAssertionDiagnostic, quotedKeys } from './internal/assertion-validation.js';
|
|
2
|
+
// Runtime counterparts of unions that exist only at compile time. Typing them as a
|
|
3
|
+
// Record keyed by the union makes a missing or misspelled entry a compile-time error,
|
|
4
|
+
// so neither list can drift from the union it mirrors.
|
|
5
|
+
const responseTimeProperties = {
|
|
6
|
+
avg: true,
|
|
7
|
+
min: true,
|
|
8
|
+
max: true,
|
|
9
|
+
stdDev: true,
|
|
10
|
+
};
|
|
11
|
+
const assertionSources = {
|
|
12
|
+
RESPONSE_TIME: true,
|
|
13
|
+
HOP_COUNT: true,
|
|
14
|
+
PACKET_LOSS: true,
|
|
15
|
+
};
|
|
16
|
+
// Comparisons the backend accepts per source. RESPONSE_TIME additionally permits
|
|
17
|
+
// NOT_EQUALS; hop count and packet loss do not. Keep in sync with the backend.
|
|
18
|
+
const responseTimeComparisons = {
|
|
19
|
+
EQUALS: true,
|
|
20
|
+
NOT_EQUALS: true,
|
|
21
|
+
GREATER_THAN: true,
|
|
22
|
+
LESS_THAN: true,
|
|
23
|
+
};
|
|
24
|
+
const numericComparisons = {
|
|
25
|
+
EQUALS: true,
|
|
26
|
+
GREATER_THAN: true,
|
|
27
|
+
LESS_THAN: true,
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Reports traceroute assertions whose source, property or comparison the backend
|
|
31
|
+
* does not accept.
|
|
32
|
+
*
|
|
33
|
+
* Assertions written as plain object literals bypass TracerouteAssertionBuilder and
|
|
34
|
+
* are type-legal, because the fields are declared as plain strings. The backend
|
|
35
|
+
* rejects the invalid combinations with a 400, so they are caught here instead.
|
|
36
|
+
*/
|
|
37
|
+
export function validateTracerouteAssertion(diagnostics, assertion, index) {
|
|
38
|
+
const location = `request.assertions[${index}]`;
|
|
39
|
+
switch (assertion.source) {
|
|
40
|
+
case 'RESPONSE_TIME':
|
|
41
|
+
if (!Object.hasOwn(responseTimeProperties, assertion.property)) {
|
|
42
|
+
addAssertionDiagnostic(diagnostics, `The RESPONSE_TIME assertion at "${location}" has an invalid property `
|
|
43
|
+
+ `${assertion.property === '' ? '(none)' : `"${assertion.property}"`}. `
|
|
44
|
+
+ `Expected one of ${quotedKeys(responseTimeProperties)}.`);
|
|
45
|
+
}
|
|
46
|
+
validateComparison(diagnostics, assertion, location, responseTimeComparisons);
|
|
47
|
+
break;
|
|
48
|
+
case 'HOP_COUNT':
|
|
49
|
+
// falls through
|
|
50
|
+
case 'PACKET_LOSS':
|
|
51
|
+
if (assertion.property) {
|
|
52
|
+
addAssertionDiagnostic(diagnostics, `The ${assertion.source} assertion at "${location}" must not specify a property, `
|
|
53
|
+
+ `but got "${assertion.property}".`);
|
|
54
|
+
}
|
|
55
|
+
validateComparison(diagnostics, assertion, location, numericComparisons);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
addAssertionDiagnostic(diagnostics, `The assertion at "${location}" has an unknown source "${assertion.source}". `
|
|
59
|
+
+ `Expected one of ${quotedKeys(assertionSources)}.`);
|
|
60
|
+
// Check files are loaded without type checking, so an unrecognized source reaches
|
|
61
|
+
// this branch at runtime and is reported above. This additionally makes adding a
|
|
62
|
+
// member to TracerouteAssertionSource without a matching case a compile-time error.
|
|
63
|
+
assertion.source;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// The comparison the backend accepts depends on the source, so the allowed set is
|
|
68
|
+
// passed in; an unknown source is reported separately and skips this check because
|
|
69
|
+
// no set applies to it.
|
|
70
|
+
function validateComparison(diagnostics, assertion, location, allowed) {
|
|
71
|
+
if (!Object.hasOwn(allowed, assertion.comparison)) {
|
|
72
|
+
addAssertionDiagnostic(diagnostics, `The ${assertion.source} assertion at "${location}" has an unsupported comparison `
|
|
73
|
+
+ `${assertion.comparison === '' ? '(none)' : `"${assertion.comparison}"`}. `
|
|
74
|
+
+ `Expected one of ${quotedKeys(allowed)}.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=traceroute-assertion-validation.js.map
|