| 20 | } |
| 21 | |
| 22 | const mergeStringRecords = ( |
| 23 | ...items: ReadonlyArray<Record<string, string> | undefined> |
| 24 | ): Record<string, string> | undefined => { |
| 25 | const defined = items.filter((item): item is Record<string, string> => item !== undefined) |
| 26 | if (defined.length === 0) return undefined |
| 27 | if (defined.length === 1) return defined[0] |
| 28 | const result = Object.fromEntries( |
| 29 | defined.flatMap((item) => |
| 30 | Object.entries(item).filter((entry): entry is [string, string] => entry[1] !== undefined), |
| 31 | ), |
| 32 | ) |
| 33 | return Object.keys(result).length === 0 ? undefined : result |
| 34 | } |
| 35 | |
| 36 | export const ProviderOptions = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown)) |
| 37 | export type ProviderOptions = Schema.Schema.Type<typeof ProviderOptions> |