add buildship authenticated trigger

This commit is contained in:
Bobby Wang
2023-10-13 18:50:46 +08:00
parent 68503156cb
commit 4ed7a89a31
2 changed files with 22 additions and 0 deletions

View File

@@ -128,4 +128,12 @@ type PushNotificationRequest = {
type PushNotificationBody = (
context: ExtensionContext
) => Message | Message[] | Promise<Message | Message[]>;
type TaskBody = (context: ExtensionContext) => Promise<any>;
type BuildshipAuthenticatedTriggerBody = (
context: ExtensionContext
) => Promise<{
url: string;
body: string;
}>;

View File

@@ -1,4 +1,5 @@
export const extensionTypes = [
"buildshipAuthenticatedTrigger",
"task",
"docSync",
"historySnapshot",
@@ -15,6 +16,7 @@ export const extensionTypes = [
export type ExtensionType = typeof extensionTypes[number];
export const extensionNames: Record<ExtensionType, string> = {
buildshipAuthenticatedTrigger: "Buildship Authenticated Trigger",
task: "Task",
docSync: "Doc Sync",
historySnapshot: "History Snapshot",
@@ -61,6 +63,18 @@ export interface IRuntimeOptions {
export const triggerTypes: ExtensionTrigger[] = ["create", "update", "delete"];
const extensionBodyTemplate = {
buildshipAuthenticatedTrigger: `const extensionBody: BuildshipAuthenticatedTriggerBody = async({row, db, change, ref, logging}) => {
logging.log("extensionBody started")
// Put your endpoint URL and request body below.
// It will trigger your endpoint with the request body.
return ({
url: "",
body: JSON.stringify({
})
})
}`,
task: `const extensionBody: TaskBody = async({row, db, change, ref, logging}) => {
logging.log("extensionBody started")