Removed unused exports
This commit is contained in:
		
							parent
							
								
									4fd59464ba
								
							
						
					
					
						commit
						1a9d4f2dd0
					
				| @ -26,7 +26,7 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ | ||||
|         blocks: [ | ||||
|           ...(depth < maxDepth ? [generateRecursiveSectionBlock(depth + 1, maxDepth)] : []), | ||||
|           transcriptBlock, | ||||
|           breakBlock | ||||
|           breakBlock, | ||||
|         ], | ||||
|       }), | ||||
|     }, | ||||
|  | ||||
| @ -28,7 +28,14 @@ export const Folders = buildCollectionConfig({ | ||||
|   admin: { | ||||
|     useAsTitle: fields.slug, | ||||
|     group: CollectionGroups.Collections, | ||||
|     defaultColumns: [fields.slug, fields.translations, fields.parentFolders, fields.sections, fields.files, fields.icon], | ||||
|     defaultColumns: [ | ||||
|       fields.slug, | ||||
|       fields.translations, | ||||
|       fields.parentFolders, | ||||
|       fields.sections, | ||||
|       fields.files, | ||||
|       fields.icon, | ||||
|     ], | ||||
|     description: | ||||
|       "Folders provide a way to structure our content. A folder can contain subfolders and/or files.", | ||||
|     preview: ({ slug }) => `https://v3.accords-library.com/en/folders/${slug}`, | ||||
|  | ||||
| @ -19,8 +19,7 @@ export const getBySlugEndpoint = createGetByEndpoint( | ||||
|           ? { | ||||
|               type: "single", | ||||
|               subfolders: | ||||
|                 sections[0]?.subfolders?.filter(isPayloadType).map(convertFolderToPreview) ?? | ||||
|                 [], | ||||
|                 sections[0]?.subfolders?.filter(isPayloadType).map(convertFolderToPreview) ?? [], | ||||
|             } | ||||
|           : { | ||||
|               type: "multiple", | ||||
|  | ||||
| @ -5,7 +5,7 @@ export const createGetByEndpoint = <C extends keyof GeneratedTypes["collections" | ||||
|   collection: C, | ||||
|   attribute: string, | ||||
|   handler: (doc: GeneratedTypes["collections"][C]) => Promise<R> | R, | ||||
|   depth?: number, | ||||
|   depth?: number | ||||
| ): CollectionEndpoint => ({ | ||||
|   path: `/${attribute}/:${attribute}`, | ||||
|   method: "get", | ||||
|  | ||||
| @ -4,10 +4,7 @@ import { Recorder } from "../types/collections"; | ||||
| import { CollectionEndpoint } from "../types/payload"; | ||||
| import { isDefined } from "../utils/asserts"; | ||||
| 
 | ||||
| export const getAllStrapiEntries = async ( | ||||
|   collectionSlug: string, | ||||
|   params: Object | ||||
| ): Promise<any[]> => { | ||||
| const getAllStrapiEntries = async (collectionSlug: string, params: Object): Promise<any[]> => { | ||||
|   let page = 1; | ||||
|   let totalPage = 1; | ||||
|   const result: any[] = []; | ||||
| @ -39,14 +36,11 @@ type Params<S> = { | ||||
|     path?: string; | ||||
|     collection: keyof GeneratedTypes["collections"]; | ||||
|     import?: (strapiObject: S, user: any) => Promise<void>; | ||||
|     convert?: ( | ||||
|       strapiObject: S, | ||||
|       user: any | ||||
|     ) => any; | ||||
|     convert?: (strapiObject: S, user: any) => any; | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| export const importStrapiEntries = async <S>({ | ||||
| const importStrapiEntries = async <S>({ | ||||
|   strapi: strapiParams, | ||||
|   payload: payloadParams, | ||||
|   user, | ||||
|  | ||||
| @ -20,8 +20,8 @@ export type RecorderBiographies = | ||||
|             version: number; | ||||
|             [k: string]: unknown; | ||||
|           }[]; | ||||
|           direction: ('ltr' | 'rtl') | null; | ||||
|           format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|           direction: ("ltr" | "rtl") | null; | ||||
|           format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|           indent: number; | ||||
|           type: string; | ||||
|           version: number; | ||||
| @ -46,26 +46,25 @@ export interface Config { | ||||
|     pages: Page; | ||||
|     collectibles: Collectible; | ||||
|     folders: Folder; | ||||
|     'chronology-items': ChronologyItem; | ||||
|     'chronology-eras': ChronologyEra; | ||||
|     "chronology-events": ChronologyEvent; | ||||
|     notes: Note; | ||||
|     images: Image; | ||||
|     'background-images': BackgroundImage; | ||||
|     'recorders-thumbnails': RecordersThumbnail; | ||||
|     "background-images": BackgroundImage; | ||||
|     "recorders-thumbnails": RecordersThumbnail; | ||||
|     videos: Video; | ||||
|     'videos-channels': VideosChannel; | ||||
|     "videos-channels": VideosChannel; | ||||
|     tags: Tag; | ||||
|     'tags-groups': TagsGroup; | ||||
|     "tags-groups": TagsGroup; | ||||
|     recorders: Recorder; | ||||
|     languages: Language; | ||||
|     currencies: Currency; | ||||
|     wordings: Wording; | ||||
|     'generic-contents': GenericContent; | ||||
|     'payload-preferences': PayloadPreference; | ||||
|     'payload-migrations': PayloadMigration; | ||||
|     "generic-contents": GenericContent; | ||||
|     "payload-preferences": PayloadPreference; | ||||
|     "payload-migrations": PayloadMigration; | ||||
|   }; | ||||
|   globals: { | ||||
|     'home-folders': HomeFolder; | ||||
|     "home-folders": HomeFolder; | ||||
|   }; | ||||
| } | ||||
| /** | ||||
| @ -75,7 +74,7 @@ export interface Config { | ||||
| export interface Page { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   type: 'Content' | 'Post' | 'Generic'; | ||||
|   type: "Content" | "Post" | "Generic"; | ||||
|   thumbnail?: string | Image | null; | ||||
|   backgroundImage?: string | BackgroundImage | null; | ||||
|   tags?: (string | Tag)[] | null; | ||||
| @ -93,8 +92,8 @@ export interface Page { | ||||
|           version: number; | ||||
|           [k: string]: unknown; | ||||
|         }[]; | ||||
|         direction: ('ltr' | 'rtl') | null; | ||||
|         format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|         direction: ("ltr" | "rtl") | null; | ||||
|         format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|         indent: number; | ||||
|         type: string; | ||||
|         version: number; | ||||
| @ -108,8 +107,8 @@ export interface Page { | ||||
|           version: number; | ||||
|           [k: string]: unknown; | ||||
|         }[]; | ||||
|         direction: ('ltr' | 'rtl') | null; | ||||
|         format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|         direction: ("ltr" | "rtl") | null; | ||||
|         format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|         indent: number; | ||||
|         type: string; | ||||
|         version: number; | ||||
| @ -126,7 +125,7 @@ export interface Page { | ||||
|   updatedBy: string | Recorder; | ||||
|   updatedAt: string; | ||||
|   createdAt: string; | ||||
|   _status?: ('draft' | 'published') | null; | ||||
|   _status?: ("draft" | "published") | null; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -237,7 +236,7 @@ export interface Recorder { | ||||
|   avatar?: string | RecordersThumbnail | null; | ||||
|   languages?: (string | Language)[] | null; | ||||
|   biographies?: RecorderBiographies; | ||||
|   role?: ('Admin' | 'Recorder' | 'Api')[] | null; | ||||
|   role?: ("Admin" | "Recorder" | "Api")[] | null; | ||||
|   anonymize: boolean; | ||||
|   email: string; | ||||
|   resetPasswordToken?: string | null; | ||||
| @ -301,8 +300,8 @@ export interface Folder { | ||||
|           version: number; | ||||
|           [k: string]: unknown; | ||||
|         }[]; | ||||
|         direction: ('ltr' | 'rtl') | null; | ||||
|         format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|         direction: ("ltr" | "rtl") | null; | ||||
|         format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|         indent: number; | ||||
|         type: string; | ||||
|         version: number; | ||||
| @ -327,11 +326,11 @@ export interface Folder { | ||||
|   files?: | ||||
|     | ( | ||||
|         | { | ||||
|             relationTo: 'collectibles'; | ||||
|             relationTo: "collectibles"; | ||||
|             value: string | Collectible; | ||||
|           } | ||||
|         | { | ||||
|             relationTo: 'pages'; | ||||
|             relationTo: "pages"; | ||||
|             value: string | Page; | ||||
|           } | ||||
|       )[] | ||||
| @ -347,7 +346,7 @@ export interface Collectible { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   thumbnail?: string | Image | null; | ||||
|   nature: 'Physical' | 'Digital'; | ||||
|   nature: "Physical" | "Digital"; | ||||
|   languages?: (string | Language)[] | null; | ||||
|   tags?: (string | Tag)[] | null; | ||||
|   translations: { | ||||
| @ -362,8 +361,8 @@ export interface Collectible { | ||||
|           version: number; | ||||
|           [k: string]: unknown; | ||||
|         }[]; | ||||
|         direction: ('ltr' | 'rtl') | null; | ||||
|         format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|         direction: ("ltr" | "rtl") | null; | ||||
|         format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|         indent: number; | ||||
|         type: string; | ||||
|         version: number; | ||||
| @ -455,8 +454,8 @@ export interface Collectible { | ||||
|   pageInfoEnabled?: boolean | null; | ||||
|   pageInfo?: { | ||||
|     pageCount: number; | ||||
|     bindingType?: ('Paperback' | 'Hardcover') | null; | ||||
|     pageOrder?: ('Left to right' | 'Right to left') | null; | ||||
|     bindingType?: ("Paperback" | "Hardcover") | null; | ||||
|     pageOrder?: ("Left to right" | "Right to left") | null; | ||||
|   }; | ||||
|   folders?: (string | Folder)[] | null; | ||||
|   parentItems?: (string | Collectible)[] | null; | ||||
| @ -465,11 +464,11 @@ export interface Collectible { | ||||
|     | { | ||||
|         content: | ||||
|           | { | ||||
|               relationTo: 'pages'; | ||||
|               relationTo: "pages"; | ||||
|               value: string | Page; | ||||
|             } | ||||
|           | { | ||||
|               relationTo: 'generic-contents'; | ||||
|               relationTo: "generic-contents"; | ||||
|               value: string | GenericContent; | ||||
|             }; | ||||
|         range?: | ||||
| @ -479,14 +478,14 @@ export interface Collectible { | ||||
|                   end: number; | ||||
|                   id?: string | null; | ||||
|                   blockName?: string | null; | ||||
|                   blockType: 'pageRange'; | ||||
|                   blockType: "pageRange"; | ||||
|                 } | ||||
|               | { | ||||
|                   start: string; | ||||
|                   end: string; | ||||
|                   id?: string | null; | ||||
|                   blockName?: string | null; | ||||
|                   blockType: 'timeRange'; | ||||
|                   blockType: "timeRange"; | ||||
|                 } | ||||
|               | { | ||||
|                   translations?: | ||||
| @ -499,8 +498,8 @@ export interface Collectible { | ||||
|                               version: number; | ||||
|                               [k: string]: unknown; | ||||
|                             }[]; | ||||
|                             direction: ('ltr' | 'rtl') | null; | ||||
|                             format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|                             direction: ("ltr" | "rtl") | null; | ||||
|                             format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|                             indent: number; | ||||
|                             type: string; | ||||
|                             version: number; | ||||
| @ -512,7 +511,7 @@ export interface Collectible { | ||||
|                     | null; | ||||
|                   id?: string | null; | ||||
|                   blockName?: string | null; | ||||
|                   blockType: 'other'; | ||||
|                   blockType: "other"; | ||||
|                 } | ||||
|             )[] | ||||
|           | null; | ||||
| @ -522,7 +521,7 @@ export interface Collectible { | ||||
|   updatedBy: string | Recorder; | ||||
|   updatedAt: string; | ||||
|   createdAt: string; | ||||
|   _status?: ('draft' | 'published') | null; | ||||
|   _status?: ("draft" | "published") | null; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -548,9 +547,9 @@ export interface GenericContent { | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
|  * via the `definition` "chronology-items". | ||||
|  * via the `definition` "chronology-events". | ||||
|  */ | ||||
| export interface ChronologyItem { | ||||
| export interface ChronologyEvent { | ||||
|   id: string; | ||||
|   name?: string | null; | ||||
|   date: { | ||||
| @ -559,6 +558,7 @@ export interface ChronologyItem { | ||||
|     day?: number | null; | ||||
|   }; | ||||
|   events: { | ||||
|     sources?: (UrlBlock | CollectibleBlock | PageBlock)[] | null; | ||||
|     translations: { | ||||
|       language: string | Language; | ||||
|       sourceLanguage: string | Language; | ||||
| @ -570,8 +570,8 @@ export interface ChronologyItem { | ||||
|             version: number; | ||||
|             [k: string]: unknown; | ||||
|           }[]; | ||||
|           direction: ('ltr' | 'rtl') | null; | ||||
|           format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|           direction: ("ltr" | "rtl") | null; | ||||
|           format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|           indent: number; | ||||
|           type: string; | ||||
|           version: number; | ||||
| @ -585,8 +585,8 @@ export interface ChronologyItem { | ||||
|             version: number; | ||||
|             [k: string]: unknown; | ||||
|           }[]; | ||||
|           direction: ('ltr' | 'rtl') | null; | ||||
|           format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|           direction: ("ltr" | "rtl") | null; | ||||
|           format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|           indent: number; | ||||
|           type: string; | ||||
|           version: number; | ||||
| @ -603,42 +603,63 @@ export interface ChronologyItem { | ||||
|   updatedBy: string | Recorder; | ||||
|   updatedAt: string; | ||||
|   createdAt: string; | ||||
|   _status?: ('draft' | 'published') | null; | ||||
|   _status?: ("draft" | "published") | null; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
|  * via the `definition` "chronology-eras". | ||||
|  * via the `definition` "UrlBlock". | ||||
|  */ | ||||
| export interface ChronologyEra { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   startingYear: number; | ||||
|   endingYear: number; | ||||
|   translations?: | ||||
|     | { | ||||
|         language: string | Language; | ||||
|         title: string; | ||||
|         description?: { | ||||
|           root: { | ||||
|             children: { | ||||
|               type: string; | ||||
|               version: number; | ||||
|               [k: string]: unknown; | ||||
| export interface UrlBlock { | ||||
|   url: string; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: "urlBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
|  * via the `definition` "CollectibleBlock". | ||||
|  */ | ||||
| export interface CollectibleBlock { | ||||
|   collectible: string | Collectible; | ||||
|   range?: | ||||
|     | ( | ||||
|         | { | ||||
|             page: number; | ||||
|             id?: string | null; | ||||
|             blockName?: string | null; | ||||
|             blockType: "page"; | ||||
|           } | ||||
|         | { | ||||
|             timestamp: string; | ||||
|             id?: string | null; | ||||
|             blockName?: string | null; | ||||
|             blockType: "timestamp"; | ||||
|           } | ||||
|         | { | ||||
|             translations: { | ||||
|               language: string | Language; | ||||
|               note: string; | ||||
|               id?: string | null; | ||||
|             }[]; | ||||
|             direction: ('ltr' | 'rtl') | null; | ||||
|             format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|             indent: number; | ||||
|             type: string; | ||||
|             version: number; | ||||
|           }; | ||||
|           [k: string]: unknown; | ||||
|         } | null; | ||||
|         id?: string | null; | ||||
|       }[] | ||||
|             id?: string | null; | ||||
|             blockName?: string | null; | ||||
|             blockType: "other"; | ||||
|           } | ||||
|       )[] | ||||
|     | null; | ||||
|   events?: (string | ChronologyItem)[] | null; | ||||
|   updatedAt: string; | ||||
|   createdAt: string; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: "collectibleBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
|  * via the `definition` "PageBlock". | ||||
|  */ | ||||
| export interface PageBlock { | ||||
|   page: string | Page; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: "pageBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -653,8 +674,8 @@ export interface Note { | ||||
|         version: number; | ||||
|         [k: string]: unknown; | ||||
|       }[]; | ||||
|       direction: ('ltr' | 'rtl') | null; | ||||
|       format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|       direction: ("ltr" | "rtl") | null; | ||||
|       format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|       indent: number; | ||||
|       type: string; | ||||
|       version: number; | ||||
| @ -672,7 +693,7 @@ export interface Video { | ||||
|   id: string; | ||||
|   uid: string; | ||||
|   gone: boolean; | ||||
|   source: 'YouTube' | 'NicoNico' | 'Tumblr'; | ||||
|   source: "YouTube" | "NicoNico" | "Tumblr"; | ||||
|   title: string; | ||||
|   description?: string | null; | ||||
|   likes?: number | null; | ||||
| @ -708,7 +729,7 @@ export interface Wording { | ||||
| export interface PayloadPreference { | ||||
|   id: string; | ||||
|   user: { | ||||
|     relationTo: 'recorders'; | ||||
|     relationTo: "recorders"; | ||||
|     value: string | Recorder; | ||||
|   }; | ||||
|   key?: string | null; | ||||
| @ -764,15 +785,15 @@ export interface LineBlock { | ||||
|         version: number; | ||||
|         [k: string]: unknown; | ||||
|       }[]; | ||||
|       direction: ('ltr' | 'rtl') | null; | ||||
|       format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|       direction: ("ltr" | "rtl") | null; | ||||
|       format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|       indent: number; | ||||
|       type: string; | ||||
|       version: number; | ||||
|     }; | ||||
|     [k: string]: unknown; | ||||
|   }; | ||||
|   blockType: 'lineBlock'; | ||||
|   blockType: "lineBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -786,15 +807,15 @@ export interface CueBlock { | ||||
|         version: number; | ||||
|         [k: string]: unknown; | ||||
|       }[]; | ||||
|       direction: ('ltr' | 'rtl') | null; | ||||
|       format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|       direction: ("ltr" | "rtl") | null; | ||||
|       format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|       indent: number; | ||||
|       type: string; | ||||
|       version: number; | ||||
|     }; | ||||
|     [k: string]: unknown; | ||||
|   }; | ||||
|   blockType: 'cueBlock'; | ||||
|   blockType: "cueBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -804,17 +825,17 @@ export interface TranscriptBlock { | ||||
|   lines: (LineBlock | CueBlock)[]; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: 'transcriptBlock'; | ||||
|   blockType: "transcriptBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
|  * via the `definition` "BreakBlock". | ||||
|  */ | ||||
| export interface BreakBlock { | ||||
|   type: 'Scene break' | 'Empty space' | 'Solid line' | 'Dotted line'; | ||||
|   type: "Scene break" | "Empty space" | "Solid line" | "Dotted line"; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: 'breakBlock'; | ||||
|   blockType: "breakBlock"; | ||||
| } | ||||
| /** | ||||
|  * This interface was referenced by `Config`'s JSON-Schema | ||||
| @ -828,8 +849,8 @@ export interface SectionBlock { | ||||
|         version: number; | ||||
|         [k: string]: unknown; | ||||
|       }[]; | ||||
|       direction: ('ltr' | 'rtl') | null; | ||||
|       format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; | ||||
|       direction: ("ltr" | "rtl") | null; | ||||
|       format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|       indent: number; | ||||
|       type: string; | ||||
|       version: number; | ||||
| @ -838,10 +859,9 @@ export interface SectionBlock { | ||||
|   }; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: 'sectionBlock'; | ||||
|   blockType: "sectionBlock"; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| declare module 'payload' { | ||||
| declare module "payload" { | ||||
|   export interface GeneratedTypes extends Config {} | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -2,10 +2,6 @@ export type StrapiLanguage = { | ||||
|   data?: { attributes: { code: string } }; | ||||
| }; | ||||
| 
 | ||||
| export type StrapiRecorders = { | ||||
|   data?: { attributes: { username: string } }[]; | ||||
| }; | ||||
| 
 | ||||
| export type StrapiImage = { | ||||
|   data?: { | ||||
|     attributes: { | ||||
|  | ||||
| @ -12,15 +12,6 @@ export const isNotEmpty = (value: string | null | undefined): value is string => | ||||
| export const isEmpty = (value: string | null | undefined): value is string => | ||||
|   isUndefined(value) || value.trim().length === 0; | ||||
| 
 | ||||
| type Span = [number, number]; | ||||
| const hasNoIntersection = (a: Span, b: Span): boolean => { | ||||
|   const [aStart, aEnd] = a; | ||||
|   const [bStart, bEnd] = b; | ||||
|   return aEnd < bStart || aStart > bEnd; | ||||
| }; | ||||
| 
 | ||||
| export const hasIntersection = (a: Span, b: Span): boolean => !hasNoIntersection(a, b); | ||||
| 
 | ||||
| export const hasDuplicates = <T>(list: T[]): boolean => list.length !== new Set(list).size; | ||||
| 
 | ||||
| export const isValidPayloadImage = ( | ||||
| @ -46,9 +37,6 @@ export const isValidPayloadImage = ( | ||||
|   return true; | ||||
| }; | ||||
| 
 | ||||
| export const isString = <T extends Object>(value: string | T): value is string => | ||||
|   typeof value === "string"; | ||||
| 
 | ||||
| export const isPayloadType = <T extends Object>(value: string | T): value is T => | ||||
|   typeof value === "object"; | ||||
| 
 | ||||
|  | ||||
| @ -1,18 +1,7 @@ | ||||
| import payload, { GeneratedTypes } from "payload"; | ||||
| import { Collections } from "../constants"; | ||||
| import { StrapiImage } from "../types/strapi"; | ||||
| import { isDefined } from "./asserts"; | ||||
| 
 | ||||
| export const findRecorder = async (name: string): Promise<string> => { | ||||
|   const recorder = await payload.find({ | ||||
|     collection: Collections.Recorders, | ||||
|     where: { username: { equals: name } }, | ||||
|     depth: 0, | ||||
|   }); | ||||
|   if (!recorder.docs[0]) throw new Error(`Recorder ${name} wasn't found`); | ||||
|   return recorder.docs[0].id; | ||||
| }; | ||||
| 
 | ||||
| type UploadStrapiImage = { | ||||
|   image: StrapiImage; | ||||
|   collection: keyof GeneratedTypes["collections"]; | ||||
|  | ||||
| @ -14,7 +14,7 @@ export const capitalize = (string: string): string => { | ||||
|   return [firstLetter.toUpperCase(), ...otherLetters].join(""); | ||||
| }; | ||||
| 
 | ||||
| export const formatToCamelCase = (name: string): string => | ||||
| const formatToCamelCase = (name: string): string => | ||||
|   name | ||||
|     .toLowerCase() | ||||
|     .split(/[ \_-]/g) | ||||
| @ -23,9 +23,7 @@ export const formatToCamelCase = (name: string): string => | ||||
| 
 | ||||
| export const formatToPascalCase = (name: string): string => capitalize(formatToCamelCase(name)); | ||||
| 
 | ||||
| export const plainTextToLexical = ( | ||||
|   text: string | ||||
| ): RichTextContent => ({ | ||||
| export const plainTextToLexical = (text: string): RichTextContent => ({ | ||||
|   root: { | ||||
|     type: "root", | ||||
|     format: "", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrMint
						DrMint