diff --git a/frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte b/frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte index 61a8684234..993fc6611a 100644 --- a/frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte +++ b/frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte @@ -263,7 +263,7 @@ btnClasses="ml-4 mt-2" color="dark" size="xs" - href={itemKind === 'flow' ? '/flows/add?hub=68' : '/scripts/add?hub=hub%2F11446'} + href={itemKind === 'flow' ? '/flows/add?hub=68' : '/scripts/add?hub=hub%2F19662'} target="_blank">Create from template {/if} diff --git a/frontend/src/lib/components/triggers/http/RouteEditorInner.svelte b/frontend/src/lib/components/triggers/http/RouteEditorInner.svelte index eeb980e347..427540b288 100644 --- a/frontend/src/lib/components/triggers/http/RouteEditorInner.svelte +++ b/frontend/src/lib/components/triggers/http/RouteEditorInner.svelte @@ -448,7 +448,7 @@ size="xs" href={itemKind === 'flow' ? '/flows/add?hub=62' - : '/scripts/add?hub=hub%2F11627'} + : '/scripts/add?hub=hub%2F19669'} target="_blank">Create from template {/if} diff --git a/frontend/src/lib/components/triggers/http/utils.ts b/frontend/src/lib/components/triggers/http/utils.ts index 7fd53a6182..4deb21fc4c 100644 --- a/frontend/src/lib/components/triggers/http/utils.ts +++ b/frontend/src/lib/components/triggers/http/utils.ts @@ -2,7 +2,7 @@ import { base } from '$lib/base' import { isCloudHosted } from '$lib/cloud' export const SECRET_KEY_PATH = 'secret_key_path' -export const HUB_SCRIPT_ID = 19661 +export const HUB_SCRIPT_ID = 19670 export const SIGNATURE_TEMPLATE_SCRIPT_HUB_PATH: string = `hub/${HUB_SCRIPT_ID}` export const SIGNATURE_TEMPLATE_FLOW_HUB_ID = '67' diff --git a/frontend/src/lib/script_helpers.ts b/frontend/src/lib/script_helpers.ts index fd7a42e587..ceb6644c42 100644 --- a/frontend/src/lib/script_helpers.ts +++ b/frontend/src/lib/script_helpers.ts @@ -660,86 +660,94 @@ export const TS_PREPROCESSOR_FLOW_INTRO = `/** export const TS_PREPROCESSOR_MODULE_CODE = `export async function preprocessor( event: | { - kind: "webhook"; - body: any, - raw_string: string | null, - query: Record; - headers: Record; - } + kind: "webhook"; + body: any; + raw_string: string | null; + query: Record; + headers: Record; + } | { - kind: "http"; - body: any, - raw_string: string | null, - route: string; - path: string; - method: string; - params: Record; - query: Record; - headers: Record; - } + kind: "http"; + body: any; + raw_string: string | null; + route: string; + path: string; + method: string; + params: Record; + query: Record; + headers: Record; + } | { - kind: "email"; - parsed_email: any, - raw_email: string, - } + kind: "email"; + parsed_email: any; + raw_email: string; + } | { kind: "websocket"; msg: string; url: string } | { - kind: "kafka"; - payload: string; - brokers: string[]; - topic: string; - group_id: string; - } + kind: "kafka"; + payload: string; + brokers: string[]; + topic: string; + group_id: string; + } | { - kind: "nats"; - payload: string; - servers: string[]; - subject: string; - headers?: Record; - status?: number; - description?: string; - length: number; - } + kind: "nats"; + payload: string; + servers: string[]; + subject: string; + headers?: Record; + status?: number; + description?: string; + length: number; + } | { - kind: "sqs"; - msg: string, - queue_url: string; - message_id?: string; - receipt_handle?: string; - attributes: Record; - message_attributes?: Record< - string, - { string_value?: string; data_type: string } - >; - } + kind: "sqs"; + msg: string; + queue_url: string; + message_id?: string; + receipt_handle?: string; + attributes: Record; + message_attributes?: Record< + string, + { string_value?: string; data_type: string } + >; + } | { - kind: "mqtt"; - payload: string, - topic: string; - retain: boolean; - pkid: number; - qos: number; - v5?: { - payload_format_indicator?: number; - topic_alias?: number; - response_topic?: string; - correlation_data?: Array; - user_properties?: Array<[string, string]>; - subscription_identifiers?: Array; - content_type?: string; - }; - } + kind: "mqtt"; + payload: string; + topic: string; + retain: boolean; + pkid: number; + qos: number; + v5?: { + payload_format_indicator?: number; + topic_alias?: number; + response_topic?: string; + correlation_data?: Array; + user_properties?: Array<[string, string]>; + subscription_identifiers?: Array; + content_type?: string; + }; + } | { - kind: "gcp"; - payload: string, - message_id: string; - subscription: string; - ordering_key?: string; - attributes?: Record; - delivery_type: "push" | "pull"; - headers?: Record; - publish_time?: string; - } + kind: "gcp"; + payload: string; + message_id: string; + subscription: string; + ordering_key?: string; + attributes?: Record; + delivery_type: "push" | "pull"; + headers?: Record; + publish_time?: string; + } + | { + kind: "postgres"; + transaction_type: "insert" | "update" | "delete", + schema_name: string, + table_name: string, + old_row?: Record, + row: Record + } ) { return { // return the args to be passed to the runnable @@ -898,6 +906,16 @@ class GcpEvent(TypedDict): headers: Optional[dict[str, str]] publish_time: Optional[str] + +class PostgresEvent(TypedDict): + kind: Literal["postgres"] + transaction_type: Literal["insert", "update", "delete"] + schema_name: str + table_name: str + old_row: Optional[dict[str, any]] + row: dict[str, any] + + Event = Union[ WebhookEvent, HttpEvent, @@ -908,6 +926,7 @@ Event = Union[ SqsEvent, MqttEvent, GcpEvent, + PostgresEvent, ]