Skip to content

Commit

Permalink
feat(clerk): Update clerk SDKs to include both frontend and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
openint-bot committed Dec 24, 2024
1 parent 9e4c248 commit 6e8bb0f
Show file tree
Hide file tree
Showing 11 changed files with 37,263 additions and 1,780 deletions.
65 changes: 38 additions & 27 deletions master-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,34 +125,45 @@ export default {
`,
},
clerk: {
// eslint-disable-next-line arrow-body-style, @typescript-eslint/require-await
download: async () => {
const htmlText = await fetch(
'https://clerk.com/docs/reference/backend-api',
).then((r) => r.text())
// Some crazy redoc stuff. Seriously can they make this any harder...
const jsPath = htmlText.match(/"([a-zA-Z0-9\/-]+redocly-state.+?)"/)?.[1]
if (!jsPath) {
throw new Error('Error finding openapi spec for Clerk')
}
const jsUrl = `https://clerk.com${jsPath}`
const jsText = await fetch(jsUrl).then((r) => r.text())
const jsonText = jsText.match(/JSON.parse\((["'].+["'])\);?/)?.[1]
try {
// Doubly nested json... crazy stuff
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unsafe-argument
const jsonState = JSON.parse(JSON.parse(jsonText!))
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
const oas = jsonState.definition.data
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (!oas.openapi) {
throw new Error('Missing openapi field in Clerk OpenAPI spec')
}
return [
{name: 'clerk', type: 'raw', data: JSON.stringify(oas, null, 2)},
]
} catch (err) {
throw err
}
return [
{
name: 'clerk_backend',
url: 'https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/bapi/2024-10-01.yml',
},
{
name: 'clerk_frontend',
url: 'https://raw.githubusercontent.com/clerk/openapi-specs/refs/heads/main/fapi/2024-10-01.yml',
},
]
// const htmlText = await fetch(
// 'https://clerk.com/docs/reference/backend-api',
// ).then((r) => r.text())
// // Some crazy redoc stuff. Seriously can they make this any harder...
// const jsPath = htmlText.match(/"([a-zA-Z0-9\/-]+redocly-state.+?)"/)?.[1]
// if (!jsPath) {
// throw new Error('Error finding openapi spec for Clerk')
// }
// const jsUrl = `https://clerk.com${jsPath}`
// const jsText = await fetch(jsUrl).then((r) => r.text())
// const jsonText = jsText.match(/JSON.parse\((["'].+["'])\);?/)?.[1]
// try {
// // Doubly nested json... crazy stuff
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unsafe-argument
// const jsonState = JSON.parse(JSON.parse(jsonText!))
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
// const oas = jsonState.definition.data
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// if (!oas.openapi) {
// throw new Error('Missing openapi field in Clerk OpenAPI spec')
// }
// return [
// {name: 'clerk', type: 'raw', data: JSON.stringify(oas, null, 2)},
// ]
// } catch (err) {
// throw err
// }
},
},
chargepoint: {
Expand Down
1,905 changes: 1,671 additions & 234 deletions sdks/sdk-clerk/clerk.oas.json → sdks/sdk-clerk/clerk_backend.oas.json

Large diffs are not rendered by default.

Loading

0 comments on commit 6e8bb0f

Please sign in to comment.