checkly 8.16.0 → 8.17.0-prerelease-b6e0d74

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.
Files changed (35) hide show
  1. package/dist/ai-context/context.js +4 -4
  2. package/dist/ai-context/skills-command/references/configure-ssl-monitors.md +4 -4
  3. package/dist/constructs/internal/assertion-codegen.d.ts +11 -2
  4. package/dist/constructs/internal/assertion-codegen.js +14 -17
  5. package/dist/constructs/internal/assertion-codegen.js.map +1 -1
  6. package/dist/constructs/internal/assertion-grammar.d.ts +35 -0
  7. package/dist/constructs/internal/assertion-grammar.js +75 -0
  8. package/dist/constructs/internal/assertion-grammar.js.map +1 -0
  9. package/dist/constructs/internal/assertion.js +2 -2
  10. package/dist/constructs/internal/assertion.js.map +1 -1
  11. package/dist/constructs/ssl-assertion-codegen.d.ts +2 -0
  12. package/dist/constructs/ssl-assertion-codegen.js +65 -27
  13. package/dist/constructs/ssl-assertion-codegen.js.map +1 -1
  14. package/dist/constructs/ssl-assertion-grammar.d.ts +123 -0
  15. package/dist/constructs/ssl-assertion-grammar.js +90 -0
  16. package/dist/constructs/ssl-assertion-grammar.js.map +1 -0
  17. package/dist/constructs/ssl-assertion-validation.d.ts +6 -6
  18. package/dist/constructs/ssl-assertion-validation.js +97 -28
  19. package/dist/constructs/ssl-assertion-validation.js.map +1 -1
  20. package/dist/constructs/ssl-assertion.d.ts +59 -114
  21. package/dist/constructs/ssl-assertion.js +59 -176
  22. package/dist/constructs/ssl-assertion.js.map +1 -1
  23. package/dist/constructs/traceroute-assertion-grammar.d.ts +33 -0
  24. package/dist/constructs/traceroute-assertion-grammar.js +33 -0
  25. package/dist/constructs/traceroute-assertion-grammar.js.map +1 -0
  26. package/dist/constructs/traceroute-assertion-validation.js +21 -27
  27. package/dist/constructs/traceroute-assertion-validation.js.map +1 -1
  28. package/dist/constructs/traceroute-assertion.d.ts +6 -25
  29. package/dist/constructs/traceroute-assertion.js +5 -51
  30. package/dist/constructs/traceroute-assertion.js.map +1 -1
  31. package/dist/reporters/abstract-list.d.ts +2 -0
  32. package/dist/reporters/abstract-list.js +29 -11
  33. package/dist/reporters/abstract-list.js.map +1 -1
  34. package/oclif.manifest.json +1 -1
  35. package/package.json +7 -7
@@ -273,10 +273,10 @@ new SslMonitor('example-com-ssl', {
273
273
  alertDaysBeforeExpiry: 30,
274
274
  },
275
275
  assertions: [
276
- SslAssertionBuilder.certExpiresInDays().greaterThan(30),
277
- SslAssertionBuilder.chainTrusted().equals(true),
278
- SslAssertionBuilder.hostnameVerified().equals(true),
279
- SslAssertionBuilder.tlsVersion().equals('TLS1.3'),
276
+ SslAssertionBuilder.certificate('daysUntilExpiry').greaterThan(30),
277
+ SslAssertionBuilder.connection('chainTrusted').equals(true),
278
+ SslAssertionBuilder.connection('hostnameVerified').equals(true),
279
+ SslAssertionBuilder.connection('tlsVersion').equals('TLS1.3'),
280
280
  ],
281
281
  },
282
282
  })
@@ -29,10 +29,10 @@ new SslMonitor('example-com-ssl', {
29
29
  alertDaysBeforeExpiry: 30,
30
30
  },
31
31
  assertions: [
32
- SslAssertionBuilder.certExpiresInDays().greaterThan(30),
33
- SslAssertionBuilder.chainTrusted().equals(true),
34
- SslAssertionBuilder.hostnameVerified().equals(true),
35
- SslAssertionBuilder.tlsVersion().equals('TLS1.3'),
32
+ SslAssertionBuilder.certificate('daysUntilExpiry').greaterThan(30),
33
+ SslAssertionBuilder.connection('chainTrusted').equals(true),
34
+ SslAssertionBuilder.connection('hostnameVerified').equals(true),
35
+ SslAssertionBuilder.connection('tlsVersion').equals('TLS1.3'),
36
36
  ],
37
37
  },
38
38
  })
@@ -11,12 +11,21 @@ import { Assertion } from './assertion.js';
11
11
  export declare function unsupportedAssertionSource(source: never, kind?: string): never;
12
12
  export interface ValueForNumericAssertionOptions {
13
13
  hasProperty?: boolean;
14
+ /**
15
+ * How to read the target as a number. Defaults to `parseInt`, which takes the leading
16
+ * numeric prefix — lenient by design, since wire targets may carry units ('5%').
17
+ * Callers that have already established the target is a full number can pass `Number`
18
+ * to keep fractions and avoid truncating '30.5' to 30.
19
+ */
20
+ parse?: (target: string) => number;
14
21
  }
15
22
  export declare function valueForNumericAssertion<Source extends string>(klass: string, method: string, assertion: Assertion<Source>, options?: ValueForNumericAssertionOptions): Value;
16
- export declare function valueForBooleanAssertion<Source extends string>(klass: string, method: string, assertion: Assertion<Source>): Value;
23
+ export interface ValueForBooleanAssertionOptions {
24
+ hasProperty?: boolean;
25
+ }
26
+ export declare function valueForBooleanAssertion<Source extends string>(klass: string, method: string, assertion: Assertion<Source>, options?: ValueForBooleanAssertionOptions): Value;
17
27
  export interface ValueForGeneralAssertionOptions {
18
28
  hasProperty?: boolean;
19
29
  hasRegex?: boolean;
20
- hasMatches?: boolean;
21
30
  }
22
31
  export declare function valueForGeneralAssertion<Source extends string>(klass: string, method: string, assertion: Assertion<Source>, options?: ValueForGeneralAssertionOptions): Value;
@@ -12,6 +12,7 @@ export function unsupportedAssertionSource(source, kind) {
12
12
  throw new Error(`${prefix} assertion source ${String(source)}`);
13
13
  }
14
14
  export function valueForNumericAssertion(klass, method, assertion, options) {
15
+ const parse = options?.parse ?? ((target) => parseInt(target, 10));
15
16
  return expr(ident(klass), builder => {
16
17
  builder.member(ident(method));
17
18
  builder.call(builder => {
@@ -24,25 +25,25 @@ export function valueForNumericAssertion(klass, method, assertion, options) {
24
25
  case 'EQUALS':
25
26
  builder.member(ident('equals'));
26
27
  builder.call(builder => {
27
- builder.number(parseInt(assertion.target, 10));
28
+ builder.number(parse(assertion.target));
28
29
  });
29
30
  break;
30
31
  case 'NOT_EQUALS':
31
32
  builder.member(ident('notEquals'));
32
33
  builder.call(builder => {
33
- builder.number(parseInt(assertion.target, 10));
34
+ builder.number(parse(assertion.target));
34
35
  });
35
36
  break;
36
37
  case 'LESS_THAN':
37
38
  builder.member(ident('lessThan'));
38
39
  builder.call(builder => {
39
- builder.number(parseInt(assertion.target, 10));
40
+ builder.number(parse(assertion.target));
40
41
  });
41
42
  break;
42
43
  case 'GREATER_THAN':
43
44
  builder.member(ident('greaterThan'));
44
45
  builder.call(builder => {
45
- builder.number(parseInt(assertion.target, 10));
46
+ builder.number(parse(assertion.target));
46
47
  });
47
48
  break;
48
49
  default:
@@ -50,12 +51,17 @@ export function valueForNumericAssertion(klass, method, assertion, options) {
50
51
  }
51
52
  });
52
53
  }
53
- // Emits an SSL boolean-source assertion: `Builder.method().equals(true|false)`.
54
- // The four boolean SSL sources only support EQUALS and carry no property/regex.
55
- export function valueForBooleanAssertion(klass, method, assertion) {
54
+ // Emits a boolean-target assertion: `Builder.method([property]).equals(true|false)`.
55
+ // Boolean targets only support EQUALS and carry no regex.
56
+ export function valueForBooleanAssertion(klass, method, assertion, options) {
56
57
  return expr(ident(klass), builder => {
57
58
  builder.member(ident(method));
58
- builder.call(() => { });
59
+ builder.call(builder => {
60
+ const hasProperty = options?.hasProperty ?? false;
61
+ if (hasProperty && assertion.property !== '') {
62
+ builder.string(assertion.property);
63
+ }
64
+ });
59
65
  switch (assertion.comparison) {
60
66
  case 'EQUALS':
61
67
  builder.member(ident('equals'));
@@ -166,15 +172,6 @@ export function valueForGeneralAssertion(klass, method, assertion, options) {
166
172
  builder.empty();
167
173
  });
168
174
  break;
169
- case 'MATCHES':
170
- if (!options?.hasMatches) {
171
- throw new Error(`Unsupported comparison ${assertion.comparison} for assertion source ${assertion.source}`);
172
- }
173
- builder.member(ident('matches'));
174
- builder.call(builder => {
175
- builder.string(assertion.target);
176
- });
177
- break;
178
175
  default:
179
176
  throw new Error(`Unsupported comparison ${assertion.comparison} for assertion source ${assertion.source}`);
180
177
  }
@@ -1 +1 @@
1
- {"version":3,"file":"assertion-codegen.js","sourceRoot":"","sources":["../../../src/constructs/internal/assertion-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAS,MAAM,0BAA0B,CAAA;AAG7D;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAE,MAAa,E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CAAC,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,SAAS;gBACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAC/B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,KAAK,EAAE,CAAA;gBACjB,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,UAAU;gBACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;gBAClC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,KAAK,EAAE,CAAA;gBACjB,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,SAAS;gBACZ,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;oBACzB,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,CAAC,UAAU,yBAAyB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;gBAC5G,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;gBAChC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;gBACF,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,CAAC,UAAU,yBAAyB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;QAC9G,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"assertion-codegen.js","sourceRoot":"","sources":["../../../src/constructs/internal/assertion-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAS,MAAM,0BAA0B,CAAA;AAG7D;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAE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C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,cAAc;gBACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;gBACpC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;gBAClC,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,SAAS;gBACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAC/B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,KAAK,EAAE,CAAA;gBACjB,CAAC,CAAC,CAAA;gBACF,MAAK;YACP,KAAK,UAAU;gBACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;gBAClC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;oBACrB,OAAO,CAAC,KAAK,EAAE,CAAA;gBACjB,CAAC,CAAC,CAAA;gBACF,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,CAAC,UAAU,yBAAyB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;QAC9G,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Assertion } from './assertion.js';
2
+ export declare const operatorComparisons: {
3
+ readonly equals: "EQUALS";
4
+ readonly notEquals: "NOT_EQUALS";
5
+ readonly greaterThan: "GREATER_THAN";
6
+ readonly lessThan: "LESS_THAN";
7
+ readonly contains: "CONTAINS";
8
+ readonly notContains: "NOT_CONTAINS";
9
+ };
10
+ export type OperatorName = keyof typeof operatorComparisons;
11
+ export type TargetValueType = 'number' | 'boolean' | 'string';
12
+ declare const targetType: unique symbol;
13
+ export interface AnyTargetSpec {
14
+ readonly kind: TargetValueType;
15
+ }
16
+ export interface TargetSpec<T extends string | number | boolean> extends AnyTargetSpec {
17
+ readonly [targetType]?: T;
18
+ }
19
+ export declare function numberTarget(): TargetSpec<number>;
20
+ export declare function booleanTarget(): TargetSpec<boolean>;
21
+ export declare function stringTarget<T extends string = string>(): TargetSpec<T>;
22
+ export interface PropertyGrammar {
23
+ readonly operators: readonly OperatorName[];
24
+ readonly target: AnyTargetSpec;
25
+ }
26
+ export declare function defineGrammar<const G extends Record<string, PropertyGrammar>>(grammar: G): G;
27
+ type TargetOf<Spec> = Spec extends TargetSpec<infer T> ? T : never;
28
+ export type PropertyOperators<Source extends string, Decl extends PropertyGrammar> = Decl extends PropertyGrammar ? {
29
+ [Op in Decl['operators'][number]]: (target: TargetOf<Decl['target']>) => Assertion<Source>;
30
+ } : never;
31
+ export declare function operatorsForProperty<Source extends string, Grammar extends Record<string, PropertyGrammar>, Property extends keyof Grammar & string>(grammar: Grammar, source: Source, property: Property): PropertyOperators<Source, Grammar[Property]>;
32
+ export declare function operatorsForSource<Source extends string, Decl extends PropertyGrammar>(source: Source, decl: Decl): PropertyOperators<Source, Decl>;
33
+ export declare function comparisonsForGrammar(decl: PropertyGrammar): Record<string, true>;
34
+ export declare function valueTypeForGrammar(decl: PropertyGrammar): TargetValueType;
35
+ export {};
@@ -0,0 +1,75 @@
1
+ import { GeneralAssertionBuilder, toAssertion } from './assertion.js';
2
+ // A property-scoped assertion grammar: one declaration per property states the operators
3
+ // it exposes and the type of its target. The builder surface, the validation whitelist,
4
+ // and codegen's literal kind are all derived from it, so a property's grammar lives in one
5
+ // place instead of being restated in a builder class, a value-type table, and a whitelist.
6
+ //
7
+ // This module is monitor-agnostic; each monitor supplies its own grammar tables.
8
+ // The operator catalog: builder method name -> wire comparison. Shared by every monitor
9
+ // grammar; adding an operator is one line here plus listing it on the properties that
10
+ // accept it.
11
+ export const operatorComparisons = {
12
+ equals: 'EQUALS',
13
+ notEquals: 'NOT_EQUALS',
14
+ greaterThan: 'GREATER_THAN',
15
+ lessThan: 'LESS_THAN',
16
+ contains: 'CONTAINS',
17
+ notContains: 'NOT_CONTAINS',
18
+ };
19
+ export function numberTarget() {
20
+ return { kind: 'number' };
21
+ }
22
+ export function booleanTarget() {
23
+ return { kind: 'boolean' };
24
+ }
25
+ export function stringTarget() {
26
+ return { kind: 'string' };
27
+ }
28
+ // `const G` keeps each row's operator array a literal tuple without callers writing
29
+ // `as const`, so `keyof typeof grammar` and the per-property operator sets stay precise.
30
+ export function defineGrammar(grammar) {
31
+ return grammar;
32
+ }
33
+ // Builds the operator object for a known property by looping over its declared operators.
34
+ // The cast is the one unavoidable bridge in the design: TypeScript cannot connect a runtime
35
+ // loop to a mapped type. It is sound because the loop defines exactly the keys in
36
+ // `decl.operators`, each routed through `operatorComparisons` — the same data
37
+ // `PropertyOperators` is computed from.
38
+ function makeOperators(source, property, decl) {
39
+ const operators = {};
40
+ for (const operator of decl.operators) {
41
+ operators[operator] = target => toAssertion(source, operatorComparisons[operator], target, property);
42
+ }
43
+ return operators;
44
+ }
45
+ // Resolves the operators for a property of a grammar.
46
+ //
47
+ // The typed signature makes an unknown property a compile error, but plain JavaScript
48
+ // callers and object-literal assertions still reach this at runtime with an arbitrary
49
+ // string. Those fall back to an unconstrained builder so the call returns something usable;
50
+ // the property is then reported by the monitor's validation at deploy time rather than
51
+ // throwing here.
52
+ export function operatorsForProperty(grammar, source, property) {
53
+ if (!Object.hasOwn(grammar, property)) {
54
+ const fallback = new GeneralAssertionBuilder(source, property);
55
+ return fallback;
56
+ }
57
+ return makeOperators(source, property, grammar[property]);
58
+ }
59
+ // Resolves the operators for a source-scoped grammar — a single declaration with no
60
+ // property, for sources whose value is the source itself (e.g. traceroute HOP_COUNT). The
61
+ // property slot is emitted empty, matching the wire shape those sources carry.
62
+ export function operatorsForSource(source, decl) {
63
+ return makeOperators(source, '', decl);
64
+ }
65
+ // Runtime derivations shared by validation and codegen, so both read the same grammar the
66
+ // builder is generated from.
67
+ // The wire comparisons a property accepts, from its declared operators.
68
+ export function comparisonsForGrammar(decl) {
69
+ return Object.fromEntries(decl.operators.map(operator => [operatorComparisons[operator], true]));
70
+ }
71
+ // How a property's target is written on the wire.
72
+ export function valueTypeForGrammar(decl) {
73
+ return decl.target.kind;
74
+ }
75
+ //# sourceMappingURL=assertion-grammar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertion-grammar.js","sourceRoot":"","sources":["../../../src/constructs/internal/assertion-grammar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEhF,yFAAyF;AACzF,wFAAwF;AACxF,2FAA2F;AAC3F,2FAA2F;AAC3F,EAAE;AACF,iFAAiF;AAEjF,wFAAwF;AACxF,sFAAsF;AACtF,aAAa;AACb,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,YAAY;IACvB,WAAW,EAAE,cAAc;IAC3B,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,cAAc;CACnB,CAAA;AA2BV,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAC3B,CAAC;AAOD,oFAAoF;AACpF,yFAAyF;AACzF,MAAM,UAAU,aAAa,CAAmD,OAAU;IACxF,OAAO,OAAO,CAAA;AAChB,CAAC;AAYD,0FAA0F;AAC1F,4FAA4F;AAC5F,kFAAkF;AAClF,8EAA8E;AAC9E,wCAAwC;AACxC,SAAS,aAAa,CAC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AAkD;AAClD,MAAM,UAAU,mBAAmB,CAAE,IAAqB;IACxD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;AACzB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // Builds an assertion payload from its parts. `comparison` is a free type parameter
2
- // so any operator string (including SSL's `MATCHES`) is accepted without a central
3
- // union. Empty property, stringified target, and null regex are the wire defaults.
2
+ // so any operator string is accepted without a central union. Empty property,
3
+ // stringified target, and null regex are the wire defaults.
4
4
  export function toAssertion(source, comparison, target, property, regex) {
5
5
  return {
6
6
  source,
@@ -1 +1 @@
1
- {"version":3,"file":"assertion.js","sourceRoot":"","sources":["../../../src/constructs/internal/assertion.ts"],"names":[],"mappings":"AAQA,oFAAoF;AACpF,mFAAmF;AACnF,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAKzB,MAAc,EACd,UAAsB,EACtB,MAAe,EACf,QAAiB,EACjB,KAAqB;IAErB,OAAO;QACL,MAAM;QACN,UAAU;QACV,QAAQ,EAAE,QAAQ,IAAI,EAAE;QACxB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAChC,KAAK,EAAE,KAAK,IAAI,IAAI;KACrB,CAAA;AACH,CAAC;AAED,MAAM,OAAO,uBAAuB;IAClC,MAAM,CAAQ;IACd,QAAQ,CAAW;IAEnB,YAAa,MAAc,EAAE,QAAmB;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,MAAM,CAAE,MAAc;QACpB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC;IAED,SAAS,CAAE,MAAc;QACvB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtE,CAAC;IA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AI,CAAC,KAAK,CAAC,CAAA;IACpF,CAAC;IAED,MAAM;QACJ,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAClF,CAAC;IAED,SAAS;QACP,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACnF,CAAC;CACF"}
@@ -1,3 +1,5 @@
1
1
  import { GeneratedFile, Value } from '../sourcegen/index.js';
2
2
  import { SslAssertion } from './ssl-assertion.js';
3
+ export declare const numericComparisons: Record<string, true>;
4
+ export declare const booleanComparisons: Record<string, true>;
3
5
  export declare function valueForSslAssertion(genfile: GeneratedFile, assertion: SslAssertion): Value;
@@ -1,34 +1,72 @@
1
1
  import { unsupportedAssertionSource, valueForBooleanAssertion, valueForGeneralAssertion, valueForNumericAssertion, } from './internal/assertion-codegen.js';
2
- const generalNoArgs = { hasProperty: false, hasRegex: false };
3
- // The string sources additionally accept the MATCHES (regex) operator.
4
- const generalWithMatches = { hasProperty: false, hasRegex: false, hasMatches: true };
2
+ import { isSslNumericTarget, sslPropertyValueType } from './ssl-assertion-grammar.js';
3
+ // Every SSL source addresses its value through the property slot — CERTIFICATE /
4
+ // CONNECTION use a field selector, JSON_RESPONSE a JSONPath, and TEXT_RESPONSE a
5
+ // regex (the backend and runner read the TEXT_RESPONSE pattern from `property`,
6
+ // not `regex`). The regex slot is never emitted.
7
+ const withProperty = { hasProperty: true, hasRegex: false };
8
+ // The comparisons each typed helper can render. A comparison outside the set makes the
9
+ // helper throw, which would abort the whole import over a single assertion, so the
10
+ // dispatch below checks membership rather than relying on the throw. Exported so the
11
+ // grammar consistency spec can assert numeric properties declare only operators this
12
+ // renders, rather than restating the set.
13
+ export const numericComparisons = {
14
+ EQUALS: true, NOT_EQUALS: true, GREATER_THAN: true, LESS_THAN: true,
15
+ };
16
+ // The boolean helper renders only EQUALS as a bare boolean literal; any other comparison
17
+ // falls through to the quoted-string form, which would not compile against a boolean
18
+ // operator. The grammar spec asserts boolean properties declare only this.
19
+ export const booleanComparisons = {
20
+ EQUALS: true,
21
+ };
22
+ // The operators for a numeric or boolean property take a `number` / `boolean`, so their
23
+ // targets must be emitted as bare literals rather than quoted strings — otherwise the
24
+ // generated code does not compile.
25
+ //
26
+ // Each typed path is guarded on the assertion actually fitting it, because remote data is
27
+ // not bound by the builder's types: the backend accepts any target string, so a monitor
28
+ // created via the UI or API can carry `selfSigned = 'yes'` or `keySizeBits = ''`. Coercing
29
+ // those would silently rewrite the assertion on the next deploy ('yes' would become
30
+ // `false`), so they fall through to the string form, which round-trips the value untouched
31
+ // and is reported by validateSslAssertion instead.
32
+ function valueForPropertyScopedAssertion(method, assertion) {
33
+ const valueType = sslPropertyValueType(assertion.source, assertion.property);
34
+ // Rendered with Number, not the helper's default parseInt: isSslNumericTarget has
35
+ // already established the whole target is a number, and parseInt would truncate '30.5'
36
+ // to 30 — a silently different assertion on the next deploy. Sharing the predicate with
37
+ // validateSslAssertion is what keeps the two honest: every target validation accepts is
38
+ // rendered as a numeric literal the property's operators take, so no assertion the CLI
39
+ // calls valid is emitted as code that does not compile.
40
+ const isRenderableNumber = valueType === 'number'
41
+ && Object.hasOwn(numericComparisons, assertion.comparison)
42
+ && isSslNumericTarget(assertion.target);
43
+ if (isRenderableNumber) {
44
+ return valueForNumericAssertion('SslAssertionBuilder', method, assertion, {
45
+ hasProperty: true,
46
+ parse: Number,
47
+ });
48
+ }
49
+ const isRenderableBoolean = valueType === 'boolean'
50
+ && Object.hasOwn(booleanComparisons, assertion.comparison)
51
+ && (assertion.target === 'true' || assertion.target === 'false');
52
+ if (isRenderableBoolean) {
53
+ return valueForBooleanAssertion('SslAssertionBuilder', method, assertion, { hasProperty: true });
54
+ }
55
+ return valueForGeneralAssertion('SslAssertionBuilder', method, assertion, withProperty);
56
+ }
5
57
  export function valueForSslAssertion(genfile, assertion) {
6
58
  genfile.namedImport('SslAssertionBuilder', 'checkly/constructs');
7
59
  switch (assertion.source) {
8
- case 'CERT_EXPIRES_IN_DAYS':
9
- return valueForNumericAssertion('SslAssertionBuilder', 'certExpiresInDays', assertion);
10
- case 'KEY_SIZE_BITS':
11
- return valueForNumericAssertion('SslAssertionBuilder', 'keySizeBits', assertion);
12
- case 'CERT_NOT_EXPIRED':
13
- return valueForBooleanAssertion('SslAssertionBuilder', 'certNotExpired', assertion);
14
- case 'HOSTNAME_VERIFIED':
15
- return valueForBooleanAssertion('SslAssertionBuilder', 'hostnameVerified', assertion);
16
- case 'CHAIN_TRUSTED':
17
- return valueForBooleanAssertion('SslAssertionBuilder', 'chainTrusted', assertion);
18
- case 'OCSP_STAPLED':
19
- return valueForBooleanAssertion('SslAssertionBuilder', 'ocspStapled', assertion);
20
- case 'TLS_VERSION':
21
- return valueForGeneralAssertion('SslAssertionBuilder', 'tlsVersion', assertion, generalNoArgs);
22
- case 'CIPHER_SUITE':
23
- return valueForGeneralAssertion('SslAssertionBuilder', 'cipherSuite', assertion, generalWithMatches);
24
- case 'ISSUER_CN':
25
- return valueForGeneralAssertion('SslAssertionBuilder', 'issuerCn', assertion, generalWithMatches);
26
- case 'CERT_FINGERPRINT_SHA256':
27
- return valueForGeneralAssertion('SslAssertionBuilder', 'certFingerprintSha256', assertion, generalNoArgs);
28
- case 'ISSUER_FINGERPRINT_SHA256':
29
- return valueForGeneralAssertion('SslAssertionBuilder', 'issuerFingerprintSha256', assertion, generalNoArgs);
30
- case 'SIGNATURE_ALGORITHM':
31
- return valueForGeneralAssertion('SslAssertionBuilder', 'signatureAlgorithm', assertion, generalWithMatches);
60
+ case 'CERTIFICATE':
61
+ return valueForPropertyScopedAssertion('certificate', assertion);
62
+ case 'CONNECTION':
63
+ return valueForPropertyScopedAssertion('connection', assertion);
64
+ case 'JSON_RESPONSE':
65
+ return valueForGeneralAssertion('SslAssertionBuilder', 'jsonResponse', assertion, withProperty);
66
+ case 'TEXT_RESPONSE':
67
+ return valueForGeneralAssertion('SslAssertionBuilder', 'textResponse', assertion, withProperty);
68
+ case 'RESPONSE_TIME':
69
+ return valueForNumericAssertion('SslAssertionBuilder', 'responseTime', assertion);
32
70
  default:
33
71
  return unsupportedAssertionSource(assertion.source, 'SSL');
34
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ssl-assertion-codegen.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion-codegen.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,iCAAiC,CAAA;AAGxC,MAAM,aAAa,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC7D,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;AAEpF,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,sBAAsB;YACzB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAA;QACxF,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;QAClF,KAAK,kBAAkB;YACrB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAA;QACrF,KAAK,mBAAmB;YACtB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAA;QACvF,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAA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AM,IAAI,SAAS,CAAC,MAAM,KAAK,OAAO,CAAC,CAAA;IAClE,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAClG,CAAC;IAED,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;AACzF,CAAC;AAED,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,aAAa;YAChB,OAAO,+BAA+B,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QAClE,KAAK,YAAY;YACf,OAAO,+BAA+B,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;QACjE,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;QACjG,KAAK,eAAe;YAClB,OAAO,wBAAwB,CAAC,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;QACjG,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,CAAC"}
@@ -0,0 +1,123 @@
1
+ import { TargetValueType } from './internal/assertion-grammar.js';
2
+ import type { SignatureAlgorithmValue, TlsVersionValue } from './ssl-assertion.js';
3
+ export declare const certificateGrammar: {
4
+ /** Days until the certificate expires (numeric). */
5
+ readonly daysUntilExpiry: {
6
+ readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
7
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
8
+ };
9
+ /** Certificate key size in bits (numeric). */
10
+ readonly keySizeBits: {
11
+ readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
12
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
13
+ };
14
+ /** Certificate subject common name (free-form string). */
15
+ readonly subjectCN: {
16
+ readonly operators: readonly ["equals", "notEquals", "contains", "notContains"];
17
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
18
+ };
19
+ /** Certificate issuer common name (free-form string). */
20
+ readonly issuerCN: {
21
+ readonly operators: readonly ["equals", "notEquals", "contains", "notContains"];
22
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
23
+ };
24
+ /** Certificate serial number — an opaque identifier, compared whole. */
25
+ readonly serialNumber: {
26
+ readonly operators: readonly ["equals", "notEquals"];
27
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
28
+ };
29
+ /** Certificate SHA-256 fingerprint — an opaque identifier, compared whole. */
30
+ readonly fingerprintSha256: {
31
+ readonly operators: readonly ["equals", "notEquals"];
32
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
33
+ };
34
+ /** Issuer SHA-256 fingerprint — an opaque identifier, compared whole. */
35
+ readonly issuerFingerprintSha256: {
36
+ readonly operators: readonly ["equals", "notEquals"];
37
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
38
+ };
39
+ /** Certificate public key algorithm (e.g. `'RSA'`, `'ECDSA'`), compared whole. */
40
+ readonly keyAlgorithm: {
41
+ readonly operators: readonly ["equals", "notEquals"];
42
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
43
+ };
44
+ /** Certificate signature algorithm — a Go `x509 SignatureAlgorithm.String()` value. */
45
+ readonly signatureAlgorithm: {
46
+ readonly operators: readonly ["equals", "notEquals"];
47
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<SignatureAlgorithmValue>;
48
+ };
49
+ /** Certificate subject alternative names. A list, so only membership can be asserted. */
50
+ readonly sans: {
51
+ readonly operators: readonly ["contains", "notContains"];
52
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
53
+ };
54
+ /** Whether the certificate is self-signed (boolean). */
55
+ readonly selfSigned: {
56
+ readonly operators: readonly ["equals"];
57
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<boolean>;
58
+ };
59
+ /** Whether the certificate is a CA certificate (boolean). */
60
+ readonly isCA: {
61
+ readonly operators: readonly ["equals"];
62
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<boolean>;
63
+ };
64
+ };
65
+ export declare const connectionGrammar: {
66
+ /** Negotiated TLS version. Ordered, so `greaterThan` expresses a minimum. */
67
+ readonly tlsVersion: {
68
+ readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
69
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<TlsVersionValue>;
70
+ };
71
+ /** Negotiated cipher suite (free-form string; hundreds of IANA names). */
72
+ readonly cipherSuite: {
73
+ readonly operators: readonly ["equals", "notEquals", "contains", "notContains"];
74
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
75
+ };
76
+ /** Whether the hostname is verified against the certificate (boolean). */
77
+ readonly hostnameVerified: {
78
+ readonly operators: readonly ["equals"];
79
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<boolean>;
80
+ };
81
+ /** Whether the certificate chain is trusted (boolean). */
82
+ readonly chainTrusted: {
83
+ readonly operators: readonly ["equals"];
84
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<boolean>;
85
+ };
86
+ /** Whether a stapled OCSP response was provided during the handshake (boolean). */
87
+ readonly ocspStapled: {
88
+ readonly operators: readonly ["equals"];
89
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<boolean>;
90
+ };
91
+ /** OCSP revocation status (e.g. `'good'`, `'revoked'`), compared whole. */
92
+ readonly ocspStatus: {
93
+ readonly operators: readonly ["equals", "notEquals"];
94
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
95
+ };
96
+ /** The IP address the hostname resolved to (free-form string). */
97
+ readonly resolvedIp: {
98
+ readonly operators: readonly ["equals", "notEquals", "contains", "notContains"];
99
+ readonly target: import("./internal/assertion-grammar.js").TargetSpec<string>;
100
+ };
101
+ };
102
+ /**
103
+ * The wire comparisons each property of a source accepts, keyed by property name. Empty for
104
+ * a source with no property-scoped grammar. Used by validation to reject an unsupported
105
+ * comparison written as an object literal.
106
+ */
107
+ export declare function sslComparisonsForSource(source: string): Record<string, Record<string, true>>;
108
+ /**
109
+ * How the target of a property-scoped SSL assertion is written, or `undefined` for a
110
+ * property the backend does not define. Callers must handle the unknown case: object
111
+ * literals bypass the builder's compile-time check and are reported by
112
+ * `validateSslAssertion` instead.
113
+ */
114
+ export declare function sslPropertyValueType(source: string, property: string): TargetValueType | undefined;
115
+ /**
116
+ * Whether a target is one this CLI treats as a number.
117
+ *
118
+ * Validation and codegen must agree: anything validation accepts, codegen has to render as
119
+ * a bare numeric literal, because the property's operators take a `number` and a quoted
120
+ * target would not compile. Targets are plain strings on the wire and reach here from object
121
+ * literals and remote monitors, so this is a runtime predicate rather than a type.
122
+ */
123
+ export declare function isSslNumericTarget(target: string): boolean;