fix: address codex review findings across new CLI tools
- supermetrics: fix query endpoint /query → /query/data/json - airops: fix base URL /v1 → /public_api/v1 - zoominfo: fix auth --dry-run leaking real JWT, add response validation - outreach: remove parseInt() on JSON:API string IDs (caused NaN) - similarweb: add encodeURIComponent on domain in all URL paths - coupler: fix dry-run auth mask from '***' to 'Bearer ***' - clay: allow name-based enrich (--first-name + --last-name + --domain) - pendo.md: fix guide state from 'published' to 'public' - close.md: fix rate limit header names to ratelimit-* Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -22,11 +22,16 @@ async function authenticate() {
|
||||
body: JSON.stringify({ username, password }),
|
||||
})
|
||||
const text = await res.text()
|
||||
if (!res.ok) {
|
||||
throw new Error(`Authentication failed (${res.status}): ${text}`)
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(text)
|
||||
if (!data.jwt) throw new Error('No JWT in response')
|
||||
ACCESS_TOKEN = data.jwt
|
||||
return ACCESS_TOKEN
|
||||
} catch {
|
||||
} catch (e) {
|
||||
if (e.message === 'No JWT in response') throw e
|
||||
throw new Error(`Authentication failed: ${text}`)
|
||||
}
|
||||
}
|
||||
@@ -82,6 +87,10 @@ async function main() {
|
||||
|
||||
switch (cmd) {
|
||||
case 'auth': {
|
||||
if (args['dry-run']) {
|
||||
result = { _dry_run: true, action: 'authenticate', url: `${BASE_URL}/authenticate`, jwt: '***' }
|
||||
break
|
||||
}
|
||||
const token = await authenticate()
|
||||
result = { jwt: token }
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user