import type { PartialSome, StrictOmit, ThunkAsync } from 'ts-gems'; import type { TranslationBundle, TranslationStore } from '../../i18n/translation-store.js'; import { OpraSchema } from '../../schema/index.js'; import { ApiDocument } from '../api-document.js'; import { DocumentInitContext } from '../common/document-init-context.js'; import { DataTypeFactory } from './data-type.factory.js'; import { HttpApiFactory } from './http-api.factory.js'; import { MQApiFactory } from './mq-api.factory.js'; import { WSApiFactory } from './ws-api.factory.js'; export declare namespace ApiDocumentFactory { interface InitArguments extends PartialSome, 'spec'> { references?: Record; types?: DataTypeInitSources; /** Documentation texts per language, either inline or through a store * that loads them (a directory of JSON files, a remote source). Every * language the store lists is materialized here, while this document * is being built, so that `export()` can stay synchronous. */ translations?: Record; translationStore?: TranslationStore; /** The language `export()` falls back to. Defaults to `'en'`. */ defaultLanguage?: string; api?: StrictOmit | StrictOmit | StrictOmit; } type ReferenceSource = string | OpraSchema.ApiDocument | InitArguments | ApiDocument; type ReferenceThunk = ThunkAsync; type DataTypeInitSources = DataTypeFactory.DataTypeSources; } /** * @class ApiDocumentFactory */ export declare class ApiDocumentFactory { private _allDocuments; /** * Creates ApiDocument instance from given schema object */ static createDocument(schemaOrUrl: string | PartialSome | ApiDocumentFactory.InitArguments, options?: Partial> | DocumentInitContext): Promise; /** * Downloads schema from the given URL and creates the document instance * @param url */ protected initDocument(document: ApiDocument, context: DocumentInitContext, schemaOrUrl: ApiDocumentFactory.InitArguments | string): Promise; /** * Materializes every language this document can be exported in. Bundle * keys are lower-cased so that a request for `EN` or `tr-TR` resolves the * same way regardless of how the language was written. */ protected loadTranslations(document: ApiDocument, init: ApiDocumentFactory.InitArguments): Promise; /** * * @param context * @protected */ protected createBuiltinDocument(context: DocumentInitContext): Promise; }