checkly 0.0.0-pr.686.4c0f5e3
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/README.md +43 -0
- package/bin/dev +17 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/constructs.d.ts +1 -0
- package/constructs.js +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +228 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/commands/authCommand.d.ts +5 -0
- package/dist/commands/authCommand.js +14 -0
- package/dist/commands/authCommand.js.map +1 -0
- package/dist/commands/baseCommand.d.ts +9 -0
- package/dist/commands/baseCommand.js +21 -0
- package/dist/commands/baseCommand.js.map +1 -0
- package/dist/commands/deploy.d.ts +13 -0
- package/dist/commands/deploy.js +171 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/destroy.d.ts +10 -0
- package/dist/commands/destroy.js +47 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/env/add.d.ts +13 -0
- package/dist/commands/env/add.js +54 -0
- package/dist/commands/env/add.js.map +1 -0
- package/dist/commands/env/ls.d.ts +6 -0
- package/dist/commands/env/ls.js +21 -0
- package/dist/commands/env/ls.js.map +1 -0
- package/dist/commands/env/pull.d.ts +12 -0
- package/dist/commands/env/pull.js +63 -0
- package/dist/commands/env/pull.js.map +1 -0
- package/dist/commands/env/rm.d.ts +12 -0
- package/dist/commands/env/rm.js +56 -0
- package/dist/commands/env/rm.js.map +1 -0
- package/dist/commands/env/update.d.ts +13 -0
- package/dist/commands/env/update.js +54 -0
- package/dist/commands/env/update.js.map +1 -0
- package/dist/commands/login.d.ts +13 -0
- package/dist/commands/login.js +129 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +9 -0
- package/dist/commands/logout.js +40 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/runtimes.d.ts +6 -0
- package/dist/commands/runtimes.js +26 -0
- package/dist/commands/runtimes.js.map +1 -0
- package/dist/commands/switch.d.ts +9 -0
- package/dist/commands/switch.js +59 -0
- package/dist/commands/switch.js.map +1 -0
- package/dist/commands/test.d.ts +36 -0
- package/dist/commands/test.js +237 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/trigger.d.ts +32 -0
- package/dist/commands/trigger.js +173 -0
- package/dist/commands/trigger.js.map +1 -0
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.js +16 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -0
- package/dist/constructs/alert-channel-subscription.d.ts +44 -0
- package/dist/constructs/alert-channel-subscription.js +39 -0
- package/dist/constructs/alert-channel-subscription.js.map +1 -0
- package/dist/constructs/alert-channel.d.ts +53 -0
- package/dist/constructs/alert-channel.js +55 -0
- package/dist/constructs/alert-channel.js.map +1 -0
- package/dist/constructs/api-check.d.ts +179 -0
- package/dist/constructs/api-check.js +248 -0
- package/dist/constructs/api-check.js.map +1 -0
- package/dist/constructs/browser-check.d.ts +59 -0
- package/dist/constructs/browser-check.js +102 -0
- package/dist/constructs/browser-check.js.map +1 -0
- package/dist/constructs/check-group.d.ts +116 -0
- package/dist/constructs/check-group.js +113 -0
- package/dist/constructs/check-group.js.map +1 -0
- package/dist/constructs/check.d.ts +111 -0
- package/dist/constructs/check.js +88 -0
- package/dist/constructs/check.js.map +1 -0
- package/dist/constructs/construct.d.ts +17 -0
- package/dist/constructs/construct.js +22 -0
- package/dist/constructs/construct.js.map +1 -0
- package/dist/constructs/email-alert-channel.d.ts +26 -0
- package/dist/constructs/email-alert-channel.js +37 -0
- package/dist/constructs/email-alert-channel.js.map +1 -0
- package/dist/constructs/environment-variable.d.ts +2 -0
- package/dist/constructs/environment-variable.js +3 -0
- package/dist/constructs/environment-variable.js.map +1 -0
- package/dist/constructs/frequency.d.ts +20 -0
- package/dist/constructs/frequency.js +26 -0
- package/dist/constructs/frequency.js.map +1 -0
- package/dist/constructs/http-header.d.ts +2 -0
- package/dist/constructs/http-header.js +3 -0
- package/dist/constructs/http-header.js.map +1 -0
- package/dist/constructs/index.d.ts +15 -0
- package/dist/constructs/index.js +32 -0
- package/dist/constructs/index.js.map +1 -0
- package/dist/constructs/key-value-pair.d.ts +5 -0
- package/dist/constructs/key-value-pair.js +3 -0
- package/dist/constructs/key-value-pair.js.map +1 -0
- package/dist/constructs/opsgenie-alert-channel.d.ts +45 -0
- package/dist/constructs/opsgenie-alert-channel.js +44 -0
- package/dist/constructs/opsgenie-alert-channel.js.map +1 -0
- package/dist/constructs/pagerduty-alert-channel.d.ts +39 -0
- package/dist/constructs/pagerduty-alert-channel.js +42 -0
- package/dist/constructs/pagerduty-alert-channel.js.map +1 -0
- package/dist/constructs/project.d.ts +57 -0
- package/dist/constructs/project.js +100 -0
- package/dist/constructs/project.js.map +1 -0
- package/dist/constructs/query-param.d.ts +2 -0
- package/dist/constructs/query-param.js +3 -0
- package/dist/constructs/query-param.js.map +1 -0
- package/dist/constructs/ref.d.ts +5 -0
- package/dist/constructs/ref.js +13 -0
- package/dist/constructs/ref.js.map +1 -0
- package/dist/constructs/slack-alert-channel.d.ts +26 -0
- package/dist/constructs/slack-alert-channel.js +40 -0
- package/dist/constructs/slack-alert-channel.js.map +1 -0
- package/dist/constructs/sms-alert-channel.d.ts +27 -0
- package/dist/constructs/sms-alert-channel.js +38 -0
- package/dist/constructs/sms-alert-channel.js.map +1 -0
- package/dist/constructs/validator-error.d.ts +2 -0
- package/dist/constructs/validator-error.js +7 -0
- package/dist/constructs/validator-error.js.map +1 -0
- package/dist/constructs/webhook-alert-channel.d.ts +59 -0
- package/dist/constructs/webhook-alert-channel.js +50 -0
- package/dist/constructs/webhook-alert-channel.js.map +1 -0
- package/dist/help/examples.d.ts +6 -0
- package/dist/help/examples.js +22 -0
- package/dist/help/examples.js.map +1 -0
- package/dist/help/help-extension.d.ts +4 -0
- package/dist/help/help-extension.js +41 -0
- package/dist/help/help-extension.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/common-messages.d.ts +5 -0
- package/dist/messages/common-messages.js +9 -0
- package/dist/messages/common-messages.js.map +1 -0
- package/dist/reporters/abstract-list.d.ts +35 -0
- package/dist/reporters/abstract-list.js +135 -0
- package/dist/reporters/abstract-list.js.map +1 -0
- package/dist/reporters/ci.d.ts +12 -0
- package/dist/reporters/ci.js +29 -0
- package/dist/reporters/ci.js.map +1 -0
- package/dist/reporters/dot.d.ts +12 -0
- package/dist/reporters/dot.js +28 -0
- package/dist/reporters/dot.js.map +1 -0
- package/dist/reporters/github.d.ts +34 -0
- package/dist/reporters/github.js +95 -0
- package/dist/reporters/github.js.map +1 -0
- package/dist/reporters/list.d.ts +14 -0
- package/dist/reporters/list.js +56 -0
- package/dist/reporters/list.js.map +1 -0
- package/dist/reporters/reporter.d.ts +15 -0
- package/dist/reporters/reporter.js +23 -0
- package/dist/reporters/reporter.js.map +1 -0
- package/dist/reporters/util.d.ts +15 -0
- package/dist/reporters/util.js +283 -0
- package/dist/reporters/util.js.map +1 -0
- package/dist/rest/accounts.d.ts +12 -0
- package/dist/rest/accounts.js +15 -0
- package/dist/rest/accounts.js.map +1 -0
- package/dist/rest/api.d.ts +27 -0
- package/dist/rest/api.js +90 -0
- package/dist/rest/api.js.map +1 -0
- package/dist/rest/assets.d.ts +13 -0
- package/dist/rest/assets.js +30 -0
- package/dist/rest/assets.js.map +1 -0
- package/dist/rest/environment-variables.d.ts +16 -0
- package/dist/rest/environment-variables.js +25 -0
- package/dist/rest/environment-variables.js.map +1 -0
- package/dist/rest/locations.d.ts +11 -0
- package/dist/rest/locations.js +12 -0
- package/dist/rest/locations.js.map +1 -0
- package/dist/rest/private-locations.d.ts +11 -0
- package/dist/rest/private-locations.js +12 -0
- package/dist/rest/private-locations.js.map +1 -0
- package/dist/rest/projects.d.ts +43 -0
- package/dist/rest/projects.js +24 -0
- package/dist/rest/projects.js.map +1 -0
- package/dist/rest/runtimes.d.ts +15 -0
- package/dist/rest/runtimes.js +15 -0
- package/dist/rest/runtimes.js.map +1 -0
- package/dist/rest/test-sessions.d.ts +57 -0
- package/dist/rest/test-sessions.js +21 -0
- package/dist/rest/test-sessions.js.map +1 -0
- package/dist/rest/users.d.ts +12 -0
- package/dist/rest/users.js +12 -0
- package/dist/rest/users.js.map +1 -0
- package/dist/services/abstract-check-runner.d.ts +55 -0
- package/dist/services/abstract-check-runner.js +154 -0
- package/dist/services/abstract-check-runner.js.map +1 -0
- package/dist/services/check-parser/collector.d.ts +33 -0
- package/dist/services/check-parser/collector.js +48 -0
- package/dist/services/check-parser/collector.js.map +1 -0
- package/dist/services/check-parser/errors.d.ts +8 -0
- package/dist/services/check-parser/errors.js +45 -0
- package/dist/services/check-parser/errors.js.map +1 -0
- package/dist/services/check-parser/parser.d.ts +39 -0
- package/dist/services/check-parser/parser.js +296 -0
- package/dist/services/check-parser/parser.js.map +1 -0
- package/dist/services/checkly-config-loader.d.ts +54 -0
- package/dist/services/checkly-config-loader.js +55 -0
- package/dist/services/checkly-config-loader.js.map +1 -0
- package/dist/services/config.d.ts +24 -0
- package/dist/services/config.js +75 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/project-parser.d.ts +19 -0
- package/dist/services/project-parser.js +87 -0
- package/dist/services/project-parser.js.map +1 -0
- package/dist/services/socket-client.d.ts +4 -0
- package/dist/services/socket-client.js +20 -0
- package/dist/services/socket-client.js.map +1 -0
- package/dist/services/test-filters.d.ts +2 -0
- package/dist/services/test-filters.js +16 -0
- package/dist/services/test-filters.js.map +1 -0
- package/dist/services/test-runner.d.ts +21 -0
- package/dist/services/test-runner.js +50 -0
- package/dist/services/test-runner.js.map +1 -0
- package/dist/services/trigger-runner.d.ts +26 -0
- package/dist/services/trigger-runner.js +47 -0
- package/dist/services/trigger-runner.js.map +1 -0
- package/dist/services/util.d.ts +30 -0
- package/dist/services/util.js +157 -0
- package/dist/services/util.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/oclif.manifest.json +527 -0
- package/package.json +174 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":";;AAAA,+CAAuC;AACvC,mCAAkC;AAClC,+CAA2C;AAE3C,MAAqB,MAAO,SAAQ,yBAAW;IAG7C,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAM,CAAC,YAAY,EAAE,CAAC,CAAA;QACvE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAC3C,IAAI,CAAC,GAAG,CAAC,iCAAiC,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;IAC7F,CAAC;;AAPH,yBAQC;AAPQ,aAAM,GAAG,KAAK,CAAA;AACd,kBAAW,GAAG,gDAAgD,CAAA"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChecklyConfig } from './services/checkly-config-loader';
|
|
2
|
+
/**
|
|
3
|
+
* Supported regions
|
|
4
|
+
*/
|
|
5
|
+
declare module './' {
|
|
6
|
+
interface Region {
|
|
7
|
+
'us-east-1': string;
|
|
8
|
+
'us-east-2': string;
|
|
9
|
+
'us-west-1': string;
|
|
10
|
+
'us-west-2': string;
|
|
11
|
+
'ca-central-1': string;
|
|
12
|
+
'sa-east-1': string;
|
|
13
|
+
'eu-west-1': string;
|
|
14
|
+
'eu-central-1': string;
|
|
15
|
+
'eu-west-2': string;
|
|
16
|
+
'eu-west-3': string;
|
|
17
|
+
'eu-north-1': string;
|
|
18
|
+
'eu-south-1': string;
|
|
19
|
+
'me-south-1': string;
|
|
20
|
+
'ap-southeast-1': string;
|
|
21
|
+
'ap-northeast-1': string;
|
|
22
|
+
'ap-east-1': string;
|
|
23
|
+
'ap-southeast-2': string;
|
|
24
|
+
'ap-southeast-3': string;
|
|
25
|
+
'ap-northeast-2': string;
|
|
26
|
+
'ap-northeast-3': string;
|
|
27
|
+
'ap-south-1': string;
|
|
28
|
+
'af-south-1': string;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export declare function defineConfig(config: ChecklyConfig): ChecklyConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAiCA,SAAgB,YAAY,CAAE,MAAqB;IACjD,OAAO,MAAM,CAAA;AACf,CAAC;AAFD,oCAEC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Ref } from './ref';
|
|
2
|
+
import { Construct } from './construct';
|
|
3
|
+
export interface AlertChannelSubscriptionProps {
|
|
4
|
+
alertChannelId: Ref;
|
|
5
|
+
/**
|
|
6
|
+
* You can either pass a checkId or a groupId, but not both.
|
|
7
|
+
*/
|
|
8
|
+
checkId?: Ref;
|
|
9
|
+
/**
|
|
10
|
+
* You can either pass a groupId or a checkId, but not both.
|
|
11
|
+
*/
|
|
12
|
+
groupId?: Ref;
|
|
13
|
+
/**
|
|
14
|
+
* Determines if the suscription active or not.
|
|
15
|
+
*/
|
|
16
|
+
activated: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates an Alert Channel Subscription
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
*
|
|
23
|
+
* This class make use of the Alert Channel Subscriptions endpoints.
|
|
24
|
+
*/
|
|
25
|
+
export declare class AlertChannelSubscription extends Construct {
|
|
26
|
+
alertChannelId: Ref;
|
|
27
|
+
checkId?: Ref;
|
|
28
|
+
groupId?: Ref;
|
|
29
|
+
activated: boolean;
|
|
30
|
+
static readonly __checklyType = "alert-channel-subscription";
|
|
31
|
+
/**
|
|
32
|
+
* Constructs the Alert Channel Syscription instance
|
|
33
|
+
*
|
|
34
|
+
* @param logicalId unique project-scoped resource name identification
|
|
35
|
+
* @param props alert channel subscription configuration properties
|
|
36
|
+
*/
|
|
37
|
+
constructor(logicalId: string, props: AlertChannelSubscriptionProps);
|
|
38
|
+
synthesize(): {
|
|
39
|
+
alertChannelId: Ref;
|
|
40
|
+
checkId: Ref | undefined;
|
|
41
|
+
groupId: Ref | undefined;
|
|
42
|
+
activated: boolean;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertChannelSubscription = void 0;
|
|
4
|
+
const construct_1 = require("./construct");
|
|
5
|
+
const project_1 = require("./project");
|
|
6
|
+
/**
|
|
7
|
+
* Creates an Alert Channel Subscription
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
*
|
|
11
|
+
* This class make use of the Alert Channel Subscriptions endpoints.
|
|
12
|
+
*/
|
|
13
|
+
class AlertChannelSubscription extends construct_1.Construct {
|
|
14
|
+
/**
|
|
15
|
+
* Constructs the Alert Channel Syscription instance
|
|
16
|
+
*
|
|
17
|
+
* @param logicalId unique project-scoped resource name identification
|
|
18
|
+
* @param props alert channel subscription configuration properties
|
|
19
|
+
*/
|
|
20
|
+
constructor(logicalId, props) {
|
|
21
|
+
super(AlertChannelSubscription.__checklyType, logicalId);
|
|
22
|
+
this.alertChannelId = props.alertChannelId;
|
|
23
|
+
this.checkId = props.checkId;
|
|
24
|
+
this.groupId = props.groupId;
|
|
25
|
+
this.activated = props.activated;
|
|
26
|
+
project_1.Session.registerConstruct(this);
|
|
27
|
+
}
|
|
28
|
+
synthesize() {
|
|
29
|
+
return {
|
|
30
|
+
alertChannelId: this.alertChannelId,
|
|
31
|
+
checkId: this.checkId,
|
|
32
|
+
groupId: this.groupId,
|
|
33
|
+
activated: this.activated,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AlertChannelSubscription = AlertChannelSubscription;
|
|
38
|
+
AlertChannelSubscription.__checklyType = 'alert-channel-subscription';
|
|
39
|
+
//# sourceMappingURL=alert-channel-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-channel-subscription.js","sourceRoot":"","sources":["../../src/constructs/alert-channel-subscription.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AACvC,uCAAmC;AAkBnC;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,qBAAS;IAQrD;;;;;OAKG;IACH,YAAa,SAAiB,EAAE,KAAoC;QAClE,KAAK,CAAC,wBAAwB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QACxD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAA;QAC1C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;QAChC,iBAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED,UAAU;QACR,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAA;IACH,CAAC;;AA9BH,4DA+BC;AAzBiB,sCAAa,GAAG,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Construct } from './construct';
|
|
2
|
+
export interface AlertChannelProps {
|
|
3
|
+
/**
|
|
4
|
+
* Determines if an alert should be send for check recoveries.
|
|
5
|
+
*/
|
|
6
|
+
sendRecovery?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Determines if an alert should be send for check failures.
|
|
9
|
+
*/
|
|
10
|
+
sendFailure?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Determines if an alert should be send when a check is degraded.
|
|
13
|
+
*/
|
|
14
|
+
sendDegraded?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Determines if an alert should be send for expiring SSL certificates.
|
|
17
|
+
*/
|
|
18
|
+
sslExpiry?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* At what moment in time to start alerting on SSL certificates.
|
|
21
|
+
*/
|
|
22
|
+
sslExpiryThreshold?: number;
|
|
23
|
+
}
|
|
24
|
+
declare class AlertChannelWrapper extends Construct {
|
|
25
|
+
constructor(logicalId: string, physicalId: string | number);
|
|
26
|
+
synthesize(): null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates an Alert Channels
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
*
|
|
33
|
+
* This class make use of the Alert Channels endpoints.
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class AlertChannel extends Construct {
|
|
36
|
+
sendRecovery?: boolean;
|
|
37
|
+
sendFailure?: boolean;
|
|
38
|
+
sendDegraded?: boolean;
|
|
39
|
+
sslExpiry?: boolean;
|
|
40
|
+
sslExpiryThreshold?: number;
|
|
41
|
+
static readonly __checklyType = "alert-channel";
|
|
42
|
+
/**
|
|
43
|
+
* Constructs the Alert Channel instance
|
|
44
|
+
*
|
|
45
|
+
* @param logicalId unique project-scoped resource name identification
|
|
46
|
+
* @param props alert channel configuration properties
|
|
47
|
+
*/
|
|
48
|
+
constructor(logicalId: string, props: AlertChannelProps);
|
|
49
|
+
static fromId(id: string | number): AlertChannelWrapper;
|
|
50
|
+
allowInChecklyConfig(): boolean;
|
|
51
|
+
synthesize(): any | null;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertChannel = void 0;
|
|
4
|
+
const construct_1 = require("./construct");
|
|
5
|
+
const project_1 = require("./project");
|
|
6
|
+
class AlertChannelWrapper extends construct_1.Construct {
|
|
7
|
+
constructor(logicalId, physicalId) {
|
|
8
|
+
super(AlertChannel.__checklyType, logicalId, physicalId, false);
|
|
9
|
+
project_1.Session.registerConstruct(this);
|
|
10
|
+
}
|
|
11
|
+
synthesize() {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates an Alert Channels
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
*
|
|
20
|
+
* This class make use of the Alert Channels endpoints.
|
|
21
|
+
*/
|
|
22
|
+
class AlertChannel extends construct_1.Construct {
|
|
23
|
+
/**
|
|
24
|
+
* Constructs the Alert Channel instance
|
|
25
|
+
*
|
|
26
|
+
* @param logicalId unique project-scoped resource name identification
|
|
27
|
+
* @param props alert channel configuration properties
|
|
28
|
+
*/
|
|
29
|
+
constructor(logicalId, props) {
|
|
30
|
+
super(AlertChannel.__checklyType, logicalId);
|
|
31
|
+
this.sendRecovery = props.sendRecovery;
|
|
32
|
+
this.sendFailure = props.sendFailure;
|
|
33
|
+
this.sendDegraded = props.sendDegraded;
|
|
34
|
+
this.sslExpiry = props.sslExpiry;
|
|
35
|
+
this.sslExpiryThreshold = props.sslExpiryThreshold;
|
|
36
|
+
}
|
|
37
|
+
static fromId(id) {
|
|
38
|
+
return new AlertChannelWrapper(`alert-channel-${id}`, id);
|
|
39
|
+
}
|
|
40
|
+
allowInChecklyConfig() {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
synthesize() {
|
|
44
|
+
return {
|
|
45
|
+
sendRecovery: this.sendRecovery,
|
|
46
|
+
sendFailure: this.sendFailure,
|
|
47
|
+
sendDegraded: this.sendDegraded,
|
|
48
|
+
sslExpiry: this.sslExpiry,
|
|
49
|
+
sslExpiryThreshold: this.sslExpiryThreshold,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.AlertChannel = AlertChannel;
|
|
54
|
+
AlertChannel.__checklyType = 'alert-channel';
|
|
55
|
+
//# sourceMappingURL=alert-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-channel.js","sourceRoot":"","sources":["../../src/constructs/alert-channel.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,uCAAmC;AAyBnC,MAAM,mBAAoB,SAAQ,qBAAS;IACzC,YAAa,SAAiB,EAAE,UAAyB;QACvD,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;QAC/D,iBAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAsB,YAAa,SAAQ,qBAAS;IASlD;;;;;OAKG;IACH,YAAa,SAAiB,EAAE,KAAwB;QACtD,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QAC5C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;QACtC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAA;QACpC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;QACtC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;QAChC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAAA;IACpD,CAAC;IAED,MAAM,CAAC,MAAM,CAAE,EAAiB;QAC9B,OAAO,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU;QACR,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAA;IACH,CAAC;;AAxCH,oCAyCC;AAlCiB,0BAAa,GAAG,eAAe,CAAA"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Check, CheckProps } from './check';
|
|
2
|
+
import { HttpHeader } from './http-header';
|
|
3
|
+
import { QueryParam } from './query-param';
|
|
4
|
+
import { Content, Entrypoint } from './construct';
|
|
5
|
+
declare enum AssertionSource {
|
|
6
|
+
STATUS_CODE = "STATUS_CODE",
|
|
7
|
+
JSON_BODY = "JSON_BODY",
|
|
8
|
+
HEADERS = "HEADERS",
|
|
9
|
+
TEXT_BODY = "TEXT_BODY",
|
|
10
|
+
RESPONSE_TIME = "RESPONSE_TIME"
|
|
11
|
+
}
|
|
12
|
+
export interface Assertion {
|
|
13
|
+
source: string;
|
|
14
|
+
property: string;
|
|
15
|
+
comparison: string;
|
|
16
|
+
target: string;
|
|
17
|
+
regex: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare class AssertionBuilder {
|
|
20
|
+
static statusCode(): NumericAssertionBuilder;
|
|
21
|
+
static jsonBody(property?: string): GeneralAssertionBuilder;
|
|
22
|
+
static headers(property?: string, regex?: string): GeneralAssertionBuilder;
|
|
23
|
+
static textBody(property?: string): GeneralAssertionBuilder;
|
|
24
|
+
static responseTme(): NumericAssertionBuilder;
|
|
25
|
+
}
|
|
26
|
+
declare class NumericAssertionBuilder {
|
|
27
|
+
source: AssertionSource;
|
|
28
|
+
constructor(source: AssertionSource);
|
|
29
|
+
equals(target: number): Assertion;
|
|
30
|
+
notEquals(target: number): Assertion;
|
|
31
|
+
lessThan(target: number): Assertion;
|
|
32
|
+
greaterThan(target: number): Assertion;
|
|
33
|
+
/** @private */
|
|
34
|
+
private _toAssertion;
|
|
35
|
+
}
|
|
36
|
+
declare class GeneralAssertionBuilder {
|
|
37
|
+
source: AssertionSource;
|
|
38
|
+
property?: string;
|
|
39
|
+
regex?: string;
|
|
40
|
+
constructor(source: AssertionSource, property?: string, regex?: string);
|
|
41
|
+
equals(target: string | number | boolean): Assertion;
|
|
42
|
+
notEquals(target: string | number | boolean): Assertion;
|
|
43
|
+
hasKey(target: string): Assertion;
|
|
44
|
+
notHasKey(target: string): Assertion;
|
|
45
|
+
hasValue(target: string | number | boolean): Assertion;
|
|
46
|
+
notHasValue(target: string | number | boolean): Assertion;
|
|
47
|
+
isEmpty(): Assertion;
|
|
48
|
+
notEmpty(): Assertion;
|
|
49
|
+
lessThan(target: string | number | boolean): Assertion;
|
|
50
|
+
greaterThan(target: string | number | boolean): Assertion;
|
|
51
|
+
contains(target: string): Assertion;
|
|
52
|
+
notContains(target: string): Assertion;
|
|
53
|
+
isNull(): Assertion;
|
|
54
|
+
isNotNull(): Assertion;
|
|
55
|
+
/** @private */
|
|
56
|
+
private _toAssertion;
|
|
57
|
+
}
|
|
58
|
+
export type BodyType = 'JSON' | 'FORM' | 'RAW' | 'GRAPHQL' | 'NONE';
|
|
59
|
+
export type HttpRequestMethod = 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'head' | 'HEAD' | 'delete' | 'DELETE' | 'options' | 'OPTIONS';
|
|
60
|
+
export interface BasicAuth {
|
|
61
|
+
username: string;
|
|
62
|
+
password: string;
|
|
63
|
+
}
|
|
64
|
+
export type ApiCheckDefaultConfig = {
|
|
65
|
+
url?: string;
|
|
66
|
+
headers?: Array<HttpHeader>;
|
|
67
|
+
queryParameters?: Array<QueryParam>;
|
|
68
|
+
basicAuth?: BasicAuth;
|
|
69
|
+
};
|
|
70
|
+
export interface Request {
|
|
71
|
+
url: string;
|
|
72
|
+
method: HttpRequestMethod;
|
|
73
|
+
followRedirects?: boolean;
|
|
74
|
+
skipSSL?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check the main Checkly documentation on assertions for specific values like regular expressions
|
|
77
|
+
* and JSON path descriptors you can use in the "property" field.
|
|
78
|
+
*/
|
|
79
|
+
assertions?: Array<Assertion>;
|
|
80
|
+
body?: string;
|
|
81
|
+
bodyType?: BodyType;
|
|
82
|
+
headers?: Array<HttpHeader>;
|
|
83
|
+
queryParameters?: Array<QueryParam>;
|
|
84
|
+
basicAuth?: BasicAuth;
|
|
85
|
+
}
|
|
86
|
+
export interface ScriptDependency {
|
|
87
|
+
path: string;
|
|
88
|
+
content: string;
|
|
89
|
+
}
|
|
90
|
+
export interface ApiCheckProps extends CheckProps {
|
|
91
|
+
/**
|
|
92
|
+
* Determines the request that the check is going to run.
|
|
93
|
+
*/
|
|
94
|
+
request: Request;
|
|
95
|
+
/**
|
|
96
|
+
* A valid piece of Node.js code to run in the setup phase.
|
|
97
|
+
* @deprecated use the "setupScript" property instead
|
|
98
|
+
*/
|
|
99
|
+
localSetupScript?: string;
|
|
100
|
+
/**
|
|
101
|
+
* A valid piece of Node.js code to run in the setup phase.
|
|
102
|
+
*/
|
|
103
|
+
setupScript?: Content | Entrypoint;
|
|
104
|
+
/**
|
|
105
|
+
* A valid piece of Node.js code to run in the teardown phase.
|
|
106
|
+
* @deprecated use the "tearDownScript" property instead
|
|
107
|
+
*/
|
|
108
|
+
localTearDownScript?: string;
|
|
109
|
+
/**
|
|
110
|
+
* A valid piece of Node.js code to run in the teardown phase.
|
|
111
|
+
*/
|
|
112
|
+
tearDownScript?: Content | Entrypoint;
|
|
113
|
+
/**
|
|
114
|
+
* The response time in milliseconds where a check should be considered degraded.
|
|
115
|
+
*/
|
|
116
|
+
degradedResponseTime?: number;
|
|
117
|
+
/**
|
|
118
|
+
* The response time in milliseconds where a check should be considered failing.
|
|
119
|
+
*/
|
|
120
|
+
maxResponseTime?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Creates an API Check
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
*
|
|
127
|
+
* This class make use of the API Checks endpoints.
|
|
128
|
+
*/
|
|
129
|
+
export declare class ApiCheck extends Check {
|
|
130
|
+
request: Request;
|
|
131
|
+
localSetupScript?: string;
|
|
132
|
+
localTearDownScript?: string;
|
|
133
|
+
degradedResponseTime?: number;
|
|
134
|
+
maxResponseTime?: number;
|
|
135
|
+
private readonly setupScriptDependencies?;
|
|
136
|
+
private readonly tearDownScriptDependencies?;
|
|
137
|
+
private readonly setupScriptPath?;
|
|
138
|
+
private readonly tearDownScriptPath?;
|
|
139
|
+
/**
|
|
140
|
+
* Constructs the API Check instance
|
|
141
|
+
*
|
|
142
|
+
* @param logicalId unique project-scoped resource name identification
|
|
143
|
+
* @param props check configuration properties
|
|
144
|
+
*
|
|
145
|
+
* {@link https://checklyhq.com/docs/cli/constructs/#apicheck Read more in the docs}
|
|
146
|
+
*/
|
|
147
|
+
constructor(logicalId: string, props: ApiCheckProps);
|
|
148
|
+
static bundle(entrypoint: string, runtimeId: string): {
|
|
149
|
+
script: string;
|
|
150
|
+
scriptPath: string;
|
|
151
|
+
dependencies: ScriptDependency[];
|
|
152
|
+
};
|
|
153
|
+
synthesize(): {
|
|
154
|
+
checkType: string;
|
|
155
|
+
request: Request;
|
|
156
|
+
localSetupScript: string | undefined;
|
|
157
|
+
setupScriptPath: string | undefined;
|
|
158
|
+
setupScriptDependencies: ScriptDependency[] | undefined;
|
|
159
|
+
localTearDownScript: string | undefined;
|
|
160
|
+
tearDownScriptPath: string | undefined;
|
|
161
|
+
tearDownScriptDependencies: ScriptDependency[] | undefined;
|
|
162
|
+
degradedResponseTime: number | undefined;
|
|
163
|
+
maxResponseTime: number | undefined;
|
|
164
|
+
name: string;
|
|
165
|
+
activated: boolean | undefined;
|
|
166
|
+
muted: boolean | undefined;
|
|
167
|
+
doubleCheck: boolean | undefined;
|
|
168
|
+
shouldFail: boolean | undefined;
|
|
169
|
+
runtimeId: string | undefined;
|
|
170
|
+
locations: (keyof import("..").Region)[] | undefined;
|
|
171
|
+
privateLocations: string[] | undefined;
|
|
172
|
+
tags: string[] | undefined;
|
|
173
|
+
frequency: number | undefined;
|
|
174
|
+
frequencyOffset: number | undefined;
|
|
175
|
+
groupId: import("./ref").Ref | undefined;
|
|
176
|
+
environmentVariables: import("./key-value-pair").default[] | undefined;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export {};
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiCheck = exports.AssertionBuilder = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const check_1 = require("./check");
|
|
6
|
+
const project_1 = require("./project");
|
|
7
|
+
const parser_1 = require("../services/check-parser/parser");
|
|
8
|
+
const util_1 = require("../services/util");
|
|
9
|
+
const util_2 = require("../reporters/util");
|
|
10
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
11
|
+
var AssertionSource;
|
|
12
|
+
(function (AssertionSource) {
|
|
13
|
+
AssertionSource["STATUS_CODE"] = "STATUS_CODE";
|
|
14
|
+
AssertionSource["JSON_BODY"] = "JSON_BODY";
|
|
15
|
+
AssertionSource["HEADERS"] = "HEADERS";
|
|
16
|
+
AssertionSource["TEXT_BODY"] = "TEXT_BODY";
|
|
17
|
+
AssertionSource["RESPONSE_TIME"] = "RESPONSE_TIME";
|
|
18
|
+
})(AssertionSource || (AssertionSource = {}));
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
var AssertionComparison;
|
|
21
|
+
(function (AssertionComparison) {
|
|
22
|
+
AssertionComparison["EQUALS"] = "EQUALS";
|
|
23
|
+
AssertionComparison["NOT_EQUALS"] = "NOT_EQUALS";
|
|
24
|
+
AssertionComparison["HAS_KEY"] = "HAS_KEY";
|
|
25
|
+
AssertionComparison["NOT_HAS_KEY"] = "NOT_HAS_KEY";
|
|
26
|
+
AssertionComparison["HAS_VALUE"] = "HAS_VALUE";
|
|
27
|
+
AssertionComparison["NOT_HAS_VALUE"] = "NOT_HAS_VALUE";
|
|
28
|
+
AssertionComparison["IS_EMPTY"] = "IS_EMPTY";
|
|
29
|
+
AssertionComparison["NOT_EMPTY"] = "NOT_EMPTY";
|
|
30
|
+
AssertionComparison["GREATER_THAN"] = "GREATER_THAN";
|
|
31
|
+
AssertionComparison["LESS_THAN"] = "LESS_THAN";
|
|
32
|
+
AssertionComparison["CONTAINS"] = "CONTAINS";
|
|
33
|
+
AssertionComparison["NOT_CONTAINS"] = "NOT_CONTAINS";
|
|
34
|
+
AssertionComparison["IS_NULL"] = "IS_NULL";
|
|
35
|
+
AssertionComparison["NOT_NULL"] = "NOT_NULL";
|
|
36
|
+
})(AssertionComparison || (AssertionComparison = {}));
|
|
37
|
+
class AssertionBuilder {
|
|
38
|
+
static statusCode() {
|
|
39
|
+
return new NumericAssertionBuilder(AssertionSource.STATUS_CODE);
|
|
40
|
+
}
|
|
41
|
+
static jsonBody(property) {
|
|
42
|
+
return new GeneralAssertionBuilder(AssertionSource.JSON_BODY, property);
|
|
43
|
+
}
|
|
44
|
+
static headers(property, regex) {
|
|
45
|
+
return new GeneralAssertionBuilder(AssertionSource.HEADERS, property, regex);
|
|
46
|
+
}
|
|
47
|
+
static textBody(property) {
|
|
48
|
+
return new GeneralAssertionBuilder(AssertionSource.TEXT_BODY, property);
|
|
49
|
+
}
|
|
50
|
+
static responseTme() {
|
|
51
|
+
return new NumericAssertionBuilder(AssertionSource.RESPONSE_TIME);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.AssertionBuilder = AssertionBuilder;
|
|
55
|
+
class NumericAssertionBuilder {
|
|
56
|
+
constructor(source) {
|
|
57
|
+
this.source = source;
|
|
58
|
+
}
|
|
59
|
+
equals(target) {
|
|
60
|
+
return this._toAssertion(AssertionComparison.EQUALS, target);
|
|
61
|
+
}
|
|
62
|
+
notEquals(target) {
|
|
63
|
+
return this._toAssertion(AssertionComparison.NOT_EQUALS, target);
|
|
64
|
+
}
|
|
65
|
+
lessThan(target) {
|
|
66
|
+
return this._toAssertion(AssertionComparison.LESS_THAN, target);
|
|
67
|
+
}
|
|
68
|
+
greaterThan(target) {
|
|
69
|
+
return this._toAssertion(AssertionComparison.GREATER_THAN, target);
|
|
70
|
+
}
|
|
71
|
+
/** @private */
|
|
72
|
+
_toAssertion(comparison, target) {
|
|
73
|
+
return { source: this.source, comparison, property: '', target: target.toString(), regex: null };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class GeneralAssertionBuilder {
|
|
77
|
+
constructor(source, property, regex) {
|
|
78
|
+
this.source = source;
|
|
79
|
+
this.property = property;
|
|
80
|
+
this.regex = regex;
|
|
81
|
+
}
|
|
82
|
+
equals(target) {
|
|
83
|
+
return this._toAssertion(AssertionComparison.EQUALS, target);
|
|
84
|
+
}
|
|
85
|
+
notEquals(target) {
|
|
86
|
+
return this._toAssertion(AssertionComparison.NOT_EQUALS, target);
|
|
87
|
+
}
|
|
88
|
+
hasKey(target) {
|
|
89
|
+
return this._toAssertion(AssertionComparison.HAS_KEY, target);
|
|
90
|
+
}
|
|
91
|
+
notHasKey(target) {
|
|
92
|
+
return this._toAssertion(AssertionComparison.NOT_HAS_KEY, target);
|
|
93
|
+
}
|
|
94
|
+
hasValue(target) {
|
|
95
|
+
return this._toAssertion(AssertionComparison.HAS_VALUE, target);
|
|
96
|
+
}
|
|
97
|
+
notHasValue(target) {
|
|
98
|
+
return this._toAssertion(AssertionComparison.NOT_HAS_VALUE, target);
|
|
99
|
+
}
|
|
100
|
+
isEmpty() {
|
|
101
|
+
return this._toAssertion(AssertionComparison.IS_EMPTY);
|
|
102
|
+
}
|
|
103
|
+
notEmpty() {
|
|
104
|
+
return this._toAssertion(AssertionComparison.NOT_EMPTY);
|
|
105
|
+
}
|
|
106
|
+
lessThan(target) {
|
|
107
|
+
return this._toAssertion(AssertionComparison.LESS_THAN, target);
|
|
108
|
+
}
|
|
109
|
+
greaterThan(target) {
|
|
110
|
+
return this._toAssertion(AssertionComparison.GREATER_THAN, target);
|
|
111
|
+
}
|
|
112
|
+
contains(target) {
|
|
113
|
+
return this._toAssertion(AssertionComparison.CONTAINS, target);
|
|
114
|
+
}
|
|
115
|
+
notContains(target) {
|
|
116
|
+
return this._toAssertion(AssertionComparison.CONTAINS, target);
|
|
117
|
+
}
|
|
118
|
+
isNull() {
|
|
119
|
+
return this._toAssertion(AssertionComparison.IS_NULL);
|
|
120
|
+
}
|
|
121
|
+
isNotNull() {
|
|
122
|
+
return this._toAssertion(AssertionComparison.NOT_NULL);
|
|
123
|
+
}
|
|
124
|
+
/** @private */
|
|
125
|
+
_toAssertion(comparison, target) {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
return {
|
|
128
|
+
source: this.source,
|
|
129
|
+
comparison,
|
|
130
|
+
property: (_a = this.property) !== null && _a !== void 0 ? _a : '',
|
|
131
|
+
target: (_b = target === null || target === void 0 ? void 0 : target.toString()) !== null && _b !== void 0 ? _b : '',
|
|
132
|
+
regex: (_c = this.regex) !== null && _c !== void 0 ? _c : null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function _printWarning(path) {
|
|
137
|
+
(0, util_2.printDeprecationWarning)(`API check "${path}" is probably providing a setup ` +
|
|
138
|
+
'or tearDown script using the "localSetupScript" or "localTearDownScript" property. Please update your API checks to ' +
|
|
139
|
+
'reference any setup / tearDown using the "setupScript" and "tearDownScript" properties See the docs at ' +
|
|
140
|
+
'https://checklyhq.com/docs/cli/constructs-reference#apicheck');
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Creates an API Check
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
*
|
|
147
|
+
* This class make use of the API Checks endpoints.
|
|
148
|
+
*/
|
|
149
|
+
class ApiCheck extends check_1.Check {
|
|
150
|
+
/**
|
|
151
|
+
* Constructs the API Check instance
|
|
152
|
+
*
|
|
153
|
+
* @param logicalId unique project-scoped resource name identification
|
|
154
|
+
* @param props check configuration properties
|
|
155
|
+
*
|
|
156
|
+
* {@link https://checklyhq.com/docs/cli/constructs/#apicheck Read more in the docs}
|
|
157
|
+
*/
|
|
158
|
+
constructor(logicalId, props) {
|
|
159
|
+
super(logicalId, props);
|
|
160
|
+
if (props.setupScript) {
|
|
161
|
+
if ('entrypoint' in props.setupScript) {
|
|
162
|
+
const { script, scriptPath, dependencies } = ApiCheck.bundle(props.setupScript.entrypoint, this.runtimeId);
|
|
163
|
+
this.localSetupScript = script;
|
|
164
|
+
this.setupScriptPath = scriptPath;
|
|
165
|
+
this.setupScriptDependencies = dependencies;
|
|
166
|
+
}
|
|
167
|
+
else if ('content' in props.setupScript) {
|
|
168
|
+
this.localSetupScript = props.setupScript.content;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw new Error('Unrecognized type for the "setupScript" property. A "setupScript" should have either a "content" ' +
|
|
172
|
+
'or "entrypoint" property.');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (props.localSetupScript) {
|
|
176
|
+
_printWarning(project_1.Session.checkFilePath);
|
|
177
|
+
this.localSetupScript = props.localSetupScript;
|
|
178
|
+
}
|
|
179
|
+
if (props.tearDownScript) {
|
|
180
|
+
if ('entrypoint' in props.tearDownScript) {
|
|
181
|
+
const { script, scriptPath, dependencies } = ApiCheck.bundle(props.tearDownScript.entrypoint, this.runtimeId);
|
|
182
|
+
this.localTearDownScript = script;
|
|
183
|
+
this.tearDownScriptPath = scriptPath;
|
|
184
|
+
this.tearDownScriptDependencies = dependencies;
|
|
185
|
+
}
|
|
186
|
+
else if ('content' in props.tearDownScript) {
|
|
187
|
+
this.localTearDownScript = props.tearDownScript.content;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (props.localTearDownScript) {
|
|
191
|
+
_printWarning(project_1.Session.checkFilePath);
|
|
192
|
+
this.localTearDownScript = props.localTearDownScript;
|
|
193
|
+
}
|
|
194
|
+
this.request = props.request;
|
|
195
|
+
this.degradedResponseTime = props.degradedResponseTime;
|
|
196
|
+
this.maxResponseTime = props.maxResponseTime;
|
|
197
|
+
project_1.Session.registerConstruct(this);
|
|
198
|
+
this.addSubscriptions();
|
|
199
|
+
}
|
|
200
|
+
static bundle(entrypoint, runtimeId) {
|
|
201
|
+
let absoluteEntrypoint = null;
|
|
202
|
+
if (path.isAbsolute(entrypoint)) {
|
|
203
|
+
absoluteEntrypoint = entrypoint;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
if (!project_1.Session.checkFileAbsolutePath) {
|
|
207
|
+
throw new Error('You cant use relative paths without the checkFileAbsolutePath in session');
|
|
208
|
+
}
|
|
209
|
+
absoluteEntrypoint = path.join(path.dirname(project_1.Session.checkFileAbsolutePath), entrypoint);
|
|
210
|
+
}
|
|
211
|
+
const runtime = project_1.Session.availableRuntimes[runtimeId];
|
|
212
|
+
if (!runtime) {
|
|
213
|
+
throw new Error(`${runtimeId} is not supported`);
|
|
214
|
+
}
|
|
215
|
+
const parser = new parser_1.Parser(Object.keys(runtime.dependencies));
|
|
216
|
+
const parsed = parser.parse(absoluteEntrypoint);
|
|
217
|
+
// Maybe we can get the parsed deps with the content immediately
|
|
218
|
+
const deps = [];
|
|
219
|
+
for (const { filePath, content } of parsed.dependencies) {
|
|
220
|
+
deps.push({
|
|
221
|
+
path: (0, util_1.pathToPosix)(path.relative(project_1.Session.basePath, filePath)),
|
|
222
|
+
content,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
script: parsed.entrypoint.content,
|
|
227
|
+
scriptPath: (0, util_1.pathToPosix)(path.relative(project_1.Session.basePath, parsed.entrypoint.filePath)),
|
|
228
|
+
dependencies: deps,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
synthesize() {
|
|
232
|
+
return {
|
|
233
|
+
...super.synthesize(),
|
|
234
|
+
checkType: 'API',
|
|
235
|
+
request: this.request,
|
|
236
|
+
localSetupScript: this.localSetupScript,
|
|
237
|
+
setupScriptPath: this.setupScriptPath,
|
|
238
|
+
setupScriptDependencies: this.setupScriptDependencies,
|
|
239
|
+
localTearDownScript: this.localTearDownScript,
|
|
240
|
+
tearDownScriptPath: this.tearDownScriptPath,
|
|
241
|
+
tearDownScriptDependencies: this.tearDownScriptDependencies,
|
|
242
|
+
degradedResponseTime: this.degradedResponseTime,
|
|
243
|
+
maxResponseTime: this.maxResponseTime,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.ApiCheck = ApiCheck;
|
|
248
|
+
//# sourceMappingURL=api-check.js.map
|