History

remove legacy compatibility codepaths

Rhys Sullivan committed 7 months ago

Commit ddd3aaa1 parent e2977a021 files · +111 −1158Browse files

Showing the changes to plugins (5 of 21 files). Show all

Unified · Split

5 files
  1. plugins/google-discovery/sdk/index.ts +0 −50
  2. plugins/graphql/sdk/index.ts +0 −43
  3. plugins/mcp/sdk/index.ts +0 −56
  4. plugins/mcp/sdk/tools.test.ts +1 −1
  5. plugins/openapi/sdk/index.ts +0 −46
plugins/google-discovery/sdk/index.ts+0−50
@@ -18,7 +18,6 @@ import { · 17 unmodified lines
1818 } from "@executor/platform-sdk/plugins";
1919 import {
2020 createPluginLocalConfigEntrySchema,
21− decodeCurrentOrLegacyLocalConfigAuth,
2221 pluginLocalConfigSourceFromConfig,
2322 SecretMaterialDeleterService,
2423 SecretMaterialResolverService,
@@ -103,29 +102,6 @@ const decodeGoogleDiscoveryCurrentLocalConfigOption = Schema.decodeUnknownOption · 78 unmodified lines
103102 config: GoogleDiscoveryStoredSourceDataSchema,
104103 }),
105104 );
106−const decodeGoogleDiscoveryLegacyLocalConfigOption = Schema.decodeUnknownOption(
107− Schema.Struct({
108− kind: Schema.Literal(GOOGLE_DISCOVERY_SOURCE_KIND),
109− name: Schema.optional(Schema.String),
110− namespace: Schema.optional(Schema.String),
111− enabled: Schema.optional(Schema.Boolean),
112− connection: Schema.Struct({
113− endpoint: Schema.optional(Schema.NullOr(Schema.String)),
114− auth: Schema.optional(Schema.Unknown),
115− }),
116− binding: Schema.Struct({
117− service: Schema.String,
118− version: Schema.String,
119− discoveryUrl: Schema.optional(Schema.NullOr(Schema.String)),
120− defaultHeaders: Schema.optional(
121− Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })),
122− ),
123− scopes: Schema.optional(Schema.Array(Schema.String)),
124− }),
125− config: Schema.optional(Schema.Unknown),
126− }),
127−);
128−
129105 export type GoogleDiscoverySourceStorage = {
130106 get: (input: {
131107 scopeId: string;
@@ -582,32 +558,6 @@ const googleDiscoveryStoredSourceDataFromLocalConfig = (input: { · 450 unmodified lines
582558 return current.value.config;
583559 }
584560
585− const legacy = decodeGoogleDiscoveryLegacyLocalConfigOption(input.config);
586− if (Option.isSome(legacy)) {
587− return storedSourceDataFromInput({
588− name:
589− legacy.value.name
590− ?? `${legacy.value.binding.service} ${legacy.value.binding.version}`,
591− service: legacy.value.binding.service,
592− version: legacy.value.binding.version,
593− discoveryUrl: legacy.value.binding.discoveryUrl ?? null,
594− defaultHeaders: legacy.value.binding.defaultHeaders ?? null,
595− scopes: legacy.value.binding.scopes ?? [],
596− auth: decodeCurrentOrLegacyLocalConfigAuth({
597− auth: legacy.value.connection.auth,
598− authSchema: GoogleDiscoveryConnectionAuthSchema,
599− loadedConfig: input.loadedConfig,
600− onLegacySecretRef: (tokenSecretRef) => ({
601− kind: "bearer",
602− tokenSecretRef,
603− }),
604− fallback: {
605− kind: "none",
606− },
607− }),
608− });
609− }
610−
611561 throw new Error("Unsupported Google Discovery local source config.");
612562 };
613563
plugins/graphql/sdk/index.ts+0−43
@@ -24,7 +24,6 @@ import { · 23 unmodified lines
2424 import {
2525 SecretMaterialResolverService,
2626 createPluginLocalConfigEntrySchema,
27− decodeCurrentOrLegacyLocalConfigAuth,
2827 pluginLocalConfigSourceFromConfig,
2928 provideExecutorRuntime,
3029 runtimeEffectError,
@@ -158,25 +157,6 @@ const decodeGraphqlCurrentLocalConfigOption = Schema.decodeUnknownOption( · 127 unmodified lines
158157 }),
159158 );
160159
161−const decodeGraphqlLegacyLocalConfigOption = Schema.decodeUnknownOption(
162− Schema.Struct({
163− kind: Schema.Literal("graphql"),
164− name: Schema.optional(Schema.String),
165− namespace: Schema.optional(Schema.String),
166− enabled: Schema.optional(Schema.Boolean),
167− connection: Schema.Struct({
168− endpoint: Schema.String,
169− auth: Schema.optional(Schema.Unknown),
170− }),
171− binding: Schema.Struct({
172− defaultHeaders: Schema.optional(
173− Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })),
174− ),
175− }),
176− config: Schema.optional(Schema.Unknown),
177− }),
178−);
179−
180160 const withoutUndefinedEntries = (
181161 record: Readonly<Record<string, unknown>>,
182162 ): Record<string, unknown> =>
@@ -363,29 +343,6 @@ const graphqlStoredSourceDataFromLocalConfig = (input: { · 180 unmodified lines
363343 return normalizeStoredSourceData(current.value.config);
364344 }
365345
366− const legacy = decodeGraphqlLegacyLocalConfigOption(input.config);
367− if (Option.isSome(legacy)) {
368− return storedSourceDataFromInput({
369− name: legacy.value.name ?? "GraphQL",
370− endpoint: legacy.value.connection.endpoint,
371− defaultHeaders: legacy.value.binding.defaultHeaders ?? null,
372− auth: decodeCurrentOrLegacyLocalConfigAuth({
373− auth: legacy.value.connection.auth,
374− authSchema: GraphqlConnectionAuthSchema,
375− loadedConfig: input.loadedConfig,
376− onLegacySecretRef: (tokenSecretRef) => ({
377− kind: "bearer",
378− tokenSecretRef,
379− headerName: null,
380− prefix: null,
381− }),
382− fallback: {
383− kind: "none",
384− },
385− }),
386− });
387− }
388−
389346 throw new Error("Unsupported GraphQL local source config.");
390347 };
391348
plugins/mcp/sdk/index.ts+0−56
@@ -249,37 +249,12 @@ const normalizeStringArray = ( · 248 unmodified lines
249249 return normalized.length > 0 ? normalized : null;
250250 };
251251
252−const decodeMcpAuthOption = Schema.decodeUnknownOption(McpConnectionAuthSchema);
253252 const decodeMcpCurrentLocalConfigOption = Schema.decodeUnknownOption(
254253 createPluginLocalConfigEntrySchema({
255254 kind: "mcp",
256255 config: McpStoredSourceDataSchema,
257256 }),
258257 );
259−const decodeMcpLegacyLocalConfigOption = Schema.decodeUnknownOption(
260− Schema.Struct({
261− kind: Schema.Literal("mcp"),
262− name: Schema.optional(Schema.String),
263− namespace: Schema.optional(Schema.String),
264− enabled: Schema.optional(Schema.Boolean),
265− connection: Schema.optional(
266− Schema.Struct({
267− endpoint: Schema.optional(Schema.NullOr(Schema.String)),
268− auth: Schema.optional(Schema.Unknown),
269− }),
270− ),
271− binding: Schema.Struct({
272− transport: Schema.optional(Schema.NullOr(SourceTransportSchema)),
273− queryParams: Schema.optional(Schema.NullOr(StringMapSchema)),
274− headers: Schema.optional(Schema.NullOr(StringMapSchema)),
275− command: Schema.optional(Schema.NullOr(Schema.String)),
276− args: Schema.optional(Schema.NullOr(StringArraySchema)),
277− env: Schema.optional(Schema.NullOr(StringMapSchema)),
278− cwd: Schema.optional(Schema.NullOr(Schema.String)),
279− }),
280− config: Schema.optional(Schema.Unknown),
281− }),
282−);
283258
284259 const normalizeStoredSourceData = (
285260 input: McpConnectInput | McpSourceConfigPayload,
@@ -399,37 +374,6 @@ const mcpStoredSourceDataFromLocalConfig = ( · 113 unmodified lines
399374 return Effect.succeed(current.value.config);
400375 }
401376
402− const legacy = decodeMcpLegacyLocalConfigOption(config);
403− if (Option.isSome(legacy)) {
404− const auth = decodeMcpAuthOption(legacy.value.connection?.auth);
405− if (
406− legacy.value.connection?.auth !== undefined &&
407− Option.isNone(auth)
408− ) {
409− return runtimeEffectError(
410− "plugins/mcp/sdk",
411− "Unsupported MCP auth configuration in local source config.",
412− );
413− }
414−
415− return normalizeStoredSourceData({
416− name: legacy.value.name ?? "MCP",
417− endpoint: legacy.value.connection?.endpoint ?? null,
418− transport: legacy.value.binding.transport ?? null,
419− queryParams: legacy.value.binding.queryParams ?? null,
420− headers: legacy.value.binding.headers ?? null,
421− command: legacy.value.binding.command ?? null,
422− args: legacy.value.binding.args ?? null,
423− env: legacy.value.binding.env ?? null,
424− cwd: legacy.value.binding.cwd ?? null,
425− auth: Option.isSome(auth)
426− ? auth.value
427− : {
428− kind: "none",
429− },
430− });
431− }
432−
433377 return runtimeEffectError(
434378 "plugins/mcp/sdk",
435379 "Unsupported MCP local source config.",
plugins/mcp/sdk/tools.test.ts+1−1
@@ -500,7 +500,7 @@ describe("codemode-mcp", () => { · 499 unmodified lines
500500 action: "accept" as const,
501501 };
502502 }),
503− path: "executor.sources.add" as ToolPath,
503+ path: "executor.mcp.createSource" as ToolPath,
504504 sourceKey: "executor",
505505 args: {
506506 endpoint: "https://example.com/mcp",
plugins/openapi/sdk/index.ts+0−46
@@ -19,7 +19,6 @@ import { · 18 unmodified lines
1919 } from "@executor/platform-sdk/plugins";
2020 import {
2121 createPluginLocalConfigEntrySchema,
22− decodeCurrentOrLegacyLocalConfigAuth,
2322 pluginLocalConfigSourceFromConfig,
2423 runtimeEffectError,
2524 SecretMaterialResolverService,
@@ -163,26 +162,6 @@ const decodeOpenApiCurrentLocalConfigOption = Schema.decodeUnknownOption( · 137 unmodified lines
163162 }),
164163 );
165164
166−const decodeOpenApiLegacyLocalConfigOption = Schema.decodeUnknownOption(
167− Schema.Struct({
168− kind: Schema.Literal("openapi"),
169− name: Schema.optional(Schema.String),
170− namespace: Schema.optional(Schema.String),
171− enabled: Schema.optional(Schema.Boolean),
172− connection: Schema.Struct({
173− endpoint: Schema.optional(Schema.NullOr(Schema.String)),
174− auth: Schema.optional(Schema.Unknown),
175− }),
176− binding: Schema.Struct({
177− specUrl: Schema.String,
178− defaultHeaders: Schema.optional(
179− Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })),
180− ),
181− }),
182− config: Schema.optional(Schema.Unknown),
183− }),
184−);
185−
186165 const createStoredSourceData = (
187166 input: OpenApiConnectInput,
188167 ): OpenApiStoredSourceData => ({
@@ -224,31 +203,6 @@ const openApiStoredSourceDataFromLocalConfig = (input: { · 35 unmodified lines
224203 });
225204 }
226205
227− const legacy = decodeOpenApiLegacyLocalConfigOption(input.config);
228− if (Option.isSome(legacy)) {
229− return normalizeStoredSourceData({
230− specUrl: legacy.value.binding.specUrl.trim(),
231− baseUrl: legacy.value.connection.endpoint?.trim() || null,
232− auth: decodeCurrentOrLegacyLocalConfigAuth({
233− auth: legacy.value.connection.auth,
234− authSchema: OpenApiConnectionAuthSchema,
235− loadedConfig: input.loadedConfig,
236− onLegacySecretRef: (tokenSecretRef) => ({
237− kind: "bearer",
238− tokenSecretRef,
239− headerName: null,
240− prefix: null,
241− }),
242− fallback: {
243− kind: "none",
244− },
245− }),
246− defaultHeaders: legacy.value.binding.defaultHeaders ?? null,
247− etag: null,
248− lastSyncAt: null,
249− });
250− }
251−
252206 throw new Error("Unsupported OpenAPI local source config.");
253207 };
254208