[{"data":1,"prerenderedAt":3323},["ShallowReactive",2],{"navigation_docs":3,"-developers-modules-content":613,"-developers-modules-content-surround":3320},[4,39,101,378,540,562,584,606],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":38},"Start","i-lucide-rocket","\u002Fstart","1.start",[10,14,18,22,26,30,34],{"title":11,"path":12,"stem":13},"Our approach","\u002Fstart\u002Four-approach","1.start\u002F0.our-approach",{"title":15,"path":16,"stem":17},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction",{"title":19,"path":20,"stem":21},"Concepts","\u002Fstart\u002Fconcepts","1.start\u002F2.concepts",{"title":23,"path":24,"stem":25},"Glossary","\u002Fstart\u002Fglossary","1.start\u002F3.glossary",{"title":27,"path":28,"stem":29},"Try it locally","\u002Fstart\u002Ftry-it-locally","1.start\u002F4.try-it-locally",{"title":31,"path":32,"stem":33},"Features","\u002Fstart\u002Ffeatures","1.start\u002F5.features",{"title":35,"path":36,"stem":37},"Questions","\u002Fstart\u002Ffaq","1.start\u002F6.faq",false,{"title":40,"icon":41,"path":42,"stem":43,"children":44,"page":38},"Run SHADE","i-lucide-server","\u002Frun","2.run",[45,49,53,57,61,65,69,73,77,81,85,89,93,97],{"title":46,"path":47,"stem":48},"Setting up an instance (Coolify)","\u002Frun\u002Fcoolify","2.run\u002F1.coolify",{"title":50,"path":51,"stem":52},"Console commands","\u002Frun\u002Fconsole","2.run\u002F10.console",{"title":54,"path":55,"stem":56},"Rotating APP_SECRET","\u002Frun\u002Frotating-app-secret","2.run\u002F11.rotating-app-secret",{"title":58,"path":59,"stem":60},"Checking an instance","\u002Frun\u002Fdoctor","2.run\u002F12.doctor",{"title":62,"path":63,"stem":64},"Self-hosting by hand","\u002Frun\u002Fown-server-by-hand","2.run\u002F13.own-server-by-hand",{"title":66,"path":67,"stem":68},"NixOS (experimental)","\u002Frun\u002Fnixos","2.run\u002F14.nixos",{"title":70,"path":71,"stem":72},"Self-hosting without Coolify","\u002Frun\u002Fown-server","2.run\u002F2.own-server",{"title":74,"path":75,"stem":76},"Hosting the site on a static host","\u002Frun\u002Fstatic-hosts","2.run\u002F3.static-hosts",{"title":78,"path":79,"stem":80},"Licence","\u002Frun\u002Flicence","2.run\u002F4.licence",{"title":82,"path":83,"stem":84},"Updating and backups","\u002Frun\u002Fupdating-and-backups","2.run\u002F5.updating-and-backups",{"title":86,"path":87,"stem":88},"Troubleshooting","\u002Frun\u002Ftroubleshooting","2.run\u002F6.troubleshooting",{"title":90,"path":91,"stem":92},"Logs, request ids, traces and metrics","\u002Frun\u002Flogs","2.run\u002F7.logs",{"title":94,"path":95,"stem":96},"Maintenance mode","\u002Frun\u002Fmaintenance-mode","2.run\u002F8.maintenance-mode",{"title":98,"path":99,"stem":100},"Usage limits","\u002Frun\u002Fusage-limits","2.run\u002F9.usage-limits",{"title":102,"icon":103,"path":104,"stem":105,"children":106},"Guide","i-lucide-book-open","\u002Fguide","3.guide",[107,109,147,192,210,280,310,364],{"title":102,"path":104,"stem":108},"3.guide\u002Findex",{"title":110,"icon":111,"path":112,"stem":113,"children":114,"page":38},"Content","i-lucide-file-text","\u002Fguide\u002Fcontent","3.guide\u002F1.content",[115,119,123,127,131,135,139,143],{"title":116,"path":117,"stem":118},"Collections and entries","\u002Fguide\u002Fcontent\u002Fcollections","3.guide\u002F1.content\u002F1.collections",{"title":120,"path":121,"stem":122},"Field types","\u002Fguide\u002Fcontent\u002Ffields","3.guide\u002F1.content\u002F2.fields",{"title":124,"path":125,"stem":126},"Drafts, publishing and version history","\u002Fguide\u002Fcontent\u002Fversions","3.guide\u002F1.content\u002F3.versions",{"title":128,"path":129,"stem":130},"Languages","\u002Fguide\u002Fcontent\u002Flanguages","3.guide\u002F1.content\u002F4.languages",{"title":132,"path":133,"stem":134},"Data sources","\u002Fguide\u002Fcontent\u002Fdata-sources","3.guide\u002F1.content\u002F5.data-sources",{"title":136,"path":137,"stem":138},"Media","\u002Fguide\u002Fcontent\u002Fmedia","3.guide\u002F1.content\u002F6.media",{"title":140,"path":141,"stem":142},"Search","\u002Fguide\u002Fcontent\u002Fsearch","3.guide\u002F1.content\u002F7.search",{"title":144,"path":145,"stem":146},"Trash","\u002Fguide\u002Fcontent\u002Ftrash","3.guide\u002F1.content\u002F8.trash",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":38},"Website","i-lucide-globe","\u002Fguide\u002Fwebsite","3.guide\u002F2.website",[153,156,160,164,168,172,176,180,184,188],{"title":148,"path":154,"stem":155},"\u002Fguide\u002Fwebsite\u002Fwebsite","3.guide\u002F2.website\u002F1.website",{"title":157,"path":158,"stem":159},"Scroll scenes","\u002Fguide\u002Fwebsite\u002Fscroll-scenes","3.guide\u002F2.website\u002F10.scroll-scenes",{"title":161,"path":162,"stem":163},"Pages and posts","\u002Fguide\u002Fwebsite\u002Fpages","3.guide\u002F2.website\u002F2.pages",{"title":165,"path":166,"stem":167},"The visual editor","\u002Fguide\u002Fwebsite\u002Fvisual-editor","3.guide\u002F2.website\u002F3.visual-editor",{"title":169,"path":170,"stem":171},"Roles and locks","\u002Fguide\u002Fwebsite\u002Froles-and-locks","3.guide\u002F2.website\u002F4.roles-and-locks",{"title":173,"path":174,"stem":175},"Header and footer","\u002Fguide\u002Fwebsite\u002Fheader-and-footer","3.guide\u002F2.website\u002F5.header-and-footer",{"title":177,"path":178,"stem":179},"Theme","\u002Fguide\u002Fwebsite\u002Ftheme","3.guide\u002F2.website\u002F6.theme",{"title":181,"path":182,"stem":183},"Redirects","\u002Fguide\u002Fwebsite\u002Fredirects","3.guide\u002F2.website\u002F7.redirects",{"title":185,"path":186,"stem":187},"Site settings","\u002Fguide\u002Fwebsite\u002Fsite-settings","3.guide\u002F2.website\u002F8.site-settings",{"title":189,"path":190,"stem":191},"The site","\u002Fguide\u002Fwebsite\u002Fthe-site","3.guide\u002F2.website\u002F9.the-site",{"title":193,"icon":194,"path":195,"stem":196,"children":197,"page":38},"Publishing","i-lucide-send","\u002Fguide\u002Fpublishing","3.guide\u002F3.publishing",[198,202,206],{"title":199,"path":200,"stem":201},"Publishing and preview","\u002Fguide\u002Fpublishing\u002Fpublishing","3.guide\u002F3.publishing\u002F1.publishing",{"title":203,"path":204,"stem":205},"Builds","\u002Fguide\u002Fpublishing\u002Fbuilds","3.guide\u002F3.publishing\u002F2.builds",{"title":207,"path":208,"stem":209},"CDN caches","\u002Fguide\u002Fpublishing\u002Fcaches","3.guide\u002F3.publishing\u002F3.caches",{"title":211,"icon":212,"path":213,"stem":214,"children":215,"page":38},"People, security and privacy","i-lucide-shield","\u002Fguide\u002Fpeople-and-security","3.guide\u002F4.people-and-security",[216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276],{"title":217,"path":218,"stem":219},"People in SHADE","\u002Fguide\u002Fpeople-and-security\u002Fpeople-in-shade","3.guide\u002F4.people-and-security\u002F0.people-in-shade",{"title":221,"path":222,"stem":223},"Team and roles","\u002Fguide\u002Fpeople-and-security\u002Fteam","3.guide\u002F4.people-and-security\u002F1.team",{"title":225,"path":226,"stem":227},"Errors and security alerts","\u002Fguide\u002Fpeople-and-security\u002Ferrors","3.guide\u002F4.people-and-security\u002F10.errors",{"title":229,"path":230,"stem":231},"Exporting an instance","\u002Fguide\u002Fpeople-and-security\u002Fexporting","3.guide\u002F4.people-and-security\u002F11.exporting",{"title":233,"path":234,"stem":235},"Organisations","\u002Fguide\u002Fpeople-and-security\u002Forganisations","3.guide\u002F4.people-and-security\u002F12.organisations",{"title":237,"path":238,"stem":239},"Signing in through an identity provider (team)","\u002Fguide\u002Fpeople-and-security\u002Fidentity-providers","3.guide\u002F4.people-and-security\u002F13.identity-providers",{"title":241,"path":242,"stem":243},"System status","\u002Fguide\u002Fpeople-and-security\u002Fsystem-status","3.guide\u002F4.people-and-security\u002F14.system-status",{"title":245,"path":246,"stem":247},"Appearance","\u002Fguide\u002Fpeople-and-security\u002Fappearance","3.guide\u002F4.people-and-security\u002F15.appearance",{"title":249,"path":250,"stem":251},"Accounts and personal pages","\u002Fguide\u002Fpeople-and-security\u002Faccounts","3.guide\u002F4.people-and-security\u002F2.accounts",{"title":253,"path":254,"stem":255},"Signing in (team)","\u002Fguide\u002Fpeople-and-security\u002Fsign-in","3.guide\u002F4.people-and-security\u002F3.sign-in",{"title":257,"path":258,"stem":259},"API tokens","\u002Fguide\u002Fpeople-and-security\u002Fapi-tokens","3.guide\u002F4.people-and-security\u002F4.api-tokens",{"title":261,"path":262,"stem":263},"Audit log","\u002Fguide\u002Fpeople-and-security\u002Faudit","3.guide\u002F4.people-and-security\u002F5.audit",{"title":265,"path":266,"stem":267},"Request protection","\u002Fguide\u002Fpeople-and-security\u002Fprotection","3.guide\u002F4.people-and-security\u002F6.protection",{"title":269,"path":270,"stem":271},"Personal data per person","\u002Fguide\u002Fpeople-and-security\u002Fprivacy","3.guide\u002F4.people-and-security\u002F7.privacy",{"title":273,"path":274,"stem":275},"Data retention","\u002Fguide\u002Fpeople-and-security\u002Fretention","3.guide\u002F4.people-and-security\u002F8.retention",{"title":277,"path":278,"stem":279},"Consent banner","\u002Fguide\u002Fpeople-and-security\u002Fconsent","3.guide\u002F4.people-and-security\u002F9.consent",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":38},"Services","i-lucide-plug","\u002Fguide\u002Fservices","3.guide\u002F5.services",[286,290,294,298,302,306],{"title":287,"path":288,"stem":289},"Email","\u002Fguide\u002Fservices\u002Femail","3.guide\u002F5.services\u002F1.email",{"title":291,"path":292,"stem":293},"Opening hours","\u002Fguide\u002Fservices\u002Fopening-hours","3.guide\u002F5.services\u002F4.opening-hours",{"title":295,"path":296,"stem":297},"Webhooks","\u002Fguide\u002Fservices\u002Fwebhooks","3.guide\u002F5.services\u002F5.webhooks",{"title":299,"path":300,"stem":301},"Locations","\u002Fguide\u002Fservices\u002Flocations","3.guide\u002F5.services\u002F6.locations",{"title":303,"path":304,"stem":305},"VAT rates","\u002Fguide\u002Fservices\u002Fvat-rates","3.guide\u002F5.services\u002F7.vat-rates",{"title":307,"path":308,"stem":309},"Channels","\u002Fguide\u002Fservices\u002Fchannels","3.guide\u002F5.services\u002F8.channels",{"title":311,"icon":312,"path":313,"stem":314,"children":315,"page":38},"InstalledModules","i-lucide-puzzle","\u002Fguide\u002Fmodules","3.guide\u002F6.modules",[316,320,324,328,332,336,340,344,348,352,356,360],{"title":317,"path":318,"stem":319},"Modules","\u002Fguide\u002Fmodules\u002Fmanaging","3.guide\u002F6.modules\u002F1.managing",{"title":321,"path":322,"stem":323},"Dutch services (module)","\u002Fguide\u002Fmodules\u002Fnl","3.guide\u002F6.modules\u002F10.nl",{"title":325,"path":326,"stem":327},"Editorial (module)","\u002Fguide\u002Fmodules\u002Feditorial","3.guide\u002F6.modules\u002F11.editorial",{"title":329,"path":330,"stem":331},"Appointments (module)","\u002Fguide\u002Fmodules\u002Fappointments","3.guide\u002F6.modules\u002F2.appointments",{"title":333,"path":334,"stem":335},"Shop (the commerce module)","\u002Fguide\u002Fmodules\u002Fshop","3.guide\u002F6.modules\u002F3.shop",{"title":337,"path":338,"stem":339},"Untrusted modules","\u002Fguide\u002Fmodules\u002Funtrusted","3.guide\u002F6.modules\u002F4.untrusted",{"title":341,"path":342,"stem":343},"Analytics (module)","\u002Fguide\u002Fmodules\u002Fanalytics","3.guide\u002F6.modules\u002F5.analytics",{"title":345,"path":346,"stem":347},"Error forwarding (module)","\u002Fguide\u002Fmodules\u002Ferror-forwarding","3.guide\u002F6.modules\u002F6.error-forwarding",{"title":349,"path":350,"stem":351},"Client programs","\u002Fguide\u002Fmodules\u002Fprograms","3.guide\u002F6.modules\u002F7.programs",{"title":353,"path":354,"stem":355},"Import and export (module)","\u002Fguide\u002Fmodules\u002Fimport","3.guide\u002F6.modules\u002F8.import",{"title":357,"path":358,"stem":359},"Payments (module)","\u002Fguide\u002Fmodules\u002Fpayments","3.guide\u002F6.modules\u002F8.payments",{"title":361,"path":362,"stem":363},"Forms (module)","\u002Fguide\u002Fmodules\u002Fforms","3.guide\u002F6.modules\u002F9.forms",{"title":365,"icon":366,"path":367,"stem":368,"children":369,"page":38},"AI assistants","i-lucide-bot","\u002Fguide\u002Fai","3.guide\u002F7.ai",[370,374],{"title":371,"path":372,"stem":373},"AI assistants (MCP)","\u002Fguide\u002Fai\u002Fassistants","3.guide\u002F7.ai\u002F1.assistants",{"title":375,"path":376,"stem":377},"Connecting an AI assistant","\u002Fguide\u002Fai\u002Fconnecting","3.guide\u002F7.ai\u002F2.connecting",{"title":379,"icon":380,"path":381,"stem":382,"children":383,"page":38},"Developers","i-lucide-code","\u002Fdevelopers","4.developers",[384,388,392,396,400,404,408,412,416,420,424,428,432,435,489,493,497,501,536],{"title":385,"path":386,"stem":387},"Architecture","\u002Fdevelopers\u002Farchitecture","4.developers\u002F1.architecture",{"title":389,"path":390,"stem":391},"Capabilities","\u002Fdevelopers\u002Fcapabilities","4.developers\u002F10.capabilities",{"title":393,"path":394,"stem":395},"Trust","\u002Fdevelopers\u002Ftrust","4.developers\u002F11.trust",{"title":397,"path":398,"stem":399},"Redis and the ports","\u002Fdevelopers\u002Fredis","4.developers\u002F12.redis",{"title":401,"path":402,"stem":403},"The worker container role","\u002Fdevelopers\u002Fworker","4.developers\u002F13.worker",{"title":405,"path":406,"stem":407},"kv: a module's own key-value storage","\u002Fdevelopers\u002Fkv","4.developers\u002F14.kv",{"title":409,"path":410,"stem":411},"Processes: long-running work on the worker","\u002Fdevelopers\u002Fprocesses","4.developers\u002F15.processes",{"title":413,"path":414,"stem":415},"Network: a module's outgoing calls","\u002Fdevelopers\u002Fnetwork","4.developers\u002F16.network",{"title":417,"path":418,"stem":419},"Realtime","\u002Fdevelopers\u002Frealtime","4.developers\u002F17.realtime",{"title":421,"path":422,"stem":423},"Private files","\u002Fdevelopers\u002Ffiles","4.developers\u002F18.files",{"title":425,"path":426,"stem":427},"Notify","\u002Fdevelopers\u002Fnotify","4.developers\u002F19.notify",{"title":429,"path":430,"stem":431},"Collections","\u002Fdevelopers\u002Fcollections","4.developers\u002F2.collections",{"title":337,"path":433,"stem":434},"\u002Fdevelopers\u002Funtrusted","4.developers\u002F20.untrusted",{"title":436,"icon":312,"path":437,"stem":438,"children":439},"Writing a plugin","\u002Fdevelopers\u002Fmodules","4.developers\u002F3.modules\u002Findex",[440,442,446,450,454,458,462,466,470,473,477,481,485],{"title":441,"path":437,"stem":438},"Writing a module",{"title":443,"path":444,"stem":445},"Module SDK and tooling","\u002Fdevelopers\u002Fmodules\u002Fsdk-and-tooling","4.developers\u002F3.modules\u002F1.sdk-and-tooling",{"title":447,"path":448,"stem":449},"Connecting accounts with OAuth2","\u002Fdevelopers\u002Fmodules\u002Foauth","4.developers\u002F3.modules\u002F10.oauth",{"title":451,"path":452,"stem":453},"Calls between modules","\u002Fdevelopers\u002Fmodules\u002Fcalls-between-modules","4.developers\u002F3.modules\u002F11.calls-between-modules",{"title":455,"path":456,"stem":457},"Experimental parts","\u002Fdevelopers\u002Fmodules\u002Fexperimental-parts","4.developers\u002F3.modules\u002F12.experimental-parts",{"title":459,"path":460,"stem":461},"The manifest","\u002Fdevelopers\u002Fmodules\u002Fmanifest","4.developers\u002F3.modules\u002F2.manifest",{"title":463,"path":464,"stem":465},"Routes","\u002Fdevelopers\u002Fmodules\u002Froutes","4.developers\u002F3.modules\u002F3.routes",{"title":467,"path":468,"stem":469},"Admin screens and the site part","\u002Fdevelopers\u002Fmodules\u002Fadmin-and-site","4.developers\u002F3.modules\u002F4.admin-and-site",{"title":110,"path":471,"stem":472},"\u002Fdevelopers\u002Fmodules\u002Fcontent","4.developers\u002F3.modules\u002F5.content",{"title":474,"path":475,"stem":476},"Background work and services","\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services","4.developers\u002F3.modules\u002F6.background-and-services",{"title":478,"path":479,"stem":480},"SDK reference","\u002Fdevelopers\u002Fmodules\u002Fsdk-reference","4.developers\u002F3.modules\u002F7.sdk-reference",{"title":482,"path":483,"stem":484},"The website module's SDK","\u002Fdevelopers\u002Fmodules\u002Fwebsite-sdk","4.developers\u002F3.modules\u002F8.website-sdk",{"title":486,"path":487,"stem":488},"Incoming webhooks","\u002Fdevelopers\u002Fmodules\u002Fincoming-webhooks","4.developers\u002F3.modules\u002F9.incoming-webhooks",{"title":490,"path":491,"stem":492},"Core and the website module","\u002Fdevelopers\u002Fcore-and-website-module","4.developers\u002F4.core-and-website-module",{"title":494,"path":495,"stem":496},"The API","\u002Fdevelopers\u002Fapi","4.developers\u002F6.api",{"title":498,"path":499,"stem":500},"API reference","\u002Fdevelopers\u002Fapi-reference","4.developers\u002F6.api-reference",{"title":502,"icon":503,"path":504,"stem":505,"children":506},"Sites in other frameworks","i-lucide-layout-template","\u002Fdevelopers\u002Fframeworks","4.developers\u002F7.frameworks\u002Findex",[507,508,512,516,520,524,528,532],{"title":502,"path":504,"stem":505},{"title":509,"path":510,"stem":511},"Accounts: sign-in and modules' routes","\u002Fdevelopers\u002Fframeworks\u002Faccounts","4.developers\u002F7.frameworks\u002F1.accounts",{"title":513,"path":514,"stem":515},"`@shadestack\u002Ftree`","\u002Fdevelopers\u002Fframeworks\u002Ftree","4.developers\u002F7.frameworks\u002F2.tree",{"title":517,"path":518,"stem":519},"Expressions and styles","\u002Fdevelopers\u002Fframeworks\u002Fexpressions-and-styles","4.developers\u002F7.frameworks\u002F3.expressions-and-styles",{"title":521,"path":522,"stem":523},"`@shadestack\u002Frender`","\u002Fdevelopers\u002Fframeworks\u002Frender","4.developers\u002F7.frameworks\u002F4.render",{"title":525,"path":526,"stem":527},"`@shadestack\u002Finteractions`","\u002Fdevelopers\u002Fframeworks\u002Finteractions","4.developers\u002F7.frameworks\u002F5.interactions",{"title":529,"path":530,"stem":531},"`@shadestack\u002Fa11y`","\u002Fdevelopers\u002Fframeworks\u002Fa11y","4.developers\u002F7.frameworks\u002F6.a11y",{"title":533,"path":534,"stem":535},"Your own page for SHADE's links","\u002Fdevelopers\u002Fframeworks\u002Flinks","4.developers\u002F7.frameworks\u002F7.links",{"title":537,"path":538,"stem":539},"Build a client module","\u002Fdevelopers\u002Fclient-module","4.developers\u002F9.client-module",{"title":541,"icon":542,"path":543,"stem":544,"children":545,"page":38},"Security","i-lucide-shield-check","\u002Fsecurity","5.security",[546,550,554,558],{"title":547,"path":548,"stem":549},"Reporting a vulnerability","\u002Fsecurity\u002Freporting","5.security\u002F0.reporting",{"title":551,"path":552,"stem":553},"Security testing","\u002Fsecurity\u002Ftesting","5.security\u002F1.testing",{"title":555,"path":556,"stem":557},"Hardening a production instance","\u002Fsecurity\u002Fhardening","5.security\u002F2.hardening",{"title":559,"path":560,"stem":561},"Manual testing with Kali Linux","\u002Fsecurity\u002Fmanual-testing","5.security\u002F3.manual-testing",{"title":563,"icon":564,"path":565,"stem":566,"children":567,"page":38},"Contributing","i-lucide-git-pull-request","\u002Fcontributing","6.contributing",[568,572,576,580],{"title":569,"path":570,"stem":571},"Reading the code","\u002Fcontributing\u002Freading-the-code","6.contributing\u002F1.reading-the-code",{"title":573,"path":574,"stem":575},"Docs site","\u002Fcontributing\u002Fdocs-site","6.contributing\u002F2.docs-site",{"title":577,"path":578,"stem":579},"Releases","\u002Fcontributing\u002Freleases","6.contributing\u002F3.releases",{"title":581,"path":582,"stem":583},"Load tests","\u002Fcontributing\u002Fload-tests","6.contributing\u002F4.load-tests",{"title":585,"icon":586,"path":587,"stem":588,"children":589,"page":38},"Project","i-lucide-map","\u002Fproject","7.project",[590,594,598,602],{"title":591,"path":592,"stem":593},"Roadmap","\u002Fproject\u002Froadmap","7.project\u002F1.roadmap",{"title":595,"path":596,"stem":597},"Known issues","\u002Fproject\u002Fknown-issues","7.project\u002F2.known-issues",{"title":599,"path":600,"stem":601},"Changelog","\u002Fproject\u002Fchangelog","7.project\u002F3.changelog",{"title":603,"path":604,"stem":605},"Decisions","\u002Fproject\u002Fdecisions","7.project\u002F4.decisions",{"title":607,"path":608,"stem":609,"children":610,"icon":612},"Community","\u002Fcommunity","8.community\u002Findex",[611],{"title":607,"path":608,"stem":609},"i-lucide-users",{"id":614,"title":110,"body":615,"description":684,"extension":3315,"links":3316,"meta":3317,"navigation":779,"path":471,"seo":3318,"stem":472,"__hash__":3319},"docs\u002F4.developers\u002F3.modules\u002F5.content.md",{"type":616,"value":617,"toc":3298},"minimark",[618,623,652,656,675,685,711,716,731,1241,1451,1455,1468,1629,1686,1690,1726,1749,1781,1785,1822,1826,1836,1915,1989,1993,2038,2048,2062,2065,2087,2091,2127,2158,2162,2184,2188,2198,2202,2236,2240,2250,2300,2326,2377,2409,2474,2578,2587,2596,2885,2916,2948,2952,2976,3226,3294],[619,620,622],"h2",{"id":621},"database","Database",[624,625,626,627,631,632,635,636,639,640,643,644,647,648,651],"p",{},"Tables go in ",[628,629,630],"code",{},"server\u002F\u003Cname>.sql.ts"," with the module prefix. The module's ",[628,633,634],{},"pnpm db:generate"," (drizzle-kit, its own\n",[628,637,638],{},"drizzle.config.ts",") writes its migrations into its own ",[628,641,642],{},"migrations\u002F","; they are applied with a separate history\ntable (",[628,645,646],{},"__drizzle_migrations_\u003Cname>","), so core and modules never conflict. The admin role applies them on start\n(",[628,649,650],{},"MIGRATE_ON_START=true","), core first. Modules load at start-up: a module that fails its checks stops the server\ninstead of half-loading.",[619,653,655],{"id":654},"collections-from-modules","Collections from modules",[624,657,658,659,662,663,666,667,670,671,674],{},"A module can add content types with ",[628,660,661],{},"collections"," (slugs prefixed ",[628,664,665],{},"\u003Cname>-",", e.g. ",[628,668,669],{},"commerce-products",").\nThey get versions, permissions and admin screens like any collection (",[672,673,429],"a",{"href":430},"), and tables\nof their own, generated like core's:",[676,677,682],"pre",{"className":678,"code":680,"language":681},[679],"language-text","shade-module collections            → server\u002Fcollections.generated.sql.ts (pnpm collections in commerce)\npnpm db:generate                    → a migration creating them, next to its other tables\n","text",[628,683,680],{"__ignoreMap":684},"",[624,686,687,688,691,692,694,695,698,699,702,703,706,707,710],{},"The module declares them in its manifest, ",[628,689,690],{},"db: { tables, migrationsFolder, collectionTables }"," (the generated file's\nexport), and lists the file in its ",[628,693,638],{}," schema; ",[628,696,697],{},"validateModule"," refuses a collection without its\ntables. The loader registers them for the content service (",[628,700,701],{},"registerCollectionTables"," in\n",[628,704,705],{},"shade\u002Ffeatures\u002Fentries\u002Fserver\u002Fmodel.ts","), so entries, versions and publishing work on them as on core's; the\nmodule's own code queries them from the generated file. Keep transactional records (orders, submissions, stock) in\nhand-written ",[628,708,709],{},"db.tables"," instead: they are not content, are never versioned and never published.",[712,713,715],"h3",{"id":714},"json-fields-and-their-checks","json fields and their checks",[624,717,718,719,722,723,726,727,730],{},"A collection keeps a document of a module's own (a layout, a configuration) in a json field:\n",[628,720,721],{},"{ kind: 'json', name: 'layout', label: 'Layout', check: 'shop:layout' }",". The value is any JSON (the website\nmodule keeps a page's node tree this way, with its check ",[628,724,725],{},"website:tree","); the module named\nin ",[628,728,729],{},"check"," decides it, with a check it registers in its manifest:",[676,732,736],{"className":733,"code":734,"language":735,"meta":684,"style":684},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import type { FieldCheck } from '@shadestack\u002Fmodule-sdk\u002Fserver'\n\nconst layout: FieldCheck = {\n  check: async (value, context, stored) => {\n    const issues = []\n    \u002F\u002F … read `value`, put what is wrong in `issues` as { path, message }, `path` within the value ('rows.0.title')\n    if (context.mode === 'publish' && !hasRows(value)) issues.push({ path: '', message: 'Add a row first' })\n    return { value: tidied(value), issues }\n  },\n  empty: () => ({ rows: [] }),\n  \u002F\u002F Optional: what changed between two versions, for the version history, reviews and AI changes.\n  changes: (before, after, { locale }) => ({\n    changes: rowsChanged(before, after).map(row => ({ kind: 'changed', label: { message: 'Row', key: 'shop.changes.row' }, excerpt: row.title })),\n    more: 0\n  })\n}\n\nexport default defineModule({ name: 'shop', \u002F* … *\u002F fieldChecks: { layout } })\n","ts",[628,737,738,774,781,803,841,856,863,948,977,983,1016,1022,1057,1161,1173,1181,1187,1192],{"__ignoreMap":684},[739,740,743,747,750,754,758,761,764,767,771],"span",{"class":741,"line":742},"line",1,[739,744,746],{"class":745},"s7zQu","import",[739,748,749],{"class":745}," type",[739,751,753],{"class":752},"sMK4o"," {",[739,755,757],{"class":756},"sTEyZ"," FieldCheck",[739,759,760],{"class":752}," }",[739,762,763],{"class":745}," from",[739,765,766],{"class":752}," '",[739,768,770],{"class":769},"sfazB","@shadestack\u002Fmodule-sdk\u002Fserver",[739,772,773],{"class":752},"'\n",[739,775,777],{"class":741,"line":776},2,[739,778,780],{"emptyLinePlaceholder":779},true,"\n",[739,782,784,788,791,794,797,800],{"class":741,"line":783},3,[739,785,787],{"class":786},"spNyl","const",[739,789,790],{"class":756}," layout",[739,792,793],{"class":752},":",[739,795,757],{"class":796},"sBMFI",[739,798,799],{"class":752}," =",[739,801,802],{"class":752}," {\n",[739,804,806,810,812,815,818,822,825,828,830,833,836,839],{"class":741,"line":805},4,[739,807,809],{"class":808},"s2Zo4","  check",[739,811,793],{"class":752},[739,813,814],{"class":786}," async",[739,816,817],{"class":752}," (",[739,819,821],{"class":820},"sHdIc","value",[739,823,824],{"class":752},",",[739,826,827],{"class":820}," context",[739,829,824],{"class":752},[739,831,832],{"class":820}," stored",[739,834,835],{"class":752},")",[739,837,838],{"class":786}," =>",[739,840,802],{"class":752},[739,842,844,847,850,852],{"class":741,"line":843},5,[739,845,846],{"class":786},"    const",[739,848,849],{"class":756}," issues",[739,851,799],{"class":752},[739,853,855],{"class":854},"swJcz"," []\n",[739,857,859],{"class":741,"line":858},6,[739,860,862],{"class":861},"sHwdD","    \u002F\u002F … read `value`, put what is wrong in `issues` as { path, message }, `path` within the value ('rows.0.title')\n",[739,864,866,869,871,874,877,880,883,885,888,891,894,897,900,903,905,908,911,913,916,918,921,924,926,929,931,934,936,938,941,943,945],{"class":741,"line":865},7,[739,867,868],{"class":745},"    if",[739,870,817],{"class":854},[739,872,873],{"class":756},"context",[739,875,876],{"class":752},".",[739,878,879],{"class":756},"mode",[739,881,882],{"class":752}," ===",[739,884,766],{"class":752},[739,886,887],{"class":769},"publish",[739,889,890],{"class":752},"'",[739,892,893],{"class":752}," &&",[739,895,896],{"class":752}," !",[739,898,899],{"class":808},"hasRows",[739,901,902],{"class":854},"(",[739,904,821],{"class":756},[739,906,907],{"class":854},")) ",[739,909,910],{"class":756},"issues",[739,912,876],{"class":752},[739,914,915],{"class":808},"push",[739,917,902],{"class":854},[739,919,920],{"class":752},"{",[739,922,923],{"class":854}," path",[739,925,793],{"class":752},[739,927,928],{"class":752}," ''",[739,930,824],{"class":752},[739,932,933],{"class":854}," message",[739,935,793],{"class":752},[739,937,766],{"class":752},[739,939,940],{"class":769},"Add a row first",[739,942,890],{"class":752},[739,944,760],{"class":752},[739,946,947],{"class":854},")\n",[739,949,951,954,956,959,961,964,966,968,970,972,974],{"class":741,"line":950},8,[739,952,953],{"class":745},"    return",[739,955,753],{"class":752},[739,957,958],{"class":854}," value",[739,960,793],{"class":752},[739,962,963],{"class":808}," tidied",[739,965,902],{"class":854},[739,967,821],{"class":756},[739,969,835],{"class":854},[739,971,824],{"class":752},[739,973,849],{"class":756},[739,975,976],{"class":752}," }\n",[739,978,980],{"class":741,"line":979},9,[739,981,982],{"class":752},"  },\n",[739,984,986,989,991,994,996,998,1000,1003,1005,1008,1011,1013],{"class":741,"line":985},10,[739,987,988],{"class":808},"  empty",[739,990,793],{"class":752},[739,992,993],{"class":752}," ()",[739,995,838],{"class":786},[739,997,817],{"class":756},[739,999,920],{"class":752},[739,1001,1002],{"class":854}," rows",[739,1004,793],{"class":752},[739,1006,1007],{"class":756}," [] ",[739,1009,1010],{"class":752},"}",[739,1012,835],{"class":756},[739,1014,1015],{"class":752},",\n",[739,1017,1019],{"class":741,"line":1018},11,[739,1020,1021],{"class":861},"  \u002F\u002F Optional: what changed between two versions, for the version history, reviews and AI changes.\n",[739,1023,1025,1028,1030,1032,1035,1037,1040,1042,1044,1047,1050,1052,1054],{"class":741,"line":1024},12,[739,1026,1027],{"class":808},"  changes",[739,1029,793],{"class":752},[739,1031,817],{"class":752},[739,1033,1034],{"class":820},"before",[739,1036,824],{"class":752},[739,1038,1039],{"class":820}," after",[739,1041,824],{"class":752},[739,1043,753],{"class":752},[739,1045,1046],{"class":820}," locale",[739,1048,1049],{"class":752}," })",[739,1051,838],{"class":786},[739,1053,817],{"class":756},[739,1055,1056],{"class":752},"{\n",[739,1058,1060,1063,1065,1068,1071,1073,1076,1078,1081,1083,1086,1088,1090,1092,1095,1097,1099,1102,1104,1106,1109,1111,1113,1115,1117,1119,1122,1124,1126,1129,1131,1133,1136,1138,1141,1144,1146,1149,1151,1154,1156,1159],{"class":741,"line":1059},13,[739,1061,1062],{"class":854},"    changes",[739,1064,793],{"class":752},[739,1066,1067],{"class":808}," rowsChanged",[739,1069,1070],{"class":756},"(before",[739,1072,824],{"class":752},[739,1074,1075],{"class":756}," after)",[739,1077,876],{"class":752},[739,1079,1080],{"class":808},"map",[739,1082,902],{"class":756},[739,1084,1085],{"class":820},"row",[739,1087,838],{"class":786},[739,1089,817],{"class":756},[739,1091,920],{"class":752},[739,1093,1094],{"class":854}," kind",[739,1096,793],{"class":752},[739,1098,766],{"class":752},[739,1100,1101],{"class":769},"changed",[739,1103,890],{"class":752},[739,1105,824],{"class":752},[739,1107,1108],{"class":854}," label",[739,1110,793],{"class":752},[739,1112,753],{"class":752},[739,1114,933],{"class":854},[739,1116,793],{"class":752},[739,1118,766],{"class":752},[739,1120,1121],{"class":769},"Row",[739,1123,890],{"class":752},[739,1125,824],{"class":752},[739,1127,1128],{"class":854}," key",[739,1130,793],{"class":752},[739,1132,766],{"class":752},[739,1134,1135],{"class":769},"shop.changes.row",[739,1137,890],{"class":752},[739,1139,1140],{"class":752}," },",[739,1142,1143],{"class":854}," excerpt",[739,1145,793],{"class":752},[739,1147,1148],{"class":756}," row",[739,1150,876],{"class":752},[739,1152,1153],{"class":756},"title ",[739,1155,1010],{"class":752},[739,1157,1158],{"class":756},"))",[739,1160,1015],{"class":752},[739,1162,1164,1167,1169],{"class":741,"line":1163},14,[739,1165,1166],{"class":854},"    more",[739,1168,793],{"class":752},[739,1170,1172],{"class":1171},"sbssI"," 0\n",[739,1174,1176,1179],{"class":741,"line":1175},15,[739,1177,1178],{"class":752},"  }",[739,1180,947],{"class":756},[739,1182,1184],{"class":741,"line":1183},16,[739,1185,1186],{"class":752},"}\n",[739,1188,1190],{"class":741,"line":1189},17,[739,1191,780],{"emptyLinePlaceholder":779},[739,1193,1195,1198,1201,1204,1206,1208,1211,1213,1215,1218,1220,1222,1225,1228,1230,1232,1235,1237,1239],{"class":741,"line":1194},18,[739,1196,1197],{"class":745},"export",[739,1199,1200],{"class":745}," default",[739,1202,1203],{"class":808}," defineModule",[739,1205,902],{"class":756},[739,1207,920],{"class":752},[739,1209,1210],{"class":854}," name",[739,1212,793],{"class":752},[739,1214,766],{"class":752},[739,1216,1217],{"class":769},"shop",[739,1219,890],{"class":752},[739,1221,824],{"class":752},[739,1223,1224],{"class":861}," \u002F* … *\u002F",[739,1226,1227],{"class":854}," fieldChecks",[739,1229,793],{"class":752},[739,1231,753],{"class":752},[739,1233,1234],{"class":756}," layout ",[739,1236,1010],{"class":752},[739,1238,760],{"class":752},[739,1240,947],{"class":756},[1242,1243,1244,1258,1313,1381,1384,1399,1418],"ul",{},[1245,1246,1247,1248,1250,1251,1254,1255,876],"li",{},"SHADE runs the check at every create, save, restore and publish of an entry holding the field, in groups and\nrepeaters too, on every route, and stores the ",[628,1249,821],{}," it gives back. Any issue refuses the write with VALIDATION,\nunder the field's path (",[628,1252,1253],{},"data.layout.rows.0.title","). A missing value is the check's ",[628,1256,1257],{},"empty()",[1245,1259,1260,817,1262,1265,1266,1269,1270,1273,1274,1277,1278,1281,1282,1285,1286,1277,1289,1291,1292,1295,1296,1298,1299,817,1302,1305,1306,1308,1309,1312],{},[628,1261,873],{},[628,1263,1264],{},"FieldCheckContext",") says where it runs: ",[628,1267,1268],{},"ctx"," (the caller's context made for the module), ",[628,1271,1272],{},"db"," (the\nsave's database, or the publish's transaction), ",[628,1275,1276],{},"collection",", ",[628,1279,1280],{},"entryId"," (null for a new entry), ",[628,1283,1284],{},"data"," (the entry's other values as written: an item template's\ncollection), ",[628,1287,1288],{},"path",[628,1290,879],{},"\n(",[628,1293,1294],{},"draft",", or ",[628,1297,887],{}," for what goes live) and ",[628,1300,1301],{},"stage",[628,1303,1304],{},"save"," for someone's change, ",[628,1307,887],{}," for a version saved\nbefore going live). ",[628,1310,1311],{},"stored()"," reads the field's value as it is stored now (undefined for a new entry and when\npublishing), to compare a change with: the website module holds builders and content editors to their role and\nkeeps embeds unchanged for whoever may not add them this way. A publish runs the check twice (in its precheck and in\nits transaction), so keep slow work out of it.",[1245,1314,1315,1318,1319,1321,1322,1325,1326,817,1329,1332,1333,1277,1336,1277,1339,1342,1343,1345,1346,1349,1350,1353,1354,1357,1358,1361,1362,1277,1365,1368,1369,1372,1373,1376,1377,1380],{},[628,1316,1317],{},"changes(before, after, { locale })",", when the check has it, says what changed between two stored values of the\nfield (a missing one is ",[628,1320,1257],{},") for a person: SHADE compares versions on the server and shows what it gives as\nit is, in the version history, reviews and AI changes (",[628,1323,1324],{},"ValueChanges","): at most 200 changes, each\n",[628,1327,1328],{},"{ kind, label, excerpt?, details? }",[628,1330,1331],{},"kind"," is ",[628,1334,1335],{},"added",[628,1337,1338],{},"removed",[628,1340,1341],{},"moved"," or ",[628,1344,1101],{},"; ",[628,1347,1348],{},"excerpt"," a few of\nthe part's words, in ",[628,1351,1352],{},"locale"," where the value has them), ",[628,1355,1356],{},"more"," for how many were left out, and an optional\n",[628,1359,1360],{},"note"," shown under them. Every text is a ",[628,1363,1364],{},"ChangeText",[628,1366,1367],{},"{ message, key?, params? }",": said by its key from the\nmodule's admin texts (",[628,1370,1371],{},"\u003Cplugin>.…",") when there is one, else as ",[628,1374,1375],{},"message",". An answer of another shape fails the\ncomparison. Without ",[628,1378,1379],{},"changes",", or while the module is off, the field is shown as changed as a whole. The website\nmodule lists a page's tree node by node this way.",[1245,1382,1383],{},"Deny by default: a field whose check no installed module registers, or whose module is switched off, can't be saved\nor published. A module's own collection that names one of its checks it doesn't have fails the load.",[1245,1385,1386,1387,1390,1391,1394,1395,1398],{},"Media (",[628,1388,1389],{},"{ mediaId }",") and links to entries (",[628,1392,1393],{},"{ kind: 'entry', collection, id }",") anywhere in the value are found: a\nmissing one refuses the save, and media in use can't be deleted. A file of any type is taken: if a place takes only\nsome (an image), the check looks the file's type up (",[628,1396,1397],{},"findMediaTypes(db, ids)",") and refuses the others.",[1245,1400,1401,1402,1405,1406,1409,1410,1413,1414,1417],{},"What a check may look up besides, with the database alone, since it holds for whoever saves: a data source by name\n(",[628,1403,1404],{},"findDataSource(name)",", one that exists and is on) and what its settings refuse\n(",[628,1407,1408],{},"dataSourceParameterIssues(source, parameters)","), the published forms of some ids (",[628,1411,1412],{},"findPublishedForms(db, ids)","),\nand a module's visitor route (",[628,1415,1416],{},"findVisitorRoute(plugin, method, path)","). The website module checks a page's\nbindings, loops and forms with them.",[1245,1419,1420,1421,1342,1424,1427,1428,1431,1432,1435,1436,1439,1440,1443,1444,817,1447,1450],{},"No ",[628,1422,1423],{},"required",[628,1425,1426],{},"defaultValue"," (the check decides), never translated, and for collections only: settings and data\nsource parameters may not hold one. ",[628,1429,1430],{},"valueType: jsonValueType\u003CLayout>('Layout', '..\u002Fshared\u002Flayout')"," types its\ncolumn in the tables ",[628,1433,1434],{},"shade-module collections"," writes (",[628,1437,1438],{},"from"," as seen from ",[628,1441,1442],{},"server\u002F",") and the value in\n",[628,1445,1446],{},"EntryData",[628,1448,1449],{},"Layout | null","). The admin's entry form shows how much\nthe field holds, read only: edit it in a screen or panel of the module's own.",[712,1452,1454],{"id":1453},"text-of-json-fields-in-search","Text of json fields in search",[624,1456,1457,1458,1460,1461,1464,1465,793],{},"Core searches the text of entries (decision 0008 point 12; ",[672,1459,140],{"href":141},"). A json field is opaque\nto it, so the module whose check the field names says what text it holds, with ",[628,1462,1463],{},"searchText"," beside ",[628,1466,1467],{},"fieldChecks",[676,1469,1471],{"className":733,"code":1470,"language":735,"meta":684,"style":684},"import type { SearchText } from '@shadestack\u002Fmodule-sdk\u002Fserver'\n\nconst layout: SearchText = (value, { language }) => rowsOf(value).map(row => row.title[language] ?? '').join(' ')\n\nexport default defineModule({ name: 'shop', \u002F* … *\u002F fieldChecks: { layout: layoutCheck }, searchText: { layout } })\n",[628,1472,1473,1494,1498,1568,1572],{"__ignoreMap":684},[739,1474,1475,1477,1479,1481,1484,1486,1488,1490,1492],{"class":741,"line":742},[739,1476,746],{"class":745},[739,1478,749],{"class":745},[739,1480,753],{"class":752},[739,1482,1483],{"class":756}," SearchText",[739,1485,760],{"class":752},[739,1487,763],{"class":745},[739,1489,766],{"class":752},[739,1491,770],{"class":769},[739,1493,773],{"class":752},[739,1495,1496],{"class":741,"line":776},[739,1497,780],{"emptyLinePlaceholder":779},[739,1499,1500,1502,1504,1506,1508,1510,1512,1514,1516,1518,1521,1523,1525,1528,1531,1533,1535,1537,1539,1541,1543,1545,1548,1551,1553,1555,1557,1560,1562,1564,1566],{"class":741,"line":783},[739,1501,787],{"class":786},[739,1503,790],{"class":756},[739,1505,793],{"class":752},[739,1507,1483],{"class":796},[739,1509,799],{"class":752},[739,1511,817],{"class":752},[739,1513,821],{"class":820},[739,1515,824],{"class":752},[739,1517,753],{"class":752},[739,1519,1520],{"class":820}," language",[739,1522,1049],{"class":752},[739,1524,838],{"class":786},[739,1526,1527],{"class":808}," rowsOf",[739,1529,1530],{"class":756},"(value)",[739,1532,876],{"class":752},[739,1534,1080],{"class":808},[739,1536,902],{"class":756},[739,1538,1085],{"class":820},[739,1540,838],{"class":786},[739,1542,1148],{"class":756},[739,1544,876],{"class":752},[739,1546,1547],{"class":756},"title[language] ",[739,1549,1550],{"class":752},"??",[739,1552,928],{"class":752},[739,1554,835],{"class":756},[739,1556,876],{"class":752},[739,1558,1559],{"class":808},"join",[739,1561,902],{"class":756},[739,1563,890],{"class":752},[739,1565,766],{"class":752},[739,1567,947],{"class":756},[739,1569,1570],{"class":741,"line":805},[739,1571,780],{"emptyLinePlaceholder":779},[739,1573,1574,1576,1578,1580,1582,1584,1586,1588,1590,1592,1594,1596,1598,1600,1602,1604,1606,1608,1611,1614,1617,1619,1621,1623,1625,1627],{"class":741,"line":843},[739,1575,1197],{"class":745},[739,1577,1200],{"class":745},[739,1579,1203],{"class":808},[739,1581,902],{"class":756},[739,1583,920],{"class":752},[739,1585,1210],{"class":854},[739,1587,793],{"class":752},[739,1589,766],{"class":752},[739,1591,1217],{"class":769},[739,1593,890],{"class":752},[739,1595,824],{"class":752},[739,1597,1224],{"class":861},[739,1599,1227],{"class":854},[739,1601,793],{"class":752},[739,1603,753],{"class":752},[739,1605,790],{"class":854},[739,1607,793],{"class":752},[739,1609,1610],{"class":756}," layoutCheck ",[739,1612,1613],{"class":752},"},",[739,1615,1616],{"class":854}," searchText",[739,1618,793],{"class":752},[739,1620,753],{"class":752},[739,1622,1234],{"class":756},[739,1624,1010],{"class":752},[739,1626,760],{"class":752},[739,1628,947],{"class":756},[1242,1630,1631,1637,1644,1668],{},[1245,1632,1633,1634,1636],{},"The key is the name of one of the module's own ",[628,1635,1467],{},"; the function gets the field's stored value and the\nlanguage code, and gives the words as one string. It is called for each language of the site.",[1245,1638,1639,1640,1643],{},"It runs as a thread task (",[628,1641,1642],{},"searchText:\u003Cname>",") with a time (5 seconds) and a memory (128 MB) budget, so it gets plain\ndata and no context, and a slow or failing one leaves the field out of the index and is logged. Trusted modules only.",[1245,1645,1646,1647,1650,1651,817,1654,1657,1658,1661,1662,1664,1665,1667],{},"A json field is searched with the weight ",[628,1648,1649],{},"C",", or the field's own ",[628,1652,1653],{},"search",[628,1655,1656],{},"'A'"," to ",[628,1659,1660],{},"'D'","). Without a ",[628,1663,1463],{},"\nthe field is not searched. A change to a ",[628,1666,1463],{}," (a module installed or switched on with one) builds the\ncollection's index again.",[1245,1669,1670,1671,1674,1675,1678,1679,1682,1683,1685],{},"Fields have ",[628,1672,1673],{},"search: 'A' | 'B' | 'C' | 'D' | false"," too: the weight in ranking. Without it the title counts ",[628,1676,1677],{},"A",", text and slugs\n",[628,1680,1681],{},"B",", textarea and rich text ",[628,1684,1649],{},", and the rest is not searched. Only fields that hold text take a weight.",[712,1687,1689],{"id":1688},"save-checks","Save checks",[624,1691,1692,1695,1696,1699,1700,1703,1704,1707,1708,1277,1711,1713,1714,1717,1718,1721,1722,1725],{},[628,1693,1694],{},"saveChecks: { '\u003Cown collection>': check }",": a module's rules for saving its collections' entries beyond what fields\nsay (the website module keeps the site's own paths free and one template per collection). ",[628,1697,1698],{},"check(tx, entry, ctx)","\nruns in the save's transaction on every write path (create, save, restore), with the saving caller's context made\nfor the module (its actor, and the module's own code: ",[628,1701,1702],{},"reportError"," and ",[628,1705,1706],{},"actAsModule"," work in it); it returns\nissues (",[628,1709,1710],{},"{ path, message }",[628,1712,1288],{}," naming a field; SHADE puts it under ",[628,1715,1716],{},"data.",") or throws. What it writes in ",[628,1719,1720],{},"tx"," is\nundone with a save it refuses. ",[628,1723,1724],{},"publishChecks"," does the same on publishing, on every route that publishes\n(the entry routes, and the modules that publish for a person: a schedule, a review, a release). Both hold the entry's row locked while they run: keep what locks a\nrow every publish needs (the website module's compiled styles) for last.",[624,1727,1728,1729,1732,1733,1736,1737,1740,1741,1744,1745,1748],{},"Slow work a publish check needs goes in ",[628,1730,1731],{},"publishPrechecks: { '\u003Cown collection>': precheck }"," instead\n(",[628,1734,1735],{},"PublishPrecheck","): ",[628,1738,1739],{},"precheck({ id, versionId, data }, ctx)"," runs before the publish's transaction (a release's: before\nits one transaction), on the version about to be published, with the caller's context made for the module and no\nlock or transaction held, so a check that runs or waits long (the website module's accessibility check in a worker\nthread) blocks nobody. What it returns reaches the collection's publish checks as ",[628,1742,1743],{},"entry.prechecked","; they decide in\nthe transaction. When the entry was saved in between and the publish named no version, SHADE refuses with CONFLICT\n(and a release whose items changed meanwhile); what else the result depends on is the check's to compare, and to\nrefuse with ",[628,1746,1747],{},"conflict(…)"," when it changed (the website module compares the whole input it checked).",[624,1750,1751,1754,1755,1758,1759,1761,1762,1765,1766,1769,1770,1773,1774,1777,1778,1780],{},[628,1752,1753],{},"versionsAwaitingPublish(db, collection, id)"," gives the versions of an entry waiting to go live: those that any module\nnames in its manifest's ",[628,1756,1757],{},"keptVersions"," (experimental), each published as it was kept. ",[628,1760,1757],{}," is\n",[628,1763,1764],{},"{ tables, versions }",". ",[628,1767,1768],{},"versions: (db, collection, entryId?) => SQLWrapper"," is a select of one column, ",[628,1771,1772],{},"versionId","\n(lowercase text), of the versions the module waits to publish: the editorial module gives those of its open releases,\npending schedules and pending reviews. Version retention runs that select as core's content inside its own delete, so\n",[628,1775,1776],{},"tables"," names the module's own tables it reads (from its ",[628,1779,709],{},"): row-level security opens those, and no other,\nto content for reading. List every table the select reads: in one it doesn't list, content sees no rows, so the\nversions found only through it are not kept and the purge deletes them.\nVersion retention keeps them too. What a module keeps beside an entry's versions must stay while one of them has it:\nthe website module keeps a node's local styles while its working copy, its published version or one of these has the node.",[712,1782,1784],{"id":1783},"publishing-several-at-once","Publishing several at once",[624,1786,1787,1790,1791,1794,1795,1798,1799,1801,1802,1805,1806,1809,1810,1813,1814,1817,1818,1821],{},[628,1788,1789],{},"publishMany(ctx, items, { note?, around? })"," (experimental) publishes and unpublishes entries in one transaction, all or\nnothing. Each item is a ",[628,1792,1793],{},"PublishManyItem",": ",[628,1796,1797],{},"{ key, collection, id, action: 'publish' | 'unpublish', versionId? }",". SHADE\nruns each publish's prechecks first, then one transaction in which every item is a savepoint, skipping what is already in\nthe wanted state. When any item fails, it throws a validation error with one issue per failing item (its ",[628,1800,1288],{}," the\nitem's ",[628,1803,1804],{},"key",", the message ",[628,1807,1808],{},"\u003Ctitle>: \u003Creason>","), and nothing goes live. Rebuilds wait for the commit. Each item's own\npublish permission is checked, as the context's actor. A module that has rows of its own to guard passes\n",[628,1811,1812],{},"around(tx, publish)",": it locks and checks them, calls ",[628,1815,1816],{},"publish()",", then writes its outcome in the same transaction.\n",[628,1819,1820],{},"lockLatestVersion"," (experimental) reads an entry's latest version with its row locked, to keep a version only while it\nis still the latest (the row-lock rule above stays the caller's).",[619,1823,1825],{"id":1824},"the-content-api-read-models-and-site-data","The content API: read models and site data",[624,1827,1828,1831,1832,1835],{},[628,1829,1830],{},"read: { routes, site }"," adds a module's read models under its own prefix, ",[628,1833,1834],{},"\u002Fapi\u002Fv1\u002Fcontent\u002F\u003Cname>",",\nserved like core's (a read or build token, the same body limit, CORS and caching):",[1242,1837,1838,1895],{},[1245,1839,1840,1794,1843,1846,1847,1850,1851,1332,1853,1856,1857,1277,1860,1277,1863,1277,1865,1277,1867,1870,1871,1703,1874,1877,1878,1881,1882,1277,1885,1277,1888,1891,1892,1894],{},[628,1841,1842],{},"routes",[628,1844,1845],{},"{ path, summary, query?, handler(ctx, { params, query }) }","; the path is under the prefix, which SHADE\nadds from the module's name: a route ",[628,1848,1849],{},"\u002Fpages"," of the module ",[628,1852,1217],{},[628,1854,1855],{},"GET \u002Fapi\u002Fv1\u002Fcontent\u002Fshop\u002Fpages",", and nothing\nof it is served without the prefix, so two modules never meet. A module named like one of core's read routes\n(",[628,1858,1859],{},"site",[628,1861,1862],{},"media",[628,1864,1284],{},[628,1866,661],{},[628,1868,1869],{},"module-sites",") serves none. Where several routes match a path\n(",[628,1872,1873],{},"\u002F:slug",[628,1875,1876],{},"\u002Flatest","), the first declared serves it. The handler answers JSON or a ",[628,1879,1880],{},"Response"," of its own (",[628,1883,1884],{},"text\u002Fcss",[628,1886,1887],{},"text\u002Fplain",[628,1889,1890],{},"application\u002Fxml",", JSON),\nsent with its status when that is a 2xx or a 4xx (its \"not found\"), with SHADE's headers only; a redirect or any\nother status is a 500. Give a ",[628,1893,1880],{}," its body as a string or bytes;",[1245,1896,1897,1900,1901,1904,1905,1277,1908,1277,1911,1914],{},[628,1898,1899],{},"site: { keys, read(ctx, locale) }",": keys it adds to ",[628,1902,1903],{},"GET \u002Fapi\u002Fv1\u002Fcontent\u002Fsite",", in a language; never one of core's\n(",[628,1906,1907],{},"settings",[628,1909,1910],{},"plugins",[628,1912,1913],{},"consent",", …) nor another module's. Only the declared keys are taken.",[624,1916,1917,1918,817,1922,1925,1926,1929,1930,1933,1934,1937,1938,1941,1942,1945,1946,1949,1950,1277,1953,1277,1956,1959,1960,1277,1963,1703,1966,1969,1970,1277,1973,1277,1976,1277,1979,1703,1982,1985,1986,876],{},"Both run as the ",[1919,1920,1921],"strong",{},"module's reader",[628,1923,1924],{},"moduleReader","): the module's own actor, reading only. It reads what its ",[628,1927,1928],{},"uses","\nlist and what is published on the site, never writes and never another module's drafts, whoever's token called it.\nThey run in a read-only transaction, which is their ",[628,1931,1932],{},"ctx.db",": not even SQL of their own made by mistake writes, and\nSHADE runs a statement before theirs, so a ",[628,1935,1936],{},"SET TRANSACTION READ WRITE"," of their own fails. What they read of the\nmodule's own tables is the module's to decide: serve only what a site may show.\n",[628,1939,1940],{},"readModuleModel(ctx, path, query)"," (SDK testing) answers a read model as the API would, for tests, by its path under\n",[628,1943,1944],{},"\u002Fapi\u002Fv1\u002Fcontent"," with the module's prefix (",[628,1947,1948],{},"readModuleModel(ctx, '\u002Fshop\u002Fpages')","). The website module serves its pages\n(",[628,1951,1952],{},"\u002Fapi\u002Fv1\u002Fcontent\u002Fwebsite\u002Fpages",[628,1954,1955],{},"\u002Fpages\u002Fby-slug",[628,1957,1958],{},"\u002Fpreview","), ",[628,1961,1962],{},"\u002Fredirects",[628,1964,1965],{},"\u002Ftheme.css",[628,1967,1968],{},"\u002Fstyles.css"," this\nway, and adds its keys ",[628,1971,1972],{},"theme",[628,1974,1975],{},"fontFaces",[628,1977,1978],{},"navigation",[628,1980,1981],{},"footer",[628,1983,1984],{},"links"," to the site data: navigation and\nfooter are the website module's, not part of core's ",[628,1987,1988],{},"PublishedSiteData",[619,1990,1992],{"id":1991},"where-entries-live-the-paths-part","Where entries live: the paths part",[624,1994,1995,1998,1999,817,2002,1794,2005,1277,2008,2011,2012,2015,2016,2019,2020,2023,2024,2027,2028,817,2031,2034,2035,876],{},[628,1996,1997],{},"paths: { addresses, itemPaths }",". An ",[1919,2000,2001],{},"address source",[628,2003,2004],{},"\u003Cname>.\u003Csource>",[628,2006,2007],{},"covers(collection)",[628,2009,2010],{},"list(ctx, languages)",", optional ",[628,2013,2014],{},"paths(…)"," for links and ",[628,2017,2018],{},"moved(…)"," after a publish) says where the entries of some collections live on the site, in every\npublic language. ",[628,2021,2022],{},"itemPaths(db, collection, locale)"," gives the address of the items of a collection with item pages,\nfor data sources and links. After a publish or an unpublish SHADE compares where entries with an address are with\nwhere they were (",[628,2025,2026],{},"public_paths","), remembers it, and writes the event ",[628,2029,2030],{},"paths.addresses.moved",[628,2032,2033],{},"{ moves, live }","),\nwhich a module hears in ",[628,2036,2037],{},"on",[624,2039,2040,2041,2044,2045,2047],{},"SHADE keeps what the sources answer in that address index: each address with its title, noindex and dates, and\nwhether it is public now. ",[628,2042,2043],{},"publicAddresses"," (read models, redirects, the sitemap, forms' page of origin) reads the\nindex in one query rather than calling every source, so the website's ",[628,2046,1849],{}," answers 20,000 addresses in about\n85 ms. The sources are read by the follow, as the system, not by whoever asked. The index is as fresh as the last\nfollow:",[1242,2049,2050,2053,2056,2059],{},[1245,2051,2052],{},"an entry's publish, unpublish or delete, and a save in a collection without drafts, is in it once the worker has\nhandled the event, normally within seconds;",[1245,2054,2055],{},"a module switched on or off is followed the same way, every address again;",[1245,2057,2058],{},"a worker follows every address when it starts, and every rebuild before it builds;",[1245,2060,2061],{},"the worker follows every address again every 15 minutes, which catches what no event tells (a language made public,\na changed collection after a deploy).",[624,2063,2064],{},"A module that is switched off leaves the list at once. A follow of every address that finds a moved address asks for\na rebuild.",[624,2066,2067,2068,2071,2072,2075,2076,2079,2080,2082,2083,2086],{},"A source with thousands of entries should give ",[628,2069,2070],{},"moved(ctx, languages, entry)",": the addresses a publish of ",[628,2073,2074],{},"entry"," may\nhave moved, in every public language. For an item's publish that is the item's own addresses, and for a publish that\nmoves none of the source's entries it is an empty list. Return ",[628,2077,2078],{},"null"," when only reading everything can say, as for a\ntemplate page whose item path moves every item. Without ",[628,2081,1341],{},", SHADE reads the source's whole ",[628,2084,2085],{},"list"," after every\npublish. When another entry already holds one of the paths, SHADE reads every address anyway, so who keeps a path is\ndecided as before.",[619,2088,2090],{"id":2089},"previews","Previews",[624,2092,2093,2096,2097,2100,2101,1015,2104,1277,2107,2110,2111,2114,2115,2118,2119,2122,2123,2126],{},[628,2094,2095],{},"createPreviewToken(ctx, { subject, versionId, locale? })"," signs a token with the API's secret, naming the module;\n",[628,2098,2099],{},"readPreviewToken(ctx, token)"," gives its claims back to that module only, in code SHADE called as it, or null. Core\nkeeps only these generic preview links: the website editor's canvas protocol (",[628,2102,2103],{},"EditorToCanvasMessage",[628,2105,2106],{},"CanvasToEditorMessage",[628,2108,2109],{},"CANVAS_PROTOCOL_VERSION",") is ",[628,2112,2113],{},"@shadestack\u002Ftree\u002Fcanvas","'s, not the SDK's.\n",[628,2116,2117],{},"adminFrames(ctx)"," gives the origins the admin may frame (its Content-Security-Policy's ",[628,2120,2121],{},"frame-src","), from the\nmodule's settings: the website module's Preview address. Only ",[628,2124,2125],{},"http(s)"," origins count.",[624,2128,2129,2132,2133,2136,2137,2139,2140,2143,2144,2147,2148,2151,2152,817,2155,2157],{},[1919,2130,2131],{},"Previews of a set of versions"," (experimental). A module that groups entries, such as the editorial module's releases,\nnames the set in the manifest's ",[628,2134,2135],{},"previewSets: (ctx, subject) => { name, items: [{ collection, id, action, versionId }] } | null",".\nIt runs as the link's maker at every read, so the module checks its own read action there; ",[628,2138,2078],{}," means the set is gone\nand the link has expired. ",[628,2141,2142],{},"createSetPreview(ctx, { subject, frontendId?, locale?, share? })"," makes the link for the\ncontext's module, ",[628,2145,2146],{},"listSetPreviewShares(ctx, subject)"," lists its share links and ",[628,2149,2150],{},"revokePreviewShare"," revokes one (its\nmaker may, or the module after its own manage check). The frontend reads it as ",[628,2153,2154],{},"kind: 'set'",[672,2156,494],{"href":495},").",[619,2159,2161],{"id":2160},"rebuilding-the-frontends","Rebuilding the frontends",[624,2163,2164,2165,2168,2169,2172,2173,2176,2177,2180,2181,2183],{},"SHADE's rebuild trigger gathers every request for a rebuild into one burst (30 seconds of quiet, at most 2 minutes),\nthen calls the other frontends' webhooks and each ",[1919,2166,2167],{},"rebuild target"," of a module that is on: ",[628,2170,2171],{},"rebuild(ctx, { reasons, requestedById })",", run as the plugin, its errors reported, never thrown on. ",[628,2174,2175],{},"requestRebuild(ctx, reason)"," asks for one\nafter a change of the module's own (the theme, a redirect); the reason is named after the module. An editor's change\nmay ask; a read token may not; the module's own actor needs ",[628,2178,2179],{},"rebuild.request"," in ",[628,2182,1928],{},". What a rebuild target asks\nfor itself is dropped, so rebuilds never loop.",[619,2185,2187],{"id":2186},"media-a-module-uses","Media a module uses",[624,2189,2190,2193,2194,2197],{},[628,2191,2192],{},"mediaUsers(db, mediaId)"," gives where the module uses a media item beyond its collections' fields (",[628,2195,2196],{},"{ title, locations, live? }",": the website module's theme fonts). The media library lists it as a use, refuses to delete the\nitem while it is used and rebuilds the site when a live one changes.",[619,2199,2201],{"id":2200},"slow-checks-on-publish","Slow checks on publish",[624,2203,2204,2205,2208,2209,2212,2213,2217,2218,2221,2222,2225,2226,1765,2229,2232,2233,2157],{},"A check that needs slow work, such as the website module's accessibility check (",[628,2206,2207],{},"@shadestack\u002Fa11y","'s\n",[628,2210,2211],{},"checkAccessibility",", 30 seconds at most), runs it as one of the module's\n",[672,2214,2216],{"href":2215},"\u002Fdevelopers\u002Fmodules\u002Fbackground-and-services#thread-tasks","thread tasks",", in a worker thread with a budget. Run it from a publish\nprecheck (",[628,2219,2220],{},"publishPrechecks","), never from a publish check: in the publish's transaction a run waiting for a thread\nwould hold a pooled connection and the entry's row lock for up to its budget. The check in the transaction then uses\nthe precheck's result. ",[628,2223,2224],{},"reportError(ctx, error, scope)"," records what went wrong inside the module's own check (a run\npast its budget, one that failed) in the error log as ",[628,2227,2228],{},"package:\u003Cname>",[628,2230,2231],{},"reportError(ctx, error, scope, { level: 'warning' })","\nrecords something that went wrong while the work around it went on (a courtesy message that could not go out): it is\nlisted and counted like an error, but never fires the new-error alert and never makes your module unhealthy (",[628,2234,2235],{},"ErrorLevel",[619,2237,2239],{"id":2238},"content-services","Content services",[624,2241,2242,2243,2245,2246,2249],{},"Module code reads and writes core's content through core's own services, from\n",[628,2244,770],{},". Each checks the permission of ",[628,2247,2248],{},"ctx.actor",", validates its input, writes in a\ntransaction and records an audit entry, as it does for an editor:",[1242,2251,2252,2277,2289],{},[1245,2253,2254,2255,1277,2258,1277,2261,1015,2264,1277,2267,1015,2270,1277,2273,2276],{},"entries: ",[628,2256,2257],{},"listEntries(ctx, slug, query)",[628,2259,2260],{},"getEntry(ctx, slug, id)",[628,2262,2263],{},"createEntry(ctx, slug, { data })",[628,2265,2266],{},"saveEntry(ctx, slug, id, { data, baseVersionId })",[628,2268,2269],{},"publishEntry(ctx, slug, id, {})",[628,2271,2272],{},"unpublishEntry(ctx, slug, id)",[628,2274,2275],{},"deleteEntry(ctx, slug, id)",";",[1245,2278,2279,2280,1277,2283,1277,2286,2276],{},"media: ",[628,2281,2282],{},"listMedia(ctx, query)",[628,2284,2285],{},"getMedia(ctx, id)",[628,2287,2288],{},"uploadMedia(ctx, { filename, data })",[1245,2290,2291,2292,2295,2296,2299],{},"a drawing (experimental): ",[628,2293,2294],{},"svgToPng(svg, { width, height })"," draws an SVG the module made as a PNG, 1 to 4096 pixels\na side, with the image library SHADE already runs. The SVG must pass the same check an SVG upload does (no links but\nto a ",[628,2297,2298],{},"#fragment",", no script), or it is refused with VALIDATION. Text is drawn with the server's fonts, so draw text as\noutlines for an image that looks the same everywhere. The website's generated social image uses it.",[624,2301,2302,2305,2306,2309,2310,2313,2314,2317,2318,2321,2322,2325],{},[1919,2303,2304],{},"The trash."," ",[628,2307,2308],{},"deleteEntry"," moves an entry to the ",[672,2311,2312],{"href":145},"trash",": it is unpublished and\nthe services above leave it out until it is restored, as a draft, or deleted forever. The event ",[628,2315,2316],{},"entries.entry.deleted"," is written when it goes\nthere. A module that reads its own collections' tables leaves trashed entries out with ",[628,2319,2320],{},"notInTrash(collection, idColumn)",",\nan SQL condition for its query, or finds them among ids with ",[628,2323,2324],{},"trashedEntryIds(db, collection, ids)",". A trashed entry\nkeeps its unique values (a slug, a partial unique index) until it is deleted forever, so a check that finds one can\nsay it is in the trash.",[624,2327,2328,2331,2332,2335,2336,2339,2340,2343,2344,2347,2348,2351,2352,1703,2355,2358,2359,2362,2363,2366,2367,2369,2370,2373,2374,876],{},[1919,2329,2330],{},"In a transaction."," To keep what a service writes together with your own change (an order's invoice file, a\nbooking's reminder, an order event), give it your context on that transaction: ",[628,2333,2334],{},"inTransaction(ctx, async (txCtx) => …)"," runs the work in one, with ",[628,2337,2338],{},"txCtx.db"," as the transaction, and ",[628,2341,2342],{},"withDb(ctx, tx)"," puts a context on a transaction you\nalready have. Both keep the context the module's own and its lazy parts lazy; never copy a context (",[628,2345,2346],{},"{ ...ctx }",").\n",[628,2349,2350],{},"afterCommit(txCtx, step)"," runs a step of yours once the change is kept, and never when it rolls back: for telling\nothers about it. ",[628,2353,2354],{},"emit",[628,2356,2357],{},"sendRealtimeUpdate"," use it, so call them inside the change's ",[628,2360,2361],{},"inTransaction",": the\nworker and the pages hear of it right after the commit. They refuse a transaction you opened yourself\n(",[628,2364,2365],{},"ctx.db.transaction(…)","), as SHADE can't know when that one commits; a nested ",[628,2368,2361],{}," is a savepoint whose\nsteps wait for the outer commit. Your schedules already run in one of SHADE's transactions.\n",[628,2371,2372],{},"recordAudit(tx, ctx, entry)"," refuses a handle that isn't a transaction as well: record the entry in the transaction\nof the change it is about, so it exists exactly when the change was kept. A read or an export that only records an\nentry opens one for it: ",[628,2375,2376],{},"await inTransaction(ctx, inTx => recordAudit(inTx.db, ctx, entry))",[624,2378,2379,2382,2383,2386,2387,2390,2391,2393,2394,2396,2397,1295,2399,2401,2402,2404,2405,2408],{},[1919,2380,2381],{},"A rule over several rows."," Two writes at the same moment each read the rows before the other commits, so a rule\nthat spans rows of your tables (no redirect loops, one template per collection) can break. Where a unique index can\nsay the rule, use one (a collection's ",[628,2384,2385],{},"indexes",", or your own table's): it holds against every writer. Where it can't,\n",[628,2388,2389],{},"lockKey(ctx, key)"," holds your module's own lock ",[628,2392,1804],{}," until the transaction ",[628,2395,1932],{}," is on ends: take it first in\nevery transaction that writes what the rule covers, then read, check and write, and the second waits until the first\nis over. It needs a transaction (",[628,2398,2361],{},[628,2400,2342],{}," in a check core gives ",[628,2403,1720],{},") and the context\nSHADE gave your code; its keys are your module's own (",[628,2406,2407],{},"package:\u003Cname>:\u003Ckey>","), so it never waits on SHADE's locks or\nanother module's.",[676,2410,2412],{"className":733,"code":2411,"language":735,"meta":684,"style":684},"await inTransaction(ctx, async (txCtx) => {\n  await lockKey(txCtx, 'redirects')\n  \u002F\u002F read the redirects, check for a loop, write\n})\n",[628,2413,2414,2440,2463,2468],{"__ignoreMap":684},[739,2415,2416,2419,2422,2425,2427,2429,2431,2434,2436,2438],{"class":741,"line":742},[739,2417,2418],{"class":745},"await",[739,2420,2421],{"class":808}," inTransaction",[739,2423,2424],{"class":756},"(ctx",[739,2426,824],{"class":752},[739,2428,814],{"class":786},[739,2430,817],{"class":752},[739,2432,2433],{"class":820},"txCtx",[739,2435,835],{"class":752},[739,2437,838],{"class":786},[739,2439,802],{"class":752},[739,2441,2442,2445,2448,2450,2452,2454,2456,2459,2461],{"class":741,"line":776},[739,2443,2444],{"class":745},"  await",[739,2446,2447],{"class":808}," lockKey",[739,2449,902],{"class":854},[739,2451,2433],{"class":756},[739,2453,824],{"class":752},[739,2455,766],{"class":752},[739,2457,2458],{"class":769},"redirects",[739,2460,890],{"class":752},[739,2462,947],{"class":854},[739,2464,2465],{"class":741,"line":783},[739,2466,2467],{"class":861},"  \u002F\u002F read the redirects, check for a loop, write\n",[739,2469,2470,2472],{"class":741,"line":805},[739,2471,1010],{"class":752},[739,2473,947],{"class":756},[676,2475,2477],{"className":733,"code":2476,"language":735,"meta":684,"style":684},"\u002F\u002F A job: runs as the module, so the manifest lists 'collections.website-posts.create'.\nrun: async (ctx) => {\n  await createEntry(ctx, 'posts', { data: { title: 'Weekly digest', slug: `digest-${week}` } })\n}\n",[628,2478,2479,2484,2503,2574],{"__ignoreMap":684},[739,2480,2481],{"class":741,"line":742},[739,2482,2483],{"class":861},"\u002F\u002F A job: runs as the module, so the manifest lists 'collections.website-posts.create'.\n",[739,2485,2486,2489,2491,2493,2495,2497,2499,2501],{"class":741,"line":776},[739,2487,2488],{"class":796},"run",[739,2490,793],{"class":752},[739,2492,814],{"class":786},[739,2494,817],{"class":752},[739,2496,1268],{"class":820},[739,2498,835],{"class":752},[739,2500,838],{"class":786},[739,2502,802],{"class":752},[739,2504,2505,2507,2510,2512,2514,2516,2518,2521,2523,2525,2527,2530,2532,2534,2537,2539,2541,2544,2546,2548,2551,2553,2556,2559,2562,2565,2568,2570,2572],{"class":741,"line":783},[739,2506,2444],{"class":745},[739,2508,2509],{"class":808}," createEntry",[739,2511,902],{"class":854},[739,2513,1268],{"class":756},[739,2515,824],{"class":752},[739,2517,766],{"class":752},[739,2519,2520],{"class":769},"posts",[739,2522,890],{"class":752},[739,2524,824],{"class":752},[739,2526,753],{"class":752},[739,2528,2529],{"class":854}," data",[739,2531,793],{"class":752},[739,2533,753],{"class":752},[739,2535,2536],{"class":854}," title",[739,2538,793],{"class":752},[739,2540,766],{"class":752},[739,2542,2543],{"class":769},"Weekly digest",[739,2545,890],{"class":752},[739,2547,824],{"class":752},[739,2549,2550],{"class":854}," slug",[739,2552,793],{"class":752},[739,2554,2555],{"class":752}," `",[739,2557,2558],{"class":769},"digest-",[739,2560,2561],{"class":752},"${",[739,2563,2564],{"class":756},"week",[739,2566,2567],{"class":752},"}`",[739,2569,760],{"class":752},[739,2571,760],{"class":752},[739,2573,947],{"class":854},[739,2575,2576],{"class":741,"line":805},[739,2577,1186],{"class":752},[624,2579,2580,2581,2583,2584,2586],{},"In a session route the same call acts as the editor, with their rights; in a job, a public or account route, a payment\nhandler or a hook (every hook and ",[628,2582,2037],{}," handler runs as the module, decision 0014) as the module, with its ",[628,2585,1928],{},". A refusal is FORBIDDEN (403 from a route). Core's tables stay out of the SDK.",[624,2588,2589,2590,2592,2593,793],{},"A data source gets the context of whoever asked for it, whose rights may not reach the module's collection (a read\ntoken of the site). To read as the module itself, with exactly its ",[628,2591,1928],{},", it passes ",[628,2594,2595],{},"actAsModule(ctx)",[676,2597,2599],{"className":733,"code":2598,"language":735,"meta":684,"style":684},"\u002F\u002F The manifest lists 'collections.shop-products.read'.\ndataSources: [{\n  name: 'shop.products',\n  label: 'shop.sources.products',\n  parameters: [],\n  item: [{ kind: 'text', name: 'title', label: 'Title' }],\n  resolve: async (ctx) => {\n    const products = await listEntries(actAsModule(ctx), 'shop-products', { status: 'published' })\n    return products.items.map(product => ({ id: product.id, data: { title: product.data.title }, media: {}, links: {} }))\n  }\n}]\n",[628,2600,2601,2606,2618,2634,2650,2662,2716,2735,2789,2873,2878],{"__ignoreMap":684},[739,2602,2603],{"class":741,"line":742},[739,2604,2605],{"class":861},"\u002F\u002F The manifest lists 'collections.shop-products.read'.\n",[739,2607,2608,2611,2613,2616],{"class":741,"line":776},[739,2609,2610],{"class":796},"dataSources",[739,2612,793],{"class":752},[739,2614,2615],{"class":756}," [",[739,2617,1056],{"class":752},[739,2619,2620,2623,2625,2627,2630,2632],{"class":741,"line":783},[739,2621,2622],{"class":854},"  name",[739,2624,793],{"class":752},[739,2626,766],{"class":752},[739,2628,2629],{"class":769},"shop.products",[739,2631,890],{"class":752},[739,2633,1015],{"class":752},[739,2635,2636,2639,2641,2643,2646,2648],{"class":741,"line":805},[739,2637,2638],{"class":854},"  label",[739,2640,793],{"class":752},[739,2642,766],{"class":752},[739,2644,2645],{"class":769},"shop.sources.products",[739,2647,890],{"class":752},[739,2649,1015],{"class":752},[739,2651,2652,2655,2657,2660],{"class":741,"line":843},[739,2653,2654],{"class":854},"  parameters",[739,2656,793],{"class":752},[739,2658,2659],{"class":756}," []",[739,2661,1015],{"class":752},[739,2663,2664,2667,2669,2671,2673,2675,2677,2679,2681,2683,2685,2687,2689,2691,2694,2696,2698,2700,2702,2704,2707,2709,2711,2714],{"class":741,"line":858},[739,2665,2666],{"class":854},"  item",[739,2668,793],{"class":752},[739,2670,2615],{"class":756},[739,2672,920],{"class":752},[739,2674,1094],{"class":854},[739,2676,793],{"class":752},[739,2678,766],{"class":752},[739,2680,681],{"class":769},[739,2682,890],{"class":752},[739,2684,824],{"class":752},[739,2686,1210],{"class":854},[739,2688,793],{"class":752},[739,2690,766],{"class":752},[739,2692,2693],{"class":769},"title",[739,2695,890],{"class":752},[739,2697,824],{"class":752},[739,2699,1108],{"class":854},[739,2701,793],{"class":752},[739,2703,766],{"class":752},[739,2705,2706],{"class":769},"Title",[739,2708,890],{"class":752},[739,2710,760],{"class":752},[739,2712,2713],{"class":756},"]",[739,2715,1015],{"class":752},[739,2717,2718,2721,2723,2725,2727,2729,2731,2733],{"class":741,"line":865},[739,2719,2720],{"class":808},"  resolve",[739,2722,793],{"class":752},[739,2724,814],{"class":786},[739,2726,817],{"class":752},[739,2728,1268],{"class":820},[739,2730,835],{"class":752},[739,2732,838],{"class":786},[739,2734,802],{"class":752},[739,2736,2737,2739,2742,2744,2747,2750,2752,2754,2756,2758,2760,2762,2764,2767,2769,2771,2773,2776,2778,2780,2783,2785,2787],{"class":741,"line":950},[739,2738,846],{"class":786},[739,2740,2741],{"class":756}," products",[739,2743,799],{"class":752},[739,2745,2746],{"class":745}," await",[739,2748,2749],{"class":808}," listEntries",[739,2751,902],{"class":854},[739,2753,1706],{"class":808},[739,2755,902],{"class":854},[739,2757,1268],{"class":756},[739,2759,835],{"class":854},[739,2761,824],{"class":752},[739,2763,766],{"class":752},[739,2765,2766],{"class":769},"shop-products",[739,2768,890],{"class":752},[739,2770,824],{"class":752},[739,2772,753],{"class":752},[739,2774,2775],{"class":854}," status",[739,2777,793],{"class":752},[739,2779,766],{"class":752},[739,2781,2782],{"class":769},"published",[739,2784,890],{"class":752},[739,2786,760],{"class":752},[739,2788,947],{"class":854},[739,2790,2791,2793,2795,2797,2800,2802,2804,2806,2809,2811,2813,2815,2818,2820,2823,2825,2828,2830,2832,2834,2836,2838,2840,2842,2844,2846,2848,2850,2852,2855,2857,2860,2863,2865,2868,2870],{"class":741,"line":979},[739,2792,953],{"class":745},[739,2794,2741],{"class":756},[739,2796,876],{"class":752},[739,2798,2799],{"class":756},"items",[739,2801,876],{"class":752},[739,2803,1080],{"class":808},[739,2805,902],{"class":854},[739,2807,2808],{"class":820},"product",[739,2810,838],{"class":786},[739,2812,817],{"class":854},[739,2814,920],{"class":752},[739,2816,2817],{"class":854}," id",[739,2819,793],{"class":752},[739,2821,2822],{"class":756}," product",[739,2824,876],{"class":752},[739,2826,2827],{"class":756},"id",[739,2829,824],{"class":752},[739,2831,2529],{"class":854},[739,2833,793],{"class":752},[739,2835,753],{"class":752},[739,2837,2536],{"class":854},[739,2839,793],{"class":752},[739,2841,2822],{"class":756},[739,2843,876],{"class":752},[739,2845,1284],{"class":756},[739,2847,876],{"class":752},[739,2849,2693],{"class":756},[739,2851,1140],{"class":752},[739,2853,2854],{"class":854}," media",[739,2856,793],{"class":752},[739,2858,2859],{"class":752}," {},",[739,2861,2862],{"class":854}," links",[739,2864,793],{"class":752},[739,2866,2867],{"class":752}," {}",[739,2869,760],{"class":752},[739,2871,2872],{"class":854},"))\n",[739,2874,2875],{"class":741,"line":985},[739,2876,2877],{"class":752},"  }\n",[739,2879,2880,2882],{"class":741,"line":1018},[739,2881,1010],{"class":752},[739,2883,2884],{"class":756},"]\n",[624,2886,2887,2889,2890,2893,2894,2896,2897,2899,2900,2902,2903,1277,2906,2908,2909,2911,2912,2915],{},[628,2888,1706],{}," only ever gives the actor of the module core called, never another module's. Which module that is, is\ncore's own record of the contexts it made, not ",[628,2891,2892],{},"ctx.plugin",": it throws for a context core didn't make (a copy such as\n",[628,2895,2346],{},", or one you made up) and for one whose ",[628,2898,2892],{}," you changed. Pass the ",[628,2901,1268],{}," you were given; the same\ncontext on a transaction (",[628,2904,2905],{},"withDb",[628,2907,2361],{},", below) is fine. Don't use it for work an\neditor started (session routes): there the editor's context keeps the editor to their own\nrights. Its writes and refusals are the module's, audited as ",[628,2910,2228],{},".\n",[628,2913,2914],{},"listPublicEntries"," still reads published entries for the site.",[624,2917,2918,2919,2922,2923,1277,2925,1277,2928,1277,2930,1703,2933,2936,2937,2940,2941,2943,2944,2947],{},"When you need only where published entries live, not their content, use ",[628,2920,2921],{},"listPublishedSummaries(ctx, collection, { locale, ids, fields })"," (experimental). It gives each entry's ",[628,2924,2827],{},[628,2926,2927],{},"slug",[628,2929,2693],{},[628,2931,2932],{},"publishedAt",[628,2934,2935],{},"updatedAt",", and the\nplain fields you name by their path, such as ",[628,2938,2939],{},"seo.noindex",", in one query per collection and language. A translation\nthat is missing falls back to the default language. It reads no relations, media or links, so a list of thousands of\naddresses stays one read. It follows the same rules as ",[628,2942,2914],{},": the collection needs ",[628,2945,2946],{},"publicApi",", the\ncaller its read action, and a field the public API hides is refused, not left out.",[619,2949,2951],{"id":2950},"form-submissions","Form submissions",[624,2953,2954,2955,2958,2959,2962,2963,2965,2966,2969,2970,2972,2973,793],{},"Forms are the official forms module's (",[672,2956,2957],{"href":362},"Forms","), not core's. Core has no form\nbuilder, no ",[628,2960,2961],{},"forms"," manifest part and no ",[628,2964,2961],{}," capability. A module that wants leads hears the event the forms module\nraises for each submission, ",[628,2967,2968],{},"forms.submission.received",", with an ",[628,2971,2037],{}," entry in its manifest and the usual\n",[672,2974,2975],{"href":475},"events between modules",[676,2977,2979],{"className":733,"code":2978,"language":735,"meta":684,"style":684},"export default defineModule({\n  name: 'crm',\n  \u002F\u002F …\n  capabilities: { subscribe: {} },\n  on: {\n    'forms.submission.received': async (ctx, event) => {\n      const { form, answers } = event.data\n      if (form.key !== 'quote') return\n      const email = answers.find(answer => answer.role === 'email')?.value\n      await pushLead(ctx, { form: form.key, email, answers })\n    }\n  }\n})\n",[628,2980,2981,2993,3008,3013,3032,3041,3069,3095,3125,3173,3211,3216,3220],{"__ignoreMap":684},[739,2982,2983,2985,2987,2989,2991],{"class":741,"line":742},[739,2984,1197],{"class":745},[739,2986,1200],{"class":745},[739,2988,1203],{"class":808},[739,2990,902],{"class":756},[739,2992,1056],{"class":752},[739,2994,2995,2997,2999,3001,3004,3006],{"class":741,"line":776},[739,2996,2622],{"class":854},[739,2998,793],{"class":752},[739,3000,766],{"class":752},[739,3002,3003],{"class":769},"crm",[739,3005,890],{"class":752},[739,3007,1015],{"class":752},[739,3009,3010],{"class":741,"line":783},[739,3011,3012],{"class":861},"  \u002F\u002F …\n",[739,3014,3015,3018,3020,3022,3025,3027,3029],{"class":741,"line":805},[739,3016,3017],{"class":854},"  capabilities",[739,3019,793],{"class":752},[739,3021,753],{"class":752},[739,3023,3024],{"class":854}," subscribe",[739,3026,793],{"class":752},[739,3028,2867],{"class":752},[739,3030,3031],{"class":752}," },\n",[739,3033,3034,3037,3039],{"class":741,"line":843},[739,3035,3036],{"class":854},"  on",[739,3038,793],{"class":752},[739,3040,802],{"class":752},[739,3042,3043,3046,3048,3050,3052,3054,3056,3058,3060,3063,3065,3067],{"class":741,"line":858},[739,3044,3045],{"class":752},"    '",[739,3047,2968],{"class":854},[739,3049,890],{"class":752},[739,3051,793],{"class":752},[739,3053,814],{"class":786},[739,3055,817],{"class":752},[739,3057,1268],{"class":820},[739,3059,824],{"class":752},[739,3061,3062],{"class":820}," event",[739,3064,835],{"class":752},[739,3066,838],{"class":786},[739,3068,802],{"class":752},[739,3070,3071,3074,3076,3079,3081,3084,3086,3088,3090,3092],{"class":741,"line":865},[739,3072,3073],{"class":786},"      const",[739,3075,753],{"class":752},[739,3077,3078],{"class":756}," form",[739,3080,824],{"class":752},[739,3082,3083],{"class":756}," answers",[739,3085,760],{"class":752},[739,3087,799],{"class":752},[739,3089,3062],{"class":756},[739,3091,876],{"class":752},[739,3093,3094],{"class":756},"data\n",[739,3096,3097,3100,3102,3105,3107,3109,3112,3114,3117,3119,3122],{"class":741,"line":950},[739,3098,3099],{"class":745},"      if",[739,3101,817],{"class":854},[739,3103,3104],{"class":756},"form",[739,3106,876],{"class":752},[739,3108,1804],{"class":756},[739,3110,3111],{"class":752}," !==",[739,3113,766],{"class":752},[739,3115,3116],{"class":769},"quote",[739,3118,890],{"class":752},[739,3120,3121],{"class":854},") ",[739,3123,3124],{"class":745},"return\n",[739,3126,3127,3129,3132,3134,3136,3138,3141,3143,3146,3148,3151,3153,3156,3158,3160,3163,3165,3167,3170],{"class":741,"line":979},[739,3128,3073],{"class":786},[739,3130,3131],{"class":756}," email",[739,3133,799],{"class":752},[739,3135,3083],{"class":756},[739,3137,876],{"class":752},[739,3139,3140],{"class":808},"find",[739,3142,902],{"class":854},[739,3144,3145],{"class":820},"answer",[739,3147,838],{"class":786},[739,3149,3150],{"class":756}," answer",[739,3152,876],{"class":752},[739,3154,3155],{"class":756},"role",[739,3157,882],{"class":752},[739,3159,766],{"class":752},[739,3161,3162],{"class":769},"email",[739,3164,890],{"class":752},[739,3166,835],{"class":854},[739,3168,3169],{"class":752},"?.",[739,3171,3172],{"class":756},"value\n",[739,3174,3175,3178,3181,3183,3185,3187,3189,3191,3193,3195,3197,3199,3201,3203,3205,3207,3209],{"class":741,"line":985},[739,3176,3177],{"class":745},"      await",[739,3179,3180],{"class":808}," pushLead",[739,3182,902],{"class":854},[739,3184,1268],{"class":756},[739,3186,824],{"class":752},[739,3188,753],{"class":752},[739,3190,3078],{"class":854},[739,3192,793],{"class":752},[739,3194,3078],{"class":756},[739,3196,876],{"class":752},[739,3198,1804],{"class":756},[739,3200,824],{"class":752},[739,3202,3131],{"class":756},[739,3204,824],{"class":752},[739,3206,3083],{"class":756},[739,3208,760],{"class":752},[739,3210,947],{"class":854},[739,3212,3213],{"class":741,"line":1018},[739,3214,3215],{"class":752},"    }\n",[739,3217,3218],{"class":741,"line":1024},[739,3219,2877],{"class":752},[739,3221,3222,3224],{"class":741,"line":1059},[739,3223,1010],{"class":752},[739,3225,947],{"class":756},[1242,3227,3228,3246,3257,3260],{},[1245,3229,3230,1332,3233,3236,3237,1345,3240,3242,3243,3245],{},[628,3231,3232],{},"event.data",[628,3234,3235],{},"{ id, form: { id, key, version }, language, answers: [{ key, kind, role, value }], consent }",". Filter on\n",[628,3238,3239],{},"form.key",[628,3241,3155],{}," is the field's purpose (such as ",[628,3244,3162],{},"). Each published version of a form has a JSON Schema of its answers.",[1245,3247,3248,3249,3252,3253,3256],{},"Whatever your module keeps of a submission is personal data: list it in ",[628,3250,3251],{},"personalData"," (with ",[628,3254,3255],{},"erase","), so people can\nask for it and have it erased.",[1245,3258,3259],{},"Connecting a form to one module at a time, sending a submission again and a webhook with a form's answers come after\n0.1.0.",[1245,3261,3262,3263,1277,3266,1277,3269,1277,3272,1015,3275,1703,3278,1765,3281,1277,3284,1703,3287,3290,3291,3293],{},"Gone from the SDK: ",[628,3264,3265],{},"findPublishedForms",[628,3267,3268],{},"listPublishedForms",[628,3270,3271],{},"readPublishedForm",[628,3273,3274],{},"PublishedForm",[628,3276,3277],{},"PublishedFormField",[628,3279,3280],{},"ModuleFormSubmission",[628,3282,3283],{},"isSpam",[628,3285,3286],{},"SpamCheckFields",[628,3288,3289],{},"SPAM_CHECK_RATE_LIMIT"," (the spam check\nthe forms module uses, see ",[672,3292,463],{"href":464},") are stable.",[3295,3296,3297],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":684,"searchDepth":776,"depth":776,"links":3299},[3300,3301,3307,3308,3309,3310,3311,3312,3313,3314],{"id":621,"depth":776,"text":622},{"id":654,"depth":776,"text":655,"children":3302},[3303,3304,3305,3306],{"id":714,"depth":783,"text":715},{"id":1453,"depth":783,"text":1454},{"id":1688,"depth":783,"text":1689},{"id":1783,"depth":783,"text":1784},{"id":1824,"depth":776,"text":1825},{"id":1991,"depth":776,"text":1992},{"id":2089,"depth":776,"text":2090},{"id":2160,"depth":776,"text":2161},{"id":2186,"depth":776,"text":2187},{"id":2200,"depth":776,"text":2201},{"id":2238,"depth":776,"text":2239},{"id":2950,"depth":776,"text":2951},"md",null,{},{"title":110,"description":684},"ioZdhr1IWOo9uXi8KU9MdZaolENQYrhUxS85bwH0RWA",[3321,3322],{"title":467,"path":468,"stem":469,"description":684,"children":-1},{"title":474,"path":475,"stem":476,"description":684,"children":-1},1796500156065]