feat: ability to refresh tokens for oauth flows (#4302)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
@@ -15,7 +15,7 @@ export {
|
||||
} from "./v/2"
|
||||
export { GQLHeader } from "./v/6"
|
||||
|
||||
export { HoppGQLAuth, HoppGQLAuthOAuth2 } from "./v/5"
|
||||
export { HoppGQLAuth, HoppGQLAuthOAuth2 } from "./v/6"
|
||||
|
||||
export { HoppGQLAuthAPIKey } from "./v/4"
|
||||
|
||||
|
||||
@@ -1,7 +1,33 @@
|
||||
import { defineVersion } from "verzod"
|
||||
import { z } from "zod"
|
||||
|
||||
import { V5_SCHEMA } from "./5"
|
||||
import { HoppRESTAuthOAuth2 } from "./../../rest/v/7"
|
||||
import {
|
||||
HoppGQLAuthBasic,
|
||||
HoppGQLAuthBearer,
|
||||
HoppGQLAuthInherit,
|
||||
HoppGQLAuthNone,
|
||||
} from "./2"
|
||||
import { HoppGQLAuthAPIKey } from "./4"
|
||||
|
||||
export { HoppRESTAuthOAuth2 as HoppGQLAuthOAuth2 } from "../../rest/v/7"
|
||||
|
||||
export const HoppGQLAuth = z
|
||||
.discriminatedUnion("authType", [
|
||||
HoppGQLAuthNone,
|
||||
HoppGQLAuthInherit,
|
||||
HoppGQLAuthBasic,
|
||||
HoppGQLAuthBearer,
|
||||
HoppGQLAuthAPIKey,
|
||||
HoppRESTAuthOAuth2, // both rest and gql have the same auth type for oauth2
|
||||
])
|
||||
.and(
|
||||
z.object({
|
||||
authActive: z.boolean(),
|
||||
})
|
||||
)
|
||||
|
||||
export type HoppGQLAuth = z.infer<typeof HoppGQLAuth>
|
||||
|
||||
export const GQLHeader = z.object({
|
||||
key: z.string().catch(""),
|
||||
@@ -15,6 +41,7 @@ export type GQLHeader = z.infer<typeof GQLHeader>
|
||||
export const V6_SCHEMA = V5_SCHEMA.extend({
|
||||
v: z.literal(6),
|
||||
headers: z.array(GQLHeader).catch([]),
|
||||
auth: HoppGQLAuth,
|
||||
})
|
||||
|
||||
export default defineVersion({
|
||||
|
||||
Reference in New Issue
Block a user