(key?: string)
| 740 | } |
| 741 | |
| 742 | function getApiKey(key?: string) { |
| 743 | const apiKey = key ?? env.TRIGGER_API_KEY; |
| 744 | |
| 745 | if (!apiKey) { |
| 746 | return { status: "missing" as const }; |
| 747 | } |
| 748 | |
| 749 | // Validate the api_key format (should be tr_{env}_XXXXX) |
| 750 | const isValid = apiKey.match(/^tr_[a-z]+_[a-zA-Z0-9]+$/); |
| 751 | |
| 752 | if (!isValid) { |
| 753 | return { status: "invalid" as const, apiKey }; |
| 754 | } |
| 755 | |
| 756 | return { status: "valid" as const, apiKey }; |
| 757 | } |
| 758 | |
| 759 | type VersionedResponseBodyMap = { |
| 760 | [key: string]: z.ZodTypeAny; |
no outgoing calls
no test coverage detected
searching dependent graphs…