Showing the changes to plugins/google-discovery (1 of 21 files). Show all
Unified · Split
| @@ -18,7 +18,6 @@ import { · 17 unmodified lines | |||
| 18 | } from "@executor/platform-sdk/plugins"; | 18 | } from "@executor/platform-sdk/plugins"; |
| 19 | import { | 19 | import { |
| 20 | createPluginLocalConfigEntrySchema, | 20 | createPluginLocalConfigEntrySchema, |
| 21 | decodeCurrentOrLegacyLocalConfigAuth, | ||
| 22 | pluginLocalConfigSourceFromConfig, | 21 | pluginLocalConfigSourceFromConfig, |
| 23 | SecretMaterialDeleterService, | 22 | SecretMaterialDeleterService, |
| 24 | SecretMaterialResolverService, | 23 | SecretMaterialResolverService, |
| @@ -103,29 +102,6 @@ const decodeGoogleDiscoveryCurrentLocalConfigOption = Schema.decodeUnknownOption · 78 unmodified lines | |||
| 103 | config: GoogleDiscoveryStoredSourceDataSchema, | 102 | config: GoogleDiscoveryStoredSourceDataSchema, |
| 104 | }), | 103 | }), |
| 105 | ); | 104 | ); |
| 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 | |||
| 129 | export type GoogleDiscoverySourceStorage = { | 105 | export type GoogleDiscoverySourceStorage = { |
| 130 | get: (input: { | 106 | get: (input: { |
| 131 | scopeId: string; | 107 | scopeId: string; |
| @@ -582,32 +558,6 @@ const googleDiscoveryStoredSourceDataFromLocalConfig = (input: { · 450 unmodified lines | |||
| 582 | return current.value.config; | 558 | return current.value.config; |
| 583 | } | 559 | } |
| 584 | 560 | ||
| 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 | |||
| 611 | throw new Error("Unsupported Google Discovery local source config."); | 561 | throw new Error("Unsupported Google Discovery local source config."); |
| 612 | }; | 562 | }; |
| 613 | 563 | ||