@envoy/envoy-integrations-sdk 2.4.0 → 2.4.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.
- package/dist/sdk/EnvoyPluginJob.d.ts +2 -2
- package/dist/sdk/EnvoyPluginJob.js +2 -2
- package/dist/sdk/EnvoyPluginJobAttachment.d.ts +49 -1
- package/dist/sdk/EnvoyPluginJobAttachment.d.ts.map +1 -1
- package/dist/sdk/EnvoyResponse.d.ts +5 -1
- package/dist/sdk/EnvoyResponse.d.ts.map +1 -1
- package/dist/sdk/middleware.d.ts.map +1 -1
- package/dist/sdk/middleware.js +10 -0
- package/package.json +1 -1
- package/src/sdk/EnvoyPluginJob.ts +2 -2
- package/src/sdk/EnvoyPluginJobAttachment.ts +57 -1
- package/src/sdk/EnvoyResponse.ts +5 -1
- package/src/sdk/middleware.ts +14 -1
|
@@ -33,9 +33,9 @@ export default class EnvoyPluginJob {
|
|
|
33
33
|
*/
|
|
34
34
|
ignore(message: string, reason: string): Promise<void>;
|
|
35
35
|
/**
|
|
36
|
-
* Reports that the job is
|
|
36
|
+
* Reports that the job is failed.
|
|
37
37
|
*
|
|
38
|
-
* Instead of calling this directly, you can return a
|
|
38
|
+
* Instead of calling this directly, you can return a 412 response from the job's event handler,
|
|
39
39
|
* using {@link EnvoyRequest.sendFailed}.
|
|
40
40
|
*/
|
|
41
41
|
fail(message: string, reason: string): Promise<void>;
|
|
@@ -74,9 +74,9 @@ var EnvoyPluginJob = /** @class */ (function () {
|
|
|
74
74
|
return this.execute('ignored', message, reason);
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
|
-
* Reports that the job is
|
|
77
|
+
* Reports that the job is failed.
|
|
78
78
|
*
|
|
79
|
-
* Instead of calling this directly, you can return a
|
|
79
|
+
* Instead of calling this directly, you can return a 412 response from the job's event handler,
|
|
80
80
|
* using {@link EnvoyRequest.sendFailed}.
|
|
81
81
|
*/
|
|
82
82
|
EnvoyPluginJob.prototype.fail = function (message, reason) {
|
|
@@ -8,6 +8,16 @@ export interface EnvoyPluginTextJobAttachment {
|
|
|
8
8
|
label: string;
|
|
9
9
|
value: string;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Display some JSON data in Envoy's dashboard.
|
|
13
|
+
*
|
|
14
|
+
* @category Attachment
|
|
15
|
+
*/
|
|
16
|
+
export interface EnvoyPluginJSONJobAttachment {
|
|
17
|
+
type: 'json';
|
|
18
|
+
label: string;
|
|
19
|
+
value: unknown;
|
|
20
|
+
}
|
|
11
21
|
/**
|
|
12
22
|
* Display a link in Envoy's dashboard.
|
|
13
23
|
*
|
|
@@ -31,6 +41,44 @@ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAt
|
|
|
31
41
|
link: string;
|
|
32
42
|
};
|
|
33
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Display a screener report in Envoy's dashboard,
|
|
46
|
+
* and allow for approval or rejection.
|
|
47
|
+
*
|
|
48
|
+
* @category Attachment
|
|
49
|
+
*/
|
|
50
|
+
export interface EnvoyPluginScreenerJobAttachment extends EnvoyPluginJSONJobAttachment {
|
|
51
|
+
label: string;
|
|
52
|
+
value: ScreenerDetails;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Screener report definitions
|
|
56
|
+
*/
|
|
57
|
+
export interface ScreenerDetails {
|
|
58
|
+
input: {
|
|
59
|
+
fields: ScreenerInputField[];
|
|
60
|
+
};
|
|
61
|
+
matches: ScreenerMatch[];
|
|
62
|
+
}
|
|
63
|
+
export interface ScreenerMatch {
|
|
64
|
+
headers: ScreenerMatchHeaders;
|
|
65
|
+
'visible-fields-count': number;
|
|
66
|
+
fields: ScreenerMatchField[];
|
|
67
|
+
}
|
|
68
|
+
export interface ScreenerMatchHeaders {
|
|
69
|
+
name: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ScreenerMatchField {
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
type: 'text' | 'image';
|
|
76
|
+
}
|
|
77
|
+
export interface ScreenerInputField {
|
|
78
|
+
name: string;
|
|
79
|
+
value: string;
|
|
80
|
+
type: 'text' | 'image';
|
|
81
|
+
}
|
|
34
82
|
/**
|
|
35
83
|
* Attachments to jobs, which will be displayed in the Envoy dashboard.
|
|
36
84
|
* Some attachments like `credential_image` can show up in other places,
|
|
@@ -38,6 +86,6 @@ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAt
|
|
|
38
86
|
*
|
|
39
87
|
* @category Attachment
|
|
40
88
|
*/
|
|
41
|
-
declare type EnvoyPluginJobAttachment = EnvoyPluginTextJobAttachment | EnvoyPluginLinkJobAttachment | EnvoyPluginCredentialJobAttachment;
|
|
89
|
+
declare type EnvoyPluginJobAttachment = EnvoyPluginTextJobAttachment | EnvoyPluginLinkJobAttachment | EnvoyPluginCredentialJobAttachment | EnvoyPluginScreenerJobAttachment;
|
|
42
90
|
export default EnvoyPluginJobAttachment;
|
|
43
91
|
//# sourceMappingURL=EnvoyPluginJobAttachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvoyPluginJobAttachment.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyPluginJobAttachment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,4BAA4B;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,kCAAmC,SAAQ,4BAA4B;IACtF,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;;;;GAMG;AACH,aAAK,wBAAwB,GACzB,4BAA4B,GAC5B,4BAA4B,GAC5B,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"EnvoyPluginJobAttachment.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyPluginJobAttachment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,4BAA4B;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,kCAAmC,SAAQ,4BAA4B;IACtF,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,gCAAiC,SAAQ,4BAA4B;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE;QACL,MAAM,EAAE,kBAAkB,EAAE,CAAC;KAC9B,CAAA;IACD,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,aAAK,wBAAwB,GACzB,4BAA4B,GAC5B,4BAA4B,GAC5B,kCAAkC,GAClC,gCAAgC,CAAC;AAErC,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Response } from 'express';
|
|
2
|
-
import EnvoyPluginJobAttachment from './EnvoyPluginJobAttachment';
|
|
2
|
+
import EnvoyPluginJobAttachment, { EnvoyPluginScreenerJobAttachment } from './EnvoyPluginJobAttachment';
|
|
3
3
|
import EnvoyOptionsRouteResponseBody from '../internal/EnvoyOptionsRouteResponseBody';
|
|
4
4
|
import EnvoySelectedValuesRouteResponseBody from '../internal/EnvoySelectedValuesRouteResponseBody';
|
|
5
5
|
import EnvoyRemoteValueRouteResponseBody from '../internal/EnvoyRemoteValueRouteResponseBody';
|
|
@@ -24,6 +24,10 @@ export default interface EnvoyResponse<Body = unknown> extends Response {
|
|
|
24
24
|
* Marks the job as "failed". The message will be communicated to the Envoy Dashboard user.
|
|
25
25
|
*/
|
|
26
26
|
sendFailed: (message: string, debugInfo?: unknown, ...attachments: Array<EnvoyPluginJobAttachment>) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Marks the job as "failed". The message will be communicated to the Envoy Dashboard user.
|
|
29
|
+
*/
|
|
30
|
+
sendFailedScreen: (message: string, debugInfo?: unknown, attachment?: EnvoyPluginScreenerJobAttachment) => void;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Use to type your `res` object in Envoy "options URL" route handlers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvoyResponse.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"EnvoyResponse.d.ts","sourceRoot":"","sources":["../../src/sdk/EnvoyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,wBAAwB,EAAE,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,6BAA6B,MAAM,2CAA2C,CAAC;AACtF,OAAO,oCAAoC,MAAM,kDAAkD,CAAC;AACpG,OAAO,iCAAiC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,gCAAgC,MAAM,oCAAoC,CAAC;AAElF;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,QAAQ;IACrE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAC;IAE7G;;OAEG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAC;IAC5G;;OAEG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,gCAAgC,KAAK,IAAI,CAAC;CACjH;AAED;;;GAGG;AACH,oBAAY,yBAAyB,GAAG,aAAa,CAAC,6BAA6B,CAAC,CAAC;AAErF;;;GAGG;AACH,oBAAY,6BAA6B,GAAG,aAAa,CAAC,iCAAiC,CAAC,CAAC;AAE7F;;;GAGG;AACH,oBAAY,gCAAgC,GAAG,aAAa,CAAC,oCAAoC,CAAC,CAAC;AAEnG;;;;;GAKG;AACH,oBAAY,4BAA4B,CAAC,MAAM,IAAI,aAAa,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/sdk/middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG/F,OAA+B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAOvG;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,6BAA6B,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/sdk/middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG/F,OAA+B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAOvG;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,6BAA6B,GAAG,cAAc,CA8EvF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAe,GAAG,mBAAmB,CAU7F"}
|
package/dist/sdk/middleware.js
CHANGED
|
@@ -126,6 +126,16 @@ function envoyMiddleware(options) {
|
|
|
126
126
|
envoyResponse_1.setHeader('Content-Type', 'application/json');
|
|
127
127
|
envoyResponse_1.end(JSON.stringify({ message: message, debugInfo: debugInfo, attachments: attachments }));
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Respond with "failed" for screener in case of screener matches.
|
|
131
|
+
*/
|
|
132
|
+
envoyResponse_1.sendFailedScreen = function (message, debugInfo, attachment) {
|
|
133
|
+
if (message === void 0) { message = ''; }
|
|
134
|
+
if (debugInfo === void 0) { debugInfo = {}; }
|
|
135
|
+
envoyResponse_1.statusCode = HttpStatus_1.default.FAILED;
|
|
136
|
+
envoyResponse_1.setHeader('Content-Type', 'application/json');
|
|
137
|
+
envoyResponse_1.end(JSON.stringify({ message: message, debugInfo: debugInfo, attachment: attachment }));
|
|
138
|
+
};
|
|
129
139
|
next();
|
|
130
140
|
return [3 /*break*/, 5];
|
|
131
141
|
case 4:
|
package/package.json
CHANGED
|
@@ -70,9 +70,9 @@ export default class EnvoyPluginJob {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* Reports that the job is
|
|
73
|
+
* Reports that the job is failed.
|
|
74
74
|
*
|
|
75
|
-
* Instead of calling this directly, you can return a
|
|
75
|
+
* Instead of calling this directly, you can return a 412 response from the job's event handler,
|
|
76
76
|
* using {@link EnvoyRequest.sendFailed}.
|
|
77
77
|
*/
|
|
78
78
|
fail(message: string, reason: string): Promise<void> {
|
|
@@ -9,6 +9,17 @@ export interface EnvoyPluginTextJobAttachment {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Display some JSON data in Envoy's dashboard.
|
|
14
|
+
*
|
|
15
|
+
* @category Attachment
|
|
16
|
+
*/
|
|
17
|
+
export interface EnvoyPluginJSONJobAttachment {
|
|
18
|
+
type: 'json';
|
|
19
|
+
label: string;
|
|
20
|
+
value: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
/**
|
|
13
24
|
* Display a link in Envoy's dashboard.
|
|
14
25
|
*
|
|
@@ -34,6 +45,50 @@ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAt
|
|
|
34
45
|
};
|
|
35
46
|
}
|
|
36
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Display a screener report in Envoy's dashboard,
|
|
50
|
+
* and allow for approval or rejection.
|
|
51
|
+
*
|
|
52
|
+
* @category Attachment
|
|
53
|
+
*/
|
|
54
|
+
export interface EnvoyPluginScreenerJobAttachment extends EnvoyPluginJSONJobAttachment {
|
|
55
|
+
label: string;
|
|
56
|
+
value: ScreenerDetails;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Screener report definitions
|
|
61
|
+
*/
|
|
62
|
+
export interface ScreenerDetails {
|
|
63
|
+
input: {
|
|
64
|
+
fields: ScreenerInputField[];
|
|
65
|
+
}
|
|
66
|
+
matches: ScreenerMatch[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ScreenerMatch {
|
|
70
|
+
headers: ScreenerMatchHeaders;
|
|
71
|
+
'visible-fields-count': number;
|
|
72
|
+
fields: ScreenerMatchField[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ScreenerMatchHeaders {
|
|
76
|
+
name: string; // ex: Tags
|
|
77
|
+
value: string; // ex: Content
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ScreenerMatchField {
|
|
81
|
+
name: string;
|
|
82
|
+
value: string;
|
|
83
|
+
type: 'text' | 'image';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ScreenerInputField {
|
|
87
|
+
name: string;
|
|
88
|
+
value: string;
|
|
89
|
+
type: 'text' | 'image';
|
|
90
|
+
}
|
|
91
|
+
|
|
37
92
|
/**
|
|
38
93
|
* Attachments to jobs, which will be displayed in the Envoy dashboard.
|
|
39
94
|
* Some attachments like `credential_image` can show up in other places,
|
|
@@ -44,6 +99,7 @@ export interface EnvoyPluginCredentialJobAttachment extends EnvoyPluginTextJobAt
|
|
|
44
99
|
type EnvoyPluginJobAttachment =
|
|
45
100
|
| EnvoyPluginTextJobAttachment
|
|
46
101
|
| EnvoyPluginLinkJobAttachment
|
|
47
|
-
| EnvoyPluginCredentialJobAttachment
|
|
102
|
+
| EnvoyPluginCredentialJobAttachment
|
|
103
|
+
| EnvoyPluginScreenerJobAttachment;
|
|
48
104
|
|
|
49
105
|
export default EnvoyPluginJobAttachment;
|
package/src/sdk/EnvoyResponse.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Response } from 'express';
|
|
2
|
-
import EnvoyPluginJobAttachment from './EnvoyPluginJobAttachment';
|
|
2
|
+
import EnvoyPluginJobAttachment, { EnvoyPluginScreenerJobAttachment } from './EnvoyPluginJobAttachment';
|
|
3
3
|
import EnvoyOptionsRouteResponseBody from '../internal/EnvoyOptionsRouteResponseBody';
|
|
4
4
|
import EnvoySelectedValuesRouteResponseBody from '../internal/EnvoySelectedValuesRouteResponseBody';
|
|
5
5
|
import EnvoyRemoteValueRouteResponseBody from '../internal/EnvoyRemoteValueRouteResponseBody';
|
|
@@ -26,6 +26,10 @@ export default interface EnvoyResponse<Body = unknown> extends Response {
|
|
|
26
26
|
* Marks the job as "failed". The message will be communicated to the Envoy Dashboard user.
|
|
27
27
|
*/
|
|
28
28
|
sendFailed: (message: string, debugInfo?: unknown, ...attachments: Array<EnvoyPluginJobAttachment>) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Marks the job as "failed". The message will be communicated to the Envoy Dashboard user.
|
|
31
|
+
*/
|
|
32
|
+
sendFailedScreen: (message: string, debugInfo?: unknown, attachment?: EnvoyPluginScreenerJobAttachment) => void;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
/**
|
package/src/sdk/middleware.ts
CHANGED
|
@@ -5,7 +5,7 @@ import HttpStatus from '../internal/HttpStatus';
|
|
|
5
5
|
import EnvoySignatureVerifier, { EnvoySignatureVerifierOptions } from '../util/EnvoySignatureVerifier';
|
|
6
6
|
import EnvoyRequest, { VERIFIED, VerifiedRequest } from './EnvoyRequest';
|
|
7
7
|
import EnvoyResponse from './EnvoyResponse';
|
|
8
|
-
import EnvoyPluginJobAttachment from './EnvoyPluginJobAttachment';
|
|
8
|
+
import EnvoyPluginJobAttachment, { EnvoyPluginScreenerJobAttachment } from './EnvoyPluginJobAttachment';
|
|
9
9
|
import EnvoyPluginSDK from './EnvoyPluginSDK';
|
|
10
10
|
import EnvoyPluginAPI from './EnvoyPluginAPI';
|
|
11
11
|
|
|
@@ -77,6 +77,19 @@ export function envoyMiddleware(options?: EnvoySignatureVerifierOptions): Reques
|
|
|
77
77
|
envoyResponse.setHeader('Content-Type', 'application/json');
|
|
78
78
|
envoyResponse.end(JSON.stringify({ message, debugInfo, attachments }));
|
|
79
79
|
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Respond with "failed" for screener in case of screener matches.
|
|
83
|
+
*/
|
|
84
|
+
envoyResponse.sendFailedScreen = (
|
|
85
|
+
message = '',
|
|
86
|
+
debugInfo: unknown = {},
|
|
87
|
+
attachment?: EnvoyPluginScreenerJobAttachment,
|
|
88
|
+
) => {
|
|
89
|
+
envoyResponse.statusCode = HttpStatus.FAILED;
|
|
90
|
+
envoyResponse.setHeader('Content-Type', 'application/json');
|
|
91
|
+
envoyResponse.end(JSON.stringify({ message, debugInfo, attachment }));
|
|
92
|
+
};
|
|
80
93
|
next();
|
|
81
94
|
} catch (error) {
|
|
82
95
|
next(error);
|