UNPKG

@paroicms/server

Version:
202 lines (201 loc) 5.21 kB
import type { MImage } from "@paroicms/public-anywhere-lib"; import type { PaUrlQuery } from "@paroicms/public-server-lib"; export type TpTemplatePayload = TpDetachedPublicPayload | TpRegularPublicPayload; export interface TpDetachedPublicPayload { site: TpSitePayload; doc: TpDetachedDocPayload; } export interface TpRegularPublicPayload { site: TpSitePayload; doc: TpDocPayload; } export interface TpSitePayload { kind: "site"; fqdn: string; url: string; assetsUrl: string; field: { [fieldName: string]: unknown; }; home: TpRoutingClusterNode & { url: string; }; language: string; languageLabel: string; fields: { [fieldName: string]: unknown; }; configuration: unknown; recaptchaKey?: string; } export interface TpClusterPayload { kind: "cluster"; routing: TpRoutingClusterNode; parentCluster: TpClusterPayload | undefined; } export interface TpRoutingClusterNode { id: string; doc?: TpDocPayload; [typeName: string]: TpRoutingClusterNode | TpDocPayload | string | undefined; } export interface TpChildRoutingClusterNode { [typeName: string]: TpRoutingClusterNode | string; } export interface TpDetachedDocPayload { kind: "detached"; typeName?: string; language?: string; languageLabel?: string; translations: TpDocTranslation[]; id?: string; title?: string; urlQuery: PaUrlQuery | undefined; cluster: TpClusterPayload; } export interface TpDocValues { type: string; nodeId: string; language: string; relativeId: string; title?: string; slug?: string; publishDate: string; metaDescription?: string; metaKeywords?: string; } export interface TpDocPayload extends TpDocValues { kind: "routingDocument" | "regularDocument"; leafType: string; leafId: string; id: string; languageLabel: string; url: string; excerpt?: string; list: { [listName: string]: TpPart[]; }; listSize: { [listName: string]: number; }; defaultImageId?: string; defaultImage?: MImage; featuredImageId?: string; featuredImage?: MImage; field: TpFieldValues; fields: TpFieldValues; translations: TpDocTranslation[]; labeling: undefined; singleLabeling: undefined; flaggedWith: undefined; flaggedWithOne: undefined; og: TpOgValues; breadcrumb: TpBreadcrumbItem[]; siblings: TpSiblingDocuments; typeLabel: string; urlQuery: PaUrlQuery | undefined; frontendAppPath: string | undefined; routing?: TpChildRoutingClusterNode; routingIds?: TpChildRoutingClusterNode; cluster: TpClusterPayload; } export interface TpDocTranslation { language: string; languageLabel: string; active: boolean; url: string; doc?: TpDocPayload; } export interface TpTerm { inRightLanguage: boolean; language: string; languageLabel: string; nodeId: string; title?: string; url?: string; doc: TpDocPayload; } export interface TpPartValues { type: string; relativeId: string; number: number; numberOfType: number; inRightLanguage: boolean; language: string; languageLabel: string; nodeId: string; publishDate: string; } export interface TpPart extends TpPartValues { kind: "part"; leafId: string; leafType: string; id: string; num: number; defaultImageId?: string; defaultImage?: MImage; featuredImageId?: string; featuredImage?: MImage; field: TpFieldValues; fields: TpFieldValues; typeLabel: string; parts?: TpPart[]; } export interface TpOgValues { url: string; type?: string; image?: TpImageVariant; title?: string; siteName?: string; description?: string; locale?: string; } export interface TpBreadcrumbItem { id: string; title?: string; url?: string; } export interface TpSiblingDocuments { previous?: TpDocPayload; next?: TpDocPayload; } export interface TpFieldValues { [fieldName: string]: string | number | boolean | object | undefined; } export type TpMedia = TpFile | TpImage; export type TpSourceMedia = TpFile | TpSourceImage; export type TpImage = TpSourceImage | TpImageVariant; declare const galleryHandleSymbol: unique symbol; export type TpGalleryHandleSymbol = typeof galleryHandleSymbol; export interface TpMediaBase { mediaId: string; url: string; mediaType: string; } export interface TpSourceBase { isSource: true; weightB: number; originalName?: string; attachedData?: TpAttachedData; [galleryHandleSymbol]: string | undefined; } export interface TpAttachedData { [propertyName: string]: string | number | boolean | object | undefined; caption?: string; } export interface TpImageBase { kind: "image"; rawWidth: number; rawHeight: number; width: number; height: number; pixelRatio: number; } export interface TpFile extends TpMediaBase, TpSourceBase { kind: "file"; } export interface TpSourceImage extends TpMediaBase, TpSourceBase, TpImageBase { } export interface TpImageVariant extends TpMediaBase, TpImageBase { isSource: false; } export {};