| 8 | const larkHost = /(^|\.)larksuite\.com$/; |
| 9 | |
| 10 | function pair(appId: unknown, appSecret: unknown, source: string) { |
| 11 | const id = typeof appId === 'string' ? appId : ''; |
| 12 | const secret = typeof appSecret === 'string' ? appSecret : ''; |
| 13 | if (id && secret) { |
| 14 | return { appId: id, appSecret: secret }; |
| 15 | } |
| 16 | if (id || secret) { |
| 17 | throw new Error(`Feishu Bitable source ${source} requires both appId and appSecret`); |
| 18 | } |
| 19 | return undefined; |
| 20 | } |
| 21 | |
| 22 | function ask(label: string, echo: boolean) { |
| 23 | process.stderr.write(label); |