Files
qqq-cli/scripts/fix-recursive-types.mjs
james.maesandClaude Opus 5.5 ea79ddeb78 feat: reference CLI, generated UI API client, conformance suite and dev IdP
- @qrun-io/qqq-ui-api-client: typed client generated (openapi-typescript +
  openapi-fetch) from the merged UI API document; device-flow sign-in, refresh,
  UiApiError (BasicErrorResponseV1), SSE reader
- @qrun-io/qqq-cli: qqq login/whoami/apps/tables/query/get/run/jobs/tail,
  only through /qqq/v1 with Authorization: Bearer
- @qrun-io/qqq-ui-api-conformance: black-box suite + qqq-dev-idp
- scripts/merge-spec.mjs, Prism mock, CI and GitHub Packages publish workflows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 11:47:12 -05:00

26 lines
959 B
JavaScript

#!/usr/bin/env node
/*
* Copyright 2026 QRun.IO, Inc.
* Licensed under the Apache License, Version 2.0 (see LICENSE).
*/
// openapi-typescript emits a directly self-recursive union (e.g. SqlWorkbenchValueV1, whose arrays
// hold more values) as a one-line member that TypeScript rejects (TS2502). Replace the self
// reference on such a line with `unknown`, keeping the rest of the type.
import { readFileSync, writeFileSync } from 'node:fs'
const file = process.argv[2]
const lines = readFileSync(file, 'utf8').split('\n')
let fixed = 0
for (let i = 0; i < lines.length; i++) {
const match = /^(\s+)([A-Za-z0-9_]+): (.*);$/.exec(lines[i])
if (!match) continue
const self = `components["schemas"]["${match[2]}"]`
if (match[3].includes(self)) {
lines[i] = `${match[1]}${match[2]}: ${match[3].split(self).join('unknown')};`
fixed++
}
}
writeFileSync(file, lines.join('\n'))
console.log(`fixed ${fixed} self-recursive type(s) in ${file}`)