import type { GenerateContextType } from '../../../context/generateTypes.js'; import type { InsertNormalizedModelArgs, InsertNormalizedModelOptions, InsertNormalizedModelReturn } from '../../../context/generateTypes.js'; import { type ProjectionOptionsRest } from '../../../types/ProjectionOptions.js'; import { type PeerInsertOptions } from '../../../types/InsertOptions.js'; import type { GqlOperation } from '../../../gql/operation/GqlOperation.js'; import type { ContentSettings } from '../../ContentSettings.js'; import type { LangSnippetConstructor } from '../../Lang.js'; import type { IdentifierType } from '../../IdentifierType.js'; import type { GeneratedValue } from '../../GeneratedValue.js'; import type { Inserted } from '../../Inserted.js'; import type { ModelProjection, NormalizedModelProjection } from '../../model/types.js'; import type { RefName } from '../../../types/RefName.js'; import type { OasSchema } from '../../../oas/schema/Schema.js'; import type { OasRef } from '../../../oas/ref/Ref.js'; import type { OasVoid } from '../../../oas/void/Void.js'; import type { GqlOperationProjection, GqlOperationProjectionConstructorArgs, ToGqlOperationIdentifierNameArgs, ToGqlOperationExportPathArgs } from './types.js'; import type * as v from 'valibot'; /** * Configuration for {@link toGqlOperationProjectionBase}. * * Generic over the language `L`: a language veneer parameterizes this config * (`GqlOperationProjectionBaseConfig`) so * `toIdentifierType`'s return tightens to that language's `type` vocabulary — * no recast. */ export type GqlOperationProjectionBaseConfig = { id: string; /** Pure: the cache-key name (the cache-check path runs this). */ toIdentifierName: (args: ToGqlOperationIdentifierNameArgs) => string; /** * Context-aware, overridable: the non-`name` parts of the identifier, * derived from the operation/schema. Runs only on cache-miss. Returns this * language's `XxIdentifierType` (`IdType`; the loose `kind: string` by * default); the tightening rides the type argument. */ toIdentifierType: (operation: GqlOperation, context: GenerateContextType) => IdType; toExportPath: (args: ToGqlOperationExportPathArgs) => string; /** * Required composite schema for the `{ subject, generator, stack }` * enrichment umbrella. Required (not optional) is load-bearing: it is what * lets `static toEnrichments` parse cast-free. A no-enrichment generator * passes `emptyEnrichmentSchema`. */ toEnrichmentSchema: () => v.GenericSchema; /** * Family-level applicability predicate. Becomes a static `isSupported` * on the returned base class so other projections can probe it via the * operation-reference protocol. When omitted, advertises support for * every operation. */ isSupported?: (args: { operation: GqlOperation; context: GenerateContextType; }) => boolean; }; type ToEnrichmentsArgs = { operation: GqlOperation; context: GenerateContextType; /** Operation variant whose enrichment should be resolved (see {@link Variant}) */ variant: string; }; /** * Build a GraphQL operation projection base class from a per-generator * config. * * The returned class extends `base` — the generator's language * snippet base — so the projection hierarchy is language-bound at its root * while core stays language-blind (the base arrives as an opaque * constructor; core never names a concrete language class). The class * exposes the generator's `id`, `toIdentifierName`, `toIdentifierType`, * `toExportPath`, `toEnrichments`, and `isSupported` statics, inherits the * static `lang` * from the base, and injects `generatorKey` so subclasses don't have to. * * Defines NO `register` / `registerInto` — register ergonomics are typed by * each language's concise vocabulary, which core can't name, so they live * in the language package's projection-base veneer over this factory. * * The projection machinery previously hosted on * `GqlOperationProjectionBase` lives here now, because the base class is no * longer statically known. */ export declare const toGqlOperationProjectionBase: (base: LangSnippetConstructor, config: GqlOperationProjectionBaseConfig) => { new (args: GqlOperationProjectionConstructorArgs): { settings: ContentSettings; operation: GqlOperation; /** The caller's options. */ options: ProjectionOptions; /** * Insert a related operation. The inserted operation is exported to this * projection's own `exportPath` unless `noExport` is set. * * Pass `{ variant }` to target a specific variant on the peer; omitting * it defaults to the peer's `'main'` variant. `{ options }` is required * when the peer declares options and refused when it does not. */ insertOperation(projection: GqlOperationProjection, operation: GqlOperation, ...rest: ProjectionOptionsRest, PeerProjectionOptions>): Inserted; /** * Insert a related model into this projection's export file. * * Pass `{ variant }` to target a specific variant on the peer model * projection; omitting it defaults to the peer's `'main'` variant. * `{ options }` is required when the peer declares options and refused * when it does not. */ insertModel(projection: ModelProjection, refName: RefName, ...rest: ProjectionOptionsRest, PeerProjectionOptions_1>): Inserted; /** * Insert a related model with reference normalization. Useful for * schemas that may be either a `$ref` or a concrete object. * * `{ variant }` and `{ options }` flow through the `$ref` branch only; * for inline schemas, bake what distinguishes them into `fallbackName`. */ insertNormalizedModel | OasVoid, PeerEnrichmentType_2 = undefined, PeerProjectionOptions_2 = undefined>(projection: NormalizedModelProjection, { schema, fallbackName }: Omit, "destinationPath">, ...rest: ProjectionOptionsRest, PeerProjectionOptions_2>): InsertNormalizedModelReturn; context: GenerateContextType; skipped: boolean; generatorKey: import("../../GeneratorKeys.js").GeneratorKey | undefined; stackTrail: import("../../../mod.js").StackTrail; }; id: string; type: "gqlOperation"; toIdentifierName: (args: ToGqlOperationIdentifierNameArgs) => string; toIdentifierType: (operation: GqlOperation, context: GenerateContextType) => IdType; toExportPath: (args: ToGqlOperationExportPathArgs) => string; isSupported: (args: { operation: GqlOperation; context: GenerateContextType; }) => boolean; toEnrichments: ({ operation, context, variant }: ToEnrichmentsArgs) => EnrichmentType; lang: import("../../Lang.js").Lang; }; export {};