@selfchecks/selfchecks 0.1.1

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.
@@ -0,0 +1,124 @@
1
+ export type FrequencyValue = number;
2
+ export declare const Frequency: {
3
+ readonly EVERY_10M: 10;
4
+ readonly EVERY_12H: number;
5
+ readonly EVERY_15M: 15;
6
+ readonly EVERY_24H: number;
7
+ readonly EVERY_2H: number;
8
+ readonly EVERY_30M: 30;
9
+ readonly EVERY_3H: number;
10
+ readonly EVERY_6H: number;
11
+ };
12
+ export type Assertion = {
13
+ operator: "contains" | "equals" | "isEmpty" | "isNotNull";
14
+ source: string;
15
+ target?: unknown;
16
+ };
17
+ type AssertionChain = {
18
+ contains(value: unknown): Assertion;
19
+ equals(value: unknown): Assertion;
20
+ isEmpty(): Assertion;
21
+ isNotNull(): Assertion;
22
+ };
23
+ export declare const AssertionBuilder: {
24
+ jsonBody: (path: string) => AssertionChain;
25
+ statusCode: () => AssertionChain;
26
+ textBody: () => AssertionChain;
27
+ };
28
+ export type Request = {
29
+ assertions?: Assertion[];
30
+ body?: string;
31
+ followRedirects?: boolean;
32
+ headers?: Array<{
33
+ key: string;
34
+ value: string;
35
+ }> | Record<string, string>;
36
+ method: string;
37
+ skipSSL?: boolean;
38
+ url: string;
39
+ };
40
+ export type RetryStrategy = {
41
+ baseBackoffSeconds?: number;
42
+ maxDurationSeconds?: number;
43
+ maxRetries?: number;
44
+ onlyOn?: string[];
45
+ sameRegion?: boolean;
46
+ type: "EXPONENTIAL" | "FIXED" | "LINEAR" | "NO_RETRIES";
47
+ };
48
+ type RetryStrategyOptions = Omit<RetryStrategy, "type">;
49
+ export declare const RetryStrategyBuilder: {
50
+ exponentialStrategy: (options: RetryStrategyOptions) => RetryStrategy;
51
+ fixedStrategy: (options: RetryStrategyOptions) => RetryStrategy;
52
+ linearStrategy: (options: RetryStrategyOptions) => RetryStrategy;
53
+ noRetries: () => RetryStrategy;
54
+ };
55
+ type SharedCheckProps = {
56
+ activated?: boolean;
57
+ environmentVariables?: Array<{
58
+ key: string;
59
+ value: string;
60
+ }>;
61
+ frequency?: FrequencyValue;
62
+ group?: CheckGroup | CheckGroupV2;
63
+ muted?: boolean;
64
+ name?: string;
65
+ retryStrategy?: RetryStrategy;
66
+ runParallel?: boolean;
67
+ tags?: string[];
68
+ };
69
+ export type ApiCheckProps = SharedCheckProps & {
70
+ degradedResponseTime?: number;
71
+ maxResponseTime?: number;
72
+ request: Request;
73
+ };
74
+ export type BrowserCheckProps = SharedCheckProps & {
75
+ code: {
76
+ entrypoint: string;
77
+ };
78
+ shouldFail?: boolean;
79
+ };
80
+ export type CheckGroupV2Props = SharedCheckProps & {
81
+ alertChannels?: WebhookAlertChannel[];
82
+ alertEscalationPolicy?: AlertEscalationPolicy;
83
+ locations?: string[];
84
+ privateLocations?: string[];
85
+ };
86
+ declare class Construct<Props> {
87
+ readonly logicalId: string;
88
+ readonly props: Props;
89
+ constructor(logicalId: string, props: Props);
90
+ }
91
+ export declare class ApiCheck extends Construct<ApiCheckProps> {
92
+ }
93
+ export declare class BrowserCheck extends Construct<BrowserCheckProps> {
94
+ }
95
+ export declare class CheckGroup extends Construct<CheckGroupV2Props> {
96
+ }
97
+ export declare class CheckGroupV2 extends Construct<CheckGroupV2Props> {
98
+ }
99
+ export type AlertEscalationPolicy = {
100
+ amount: number;
101
+ interval: number;
102
+ runThreshold: number;
103
+ type: "RUN_BASED";
104
+ };
105
+ export declare const AlertEscalationBuilder: {
106
+ runBasedEscalation: (runThreshold: number, options: {
107
+ amount: number;
108
+ interval: number;
109
+ }) => AlertEscalationPolicy;
110
+ };
111
+ export type WebhookAlertChannelProps = {
112
+ method: string;
113
+ name: string;
114
+ sendDegraded?: boolean;
115
+ sendFailure?: boolean;
116
+ sendRecovery?: boolean;
117
+ sslExpiry?: boolean;
118
+ template?: string;
119
+ url: URL;
120
+ };
121
+ export declare class WebhookAlertChannel extends Construct<WebhookAlertChannelProps> {
122
+ }
123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 @@
1
+ export const Frequency = {
2
+ EVERY_10M: 10,
3
+ EVERY_12H: 12 * 60,
4
+ EVERY_15M: 15,
5
+ EVERY_24H: 24 * 60,
6
+ EVERY_2H: 2 * 60,
7
+ EVERY_30M: 30,
8
+ EVERY_3H: 3 * 60,
9
+ EVERY_6H: 6 * 60,
10
+ };
11
+ function assertionChain(source) {
12
+ return {
13
+ contains: (target) => ({ operator: "contains", source, target }),
14
+ equals: (target) => ({ operator: "equals", source, target }),
15
+ isEmpty: () => ({ operator: "isEmpty", source }),
16
+ isNotNull: () => ({ operator: "isNotNull", source }),
17
+ };
18
+ }
19
+ export const AssertionBuilder = {
20
+ jsonBody: (path) => assertionChain(`jsonBody:${path}`),
21
+ statusCode: () => assertionChain("statusCode"),
22
+ textBody: () => assertionChain("textBody"),
23
+ };
24
+ export const RetryStrategyBuilder = {
25
+ exponentialStrategy: (options) => ({
26
+ ...options,
27
+ type: "EXPONENTIAL",
28
+ }),
29
+ fixedStrategy: (options) => ({
30
+ ...options,
31
+ type: "FIXED",
32
+ }),
33
+ linearStrategy: (options) => ({
34
+ ...options,
35
+ type: "LINEAR",
36
+ }),
37
+ noRetries: () => ({ maxRetries: 0, type: "NO_RETRIES" }),
38
+ };
39
+ class Construct {
40
+ logicalId;
41
+ props;
42
+ constructor(logicalId, props) {
43
+ this.logicalId = logicalId;
44
+ this.props = props;
45
+ }
46
+ }
47
+ export class ApiCheck extends Construct {
48
+ }
49
+ export class BrowserCheck extends Construct {
50
+ }
51
+ export class CheckGroup extends Construct {
52
+ }
53
+ export class CheckGroupV2 extends Construct {
54
+ }
55
+ export const AlertEscalationBuilder = {
56
+ runBasedEscalation: (runThreshold, options) => ({
57
+ ...options,
58
+ runThreshold,
59
+ type: "RUN_BASED",
60
+ }),
61
+ };
62
+ export class WebhookAlertChannel extends Construct {
63
+ }
@@ -0,0 +1,10 @@
1
+ export type SelfchecksConfig = {
2
+ checks?: Record<string, unknown>;
3
+ cli?: Record<string, unknown>;
4
+ logicalId?: string;
5
+ projectName?: string;
6
+ repoUrl?: string;
7
+ [key: string]: unknown;
8
+ };
9
+ export declare function defineConfig<const T extends SelfchecksConfig>(config: T): T;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAE3E"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export function defineConfig(config) {
2
+ return config;
3
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@selfchecks/selfchecks",
3
+ "version": "0.1.1",
4
+ "description": "Checkly-compatible constructs supported by Selfchecks",
5
+ "type": "module",
6
+ "files": [
7
+ "dist/**/*.d.ts",
8
+ "dist/**/*.d.ts.map",
9
+ "dist/**/*.js"
10
+ ],
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./constructs": {
19
+ "types": "./dist/constructs.d.ts",
20
+ "import": "./dist/constructs.js"
21
+ }
22
+ },
23
+ "typesVersions": {
24
+ "*": {
25
+ "constructs": [
26
+ "dist/constructs.d.ts"
27
+ ]
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/selfchecks/selfchecks.git",
36
+ "directory": "packages/checkly-compat"
37
+ },
38
+ "engines": {
39
+ "node": ">=20.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.json",
43
+ "test": "vitest run --root ../.. packages/checkly-compat/src/index.test.ts",
44
+ "typecheck": "tsc -p tsconfig.json --noEmit"
45
+ },
46
+ "devDependencies": {
47
+ "typescript": "^5.8.3",
48
+ "vitest": "^3.2.4"
49
+ }
50
+ }