@abyss-project/monitor 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const http_1 = require("http");
4
+ const index_1 = require("../index");
5
+ describe('APPLICATION_SENTINEL_HEADER_MASK', () => {
6
+ it('is exported from the package root barrel', () => {
7
+ expect(typeof index_1.APPLICATION_SENTINEL_HEADER_MASK).toBe('string');
8
+ expect(index_1.APPLICATION_SENTINEL_HEADER_MASK.length).toBeGreaterThan(0);
9
+ });
10
+ it('can never be a real HTTP header value', () => {
11
+ expect(() => (0, http_1.validateHeaderValue)('X-Probe', index_1.APPLICATION_SENTINEL_HEADER_MASK)).toThrow();
12
+ });
13
+ });
14
+ //# sourceMappingURL=sentinel-header-mask.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentinel-header-mask.test.js","sourceRoot":"","sources":["../../src/__tests__/sentinel-header-mask.test.ts"],"names":[],"mappings":";;AAAA,+BAA2C;AAC3C,oCAA4D;AAE5D,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,OAAO,wCAAgC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/D,MAAM,CAAC,wCAAgC,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAIH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,0BAAmB,EAAC,SAAS,EAAE,wCAAgC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum ApplicationSentinelCheckStatus {
2
+ SUCCESS = "SUCCESS",
3
+ FAILED = "FAILED",
4
+ NOT_RUN = "NOT_RUN"
5
+ }
6
+ export type ApplicationSentinelExecutedCheckStatus = ApplicationSentinelCheckStatus.SUCCESS | ApplicationSentinelCheckStatus.FAILED;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationSentinelCheckStatus = void 0;
4
+ var ApplicationSentinelCheckStatus;
5
+ (function (ApplicationSentinelCheckStatus) {
6
+ ApplicationSentinelCheckStatus["SUCCESS"] = "SUCCESS";
7
+ ApplicationSentinelCheckStatus["FAILED"] = "FAILED";
8
+ ApplicationSentinelCheckStatus["NOT_RUN"] = "NOT_RUN";
9
+ })(ApplicationSentinelCheckStatus || (exports.ApplicationSentinelCheckStatus = ApplicationSentinelCheckStatus = {}));
10
+ //# sourceMappingURL=application-sentinel-check-status.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-sentinel-check-status.enum.js","sourceRoot":"","sources":["../../../src/types/enum/application-sentinel-check-status.enum.ts"],"names":[],"mappings":";;;AAOA,IAAY,8BASX;AATD,WAAY,8BAA8B;IACxC,qDAAmB,CAAA;IACnB,mDAAiB,CAAA;IAMjB,qDAAmB,CAAA;AACrB,CAAC,EATW,8BAA8B,8CAA9B,8BAA8B,QASzC"}
@@ -6,3 +6,4 @@ export * from './log-level.enum';
6
6
  export * from './log-scenario.enum';
7
7
  export * from './application-webhook-scope.enum';
8
8
  export * from './application-sentinel-type.enum';
9
+ export * from './application-sentinel-check-status.enum';
@@ -22,4 +22,5 @@ __exportStar(require("./log-level.enum"), exports);
22
22
  __exportStar(require("./log-scenario.enum"), exports);
23
23
  __exportStar(require("./application-webhook-scope.enum"), exports);
24
24
  __exportStar(require("./application-sentinel-type.enum"), exports);
25
+ __exportStar(require("./application-sentinel-check-status.enum"), exports);
25
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,oDAAkC;AAClC,gEAA8C;AAC9C,gEAA8C;AAC9C,mDAAiC;AACjC,sDAAoC;AACpC,mEAAiD;AACjD,mEAAiD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,oDAAkC;AAClC,gEAA8C;AAC9C,gEAA8C;AAC9C,mDAAiC;AACjC,sDAAoC;AACpC,mEAAiD;AACjD,mEAAiD;AACjD,2EAAyD"}
@@ -1,5 +1,6 @@
1
1
  import { QueryPaginate } from '..';
2
2
  import { ApplicationSentinelConfigurationDto } from '../../dto';
3
+ import { ApplicationSentinelCheckStatus } from '../../../enum';
3
4
  export interface IGetApplicationSentinelParams {
4
5
  applicationId: string;
5
6
  applicationSentinelId: string;
@@ -52,6 +53,7 @@ export type IPaginateHistoryApplicationSentinelQuery = {
52
53
  minLatency?: number;
53
54
  maxLatency?: number;
54
55
  hasFailed?: boolean;
56
+ status?: ApplicationSentinelCheckStatus;
55
57
  } & QueryPaginate;
56
58
  export interface IDeleteApplicationSentinelParams {
57
59
  applicationId: string;
@@ -1,15 +1,17 @@
1
1
  import { ApplicationSentinelType } from '../../enum/application-sentinel-type.enum';
2
2
  import { APIMethod } from '../../enum';
3
3
  export declare const MAX_APPLICATION_SENTINEL_RETRY_COUNT = 5;
4
+ export declare const APPLICATION_SENTINEL_HEADER_MASK = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
5
+ export type ApplicationSentinelLatencyPolicy = {
6
+ max: number;
7
+ min?: number | null;
8
+ };
4
9
  export type ApplicationSentinelConfigurationDto = ApplicationSentinelConfigurationPing | ApplicationSentinelConfigurationHttp | ApplicationSentinelConfigurationTcp;
5
10
  export type ApplicationSentinelConfigurationPing = {
6
11
  type: ApplicationSentinelType.PING;
7
12
  host: string;
8
13
  successPolicy: {
9
- latency: {
10
- min: number;
11
- max: number;
12
- };
14
+ latency: ApplicationSentinelLatencyPolicy;
13
15
  };
14
16
  };
15
17
  export type ApplicationSentinelConfigurationHttp = {
@@ -22,10 +24,7 @@ export type ApplicationSentinelConfigurationHttp = {
22
24
  };
23
25
  headers: Record<string, string>;
24
26
  successPolicy: {
25
- latency: {
26
- min: number;
27
- max: number;
28
- };
27
+ latency: ApplicationSentinelLatencyPolicy;
29
28
  statusCodes?: number[];
30
29
  bodyAssertion?: {
31
30
  enabled: boolean;
@@ -39,15 +38,13 @@ export type ApplicationSentinelConfigurationTcp = {
39
38
  host: string;
40
39
  port: number;
41
40
  successPolicy: {
42
- latency: {
43
- min: number;
44
- max: number;
45
- };
41
+ latency: ApplicationSentinelLatencyPolicy;
46
42
  };
47
43
  };
48
44
  export type ApplicationSentinelResult = {
49
45
  isSuccess: boolean;
50
46
  latency: number;
47
+ totalDurationMs?: number;
51
48
  retryCount: number;
52
49
  metadata: Record<string, string> | null;
53
50
  errorMessage: string | null;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_APPLICATION_SENTINEL_RETRY_COUNT = void 0;
3
+ exports.APPLICATION_SENTINEL_HEADER_MASK = exports.MAX_APPLICATION_SENTINEL_RETRY_COUNT = void 0;
4
4
  exports.MAX_APPLICATION_SENTINEL_RETRY_COUNT = 5;
5
+ exports.APPLICATION_SENTINEL_HEADER_MASK = '••••••••';
5
6
  //# sourceMappingURL=application-sentinel-configuration.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-sentinel-configuration.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/dto/application-sentinel-configuration.dto.ts"],"names":[],"mappings":";;;AAGa,QAAA,oCAAoC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"application-sentinel-configuration.dto.js","sourceRoot":"","sources":["../../../../src/types/interface/dto/application-sentinel-configuration.dto.ts"],"names":[],"mappings":";;;AAGa,QAAA,oCAAoC,GAAG,CAAC,CAAC;AAazC,QAAA,gCAAgC,GAAG,UAAU,CAAC"}
@@ -8,6 +8,7 @@ export interface IApplicationCronTask {
8
8
  webhookUrl: string;
9
9
  webhookSecret: string;
10
10
  isActivated: boolean;
11
+ enqueueFailures?: number;
11
12
  lastExecutedAt: Date | null;
12
13
  updatedAt?: Date;
13
14
  createdAt?: Date;
@@ -1,10 +1,12 @@
1
1
  import { ApplicationSentinelResult } from '../dto';
2
+ import { ApplicationSentinelCheckStatus } from '../../enum';
2
3
  import { IApplicationSentinel } from './application-sentinel.model';
3
4
  import { IApplicationWebhookHistory } from './application-webhook-history.model';
4
5
  export interface IApplicationSentinelHistory {
5
6
  id?: string;
6
7
  applicationSentinelId: string;
7
8
  startDate: Date;
9
+ status: ApplicationSentinelCheckStatus;
8
10
  hasFailed: boolean;
9
11
  latency: number | null;
10
12
  webhookMetadata: Record<string, string>;
@@ -14,7 +14,8 @@ export interface IApplicationSentinel {
14
14
  lastDownNotificationDate?: Date | null;
15
15
  lastUpNotificationDate?: Date | null;
16
16
  consecutiveFailures?: number;
17
- nextCheckSkipUntil?: Date | null;
17
+ enqueueFailures?: number;
18
+ nextNotificationAfter?: Date | null;
18
19
  lastCheckedAt?: Date | null;
19
20
  updatedAt?: Date;
20
21
  createdAt?: Date;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/monitor",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Core package to interact with Abyss-Monitor",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",