UNPKG

@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>

448 lines 17.8 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../lib/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; /** * Where Slack exposes the shortcut. */ export const ConnectConnectorCreateData8Type = { Global: "global", Message: "message", }; /** * GitHub App owner type. */ export const ConnectConnectorCreateDataType = { UserLower: "user", OrganizationLower: "organization", UserMixed: "User", OrganizationMixed: "Organization", }; /** * Which subject the connector issues tokens for. Defaults to \"app\" (connector-level keys). \"user\" connectors store no connector-level values; each user supplies their own key during authorization. */ export const ConnectConnectorCreateDataSubjectType = { App: "app", User: "user", }; /** * Intended key use: signing or encryption. */ export const Use = { Sig: "sig", Enc: "enc", }; /** @internal */ export const TypePhoton$outboundSchema = z.object({ projectId: z.string(), projectSecret: z.string(), webhookSecret: z.string().optional(), }); export function typePhotonToJSON(typePhoton) { return JSON.stringify(TypePhoton$outboundSchema.parse(typePhoton)); } /** @internal */ export const TypeSnowflakeWif$outboundSchema = z.object({ clientName: z.string().optional(), accountIdentifier: z.string().optional(), extras: z.record(z.any()).optional(), }); export function typeSnowflakeWifToJSON(typeSnowflakeWif) { return JSON.stringify(TypeSnowflakeWif$outboundSchema.parse(typeSnowflakeWif)); } /** @internal */ export const TypeSnowflake$outboundSchema = z.object({ clientName: z.string().optional(), accountIdentifier: z.string(), defaultSessionRole: z.string().optional(), extras: z.record(z.any()).optional(), }); export function typeSnowflakeToJSON(typeSnowflake) { return JSON.stringify(TypeSnowflake$outboundSchema.parse(typeSnowflake)); } /** @internal */ export const SlackTeam$outboundSchema = z.object({ id: z.string(), name: z.string().optional(), domain: z.string().optional(), }); export function slackTeamToJSON(slackTeam) { return JSON.stringify(SlackTeam$outboundSchema.parse(slackTeam)); } /** @internal */ export const SlashCommands$outboundSchema = z.object({ command: z.string(), description: z.string(), usageHint: z.string().optional(), shouldEscape: z.boolean().optional(), }); export function slashCommandsToJSON(slashCommands) { return JSON.stringify(SlashCommands$outboundSchema.parse(slashCommands)); } /** @internal */ export const ConnectConnectorCreateData8Type$outboundSchema = z.nativeEnum(ConnectConnectorCreateData8Type); /** @internal */ export const Shortcuts$outboundSchema = z.object({ type: ConnectConnectorCreateData8Type$outboundSchema, name: z.string(), callbackId: z.string(), description: z.string(), }); export function shortcutsToJSON(shortcuts) { return JSON.stringify(Shortcuts$outboundSchema.parse(shortcuts)); } /** @internal */ export const TypeSlack$outboundSchema = z.object({ appId: z.string(), appName: z.string(), clientId: z.string(), clientSecret: z.string(), slackTeam: z.lazy(() => SlackTeam$outboundSchema).optional(), signingSecret: z.string().optional(), verificationToken: z.string().optional(), botScopes: z.array(z.string()).optional(), userScopes: z.array(z.string()).optional(), slashCommands: z.array(z.lazy(() => SlashCommands$outboundSchema)).optional(), shortcuts: z.array(z.lazy(() => Shortcuts$outboundSchema)).optional(), extras: z.record(z.any()).optional(), }); export function typeSlackToJSON(typeSlack) { return JSON.stringify(TypeSlack$outboundSchema.parse(typeSlack)); } /** @internal */ export const TypeSendblue$outboundSchema = z.object({ apiKeyId: z.string(), apiSecretKey: z.string(), phoneNumbers: z.array(z.string()).optional(), }); export function typeSendblueToJSON(typeSendblue) { return JSON.stringify(TypeSendblue$outboundSchema.parse(typeSendblue)); } /** @internal */ export const TypeSalesforce$outboundSchema = z.object({ consumerKey: z.string(), consumerSecret: z.string(), loginHost: z.string(), }); export function typeSalesforceToJSON(typeSalesforce) { return JSON.stringify(TypeSalesforce$outboundSchema.parse(typeSalesforce)); } /** @internal */ export const TypeLinq$outboundSchema = z.object({ apiToken: z.string(), phoneNumbers: z.array(z.string()).optional(), }); export function typeLinqToJSON(typeLinq) { return JSON.stringify(TypeLinq$outboundSchema.parse(typeLinq)); } /** @internal */ export const OwnerOrganization$outboundSchema = z.object({ id: z.string(), slug: z.string(), name: z.string(), logoUrl: z.nullable(z.string()).optional(), }); export function ownerOrganizationToJSON(ownerOrganization) { return JSON.stringify(OwnerOrganization$outboundSchema.parse(ownerOrganization)); } /** @internal */ export const Application$outboundSchema = z.object({ id: z.string(), clientId: z.string(), name: z.string(), description: z.nullable(z.string()).optional(), developer: z.nullable(z.string()).optional(), developerUrl: z.nullable(z.string()).optional(), imageUrl: z.nullable(z.string()).optional(), redirectUris: z.array(z.string()).optional(), distribution: z.nullable(z.string()).optional(), webhookResourceTypes: z.array(z.string()).optional(), webhookUrl: z.nullable(z.string()).optional(), webhookEnabled: z.boolean().optional(), createdAt: z.string().optional(), updatedAt: z.string().optional(), }); export function applicationToJSON(application) { return JSON.stringify(Application$outboundSchema.parse(application)); } /** @internal */ export const TypeLinear$outboundSchema = z.object({ appId: z.string().optional(), appName: z.string().optional(), clientId: z.string(), clientSecret: z.string(), webhookSecret: z.string().optional(), appScopes: z.array(z.string()).optional(), userScopes: z.array(z.string()).optional(), ownerOrganization: z.lazy(() => OwnerOrganization$outboundSchema).optional(), application: z.lazy(() => Application$outboundSchema).optional(), extras: z.record(z.any()).optional(), }); export function typeLinearToJSON(typeLinear) { return JSON.stringify(TypeLinear$outboundSchema.parse(typeLinear)); } /** @internal */ export const ConnectConnectorCreateDataType$outboundSchema = z.nativeEnum(ConnectConnectorCreateDataType); /** @internal */ export const Owner$outboundSchema = z.object({ type: ConnectConnectorCreateDataType$outboundSchema, id: z.number().int(), slug: z.string(), name: z.string().optional(), }); export function ownerToJSON(owner) { return JSON.stringify(Owner$outboundSchema.parse(owner)); } /** @internal */ export const TypeGithub$outboundSchema = z.object({ appId: z.number().int(), appSlug: z.string(), appName: z.string(), clientId: z.string(), owner: z.lazy(() => Owner$outboundSchema).optional(), clientSecret: z.string().optional(), privateKeyPem: z.string().optional(), webhookSecret: z.string().optional(), extras: z.record(z.any()).optional(), }); export function typeGithubToJSON(typeGithub) { return JSON.stringify(TypeGithub$outboundSchema.parse(typeGithub)); } /** @internal */ export const ConnectConnectorCreateDataSubjectType$outboundSchema = z.nativeEnum(ConnectConnectorCreateDataSubjectType); /** @internal */ export const Values$outboundSchema = z.object({ value: z.string(), scope: z.string().optional(), expiresAt: z.number().int().optional(), }); export function valuesToJSON(values) { return JSON.stringify(Values$outboundSchema.parse(values)); } /** @internal */ export const TypeApiKey$outboundSchema = z.object({ subjectType: ConnectConnectorCreateDataSubjectType$outboundSchema.optional(), values: z.array(z.lazy(() => Values$outboundSchema)).optional(), serviceUrls: z.array(z.string()).optional(), instructions: z.string().optional(), }); export function typeApiKeyToJSON(typeApiKey) { return JSON.stringify(TypeApiKey$outboundSchema.parse(typeApiKey)); } /** @internal */ export const Use$outboundSchema = z.nativeEnum(Use); /** @internal */ export const Keys$outboundSchema = z.object({ kty: z.string(), kid: z.string().optional(), use: Use$outboundSchema.optional(), keyOps: z.array(z.string()).optional(), alg: z.string().optional(), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { keyOps: "key_ops", additionalProperties: null, }), }; }); export function keysToJSON(keys) { return JSON.stringify(Keys$outboundSchema.parse(keys)); } /** @internal */ export const Jwks$outboundSchema = z.object({ keys: z.array(z.lazy(() => Keys$outboundSchema)), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }); export function jwksToJSON(jwks) { return JSON.stringify(Jwks$outboundSchema.parse(jwks)); } /** @internal */ export const ServerConfig$outboundSchema = z.object({ issuer: z.string().optional(), authorizationEndpoint: z.string().optional(), tokenEndpoint: z.string().optional(), userinfoEndpoint: z.string().optional(), jwksUri: z.string().optional(), jwks: z.lazy(() => Jwks$outboundSchema).optional(), revocationEndpoint: z.string().optional(), introspectionEndpoint: z.string().optional(), endSessionEndpoint: z.string().optional(), deviceAuthorizationEndpoint: z.string().optional(), registrationEndpoint: z.string().optional(), responseTypesSupported: z.array(z.string()).optional(), tokenEndpointAuthMethodsSupported: z.array(z.string()).optional(), tokenEndpointAuthSigningAlgValuesSupported: z.array(z.string()).optional(), scopesSupported: z.array(z.string()).optional(), grantTypesSupported: z.array(z.string()).optional(), responseModesSupported: z.array(z.string()).optional(), subjectTypesSupported: z.array(z.string()).optional(), idTokenSigningAlgValuesSupported: z.array(z.string()).optional(), idTokenEncryptionAlgValuesSupported: z.array(z.string()).optional(), idTokenEncryptionEncValuesSupported: z.array(z.string()).optional(), claimTypesSupported: z.array(z.string()).optional(), claimsSupported: z.array(z.string()).optional(), codeChallengeMethodsSupported: z.array(z.string()).optional(), promptValuesSupported: z.array(z.string()).optional(), claimsParameterSupported: z.boolean().optional(), requestParameterSupported: z.boolean().optional(), requestUriParameterSupported: z.boolean().optional(), requireRequestUriRegistration: z.boolean().optional(), serviceDocumentation: z.string().optional(), opPolicyUri: z.string().optional(), opTosUri: z.string().optional(), logoUri: z.string().optional(), clientIdMetadataDocumentSupported: z.boolean().optional(), authorizationDetailsTypesSupported: z.array(z.string()).optional(), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { authorizationEndpoint: "authorization_endpoint", tokenEndpoint: "token_endpoint", userinfoEndpoint: "userinfo_endpoint", jwksUri: "jwks_uri", revocationEndpoint: "revocation_endpoint", introspectionEndpoint: "introspection_endpoint", endSessionEndpoint: "end_session_endpoint", deviceAuthorizationEndpoint: "device_authorization_endpoint", registrationEndpoint: "registration_endpoint", responseTypesSupported: "response_types_supported", tokenEndpointAuthMethodsSupported: "token_endpoint_auth_methods_supported", tokenEndpointAuthSigningAlgValuesSupported: "token_endpoint_auth_signing_alg_values_supported", scopesSupported: "scopes_supported", grantTypesSupported: "grant_types_supported", responseModesSupported: "response_modes_supported", subjectTypesSupported: "subject_types_supported", idTokenSigningAlgValuesSupported: "id_token_signing_alg_values_supported", idTokenEncryptionAlgValuesSupported: "id_token_encryption_alg_values_supported", idTokenEncryptionEncValuesSupported: "id_token_encryption_enc_values_supported", claimTypesSupported: "claim_types_supported", claimsSupported: "claims_supported", codeChallengeMethodsSupported: "code_challenge_methods_supported", promptValuesSupported: "prompt_values_supported", claimsParameterSupported: "claims_parameter_supported", requestParameterSupported: "request_parameter_supported", requestUriParameterSupported: "request_uri_parameter_supported", requireRequestUriRegistration: "require_request_uri_registration", serviceDocumentation: "service_documentation", opPolicyUri: "op_policy_uri", opTosUri: "op_tos_uri", logoUri: "logo_uri", clientIdMetadataDocumentSupported: "client_id_metadata_document_supported", authorizationDetailsTypesSupported: "authorization_details_types_supported", additionalProperties: null, }), }; }); export function serverConfigToJSON(serverConfig) { return JSON.stringify(ServerConfig$outboundSchema.parse(serverConfig)); } /** @internal */ export const UserAuthorization$outboundSchema = z.object({ enabled: z.boolean(), scopes: z.array(z.string()).optional(), }); export function userAuthorizationToJSON(userAuthorization) { return JSON.stringify(UserAuthorization$outboundSchema.parse(userAuthorization)); } /** @internal */ export const RefreshTokens$outboundSchema = z.object({ enabled: z.boolean(), }); export function refreshTokensToJSON(refreshTokens) { return JSON.stringify(RefreshTokens$outboundSchema.parse(refreshTokens)); } /** @internal */ export const ClientCredentials$outboundSchema = z.object({ enabled: z.boolean(), scopes: z.array(z.string()).optional(), }); export function clientCredentialsToJSON(clientCredentials) { return JSON.stringify(ClientCredentials$outboundSchema.parse(clientCredentials)); } /** @internal */ export const ForwardedClaims$outboundSchema = z.object({ idToken: z.array(z.string()).optional(), }); export function forwardedClaimsToJSON(forwardedClaims) { return JSON.stringify(ForwardedClaims$outboundSchema.parse(forwardedClaims)); } /** @internal */ export const JwtBearer$outboundSchema = z.object({ enabled: z.boolean().optional(), scopes: z.array(z.string()).optional(), sub: z.string().optional(), iss: z.string().optional(), aud: z.string().optional(), additionalClaims: z.record(z.any()).optional(), ttl: z.number().optional(), useClientCredentials: z.boolean().optional(), }); export function jwtBearerToJSON(jwtBearer) { return JSON.stringify(JwtBearer$outboundSchema.parse(jwtBearer)); } /** @internal */ export const ClientAssertion$outboundSchema = z.object({ type: z.string().optional(), ttl: z.number().optional(), claims: z.record(z.any()).optional(), }); export function clientAssertionToJSON(clientAssertion) { return JSON.stringify(ClientAssertion$outboundSchema.parse(clientAssertion)); } /** @internal */ export const TypeOauth$outboundSchema = z.object({ serverUrl: z.string().optional(), serverConfig: z.lazy(() => ServerConfig$outboundSchema).optional(), clientId: z.string(), clientName: z.string().optional(), clientSecret: z.string().optional(), tokenEndpointAuthMethod: z.string().optional(), responseType: z.string().optional(), pkceRequired: z.boolean().optional(), codeChallengeMethod: z.string().optional(), userAuthorization: z.lazy(() => UserAuthorization$outboundSchema).optional(), refreshTokens: z.lazy(() => RefreshTokens$outboundSchema).optional(), clientCredentials: z.lazy(() => ClientCredentials$outboundSchema).optional(), forwardedClaims: z.lazy(() => ForwardedClaims$outboundSchema).optional(), defaultAudience: z.string().optional(), defaultTokenExpiresIn: z.number().optional(), authorizationUrlParams: z.record(z.string()).optional(), jwtBearer: z.lazy(() => JwtBearer$outboundSchema).optional(), clientAssertion: z.lazy(() => ClientAssertion$outboundSchema).optional(), }); export function typeOauthToJSON(typeOauth) { return JSON.stringify(TypeOauth$outboundSchema.parse(typeOauth)); } /** @internal */ export const ConnectConnectorCreateData$outboundSchema = smartUnion([ z.lazy(() => TypeGithub$outboundSchema), z.lazy(() => TypeSlack$outboundSchema), z.lazy(() => TypeSalesforce$outboundSchema), z.lazy(() => TypeLinear$outboundSchema), z.lazy(() => TypeSendblue$outboundSchema), z.lazy(() => TypePhoton$outboundSchema), z.lazy(() => TypeOauth$outboundSchema), z.lazy(() => TypeLinq$outboundSchema), z.lazy(() => TypeSnowflake$outboundSchema), z.lazy(() => TypeApiKey$outboundSchema), z.lazy(() => TypeSnowflakeWif$outboundSchema), z.record(z.any()), ]); export function connectConnectorCreateDataToJSON(connectConnectorCreateData) { return JSON.stringify(ConnectConnectorCreateData$outboundSchema.parse(connectConnectorCreateData)); } //# sourceMappingURL=connectconnectorcreatedata.js.map