gristlabs_grist-core/app/common/Triggers-ti.ts
CamilleLegeron 0bfdaa9c02
Add authorization header in webhooks stored in secrets table (#941)
Summary:
Adding authorization header support for webhooks.

Issue:  https://github.com/gristlabs/grist-core/issues/827

---------

Co-authored-by: Florent <florent.git@zeteo.me>
2024-07-04 14:17:10 +02:00

115 lines
3.3 KiB
TypeScript

/**
* This module was automatically generated by `ts-interface-builder`
*/
import * as t from "ts-interface-checker";
// tslint:disable:object-literal-key-quotes
export const WebhookSubscribeCollection = t.iface([], {
"webhooks": t.array("Webhook"),
});
export const Webhook = t.iface([], {
"fields": "WebhookFields",
});
export const WebhookFields = t.iface([], {
"url": "string",
"authorization": t.opt("string"),
"eventTypes": t.array(t.union(t.lit("add"), t.lit("update"))),
"tableId": "string",
"watchedColIds": t.opt(t.array("string")),
"enabled": t.opt("boolean"),
"isReadyColumn": t.opt(t.union("string", "null")),
"name": t.opt("string"),
"memo": t.opt("string"),
});
export const WebhookBatchStatus = t.union(t.lit('success'), t.lit('failure'), t.lit('rejected'));
export const WebhookStatus = t.union(t.lit('idle'), t.lit('sending'), t.lit('retrying'), t.lit('postponed'), t.lit('error'), t.lit('invalid'));
export const WebhookSubscribe = t.iface([], {
"url": "string",
"authorization": t.opt("string"),
"eventTypes": t.array(t.union(t.lit("add"), t.lit("update"))),
"watchedColIds": t.opt(t.array("string")),
"enabled": t.opt("boolean"),
"isReadyColumn": t.opt(t.union("string", "null")),
"name": t.opt("string"),
"memo": t.opt("string"),
});
export const WebhookSummaryCollection = t.iface([], {
"webhooks": t.array("WebhookSummary"),
});
export const WebhookSummary = t.iface([], {
"id": "string",
"fields": t.iface([], {
"url": "string",
"authorization": t.opt("string"),
"unsubscribeKey": "string",
"eventTypes": t.array("string"),
"isReadyColumn": t.union("string", "null"),
"tableId": "string",
"watchedColIds": t.opt(t.array("string")),
"enabled": "boolean",
"name": "string",
"memo": "string",
}),
"usage": t.union("WebhookUsage", "null"),
});
export const WebhookUpdate = t.iface([], {
"id": "string",
"fields": "WebhookPatch",
});
export const WebhookPatch = t.iface([], {
"url": t.opt("string"),
"authorization": t.opt("string"),
"eventTypes": t.opt(t.array(t.union(t.lit("add"), t.lit("update")))),
"tableId": t.opt("string"),
"watchedColIds": t.opt(t.array("string")),
"enabled": t.opt("boolean"),
"isReadyColumn": t.opt(t.union("string", "null")),
"name": t.opt("string"),
"memo": t.opt("string"),
});
export const WebhookUsage = t.iface([], {
"numWaiting": "number",
"status": "WebhookStatus",
"updatedTime": t.opt(t.union("number", "null")),
"lastSuccessTime": t.opt(t.union("number", "null")),
"lastFailureTime": t.opt(t.union("number", "null")),
"lastErrorMessage": t.opt(t.union("string", "null")),
"lastHttpStatus": t.opt(t.union("number", "null")),
"lastEventBatch": t.opt(t.union("null", t.iface([], {
"size": "number",
"errorMessage": t.union("string", "null"),
"httpStatus": t.union("number", "null"),
"status": "WebhookBatchStatus",
"attempts": "number",
}))),
"numSuccess": t.opt(t.iface([], {
"pastHour": "number",
"past24Hours": "number",
})),
});
const exportedTypeSuite: t.ITypeSuite = {
WebhookSubscribeCollection,
Webhook,
WebhookFields,
WebhookBatchStatus,
WebhookStatus,
WebhookSubscribe,
WebhookSummaryCollection,
WebhookSummary,
WebhookUpdate,
WebhookPatch,
WebhookUsage,
};
export default exportedTypeSuite;