preprocessor template nits (#5760)
This commit is contained in:
@@ -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</Button
|
||||
>
|
||||
{/if}
|
||||
|
||||
@@ -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</Button
|
||||
>
|
||||
{/if}
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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<string, string>;
|
||||
headers: Record<string, string>;
|
||||
}
|
||||
kind: "webhook";
|
||||
body: any;
|
||||
raw_string: string | null;
|
||||
query: Record<string, string>;
|
||||
headers: Record<string, string>;
|
||||
}
|
||||
| {
|
||||
kind: "http";
|
||||
body: any,
|
||||
raw_string: string | null,
|
||||
route: string;
|
||||
path: string;
|
||||
method: string;
|
||||
params: Record<string, string>;
|
||||
query: Record<string, string>;
|
||||
headers: Record<string, string>;
|
||||
}
|
||||
kind: "http";
|
||||
body: any;
|
||||
raw_string: string | null;
|
||||
route: string;
|
||||
path: string;
|
||||
method: string;
|
||||
params: Record<string, string>;
|
||||
query: Record<string, string>;
|
||||
headers: Record<string, string>;
|
||||
}
|
||||
| {
|
||||
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<string, string[]>;
|
||||
status?: number;
|
||||
description?: string;
|
||||
length: number;
|
||||
}
|
||||
kind: "nats";
|
||||
payload: string;
|
||||
servers: string[];
|
||||
subject: string;
|
||||
headers?: Record<string, string[]>;
|
||||
status?: number;
|
||||
description?: string;
|
||||
length: number;
|
||||
}
|
||||
| {
|
||||
kind: "sqs";
|
||||
msg: string,
|
||||
queue_url: string;
|
||||
message_id?: string;
|
||||
receipt_handle?: string;
|
||||
attributes: Record<string, string>;
|
||||
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<string, string>;
|
||||
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<number>;
|
||||
user_properties?: Array<[string, string]>;
|
||||
subscription_identifiers?: Array<number>;
|
||||
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<number>;
|
||||
user_properties?: Array<[string, string]>;
|
||||
subscription_identifiers?: Array<number>;
|
||||
content_type?: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
kind: "gcp";
|
||||
payload: string,
|
||||
message_id: string;
|
||||
subscription: string;
|
||||
ordering_key?: string;
|
||||
attributes?: Record<string, string>;
|
||||
delivery_type: "push" | "pull";
|
||||
headers?: Record<string, string>;
|
||||
publish_time?: string;
|
||||
}
|
||||
kind: "gcp";
|
||||
payload: string;
|
||||
message_id: string;
|
||||
subscription: string;
|
||||
ordering_key?: string;
|
||||
attributes?: Record<string, string>;
|
||||
delivery_type: "push" | "pull";
|
||||
headers?: Record<string, string>;
|
||||
publish_time?: string;
|
||||
}
|
||||
| {
|
||||
kind: "postgres";
|
||||
transaction_type: "insert" | "update" | "delete",
|
||||
schema_name: string,
|
||||
table_name: string,
|
||||
old_row?: Record<string, any>,
|
||||
row: Record<string, any>
|
||||
}
|
||||
) {
|
||||
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,
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user