import { z } from 'zod'; import { BaseModel } from '../../core/common/base-model'; import { Metadata } from '../../core/common/metadata'; import { UserWithMetaInformation } from '../../core/user'; import { OAuth2GrantType } from './dto/upsert-app-connection-request'; import { OAuth2AuthorizationMethod } from './oauth2-authorization-method'; export type AppConnectionId = string; export declare enum AppConnectionStatus { ACTIVE = "ACTIVE", MISSING = "MISSING", ERROR = "ERROR" } export declare enum AppConnectionScope { PROJECT = "PROJECT", PLATFORM = "PLATFORM" } export declare enum AppConnectionType { OAUTH2 = "OAUTH2", PLATFORM_OAUTH2 = "PLATFORM_OAUTH2", CLOUD_OAUTH2 = "CLOUD_OAUTH2", SECRET_TEXT = "SECRET_TEXT", BASIC_AUTH = "BASIC_AUTH", CUSTOM_AUTH = "CUSTOM_AUTH", NO_AUTH = "NO_AUTH" } export type SecretTextConnectionValue = { type: AppConnectionType.SECRET_TEXT; secret_text: string; }; export type BasicAuthConnectionValue = { username: string; password: string; type: AppConnectionType.BASIC_AUTH; }; export type BaseOAuth2ConnectionValue = { expires_in?: number; client_id: string; token_type: string; access_token: string; claimed_at: number; refresh_token: string; scope: string; token_url: string; authorization_method?: OAuth2AuthorizationMethod; data: Record; props?: Record; grant_type?: OAuth2GrantType; }; export type CustomAuthConnectionValue = Record> = { type: AppConnectionType.CUSTOM_AUTH; props: T; }; export type CloudOAuth2ConnectionValue = { type: AppConnectionType.CLOUD_OAUTH2; } & BaseOAuth2ConnectionValue; export type PlatformOAuth2ConnectionValue = { type: AppConnectionType.PLATFORM_OAUTH2; redirect_url: string; } & BaseOAuth2ConnectionValue; export type OAuth2ConnectionValueWithApp = { type: AppConnectionType.OAUTH2; client_secret: string; redirect_url: string; } & BaseOAuth2ConnectionValue; export type NoAuthConnectionValue = { type: AppConnectionType.NO_AUTH; }; export type AppConnectionValue = Record> = T extends AppConnectionType.SECRET_TEXT ? SecretTextConnectionValue : T extends AppConnectionType.BASIC_AUTH ? BasicAuthConnectionValue : T extends AppConnectionType.CLOUD_OAUTH2 ? CloudOAuth2ConnectionValue : T extends AppConnectionType.PLATFORM_OAUTH2 ? PlatformOAuth2ConnectionValue : T extends AppConnectionType.OAUTH2 ? OAuth2ConnectionValueWithApp : T extends AppConnectionType.CUSTOM_AUTH ? CustomAuthConnectionValue : T extends AppConnectionType.NO_AUTH ? NoAuthConnectionValue : never; export type AppConnection = BaseModel & { externalId: string; type: Type; scope: AppConnectionScope; pieceName: string; displayName: string; projectIds: string[]; platformId: string; status: AppConnectionStatus; ownerId: string; owner: UserWithMetaInformation | null; value: AppConnectionValue; metadata: Metadata | null; pieceVersion: string; preSelectForNewProjects: boolean; }; export type OAuth2AppConnection = AppConnection; export type SecretKeyAppConnection = AppConnection; export type CloudAuth2Connection = AppConnection; export type PlatformOAuth2Connection = AppConnection; export type BasicAuthConnection = AppConnection; export type CustomAuthConnection = AppConnection; export type NoAuthConnection = AppConnection; export declare const AppConnectionWithoutSensitiveData: z.ZodObject<{ externalId: z.ZodString; displayName: z.ZodString; type: z.ZodEnum; pieceName: z.ZodString; projectIds: z.ZodArray; platformId: z.ZodOptional>; scope: z.ZodEnum; status: z.ZodEnum; ownerId: z.ZodOptional>; owner: z.ZodOptional; externalId: z.ZodOptional>; platformId: z.ZodOptional>; platformRole: z.ZodEnum; lastName: z.ZodString; created: z.ZodPipe, z.ZodString>; updated: z.ZodPipe, z.ZodString>; lastActiveDate: z.ZodOptional, z.ZodString>>>; imageUrl: z.ZodOptional>; }, z.core.$strip>>>; metadata: z.ZodOptional>>; flowIds: z.ZodOptional>>; pieceVersion: z.ZodString; preSelectForNewProjects: z.ZodBoolean; usingSecretManager: z.ZodBoolean; id: z.ZodString; created: z.ZodPipe, z.ZodString>; updated: z.ZodPipe, z.ZodString>; }, z.core.$strip>; export type AppConnectionWithoutSensitiveData = z.infer; export declare const AppConnectionOwners: z.ZodObject<{ firstName: z.ZodString; lastName: z.ZodString; email: z.ZodString; }, z.core.$strip>; export type AppConnectionOwners = z.infer; /**i.e props: {projectId: "123"} and value: "{{projectId}}" will return "123" */ export declare const resolveValueFromProps: (props: Record | undefined, value: string) => string; //# sourceMappingURL=app-connection.d.ts.map