@awell-health/awell-extensions 2.0.292 → 2.0.293
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/extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.d.ts +5 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.js +5 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.js.map +1 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/ticketCreated.d.ts +6 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/ticketCreated.js +20 -2
- package/dist/extensions/freshdesk/webhooks/TicketCreated/ticketCreated.js.map +1 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/types.d.ts +19 -1
- package/dist/extensions/freshdesk/webhooks/TicketCreated/types.js +22 -0
- package/dist/extensions/freshdesk/webhooks/TicketCreated/types.js.map +1 -1
- package/dist/extensions/freshdesk/webhooks/index.d.ts +5 -1
- package/package.json +1 -1
@@ -1,5 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ticketCreatedPayload = void 0;
|
4
|
-
exports.ticketCreatedPayload = {
|
4
|
+
exports.ticketCreatedPayload = {
|
5
|
+
freshdesk_webhook: {
|
6
|
+
ticket_id: '295186',
|
7
|
+
},
|
8
|
+
};
|
5
9
|
//# sourceMappingURL=ticketCreated.mock.js.map
|
package/dist/extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ticketCreated.mock.js","sourceRoot":"","sources":["../../../../../../extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG,
|
1
|
+
{"version":3,"file":"ticketCreated.mock.js","sourceRoot":"","sources":["../../../../../../extensions/freshdesk/webhooks/TicketCreated/__testdata__/ticketCreated.mock.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG;IAClC,iBAAiB,EAAE;QACjB,SAAS,EAAE,QAAQ;KACpB;CACoC,CAAA"}
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import { type Webhook } from '@awell-health/extensions-core';
|
2
2
|
import { type settings } from '../../settings';
|
3
3
|
import { type TicketCreatedWebhookPayload } from './types';
|
4
|
-
declare const dataPoints: {
|
4
|
+
declare const dataPoints: {
|
5
|
+
ticketId: {
|
6
|
+
key: string;
|
7
|
+
valueType: "string";
|
8
|
+
};
|
9
|
+
};
|
5
10
|
export declare const ticketCreated: Webhook<keyof typeof dataPoints, TicketCreatedWebhookPayload, typeof settings>;
|
6
11
|
export type TicketCreated = typeof ticketCreated;
|
7
12
|
export {};
|
@@ -1,13 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ticketCreated = void 0;
|
4
|
-
const
|
4
|
+
const types_1 = require("./types");
|
5
|
+
const dataPoints = {
|
6
|
+
ticketId: {
|
7
|
+
key: 'ticketId',
|
8
|
+
valueType: 'string',
|
9
|
+
},
|
10
|
+
};
|
5
11
|
exports.ticketCreated = {
|
6
12
|
key: 'ticketCreated',
|
7
13
|
dataPoints,
|
8
14
|
onEvent: async ({ payload: { payload, rawBody, headers, settings }, onSuccess, onError, }) => {
|
15
|
+
const parsedPayload = types_1.zTicketCreatedWebhookPayload.safeParse(payload);
|
16
|
+
if (!parsedPayload.success) {
|
17
|
+
await onError({
|
18
|
+
response: {
|
19
|
+
statusCode: 400,
|
20
|
+
message: JSON.stringify(parsedPayload.error, null, 2),
|
21
|
+
},
|
22
|
+
});
|
23
|
+
return;
|
24
|
+
}
|
9
25
|
await onSuccess({
|
10
|
-
data_points: {
|
26
|
+
data_points: {
|
27
|
+
ticketId: parsedPayload.data.freshdesk_webhook.ticket_id,
|
28
|
+
},
|
11
29
|
});
|
12
30
|
},
|
13
31
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ticketCreated.js","sourceRoot":"","sources":["../../../../../extensions/freshdesk/webhooks/TicketCreated/ticketCreated.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"ticketCreated.js","sourceRoot":"","sources":["../../../../../extensions/freshdesk/webhooks/TicketCreated/ticketCreated.ts"],"names":[],"mappings":";;;AAMA,mCAAsD;AAEtD,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE;QACR,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,UAAU;IACV,OAAO,EAAE,KAAK,EAAE,EACd,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAChD,SAAS,EACT,OAAO,GACR,EAAE,EAAE;QACH,MAAM,aAAa,GAAG,oCAA4B,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QAErE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC3B,MAAM,OAAO,CAAC;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,GAAG;oBACf,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtD;aACF,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,MAAM,SAAS,CAAC;YACd,WAAW,EAAE;gBACX,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS;aACzD;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { z } from 'zod';
|
1
2
|
/**
|
2
3
|
* Problem:
|
3
4
|
* Freshdesk allows their users to define a custom webhook payload.
|
@@ -13,4 +14,21 @@
|
|
13
14
|
*
|
14
15
|
* See https://support.freshdesk.com/support/solutions/articles/132589-using-webhooks-in-automation-rules
|
15
16
|
*/
|
16
|
-
export
|
17
|
+
export declare const zTicketCreatedWebhookPayload: z.ZodObject<{
|
18
|
+
freshdesk_webhook: z.ZodObject<{
|
19
|
+
ticket_id: z.ZodString;
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
21
|
+
ticket_id: string;
|
22
|
+
}, {
|
23
|
+
ticket_id: string;
|
24
|
+
}>;
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
26
|
+
freshdesk_webhook: {
|
27
|
+
ticket_id: string;
|
28
|
+
};
|
29
|
+
}, {
|
30
|
+
freshdesk_webhook: {
|
31
|
+
ticket_id: string;
|
32
|
+
};
|
33
|
+
}>;
|
34
|
+
export type TicketCreatedWebhookPayload = z.infer<typeof zTicketCreatedWebhookPayload>;
|
@@ -1,3 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.zTicketCreatedWebhookPayload = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
/**
|
6
|
+
* Problem:
|
7
|
+
* Freshdesk allows their users to define a custom webhook payload.
|
8
|
+
* This means there's no "standard" webhook payload and it's not possible to define a "standard" schema for it.
|
9
|
+
*
|
10
|
+
* Alternative 1:
|
11
|
+
* If a customer wants to use a webhook-based integration with Freshdesk, we register the webhook
|
12
|
+
* in a private extension and define a custom contract/schema together with the customer and use that instead.
|
13
|
+
*
|
14
|
+
* Alternative 2:
|
15
|
+
* We try to define a schema for the webhook payload that is flexible enough to handle all possible payloads.
|
16
|
+
* Haven't attempted this yet.
|
17
|
+
*
|
18
|
+
* See https://support.freshdesk.com/support/solutions/articles/132589-using-webhooks-in-automation-rules
|
19
|
+
*/
|
20
|
+
exports.zTicketCreatedWebhookPayload = zod_1.z.object({
|
21
|
+
freshdesk_webhook: zod_1.z.object({
|
22
|
+
ticket_id: zod_1.z.string(),
|
23
|
+
}),
|
24
|
+
});
|
3
25
|
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../extensions/freshdesk/webhooks/TicketCreated/types.ts"],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../extensions/freshdesk/webhooks/TicketCreated/types.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEvB;;;;;;;;;;;;;;GAcG;AAEU,QAAA,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IACnD,iBAAiB,EAAE,OAAC,CAAC,MAAM,CAAC;QAC1B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;KACtB,CAAC;CACH,CAAC,CAAA"}
|
@@ -1,4 +1,8 @@
|
|
1
|
-
export declare const webhooks: import("@awell-health/extensions-core").Webhook<
|
1
|
+
export declare const webhooks: import("@awell-health/extensions-core").Webhook<"ticketId", {
|
2
|
+
freshdesk_webhook: {
|
3
|
+
ticket_id: string;
|
4
|
+
};
|
5
|
+
}, {
|
2
6
|
domain: {
|
3
7
|
key: string;
|
4
8
|
label: string;
|