Try migrating to absolute path but payload sucks
This commit is contained in:
		
							parent
							
								
									d52febb766
								
							
						
					
					
						commit
						6c021fdc94
					
				
							
								
								
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| [submodule "src/shared"] | ||||
| 	path = src/shared | ||||
| 	url = https://github.com/Accords-Library/shared-library.git | ||||
							
								
								
									
										10
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @ -1,9 +1,11 @@ | ||||
| { | ||||
|   "css.lint.unknownAtRules": "ignore", | ||||
|   "editor.rulers": [100], | ||||
|   "editor.tabSize": 2, | ||||
|   "typescript.preferences.importModuleSpecifier": "non-relative", | ||||
|   "editor.codeActionsOnSave": { | ||||
|     "source.fixAll": "explicit", | ||||
|     "source.organizeImports": "explicit" | ||||
|   "explorer.fileNesting.enabled": true, | ||||
|   "explorer.fileNesting.patterns": { | ||||
|     "package.json": ".git*, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, .ncurc.*, .nvmrc, *.config.cjs, *.config.js, *.config.ts, *config.json, .*ignore", | ||||
|     ".env": ".env.*", | ||||
|     "README.md": "*.md" | ||||
|   } | ||||
| } | ||||
|  | ||||
							
								
								
									
										56
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										56
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -35,6 +35,8 @@ | ||||
|         "prettier": "3.3.2", | ||||
|         "ts-node": "10.9.2", | ||||
|         "ts-unused-exports": "10.1.0", | ||||
|         "tsconfig-paths": "^4.2.0", | ||||
|         "tsconfig-paths-webpack-plugin": "^4.1.0", | ||||
|         "typescript": "5.4.5" | ||||
|       } | ||||
|     }, | ||||
| @ -12032,19 +12034,7 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tsconfig-paths": { | ||||
|       "version": "3.14.2", | ||||
|       "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", | ||||
|       "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@types/json5": "^0.0.29", | ||||
|         "json5": "^1.0.2", | ||||
|         "minimist": "^1.2.6", | ||||
|         "strip-bom": "^3.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tsconfig-paths/node_modules/json5": { | ||||
|     "node_modules/ts-unused-exports/node_modules/json5": { | ||||
|       "version": "1.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", | ||||
|       "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", | ||||
| @ -12056,6 +12046,46 @@ | ||||
|         "json5": "lib/cli.js" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/ts-unused-exports/node_modules/tsconfig-paths": { | ||||
|       "version": "3.15.0", | ||||
|       "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", | ||||
|       "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@types/json5": "^0.0.29", | ||||
|         "json5": "^1.0.2", | ||||
|         "minimist": "^1.2.6", | ||||
|         "strip-bom": "^3.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tsconfig-paths": { | ||||
|       "version": "4.2.0", | ||||
|       "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", | ||||
|       "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "json5": "^2.2.2", | ||||
|         "minimist": "^1.2.6", | ||||
|         "strip-bom": "^3.0.0" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=6" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tsconfig-paths-webpack-plugin": { | ||||
|       "version": "4.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.1.0.tgz", | ||||
|       "integrity": "sha512-xWFISjviPydmtmgeUAuXp4N1fky+VCtfhOkDUFIv5ea7p4wuTomI4QTrXvFBX2S4jZsmyTSrStQl+E+4w+RzxA==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "chalk": "^4.1.0", | ||||
|         "enhanced-resolve": "^5.7.0", | ||||
|         "tsconfig-paths": "^4.1.2" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=10.13.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tslib": { | ||||
|       "version": "2.6.2", | ||||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", | ||||
|  | ||||
| @ -12,10 +12,11 @@ | ||||
|     "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js", | ||||
|     "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/ && copyfiles -u 1 \"src/sdk.ts\" dist/ && copyfiles -u 1 \"src/constants.ts\" dist/ && copyfiles -u 1 \"src/types/collections.ts\" dist/", | ||||
|     "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types", | ||||
|     "unused-exports": "ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/payload.config.ts;src/constants.ts;src/sdk.ts;src/types/collections.ts'", | ||||
|     "unused-exports": "ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/payload.config.ts;src/types/collections.ts;src/shared/*'", | ||||
|     "prettier": "prettier --list-different --end-of-line auto --write src", | ||||
|     "tsc": "tsc --noEmit", | ||||
|     "precommit": "npm run generate:types && npm run prettier && npm run unused-exports && npm run tsc", | ||||
|     "fetch-submodules": "cd src/shared && git pull && cd ../..", | ||||
|     "precommit": "npm run fetch-submodules && npm run generate:types && npm run prettier && npm run unused-exports && npm run tsc", | ||||
|     "upgrade": "ncu", | ||||
|     "prod": "rm -rf build && rm -rf dist && npm ci && npm run precommit && npm run build && npm run serve" | ||||
|   }, | ||||
| @ -46,6 +47,8 @@ | ||||
|     "prettier": "3.3.2", | ||||
|     "ts-node": "10.9.2", | ||||
|     "ts-unused-exports": "10.1.0", | ||||
|     "tsconfig-paths": "^4.2.0", | ||||
|     "tsconfig-paths-webpack-plugin": "^4.1.0", | ||||
|     "typescript": "5.4.5" | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { Access } from "payload/config"; | ||||
| import { RecordersRoles } from "../../constants"; | ||||
| import { Recorder } from "../../types/collections"; | ||||
| import { isDefined, isUndefined } from "../../utils/asserts"; | ||||
| import { RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const mustBeAdmin: Access<unknown, Recorder> = ({ req: { user } }): boolean => { | ||||
|   if (isUndefined(user)) return false; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { Access } from "payload/config"; | ||||
| import { RecordersRoles } from "../../constants"; | ||||
| import { Recorder } from "../../types/collections"; | ||||
| import { isUndefined } from "../../utils/asserts"; | ||||
| import { RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { isUndefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const mustBeAdminOrSelf: Access<unknown, Recorder> = ({ req: { user } }) => { | ||||
|   if (isUndefined(user)) return false; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { User } from "payload/auth"; | ||||
| import { RecordersRoles } from "../../constants"; | ||||
| import { Recorder } from "../../types/collections"; | ||||
| import { isDefined, isUndefined } from "../../utils/asserts"; | ||||
| import { RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const shownOnlyToAdmin = ({ user }: { user: User }): boolean => { | ||||
|   if (isUndefined(user)) return false; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { FieldAccess } from "payload/types"; | ||||
| import { RecordersRoles } from "../../constants"; | ||||
| import { Recorder } from "../../types/collections"; | ||||
| import { isDefined, isUndefined } from "../../utils/asserts"; | ||||
| import { RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const mustBeAdmin: FieldAccess<any, any, Recorder> = ({ req: { user } }): boolean => { | ||||
|   if (isUndefined(user)) return false; | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { AttributeTypes, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections, AttributeTypes } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const numberBlock: Block = { | ||||
|   slug: "numberBlock", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { AttributeTypes, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections, AttributeTypes } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const tagsBlock: Block = { | ||||
|   slug: "tagsBlock", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { AttributeTypes, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections, AttributeTypes } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const textBlock: Block = { | ||||
|   slug: "textBlock", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { BreakBlockType } from "../constants"; | ||||
| import { BreakBlockType } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const breakBlock: Block = { | ||||
|   slug: "breakBlock", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { createEditor } from "../utils/editor"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| 
 | ||||
| export const cueBlock: Block = { | ||||
|   slug: "cueBlock", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { createEditor } from "../utils/editor"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| 
 | ||||
| export const lineBlock: Block = { | ||||
|   slug: "lineBlock", | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { createEditor } from "../utils/editor"; | ||||
| import { breakBlock } from "./breakBlock"; | ||||
| import { transcriptBlock } from "./transcriptBlock"; | ||||
| import { breakBlock } from "src/blocks/breakBlock"; | ||||
| import { transcriptBlock } from "src/blocks/transcriptBlock"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| 
 | ||||
| const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ | ||||
|   slug: "sectionBlock", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { cueBlock } from "./cueBlock"; | ||||
| import { lineBlock } from "./lineBlock"; | ||||
| import { cueBlock } from "src/blocks/cueBlock"; | ||||
| import { lineBlock } from "src/blocks/lineBlock"; | ||||
| 
 | ||||
| export const transcriptBlock: Block = { | ||||
|   slug: "transcriptBlock", | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { mustBeAdmin } from "../../accesses/fields/mustBeAdmin"; | ||||
| import { AttributeTypes, CollectionGroups, Collections } from "../../constants"; | ||||
| import { iconField } from "../../fields/iconField/iconField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { mustBeAdmin } from "src/accesses/fields/mustBeAdmin"; | ||||
| import { iconField } from "src/fields/iconField/iconField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups, AttributeTypes } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   slug: "slug", | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { getByID } from "./endpoints/getByID"; | ||||
| 
 | ||||
| const fields = { | ||||
|  | ||||
| @ -1,16 +1,20 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointAudio, EndpointAudioPreview, PayloadMedia } from "../../../sdk"; | ||||
| import { Audio } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isAudio, isMediaThumbnail, isNotEmpty } from "../../../utils/asserts"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   PayloadMedia, | ||||
|   EndpointAudioPreview, | ||||
|   EndpointAudio, | ||||
| } from "src/shared/payload/endpoint-types"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isAudio, isNotEmpty, isMediaThumbnail } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   getLanguageId, | ||||
|   convertMediaThumbnailToEndpointPayloadImage, | ||||
|   convertRTCToEndpointRTC, | ||||
|   getLanguageId, | ||||
| } from "../../../utils/endpoints"; | ||||
|   convertCreditsToEndpointCredits, | ||||
| } from "src/utils/endpoints"; | ||||
| import { Audio } from "src/types/collections"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,15 +1,4 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { | ||||
|   QuickFilters, | ||||
|   languageBasedFilters, | ||||
|   publishStatusFilters, | ||||
| } from "../../components/QuickFilters"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "../../utils/versionedCollectionConfig"; | ||||
| import { collectibleBlock } from "./blocks/collectibleBlock"; | ||||
| import { pageBlock } from "./blocks/contentBlock"; | ||||
| import { urlBlock } from "./blocks/urlBlock"; | ||||
| @ -20,6 +9,17 @@ import { beforeValidatePopulateNameField } from "./hooks/beforeValidatePopulateN | ||||
| import { validateDate } from "./validations/validateDate"; | ||||
| import { validateEventsTranslationsDescription } from "./validations/validateEventsTranslationsDescription"; | ||||
| import { validateEventsTranslationsTitle } from "./validations/validateEventsTranslationsTitle"; | ||||
| import { | ||||
|   QuickFilters, | ||||
|   languageBasedFilters, | ||||
|   publishStatusFilters, | ||||
| } from "src/components/QuickFilters"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "src/utils/versionedCollectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   name: "name", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { translatedFields } from "../../../fields/translatedFields/translatedFields"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const collectibleBlock: Block = { | ||||
|   slug: "collectibleBlock", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { Block } from "payload/types"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const pageBlock: Block = { | ||||
|   slug: "pageBlock", | ||||
|  | ||||
| @ -1,12 +1,12 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointChronologyEvent, EndpointSource } from "../../../sdk"; | ||||
| import { ChronologyEvent, CollectibleBlock } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isDefined, isNotEmpty, isPayloadType } from "../../../utils/asserts"; | ||||
| import { convertCreditsToEndpointCredits, getDomainFromUrl } from "../../../utils/endpoints"; | ||||
| import { convertCollectibleToEndpointCollectiblePreview } from "../../Collectibles/endpoints/getBySlugEndpoint"; | ||||
| import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint"; | ||||
| import { convertCollectibleToEndpointCollectiblePreview } from "src/collections/Collectibles/endpoints/getBySlugEndpoint"; | ||||
| import { convertPageToEndpointPagePreview } from "src/collections/Pages/endpoints/getBySlugEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointChronologyEvent, EndpointSource } from "src/shared/payload/endpoint-types"; | ||||
| import { ChronologyEvent, CollectibleBlock } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isDefined, isPayloadType, isNotEmpty } from "src/utils/asserts"; | ||||
| import { convertCreditsToEndpointCredits, getDomainFromUrl } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getAllEndpoint: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { eventToEndpointEvent } from "./getAllEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createStrapiImportEndpoint } from "../../../endpoints/createStrapiImportEndpoint"; | ||||
| import { StrapiLanguage } from "../../../types/strapi"; | ||||
| import { isDefined, isUndefined } from "../../../utils/asserts"; | ||||
| import { plainTextToLexical } from "../../../utils/string"; | ||||
| import { createStrapiImportEndpoint } from "src/endpoints/createStrapiImportEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { StrapiLanguage } from "src/types/strapi"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| import { plainTextToLexical } from "src/utils/string"; | ||||
| 
 | ||||
| type StrapiChronologyItem = { | ||||
|   year: number; | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { FieldHook } from "payload/dist/fields/config/types"; | ||||
| import { ChronologyEvent } from "../../../types/collections"; | ||||
| import { isDefined, isUndefined } from "../../../utils/asserts"; | ||||
| import { ChronologyEvent } from "src/types/collections"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const beforeValidatePopulateNameField: FieldHook< | ||||
|   ChronologyEvent, | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { DateTime } from "luxon"; | ||||
| import { Validate } from "payload/types"; | ||||
| import { ChronologyEvent } from "../../../types/collections"; | ||||
| import { isUndefined } from "../../../utils/asserts"; | ||||
| import { ChronologyEvent } from "src/types/collections"; | ||||
| import { isUndefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const validateDate: Validate<ChronologyEvent["date"] | undefined> = (date) => { | ||||
|   if (isUndefined(date)) return "This field is required."; | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Validate } from "payload/types"; | ||||
| import { ChronologyEvent } from "../../../types/collections"; | ||||
| import { isEmpty } from "../../../utils/asserts"; | ||||
| import { ChronologyEvent } from "src/types/collections"; | ||||
| import { isEmpty } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const validateEventsTranslationsDescription: Validate< | ||||
|   string | undefined, | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { Validate } from "payload/types"; | ||||
| import { ChronologyEvent } from "../../../types/collections"; | ||||
| import { isEmpty } from "../../../utils/asserts"; | ||||
| import { ChronologyEvent } from "src/types/collections"; | ||||
| import { isEmpty } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const validateEventsTranslationsTitle: Validate< | ||||
|   string | undefined, | ||||
|  | ||||
| @ -1,33 +1,33 @@ | ||||
| import { RowLabelArgs } from "payload/dist/admin/components/forms/RowLabel/types"; | ||||
| import { Where } from "payload/types"; | ||||
| import { | ||||
|   CollectibleBindingTypes, | ||||
|   CollectibleNature, | ||||
|   CollectiblePageOrders, | ||||
|   CollectionGroups, | ||||
|   Collections, | ||||
| } from "../../constants"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; | ||||
| import { componentField } from "../../fields/componentField/componentField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; | ||||
| import { beforeDuplicatePiping } from "../../hooks/beforeDuplicatePiping"; | ||||
| import { beforeDuplicateUnpublish } from "../../hooks/beforeDuplicateUnpublish"; | ||||
| import { Collectible } from "../../types/collections"; | ||||
| import { isPayloadType } from "../../utils/asserts"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "../../utils/versionedCollectionConfig"; | ||||
| import { RowLabel } from "./components/RowLabel"; | ||||
| import { getBySlugEndpoint } from "./endpoints/getBySlugEndpoint"; | ||||
| import { getBySlugEndpointGallery } from "./endpoints/getBySlugEndpointGallery"; | ||||
| import { getBySlugEndpointGalleryImage } from "./endpoints/getBySlugEndpointGalleryImage"; | ||||
| import { getBySlugEndpointScanPage } from "./endpoints/getBySlugEndpointScanPage"; | ||||
| import { getBySlugEndpointScans } from "./endpoints/getBySlugEndpointScans"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { backPropagationField } from "src/fields/backPropagationField/backPropagationField"; | ||||
| import { componentField } from "src/fields/componentField/componentField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "src/hooks/beforeDuplicateAddCopyTo"; | ||||
| import { beforeDuplicatePiping } from "src/hooks/beforeDuplicatePiping"; | ||||
| import { beforeDuplicateUnpublish } from "src/hooks/beforeDuplicateUnpublish"; | ||||
| import { | ||||
|   Collections, | ||||
|   CollectionGroups, | ||||
|   CollectibleNature, | ||||
|   CollectibleBindingTypes, | ||||
|   CollectiblePageOrders, | ||||
| } from "src/shared/payload/constants"; | ||||
| import { Collectible } from "src/types/collections"; | ||||
| import { isPayloadType } from "src/utils/asserts"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "src/utils/versionedCollectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   status: "_status", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import React from "react"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| import styled from "styled-components"; | ||||
| import { isDefined } from "../../../utils/asserts"; | ||||
| 
 | ||||
| interface Props { | ||||
|   page?: number; | ||||
|  | ||||
| @ -1,31 +1,31 @@ | ||||
| import { CollectibleNature, Collections } from "../../../constants"; | ||||
| import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; | ||||
| import { EndpointCollectible, EndpointCollectiblePreview } from "../../../sdk"; | ||||
| import { Collectible } from "../../../types/collections"; | ||||
| import { convertAudioToEndpointAudioPreview } from "src/collections/Audios/endpoints/getByID"; | ||||
| import { convertFileToEndpointFilePreview } from "src/collections/Files/endpoints/getByID"; | ||||
| import { convertPageToEndpointPagePreview } from "src/collections/Pages/endpoints/getBySlugEndpoint"; | ||||
| import { convertRecorderToEndpointRecorderPreview } from "src/collections/Recorders/endpoints/getByID"; | ||||
| import { convertVideoToEndpointVideoPreview } from "src/collections/Videos/endpoints/getByID"; | ||||
| import { createGetByEndpoint } from "src/endpoints/createGetByEndpoint"; | ||||
| import { Collections, CollectibleNature } from "src/shared/payload/constants"; | ||||
| import { EndpointCollectiblePreview, EndpointCollectible } from "src/shared/payload/endpoint-types"; | ||||
| import { Collectible } from "src/types/collections"; | ||||
| import { | ||||
|   isAudio, | ||||
|   isDefined, | ||||
|   isFile, | ||||
|   isImage, | ||||
|   isNotEmpty, | ||||
|   isPayloadArrayType, | ||||
|   isPayloadType, | ||||
|   isNotEmpty, | ||||
|   isDefined, | ||||
|   isPayloadArrayType, | ||||
|   isPublished, | ||||
|   isFile, | ||||
|   isScan, | ||||
|   isAudio, | ||||
|   isVideo, | ||||
| } from "../../../utils/asserts"; | ||||
| } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertImageToEndpointPayloadImage, | ||||
|   convertScanToEndpointScanImage, | ||||
|   convertSourceToEndpointSource, | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   getDomainFromUrl, | ||||
| } from "../../../utils/endpoints"; | ||||
| import { convertAudioToEndpointAudioPreview } from "../../Audios/endpoints/getByID"; | ||||
| import { convertFileToEndpointFilePreview } from "../../Files/endpoints/getByID"; | ||||
| import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint"; | ||||
| import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID"; | ||||
| import { convertVideoToEndpointVideoPreview } from "../../Videos/endpoints/getByID"; | ||||
|   convertSourceToEndpointSource, | ||||
|   convertScanToEndpointScanImage, | ||||
| } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpoint = createGetByEndpoint({ | ||||
|   collection: Collections.Collectibles, | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; | ||||
| import { EndpointCollectibleGallery } from "../../../sdk"; | ||||
| import { isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts"; | ||||
| import { createGetByEndpoint } from "src/endpoints/createGetByEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointCollectibleGallery } from "src/shared/payload/endpoint-types"; | ||||
| import { isPayloadType, isNotEmpty, isImage } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertImageToEndpointPayloadImage, | ||||
|   convertSourceToEndpointSource, | ||||
| } from "../../../utils/endpoints"; | ||||
| } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpointGallery = createGetByEndpoint({ | ||||
|   collection: Collections.Collectibles, | ||||
|  | ||||
| @ -1,11 +1,12 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointCollectibleGalleryImage } from "../../../sdk"; | ||||
| import { Collectible, Image } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isDefined, isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts"; | ||||
| import { convertSourceToEndpointSource } from "../../../utils/endpoints"; | ||||
| import { convertImageToEndpointImage } from "../../Images/endpoints/getByID"; | ||||
| import { convertImageToEndpointImage } from "src/collections/Images/endpoints/getByID"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointCollectibleGalleryImage } from "src/shared/payload/endpoint-types"; | ||||
| import { Collectible } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isImage, isPayloadType, isNotEmpty, isDefined } from "src/utils/asserts"; | ||||
| import { convertSourceToEndpointSource } from "src/utils/endpoints"; | ||||
| import { Image } from "src/types/collections"; | ||||
| 
 | ||||
| export const getBySlugEndpointGalleryImage: CollectionEndpoint = { | ||||
|   path: "/slug/:slug/gallery/:index", | ||||
|  | ||||
| @ -1,13 +1,10 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointCollectibleScanPage } from "../../../sdk"; | ||||
| import { Collectible, Scan } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isDefined, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts"; | ||||
| import { | ||||
|   convertScanToEndpointScanImage, | ||||
|   convertSourceToEndpointSource, | ||||
| } from "../../../utils/endpoints"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointCollectibleScanPage } from "src/shared/payload/endpoint-types"; | ||||
| import { Collectible, Scan } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isScan, isPayloadType, isNotEmpty, isDefined } from "src/utils/asserts"; | ||||
| import { convertScanToEndpointScanImage, convertSourceToEndpointSource } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpointScanPage: CollectionEndpoint = { | ||||
|   path: "/slug/:slug/scans/:index", | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; | ||||
| import { EndpointCollectibleScans } from "../../../sdk"; | ||||
| import { Collectible } from "../../../types/collections"; | ||||
| import { isImage, isNotEmpty, isPayloadType, isScan } from "../../../utils/asserts"; | ||||
| import { createGetByEndpoint } from "src/endpoints/createGetByEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointCollectibleScans } from "src/shared/payload/endpoint-types"; | ||||
| import { Collectible } from "src/types/collections"; | ||||
| import { isPayloadType, isNotEmpty, isImage, isScan } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertCreditsToEndpointCredits, | ||||
|   convertImageToEndpointPayloadImage, | ||||
|   convertScanToEndpointScanImage, | ||||
|   convertSourceToEndpointSource, | ||||
| } from "../../../utils/endpoints"; | ||||
|   convertCreditsToEndpointCredits, | ||||
|   convertScanToEndpointScanImage, | ||||
| } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpointScans = createGetByEndpoint({ | ||||
|   collection: Collections.Collectibles, | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { iconField } from "../../fields/iconField/iconField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { iconField } from "src/fields/iconField/iconField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   slug: "slug", | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import { text } from "payload/dist/fields/validations"; | ||||
| import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; | ||||
| import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { getAllEndpoint } from "./endpoints/getAllEndpoint"; | ||||
| import { importFromStrapi } from "./endpoints/importFromStrapi"; | ||||
| import { shownOnlyToAdmin } from "src/accesses/collections/shownOnlyToAdmin"; | ||||
| import { mustBeAdmin } from "src/accesses/fields/mustBeAdmin"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   id: "id", | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { Currency } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { Currency } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| 
 | ||||
| export const getAllEndpoint: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createStrapiImportEndpoint } from "../../../endpoints/createStrapiImportEndpoint"; | ||||
| import { createStrapiImportEndpoint } from "src/endpoints/createStrapiImportEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| type StrapiLanguage = { | ||||
|   code: string; | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { getByID } from "./endpoints/getByID"; | ||||
| 
 | ||||
| const fields = { | ||||
|  | ||||
| @ -1,16 +1,16 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointFile, EndpointFilePreview, PayloadMedia } from "../../../sdk"; | ||||
| import { File } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isFile, isMediaThumbnail, isNotEmpty } from "../../../utils/asserts"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { PayloadMedia, EndpointFilePreview, EndpointFile } from "src/shared/payload/endpoint-types"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isFile, isNotEmpty, isMediaThumbnail } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   getLanguageId, | ||||
|   convertMediaThumbnailToEndpointPayloadImage, | ||||
|   convertRTCToEndpointRTC, | ||||
|   getLanguageId, | ||||
| } from "../../../utils/endpoints"; | ||||
|   convertCreditsToEndpointCredits, | ||||
| } from "src/utils/endpoints"; | ||||
| import { File } from "src/types/collections"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,13 +1,13 @@ | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; | ||||
| import { iconField } from "../../fields/iconField/iconField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { Folder } from "../../types/collections"; | ||||
| import { isPayloadType } from "../../utils/asserts"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { backPropagationField } from "src/fields/backPropagationField/backPropagationField"; | ||||
| import { iconField } from "src/fields/iconField/iconField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { Folder } from "src/types/collections"; | ||||
| import { isPayloadType } from "src/utils/asserts"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { getBySlugEndpoint } from "./endpoints/getBySlugEndpoint"; | ||||
| 
 | ||||
| const fields = { | ||||
|  | ||||
| @ -1,24 +1,24 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; | ||||
| import { EndpointFolder, EndpointFolderPreview } from "../../../sdk"; | ||||
| import { Folder, Language } from "../../../types/collections"; | ||||
| import { convertAudioToEndpointAudioPreview } from "src/collections/Audios/endpoints/getByID"; | ||||
| import { convertCollectibleToEndpointCollectiblePreview } from "src/collections/Collectibles/endpoints/getBySlugEndpoint"; | ||||
| import { convertFileToEndpointFilePreview } from "src/collections/Files/endpoints/getByID"; | ||||
| import { convertImageToEndpointImagePreview } from "src/collections/Images/endpoints/getByID"; | ||||
| import { convertPageToEndpointPagePreview } from "src/collections/Pages/endpoints/getBySlugEndpoint"; | ||||
| import { convertVideoToEndpointVideoPreview } from "src/collections/Videos/endpoints/getByID"; | ||||
| import { createGetByEndpoint } from "src/endpoints/createGetByEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointFolderPreview, EndpointFolder } from "src/shared/payload/endpoint-types"; | ||||
| import { Folder, Language } from "src/types/collections"; | ||||
| import { | ||||
|   isAudio, | ||||
|   isDefined, | ||||
|   isFile, | ||||
|   isImage, | ||||
|   isNotEmpty, | ||||
|   isPayloadType, | ||||
|   isPublished, | ||||
|   isImage, | ||||
|   isAudio, | ||||
|   isVideo, | ||||
| } from "../../../utils/asserts"; | ||||
| import { convertSourceToEndpointSource, getLanguageId } from "../../../utils/endpoints"; | ||||
| import { convertAudioToEndpointAudioPreview } from "../../Audios/endpoints/getByID"; | ||||
| import { convertCollectibleToEndpointCollectiblePreview } from "../../Collectibles/endpoints/getBySlugEndpoint"; | ||||
| import { convertFileToEndpointFilePreview } from "../../Files/endpoints/getByID"; | ||||
| import { convertImageToEndpointImagePreview } from "../../Images/endpoints/getByID"; | ||||
| import { convertPageToEndpointPagePreview } from "../../Pages/endpoints/getBySlugEndpoint"; | ||||
| import { convertVideoToEndpointVideoPreview } from "../../Videos/endpoints/getByID"; | ||||
|   isFile, | ||||
| } from "src/utils/asserts"; | ||||
| import { getLanguageId, convertSourceToEndpointSource } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpoint = createGetByEndpoint({ | ||||
|   collection: Collections.Folders, | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { QuickFilters, languageBasedFilters } from "../../components/QuickFilters"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { QuickFilters, languageBasedFilters } from "src/components/QuickFilters"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "src/hooks/beforeDuplicateAddCopyTo"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   name: "name", | ||||
|  | ||||
| @ -1,15 +1,15 @@ | ||||
| import { Collections } from "../../constants"; | ||||
| import { createImageSizesRegenerationEndpoint } from "../../endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { createImageSizesRegenerationEndpoint } from "src/endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { | ||||
|   buildImageCollectionConfig, | ||||
|   generateOpenGraphSize, | ||||
|   generateWebpSize, | ||||
| } from "../../utils/imageCollectionConfig"; | ||||
| } from "src/utils/imageCollectionConfig"; | ||||
| import { getByID } from "./endpoints/getByID"; | ||||
| 
 | ||||
| const fields = { | ||||
|  | ||||
| @ -1,16 +1,20 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointImage, EndpointImagePreview, PayloadImage } from "../../../sdk"; | ||||
| import { Image } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isImage, isNotEmpty, isPayloadImage } from "../../../utils/asserts"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   PayloadImage, | ||||
|   EndpointImagePreview, | ||||
|   EndpointImage, | ||||
| } from "src/shared/payload/endpoint-types"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isImage, isNotEmpty, isPayloadImage } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   convertRTCToEndpointRTC, | ||||
|   convertSizesToPayloadImages, | ||||
|   getLanguageId, | ||||
| } from "../../../utils/endpoints"; | ||||
|   convertSizesToPayloadImages, | ||||
|   convertRTCToEndpointRTC, | ||||
|   convertCreditsToEndpointCredits, | ||||
| } from "src/utils/endpoints"; | ||||
| import { Image } from "src/types/collections"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,11 +1,10 @@ | ||||
| import { text } from "payload/dist/fields/validations"; | ||||
| import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; | ||||
| import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { getAllEndpoint } from "./endpoints/getAllEndpoint"; | ||||
| import { importFromStrapi } from "./endpoints/importFromStrapi"; | ||||
| import { shownOnlyToAdmin } from "src/accesses/collections/shownOnlyToAdmin"; | ||||
| import { mustBeAdmin } from "src/accesses/fields/mustBeAdmin"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   id: "id", | ||||
| @ -30,7 +29,7 @@ export const Languages = buildCollectionConfig({ | ||||
|   }, | ||||
|   access: { create: mustBeAdmin, update: mustBeAdmin, delete: mustBeAdmin }, | ||||
|   timestamps: false, | ||||
|   endpoints: [importFromStrapi, getAllEndpoint], | ||||
|   endpoints: [getAllEndpoint], | ||||
|   fields: [ | ||||
|     { | ||||
|       name: fields.id, | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { Language } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { Language } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| 
 | ||||
| export const getAllEndpoint: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,18 +0,0 @@ | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createStrapiImportEndpoint } from "../../../endpoints/createStrapiImportEndpoint"; | ||||
| 
 | ||||
| type StrapiLanguage = { | ||||
|   name: string; | ||||
|   code: string; | ||||
| }; | ||||
| 
 | ||||
| export const importFromStrapi = createStrapiImportEndpoint<StrapiLanguage>({ | ||||
|   strapi: { | ||||
|     collection: "languages", | ||||
|     params: {}, | ||||
|   }, | ||||
|   payload: { | ||||
|     collection: Collections.Languages, | ||||
|     convert: ({ code, name }) => ({ id: code, name }), | ||||
|   }, | ||||
| }); | ||||
| @ -1,11 +1,11 @@ | ||||
| import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; | ||||
| import { Collections } from "../../constants"; | ||||
| import { createImageSizesRegenerationEndpoint } from "../../endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { shownOnlyToAdmin } from "src/accesses/collections/shownOnlyToAdmin"; | ||||
| import { createImageSizesRegenerationEndpoint } from "src/endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   buildImageCollectionConfig, | ||||
|   generateOpenGraphSize, | ||||
|   generateWebpSize, | ||||
| } from "../../utils/imageCollectionConfig"; | ||||
| } from "src/utils/imageCollectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   filename: "filename", | ||||
|  | ||||
| @ -1,22 +1,22 @@ | ||||
| import { Where } from "payload/types"; | ||||
| import { breakBlock } from "../../blocks/breakBlock"; | ||||
| import { sectionBlock } from "../../blocks/sectionBlock"; | ||||
| import { transcriptBlock } from "../../blocks/transcriptBlock"; | ||||
| import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; | ||||
| import { beforeDuplicatePiping } from "../../hooks/beforeDuplicatePiping"; | ||||
| import { beforeDuplicateUnpublish } from "../../hooks/beforeDuplicateUnpublish"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "../../utils/versionedCollectionConfig"; | ||||
| import { getBySlugEndpoint } from "./endpoints/getBySlugEndpoint"; | ||||
| import { breakBlock } from "src/blocks/breakBlock"; | ||||
| import { sectionBlock } from "src/blocks/sectionBlock"; | ||||
| import { transcriptBlock } from "src/blocks/transcriptBlock"; | ||||
| import { QuickFilters, publishStatusFilters } from "src/components/QuickFilters"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { backPropagationField } from "src/fields/backPropagationField/backPropagationField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "src/hooks/beforeDuplicateAddCopyTo"; | ||||
| import { beforeDuplicatePiping } from "src/hooks/beforeDuplicatePiping"; | ||||
| import { beforeDuplicateUnpublish } from "src/hooks/beforeDuplicateUnpublish"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { buildVersionedCollectionConfig } from "src/utils/versionedCollectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   slug: "slug", | ||||
|  | ||||
| @ -1,23 +1,26 @@ | ||||
| import { convertRecorderToEndpointRecorderPreview } from "src/collections/Recorders/endpoints/getByID"; | ||||
| import { createGetByEndpoint } from "src/endpoints/createGetByEndpoint"; | ||||
| import { Collections, BreakBlockType } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   EndpointPagePreview, | ||||
|   EndpointPage, | ||||
|   TableOfContentEntry, | ||||
| } from "src/shared/payload/endpoint-types"; | ||||
| import { | ||||
|   BreakBlockType, | ||||
|   Collections, | ||||
|   RichTextContent, | ||||
|   isBlockNodeBreakBlock, | ||||
|   isBlockNodeSectionBlock, | ||||
|   isNodeBlockNode, | ||||
| } from "../../../constants"; | ||||
| import { createGetByEndpoint } from "../../../endpoints/createGetByEndpoint"; | ||||
| import { EndpointPage, EndpointPagePreview, TableOfContentEntry } from "../../../sdk"; | ||||
| import { Page } from "../../../types/collections"; | ||||
| import { isImage, isNotEmpty, isPayloadType } from "../../../utils/asserts"; | ||||
|   isBlockNodeSectionBlock, | ||||
|   isBlockNodeBreakBlock, | ||||
| } from "src/shared/payload/rich-text"; | ||||
| import { Page } from "src/types/collections"; | ||||
| import { isImage, isPayloadType, isNotEmpty } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   convertImageToEndpointPayloadImage, | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertRTCToEndpointRTC, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   convertSourceToEndpointSource, | ||||
| } from "../../../utils/endpoints"; | ||||
| import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID"; | ||||
| } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getBySlugEndpoint = createGetByEndpoint({ | ||||
|   collection: Collections.Pages, | ||||
|  | ||||
| @ -1,16 +1,16 @@ | ||||
| import { mustBeAdmin as mustBeAdminForCollections } from "../../accesses/collections/mustBeAdmin"; | ||||
| import { mustBeAdminOrSelf } from "../../accesses/collections/mustBeAdminOrSelf"; | ||||
| import { mustBeAdmin as mustBeAdminForFields } from "../../accesses/fields/mustBeAdmin"; | ||||
| import { QuickFilters } from "../../components/QuickFilters"; | ||||
| import { CollectionGroups, Collections, RecordersRoles } from "../../constants"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { mustBeAdminOrSelf } from "src/accesses/collections/mustBeAdminOrSelf"; | ||||
| import { QuickFilters } from "src/components/QuickFilters"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups, RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { getByID } from "./endpoints/getByID"; | ||||
| import { importFromStrapi } from "./endpoints/importFromStrapi"; | ||||
| import { beforeLoginMustHaveAtLeastOneRole } from "./hooks/beforeLoginMustHaveAtLeastOneRole"; | ||||
| import { mustBeAdmin as mustBeAdminForCollections } from "src/accesses/collections/mustBeAdmin"; | ||||
| import { mustBeAdmin as mustBeAdminForFields } from "src/accesses/fields/mustBeAdmin"; | ||||
| 
 | ||||
| const fields = { | ||||
|   username: "username", | ||||
|  | ||||
| @ -1,13 +1,10 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointRecorder, EndpointRecorderPreview } from "../../../sdk"; | ||||
| import { Recorder } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isImage, isPayloadType } from "../../../utils/asserts"; | ||||
| import { | ||||
|   convertImageToEndpointPayloadImage, | ||||
|   convertRTCToEndpointRTC, | ||||
| } from "../../../utils/endpoints"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointRecorderPreview, EndpointRecorder } from "src/shared/payload/endpoint-types"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isPayloadType, isImage } from "src/utils/asserts"; | ||||
| import { convertImageToEndpointPayloadImage, convertRTCToEndpointRTC } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { createStrapiImportEndpoint } from "../../../endpoints/createStrapiImportEndpoint"; | ||||
| import { Recorder } from "../../../types/collections"; | ||||
| import { StrapiImage, StrapiLanguage } from "../../../types/strapi"; | ||||
| import { isDefined } from "../../../utils/asserts"; | ||||
| import { uploadStrapiImage } from "../../../utils/localApi"; | ||||
| import { createStrapiImportEndpoint } from "src/endpoints/createStrapiImportEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { StrapiImage, StrapiLanguage } from "src/types/strapi"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| import { uploadStrapiImage } from "src/utils/localApi"; | ||||
| 
 | ||||
| type StrapiRecorder = { | ||||
|   username: string; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; | ||||
| import { Collections } from "../../constants"; | ||||
| import { createImageSizesRegenerationEndpoint } from "../../endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { buildImageCollectionConfig, generateWebpSize } from "../../utils/imageCollectionConfig"; | ||||
| import { shownOnlyToAdmin } from "src/accesses/collections/shownOnlyToAdmin"; | ||||
| import { createImageSizesRegenerationEndpoint } from "src/endpoints/imageSizesRegenerationEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { buildImageCollectionConfig, generateWebpSize } from "src/utils/imageCollectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   filename: "filename", | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { slugField } from "../../fields/slugField/slugField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { slugField } from "src/fields/slugField/slugField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "src/hooks/beforeDuplicateAddCopyTo"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   slug: "slug", | ||||
|  | ||||
| @ -1,14 +1,14 @@ | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { attributesField } from "../../fields/attributesField/attributesField"; | ||||
| import { componentField } from "../../fields/componentField/componentField"; | ||||
| import { creditsField } from "../../fields/creditsField/creditsField"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { Video } from "../../types/collections"; | ||||
| import { isPayloadType } from "../../utils/asserts"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { createEditor } from "../../utils/editor"; | ||||
| import { attributesField } from "src/fields/attributesField/attributesField"; | ||||
| import { componentField } from "src/fields/componentField/componentField"; | ||||
| import { creditsField } from "src/fields/creditsField/creditsField"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { Video } from "src/types/collections"; | ||||
| import { isPayloadType } from "src/utils/asserts"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| import { getByID } from "./endpoints/getByID"; | ||||
| 
 | ||||
| const fields = { | ||||
|  | ||||
| @ -1,24 +1,28 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointVideo, EndpointVideoPreview, PayloadMedia } from "../../../sdk"; | ||||
| import { Video } from "../../../types/collections"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   PayloadMedia, | ||||
|   EndpointVideoPreview, | ||||
|   EndpointVideo, | ||||
| } from "src/shared/payload/endpoint-types"; | ||||
| import { Video } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { | ||||
|   isDefined, | ||||
|   isEmpty, | ||||
|   isMediaThumbnail, | ||||
|   isNotEmpty, | ||||
|   isPayloadType, | ||||
|   isUndefined, | ||||
|   isVideo, | ||||
| } from "../../../utils/asserts"; | ||||
|   isNotEmpty, | ||||
|   isMediaThumbnail, | ||||
|   isUndefined, | ||||
|   isPayloadType, | ||||
|   isEmpty, | ||||
|   isDefined, | ||||
| } from "src/utils/asserts"; | ||||
| import { | ||||
|   convertAttributesToEndpointAttributes, | ||||
|   convertCreditsToEndpointCredits, | ||||
|   getLanguageId, | ||||
|   convertMediaThumbnailToEndpointPayloadImage, | ||||
|   convertRTCToEndpointRTC, | ||||
|   getLanguageId, | ||||
| } from "../../../utils/endpoints"; | ||||
|   convertCreditsToEndpointCredits, | ||||
| } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getByID: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { backPropagationField } from "src/fields/backPropagationField/backPropagationField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   url: "url", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { shownOnlyToAdmin } from "../../accesses/collections/shownOnlyToAdmin"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { shownOnlyToAdmin } from "src/accesses/collections/shownOnlyToAdmin"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| export const VideosSubtitles = buildCollectionConfig({ | ||||
|   slug: Collections.VideosSubtitles, | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import { GlobalConfig } from "payload/types"; | ||||
| import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { imageField } from "../../fields/imageField/imageField"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { globalAfterChangeWebhook } from "../../hooks/afterOperationWebhook"; | ||||
| import { getConfigEndpoint } from "./endpoints/getConfigEndpoint"; | ||||
| import { mustBeAdmin } from "src/accesses/fields/mustBeAdmin"; | ||||
| import { imageField } from "src/fields/imageField/imageField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { globalAfterChangeWebhook } from "src/hooks/afterOperationWebhook"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| const fields = { | ||||
|   homeBackgroundImage: "homeBackgroundImage", | ||||
|  | ||||
| @ -1,10 +1,10 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointWebsiteConfig } from "../../../sdk"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isImage, isPayloadType } from "../../../utils/asserts"; | ||||
| import { convertImageToEndpointPayloadImage } from "../../../utils/endpoints"; | ||||
| import { convertFolderToEndpointFolderPreview } from "../../Folders/endpoints/getBySlugEndpoint"; | ||||
| import { convertFolderToEndpointFolderPreview } from "src/collections/Folders/endpoints/getBySlugEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointWebsiteConfig } from "src/shared/payload/endpoint-types"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isImage, isPayloadType } from "src/utils/asserts"; | ||||
| import { convertImageToEndpointPayloadImage } from "src/utils/endpoints"; | ||||
| 
 | ||||
| export const getConfigEndpoint: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,12 +1,12 @@ | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { mustBeAdmin } from "../../accesses/collections/mustBeAdmin"; | ||||
| import { QuickFilters, languageBasedFilters } from "../../components/QuickFilters"; | ||||
| import { CollectionGroups, Collections } from "../../constants"; | ||||
| import { rowField } from "../../fields/rowField/rowField"; | ||||
| import { translatedFields } from "../../fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; | ||||
| import { buildCollectionConfig } from "../../utils/collectionConfig"; | ||||
| import { getAllEndpoint } from "./endpoints/getAllEndpoint"; | ||||
| import { mustBeAdmin } from "src/accesses/fields/mustBeAdmin"; | ||||
| import { QuickFilters, languageBasedFilters } from "src/components/QuickFilters"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { translatedFields } from "src/fields/translatedFields/translatedFields"; | ||||
| import { beforeDuplicateAddCopyTo } from "src/hooks/beforeDuplicateAddCopyTo"; | ||||
| import { Collections, CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   name: "name", | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import payload from "payload"; | ||||
| import { Collections } from "../../../constants"; | ||||
| import { EndpointWording } from "../../../sdk"; | ||||
| import { CollectionEndpoint } from "../../../types/payload"; | ||||
| import { isPayloadType } from "../../../utils/asserts"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointWording } from "src/shared/payload/endpoint-types"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isPayloadType } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const getAllEndpoint: CollectionEndpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -2,8 +2,8 @@ import { Options } from "payload/dist/collections/operations/local/find"; | ||||
| import QueryString from "qs"; | ||||
| import React from "react"; | ||||
| import { Link } from "react-router-dom"; | ||||
| import { LanguageCodes } from "src/shared/payload/constants"; | ||||
| import styled from "styled-components"; | ||||
| import { LanguageCodes } from "../constants"; | ||||
| 
 | ||||
| type Props = { | ||||
|   slug: string; | ||||
|  | ||||
							
								
								
									
										312
									
								
								src/constants.ts
									
									
									
									
									
								
							
							
						
						
									
										312
									
								
								src/constants.ts
									
									
									
									
									
								
							| @ -1,312 +0,0 @@ | ||||
| import { EndpointAudioPreview, EndpointImagePreview, EndpointVideoPreview } from "./sdk"; | ||||
| import type { BreakBlock, SectionBlock, TranscriptBlock } from "./types/collections"; | ||||
| 
 | ||||
| // END MOCKING SECTION
 | ||||
| 
 | ||||
| export enum Collections { | ||||
|   Attributes = "attributes", | ||||
|   Audios = "audios", | ||||
|   ChronologyEvents = "chronology-events", | ||||
|   Collectibles = "collectibles", | ||||
|   CreditsRole = "credits-roles", | ||||
|   Currencies = "currencies", | ||||
|   Files = "files", | ||||
|   Folders = "folders", | ||||
|   GenericContents = "generic-contents", | ||||
|   Images = "images", | ||||
|   Languages = "languages", | ||||
|   MediaThumbnails = "media-thumbnails", | ||||
|   Pages = "pages", | ||||
|   Recorders = "recorders", | ||||
|   Scans = "scans", | ||||
|   Tags = "tags", | ||||
|   Videos = "videos", | ||||
|   VideosChannels = "videos-channels", | ||||
|   VideosSubtitles = "videos-subtitles", | ||||
|   Wordings = "wordings", | ||||
|   WebsiteConfig = "website-config", | ||||
| } | ||||
| 
 | ||||
| export enum CollectionGroups { | ||||
|   Collections = "Collections", | ||||
|   Media = "Media", | ||||
|   Meta = "Meta", | ||||
| } | ||||
| 
 | ||||
| export enum LanguageCodes { | ||||
|   en = "English", | ||||
|   fr = "French", | ||||
|   ja = "Japan", | ||||
|   es = "Spanish", | ||||
|   "pt-br" = "Portuguese", | ||||
|   "zh" = "Chinese", | ||||
| } | ||||
| 
 | ||||
| export enum BreakBlockType { | ||||
|   sceneBreak = "Scene break", | ||||
|   space = "Empty space", | ||||
|   solidLine = "Solid line", | ||||
|   dottedLine = "Dotted line", | ||||
| } | ||||
| 
 | ||||
| export enum CollectibleBindingTypes { | ||||
|   Paperback = "Paperback", | ||||
|   Hardcover = "Hardcover", | ||||
| } | ||||
| 
 | ||||
| export enum CollectiblePageOrders { | ||||
|   LeftToRight = "Left to right", | ||||
|   RightToLeft = "Right to left", | ||||
| } | ||||
| 
 | ||||
| export enum CollectibleNature { | ||||
|   Physical = "Physical", | ||||
|   Digital = "Digital", | ||||
| } | ||||
| 
 | ||||
| export enum CollectibleContentType { | ||||
|   None = "None", | ||||
|   Indexes = "Index-based", | ||||
|   Pages = "Page-based", | ||||
| } | ||||
| 
 | ||||
| export enum RecordersRoles { | ||||
|   Admin = "Admin", | ||||
|   Recorder = "Recorder", | ||||
|   Api = "Api", | ||||
| } | ||||
| 
 | ||||
| export enum CollectionStatus { | ||||
|   Draft = "draft", | ||||
|   Published = "published", | ||||
| } | ||||
| 
 | ||||
| export enum AttributeTypes { | ||||
|   Number = "Number", | ||||
|   Text = "Text", | ||||
|   Tags = "Tags", | ||||
| } | ||||
| 
 | ||||
| /* WEB HOOKS */ | ||||
| 
 | ||||
| export type AfterOperationWebHookMessage = { | ||||
|   collection: Collections; | ||||
|   id?: string; | ||||
|   addedDependantIds: string[]; | ||||
|   urls: string[]; | ||||
| }; | ||||
| /* RICH TEXT */ | ||||
| 
 | ||||
| export type RichTextContent = { | ||||
|   root: { | ||||
|     children: RichTextNode[]; | ||||
|     direction: ("ltr" | "rtl") | null; | ||||
|     format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
|     indent: number; | ||||
|     type: string; | ||||
|     version: number; | ||||
|   }; | ||||
|   [k: string]: unknown; | ||||
| }; | ||||
| 
 | ||||
| export type RichTextNode = { | ||||
|   type: string; | ||||
|   version: number; | ||||
|   [k: string]: unknown; | ||||
| }; | ||||
| 
 | ||||
| export interface RichTextNodeWithChildren extends RichTextNode { | ||||
|   children: RichTextNode[]; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextParagraphNode extends RichTextNodeWithChildren { | ||||
|   type: "paragraph"; | ||||
|   format: "left" | "start" | "center" | "right" | "end" | "justify" | ""; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextListNode extends RichTextNode { | ||||
|   type: "list"; | ||||
|   children: RichTextNodeWithChildren[]; | ||||
|   listType: string; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextListNumberNode extends RichTextListNode { | ||||
|   listType: "number"; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextListBulletNode extends RichTextListNode { | ||||
|   listType: "bullet"; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextListCheckNode extends RichTextListNode { | ||||
|   listType: "check"; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextLinebreakNode extends RichTextNode { | ||||
|   type: "linebreak"; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextUploadNode extends RichTextNode { | ||||
|   type: "upload"; | ||||
|   relationTo: string; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextUploadImageNode extends RichTextUploadNode { | ||||
|   relationTo: Collections.Images; | ||||
|   value: EndpointImagePreview; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextUploadVideoNode extends RichTextUploadNode { | ||||
|   relationTo: Collections.Videos; | ||||
|   value: EndpointVideoPreview; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextUploadAudioNode extends RichTextUploadNode { | ||||
|   relationTo: Collections.Audios; | ||||
|   value: EndpointAudioPreview; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextTextNode extends RichTextNode { | ||||
|   type: "text"; | ||||
|   format: number; | ||||
|   text: string; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextTabNode extends RichTextNode { | ||||
|   type: "tab"; | ||||
|   format: number; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextLinkNode extends RichTextNodeWithChildren { | ||||
|   type: "link"; | ||||
|   fields: { | ||||
|     linkType: "internal" | "custom"; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextLinkInternalNode extends RichTextLinkNode { | ||||
|   fields: { | ||||
|     linkType: "internal"; | ||||
|     newTab: boolean; | ||||
|     doc: { | ||||
|       relationTo: string; | ||||
|       value: any; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextLinkCustomNode extends RichTextLinkNode { | ||||
|   fields: { | ||||
|     linkType: "custom"; | ||||
|     newTab: boolean; | ||||
|     url: string; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextBlockNode extends RichTextNode { | ||||
|   type: "block"; | ||||
|   fields: { | ||||
|     blockType: string; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextSectionBlock extends RichTextBlockNode { | ||||
|   fields: SectionBlock; | ||||
|   anchorHash: string; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextTranscriptBlock extends RichTextBlockNode { | ||||
|   fields: TranscriptBlock; | ||||
| } | ||||
| 
 | ||||
| export interface RichTextBreakBlock extends RichTextBlockNode { | ||||
|   fields: BreakBlock; | ||||
|   anchorHash: string; | ||||
| } | ||||
| 
 | ||||
| export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode => | ||||
|   node.type === "paragraph"; | ||||
| 
 | ||||
| export const isNodeUploadNode = (node: RichTextNode): node is RichTextUploadNode => | ||||
|   node.type === "upload"; | ||||
| 
 | ||||
| export const isUploadNodeImageNode = (node: RichTextUploadNode): node is RichTextUploadImageNode => | ||||
|   node.relationTo === Collections.Images; | ||||
| 
 | ||||
| export const isUploadNodeVideoNode = (node: RichTextUploadNode): node is RichTextUploadVideoNode => | ||||
|   node.relationTo === Collections.Videos; | ||||
| 
 | ||||
| export const isUploadNodeAudioNode = (node: RichTextUploadNode): node is RichTextUploadAudioNode => | ||||
|   node.relationTo === Collections.Audios; | ||||
| 
 | ||||
| export const isNodeListNode = (node: RichTextNode): node is RichTextListNode => | ||||
|   node.type === "list"; | ||||
| 
 | ||||
| export const isListNodeNumberListNode = (node: RichTextListNode): node is RichTextListNumberNode => | ||||
|   node.listType === "number"; | ||||
| 
 | ||||
| export const isListNodeBulletListNode = (node: RichTextListNode): node is RichTextListBulletNode => | ||||
|   node.listType === "bullet"; | ||||
| 
 | ||||
| export const isListNodeCheckListNode = (node: RichTextListNode): node is RichTextListCheckNode => | ||||
|   node.listType === "check"; | ||||
| 
 | ||||
| export const isNodeLinebreakNode = (node: RichTextNode): node is RichTextLinebreakNode => | ||||
|   node.type === "linebreak"; | ||||
| 
 | ||||
| export const isNodeTextNode = (node: RichTextNode): node is RichTextTextNode => | ||||
|   node.type === "text"; | ||||
| 
 | ||||
| export const isNodeTabNode = (node: RichTextNode): node is RichTextTabNode => node.type === "tab"; | ||||
| 
 | ||||
| export const isNodeLinkNode = (node: RichTextNode): node is RichTextLinkNode => | ||||
|   node.type === "link"; | ||||
| 
 | ||||
| export const isLinkNodeInternalLinkNode = ( | ||||
|   node: RichTextLinkNode | ||||
| ): node is RichTextLinkInternalNode => node.fields.linkType === "internal"; | ||||
| 
 | ||||
| export const isLinkNodeCustomLinkNode = (node: RichTextLinkNode): node is RichTextLinkCustomNode => | ||||
|   node.fields.linkType === "custom"; | ||||
| 
 | ||||
| export const isNodeBlockNode = (node: RichTextNode): node is RichTextBlockNode => | ||||
|   node.type === "block"; | ||||
| 
 | ||||
| export const isBlockNodeSectionBlock = (node: RichTextBlockNode): node is RichTextSectionBlock => | ||||
|   node.fields.blockType === "sectionBlock"; | ||||
| 
 | ||||
| export const isBlockNodeTranscriptBlock = ( | ||||
|   node: RichTextBlockNode | ||||
| ): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock"; | ||||
| 
 | ||||
| export const isBlockNodeBreakBlock = (node: RichTextBlockNode): node is RichTextBreakBlock => | ||||
|   node.fields.blockType === "breakBlock"; | ||||
| 
 | ||||
| /* BLOCKS */ | ||||
| 
 | ||||
| /* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */ | ||||
| export interface CueBlock { | ||||
|   content: RichTextContent; | ||||
|   blockType: "cueBlock"; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
| } | ||||
| 
 | ||||
| export interface LineBlock { | ||||
|   content: RichTextContent; | ||||
|   blockType: "lineBlock"; | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
| } | ||||
| 
 | ||||
| export interface GenericBlock { | ||||
|   id?: string | null; | ||||
|   blockName?: string | null; | ||||
|   blockType: string; | ||||
| } | ||||
| 
 | ||||
| export const isBlockCueBlock = (block: GenericBlock): block is CueBlock => | ||||
|   block.blockType === "cueBlock"; | ||||
| 
 | ||||
| export const isBlockLineBlock = (block: GenericBlock): block is LineBlock => | ||||
|   block.blockType === "lineBlock"; | ||||
| @ -1,6 +1,6 @@ | ||||
| import payload, { GeneratedTypes } from "payload"; | ||||
| import { CollectionEndpoint } from "../types/payload"; | ||||
| import { isPublished } from "../utils/asserts"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isPublished } from "src/utils/asserts"; | ||||
| 
 | ||||
| interface Params<C extends keyof GeneratedTypes["collections"], R> { | ||||
|   collection: C; | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import payload, { GeneratedTypes } from "payload"; | ||||
| import QueryString from "qs"; | ||||
| import { Recorder } from "../types/collections"; | ||||
| import { CollectionEndpoint } from "../types/payload"; | ||||
| import { isDefined } from "../utils/asserts"; | ||||
| import { Recorder } from "src/types/collections"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| const getAllStrapiEntries = async (collectionSlug: string, params: Object): Promise<any[]> => { | ||||
|   let page = 1; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import payload from "payload"; | ||||
| import { Endpoint } from "payload/config"; | ||||
| import { Collections } from "../constants"; | ||||
| import { EndpointAllIds } from "../sdk"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointAllIds } from "src/shared/payload/endpoint-types"; | ||||
| 
 | ||||
| export const getAllIds: Endpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,8 +1,9 @@ | ||||
| import payload from "payload"; | ||||
| import { Endpoint } from "payload/config"; | ||||
| import { Collections } from "../constants"; | ||||
| import { EndpointAllSDKUrls, getSDKEndpoint } from "../sdk"; | ||||
| import { Collectible } from "../types/collections"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { EndpointAllSDKUrls } from "src/shared/payload/endpoint-types"; | ||||
| import { getSDKEndpoint } from "src/shared/payload/sdk"; | ||||
| import { Collectible } from "src/types/collections"; | ||||
| 
 | ||||
| export const getAllSDKUrlsEndpoint: Endpoint = { | ||||
|   method: "get", | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import payload from "payload"; | ||||
| import { CollectionEndpoint } from "../types/payload"; | ||||
| import { CollectionEndpoint } from "src/types/payload"; | ||||
| 
 | ||||
| export const createImageSizesRegenerationEndpoint = ( | ||||
|   collection: "images" | "scans" | "media-thumbnails" | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { BlockField } from "payload/dist/fields/config/types"; | ||||
| import { numberBlock } from "../../blocks/attributeBlocks/numberBlock"; | ||||
| import { tagsBlock } from "../../blocks/attributeBlocks/tagsBlock"; | ||||
| import { textBlock } from "../../blocks/attributeBlocks/textBlock"; | ||||
| import { numberBlock } from "src/blocks/attributeBlocks/numberBlock"; | ||||
| import { tagsBlock } from "src/blocks/attributeBlocks/tagsBlock"; | ||||
| import { textBlock } from "src/blocks/attributeBlocks/textBlock"; | ||||
| 
 | ||||
| type AttributesFieldProps = Omit<BlockField, "type" | "blocks">; | ||||
| 
 | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import payload, { GeneratedTypes } from "payload"; | ||||
| import { FieldBase, SingleRelationshipField } from "payload/dist/fields/config/types"; | ||||
| import { Where } from "payload/types"; | ||||
| import { isEmpty } from "../../utils/asserts"; | ||||
| import { isEmpty } from "src/utils/asserts"; | ||||
| 
 | ||||
| type BackPropagationField = FieldBase & { | ||||
|   where: (data: any) => Where; | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { CollapsibleField, Condition, Field } from "payload/types"; | ||||
| import { capitalize } from "../../utils/string"; | ||||
| import { capitalize } from "src/utils/string"; | ||||
| 
 | ||||
| type Props = { | ||||
|   name: string; | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| import { array } from "payload/dist/fields/validations"; | ||||
| import { ArrayField } from "payload/types"; | ||||
| import { Collections } from "../../constants"; | ||||
| import { Credits } from "../../types/collections"; | ||||
| import { hasDuplicates, isDefined, isPayloadType, isUndefined } from "../../utils/asserts"; | ||||
| import { rowField } from "../rowField/rowField"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { Credits } from "src/types/collections"; | ||||
| import { isDefined, isUndefined, isPayloadType, hasDuplicates } from "src/utils/asserts"; | ||||
| 
 | ||||
| type Props = Omit<ArrayField, "type" | "fields">; | ||||
| 
 | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { icons } from "@iconify-json/material-symbols"; | ||||
| import { TextField } from "payload/types"; | ||||
| import { isEmpty } from "../../utils/asserts"; | ||||
| import { isEmpty } from "src/utils/asserts"; | ||||
| 
 | ||||
| type Props = Omit<TextField, "type" | "hasMany" | "maxRows" | "minRows">; | ||||
| 
 | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { Props } from "payload/components/views/Cell"; | ||||
| import React, { useEffect, useMemo, useState } from "react"; | ||||
| import { Link } from "react-router-dom"; | ||||
| import { isUndefined } from "../../utils/asserts"; | ||||
| import { isUndefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const Cell = ({ cellData, field, rowData, collection }: Props): JSX.Element => { | ||||
|   const [imageURL, setImageURL] = useState<string>(); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { TextField } from "payload/types"; | ||||
| import { isUndefined } from "../../utils/asserts"; | ||||
| import { isUndefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| type Props = Omit<TextField, "type" | "hasMany" | "minRows" | "maxRows">; | ||||
| 
 | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import React from "react"; | ||||
| import { Language } from "../../types/collections"; | ||||
| import { isDefined } from "../../utils/asserts"; | ||||
| import { formatLanguageCode } from "../../utils/string"; | ||||
| import { Language } from "src/types/collections"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| import { formatLanguageCode } from "src/utils/string"; | ||||
| 
 | ||||
| interface Props { | ||||
|   cellData: { language?: string | Language; title?: string }[]; | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import React from "react"; | ||||
| import { Language } from "src/types/collections"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| import { formatLanguageCode, shortenEllipsis } from "src/utils/string"; | ||||
| import styled from "styled-components"; | ||||
| import { Language } from "../../types/collections"; | ||||
| import { isDefined } from "../../utils/asserts"; | ||||
| import { formatLanguageCode, shortenEllipsis } from "../../utils/string"; | ||||
| 
 | ||||
| interface Props { | ||||
|   language?: Language | string; | ||||
|  | ||||
| @ -1,11 +1,11 @@ | ||||
| import { RowLabelArgs } from "payload/dist/admin/components/forms/RowLabel/types"; | ||||
| import { array } from "payload/dist/fields/validations"; | ||||
| import { ArrayField, Field } from "payload/types"; | ||||
| import { Collections } from "../../constants"; | ||||
| import { hasDuplicates, isDefined, isUndefined } from "../../utils/asserts"; | ||||
| import { rowField } from "../rowField/rowField"; | ||||
| import { Cell } from "./Cell"; | ||||
| import { RowLabel } from "./RowLabel"; | ||||
| import { rowField } from "src/fields/rowField/rowField"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { isDefined, isUndefined, hasDuplicates } from "src/utils/asserts"; | ||||
| 
 | ||||
| const fieldsNames = { | ||||
|   language: "language", | ||||
|  | ||||
| @ -3,9 +3,10 @@ import { | ||||
|   AfterChangeHook as CollectionAfterChangeHook, | ||||
| } from "payload/dist/collections/config/types"; | ||||
| import { AfterChangeHook as GlobalAfterChangeHook } from "payload/dist/globals/config/types"; | ||||
| import { AfterOperationWebHookMessage, Collections } from "../constants"; | ||||
| import { getSDKUrlsForDocument } from "../endpoints/getAllSDKUrlsEndpoint"; | ||||
| import { getAddedBackPropagationRelationships } from "../fields/backPropagationField/backPropagationUtils"; | ||||
| import { getSDKUrlsForDocument } from "src/endpoints/getAllSDKUrlsEndpoint"; | ||||
| import { getAddedBackPropagationRelationships } from "src/fields/backPropagationField/backPropagationUtils"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { AfterOperationWebHookMessage } from "src/shared/payload/webhooks"; | ||||
| 
 | ||||
| export const globalAfterChangeWebhook: GlobalAfterChangeHook = async ({ | ||||
|   global, | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { BeforeDuplicate } from "payload/types"; | ||||
| import { CollectionStatus } from "../constants"; | ||||
| import { CollectionStatus } from "src/shared/payload/constants"; | ||||
| 
 | ||||
| export const beforeDuplicateUnpublish: BeforeDuplicate = ({ data }) => ({ | ||||
|   ...data, | ||||
|  | ||||
| @ -4,33 +4,34 @@ import { cloudStorage } from "@payloadcms/plugin-cloud-storage"; | ||||
| import path from "path"; | ||||
| import { buildConfig } from "payload/config"; | ||||
| import { sftpAdapter } from "payloadcms-sftp-storage"; | ||||
| import { Attributes } from "./collections/Attributes/Attributes"; | ||||
| import { Audios } from "./collections/Audios/Audios"; | ||||
| import { ChronologyEvents } from "./collections/ChronologyEvents/ChronologyEvents"; | ||||
| import { Collectibles } from "./collections/Collectibles/Collectibles"; | ||||
| import { CreditsRoles } from "./collections/CreditsRoles/CreditsRoles"; | ||||
| import { Currencies } from "./collections/Currencies/Currencies"; | ||||
| import { Files } from "./collections/Files/Files"; | ||||
| import { Folders } from "./collections/Folders/Folders"; | ||||
| import { GenericContents } from "./collections/GenericContents/GenericContents"; | ||||
| import { Images } from "./collections/Images/Images"; | ||||
| import { Languages } from "./collections/Languages/Languages"; | ||||
| import { MediaThumbnails } from "./collections/MediaThumbnails/MediaThumbnails"; | ||||
| import { Pages } from "./collections/Pages/Pages"; | ||||
| import { Recorders } from "./collections/Recorders/Recorders"; | ||||
| import { Scans } from "./collections/Scans/Scans"; | ||||
| import { Tags } from "./collections/Tags/Tags"; | ||||
| import { Videos } from "./collections/Videos/Videos"; | ||||
| import { VideosChannels } from "./collections/VideosChannels/VideosChannels"; | ||||
| import { VideosSubtitles } from "./collections/VideosSubtitles/VideosSubtitles"; | ||||
| import { WebsiteConfig } from "./collections/WebsiteConfig/WebsiteConfig"; | ||||
| import { Wordings } from "./collections/Wordings/Wordings"; | ||||
| import { Icon } from "./components/Icon"; | ||||
| import { Logo } from "./components/Logo"; | ||||
| import { Collections } from "./constants"; | ||||
| import { getAllIds } from "./endpoints/getAllIdsEndpoint"; | ||||
| import { getAllSDKUrlsEndpoint } from "./endpoints/getAllSDKUrlsEndpoint"; | ||||
| import { createEditor } from "./utils/editor"; | ||||
| import { Attributes } from "src/collections/Attributes/Attributes"; | ||||
| import { Audios } from "src/collections/Audios/Audios"; | ||||
| import { ChronologyEvents } from "src/collections/ChronologyEvents/ChronologyEvents"; | ||||
| import { Collectibles } from "src/collections/Collectibles/Collectibles"; | ||||
| import { CreditsRoles } from "src/collections/CreditsRoles/CreditsRoles"; | ||||
| import { Currencies } from "src/collections/Currencies/Currencies"; | ||||
| import { Files } from "src/collections/Files/Files"; | ||||
| import { Folders } from "src/collections/Folders/Folders"; | ||||
| import { GenericContents } from "src/collections/GenericContents/GenericContents"; | ||||
| import { Images } from "src/collections/Images/Images"; | ||||
| import { Languages } from "src/collections/Languages/Languages"; | ||||
| import { MediaThumbnails } from "src/collections/MediaThumbnails/MediaThumbnails"; | ||||
| import { Pages } from "src/collections/Pages/Pages"; | ||||
| import { Recorders } from "src/collections/Recorders/Recorders"; | ||||
| import { Scans } from "src/collections/Scans/Scans"; | ||||
| import { Tags } from "src/collections/Tags/Tags"; | ||||
| import { Videos } from "src/collections/Videos/Videos"; | ||||
| import { VideosChannels } from "src/collections/VideosChannels/VideosChannels"; | ||||
| import { VideosSubtitles } from "src/collections/VideosSubtitles/VideosSubtitles"; | ||||
| import { WebsiteConfig } from "src/collections/WebsiteConfig/WebsiteConfig"; | ||||
| import { Wordings } from "src/collections/Wordings/Wordings"; | ||||
| import { Icon } from "src/components/Icon"; | ||||
| import { Logo } from "src/components/Logo"; | ||||
| import { getAllIds } from "src/endpoints/getAllIdsEndpoint"; | ||||
| import { getAllSDKUrlsEndpoint } from "src/endpoints/getAllSDKUrlsEndpoint"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { createEditor } from "src/utils/editor"; | ||||
| // import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
 | ||||
| 
 | ||||
| const configuredSftpAdapter = sftpAdapter({ | ||||
|   connectOptions: { | ||||
| @ -54,6 +55,22 @@ export default buildConfig({ | ||||
|     }, | ||||
|     css: path.resolve(__dirname, "styles.scss"), | ||||
|     bundler: webpackBundler(), | ||||
|     webpack: (config) => ({ | ||||
|       ...config, | ||||
|       resolve: { | ||||
|         ...config.resolve, | ||||
|         // plugins: [
 | ||||
|         //   ...(config.resolve?.plugins ?? []),
 | ||||
|         //   new TsconfigPathsPlugin({
 | ||||
|         //     /* options: see below */
 | ||||
|         //   }),
 | ||||
|         // ],
 | ||||
|         alias: { | ||||
|           ...config.resolve?.alias, | ||||
|           "src/": path.resolve(__dirname, "src"), | ||||
|         }, | ||||
|       }, | ||||
|     }), | ||||
|   }, | ||||
|   editor: createEditor({}), | ||||
|   collections: [ | ||||
|  | ||||
							
								
								
									
										727
									
								
								src/sdk.ts
									
									
									
									
									
								
							
							
						
						
									
										727
									
								
								src/sdk.ts
									
									
									
									
									
								
							| @ -1,727 +0,0 @@ | ||||
| import { | ||||
|   AttributeTypes, | ||||
|   CollectibleBindingTypes, | ||||
|   CollectibleNature, | ||||
|   CollectiblePageOrders, | ||||
|   Collections, | ||||
|   RichTextContent, | ||||
| } from "./constants"; | ||||
| import { Currency, Language } from "./types/collections"; | ||||
| 
 | ||||
| // END MOCKING SECTION
 | ||||
| 
 | ||||
| export type EndpointFolderPreview = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   icon?: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     title: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointFolder = Omit<EndpointFolderPreview, "translations"> & { | ||||
|   translations: (EndpointFolderPreview["translations"][number] & { | ||||
|     description?: RichTextContent; | ||||
|   })[]; | ||||
|   sections: | ||||
|     | { type: "single"; subfolders: EndpointFolderPreview[] } | ||||
|     | { | ||||
|         type: "multiple"; | ||||
|         sections: { | ||||
|           translations: { language: string; name: string }[]; | ||||
|           subfolders: EndpointFolderPreview[]; | ||||
|         }[]; | ||||
|       }; | ||||
|   files: ( | ||||
|     | { | ||||
|         relationTo: Collections.Collectibles; | ||||
|         value: EndpointCollectiblePreview; | ||||
|       } | ||||
|     | { | ||||
|         relationTo: Collections.Pages; | ||||
|         value: EndpointPagePreview; | ||||
|       } | ||||
|     | { | ||||
|         relationTo: Collections.Images; | ||||
|         value: EndpointImagePreview; | ||||
|       } | ||||
|     | { | ||||
|         relationTo: Collections.Audios; | ||||
|         value: EndpointAudioPreview; | ||||
|       } | ||||
|     | { | ||||
|         relationTo: Collections.Videos; | ||||
|         value: EndpointVideoPreview; | ||||
|       } | ||||
|     | { | ||||
|         relationTo: Collections.Files; | ||||
|         value: EndpointFilePreview; | ||||
|       } | ||||
|   )[]; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointWebsiteConfig = { | ||||
|   home: { | ||||
|     backgroundImage?: EndpointPayloadImage; | ||||
|     folders: (EndpointFolderPreview & { | ||||
|       lightThumbnail?: EndpointPayloadImage; | ||||
|       darkThumbnail?: EndpointPayloadImage; | ||||
|     })[]; | ||||
|   }; | ||||
|   timeline: { | ||||
|     backgroundImage?: EndpointPayloadImage; | ||||
|     breaks: number[]; | ||||
|     eventCount: number; | ||||
|     eras: { | ||||
|       startingYear: number; | ||||
|       endingYear: number; | ||||
|       name: string; | ||||
|     }[]; | ||||
|   }; | ||||
|   defaultOpenGraphImage?: EndpointPayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointRecorderPreview = { | ||||
|   id: string; | ||||
|   username: string; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointRecorder = EndpointRecorderPreview & { | ||||
|   avatar?: EndpointPayloadImage; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     biography: RichTextContent; | ||||
|   }[]; | ||||
|   languages: string[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointWording = { | ||||
|   name: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     name: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointTag = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   page?: { slug: string }; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     name: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointGenericAttribute = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   icon: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     name: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointNumberAttribute = EndpointGenericAttribute & { | ||||
|   type: AttributeTypes.Number; | ||||
|   value: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointTextAttribute = EndpointGenericAttribute & { | ||||
|   type: AttributeTypes.Text; | ||||
|   value: string; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointTagsAttribute = EndpointGenericAttribute & { | ||||
|   type: AttributeTypes.Tags; | ||||
|   value: EndpointTag[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointAttribute = | ||||
|   | EndpointNumberAttribute | ||||
|   | EndpointTextAttribute | ||||
|   | EndpointTagsAttribute; | ||||
| 
 | ||||
| export type EndpointRole = { | ||||
|   id: string; | ||||
|   icon: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     name: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCredit = { | ||||
|   role: EndpointRole; | ||||
|   recorders: EndpointRecorderPreview[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointPagePreview = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   attributes: EndpointAttribute[]; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|   }[]; | ||||
|   updatedAt: string; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointPage = Omit<EndpointPagePreview, "translations"> & { | ||||
|   backgroundImage?: EndpointPayloadImage; | ||||
|   translations: (EndpointPagePreview["translations"][number] & { | ||||
|     sourceLanguage: string; | ||||
|     summary?: RichTextContent; | ||||
|     content: RichTextContent; | ||||
|     credits: EndpointCredit[]; | ||||
|     toc: TableOfContentEntry[]; | ||||
|   })[]; | ||||
|   createdAt: string; | ||||
|   updatedBy?: EndpointRecorderPreview; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectiblePreview = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|   }[]; | ||||
|   attributes: EndpointAttribute[]; | ||||
|   releaseDate?: string; | ||||
|   languages: string[]; | ||||
|   price?: { | ||||
|     amount: number; | ||||
|     currency: string; | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectible = Omit<EndpointCollectiblePreview, "translations"> & { | ||||
|   translations: (EndpointCollectiblePreview["translations"][number] & { | ||||
|     description?: RichTextContent; | ||||
|   })[]; | ||||
|   backgroundImage?: EndpointPayloadImage; | ||||
|   nature: CollectibleNature; | ||||
|   gallery?: { count: number; thumbnail: EndpointPayloadImage }; | ||||
|   scans?: { count: number; thumbnail: EndpointPayloadImage }; | ||||
|   urls: { url: string; label: string }[]; | ||||
|   size?: { | ||||
|     width: number; | ||||
|     height: number; | ||||
|     thickness?: number; | ||||
|   }; | ||||
|   weight?: number; | ||||
|   pageInfo?: { | ||||
|     pageCount: number; | ||||
|     bindingType?: CollectibleBindingTypes; | ||||
|     pageOrder?: CollectiblePageOrders; | ||||
|   }; | ||||
|   subitems: EndpointCollectiblePreview[]; | ||||
|   files: EndpointFilePreview[]; | ||||
|   contents: { | ||||
|     content: | ||||
|       | { | ||||
|           relationTo: Collections.Pages; | ||||
|           value: EndpointPagePreview; | ||||
|         } | ||||
|       | { | ||||
|           relationTo: Collections.Audios; | ||||
|           value: EndpointAudioPreview; | ||||
|         } | ||||
|       | { | ||||
|           relationTo: Collections.Videos; | ||||
|           value: EndpointVideoPreview; | ||||
|         } | ||||
|       | { | ||||
|           relationTo: Collections.GenericContents; | ||||
|           value: { | ||||
|             translations: { | ||||
|               language: string; | ||||
|               name: string; | ||||
|             }[]; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|     range?: | ||||
|       | { | ||||
|           type: "pageRange"; | ||||
|           start: number; | ||||
|           end: number; | ||||
|         } | ||||
|       | { | ||||
|           type: "timeRange"; | ||||
|           start: string; | ||||
|           end: string; | ||||
|         } | ||||
|       | { | ||||
|           type: "other"; | ||||
|           translations: { | ||||
|             language: string; | ||||
|             note: RichTextContent; | ||||
|           }[]; | ||||
|         }; | ||||
|   }[]; | ||||
|   createdAt: string; | ||||
|   updatedAt: string; | ||||
|   updatedBy?: EndpointRecorderPreview; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectibleScans = { | ||||
|   slug: string; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|     description?: RichTextContent; | ||||
|   }[]; | ||||
|   credits: EndpointCredit[]; | ||||
|   cover?: { | ||||
|     front?: EndpointScanImage; | ||||
|     spine?: EndpointScanImage; | ||||
|     back?: EndpointScanImage; | ||||
|     insideFront?: EndpointScanImage; | ||||
|     insideBack?: EndpointScanImage; | ||||
|     flapFront?: EndpointScanImage; | ||||
|     flapBack?: EndpointScanImage; | ||||
|     insideFlapFront?: EndpointScanImage; | ||||
|     insideFlapBack?: EndpointScanImage; | ||||
|   }; | ||||
|   dustjacket?: { | ||||
|     front?: EndpointScanImage; | ||||
|     spine?: EndpointScanImage; | ||||
|     back?: EndpointScanImage; | ||||
|     insideFront?: EndpointScanImage; | ||||
|     insideSpine?: EndpointScanImage; | ||||
|     insideBack?: EndpointScanImage; | ||||
|     flapFront?: EndpointScanImage; | ||||
|     flapBack?: EndpointScanImage; | ||||
|     insideFlapFront?: EndpointScanImage; | ||||
|     insideFlapBack?: EndpointScanImage; | ||||
|   }; | ||||
|   obi?: { | ||||
|     front?: EndpointScanImage; | ||||
|     spine?: EndpointScanImage; | ||||
|     back?: EndpointScanImage; | ||||
|     insideFront?: EndpointScanImage; | ||||
|     insideSpine?: EndpointScanImage; | ||||
|     insideBack?: EndpointScanImage; | ||||
|     flapFront?: EndpointScanImage; | ||||
|     flapBack?: EndpointScanImage; | ||||
|     insideFlapFront?: EndpointScanImage; | ||||
|     insideFlapBack?: EndpointScanImage; | ||||
|   }; | ||||
|   pages: EndpointScanImage[]; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectibleGallery = { | ||||
|   slug: string; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|     description?: RichTextContent; | ||||
|   }[]; | ||||
|   images: EndpointPayloadImage[]; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectibleGalleryImage = { | ||||
|   slug: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|     description?: RichTextContent; | ||||
|   }[]; | ||||
|   image: EndpointImage; | ||||
|   previousIndex?: string; | ||||
|   nextIndex?: string; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointCollectibleScanPage = { | ||||
|   slug: string; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|     description?: RichTextContent; | ||||
|   }[]; | ||||
|   image: EndpointScanImage; | ||||
|   previousIndex?: string; | ||||
|   nextIndex?: string; | ||||
|   parentPages: EndpointSource[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointScanImage = PayloadImage & { | ||||
|   index: string; | ||||
|   sizes: PayloadImage[]; | ||||
| }; | ||||
| 
 | ||||
| export type TableOfContentEntry = { | ||||
|   prefix: string; | ||||
|   title: string; | ||||
|   type: "sceneBreak" | "break" | "section"; | ||||
|   index: number; | ||||
|   children: TableOfContentEntry[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointChronologyEvent = { | ||||
|   id: string; | ||||
|   date: { | ||||
|     year: number; | ||||
|     month?: number; | ||||
|     day?: number; | ||||
|   }; | ||||
|   events: { | ||||
|     sources: EndpointSource[]; | ||||
|     translations: { | ||||
|       language: string; | ||||
|       sourceLanguage: string; | ||||
|       title?: string; | ||||
|       description?: RichTextContent; | ||||
|       notes?: RichTextContent; | ||||
|       credits: EndpointCredit[]; | ||||
|     }[]; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointSourcePreview = { | ||||
|   id: string; | ||||
|   slug: string; | ||||
|   translations: { language: string; pretitle?: string; title: string; subtitle?: string }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointSource = | ||||
|   | { type: "url"; url: string; label: string } | ||||
|   | { | ||||
|       type: "collectible"; | ||||
|       collectible: EndpointSourcePreview; | ||||
|       range?: | ||||
|         | { type: "page"; page: number } | ||||
|         | { type: "timestamp"; timestamp: 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 = { | ||||
|   id: string; | ||||
|   url: string; | ||||
|   filename: string; | ||||
|   mimeType: string; | ||||
|   attributes: EndpointAttribute[]; | ||||
|   translations: { | ||||
|     language: string; | ||||
|     pretitle?: string; | ||||
|     title: string; | ||||
|     subtitle?: string; | ||||
|   }[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointMedia = Omit<EndpointMediaPreview, "translations"> & { | ||||
|   filesize: number; | ||||
|   updatedAt: string; | ||||
|   createdAt: string; | ||||
|   translations: (EndpointMediaPreview["translations"][number] & { | ||||
|     description?: RichTextContent; | ||||
|   })[]; | ||||
|   credits: EndpointCredit[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointImagePreview = EndpointMediaPreview & { | ||||
|   width: number; | ||||
|   height: number; | ||||
|   sizes: PayloadImage[]; | ||||
|   openGraph?: PayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointImage = EndpointMedia & { | ||||
|   width: number; | ||||
|   height: number; | ||||
|   sizes: PayloadImage[]; | ||||
|   openGraph?: PayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointAudioPreview = EndpointMediaPreview & { | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   duration: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointAudio = EndpointMedia & { | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   duration: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointVideoPreview = EndpointMediaPreview & { | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   subtitles: { | ||||
|     language: string; | ||||
|     url: string; | ||||
|   }[]; | ||||
|   duration: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointVideo = EndpointMedia & { | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
|   subtitles: { | ||||
|     language: string; | ||||
|     url: string; | ||||
|   }[]; | ||||
|   platform?: { | ||||
|     channel: { | ||||
|       url: string; | ||||
|       title: string; | ||||
|       subscribers: number; | ||||
|     }; | ||||
|     views?: number; | ||||
|     likes?: number; | ||||
|     dislikes?: number; | ||||
|     url: string; | ||||
|     publishedDate: string; | ||||
|   }; | ||||
|   duration: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointFilePreview = EndpointMediaPreview & { | ||||
|   filesize: number; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointFile = EndpointMedia & { | ||||
|   filesize: number; | ||||
|   thumbnail?: EndpointPayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointPayloadImage = PayloadImage & { | ||||
|   sizes: PayloadImage[]; | ||||
|   openGraph?: PayloadImage; | ||||
| }; | ||||
| 
 | ||||
| export type PayloadMedia = { | ||||
|   id: string; | ||||
|   url: string; | ||||
|   mimeType: string; | ||||
|   filename: string; | ||||
|   filesize: number; | ||||
| }; | ||||
| 
 | ||||
| export type PayloadImage = PayloadMedia & { | ||||
|   width: number; | ||||
|   height: number; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointAllSDKUrls = { | ||||
|   urls: string[]; | ||||
| }; | ||||
| 
 | ||||
| export type EndpointAllIds = { | ||||
|   collectibles: { slugs: string[] }; | ||||
|   pages: { slugs: string[] }; | ||||
|   folders: { slugs: string[] }; | ||||
|   videos: { ids: string[] }; | ||||
|   audios: { ids: string[] }; | ||||
|   images: { ids: string[] }; | ||||
|   files: { ids: string[] }; | ||||
|   recorders: { ids: string[] }; | ||||
|   chronologyEvents: { ids: string[] }; | ||||
| }; | ||||
| 
 | ||||
| // SDK
 | ||||
| 
 | ||||
| export const getSDKEndpoint = { | ||||
|   getConfigEndpoint: () => `/globals/${Collections.WebsiteConfig}/config`, | ||||
|   getFolderEndpoint: (slug: string) => `/${Collections.Folders}/slug/${slug}`, | ||||
|   getLanguagesEndpoint: () => `/${Collections.Languages}/all`, | ||||
|   getCurrenciesEndpoint: () => `/${Collections.Currencies}/all`, | ||||
|   getWordingsEndpoint: () => `/${Collections.Wordings}/all`, | ||||
|   getPageEndpoint: (slug: string) => `/${Collections.Pages}/slug/${slug}`, | ||||
|   getCollectibleEndpoint: (slug: string) => `/${Collections.Collectibles}/slug/${slug}`, | ||||
|   getCollectibleScansEndpoint: (slug: string) => `/${Collections.Collectibles}/slug/${slug}/scans`, | ||||
|   getCollectibleScanPageEndpoint: (slug: string, index: string) => | ||||
|     `/${Collections.Collectibles}/slug/${slug}/scans/${index}`, | ||||
|   getCollectibleGalleryEndpoint: (slug: string) => | ||||
|     `/${Collections.Collectibles}/slug/${slug}/gallery`, | ||||
|   getCollectibleGalleryImageEndpoint: (slug: string, index: string) => | ||||
|     `/${Collections.Collectibles}/slug/${slug}/gallery/${index}`, | ||||
|   getChronologyEventsEndpoint: () => `/${Collections.ChronologyEvents}/all`, | ||||
|   getChronologyEventByIDEndpoint: (id: string) => `/${Collections.ChronologyEvents}/id/${id}`, | ||||
|   getImageByIDEndpoint: (id: string) => `/${Collections.Images}/id/${id}`, | ||||
|   getAudioByIDEndpoint: (id: string) => `/${Collections.Audios}/id/${id}`, | ||||
|   getVideoByIDEndpoint: (id: string) => `/${Collections.Videos}/id/${id}`, | ||||
|   getFileByIDEndpoint: (id: string) => `/${Collections.Files}/id/${id}`, | ||||
|   getRecorderByIDEndpoint: (id: string) => `/${Collections.Recorders}/id/${id}`, | ||||
|   getAllSDKUrlsEndpoint: () => `/all-sdk-urls`, | ||||
|   getAllIds: () => `/all-ids`, | ||||
|   getLoginEndpoint: () => `/${Collections.Recorders}/login`, | ||||
| }; | ||||
| 
 | ||||
| type PayloadSDKResponse<T> = { | ||||
|   data: T; | ||||
|   endpointCalled: string; | ||||
| }; | ||||
| 
 | ||||
| type PayloadTokenCache = { | ||||
|   set: (token: string, expirationTimestamp: number) => void; | ||||
|   get: () => string | undefined; | ||||
| }; | ||||
| 
 | ||||
| type PayloadDataCache = { | ||||
|   set: (url: string, response: any) => void; | ||||
|   get: (url: string) => any | undefined; | ||||
| }; | ||||
| 
 | ||||
| export class PayloadSDK { | ||||
|   private tokenCache: PayloadTokenCache | undefined; | ||||
|   private dataCache: PayloadDataCache | undefined; | ||||
| 
 | ||||
|   constructor( | ||||
|     private readonly apiURL: string, | ||||
|     private readonly email: string, | ||||
|     private readonly password: string | ||||
|   ) {} | ||||
| 
 | ||||
|   addTokenCache(tokenCache: PayloadTokenCache) { | ||||
|     this.tokenCache = tokenCache; | ||||
|   } | ||||
| 
 | ||||
|   addDataCache(dataCache: PayloadDataCache) { | ||||
|     this.dataCache = dataCache; | ||||
|   } | ||||
| 
 | ||||
|   private logResponse(res: Response) { | ||||
|     console.log(res.status, res.statusText, res.url); | ||||
|   } | ||||
| 
 | ||||
|   private async refreshToken() { | ||||
|     const loginUrl = `${this.apiURL}${getSDKEndpoint.getLoginEndpoint()}`; | ||||
|     const loginResult = await fetch(loginUrl, { | ||||
|       method: "POST", | ||||
|       headers: { "Content-Type": "application/json" }, | ||||
|       body: JSON.stringify({ email: this.email, password: this.password }), | ||||
|     }); | ||||
|     this.logResponse(loginResult); | ||||
| 
 | ||||
|     if (loginResult.status !== 200) { | ||||
|       throw new Error("Unable to login"); | ||||
|     } | ||||
| 
 | ||||
|     const { token, exp } = (await loginResult.json()) as { | ||||
|       token: string; | ||||
|       exp: number; | ||||
|     }; | ||||
|     this.tokenCache?.set(token, exp); | ||||
|     return token; | ||||
|   } | ||||
| 
 | ||||
|   async request<T>(endpoint: string): Promise<PayloadSDKResponse<T>> { | ||||
|     const cachedResponse = this.dataCache?.get(endpoint); | ||||
|     if (cachedResponse) { | ||||
|       return cachedResponse; | ||||
|     } | ||||
| 
 | ||||
|     const result = await fetch(`${this.apiURL}${endpoint}`, { | ||||
|       headers: { | ||||
|         Authorization: `JWT ${this.tokenCache?.get() ?? (await this.refreshToken())}`, | ||||
|       }, | ||||
|     }); | ||||
|     this.logResponse(result); | ||||
| 
 | ||||
|     if (!result.ok) { | ||||
|       throw new Error("Unhandled fetch error"); | ||||
|     } | ||||
| 
 | ||||
|     const response = { data: await result.json(), endpointCalled: endpoint }; | ||||
|     this.dataCache?.set(endpoint, response); | ||||
|     return response; | ||||
|   } | ||||
| 
 | ||||
|   async getConfig(): Promise<PayloadSDKResponse<EndpointWebsiteConfig>> { | ||||
|     return await this.request(getSDKEndpoint.getConfigEndpoint()); | ||||
|   } | ||||
|   async getFolder(slug: string): Promise<PayloadSDKResponse<EndpointFolder>> { | ||||
|     return await this.request(getSDKEndpoint.getFolderEndpoint(slug)); | ||||
|   } | ||||
|   async getLanguages(): Promise<PayloadSDKResponse<Language[]>> { | ||||
|     return await this.request(getSDKEndpoint.getLanguagesEndpoint()); | ||||
|   } | ||||
|   async getCurrencies(): Promise<PayloadSDKResponse<Currency[]>> { | ||||
|     return await this.request(getSDKEndpoint.getCurrenciesEndpoint()); | ||||
|   } | ||||
|   async getWordings(): Promise<PayloadSDKResponse<EndpointWording[]>> { | ||||
|     return await this.request(getSDKEndpoint.getWordingsEndpoint()); | ||||
|   } | ||||
|   async getPage(slug: string): Promise<PayloadSDKResponse<EndpointPage>> { | ||||
|     return await this.request(getSDKEndpoint.getPageEndpoint(slug)); | ||||
|   } | ||||
|   async getCollectible(slug: string): Promise<PayloadSDKResponse<EndpointCollectible>> { | ||||
|     return await this.request(getSDKEndpoint.getCollectibleEndpoint(slug)); | ||||
|   } | ||||
|   async getCollectibleScans(slug: string): Promise<PayloadSDKResponse<EndpointCollectibleScans>> { | ||||
|     return await this.request(getSDKEndpoint.getCollectibleScansEndpoint(slug)); | ||||
|   } | ||||
|   async getCollectibleScanPage( | ||||
|     slug: string, | ||||
|     index: string | ||||
|   ): Promise<PayloadSDKResponse<EndpointCollectibleScanPage>> { | ||||
|     return await this.request(getSDKEndpoint.getCollectibleScanPageEndpoint(slug, index)); | ||||
|   } | ||||
|   async getCollectibleGallery( | ||||
|     slug: string | ||||
|   ): Promise<PayloadSDKResponse<EndpointCollectibleGallery>> { | ||||
|     return await this.request(getSDKEndpoint.getCollectibleGalleryEndpoint(slug)); | ||||
|   } | ||||
|   async getCollectibleGalleryImage( | ||||
|     slug: string, | ||||
|     index: string | ||||
|   ): Promise<PayloadSDKResponse<EndpointCollectibleGalleryImage>> { | ||||
|     return await this.request(getSDKEndpoint.getCollectibleGalleryImageEndpoint(slug, index)); | ||||
|   } | ||||
|   async getChronologyEvents(): Promise<PayloadSDKResponse<EndpointChronologyEvent[]>> { | ||||
|     return await this.request(getSDKEndpoint.getChronologyEventsEndpoint()); | ||||
|   } | ||||
|   async getChronologyEventByID(id: string): Promise<PayloadSDKResponse<EndpointChronologyEvent>> { | ||||
|     return await this.request(getSDKEndpoint.getChronologyEventByIDEndpoint(id)); | ||||
|   } | ||||
|   async getImageByID(id: string): Promise<PayloadSDKResponse<EndpointImage>> { | ||||
|     return await this.request(getSDKEndpoint.getImageByIDEndpoint(id)); | ||||
|   } | ||||
|   async getAudioByID(id: string): Promise<PayloadSDKResponse<EndpointAudio>> { | ||||
|     return await this.request(getSDKEndpoint.getAudioByIDEndpoint(id)); | ||||
|   } | ||||
|   async getVideoByID(id: string): Promise<PayloadSDKResponse<EndpointVideo>> { | ||||
|     return await this.request(getSDKEndpoint.getVideoByIDEndpoint(id)); | ||||
|   } | ||||
|   async getFileByID(id: string): Promise<PayloadSDKResponse<EndpointFile>> { | ||||
|     return await this.request(getSDKEndpoint.getFileByIDEndpoint(id)); | ||||
|   } | ||||
|   async getRecorderByID(id: string): Promise<PayloadSDKResponse<EndpointRecorder>> { | ||||
|     return await this.request(getSDKEndpoint.getRecorderByIDEndpoint(id)); | ||||
|   } | ||||
|   async getAllSdkUrls(): Promise<PayloadSDKResponse<EndpointAllSDKUrls>> { | ||||
|     return await this.request(getSDKEndpoint.getAllSDKUrlsEndpoint()); | ||||
|   } | ||||
|   async getAllIds(): Promise<PayloadSDKResponse<EndpointAllIds>> { | ||||
|     return await this.request(getSDKEndpoint.getAllIds()); | ||||
|   } | ||||
| } | ||||
| @ -1,10 +1,8 @@ | ||||
| import "dotenv/config"; | ||||
| import express from "express"; | ||||
| import { readFileSync } from "fs"; | ||||
| import path from "path"; | ||||
| import payload from "payload"; | ||||
| import { Collections, RecordersRoles } from "./constants"; | ||||
| import { isDefined, isUndefined } from "./utils/asserts"; | ||||
| import { Collections, RecordersRoles } from "src/shared/payload/constants"; | ||||
| import { isUndefined, isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| const app = express(); | ||||
| 
 | ||||
| @ -55,36 +53,6 @@ const start = async () => { | ||||
|     }, | ||||
|   }); | ||||
| 
 | ||||
|   // Add your own express routes here
 | ||||
|   app.use("/public", express.static(path.join(__dirname, "../public"))); | ||||
| 
 | ||||
|   app.get("/api/sdk", (_, res) => { | ||||
|     const removeMockingSection = (text: string): string => { | ||||
|       const lines = text.split("\n"); | ||||
|       const endMockingLine = lines.findIndex((line) => line === "// END MOCKING SECTION") ?? 0; | ||||
|       return lines.slice(endMockingLine + 1).join("\n"); | ||||
|     }; | ||||
| 
 | ||||
|     const removeDeclare = (text: string): string => { | ||||
|       const lines = text.split("\n"); | ||||
|       const startDeclareLine = lines.findIndex((line) => line.startsWith("declare module")) ?? 0; | ||||
|       return lines.slice(0, startDeclareLine).join("\n"); | ||||
|     }; | ||||
| 
 | ||||
|     const result = []; | ||||
| 
 | ||||
|     result.push(removeDeclare(readFileSync(path.join(__dirname, "types/collections.ts"), "utf-8"))); | ||||
| 
 | ||||
|     result.push("/////////////// CONSTANTS ///////////////"); | ||||
|     result.push(removeMockingSection(readFileSync(path.join(__dirname, "constants.ts"), "utf-8"))); | ||||
| 
 | ||||
|     result.push("////////////////// SDK //////////////////"); | ||||
|     result.push(removeMockingSection(readFileSync(path.join(__dirname, "sdk.ts"), "utf-8"))); | ||||
| 
 | ||||
|     res.type("text/plain"); | ||||
|     res.send(result.join("\n\n")); | ||||
|   }); | ||||
| 
 | ||||
|   app.get("/robots.txt", (_, res) => { | ||||
|     res.type("text/plain"); | ||||
|     res.send("User-agent: *\nDisallow: /"); | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| import { RichTextContent, isNodeParagraphNode } from "../constants"; | ||||
| import { PayloadImage, PayloadMedia } from "../sdk"; | ||||
| import { Audio, File, Image, MediaThumbnail, Scan, Video } from "../types/collections"; | ||||
| import { PayloadImage, PayloadMedia } from "src/shared/payload/endpoint-types"; | ||||
| import { RichTextContent, isNodeParagraphNode } from "src/shared/payload/rich-text"; | ||||
| import { Scan, MediaThumbnail, Video, Image, Audio } from "src/types/collections"; | ||||
| import { File } from "src/types/collections"; | ||||
| 
 | ||||
| export const isDefined = <T>(value: T | null | undefined): value is T => | ||||
|   value !== null && value !== undefined; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| import { GeneratedTypes } from "payload"; | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { afterDeleteWebhook, collectionAfterChangeWebhook } from "../hooks/afterOperationWebhook"; | ||||
| import { formatToPascalCase } from "./string"; | ||||
| import { collectionAfterChangeWebhook, afterDeleteWebhook } from "src/hooks/afterOperationWebhook"; | ||||
| import { formatToPascalCase } from "src/utils/string"; | ||||
| 
 | ||||
| type CollectionConfigWithPlugins = CollectionConfig; | ||||
| 
 | ||||
|  | ||||
| @ -1,60 +1,60 @@ | ||||
| import { convertAudioToEndpointAudioPreview } from "../collections/Audios/endpoints/getByID"; | ||||
| import { convertImageToEndpointImagePreview } from "../collections/Images/endpoints/getByID"; | ||||
| import { convertRecorderToEndpointRecorderPreview } from "../collections/Recorders/endpoints/getByID"; | ||||
| import { convertVideoToEndpointVideoPreview } from "../collections/Videos/endpoints/getByID"; | ||||
| import { convertAudioToEndpointAudioPreview } from "src/collections/Audios/endpoints/getByID"; | ||||
| import { convertImageToEndpointImagePreview } from "src/collections/Images/endpoints/getByID"; | ||||
| import { convertRecorderToEndpointRecorderPreview } from "src/collections/Recorders/endpoints/getByID"; | ||||
| import { convertVideoToEndpointVideoPreview } from "src/collections/Videos/endpoints/getByID"; | ||||
| import { AttributeTypes } from "src/shared/payload/constants"; | ||||
| import { | ||||
|   AttributeTypes, | ||||
|   RichTextBreakBlock, | ||||
|   RichTextContent, | ||||
|   RichTextSectionBlock, | ||||
|   RichTextUploadNode, | ||||
|   isBlockNodeBreakBlock, | ||||
|   isBlockNodeSectionBlock, | ||||
|   isNodeBlockNode, | ||||
|   isNodeUploadNode, | ||||
|   isUploadNodeAudioNode, | ||||
|   isUploadNodeImageNode, | ||||
|   isUploadNodeVideoNode, | ||||
| } from "../constants"; | ||||
| import { | ||||
|   EndpointAttribute, | ||||
|   EndpointCredit, | ||||
|   EndpointPayloadImage, | ||||
|   EndpointRole, | ||||
|   EndpointScanImage, | ||||
|   EndpointTag, | ||||
|   EndpointSource, | ||||
|   EndpointSourcePreview, | ||||
|   EndpointTag, | ||||
|   EndpointRole, | ||||
|   EndpointCredit, | ||||
|   EndpointAttribute, | ||||
|   PayloadImage, | ||||
| } from "../sdk"; | ||||
|   EndpointScanImage, | ||||
|   EndpointPayloadImage, | ||||
| } from "src/shared/payload/endpoint-types"; | ||||
| import { | ||||
|   RichTextContent, | ||||
|   isNodeBlockNode, | ||||
|   isBlockNodeSectionBlock, | ||||
|   RichTextSectionBlock, | ||||
|   isBlockNodeBreakBlock, | ||||
|   RichTextBreakBlock, | ||||
|   isNodeUploadNode, | ||||
|   RichTextUploadNode, | ||||
|   isUploadNodeImageNode, | ||||
|   isUploadNodeAudioNode, | ||||
|   isUploadNodeVideoNode, | ||||
| } from "src/shared/payload/rich-text"; | ||||
| import { | ||||
|   Audio, | ||||
|   Collectible, | ||||
|   Credits, | ||||
|   CreditsRole, | ||||
|   Folder, | ||||
|   Image, | ||||
|   Language, | ||||
|   MediaThumbnail, | ||||
|   NumberBlock, | ||||
|   Scan, | ||||
|   Tag, | ||||
|   TagsBlock, | ||||
|   TextBlock, | ||||
|   Audio, | ||||
|   Video, | ||||
| } from "../types/collections"; | ||||
|   Collectible, | ||||
|   Folder, | ||||
|   Language, | ||||
|   CreditsRole, | ||||
|   Credits, | ||||
|   TagsBlock, | ||||
|   NumberBlock, | ||||
|   TextBlock, | ||||
|   Scan, | ||||
|   MediaThumbnail, | ||||
|   Tag, | ||||
| } from "src/types/collections"; | ||||
| import { | ||||
|   isAudio, | ||||
|   isDefined, | ||||
|   isEmpty, | ||||
|   isPayloadType, | ||||
|   isImage, | ||||
|   isAudio, | ||||
|   isVideo, | ||||
|   isNotEmpty, | ||||
|   isPayloadArrayType, | ||||
|   isPayloadImage, | ||||
|   isPayloadType, | ||||
|   isPublished, | ||||
|   isVideo, | ||||
| } from "./asserts"; | ||||
|   isDefined, | ||||
|   isEmpty, | ||||
|   isPayloadImage, | ||||
| } from "src/utils/asserts"; | ||||
| 
 | ||||
| const convertTagToEndpointTag = ({ id, slug, page, translations }: Tag): EndpointTag => ({ | ||||
|   id, | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| import { ImageSize } from "payload/dist/uploads/types"; | ||||
| import { CollectionConfig } from "payload/types"; | ||||
| import { publicAccess } from "../accesses/publicAccess"; | ||||
| import { CollectionGroups } from "../constants"; | ||||
| import { BuildCollectionConfig, buildCollectionConfig } from "./collectionConfig"; | ||||
| import { publicAccess } from "src/accesses/publicAccess"; | ||||
| import { CollectionGroups } from "src/shared/payload/constants"; | ||||
| import { BuildCollectionConfig, buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { | ||||
|   filename: "filename", | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import payload, { GeneratedTypes } from "payload"; | ||||
| import { StrapiImage } from "../types/strapi"; | ||||
| import { isDefined } from "./asserts"; | ||||
| import { StrapiImage } from "src/types/strapi"; | ||||
| import { isDefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| type UploadStrapiImage = { | ||||
|   image: StrapiImage; | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import tags from "language-tags"; | ||||
| import { RichTextContent } from "../constants"; | ||||
| import { isUndefined } from "./asserts"; | ||||
| import { RichTextContent } from "src/shared/payload/rich-text"; | ||||
| import { isUndefined } from "src/utils/asserts"; | ||||
| 
 | ||||
| export const shortenEllipsis = (text: string, length: number): string => | ||||
|   text.length - 3 > length ? `${text.substring(0, length)}...` : text; | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { CollectionBeforeChangeHook, CollectionConfig, RelationshipField } from "payload/types"; | ||||
| import { Collections } from "../constants"; | ||||
| import { BuildCollectionConfig, buildCollectionConfig } from "./collectionConfig"; | ||||
| import { Collections } from "src/shared/payload/constants"; | ||||
| import { BuildCollectionConfig, buildCollectionConfig } from "src/utils/collectionConfig"; | ||||
| 
 | ||||
| const fields = { updatedBy: "updatedBy" }; | ||||
| 
 | ||||
|  | ||||
| @ -32,7 +32,7 @@ | ||||
|     "module": "commonjs" /* Specify what module code is generated. */, | ||||
|     "rootDir": "./src" /* Specify the root folder within your source files. */, | ||||
|     // "moduleResolution": "node10",                     /* Specify how TypeScript looks up a file from a given module specifier. */ | ||||
|     // "baseUrl": "./",                                  /* Specify the base directory to resolve non-relative module names. */ | ||||
|     "baseUrl": "." /* Specify the base directory to resolve non-relative module names. */, | ||||
|     "paths": { | ||||
|       "payload/generated-types": ["./src/payload-types.ts"] | ||||
|     } /* Specify a set of entries that re-map imports to additional lookup locations. */, | ||||
| @ -116,6 +116,7 @@ | ||||
|   "exclude": ["node_modules", "dist", "build"], | ||||
|   "ts-node": { | ||||
|     "transpileOnly": true, | ||||
|     "swc": true | ||||
|     "swc": true, | ||||
|     "require": ["tsconfig-paths/register"] | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrMint
						DrMint