Using the following contentlayer.config.ts in an attempt to create the following relationship:
erDiagram
PROPERTY ||--o{ CONTENT-BLOCK : "has many"
CONTENT-BLOCK ||..|| SIMPLEBLOCK : "contains one of"
CONTENT-BLOCK ||..|| VIDEOBLOCK : "contains one of"
CONTENT-BLOCK ||..|| PROPERTYPREVIEWBLOCK : "contains one of"
PROPERTYPREVIEWBLOCK ||..|| PROPERTY: "refers to one of"
Loading
const HeroBlock = defineNestedType ( ( ) => ( {
name : 'Hero' ,
fields : {
title : { type : 'string' , } ,
subtitle : { type : 'string' , } ,
url : { type : 'string' , } ,
}
} ) )
const SimpleBlock = defineNestedType ( ( ) => ( {
name : 'Simple' ,
fields : {
content : { type : 'string' , } ,
}
} ) )
const PropertyPreviewBlock = defineNestedType ( ( ) => ( {
name : 'PropertyPreview' ,
fields : {
property : { type : 'reference' , to : Property } ,
}
} ) )
const VideoBlock = defineNestedType ( ( ) => ( {
name : 'Video' ,
fields : {
type : { type : 'string' , } ,
coordinates : { type : 'list' , of : { type : 'number' } }
}
} ) )
const GalleryBlock = defineNestedType ( ( ) => ( {
name : 'Gallery' ,
fields : {
type : { type : 'string' , } ,
coordinates : { type : 'list' , of : { type : 'number' } }
}
} ) )
const ContentBlock = defineNestedType ( ( ) => ( {
name : 'ContentBlock' ,
fields : {
content : {
type : 'nested' ,
of : [ HeroBlock , SimpleBlock , PropertyPreviewBlock , VideoBlock , GalleryBlock ]
} ,
}
} ) )
const Property = defineDocumentType ( ( ) => ( {
name : 'Property' ,
filePathPattern : 'properties/**.md' ,
contentType : 'markdown' ,
fields : {
title : { type : 'string' } ,
images : { type : 'list' , of : Image } ,
address : { type : 'nested' , of : PropertyAddress } ,
type : { type : 'nested' , of : PropertyType } ,
map : { type : 'json' , } ,
price : { type : 'number' , } ,
property_type : { type : 'string' } ,
attributes : { type : 'list' , of : PropertyAttribute } ,
content : {
type : 'list' ,
of : ContentBlock
}
} ,
computedFields : {
slud : {
type : 'string' ,
resolve : ( doc ) => doc . _raw . sourceFileName . replace ( / \. m d / , '' )
}
}
} ) )
But then I end up with this type error:
and these cli errors:
This error shouldn' t have happened. Please consider opening a GitHub issue with the stack trace below here:
https://github.com/contentlayerdev/contentlayer/issues
An unchecked error was produced.
TypeError: Cannot read properties of undefined (reading ' name' )
at IncompatibleFieldDataError.renderLine (file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@contentlayer-source-files-npm-0.2.9-325e8923d3/node_modules/@contentlayer/source-files/src/errors/index.ts:353:74)
at file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@contentlayer-source-files-npm-0.2.9-325e8923d3/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:133:31
at Array.map (<anonymous>)
at aggregateFetchDataErrors (file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@contentlayer-source-files-npm-0.2.9-325e8923d3/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:133:8)
at next (file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@contentlayer-source-files-npm-0.2.9-325e8923d3/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:34:26)
at Generator.next (<anonymous>)
at ISuspend.factory (file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@effect-ts-system-npm-0.57.5-e58c7bc984/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28)
at FiberContext.evaluateNow (file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@effect-ts-system-npm-0.57.5-e58c7bc984/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51)
at file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@effect-ts-system-npm-0.57.5-e58c7bc984/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
at file:///home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/@effect-ts-system-npm-0.57.5-e58c7bc984/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9
Fiber: #23 (started at: 2022-12-30T23:13:16.209Z) was supposed to continue to:
a future continuation at packages/@contentlayer/source-files/src/fetchData/index.ts:102:21
Fiber: #23 (started at: 2022-12-30T23:13:16.209Z) Execution trace:
packages/@contentlayer/source-files/src/errors/aggregate.ts:27:8
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:74:15
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:139:37
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:134:8
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:72:43
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:68:16
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:67:16
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:56:24
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:53:49
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:122:10
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:118:22
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:47:44
packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:46:10
Fiber: #23 (started at: 2022-12-30T23:13:16.209Z) was spawned by:
Fiber: #19 (started at: 2022-12-30T23:13:16.208Z) was supposed to continue to: <empty trace>
Fiber: #19 (started at: 2022-12-30T23:13:16.208Z) Execution trace: <empty trace>
Fiber: #19 (started at: 2022-12-30T23:13:16.208Z) was spawned by:
Fiber: #18 (started at: 2022-12-30T23:13:16.207Z) was supposed to continue to: <empty trace>
Fiber: #18 (started at: 2022-12-30T23:13:16.207Z) Execution trace: <empty trace>
Fiber: #18 (started at: 2022-12-30T23:13:16.207Z) was spawned by:
Fiber: #17 (started at: 2022-12-30T23:13:16.198Z) was supposed to continue to: <empty trace>
Fiber: #17 (started at: 2022-12-30T23:13:16.198Z) Execution trace:
packages/@contentlayer/source-files/src/fetchData/index.ts:54:116
packages/@contentlayer/utils/src/node/fs.ts:90:15
packages/@contentlayer/utils/src/node/fs.ts:89:72
packages/@contentlayer/utils/src/node/fs.ts:89:12
packages/@contentlayer/utils/src/node/fs.ts:17:10
packages/@contentlayer/utils/src/node/fs.ts:16:60
packages/@contentlayer/utils/src/node/fs.ts:16:15
packages/@contentlayer/utils/src/node/fs.ts:31:27
packages/@contentlayer/core/src/DataCache.ts:51:31
packages/@contentlayer/core/src/DataCache.ts:50:17
packages/@contentlayer/core/src/ArtifactsDir.ts:31:12
packages/@contentlayer/core/src/cwd.ts:23:43
packages/@contentlayer/utils/src/node/version.ts:21:15
packages/@contentlayer/utils/src/node/version.ts:20:10
packages/@contentlayer/utils/src/node/fs.ts:77:17
packages/@contentlayer/utils/src/node/fs.ts:76:12
packages/@contentlayer/utils/src/node/fs.ts:45:22
packages/@contentlayer/core/src/ArtifactsDir.ts:27:15
packages/@contentlayer/core/src/DataCache.ts:47:38
packages/@contentlayer/core/src/DataCache.ts:46:12
Fiber: #17 (started at: 2022-12-30T23:13:16.198Z) was spawned by:
Fiber: #1 (started at: 2022-12-30T23:13:15.989Z) was supposed to continue to: <empty trace>
Fiber: #1 (started at: 2022-12-30T23:13:15.989Z) Execution trace:
packages/@contentlayer/core/src/cwd.ts:23:43
packages/@contentlayer/core/src/generation/generate-dotpkg.ts:82:13
packages/@contentlayer/core/src/generation/generate-dotpkg.ts:78:16
packages/@contentlayer/cli/src/commands/BuildCommand.ts:26:14
packages/@contentlayer/cli/src/commands/BuildCommand.ts:25:91
packages/@contentlayer/cli/src/commands/BuildCommand.ts:25:12
packages/@contentlayer/core/src/getConfig/index.ts:42:18
packages/@contentlayer/core/src/getConfig/index.ts:41:10
packages/@contentlayer/core/src/getConfig/esbuild.ts:47:15
packages/@contentlayer/core/src/getConfig/esbuild.ts:39:26
packages/@contentlayer/core/src/getConfig/esbuild.ts:37:12
packages/@contentlayer/core/src/getConfig/esbuild.ts:117:12
packages/@contentlayer/core/src/getConfig/esbuild.ts:75:36
packages/@contentlayer/core/src/getConfig/index.ts:198:13
packages/@contentlayer/core/src/getConfig/index.ts:187:28
packages/@contentlayer/core/src/getConfig/index.ts:185:44
packages/@contentlayer/core/src/getConfig/index.ts:172:28
packages/@contentlayer/core/src/getConfig/index.ts:170:31
packages/@contentlayer/core/src/getConfig/index.ts:157:28
packages/@contentlayer/core/src/getConfig/index.ts:155:15
packages/@contentlayer/core/src/getConfig/index.ts:152:15
packages/@contentlayer/core/src/getConfig/index.ts:151:15
packages/@contentlayer/core/src/cwd.ts:23:43
packages/@contentlayer/core/src/getConfig/index.ts:136:27
packages/@contentlayer/core/src/getConfig/index.ts:123:10
Fiber: #1 (started at: 2022-12-30T23:13:15.989Z) was spawned by: <empty trace>
OS: linux 5.19.15-201.fc36.x86_64 (arch: x64)
Process: /home/zenobius/.asdf/installs/nodejs/16.17.0/bin/node /home/zenobius/Projects/Mine/Github/netlifycms-nextjs/node_modules/.store/contentlayer-npm-0.2.9-5fadd70b6f/node_modules/contentlayer/bin/cli.cjs build
Node version: v16.17.0
Contentlayer version: 0.2.9
Using the following
contentlayer.config.tsin an attempt to create the following relationship:erDiagram PROPERTY ||--o{ CONTENT-BLOCK : "has many" CONTENT-BLOCK ||..|| SIMPLEBLOCK : "contains one of" CONTENT-BLOCK ||..|| VIDEOBLOCK : "contains one of" CONTENT-BLOCK ||..|| PROPERTYPREVIEWBLOCK : "contains one of" PROPERTYPREVIEWBLOCK ||..|| PROPERTY: "refers to one of"But then I end up with this type error:
and these cli errors: