From 94aab166b5a5018d847f5c5ec709727f704f12a9 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 1 Dec 2024 12:52:48 +1030 Subject: [PATCH] chore: Remove service metadata --- control-plane/src/modules/contract.ts | 17 ------------- control-plane/src/modules/data.ts | 20 --------------- control-plane/src/modules/router.ts | 25 ------------------- control-plane/src/modules/service-metadata.ts | 23 ----------------- 4 files changed, 85 deletions(-) diff --git a/control-plane/src/modules/contract.ts b/control-plane/src/modules/contract.ts index 9be2f63b..98cc5888 100644 --- a/control-plane/src/modules/contract.ts +++ b/control-plane/src/modules/contract.ts @@ -756,23 +756,6 @@ export const definition = { messageId: z.string(), }), }, - storeServiceMetadata: { - method: "PUT", - path: "/clusters/:clusterId/services/:service/keys/:key", - headers: z.object({ authorization: z.string() }), - body: z.object({ - value: z.string(), - }), - pathParams: z.object({ - clusterId: z.string(), - service: z.string(), - key: z.string(), - }), - responses: { - 204: z.undefined(), - 401: z.undefined(), - }, - }, getClusterExport: { method: "GET", path: "/clusters/:clusterId/export", diff --git a/control-plane/src/modules/data.ts b/control-plane/src/modules/data.ts index d0df7a0d..70c1abe9 100644 --- a/control-plane/src/modules/data.ts +++ b/control-plane/src/modules/data.ts @@ -220,26 +220,6 @@ export const integrations = pgTable( }), ); -export const serviceMetadata = pgTable( - "service_metadata", - { - cluster_id: varchar("cluster_id") - .references(() => clusters.id) - .notNull(), - service: varchar("service", { length: 1024 }).notNull(), - key: text("status", { - enum: ["incoming-webhook-token"], - }).notNull(), - value: text("value").notNull(), - }, - (table) => ({ - pk: primaryKey({ - columns: [table.cluster_id, table.service, table.key], - name: "service_metadata_cluster_id_service_key", - }), - }), -); - export const workflowMetadata = pgTable( "workflow_metadata", { diff --git a/control-plane/src/modules/router.ts b/control-plane/src/modules/router.ts index 1b9a2b7b..0bbd1f3b 100644 --- a/control-plane/src/modules/router.ts +++ b/control-plane/src/modules/router.ts @@ -8,7 +8,6 @@ import { contract } from "./contract"; import * as data from "./data"; import * as management from "./management"; import * as events from "./observability/events"; -import { storeServiceMetadata } from "./service-metadata"; import { assertGenericMessage, editHumanMessage, @@ -339,30 +338,6 @@ export const router = initServer().router(contract, { body: messages.upserted, }; }, - storeServiceMetadata: async (request) => { - const machine = request.request.getAuth().isMachine(); - - const { clusterId, service, key } = request.params; - const { value } = request.body; - - if (machine.clusterId !== clusterId) { - return { - status: 401, - }; - } - - await storeServiceMetadata({ - clusterId, - key, - value, - service, - }); - - return { - status: 204, - body: undefined, - }; - }, getClusterExport: async (request) => { const { clusterId } = request.params; diff --git a/control-plane/src/modules/service-metadata.ts b/control-plane/src/modules/service-metadata.ts index 97598bc8..dadd2f6f 100644 --- a/control-plane/src/modules/service-metadata.ts +++ b/control-plane/src/modules/service-metadata.ts @@ -38,26 +38,3 @@ export const storeServiceMetadata = async ({ }); }; -export const getServiceMetadata = async ({ - clusterId, - service, - key, -}: { - service: string; - clusterId: string; - key: string; -}) => { - return db - .select({ - key: serviceMetadata.key, - value: serviceMetadata.value, - }) - .from(serviceMetadata) - .where( - and( - eq(serviceMetadata.cluster_id, clusterId), - eq(serviceMetadata.service, service), - eq(serviceMetadata.key, keySchema.parse(key)), - ), - ); -};