/** * This module contains sample data that can be used for testing purposes. * In our case the sample data represents TsAppSpec data. */ import * as AppSpec from "../../src/appSpec.js"; import { Branded } from "../../src/branded.js"; import { App } from "../../src/legacy/publicApi/App.js"; import * as TsAppSpec from "../../src/legacy/publicApi/tsAppSpec.js"; export declare function createApp(scope: ConfigType): { appConfigName: string; app: App; }; export declare function getAppConfig(scope: "minimal"): MinimalNamedConfig; export declare function getAppConfig(scope: "full"): FullNamedConfig; export declare function getAppConfig(scope: ConfigType): NamedConfig; export declare function getAuthConfig(scope: "minimal"): MinimalConfig; export declare function getAuthConfig(scope: "full"): FullConfig; export declare function getAuthConfig(scope: ConfigType): Config; export declare function getAuthMethods(scope: "minimal"): MinimalConfig; export declare function getAuthMethods(scope: "full"): FullConfig; export declare function getAuthMethods(scope: ConfigType): Config; export declare function getExternalAuthConfig(scope: "minimal"): MinimalConfig; export declare function getExternalAuthConfig(scope: "full"): FullConfig; export declare function getExternalAuthConfig(scope: ConfigType): Config; export declare function getUsernameAndPasswordConfig(scope: "minimal"): MinimalConfig; export declare function getUsernameAndPasswordConfig(scope: "full"): FullConfig; export declare function getUsernameAndPasswordConfig(scope: ConfigType): Config; export declare function getEmailAuthConfig(scope: "minimal"): MinimalConfig; export declare function getEmailAuthConfig(scope: "full"): FullConfig; export declare function getEmailAuthConfig(scope: ConfigType): Config; export declare function getPasswordResetConfig(scope: "minimal"): MinimalConfig; export declare function getPasswordResetConfig(scope: "full"): FullConfig; export declare function getPasswordResetConfig(scope: ConfigType): Config; export declare function getEmailVerificationConfig(scope: "minimal"): MinimalConfig; export declare function getEmailVerificationConfig(scope: "full"): FullConfig; export declare function getEmailVerificationConfig(scope: ConfigType): Config; export declare function getClientConfig(scope: "minimal"): MinimalConfig; export declare function getClientConfig(scope: "full"): FullConfig; export declare function getClientConfig(scope: ConfigType): Config; export declare function getServerConfig(scope: "minimal"): MinimalConfig; export declare function getServerConfig(scope: "full"): FullConfig; export declare function getServerConfig(scope: ConfigType): Config; export declare function getEmailSenderConfig(scope: "minimal"): MinimalConfig; export declare function getEmailSenderConfig(scope: "full"): FullConfig; export declare function getEmailSenderConfig(scope: ConfigType): Config; export declare function getWebSocketConfig(scope: "minimal"): MinimalConfig; export declare function getWebSocketConfig(scope: "full"): FullConfig; export declare function getWebSocketConfig(scope: ConfigType): Config; export declare function getDbConfig(scope: "minimal"): MinimalConfig; export declare function getDbConfig(scope: "full"): FullConfig; export declare function getDbConfig(scope: ConfigType): Config; export declare function getPageConfigs(): NamedConfig[]; export declare function getPageConfig(pageType: "minimal"): MinimalNamedConfig; export declare function getPageConfig(pageType: "full" | "email-verification" | "password-reset"): FullNamedConfig; export declare function getPageConfig(pageType: PageType): NamedConfig; export declare function getRouteConfigs(): NamedConfig[]; export declare function getRouteConfig(routeType: "minimal"): MinimalNamedConfig; export declare function getRouteConfig(routeType: "full" | "email-verification" | "password-reset"): FullNamedConfig; export declare function getRouteConfig(routeType: PageType): NamedConfig; export declare function getQueryConfigs(): NamedConfig[]; export declare function getQueryConfig(scope: "minimal"): MinimalNamedConfig; export declare function getQueryConfig(scope: "full"): FullNamedConfig; export declare function getQueryConfig(scope: ConfigType): NamedConfig; export declare function getActionConfigs(): NamedConfig[]; export declare function getActionConfig(scope: "minimal"): MinimalNamedConfig; export declare function getActionConfig(scope: "full"): FullNamedConfig; export declare function getActionConfig(scope: ConfigType): NamedConfig; export declare function getCrudConfigs(): NamedConfig[]; export declare function getCrudConfig(scope: "minimal"): MinimalNamedConfig; export declare function getCrudConfig(scope: "full"): FullNamedConfig; export declare function getCrudConfig(scope: ConfigType): NamedConfig; export declare function getCrudOperations(scope: "minimal"): MinimalConfig; export declare function getCrudOperations(scope: "full"): FullConfig; export declare function getCrudOperations(scope: ConfigType): Config; export declare function getCrudOperationOptions(scope: "minimal"): MinimalConfig; export declare function getCrudOperationOptions(scope: "full"): FullConfig; export declare function getCrudOperationOptions(scope: ConfigType): Config; export declare function getSchedule(scope: "minimal"): MinimalConfig; export declare function getSchedule(scope: "full"): FullConfig; export declare function getSchedule(scope: ConfigType): Config; export declare function getPerform(scope: "minimal"): MinimalConfig; export declare function getPerform(scope: "full"): FullConfig; export declare function getPerform(scope: ConfigType): Config; export declare function getApiNamespaceConfigs(): NamedConfig[]; export declare function getApiNamespaceConfig(scope: "minimal"): MinimalNamedConfig; export declare function getApiNamespaceConfig(scope: "full"): FullNamedConfig; export declare function getApiNamespaceConfig(scope: ConfigType): NamedConfig; export declare function getApiConfigs(): NamedConfig[]; export declare function getApiConfig(scope: "minimal"): MinimalNamedConfig; export declare function getApiConfig(scope: "full"): FullNamedConfig; export declare function getApiConfig(scope: ConfigType): NamedConfig; export declare function getHttpRoute(scope: "minimal"): MinimalConfig; export declare function getHttpRoute(scope: "full"): FullConfig; export declare function getHttpRoute(scope: ConfigType): Config; export declare function getJobConfigs(): NamedConfig[]; export declare function getJobConfig(scope: "minimal"): MinimalNamedConfig; export declare function getJobConfig(scope: "full"): FullNamedConfig; export declare function getJobConfig(scope: ConfigType): NamedConfig; export declare function getEmailFromField(scope: "minimal"): MinimalConfig; export declare function getEmailFromField(scope: "full"): FullConfig; export declare function getEmailFromField(scope: ConfigType): Config; export declare function getExtImport(scope: "minimal", importKind: AppSpec.ExtImportKind): MinimalConfig; export declare function getExtImport(scope: "full", importKind: AppSpec.ExtImportKind): FullConfig; export declare function getExtImport(scope: ConfigType, importKind: AppSpec.ExtImportKind): Config; export declare function getEntity(entity: EntityType): "Task" | "User" | "SocialUser"; export declare function getEntities(scope: ConfigType): string[]; declare const CONFIG_TYPES: readonly ["minimal", "full"]; type ConfigType = (typeof CONFIG_TYPES)[number]; /** * By default we define only `ConfigType` variants for all of the configs * that can be used in the app. This is because we want to test both * edge cases of the configs. * * Pages are a special case, because even though they are a top-level config, * they are also used by `AuthConfig`. That is why we define those two cases separately. * Mostly to bring attention that we have additional edge cases for pages. */ declare const PAGE_CONFIG_TYPES: readonly ["minimal", "full", "email-verification", "password-reset"]; type PageType = (typeof PAGE_CONFIG_TYPES)[number]; declare const ENTITY_CONFIG_TYPES: readonly ["task", "user", "social-user"]; type EntityType = (typeof ENTITY_CONFIG_TYPES)[number]; type NamedConfig = MinimalNamedConfig | FullNamedConfig; export type Config = MinimalConfig | FullConfig; type MinimalNamedConfig = { name: string; config: MinimalConfig; }; type FullNamedConfig = { name: string; config: FullConfig; }; /** * Creates a type containing only the required properties from T recursively. * * This utility: * - Filters out optional properties recurisvely * - Stops from unwrapping `Branded` types * - Returns `EmptyObject` when no required properties exist * * @template T - The type to extract required properties from * * @example * ```ts * // Given the following type: * type Result = MinimalConfig<{ * a: Branded; * b: { * c: boolean; * d?: { * e: boolean; * }; * }; * f: { * g: boolean; * h?: string; * }[]; * }; * // The result will be: * type Result = { * a: Branded; * b: { * c: boolean; * }; * f: { * g: boolean; * h: string; * }[]; * }; */ export type MinimalConfig = T extends Branded ? T : T extends Array ? Array> : T extends object ? keyof T extends never ? EmptyObject : MinimalConfigObject : T; type MinimalConfigObject = { [K in keyof T as EmptyObject extends Pick ? never : K]: MinimalConfig; } extends infer Object ? Object extends EmptyObject ? EmptyObject : Object : never; /** * Represents an empty object type in TypeScript. * @see https://www.totaltypescript.com/the-empty-object-type-in-typescript */ type EmptyObject = Record; /** * Creates a type with all properties of T required recursively. * * This utility: * - Makes all properties required recursively * - Stops from unwrapping branded types * * @template T - The type to make fully required * * @example * ```ts * // Given the following type: * type Result = FullConfig<{ * a: Branded; * b: { * c: boolean; * d?: { * e: boolean; * }; * }; * f: { * g: boolean; * h?: string; * }[]; * }; * // The result will be: * type Result = FullConfig<{ * a: Branded; * b: { * c: boolean; * d: { * e: boolean; * }; * }; * f: { * g: boolean; * h: string; * }[]; * }; */ export type FullConfig = T extends Branded ? T : T extends Array ? Array> : T extends object ? FullConfigObject : T; type FullConfigObject = { [K in keyof T]-?: FullConfig; }; export {}; //# sourceMappingURL=testFixtures.d.ts.map