Use import type whenever possible
This commit is contained in:
parent
04ce83b083
commit
a5ca1ee9f2
|
@ -1,4 +1,4 @@
|
|||
import { TrackRequestParams } from "./types";
|
||||
import type { TrackRequestParams } from "./types";
|
||||
|
||||
type AnalyticsBody = Record<string, unknown> & {
|
||||
type: "event" | "request";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { MeiliDocument, SearchRequest, SearchResponse } from "./types";
|
||||
import type { MeiliDocument, SearchRequest, SearchResponse } from "./types";
|
||||
|
||||
export class MeilisearchSDK {
|
||||
constructor(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Collections } from "../payload/constants";
|
||||
import {
|
||||
import type {
|
||||
EndpointCollectible,
|
||||
EndpointPage,
|
||||
EndpointFolder,
|
||||
|
@ -9,7 +8,8 @@ import {
|
|||
EndpointFile,
|
||||
EndpointRecorder,
|
||||
EndpointChronologyEvent,
|
||||
} from "../payload/endpoint-types";
|
||||
} from "payload/endpoint-types";
|
||||
import { Collections } from "../payload/constants";
|
||||
|
||||
export type MeiliDocument = {
|
||||
meilid: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RichTextContent } from "./rich-text";
|
||||
import type { RichTextContent } from "./rich-text";
|
||||
|
||||
export interface TranscriptBlock extends GenericBlock {
|
||||
lines: (LineBlock | CueBlock)[];
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
import { AttributeTypes, CollectibleBindingTypes, CollectibleNature, CollectiblePageOrders, Collections } from "./constants";
|
||||
import { RichTextContent } from "./rich-text";
|
||||
import type {
|
||||
Collections,
|
||||
AttributeTypes,
|
||||
CollectibleNature,
|
||||
CollectibleBindingTypes,
|
||||
CollectiblePageOrders,
|
||||
} from "./constants";
|
||||
import type { RichTextContent } from "./rich-text";
|
||||
|
||||
export interface EndpointCurrency {
|
||||
id: string;
|
||||
|
@ -19,9 +25,9 @@ export type EndpointFolderPreview = {
|
|||
language: string;
|
||||
title: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointFolder = Omit<EndpointFolderPreview, "translations"> & {
|
||||
export type EndpointFolder = Omit<EndpointFolderPreview, "translations"> & {
|
||||
translations: (EndpointFolderPreview["translations"][number] & {
|
||||
description?: RichTextContent;
|
||||
})[];
|
||||
|
@ -61,9 +67,9 @@ export type EndpointFolderPreview = {
|
|||
}
|
||||
)[];
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointWebsiteConfig = {
|
||||
export type EndpointWebsiteConfig = {
|
||||
home: {
|
||||
backgroundImage?: EndpointPayloadImage;
|
||||
folders: (EndpointFolderPreview & {
|
||||
|
@ -82,31 +88,31 @@ export type EndpointFolderPreview = {
|
|||
}[];
|
||||
};
|
||||
defaultOpenGraphImage?: EndpointPayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointRecorderPreview = {
|
||||
export type EndpointRecorderPreview = {
|
||||
id: string;
|
||||
username: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointRecorder = EndpointRecorderPreview & {
|
||||
export type EndpointRecorder = EndpointRecorderPreview & {
|
||||
avatar?: EndpointPayloadImage;
|
||||
translations: {
|
||||
language: string;
|
||||
biography: RichTextContent;
|
||||
}[];
|
||||
languages: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointWording = {
|
||||
export type EndpointWording = {
|
||||
name: string;
|
||||
translations: {
|
||||
language: string;
|
||||
name: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointTag = {
|
||||
export type EndpointTag = {
|
||||
id: string;
|
||||
slug: string;
|
||||
page?: { slug: string };
|
||||
|
@ -114,9 +120,9 @@ export type EndpointFolderPreview = {
|
|||
language: string;
|
||||
name: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointGenericAttribute = {
|
||||
export type EndpointGenericAttribute = {
|
||||
id: string;
|
||||
slug: string;
|
||||
icon: string;
|
||||
|
@ -124,43 +130,43 @@ export type EndpointFolderPreview = {
|
|||
language: string;
|
||||
name: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointNumberAttribute = EndpointGenericAttribute & {
|
||||
export type EndpointNumberAttribute = EndpointGenericAttribute & {
|
||||
type: AttributeTypes.Number;
|
||||
value: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointTextAttribute = EndpointGenericAttribute & {
|
||||
export type EndpointTextAttribute = EndpointGenericAttribute & {
|
||||
type: AttributeTypes.Text;
|
||||
value: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointTagsAttribute = EndpointGenericAttribute & {
|
||||
export type EndpointTagsAttribute = EndpointGenericAttribute & {
|
||||
type: AttributeTypes.Tags;
|
||||
value: EndpointTag[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointAttribute =
|
||||
export type EndpointAttribute =
|
||||
| EndpointNumberAttribute
|
||||
| EndpointTextAttribute
|
||||
| EndpointTagsAttribute;
|
||||
|
||||
export type EndpointRole = {
|
||||
export type EndpointRole = {
|
||||
id: string;
|
||||
icon: string;
|
||||
translations: {
|
||||
language: string;
|
||||
name: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCredit = {
|
||||
export type EndpointCredit = {
|
||||
role: EndpointRole;
|
||||
recorders: EndpointRecorderPreview[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointPagePreview = {
|
||||
export type EndpointPagePreview = {
|
||||
id: string;
|
||||
slug: string;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
|
@ -172,9 +178,9 @@ export type EndpointFolderPreview = {
|
|||
subtitle?: string;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointPage = Omit<EndpointPagePreview, "translations"> & {
|
||||
export type EndpointPage = Omit<EndpointPagePreview, "translations"> & {
|
||||
backgroundImage?: EndpointPayloadImage;
|
||||
translations: (EndpointPagePreview["translations"][number] & {
|
||||
sourceLanguage: string;
|
||||
|
@ -186,9 +192,9 @@ export type EndpointFolderPreview = {
|
|||
createdAt: string;
|
||||
updatedBy?: EndpointRecorderPreview;
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectiblePreview = {
|
||||
export type EndpointCollectiblePreview = {
|
||||
id: string;
|
||||
slug: string;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
|
@ -205,9 +211,12 @@ export type EndpointFolderPreview = {
|
|||
amount: number;
|
||||
currency: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectible = Omit<EndpointCollectiblePreview, "translations"> & {
|
||||
export type EndpointCollectible = Omit<
|
||||
EndpointCollectiblePreview,
|
||||
"translations"
|
||||
> & {
|
||||
translations: (EndpointCollectiblePreview["translations"][number] & {
|
||||
description?: RichTextContent;
|
||||
})[];
|
||||
|
@ -276,9 +285,9 @@ export type EndpointFolderPreview = {
|
|||
updatedAt: string;
|
||||
updatedBy?: EndpointRecorderPreview;
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectibleScans = {
|
||||
export type EndpointCollectibleScans = {
|
||||
slug: string;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
translations: {
|
||||
|
@ -326,9 +335,9 @@ export type EndpointFolderPreview = {
|
|||
};
|
||||
pages: EndpointScanImage[];
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectibleGallery = {
|
||||
export type EndpointCollectibleGallery = {
|
||||
slug: string;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
translations: {
|
||||
|
@ -340,9 +349,9 @@ export type EndpointFolderPreview = {
|
|||
}[];
|
||||
images: EndpointPayloadImage[];
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectibleGalleryImage = {
|
||||
export type EndpointCollectibleGalleryImage = {
|
||||
slug: string;
|
||||
translations: {
|
||||
language: string;
|
||||
|
@ -355,9 +364,9 @@ export type EndpointFolderPreview = {
|
|||
previousIndex?: string;
|
||||
nextIndex?: string;
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointCollectibleScanPage = {
|
||||
export type EndpointCollectibleScanPage = {
|
||||
slug: string;
|
||||
translations: {
|
||||
language: string;
|
||||
|
@ -370,22 +379,22 @@ export type EndpointFolderPreview = {
|
|||
previousIndex?: string;
|
||||
nextIndex?: string;
|
||||
parentPages: EndpointSource[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointScanImage = PayloadImage & {
|
||||
export type EndpointScanImage = PayloadImage & {
|
||||
index: string;
|
||||
sizes: PayloadImage[];
|
||||
};
|
||||
};
|
||||
|
||||
export type TableOfContentEntry = {
|
||||
export type TableOfContentEntry = {
|
||||
prefix: string;
|
||||
title: string;
|
||||
type: "sceneBreak" | "break" | "section";
|
||||
index: number;
|
||||
children: TableOfContentEntry[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointChronologyEvent = {
|
||||
export type EndpointChronologyEvent = {
|
||||
id: string;
|
||||
date: {
|
||||
year: number;
|
||||
|
@ -403,15 +412,20 @@ export type EndpointFolderPreview = {
|
|||
credits: EndpointCredit[];
|
||||
}[];
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointSourcePreview = {
|
||||
export type EndpointSourcePreview = {
|
||||
id: string;
|
||||
slug: string;
|
||||
translations: { language: string; pretitle?: string; title: string; subtitle?: string }[];
|
||||
};
|
||||
translations: {
|
||||
language: string;
|
||||
pretitle?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type EndpointSource =
|
||||
export type EndpointSource =
|
||||
| { type: "url"; url: string; label: string }
|
||||
| {
|
||||
type: "collectible";
|
||||
|
@ -419,14 +433,17 @@ export type EndpointFolderPreview = {
|
|||
range?:
|
||||
| { type: "page"; page: number }
|
||||
| { type: "timestamp"; timestamp: string }
|
||||
| { type: "custom"; translations: { language: string; note: string }[] };
|
||||
| {
|
||||
type: "custom";
|
||||
translations: { language: string; note: string }[];
|
||||
};
|
||||
}
|
||||
| { type: "page"; page: EndpointSourcePreview }
|
||||
| { type: "folder"; folder: EndpointSourcePreview }
|
||||
| { type: "scans"; collectible: EndpointSourcePreview }
|
||||
| { type: "gallery"; collectible: EndpointSourcePreview };
|
||||
|
||||
export type EndpointMediaPreview = {
|
||||
export type EndpointMediaPreview = {
|
||||
id: string;
|
||||
url: string;
|
||||
filename: string;
|
||||
|
@ -438,9 +455,9 @@ export type EndpointFolderPreview = {
|
|||
title: string;
|
||||
subtitle?: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointMedia = Omit<EndpointMediaPreview, "translations"> & {
|
||||
export type EndpointMedia = Omit<EndpointMediaPreview, "translations"> & {
|
||||
filesize: number;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
|
@ -448,42 +465,42 @@ export type EndpointFolderPreview = {
|
|||
description?: RichTextContent;
|
||||
})[];
|
||||
credits: EndpointCredit[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointImagePreview = EndpointMediaPreview & {
|
||||
export type EndpointImagePreview = EndpointMediaPreview & {
|
||||
width: number;
|
||||
height: number;
|
||||
sizes: PayloadImage[];
|
||||
openGraph?: PayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointImage = EndpointMedia & {
|
||||
export type EndpointImage = EndpointMedia & {
|
||||
width: number;
|
||||
height: number;
|
||||
sizes: PayloadImage[];
|
||||
openGraph?: PayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointAudioPreview = EndpointMediaPreview & {
|
||||
export type EndpointAudioPreview = EndpointMediaPreview & {
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
duration: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointAudio = EndpointMedia & {
|
||||
export type EndpointAudio = EndpointMedia & {
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
duration: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointVideoPreview = EndpointMediaPreview & {
|
||||
export type EndpointVideoPreview = EndpointMediaPreview & {
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
subtitles: {
|
||||
language: string;
|
||||
url: string;
|
||||
}[];
|
||||
duration: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointVideo = EndpointMedia & {
|
||||
export type EndpointVideo = EndpointMedia & {
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
subtitles: {
|
||||
language: string;
|
||||
|
@ -502,41 +519,41 @@ export type EndpointFolderPreview = {
|
|||
publishedDate: string;
|
||||
};
|
||||
duration: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointFilePreview = EndpointMediaPreview & {
|
||||
export type EndpointFilePreview = EndpointMediaPreview & {
|
||||
filesize: number;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointFile = EndpointMedia & {
|
||||
export type EndpointFile = EndpointMedia & {
|
||||
filesize: number;
|
||||
thumbnail?: EndpointPayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointPayloadImage = PayloadImage & {
|
||||
export type EndpointPayloadImage = PayloadImage & {
|
||||
sizes: PayloadImage[];
|
||||
openGraph?: PayloadImage;
|
||||
};
|
||||
};
|
||||
|
||||
export type PayloadMedia = {
|
||||
export type PayloadMedia = {
|
||||
id: string;
|
||||
url: string;
|
||||
mimeType: string;
|
||||
filename: string;
|
||||
filesize: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type PayloadImage = PayloadMedia & {
|
||||
export type PayloadImage = PayloadMedia & {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointAllSDKUrls = {
|
||||
export type EndpointAllSDKUrls = {
|
||||
urls: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export type EndpointAllIds = {
|
||||
export type EndpointAllIds = {
|
||||
collectibles: { slugs: string[] };
|
||||
pages: { slugs: string[] };
|
||||
folders: { slugs: string[] };
|
||||
|
@ -546,5 +563,4 @@ export type EndpointFolderPreview = {
|
|||
files: { ids: string[] };
|
||||
recorders: { ids: string[] };
|
||||
chronologyEvents: { ids: string[] };
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import { Collections } from "./constants";
|
||||
import {
|
||||
EndpointAudioPreview,
|
||||
EndpointImagePreview,
|
||||
EndpointVideoPreview,
|
||||
} from "./endpoint-types";
|
||||
import {
|
||||
GenericBlock,
|
||||
SectionBlock,
|
||||
TranscriptBlock,
|
||||
BreakBlock,
|
||||
type GenericBlock,
|
||||
type SectionBlock,
|
||||
type TranscriptBlock,
|
||||
type BreakBlock,
|
||||
isBlockTranscriptBlock,
|
||||
isBlockBreakBlock,
|
||||
} from "./blocks";
|
||||
import { Collections } from "./constants";
|
||||
import type {
|
||||
EndpointImagePreview,
|
||||
EndpointVideoPreview,
|
||||
EndpointAudioPreview,
|
||||
} from "./endpoint-types";
|
||||
|
||||
export type RichTextContent = {
|
||||
root: {
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import { Collections } from "./constants";
|
||||
import {
|
||||
EndpointAllIds,
|
||||
EndpointAllSDKUrls,
|
||||
EndpointAudio,
|
||||
EndpointChronologyEvent,
|
||||
import type {
|
||||
EndpointWebsiteConfig,
|
||||
EndpointFolder,
|
||||
EndpointLanguage,
|
||||
EndpointCurrency,
|
||||
EndpointWording,
|
||||
EndpointPage,
|
||||
EndpointCollectible,
|
||||
EndpointCollectibleScans,
|
||||
EndpointCollectibleScanPage,
|
||||
EndpointCollectibleGallery,
|
||||
EndpointCollectibleGalleryImage,
|
||||
EndpointCollectibleScanPage,
|
||||
EndpointCollectibleScans,
|
||||
EndpointCurrency,
|
||||
EndpointFile,
|
||||
EndpointFolder,
|
||||
EndpointChronologyEvent,
|
||||
EndpointImage,
|
||||
EndpointLanguage,
|
||||
EndpointPage,
|
||||
EndpointRecorder,
|
||||
EndpointAudio,
|
||||
EndpointVideo,
|
||||
EndpointWebsiteConfig,
|
||||
EndpointWording,
|
||||
EndpointFile,
|
||||
EndpointRecorder,
|
||||
EndpointAllSDKUrls,
|
||||
EndpointAllIds,
|
||||
} from "./endpoint-types";
|
||||
|
||||
export const getSDKEndpoint = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Collections } from "./constants";
|
||||
import type { Collections } from "./constants";
|
||||
|
||||
export type AfterOperationWebHookMessage = {
|
||||
collection: Collections;
|
||||
|
|
Loading…
Reference in New Issue