The code isn't returning my Documents
import * as prismic from '@prismicio/client';
/**
* @param {Object} args
* @param {prismic.Content.CaseStudiesSlice} args.slice
* @param {{ client: prismic.Client<prismic.Content.AllDocumentTypes> }} args.context
*/
export default async function mapper({ slice, context }) {
const caseStudies = (
await Promise.all(
slice.items.map(async (item) => {
if (prismic.isFilled.contentRelationship(item.case_study)) {
return /** @type {prismic.Content.CaseStudyDocument} */ (
await context.client.getByID(item.case_study.id)
);
}
})
)
).filter(Boolean);
return {
slice,
caseStudies
};
}
Steps taken
Tried primary.case_studies
too but still no documents just sn empty array
Plus
items
has type never[]
And when I go to that documents page it shows Error 500
Package.json file
{
"name": "sveltekit-starter-prismic-minimal",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "concurrently \"npm:vite:dev\" \"npm:slicemachine\" --prefix-colors blue,magenta",
"vite:dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"slicemachine": "start-slicemachine"
},
"devDependencies": {
"@iconify-json/ph": "^1.2.0",
"@slicemachine/adapter-sveltekit": "^0.3.49",
"@sveltejs/adapter-auto": "^3.2.2",
"@sveltejs/kit": "^2.5.15",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"@tailwindcss/typography": "^0.5.15",
"@types/eslint": "^8.56.10",
"autoprefixer": "^10.4.20",
"concurrently": "^8.2.2",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.39.3",
"globals": "^15.4.0",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.6.6",
"slice-machine-ui": "^2.7.1",
"svelte": "^4.2.18",
"svelte-check": "^3.8.0",
"tailwindcss": "^3.4.12",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.0-alpha.20",
"typescript-svelte-plugin": "^0.3.38",
"unplugin-icons": "^0.19.3",
"vite": "^5.3.1"
},
"type": "module",
"dependencies": {
"@fontsource-variable/dm-sans": "^5.1.0",
"@prismicio/client": "^7.9.0",
"@prismicio/svelte": "^1.2.0",
"clsx": "^2.1.1"
}
}