@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
124 lines • 4.05 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
export const AuthTokenScopesOrigin = {
App: "app",
Apple: "apple",
Bitbucket: "bitbucket",
Chatgpt: "chatgpt",
Email: "email",
Emu: "emu",
Github: "github",
GithubWebhook: "github-webhook",
Gitlab: "gitlab",
Google: "google",
Invite: "invite",
Manual: "manual",
Otp: "otp",
Passkey: "passkey",
Saml: "saml",
Sms: "sms",
TokenExchangeOidc: "token-exchange-oidc",
};
/**
* Possible step-up auth origins
*/
export const AuthTokenScopes1Origin = {
EmailOtp: "email-otp",
Otp: "otp",
RecoveryCode: "recovery-code",
Totp: "totp",
Webauthn: "webauthn",
};
export const ScopesOrigin = {
App: "app",
Apple: "apple",
Bitbucket: "bitbucket",
Chatgpt: "chatgpt",
Email: "email",
Emu: "emu",
Github: "github",
GithubWebhook: "github-webhook",
Gitlab: "gitlab",
Google: "google",
Invite: "invite",
Manual: "manual",
Otp: "otp",
Passkey: "passkey",
Saml: "saml",
Sms: "sms",
TokenExchangeOidc: "token-exchange-oidc",
};
/** @internal */
export const AuthTokenScopesOrigin$inboundSchema = z.nativeEnum(AuthTokenScopesOrigin);
/** @internal */
export const Scopes2$inboundSchema = z.object({
type: types.literal("team"),
teamId: types.string(),
origin: types.optional(AuthTokenScopesOrigin$inboundSchema),
createdAt: types.number(),
expiresAt: types.optional(types.number()),
});
export function scopes2FromJSON(jsonString) {
return safeParse(jsonString, (x) => Scopes2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Scopes2' from JSON`);
}
/** @internal */
export const AuthTokenScopes1Origin$inboundSchema = z.nativeEnum(AuthTokenScopes1Origin);
/** @internal */
export const Sudo$inboundSchema = z
.object({
origin: AuthTokenScopes1Origin$inboundSchema,
verifiedAt: types.optional(types.number()),
expiresAt: types.number(),
});
export function sudoFromJSON(jsonString) {
return safeParse(jsonString, (x) => Sudo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Sudo' from JSON`);
}
/** @internal */
export const ScopesOrigin$inboundSchema = z.nativeEnum(ScopesOrigin);
/** @internal */
export const Scopes1$inboundSchema = z.object({
type: types.literal("user"),
sudo: types.optional(z.lazy(() => Sudo$inboundSchema)),
origin: types.optional(ScopesOrigin$inboundSchema),
createdAt: types.number(),
expiresAt: types.optional(types.number()),
});
export function scopes1FromJSON(jsonString) {
return safeParse(jsonString, (x) => Scopes1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Scopes1' from JSON`);
}
/** @internal */
export const Scopes$inboundSchema = z
.union([
z.lazy(() => Scopes1$inboundSchema),
z.lazy(() => Scopes2$inboundSchema),
]);
export function scopesFromJSON(jsonString) {
return safeParse(jsonString, (x) => Scopes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Scopes' from JSON`);
}
/** @internal */
export const AuthToken$inboundSchema = z.object({
id: types.string(),
name: types.string(),
type: types.string(),
prefix: types.optional(types.string()),
suffix: types.optional(types.string()),
origin: types.optional(types.string()),
scopes: types.optional(z.array(z.union([
z.lazy(() => Scopes1$inboundSchema),
z.lazy(() => Scopes2$inboundSchema),
]))),
createdAt: types.number(),
activeAt: types.number(),
expiresAt: types.optional(types.number()),
revokedAt: types.optional(types.number()),
leakedAt: types.optional(types.number()),
leakedUrl: types.optional(types.string()),
});
export function authTokenFromJSON(jsonString) {
return safeParse(jsonString, (x) => AuthToken$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthToken' from JSON`);
}
//# sourceMappingURL=authtoken.js.map