import type { LIGHTNING_OUT_ACCESS_MODES } from './lightningOut'; import type * as nodeFs from 'node:fs'; import AnalyticsTemplateGenerator from '../generators/analyticsTemplateGenerator'; import ApexClassGenerator from '../generators/apexClassGenerator'; import ApexTriggerGenerator from '../generators/apexTriggerGenerator'; import { type BaseGenerator } from '../generators/baseGenerator'; import DigitalExperienceSiteGenerator from '../generators/digitalExperienceSiteGenerator'; import FlexipageGenerator from '../generators/flexipageGenerator'; import LightningAppGenerator from '../generators/lightningAppGenerator'; import LightningComponentGenerator from '../generators/lightningComponentGenerator'; import LightningEventGenerator from '../generators/lightningEventGenerator'; import LightningInterfaceGenerator from '../generators/lightningInterfaceGenerator'; import LightningOutGenerator from '../generators/lightningOutGenerator'; import LightningTestGenerator from '../generators/lightningTestGenerator'; import ProjectGenerator from '../generators/projectGenerator'; import StaticResourceGenerator from '../generators/staticResourceGenerator'; import UIBundleGenerator from '../generators/uiBundleGenerator'; import UIEmbeddingGenerator from '../generators/uiEmbeddingGenerator'; import VisualforceComponentGenerator from '../generators/visualforceComponentGenerator'; import VisualforcePageGenerator from '../generators/visualforcePageGenerator'; import { type ProjectTemplate } from './projectTemplates'; export type GeneratorClass = new (options: TOptions, context?: GeneratorContext, cwd?: string) => BaseGenerator; /** * Optional context for generators allowing fs and template path injection. * When not provided, defaults to Node's fs and __dirname-based template resolution. * cwd is owned by TemplateService; pass via constructor param. */ export type GeneratorContext = { /** Node-fs-compatible object. Defaults to require('node:fs'). Pass memfs for web. */ readonly fs?: typeof nodeFs; /** Absolute path to built-in templates root. Overrides __dirname-based resolution. */ readonly templatesRootPath?: string; }; export type Generators = typeof AnalyticsTemplateGenerator | typeof ApexClassGenerator | typeof ApexTriggerGenerator | typeof FlexipageGenerator | typeof LightningAppGenerator | typeof LightningComponentGenerator | typeof LightningEventGenerator | typeof LightningTestGenerator | typeof LightningInterfaceGenerator | typeof DigitalExperienceSiteGenerator | typeof UIEmbeddingGenerator | typeof LightningOutGenerator | typeof ProjectGenerator | typeof StaticResourceGenerator | typeof VisualforceComponentGenerator | typeof VisualforcePageGenerator | typeof UIBundleGenerator; /** * Available Template types * Each template type must have a corresponding generator class: * - generator class file should locate in generators/ * - generator class file should default export a generator class extending SfGenerator * - generator class file should have a name same as the type name, except with the first letter lowercased */ export declare enum TemplateType { AnalyticsTemplate = 0, ApexClass = 1, ApexTrigger = 2, Flexipage = 3, LightningApp = 4, LightningComponent = 5, LightningEvent = 6, LightningInterface = 7, LightningTest = 8, DigitalExperienceSite = 9, UIEmbedding = 10, LightningOut = 11, Project = 12, VisualforceComponent = 13, VisualforcePage = 14, StaticResource = 15, UIBundle = 16 } export declare const generators: Map>; export type CreateOutput = { outputDir: string; created: string[]; rawOutput: string; }; /** * Template Options * If not supplied, the apiversion and outputdir use default values. */ export interface TemplateOptions { apiversion?: string; outputdir?: string; } export interface AnalyticsTemplateOptions extends TemplateOptions { templatename: string; } type ApexClassBaseOptions = TemplateOptions & { classname: string; }; type NonBatchableApexClassOptions = ApexClassBaseOptions & { template: 'DefaultApexClass' | 'BasicUnitTest' | 'ApexUnitTest' | 'ApexException' | 'InboundEmailService' | 'Queueable'; sobjecttype?: never; }; type BatchableApexClassOptions = ApexClassBaseOptions & { template: 'Batchable'; sobjecttype?: string; }; export type ApexClassOptions = NonBatchableApexClassOptions | BatchableApexClassOptions; type ApexTriggerEvent = 'before insert' | 'before update' | 'before delete' | 'after insert' | 'after update' | 'after delete' | 'after undelete'; export interface ApexTriggerOptions extends TemplateOptions { triggername: string; triggerevents: ApexTriggerEvent[]; sobject: string; template: 'ApexTrigger'; } export interface LightningAppOptions extends TemplateOptions { appname: string; template: 'DefaultLightningApp'; internal: boolean; } export interface LightningComponentOptions extends TemplateOptions { componentname: string; template: 'default' | 'analyticsDashboard' | 'analyticsDashboardWithStep' | 'typeScript'; type: 'aura' | 'lwc'; internal: boolean; } export interface LightningEventOptions extends TemplateOptions { eventname: string; template: 'DefaultLightningEvt'; internal: boolean; } export interface LightningInterfaceOptions extends TemplateOptions { interfacename: string; template: 'DefaultLightningIntf'; internal: boolean; } export interface LightningTestOptions extends TemplateOptions { template: 'DefaultLightningTest'; testname: string; internal: boolean; } export interface UIEmbeddingOptions extends TemplateOptions { componentname: string; src: string; sandbox: string; title: string; internal: boolean; } export interface LightningOutEcaOptions { /** ECA DeveloperName (≤ 80 chars). */ name: string; /** Required contact email. */ contactEmail: string; /** Required absolute https callback/redirect URL. */ callbackUrl: string; } /** 'guest' | 'authenticated' — derived from the runtime list so the two cannot drift. */ export type LightningOutAccess = (typeof LIGHTNING_OUT_ACCESS_MODES)[number]; interface LightningOutBaseOptions extends TemplateOptions { /** LightningOutApp DeveloperName AND value (≤ 64 chars). */ appName: string; /** Optional component references exposed by the app (LWC "c/x" or Aura "c:X"). */ components?: string[]; /** * CLWR only. Experience site (Network) name, emitted as . * Deployable at API 69.0+; the caller owns any API-version policy. * Omitting it for CLWR writes no , and deploying that file at API 69.0+ removes the app's * existing site link (including one made in Setup), so callers should require it for CLWR. */ site?: string; } /** Authenticated Lightning Out options; required fields preserve the existing public contract. */ export interface LightningOutOptions extends LightningOutBaseOptions { /** LWR_CORE or CLWR. */ runtime: 'LWR_CORE' | 'CLWR'; /** Required explicit http(s) origins for external host pages that embed the app. */ hostDomains: string[]; /** Required External Client Application (OAuth) settings. */ eca: LightningOutEcaOptions; /** CLWR only. 'authenticated' (default); LWR_CORE is always authenticated. */ access?: LightningOutAccess; } /** CLWR guest options; ECA and host domains are optional, and only the app file is emitted. */ export interface LightningOutGuestOptions extends LightningOutBaseOptions { runtime: 'CLWR'; access: Extract; /** Optional explicit http(s) embed origins; when supplied, they populate . */ hostDomains?: string[]; /** Ignored for guest access; no ECA files are emitted. */ eca?: LightningOutEcaOptions; } export type LightningOutGeneratorOptions = LightningOutOptions | LightningOutGuestOptions; export interface ProjectOptions extends TemplateOptions { projectname: string; defaultpackagedir: string; /** * namespace * Note that namespace is a reserved keyword for yeoman generator */ ns: string; template: ProjectTemplate; manifest: boolean; loginurl: string; lwcLanguage?: 'javascript' | 'typescript'; } export interface VisualforceComponentOptions extends TemplateOptions { componentname: string; label: string; template: 'DefaultVFComponent'; } export interface VisualforcePageOptions extends TemplateOptions { pagename: string; label: string; template: 'DefaultVFPage'; } export interface StaticResourceOptions extends TemplateOptions { resourcename: string; contenttype: string; template: 'empty'; } export interface UIBundleOptions extends TemplateOptions { bundlename: string; template: string; masterlabel?: string; internal?: boolean; } export interface FlexipageOptions extends TemplateOptions { flexipagename: string; template: 'RecordPage' | 'AppPage' | 'HomePage'; flexipageTemplatesGitRepo?: string; forceLoadingRemoteRepo?: boolean; masterlabel?: string; description?: string; internal?: boolean; entityName?: string; primaryField?: string; secondaryFields?: string[]; detailFields?: string[]; } export interface DigitalExperienceSiteOptions extends TemplateOptions { template: string; sitename: string; urlpathprefix: string; adminemail: string; } export {};