fix gcp trigger types issue temporarily by disabling them on cli

This commit is contained in:
Ruben Fiszel
2025-04-17 00:15:10 +02:00
parent 87dbb14656
commit 11e3165191
+21 -8
View File
@@ -28,7 +28,7 @@ type Trigger = {
postgres: PostgresTrigger;
mqtt: MqttTrigger;
sqs: SqsTrigger;
gcp: GcpTrigger
gcp: GcpTrigger;
};
type TriggerFile<K extends TriggerType> = Omit<
@@ -62,7 +62,7 @@ async function getTrigger<K extends TriggerType>(
postgres: wmill.getPostgresTrigger,
mqtt: wmill.getMqttTrigger,
sqs: wmill.getSqsTrigger,
gcp: wmill.getGcpTrigger
gcp: wmill.getGcpTrigger,
};
const triggerFunction = triggerFunctions[triggerType];
@@ -90,7 +90,9 @@ async function updateTrigger<K extends TriggerType>(
postgres: wmill.updatePostgresTrigger,
mqtt: wmill.updateMqttTrigger,
sqs: wmill.updateSqsTrigger,
gcp: wmill.updateGcpTrigger
gcp: async (args) => {
throw new Error("GCP triggers are not supported yet");
},
};
const triggerFunction = triggerFunctions[triggerType];
await triggerFunction({ workspace, path, requestBody: trigger });
@@ -116,7 +118,9 @@ async function createTrigger<K extends TriggerType>(
postgres: wmill.createPostgresTrigger,
mqtt: wmill.createMqttTrigger,
sqs: wmill.createSqsTrigger,
gcp: wmill.createGcpTrigger
gcp: async (args) => {
throw new Error("GCP triggers are not supported yet");
},
};
const triggerFunction = triggerFunctions[triggerType];
await triggerFunction({ workspace, path, requestBody: trigger });
@@ -197,8 +201,8 @@ async function list(opts: GlobalOptions) {
workspace: workspace.workspaceId,
});
const gcpTriggers = await wmill.listGcpTriggers({
workspace: workspace.workspaceId
})
workspace: workspace.workspaceId,
});
const triggers = [
...httpTriggers.map((x) => ({ path: x.path, kind: "http" })),
...websocketTriggers.map((x) => ({ path: x.path, kind: "websocket" })),
@@ -207,7 +211,7 @@ async function list(opts: GlobalOptions) {
...postgresTriggers.map((x) => ({ path: x.path, kind: "postgres" })),
...mqttTriggers.map((x) => ({ path: x.path, kind: "mqtt" })),
...sqsTriggers.map((x) => ({ path: x.path, kind: "sqs" })),
...gcpTriggers.map((x) => ({ path: x.path, kind: "gcp" }))
...gcpTriggers.map((x) => ({ path: x.path, kind: "gcp" })),
];
new Table()
@@ -221,7 +225,16 @@ async function list(opts: GlobalOptions) {
function checkIfValidTrigger(kind: string | undefined): kind is TriggerType {
if (
kind &&
["http", "websocket", "kafka", "nats", "postgres", "mqtt", "sqs", "gcp"].includes(kind)
[
"http",
"websocket",
"kafka",
"nats",
"postgres",
"mqtt",
"sqs",
"gcp",
].includes(kind)
) {
return true;
} else {