Showing the changes to plugins/openapi (1 of 21 files). Show all
Unified · Split
| @@ -19,7 +19,6 @@ import { · 18 unmodified lines | |||
| 19 | } from "@executor/platform-sdk/plugins"; | 19 | } from "@executor/platform-sdk/plugins"; |
| 20 | import { | 20 | import { |
| 21 | createPluginLocalConfigEntrySchema, | 21 | createPluginLocalConfigEntrySchema, |
| 22 | decodeCurrentOrLegacyLocalConfigAuth, | ||
| 23 | pluginLocalConfigSourceFromConfig, | 22 | pluginLocalConfigSourceFromConfig, |
| 24 | runtimeEffectError, | 23 | runtimeEffectError, |
| 25 | SecretMaterialResolverService, | 24 | SecretMaterialResolverService, |
| @@ -163,26 +162,6 @@ const decodeOpenApiCurrentLocalConfigOption = Schema.decodeUnknownOption( · 137 unmodified lines | |||
| 163 | }), | 162 | }), |
| 164 | ); | 163 | ); |
| 165 | 164 | ||
| 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 | |||
| 186 | const createStoredSourceData = ( | 165 | const createStoredSourceData = ( |
| 187 | input: OpenApiConnectInput, | 166 | input: OpenApiConnectInput, |
| 188 | ): OpenApiStoredSourceData => ({ | 167 | ): OpenApiStoredSourceData => ({ |
| @@ -224,31 +203,6 @@ const openApiStoredSourceDataFromLocalConfig = (input: { · 35 unmodified lines | |||
| 224 | }); | 203 | }); |
| 225 | } | 204 | } |
| 226 | 205 | ||
| 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 | |||
| 252 | throw new Error("Unsupported OpenAPI local source config."); | 206 | throw new Error("Unsupported OpenAPI local source config."); |
| 253 | }; | 207 | }; |
| 254 | 208 | ||