@jeromefitz/notion 4.0.3 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Nice Group of People, LLC
3
+ Copyright (c) 2021-2023 Nice Group of People, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/index.js CHANGED
@@ -1 +1 @@
1
- import{Client as eo}from"@notionhq/client";import T from"lodash/filter.js";import Re from"lodash/map.js";var w=({key:t,notion:r,type:o})=>({key:t,notion:r,type:o}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},k=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],K=[...k],q=[...k,e.author,e.status,e.subtitle],Z=[...k,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],J=[...k,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],X=[...k],ee=[...k,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],te=[...k,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],oe=[...k],re=[...k,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],ne=[...k,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],ro={BLOG:T(K,{init:!0}),BOOKS:T(q,{init:!0}),EPISODES:T(Z,{init:!0}),EVENTS:T(J,{init:!0}),PAGES:T(X,{init:!0}),PEOPLE:T(ee,{init:!0}),PODCASTS:T(te,{init:!0}),SEO:T(oe,{init:!0}),SHOWS:T(re,{init:!0}),VENUES:T(ne,{init:!0})},ie={BLOG:K.map(t=>w(t)),BOOKS:q.map(t=>w(t)),EPISODES:Z.map(t=>w(t)),EVENTS:J.map(t=>w(t)),PAGES:X.map(t=>w(t)),PEOPLE:ee.map(t=>w(t)),PODCASTS:te.map(t=>w(t)),SEO:oe.map(t=>w(t)),SHOWS:re.map(t=>w(t)),VENUES:ne.map(t=>w(t))},se=Re(e,t=>w(t)),$=new Date().toISOString(),I={dateBefore:{property:e.datePublished.notion,date:{before:$}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:$}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},Be="LISTING",Le="LISTING_BY_DATE",Ge="SLUG",Ne="SLUG_BY_ROUTE",Ae=[Be,Le,Ge,Ne],f=Object.assign({},...Ae.map(t=>({[t]:t})).flat(1));import{avoidRateLimit as Ue,isUndefined as Me}from"@jeromefitz/utils";var Ve=async({getBlocksChildrenList:t,block_id:r})=>Me(r)?[]:(await Ue(0),await t({block_id:r})),L=Ve;var C={sorts:[{property:e.slug.notion,direction:"ascending"}]},He=async({database_id:t,filter:r=C==null?void 0:C.filter,getDatabasesQuery:o,sorts:l=C==null?void 0:C.sorts})=>t?await o({database_id:t,sorts:l,filter:r}):[],G=He;var ae=async({getBlocksChildrenList:t,blocks:r})=>{if(r==null)return r;let o=r.filter(n=>n.has_children).map(n=>{let{id:i}=n;return{promise:t({block_id:i,page_size:100}),parent_block:n}}),l=await Promise.all(o.map(n=>n.promise));for(let n=0;n<l.length;n++){let i=l[n].results;if(await ae({blocks:i,getBlocksChildrenList:t}),o[n]){let p=o[n].parent_block;p[p.type].children=i}}return r},N=ae;var Fe=({config:t,item:r,routeType:o,meta:l})=>{var _,y;let{NOTION:n}=t,i="",p=(_=r.properties)==null?void 0:_.slug,s="",c="/[...catchAll]";switch(o){case n.BLOG.routeType:case n.EVENTS.routeType:i=(y=r.properties[n[o.toUpperCase()].infoType.key])==null?void 0:y.start.slice(0,10);let[a,u,d]=i==null?void 0:i.split("-");s=`/${o}/${a}/${u}/${d}/${p}`;break;case n.PODCASTS.routeType:case n.EPISODES.routeType:s=`/${l==null?void 0:l.join("/")}/${p}`;break;default:s=`/${o}/${p}`;break}return s=s.replace("//","/"),{as:s,date:i,href:c,slug:p}},A=Fe;import{sortObject as ke}from"@jeromefitz/utils";import bt from"lodash/map.js";import V from"lodash/omit.js";import le from"date-fns/addDays/index.js";import Qe from"date-fns/addMonths/index.js";import We from"date-fns/addYears/index.js";var Ye=(t,r)=>{switch(r){case"year":return We(t,1).toISOString();case"month":return Qe(t,1).toISOString();case"day":return le(t,2).toISOString()}return le(t,-1).toISOString()},E=Ye;import ze from"lodash/map.js";var je=({config:t,data:r,pathVariables:o,pageId:l})=>{var _,y;let{NOTION:n}=t,i={};if(!(r!=null&&r.properties))return i;let{properties:p}=r,s="";if(o){let{meta:a,routeType:u}=o;s=u===((_=n==null?void 0:n.PODCASTS)==null?void 0:_.routeType)&&a.length>1?(y=n==null?void 0:n.EPISODES)==null?void 0:y.routeType:u}let c=s?ie[s.toUpperCase()]:se;return ze(c,a=>{let u,d=p[a.notion];i[a.key]=null,d&&(u=D[a.type](d,l),i[a.key]=u||null)}),i},g=je;import{sortObject as $e}from"@jeromefitz/utils";import Ke from"lodash/map.js";import qe from"lodash/omit.js";var Ze=({config:t,results:r,routeType:o})=>{let l=[];return Ke(r,n=>{let i=qe(n,"properties");i.properties=$e(g({config:t,data:n,pathVariables:o,pageId:n==null?void 0:n.id})),l.push(i)}),l},pe=Ze;var Je=({isPage:t,isIndex:r,hasMeta:o})=>t?f.SLUG:r&&!o?f.LISTING:r&&o?f.LISTING_BY_DATE:o?f.SLUG_BY_ROUTE:f.SLUG,U=Je;var Xe=t=>(console.dir("@notion(_unsupported)"),t),x=Xe;var et=t=>t.checkbox||!1,_e=et;var tt=t=>{let{type:r}=t;return t[r]},R=tt;var ot=t=>t.email||null,ue=ot;import{stringToUUID as rt}from"@jeromefitz/utils";import nt from"github-slugger";import it from"lodash/size.js";var st="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",at=(t,r)=>st.replace("{{FILENAME}}",encodeURIComponent(t)).replace("{{PAGE_ID}}",rt(r)),lt=(t,r)=>{let o=new nt,l={};return it(t.files)<=0||t.files.map(n=>{var i,p;if((n==null?void 0:n.type)==="file"){let s=(i=n==null?void 0:n.file)==null?void 0:i.url.split("?")[0],c=o.slug(s);l[c]={type:n==null?void 0:n.type,url:at(s,r)}}if((n==null?void 0:n.type)==="external"){let s=(p=n==null?void 0:n.external)==null?void 0:p.url.split("?")[0],c=o.slug(s);l[c]={type:n==null?void 0:n.type,url:s}}}),l},M=lt;import pt from"github-slugger";import _t from"lodash/map.js";var ut=t=>{let r=new pt,o={};return _t(t.multi_select,l=>{let n=l;n.slug=r.slug(n.name),o[n.id]=n}),o},de=ut;var dt=t=>(t==null?void 0:t.number)||null,ce=dt;import ct from"github-slugger";var yt=t=>{let r=new ct;return t.people.map(o=>{let{avatar_url:l,id:n,name:i,person:p}=o,{email:s}=p;return{[r.slug(i)]:{avatar_url:l,email:s,id:n,name:i}}})[0]},ye=yt;var mt=t=>(t==null?void 0:t.phone_number)||null,me=mt;import he from"lodash/map.js";var ht=t=>t.type==="rollup"?t.rollup.type==="array"&&he(t.rollup.array,r=>D[r.type](r))[0]:he(t.relation,r=>r.id),Pe=ht;var Pt=t=>{var r;return t!=null&&t.rich_text?(r=t==null?void 0:t.rich_text[0])==null?void 0:r.plain_text:null},Se=Pt;import ge from"lodash/map.js";import St from"lodash/sortBy.js";var gt=t=>{let r=t==null?void 0:t.rollup;return St(ge(r==null?void 0:r.array,o=>ge(o[o==null?void 0:o.type],l=>D[o==null?void 0:o.type]({type:o==null?void 0:o.type,[o==null?void 0:o.type]:[l]})))).flat()},fe=gt;import ft from"github-slugger";var Et=t=>{let r=new ft,o=t.select;return o?(o.slug=r.slug(t.select.name),{[o.id]:o}):null},Ee=Et;var wt=t=>{var r;return t!=null&&t.title?(r=t==null?void 0:t.title[0])==null?void 0:r.plain_text:null},we=wt;var Tt=t=>t.url||null,Te=Tt;var kt={checkbox:_e,created_by:x,created_time:R,date:R,email:ue,files:M,formula:x,image:M,last_edited_by:x,last_edited_time:R,multi_select:de,number:ce,people:ye,phone_number:me,relation:Pe,rich_text:Se,rollup:fe,select:Ee,title:we,url:Te},D=kt;var It=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i})=>{let{NOTION:p}=t,s={},c=p[i.toUpperCase()].page_id__seo,_=await l({page_id:c});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=V(_,"properties"),s.properties=ke(g({config:t,data:_,pathVariables:n,pageId:s.id})));let y=p[i.toUpperCase()].infoType.notion??e.datePublished.notion,a=y===e.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await r({block_id:s.id}),d=await o({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:a}}]}}),h=[];bt(d.results,P=>{let S=P;S=V(S,"properties"),S.properties=ke(g({config:t,data:P,pathVariables:n,pageId:P.id})),h.push(S)});let m=V(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},H=It;import{sortObject as be}from"@jeromefitz/utils";import Dt from"lodash/map.js";import B from"lodash/omit.js";import Ct from"lodash/size.js";var Ot=({config:t,pathVariables:r,routeType:o,slug:l})=>{var d,h;let{NOTION:n}=t,{meta:i}=r,[p,s,c]=i,_=Ct(i),y=new Date().toISOString(),a=new Date(`${p||y.slice(0,4)}-${s||"01"}-${c||"01"}`),u=((h=(d=n[o.toUpperCase()])==null?void 0:d.infoType)==null?void 0:h.notion)??e.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"day")}},{...I.slug,rich_text:{equals:l}}]}}},vt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=t,c={},_={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(_=B(a,"properties"),_.properties=be(g({config:t,data:a,pathVariables:n,pageId:a.id}))),c=await r({block_id:_.id});let u=[{property:e.datePublished.notion,direction:"descending"}],d=Ot({config:t,pathVariables:n,routeType:i,slug:p}),h=s[i.toUpperCase()].database_id,m=await o({database_id:h,filter:d,sorts:u}),P=[];Dt(m.results,O=>{let v=B(O,"properties");v.properties=be(g({config:t,data:O,pathVariables:n,pageId:v.id})),v&&P.push(v)});let S=B(m,"results");S.results=P;let b=B(S,"data");return{info:_,content:c,items:b,images:{}}},F=vt;import{sortObject as xt}from"@jeromefitz/utils";import Rt from"lodash/omit.js";var Bt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getDeepFetchAllChildren:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=t,c=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(c))return{info:{},content:{},items:{},images:{}};let y=await o({database_id:s[c].database_id,filter:{and:[{...I.slug,rich_text:{equals:p}}]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Rt(a,"properties");u.properties=xt(g({config:t,data:a,pathVariables:n,pageId:u.id}));let d=await r({block_id:u.id}),m=[...await l({blocks:d.results})];return{info:u,content:m,items:{},images:{}}},Q=Bt;import{sortObject as Ie}from"@jeromefitz/utils";import De from"lodash/omit.js";import Lt from"lodash/size.js";var Gt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i})=>{var b;let{NOTION:p}=t,{meta:s}=n,c=i.toUpperCase(),[_,y]=s,a=Lt(s)===2,u=(b=p[c])==null?void 0:b.hasChild.toUpperCase(),d=await o({database_id:p[a?p[u].routeType.toUpperCase():c].database_id,filter:{and:[{...I.slug,rich_text:{equals:a?y:_}}]}}),h=(d==null?void 0:d.object)==="list"&&d.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let m=De(h,"properties");m.properties=Ie(g({config:t,data:h,pathVariables:n,pageId:m.id}));let P=await r({block_id:m.id}),S={};return a||(S=await l({config:t,reqQuery:{podcasts:m.id,databaseType:p[u].routeType.toUpperCase()}})),{info:m,content:P,items:S,images:{}}},Nt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:l,routeType:n,slug:i})=>{var b,O;let p=new Date().toISOString(),{NOTION:s}=t,{meta:c}=l,[_,y,a]=c,u=new Date(`${_||p.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((O=(b=s[n.toUpperCase()])==null?void 0:b.infoType)==null?void 0:O.notion)??e.datePublished.notion,h=await o({database_id:s[n.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:E(u,"")}},{property:d,date:{before:E(u,"day")}},{...I.slug,rich_text:{equals:i}}]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let P=De(m,"properties");P.properties=Ie(g({config:t,data:m,pathVariables:l,pageId:P.id}));let S=await r({block_id:P.id});return{info:P,content:S,items:{},images:{}}},At=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=t;return s[i.toUpperCase()].hasChild?await Gt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i}):c[f.LISTING_BY_DATE].includes(i.toUpperCase())?await Nt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:n,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},W=At;import{avoidRateLimit as Ut,isUndefined as Mt}from"@jeromefitz/utils";var Vt=async({getPagesRetrieve:t,page_id:r})=>Mt(r)?[]:(await Ut(0),await t({page_id:r})),Y=Vt;import Ce from"lodash/drop.js";import Ht from"lodash/dropRight.js";import Ft from"lodash/first.js";import Oe from"lodash/includes.js";import Qt from"lodash/isInteger.js";import Wt from"lodash/join.js";import Yt from"lodash/last.js";import ve from"lodash/size.js";var zt=({config:t,catchAll:r})=>{let{NOTION:o,PAGES__HOMEPAGE:l,ROUTE_META:n,ROUTE_TYPES:i}=t,p=ve(r),s=Ft(r),c=s.toUpperCase(),_=Yt(r),y=p>1&&Oe(n,c)?Ce(r):Ce(Ht(r)),a=s===_&&!Oe(i,c)?o.PAGES.routeType:s,u=s!==_&&!Qt(parseInt(_))?_:s,d=a===o.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&ve(y)!==0,P=d&&s===l?"":Wt(r,"/"),S={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:P},b=U(S);return{...S,dataType:b}},z=zt;import{avoidRateLimit as jt,isObjectEmpty as $t}from"@jeromefitz/utils";import Kt from"lodash/map.js";import qt from"lodash/omit.js";import Zt from"lodash/size.js";var Jt=[{property:e.slug.notion,direction:"ascending"}],Xt=async({config:t,reqQuery:r,notionDatabasesQuery:o})=>{let{NOTION:l}=t,{databaseType:n}=r,i=n,p=!1,s=n.toUpperCase(),c=l[s].database_id;if(!c)return[];let _={},y={},a,u;if(n==="EPISODES"){u=Jt;let{podcasts:d}=r,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),Zt(m)>0&&Kt(m,P=>h.push({property:e.relationEpisodes__Podcasts.notion,relation:{contains:P}})),a={or:[...h]}}else p=!0;if(!p&&(!_||$t(_))){await jt(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:e.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await o({database_id:c,filter:a,sorts:u}),_=d,y=pe({config:t,results:d.results,routeType:i}),_=qt(_,"results"),_.results=y):p=!0}return _},j=Xt;var xe=class extends eo{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await L({...o,getBlocksChildrenList:this.blocks.children.list}),getDatabasesByIdQuery:async o=>await G({...o,getDatabasesQuery:this.databases.query}),getDeepFetchAllChildren:async o=>await N({...o,getBlocksChildrenList:this.blocks.children.list}),getInfoType:o=>A({...o,config:this.#e}),getPagesById:async o=>await Y({...o,getPagesRetrieve:this.pages.retrieve}),getPathVariables:o=>z({...o,config:this.#e}),getQuery:async o=>await j({...o,config:this.#e,notionDatabasesQuery:this.databases.query})};this.dataTypes={[f.LISTING]:async o=>await H({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[f.LISTING_BY_DATE]:async o=>await F({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[f.SLUG]:async o=>await Q({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren}),[f.SLUG_BY_ROUTE]:async o=>await W({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery})};this.#e=o==null?void 0:o.config}#e};export{xe as Client};
1
+ import{Client as eo}from"@notionhq/client";import T from"lodash/filter.js";import Re from"lodash/map.js";var w=({key:t,notion:r,type:o})=>({key:t,notion:r,type:o}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},k=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],K=[...k],q=[...k,e.author,e.status,e.subtitle],Z=[...k,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],J=[...k,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],X=[...k],ee=[...k,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],te=[...k,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],oe=[...k],re=[...k,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],ne=[...k,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],ro={BLOG:T(K,{init:!0}),BOOKS:T(q,{init:!0}),EPISODES:T(Z,{init:!0}),EVENTS:T(J,{init:!0}),PAGES:T(X,{init:!0}),PEOPLE:T(ee,{init:!0}),PODCASTS:T(te,{init:!0}),SEO:T(oe,{init:!0}),SHOWS:T(re,{init:!0}),VENUES:T(ne,{init:!0})},ie={BLOG:K.map(t=>w(t)),BOOKS:q.map(t=>w(t)),EPISODES:Z.map(t=>w(t)),EVENTS:J.map(t=>w(t)),PAGES:X.map(t=>w(t)),PEOPLE:ee.map(t=>w(t)),PODCASTS:te.map(t=>w(t)),SEO:oe.map(t=>w(t)),SHOWS:re.map(t=>w(t)),VENUES:ne.map(t=>w(t))},se=Re(e,t=>w(t)),$=new Date().toISOString(),D={dateBefore:{property:e.datePublished.notion,date:{before:$}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:$}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},Be="LISTING",Le="LISTING_BY_DATE",Ge="SLUG",Ne="SLUG_BY_ROUTE",Ae=[Be,Le,Ge,Ne],f=Object.assign({},...Ae.map(t=>({[t]:t})).flat(1));import{avoidRateLimit as Ue,isUndefined as Me}from"@jeromefitz/utils";var Ve=async({getBlocksChildrenList:t,block_id:r})=>Me(r)?[]:(await Ue(0),await t({block_id:r})),L=Ve;var O={sorts:[{property:e.slug.notion,direction:"ascending"}]},He=async({database_id:t,filter:r=O==null?void 0:O.filter,getDatabasesQuery:o,sorts:l=O==null?void 0:O.sorts})=>t?await o({database_id:t,sorts:l,filter:r}):[],G=He;var ae=async({getBlocksChildrenList:t,blocks:r})=>{if(r==null)return r;let o=r.filter(n=>n.has_children).map(n=>{let{id:i}=n;return{promise:t({block_id:i,page_size:100}),parent_block:n}}),l=await Promise.all(o.map(n=>n.promise));for(let n=0;n<l.length;n++){let i=l[n].results;if(await ae({blocks:i,getBlocksChildrenList:t}),o[n]){let _=o[n].parent_block;_[_.type].children=i}}return r},N=ae;var Fe=({config:t,item:r,routeType:o,meta:l})=>{var p,y;let{NOTION:n}=t,i="",_=(p=r.properties)==null?void 0:p.slug,s="",c="/[...catchAll]";switch(o){case n.BLOG.routeType:case n.EVENTS.routeType:i=(y=r.properties[n[o.toUpperCase()].infoType.key])==null?void 0:y.start.slice(0,10);let[a,u,d]=i==null?void 0:i.split("-");s=`/${o}/${a}/${u}/${d}/${_}`;break;case n.PODCASTS.routeType:case n.EPISODES.routeType:s=`/${l==null?void 0:l.join("/")}/${_}`;break;default:s=`/${o}/${_}`;break}return s=s.replace("//","/"),{as:s,date:i,href:c,slug:_}},A=Fe;import{sortObject as ke}from"@jeromefitz/utils";import bt from"lodash/map.js";import V from"lodash/omit.js";import le from"date-fns/addDays/index.js";import Qe from"date-fns/addMonths/index.js";import We from"date-fns/addYears/index.js";var Ye=(t,r)=>{switch(r){case"year":return We(t,1).toISOString();case"month":return Qe(t,1).toISOString();case"day":return le(t,2).toISOString()}return le(t,-1).toISOString()},E=Ye;import ze from"lodash/map.js";var je=({config:t,data:r,pathVariables:o,pageId:l})=>{var p,y;let{NOTION:n}=t,i={};if(!(r!=null&&r.properties))return i;let{properties:_}=r,s="";if(o){let{meta:a,routeType:u}=o;s=u===((p=n==null?void 0:n.PODCASTS)==null?void 0:p.routeType)&&a.length>1?(y=n==null?void 0:n.EPISODES)==null?void 0:y.routeType:u}let c=s?ie[s.toUpperCase()]:se;return ze(c,a=>{let u,d=_[a.notion];i[a.key]=null,d&&(u=C[a.type](d,l),i[a.key]=u||null)}),i},g=je;import{sortObject as $e}from"@jeromefitz/utils";import Ke from"lodash/map.js";import qe from"lodash/omit.js";var Ze=({config:t,results:r,routeType:o})=>{let l=[];return Ke(r,n=>{let i=qe(n,"properties");i.properties=$e(g({config:t,data:n,pathVariables:o,pageId:n==null?void 0:n.id})),l.push(i)}),l},pe=Ze;var Je=({isPage:t,isIndex:r,hasMeta:o})=>t?f.SLUG:r&&!o?f.LISTING:r&&o?f.LISTING_BY_DATE:o?f.SLUG_BY_ROUTE:f.SLUG,U=Je;var Xe=t=>(console.dir("@notion(_unsupported)"),t),x=Xe;var et=t=>t.checkbox||!1,_e=et;var tt=t=>{let{type:r}=t;return t[r]},R=tt;var ot=t=>t.email||null,ue=ot;import{stringToUUID as rt}from"@jeromefitz/utils";import nt from"github-slugger";import it from"lodash/size.js";var st="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",at=(t,r)=>st.replace("{{FILENAME}}",encodeURIComponent(t)).replace("{{PAGE_ID}}",rt(r)),lt=(t,r)=>{let o=new nt,l={};return it(t.files)<=0||t.files.map(n=>{var i,_;if((n==null?void 0:n.type)==="file"){let s=(i=n==null?void 0:n.file)==null?void 0:i.url.split("?")[0],c=o.slug(s);l[c]={type:n==null?void 0:n.type,url:at(s,r)}}if((n==null?void 0:n.type)==="external"){let s=(_=n==null?void 0:n.external)==null?void 0:_.url.split("?")[0],c=o.slug(s);l[c]={type:n==null?void 0:n.type,url:s}}}),l},M=lt;import pt from"github-slugger";import _t from"lodash/map.js";var ut=t=>{let r=new pt,o={};return _t(t.multi_select,l=>{let n=l;n.slug=r.slug(n.name),o[n.id]=n}),o},de=ut;var dt=t=>(t==null?void 0:t.number)||null,ce=dt;import ct from"github-slugger";var yt=t=>{let r=new ct;return t.people.map(o=>{let{avatar_url:l,id:n,name:i,person:_}=o,{email:s}=_;return{[r.slug(i)]:{avatar_url:l,email:s,id:n,name:i}}})[0]},ye=yt;var mt=t=>(t==null?void 0:t.phone_number)||null,me=mt;import he from"lodash/map.js";var ht=t=>t.type==="rollup"?t.rollup.type==="array"&&he(t.rollup.array,r=>C[r.type](r))[0]:he(t.relation,r=>r.id),Pe=ht;var Pt=t=>{var r;return t!=null&&t.rich_text?(r=t==null?void 0:t.rich_text[0])==null?void 0:r.plain_text:null},Se=Pt;import ge from"lodash/map.js";import St from"lodash/sortBy.js";var gt=t=>{let r=t==null?void 0:t.rollup;return St(ge(r==null?void 0:r.array,o=>ge(o[o==null?void 0:o.type],l=>C[o==null?void 0:o.type]({type:o==null?void 0:o.type,[o==null?void 0:o.type]:[l]})))).flat()},fe=gt;import ft from"github-slugger";var Et=t=>{let r=new ft,o=t.select;return o?(o.slug=r.slug(t.select.name),{[o.id]:o}):null},Ee=Et;var wt=t=>{var r;return t!=null&&t.title?(r=t==null?void 0:t.title[0])==null?void 0:r.plain_text:null},we=wt;var Tt=t=>t.url||null,Te=Tt;var kt={checkbox:_e,created_by:x,created_time:R,date:R,email:ue,files:M,formula:x,image:M,last_edited_by:x,last_edited_time:R,multi_select:de,number:ce,people:ye,phone_number:me,relation:Pe,rich_text:Se,rollup:fe,select:Ee,title:we,url:Te},C=kt;var It=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i})=>{let{NOTION:_}=t,s={},c=_[i.toUpperCase()].page_id__seo,p=await l({page_id:c});if(!p)return{};(p==null?void 0:p.object)==="page"&&(s=V(p,"properties"),s.properties=ke(g({config:t,data:p,pathVariables:n,pageId:s.id})));let y=_[i.toUpperCase()].infoType.notion??e.datePublished.notion,a=y===e.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await r({block_id:s.id}),d=await o({database_id:_[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:a}}]}}),h=[];bt(d.results,P=>{let S=P;S=V(S,"properties"),S.properties=ke(g({config:t,data:P,pathVariables:n,pageId:P.id})),h.push(S)});let m=V(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},H=It;import{sortObject as be}from"@jeromefitz/utils";import Dt from"lodash/map.js";import B from"lodash/omit.js";import Ct from"lodash/size.js";var Ot=({config:t,pathVariables:r,routeType:o,slug:l})=>{var d,h;let{NOTION:n}=t,{meta:i}=r,[_,s,c]=i,p=Ct(i),y=new Date().toISOString(),a=new Date(`${_||y.slice(0,4)}-${s||"01"}-${c||"01"}`),u=((h=(d=n[o.toUpperCase()])==null?void 0:d.infoType)==null?void 0:h.notion)??e.datePublished.notion;switch(p){case 1:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:E(a,"")}},{property:u,date:{before:E(a,"day")}},{...D.slug,rich_text:{equals:l}}]}}},vt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i,slug:_})=>{let{NOTION:s}=t,c={},p={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(p=B(a,"properties"),p.properties=be(g({config:t,data:a,pathVariables:n,pageId:a.id}))),c=await r({block_id:p.id});let u=[{property:e.datePublished.notion,direction:"descending"}],d=Ot({config:t,pathVariables:n,routeType:i,slug:_}),h=s[i.toUpperCase()].database_id,m=await o({database_id:h,filter:d,sorts:u}),P=[];Dt(m.results,I=>{let v=B(I,"properties");v.properties=be(g({config:t,data:I,pathVariables:n,pageId:v.id})),v&&P.push(v)});let S=B(m,"results");S.results=P;let b=B(S,"data");return{info:p,content:c,items:b,images:{}}},F=vt;import{sortObject as xt}from"@jeromefitz/utils";import Rt from"lodash/omit.js";var Bt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getDeepFetchAllChildren:l,pathVariables:n,routeType:i,slug:_})=>{let{NOTION:s}=t,c=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(c))return{info:{},content:{},items:{},images:{}};let y=await o({database_id:s[c].database_id,filter:{and:[{...D.slug,rich_text:{equals:_}}]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Rt(a,"properties");u.properties=xt(g({config:t,data:a,pathVariables:n,pageId:u.id}));let d=await r({block_id:u.id}),m=[...await l({blocks:d.results})];return{info:u,content:m,items:{},images:{}}},Q=Bt;import{sortObject as Ie}from"@jeromefitz/utils";import De from"lodash/omit.js";import Lt from"lodash/size.js";var Gt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i})=>{var b,I;let{NOTION:_}=t,{meta:s}=n,c=i.toUpperCase(),[p,y]=s,a=Lt(s)===2,u=(I=(b=_[c])==null?void 0:b.hasChild)==null?void 0:I.toUpperCase(),d=await o({database_id:_[a?_[u].routeType.toUpperCase():c].database_id,filter:{and:[{...D.slug,rich_text:{equals:a?y:p}}]}}),h=(d==null?void 0:d.object)==="list"&&d.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let m=De(h,"properties");m.properties=Ie(g({config:t,data:h,pathVariables:n,pageId:m.id}));let P=await r({block_id:m.id}),S={};return a||(S=await l({config:t,reqQuery:{podcasts:m.id,databaseType:_[u].routeType.toUpperCase()}})),{info:m,content:P,items:S,images:{}}},Nt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:l,routeType:n,slug:i})=>{var b,I;let _=new Date().toISOString(),{NOTION:s}=t,{meta:c}=l,[p,y,a]=c,u=new Date(`${p||_.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((I=(b=s[n.toUpperCase()])==null?void 0:b.infoType)==null?void 0:I.notion)??e.datePublished.notion,h=await o({database_id:s[n.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:E(u,"")}},{property:d,date:{before:E(u,"day")}},{...D.slug,rich_text:{equals:i}}]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let P=De(m,"properties");P.properties=Ie(g({config:t,data:m,pathVariables:l,pageId:P.id}));let S=await r({block_id:P.id});return{info:P,content:S,items:{},images:{}}},At=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i,slug:_})=>{var p;let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=t;return(p=s[i==null?void 0:i.toUpperCase()])!=null&&p.hasChild?await Gt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i}):c[f.LISTING_BY_DATE].includes(i.toUpperCase())?await Nt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:n,routeType:i,slug:_}):{info:{},content:{},items:{},images:{}}},W=At;import{avoidRateLimit as Ut,isUndefined as Mt}from"@jeromefitz/utils";var Vt=async({getPagesRetrieve:t,page_id:r})=>Mt(r)?[]:(await Ut(0),await t({page_id:r})),Y=Vt;import Ce from"lodash/drop.js";import Ht from"lodash/dropRight.js";import Ft from"lodash/first.js";import Oe from"lodash/includes.js";import Qt from"lodash/isInteger.js";import Wt from"lodash/join.js";import Yt from"lodash/last.js";import ve from"lodash/size.js";var zt=({config:t,catchAll:r})=>{let{NOTION:o,PAGES__HOMEPAGE:l,ROUTE_META:n,ROUTE_TYPES:i}=t,_=ve(r),s=Ft(r),c=s.toUpperCase(),p=Yt(r),y=_>1&&Oe(n,c)?Ce(r):Ce(Ht(r)),a=s===p&&!Oe(i,c)?o.PAGES.routeType:s,u=s!==p&&!Qt(parseInt(p))?p:s,d=a===o.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&ve(y)!==0,P=d&&s===l?"":Wt(r,"/"),S={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:P},b=U(S);return{...S,dataType:b}},z=zt;import{avoidRateLimit as jt,isObjectEmpty as $t}from"@jeromefitz/utils";import Kt from"lodash/map.js";import qt from"lodash/omit.js";import Zt from"lodash/size.js";var Jt=[{property:e.slug.notion,direction:"ascending"}],Xt=async({config:t,reqQuery:r,notionDatabasesQuery:o})=>{let{NOTION:l}=t,{databaseType:n}=r,i=n,_=!1,s=n.toUpperCase(),c=l[s].database_id;if(!c)return[];let p={},y={},a,u;if(n==="EPISODES"){u=Jt;let{podcasts:d}=r,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),Zt(m)>0&&Kt(m,P=>h.push({property:e.relationEpisodes__Podcasts.notion,relation:{contains:P}})),a={or:[...h]}}else _=!0;if(!_&&(!p||$t(p))){await jt(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:e.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await o({database_id:c,filter:a,sorts:u}),p=d,y=pe({config:t,results:d.results,routeType:i}),p=qt(p,"results"),p.results=y):_=!0}return p},j=Xt;var xe=class extends eo{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await L({...o,getBlocksChildrenList:this.blocks.children.list}),getDatabasesByIdQuery:async o=>await G({...o,getDatabasesQuery:this.databases.query}),getDeepFetchAllChildren:async o=>await N({...o,getBlocksChildrenList:this.blocks.children.list}),getInfoType:o=>A({...o,config:this.#e}),getPagesById:async o=>await Y({...o,getPagesRetrieve:this.pages.retrieve}),getPathVariables:o=>z({...o,config:this.#e}),getQuery:async o=>await j({...o,config:this.#e,notionDatabasesQuery:this.databases.query})};this.dataTypes={[f.LISTING]:async o=>await H({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[f.LISTING_BY_DATE]:async o=>await F({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById}),[f.SLUG]:async o=>await Q({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren}),[f.SLUG_BY_ROUTE]:async o=>await W({...o,config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery})};this.#e=o==null?void 0:o.config}#e};export{xe as Client};
package/package.json CHANGED
@@ -1,31 +1,27 @@
1
1
  {
2
- "private": false,
3
- "license": "MIT",
4
- "version": "4.0.3",
5
2
  "name": "@jeromefitz/notion",
3
+ "version": "4.0.5",
4
+ "type": "module",
6
5
  "description": "Notion: Custom Client for jeromefitzgerald.com",
6
+ "repository": "jeromefitz/packages.git",
7
7
  "author": {
8
8
  "name": "Jerome Fitzgerald",
9
9
  "email": "j@jeromefitzgerald.com",
10
10
  "url": "https://jeromefitzgerald.com"
11
11
  },
12
- "repository": "jeromefitz/packages.git",
13
- "publishConfig": {
14
- "registry": "https://registry.npmjs.org/"
15
- },
16
- "keywords": [
17
- "next",
18
- "next.js",
19
- "notion"
20
- ],
12
+ "license": "MIT",
13
+ "private": false,
21
14
  "engines": {
22
15
  "node": ">=16"
23
16
  },
24
- "type": "module",
25
17
  "main": "./index.js",
26
18
  "module": "./index.js",
27
19
  "typings": "./index.d.ts",
28
- "sideEffects": false,
20
+ "keywords": [
21
+ "next",
22
+ "next.js",
23
+ "notion"
24
+ ],
29
25
  "scripts": {
30
26
  "build": "tsup-node",
31
27
  "clean": "rm -rf .turbo && rm -rf dist",
@@ -38,19 +34,23 @@
38
34
  "lint:eslint": "eslint ./src --ext cjs,js,jsx,mjs,ts,tsx --max-warnings=0",
39
35
  "semantic-release": "semantic-release"
40
36
  },
37
+ "peerDependencies": {
38
+ "@jeromefitz/utils": "^2.1.0",
39
+ "lodash": "^4.17.21"
40
+ },
41
41
  "dependencies": {
42
- "@notionhq/client": "2.2.3",
42
+ "@notionhq/client": "2.2.4",
43
43
  "date-fns": "2.29.3",
44
- "date-fns-tz": "1.3.7",
44
+ "date-fns-tz": "2.0.0",
45
45
  "github-slugger": "2.0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@jeromefitz/utils": "workspace:*",
49
- "@types/lodash": "4.14.191",
49
+ "@types/lodash": "4.14.194",
50
50
  "lodash": "4.17.21"
51
51
  },
52
- "peerDependencies": {
53
- "@jeromefitz/utils": "^2.1.0",
54
- "lodash": "^4.17.21"
55
- }
52
+ "publishConfig": {
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "sideEffects": false
56
56
  }
@@ -1 +1 @@
1
- import{sortObject as se}from"@jeromefitz/utils";import le from"lodash/omit.js";import Ke from"lodash/size.js";import c from"lodash/filter.js";import ae from"lodash/map.js";var d=({key:o,notion:t,type:r})=>({key:o,notion:t,type:r}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},h=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],I=[...h],R=[...h,e.author,e.status,e.subtitle],L=[...h,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],A=[...h,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],M=[...h],U=[...h,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],N=[...h,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],H=[...h],V=[...h,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],W=[...h,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],$e={BLOG:c(I,{init:!0}),BOOKS:c(R,{init:!0}),EPISODES:c(L,{init:!0}),EVENTS:c(A,{init:!0}),PAGES:c(M,{init:!0}),PEOPLE:c(U,{init:!0}),PODCASTS:c(N,{init:!0}),SEO:c(H,{init:!0}),SHOWS:c(V,{init:!0}),VENUES:c(W,{init:!0})},F={BLOG:I.map(o=>d(o)),BOOKS:R.map(o=>d(o)),EPISODES:L.map(o=>d(o)),EVENTS:A.map(o=>d(o)),PAGES:M.map(o=>d(o)),PEOPLE:U.map(o=>d(o)),PODCASTS:N.map(o=>d(o)),SEO:H.map(o=>d(o)),SHOWS:V.map(o=>d(o)),VENUES:W.map(o=>d(o))},B=ae(e,o=>d(o)),G=new Date().toISOString(),C={dateBefore:{property:e.datePublished.notion,date:{before:G}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:G}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},_e="LISTING",pe="LISTING_BY_DATE",ue="SLUG",de="SLUG_BY_ROUTE",ye=[_e,pe,ue,de],Y=Object.assign({},...ye.map(o=>({[o]:o})).flat(1));import K from"date-fns/addDays/index.js";import ce from"date-fns/addMonths/index.js";import he from"date-fns/addYears/index.js";var Pe=(o,t)=>{switch(t){case"year":return he(o,1).toISOString();case"month":return ce(o,1).toISOString();case"day":return K(o,2).toISOString()}return K(o,-1).toISOString()},T=Pe;import Se from"lodash/map.js";var me=({config:o,data:t,pathVariables:r,pageId:i})=>{var m,E;let{NOTION:n}=o,s={};if(!(t!=null&&t.properties))return s;let{properties:a}=t,l="";if(r){let{meta:p,routeType:u}=r;l=u===((m=n==null?void 0:n.PODCASTS)==null?void 0:m.routeType)&&p.length>1?(E=n==null?void 0:n.EPISODES)==null?void 0:E.routeType:u}let _=l?F[l.toUpperCase()]:B;return Se(_,p=>{let u,y=a[p.notion];s[p.key]=null,y&&(u=w[p.type](y,i),s[p.key]=u||null)}),s},b=me;var Ee=o=>(console.dir("@notion(_unsupported)"),o),D=Ee;var we=o=>o.checkbox||!1,z=we;var ge=o=>{let{type:t}=o;return o[t]},v=ge;var fe=o=>o.email||null,j=fe;import{stringToUUID as ke}from"@jeromefitz/utils";import Te from"github-slugger";import be from"lodash/size.js";var De="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",ve=(o,t)=>De.replace("{{FILENAME}}",encodeURIComponent(o)).replace("{{PAGE_ID}}",ke(t)),Ce=(o,t)=>{let r=new Te,i={};return be(o.files)<=0||o.files.map(n=>{var s,a;if((n==null?void 0:n.type)==="file"){let l=(s=n==null?void 0:n.file)==null?void 0:s.url.split("?")[0],_=r.slug(l);i[_]={type:n==null?void 0:n.type,url:ve(l,t)}}if((n==null?void 0:n.type)==="external"){let l=(a=n==null?void 0:n.external)==null?void 0:a.url.split("?")[0],_=r.slug(l);i[_]={type:n==null?void 0:n.type,url:l}}}),i},x=Ce;import xe from"github-slugger";import Oe from"lodash/map.js";var Ge=o=>{let t=new xe,r={};return Oe(o.multi_select,i=>{let n=i;n.slug=t.slug(n.name),r[n.id]=n}),r},q=Ge;var Ie=o=>(o==null?void 0:o.number)||null,Z=Ie;import Re from"github-slugger";var Le=o=>{let t=new Re;return o.people.map(r=>{let{avatar_url:i,id:n,name:s,person:a}=r,{email:l}=a;return{[t.slug(s)]:{avatar_url:i,email:l,id:n,name:s}}})[0]},Q=Le;var Ae=o=>(o==null?void 0:o.phone_number)||null,$=Ae;import J from"lodash/map.js";var Me=o=>o.type==="rollup"?o.rollup.type==="array"&&J(o.rollup.array,t=>w[t.type](t))[0]:J(o.relation,t=>t.id),X=Me;var Ue=o=>{var t;return o!=null&&o.rich_text?(t=o==null?void 0:o.rich_text[0])==null?void 0:t.plain_text:null},ee=Ue;import oe from"lodash/map.js";import Ne from"lodash/sortBy.js";var He=o=>{let t=o==null?void 0:o.rollup;return Ne(oe(t==null?void 0:t.array,r=>oe(r[r==null?void 0:r.type],i=>w[r==null?void 0:r.type]({type:r==null?void 0:r.type,[r==null?void 0:r.type]:[i]})))).flat()},te=He;import Ve from"github-slugger";var We=o=>{let t=new Ve,r=o.select;return r?(r.slug=t.slug(o.select.name),{[r.id]:r}):null},ne=We;var Fe=o=>{var t;return o!=null&&o.title?(t=o==null?void 0:o.title[0])==null?void 0:t.plain_text:null},re=Fe;var Be=o=>o.url||null,ie=Be;var Ye={checkbox:z,created_by:D,created_time:v,date:v,email:j,files:x,formula:D,image:x,last_edited_by:D,last_edited_time:v,multi_select:q,number:Z,people:Q,phone_number:$,relation:X,rich_text:ee,rollup:te,select:ne,title:re,url:ie},w=Ye;var ze=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:i,pathVariables:n,routeType:s})=>{var f;let{NOTION:a}=o,{meta:l}=n,_=s.toUpperCase(),[m,E]=l,p=Ke(l)===2,u=(f=a[_])==null?void 0:f.hasChild.toUpperCase(),y=await r({database_id:a[p?a[u].routeType.toUpperCase():_].database_id,filter:{and:[{...C.slug,rich_text:{equals:p?E:m}}]}}),S=(y==null?void 0:y.object)==="list"&&y.results[0];if(!S)return{info:{},content:{},items:{},images:{}};let P=le(S,"properties");P.properties=se(b({config:o,data:S,pathVariables:n,pageId:P.id}));let g=await t({block_id:P.id}),k={};return p||(k=await i({config:o,reqQuery:{podcasts:P.id,databaseType:a[u].routeType.toUpperCase()}})),{info:P,content:g,items:k,images:{}}},je=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,pathVariables:i,routeType:n,slug:s})=>{var f,O;let a=new Date().toISOString(),{NOTION:l}=o,{meta:_}=i,[m,E,p]=_,u=new Date(`${m||a.slice(0,4)}-${E||"01"}-${p||"01"}`),y=((O=(f=l[n.toUpperCase()])==null?void 0:f.infoType)==null?void 0:O.notion)??e.datePublished.notion,S=await r({database_id:l[n.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:T(u,"")}},{property:y,date:{before:T(u,"day")}},{...C.slug,rich_text:{equals:s}}]}}),P=(S==null?void 0:S.object)==="list"&&S.results[0];if(!P)return{info:{},content:{},items:{},images:{}};let g=le(P,"properties");g.properties=se(b({config:o,data:P,pathVariables:i,pageId:g.id}));let k=await t({block_id:g.id});return{info:g,content:k,items:{},images:{}}},qe=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:i,pathVariables:n,routeType:s,slug:a})=>{let{NOTION:l,ROUTE_TYPES_BY_DATA_TYPES:_}=o;return l[s.toUpperCase()].hasChild?await ze({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:i,pathVariables:n,routeType:s}):_[Y.LISTING_BY_DATE].includes(s.toUpperCase())?await je({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,pathVariables:n,routeType:s,slug:a}):{info:{},content:{},items:{},images:{}}},st=qe;export{st as default};
1
+ import{sortObject as se}from"@jeromefitz/utils";import le from"lodash/omit.js";import Ke from"lodash/size.js";import h from"lodash/filter.js";import ae from"lodash/map.js";var d=({key:o,notion:t,type:r})=>({key:o,notion:t,type:r}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},P=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],I=[...P],R=[...P,e.author,e.status,e.subtitle],L=[...P,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],A=[...P,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],M=[...P],U=[...P,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],N=[...P,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],H=[...P],V=[...P,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],W=[...P,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],$e={BLOG:h(I,{init:!0}),BOOKS:h(R,{init:!0}),EPISODES:h(L,{init:!0}),EVENTS:h(A,{init:!0}),PAGES:h(M,{init:!0}),PEOPLE:h(U,{init:!0}),PODCASTS:h(N,{init:!0}),SEO:h(H,{init:!0}),SHOWS:h(V,{init:!0}),VENUES:h(W,{init:!0})},F={BLOG:I.map(o=>d(o)),BOOKS:R.map(o=>d(o)),EPISODES:L.map(o=>d(o)),EVENTS:A.map(o=>d(o)),PAGES:M.map(o=>d(o)),PEOPLE:U.map(o=>d(o)),PODCASTS:N.map(o=>d(o)),SEO:H.map(o=>d(o)),SHOWS:V.map(o=>d(o)),VENUES:W.map(o=>d(o))},B=ae(e,o=>d(o)),G=new Date().toISOString(),x={dateBefore:{property:e.datePublished.notion,date:{before:G}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:G}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},_e="LISTING",pe="LISTING_BY_DATE",ue="SLUG",de="SLUG_BY_ROUTE",ce=[_e,pe,ue,de],Y=Object.assign({},...ce.map(o=>({[o]:o})).flat(1));import K from"date-fns/addDays/index.js";import ye from"date-fns/addMonths/index.js";import he from"date-fns/addYears/index.js";var Pe=(o,t)=>{switch(t){case"year":return he(o,1).toISOString();case"month":return ye(o,1).toISOString();case"day":return K(o,2).toISOString()}return K(o,-1).toISOString()},b=Pe;import Se from"lodash/map.js";var me=({config:o,data:t,pathVariables:r,pageId:s})=>{var c,E;let{NOTION:n}=o,i={};if(!(t!=null&&t.properties))return i;let{properties:a}=t,l="";if(r){let{meta:p,routeType:u}=r;l=u===((c=n==null?void 0:n.PODCASTS)==null?void 0:c.routeType)&&p.length>1?(E=n==null?void 0:n.EPISODES)==null?void 0:E.routeType:u}let _=l?F[l.toUpperCase()]:B;return Se(_,p=>{let u,y=a[p.notion];i[p.key]=null,y&&(u=w[p.type](y,s),i[p.key]=u||null)}),i},D=me;var Ee=o=>(console.dir("@notion(_unsupported)"),o),v=Ee;var we=o=>o.checkbox||!1,z=we;var ge=o=>{let{type:t}=o;return o[t]},C=ge;var fe=o=>o.email||null,j=fe;import{stringToUUID as ke}from"@jeromefitz/utils";import Te from"github-slugger";import be from"lodash/size.js";var De="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",ve=(o,t)=>De.replace("{{FILENAME}}",encodeURIComponent(o)).replace("{{PAGE_ID}}",ke(t)),Ce=(o,t)=>{let r=new Te,s={};return be(o.files)<=0||o.files.map(n=>{var i,a;if((n==null?void 0:n.type)==="file"){let l=(i=n==null?void 0:n.file)==null?void 0:i.url.split("?")[0],_=r.slug(l);s[_]={type:n==null?void 0:n.type,url:ve(l,t)}}if((n==null?void 0:n.type)==="external"){let l=(a=n==null?void 0:n.external)==null?void 0:a.url.split("?")[0],_=r.slug(l);s[_]={type:n==null?void 0:n.type,url:l}}}),s},O=Ce;import xe from"github-slugger";import Oe from"lodash/map.js";var Ge=o=>{let t=new xe,r={};return Oe(o.multi_select,s=>{let n=s;n.slug=t.slug(n.name),r[n.id]=n}),r},q=Ge;var Ie=o=>(o==null?void 0:o.number)||null,Z=Ie;import Re from"github-slugger";var Le=o=>{let t=new Re;return o.people.map(r=>{let{avatar_url:s,id:n,name:i,person:a}=r,{email:l}=a;return{[t.slug(i)]:{avatar_url:s,email:l,id:n,name:i}}})[0]},Q=Le;var Ae=o=>(o==null?void 0:o.phone_number)||null,$=Ae;import J from"lodash/map.js";var Me=o=>o.type==="rollup"?o.rollup.type==="array"&&J(o.rollup.array,t=>w[t.type](t))[0]:J(o.relation,t=>t.id),X=Me;var Ue=o=>{var t;return o!=null&&o.rich_text?(t=o==null?void 0:o.rich_text[0])==null?void 0:t.plain_text:null},ee=Ue;import oe from"lodash/map.js";import Ne from"lodash/sortBy.js";var He=o=>{let t=o==null?void 0:o.rollup;return Ne(oe(t==null?void 0:t.array,r=>oe(r[r==null?void 0:r.type],s=>w[r==null?void 0:r.type]({type:r==null?void 0:r.type,[r==null?void 0:r.type]:[s]})))).flat()},te=He;import Ve from"github-slugger";var We=o=>{let t=new Ve,r=o.select;return r?(r.slug=t.slug(o.select.name),{[r.id]:r}):null},ne=We;var Fe=o=>{var t;return o!=null&&o.title?(t=o==null?void 0:o.title[0])==null?void 0:t.plain_text:null},re=Fe;var Be=o=>o.url||null,ie=Be;var Ye={checkbox:z,created_by:v,created_time:C,date:C,email:j,files:O,formula:v,image:O,last_edited_by:v,last_edited_time:C,multi_select:q,number:Z,people:Q,phone_number:$,relation:X,rich_text:ee,rollup:te,select:ne,title:re,url:ie},w=Ye;var ze=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:s,pathVariables:n,routeType:i})=>{var f,k;let{NOTION:a}=o,{meta:l}=n,_=i.toUpperCase(),[c,E]=l,p=Ke(l)===2,u=(k=(f=a[_])==null?void 0:f.hasChild)==null?void 0:k.toUpperCase(),y=await r({database_id:a[p?a[u].routeType.toUpperCase():_].database_id,filter:{and:[{...x.slug,rich_text:{equals:p?E:c}}]}}),m=(y==null?void 0:y.object)==="list"&&y.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let S=le(m,"properties");S.properties=se(D({config:o,data:m,pathVariables:n,pageId:S.id}));let g=await t({block_id:S.id}),T={};return p||(T=await s({config:o,reqQuery:{podcasts:S.id,databaseType:a[u].routeType.toUpperCase()}})),{info:S,content:g,items:T,images:{}}},je=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,pathVariables:s,routeType:n,slug:i})=>{var f,k;let a=new Date().toISOString(),{NOTION:l}=o,{meta:_}=s,[c,E,p]=_,u=new Date(`${c||a.slice(0,4)}-${E||"01"}-${p||"01"}`),y=((k=(f=l[n.toUpperCase()])==null?void 0:f.infoType)==null?void 0:k.notion)??e.datePublished.notion,m=await r({database_id:l[n.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:b(u,"")}},{property:y,date:{before:b(u,"day")}},{...x.slug,rich_text:{equals:i}}]}}),S=(m==null?void 0:m.object)==="list"&&m.results[0];if(!S)return{info:{},content:{},items:{},images:{}};let g=le(S,"properties");g.properties=se(D({config:o,data:S,pathVariables:s,pageId:g.id}));let T=await t({block_id:g.id});return{info:g,content:T,items:{},images:{}}},qe=async({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:s,pathVariables:n,routeType:i,slug:a})=>{var c;let{NOTION:l,ROUTE_TYPES_BY_DATA_TYPES:_}=o;return(c=l[i==null?void 0:i.toUpperCase()])!=null&&c.hasChild?await ze({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,getQuery:s,pathVariables:n,routeType:i}):_[Y.LISTING_BY_DATE].includes(i.toUpperCase())?await je({config:o,getBlocksByIdChildren:t,getDatabasesByIdQuery:r,pathVariables:n,routeType:i,slug:a}):{info:{},content:{},items:{},images:{}}},st=qe;export{st as default};
package/queries/index.js CHANGED
@@ -1 +1 @@
1
- import{avoidRateLimit as fe,isUndefined as we}from"@jeromefitz/utils";var ge=async({getBlocksChildrenList:t,block_id:r})=>we(r)?[]:(await fe(0),await t({block_id:r})),Te=ge;import g from"lodash/filter.js";import ke from"lodash/map.js";var w=({key:t,notion:r,type:n})=>({key:t,notion:r,type:n}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},T=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],M=[...T],B=[...T,e.author,e.status,e.subtitle],H=[...T,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],V=[...T,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],W=[...T],F=[...T,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],z=[...T,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],Y=[...T],j=[...T,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],$=[...T,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],ro={BLOG:g(M,{init:!0}),BOOKS:g(B,{init:!0}),EPISODES:g(H,{init:!0}),EVENTS:g(V,{init:!0}),PAGES:g(W,{init:!0}),PEOPLE:g(F,{init:!0}),PODCASTS:g(z,{init:!0}),SEO:g(Y,{init:!0}),SHOWS:g(j,{init:!0}),VENUES:g($,{init:!0})},K={BLOG:M.map(t=>w(t)),BOOKS:B.map(t=>w(t)),EPISODES:H.map(t=>w(t)),EVENTS:V.map(t=>w(t)),PAGES:W.map(t=>w(t)),PEOPLE:F.map(t=>w(t)),PODCASTS:z.map(t=>w(t)),SEO:Y.map(t=>w(t)),SHOWS:j.map(t=>w(t)),VENUES:$.map(t=>w(t))},Q=ke(e,t=>w(t)),U=new Date().toISOString(),D={dateBefore:{property:e.datePublished.notion,date:{before:U}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:U}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},be="LISTING",De="LISTING_BY_DATE",Ie="SLUG",Ce="SLUG_BY_ROUTE",Oe=[be,De,Ie,Ce],b=Object.assign({},...Oe.map(t=>({[t]:t})).flat(1));var C={sorts:[{property:e.slug.notion,direction:"ascending"}]},ve=async({database_id:t,filter:r=C==null?void 0:C.filter,getDatabasesQuery:n,sorts:l=C==null?void 0:C.sorts})=>t?await n({database_id:t,sorts:l,filter:r}):[],xe=ve;var q=async({getBlocksChildrenList:t,blocks:r})=>{if(r==null)return r;let n=r.filter(o=>o.has_children).map(o=>{let{id:i}=o;return{promise:t({block_id:i,page_size:100}),parent_block:o}}),l=await Promise.all(n.map(o=>o.promise));for(let o=0;o<l.length;o++){let i=l[o].results;if(await q({blocks:i,getBlocksChildrenList:t}),n[o]){let p=n[o].parent_block;p[p.type].children=i}}return r},Re=q;var Ge=({config:t,item:r,routeType:n,meta:l})=>{var _,y;let{NOTION:o}=t,i="",p=(_=r.properties)==null?void 0:_.slug,s="",c="/[...catchAll]";switch(n){case o.BLOG.routeType:case o.EVENTS.routeType:i=(y=r.properties[o[n.toUpperCase()].infoType.key])==null?void 0:y.start.slice(0,10);let[a,u,d]=i==null?void 0:i.split("-");s=`/${n}/${a}/${u}/${d}/${p}`;break;case o.PODCASTS.routeType:case o.EPISODES.routeType:s=`/${l==null?void 0:l.join("/")}/${p}`;break;default:s=`/${n}/${p}`;break}return s=s.replace("//","/"),{as:s,date:i,href:c,slug:p}},Le=Ge;import{sortObject as ce}from"@jeromefitz/utils";import St from"lodash/map.js";import A from"lodash/omit.js";import Z from"date-fns/addDays/index.js";import Ne from"date-fns/addMonths/index.js";import Ae from"date-fns/addYears/index.js";var Ue=(t,r)=>{switch(r){case"year":return Ae(t,1).toISOString();case"month":return Ne(t,1).toISOString();case"day":return Z(t,2).toISOString()}return Z(t,-1).toISOString()},f=Ue;import Me from"lodash/map.js";var Be=({config:t,data:r,pathVariables:n,pageId:l})=>{var _,y;let{NOTION:o}=t,i={};if(!(r!=null&&r.properties))return i;let{properties:p}=r,s="";if(n){let{meta:a,routeType:u}=n;s=u===((_=o==null?void 0:o.PODCASTS)==null?void 0:_.routeType)&&a.length>1?(y=o==null?void 0:o.EPISODES)==null?void 0:y.routeType:u}let c=s?K[s.toUpperCase()]:Q;return Me(c,a=>{let u,d=p[a.notion];i[a.key]=null,d&&(u=I[a.type](d,l),i[a.key]=u||null)}),i},E=Be;import{sortObject as He}from"@jeromefitz/utils";import Ve from"lodash/map.js";import We from"lodash/omit.js";var Fe=({config:t,results:r,routeType:n})=>{let l=[];return Ve(r,o=>{let i=We(o,"properties");i.properties=He(E({config:t,data:o,pathVariables:n,pageId:o==null?void 0:o.id})),l.push(i)}),l},J=Fe;var ze=({isPage:t,isIndex:r,hasMeta:n})=>t?b.SLUG:r&&!n?b.LISTING:r&&n?b.LISTING_BY_DATE:n?b.SLUG_BY_ROUTE:b.SLUG,L=ze;var Ye=t=>(console.dir("@notion(_unsupported)"),t),x=Ye;var je=t=>t.checkbox||!1,X=je;var $e=t=>{let{type:r}=t;return t[r]},R=$e;var Ke=t=>t.email||null,ee=Ke;import{stringToUUID as Qe}from"@jeromefitz/utils";import qe from"github-slugger";import Ze from"lodash/size.js";var Je="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",Xe=(t,r)=>Je.replace("{{FILENAME}}",encodeURIComponent(t)).replace("{{PAGE_ID}}",Qe(r)),et=(t,r)=>{let n=new qe,l={};return Ze(t.files)<=0||t.files.map(o=>{var i,p;if((o==null?void 0:o.type)==="file"){let s=(i=o==null?void 0:o.file)==null?void 0:i.url.split("?")[0],c=n.slug(s);l[c]={type:o==null?void 0:o.type,url:Xe(s,r)}}if((o==null?void 0:o.type)==="external"){let s=(p=o==null?void 0:o.external)==null?void 0:p.url.split("?")[0],c=n.slug(s);l[c]={type:o==null?void 0:o.type,url:s}}}),l},N=et;import tt from"github-slugger";import ot from"lodash/map.js";var rt=t=>{let r=new tt,n={};return ot(t.multi_select,l=>{let o=l;o.slug=r.slug(o.name),n[o.id]=o}),n},te=rt;var nt=t=>(t==null?void 0:t.number)||null,oe=nt;import it from"github-slugger";var st=t=>{let r=new it;return t.people.map(n=>{let{avatar_url:l,id:o,name:i,person:p}=n,{email:s}=p;return{[r.slug(i)]:{avatar_url:l,email:s,id:o,name:i}}})[0]},re=st;var at=t=>(t==null?void 0:t.phone_number)||null,ne=at;import ie from"lodash/map.js";var lt=t=>t.type==="rollup"?t.rollup.type==="array"&&ie(t.rollup.array,r=>I[r.type](r))[0]:ie(t.relation,r=>r.id),se=lt;var pt=t=>{var r;return t!=null&&t.rich_text?(r=t==null?void 0:t.rich_text[0])==null?void 0:r.plain_text:null},ae=pt;import le from"lodash/map.js";import _t from"lodash/sortBy.js";var ut=t=>{let r=t==null?void 0:t.rollup;return _t(le(r==null?void 0:r.array,n=>le(n[n==null?void 0:n.type],l=>I[n==null?void 0:n.type]({type:n==null?void 0:n.type,[n==null?void 0:n.type]:[l]})))).flat()},pe=ut;import dt from"github-slugger";var ct=t=>{let r=new dt,n=t.select;return n?(n.slug=r.slug(t.select.name),{[n.id]:n}):null},_e=ct;var yt=t=>{var r;return t!=null&&t.title?(r=t==null?void 0:t.title[0])==null?void 0:r.plain_text:null},ue=yt;var mt=t=>t.url||null,de=mt;var ht={checkbox:X,created_by:x,created_time:R,date:R,email:ee,files:N,formula:x,image:N,last_edited_by:x,last_edited_time:R,multi_select:te,number:oe,people:re,phone_number:ne,relation:se,rich_text:ae,rollup:pe,select:_e,title:ue,url:de},I=ht;var Pt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:o,routeType:i})=>{let{NOTION:p}=t,s={},c=p[i.toUpperCase()].page_id__seo,_=await l({page_id:c});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=A(_,"properties"),s.properties=ce(E({config:t,data:_,pathVariables:o,pageId:s.id})));let y=p[i.toUpperCase()].infoType.notion??e.datePublished.notion,a=y===e.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await r({block_id:s.id}),d=await n({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:a}}]}}),h=[];St(d.results,S=>{let P=S;P=A(P,"properties"),P.properties=ce(E({config:t,data:S,pathVariables:o,pageId:S.id})),h.push(P)});let m=A(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},Et=Pt;import{sortObject as ye}from"@jeromefitz/utils";import ft from"lodash/map.js";import G from"lodash/omit.js";import wt from"lodash/size.js";var gt=({config:t,pathVariables:r,routeType:n,slug:l})=>{var d,h;let{NOTION:o}=t,{meta:i}=r,[p,s,c]=i,_=wt(i),y=new Date().toISOString(),a=new Date(`${p||y.slice(0,4)}-${s||"01"}-${c||"01"}`),u=((h=(d=o[n.toUpperCase()])==null?void 0:d.infoType)==null?void 0:h.notion)??e.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"day")}},{...D.slug,rich_text:{equals:l}}]}}},Tt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:o,routeType:i,slug:p})=>{let{NOTION:s}=t,c={},_={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(_=G(a,"properties"),_.properties=ye(E({config:t,data:a,pathVariables:o,pageId:a.id}))),c=await r({block_id:_.id});let u=[{property:e.datePublished.notion,direction:"descending"}],d=gt({config:t,pathVariables:o,routeType:i,slug:p}),h=s[i.toUpperCase()].database_id,m=await n({database_id:h,filter:d,sorts:u}),S=[];ft(m.results,O=>{let v=G(O,"properties");v.properties=ye(E({config:t,data:O,pathVariables:o,pageId:v.id})),v&&S.push(v)});let P=G(m,"results");P.results=S;let k=G(P,"data");return{info:_,content:c,items:k,images:{}}},kt=Tt;import{sortObject as bt}from"@jeromefitz/utils";import Dt from"lodash/omit.js";var It=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getDeepFetchAllChildren:l,pathVariables:o,routeType:i,slug:p})=>{let{NOTION:s}=t,c=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(c))return{info:{},content:{},items:{},images:{}};let y=await n({database_id:s[c].database_id,filter:{and:[{...D.slug,rich_text:{equals:p}}]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Dt(a,"properties");u.properties=bt(E({config:t,data:a,pathVariables:o,pageId:u.id}));let d=await r({block_id:u.id}),m=[...await l({blocks:d.results})];return{info:u,content:m,items:{},images:{}}},Ct=It;import{sortObject as me}from"@jeromefitz/utils";import he from"lodash/omit.js";import Ot from"lodash/size.js";var vt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i})=>{var k;let{NOTION:p}=t,{meta:s}=o,c=i.toUpperCase(),[_,y]=s,a=Ot(s)===2,u=(k=p[c])==null?void 0:k.hasChild.toUpperCase(),d=await n({database_id:p[a?p[u].routeType.toUpperCase():c].database_id,filter:{and:[{...D.slug,rich_text:{equals:a?y:_}}]}}),h=(d==null?void 0:d.object)==="list"&&d.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let m=he(h,"properties");m.properties=me(E({config:t,data:h,pathVariables:o,pageId:m.id}));let S=await r({block_id:m.id}),P={};return a||(P=await l({config:t,reqQuery:{podcasts:m.id,databaseType:p[u].routeType.toUpperCase()}})),{info:m,content:S,items:P,images:{}}},xt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,pathVariables:l,routeType:o,slug:i})=>{var k,O;let p=new Date().toISOString(),{NOTION:s}=t,{meta:c}=l,[_,y,a]=c,u=new Date(`${_||p.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((O=(k=s[o.toUpperCase()])==null?void 0:k.infoType)==null?void 0:O.notion)??e.datePublished.notion,h=await n({database_id:s[o.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:f(u,"")}},{property:d,date:{before:f(u,"day")}},{...D.slug,rich_text:{equals:i}}]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let S=he(m,"properties");S.properties=me(E({config:t,data:m,pathVariables:l,pageId:S.id}));let P=await r({block_id:S.id});return{info:S,content:P,items:{},images:{}}},Rt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=t;return s[i.toUpperCase()].hasChild?await vt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i}):c[b.LISTING_BY_DATE].includes(i.toUpperCase())?await xt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,pathVariables:o,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},Gt=Rt;import{avoidRateLimit as Lt,isUndefined as Nt}from"@jeromefitz/utils";var At=async({getPagesRetrieve:t,page_id:r})=>Nt(r)?[]:(await Lt(0),await t({page_id:r})),Ut=At;import Se from"lodash/drop.js";import Mt from"lodash/dropRight.js";import Bt from"lodash/first.js";import Pe from"lodash/includes.js";import Ht from"lodash/isInteger.js";import Vt from"lodash/join.js";import Wt from"lodash/last.js";import Ee from"lodash/size.js";var Ft=({config:t,catchAll:r})=>{let{NOTION:n,PAGES__HOMEPAGE:l,ROUTE_META:o,ROUTE_TYPES:i}=t,p=Ee(r),s=Bt(r),c=s.toUpperCase(),_=Wt(r),y=p>1&&Pe(o,c)?Se(r):Se(Mt(r)),a=s===_&&!Pe(i,c)?n.PAGES.routeType:s,u=s!==_&&!Ht(parseInt(_))?_:s,d=a===n.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&Ee(y)!==0,S=d&&s===l?"":Vt(r,"/"),P={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:S},k=L(P);return{...P,dataType:k}},zt=Ft;import{avoidRateLimit as Yt,isObjectEmpty as jt}from"@jeromefitz/utils";import $t from"lodash/map.js";import Kt from"lodash/omit.js";import Qt from"lodash/size.js";var qt=[{property:e.slug.notion,direction:"ascending"}],Zt=async({config:t,reqQuery:r,notionDatabasesQuery:n})=>{let{NOTION:l}=t,{databaseType:o}=r,i=o,p=!1,s=o.toUpperCase(),c=l[s].database_id;if(!c)return[];let _={},y={},a,u;if(o==="EPISODES"){u=qt;let{podcasts:d}=r,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),Qt(m)>0&&$t(m,S=>h.push({property:e.relationEpisodes__Podcasts.notion,relation:{contains:S}})),a={or:[...h]}}else p=!0;if(!p&&(!_||jt(_))){await Yt(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:e.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await n({database_id:c,filter:a,sorts:u}),_=d,y=J({config:t,results:d.results,routeType:i}),_=Kt(_,"results"),_.results=y):p=!0}return _},Jt=Zt;export{Te as getBlocksByIdChildren,xe as getDatabasesByIdQuery,Re as getDeepFetchAllChildren,Le as getInfoType,Et as getNotionListing,kt as getNotionListingByDate,Ct as getNotionSlug,Gt as getNotionSlugByRoute,Ut as getPagesById,zt as getPathVariables,Jt as getQuery};
1
+ import{avoidRateLimit as fe,isUndefined as we}from"@jeromefitz/utils";var ge=async({getBlocksChildrenList:t,block_id:r})=>we(r)?[]:(await fe(0),await t({block_id:r})),ke=ge;import g from"lodash/filter.js";import Te from"lodash/map.js";var w=({key:t,notion:r,type:n})=>({key:t,notion:r,type:n}),e={addressCity:{init:!0,key:"addressCity",notion:"Address.City",type:"rich_text"},addressLatitude:{init:!0,key:"addressLatitude",notion:"Address.Latitude",type:"number",format:"number"},addressLongitude:{init:!0,key:"addressLongitude",notion:"Address.Longitude",type:"number",format:"number"},addressNeighborhood:{init:!0,key:"addressNeighborhood",notion:"Address.Neighborhood",type:"rich_text"},addressState:{init:!0,key:"addressState",notion:"Address.State",type:"select"},addressStreet:{init:!0,key:"addressStreet",notion:"Address.Street",type:"rich_text"},addressZipCode:{init:!0,key:"addressZipCode",notion:"Address.ZipCode",type:"number",format:"number"},author:{init:!0,key:"author",notion:"Author",type:"rich_text"},authors:{init:!0,key:"authors",notion:"Authors",type:"people"},categories:{init:!0,key:"categories",notion:"Categories",type:"multi_select"},dateCreated:{init:!1,key:"dateCreated",notion:"Date.Created",type:"created_time"},dateEdited:{init:!1,key:"dateEdited",notion:"Date.Edited",type:"last_edited_time"},dateEvent:{init:!0,key:"dateEvent",notion:"Date.Event",type:"date"},datePublished:{init:!0,key:"datePublished",notion:"Date.Published",type:"date"},dateRecorded:{init:!0,key:"dateRecorded",notion:"Date.Recorded",type:"date"},duration:{init:!0,key:"duration",notion:"Duration",type:"rich_text"},email:{init:!0,key:"email",notion:"Email",type:"rich_text"},episode:{init:!0,key:"episode",notion:"Episode",type:"number",format:"number"},explicit:{init:!0,key:"explicit",notion:"Explicit",type:"checkbox"},festivals:{init:!0,key:"festivals",notion:"Festival",type:"multi_select"},food:{init:!0,key:"food",notion:"Food",type:"rich_text"},isIndexed:{init:!0,key:"isIndexed",notion:"Is.Indexed",type:"checkbox"},isPublished:{init:!0,key:"isPublished",notion:"Is.Published",type:"checkbox"},mp3:{init:!0,key:"mp3",notion:"MP3",type:"files"},name:{init:!0,key:"name",notion:"Name",type:"rich_text"},nameFirst:{init:!0,key:"nameFirst",notion:"Name.First",type:"rich_text"},nameLast:{init:!0,key:"nameLast",notion:"Name.Last",type:"rich_text"},namePreferred:{init:!0,key:"namePreferred",notion:"Name.Preferred",type:"rich_text"},phoneNumber:{init:!0,key:"phoneNumber",notion:"Phone",type:"rich_text"},podcastAuthor:{init:!0,key:"podcastAuthor",notion:"Author",type:"rich_text"},podcastAuthorEmail:{init:!0,key:"podcastAuthorEmail",notion:"Author.Email",type:"rich_text"},relationEpisodes__Podcasts:{init:!0,key:"relationEpisodes__Podcasts",notion:"Podcasts",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Episodes"}},relationPodcasts__Episodes:{init:!1,key:"relationPodcasts__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Podcasts"}},rollupEpisodes__Podcasts:{init:!1,key:"rollupEpisodes__Podcasts",notion:"Podcasts.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Title",function:"show_original"}},rollupEpisodes__PodcastsSlugs:{init:!1,key:"rollupEpisodes__PodcastsSlugs",notion:"Podcasts.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Podcasts",rollup_property_id:"Slug",function:"show_original"}},rollupPodcasts__Episodes:{init:!1,key:"rollupPodcasts__Episodes",notion:"Episodes.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Title",function:"show_original"}},rollupPodcasts__EpisodesSlugs:{init:!1,key:"rollupPodcasts__EpisodesSlugs",notion:"Episodes.Slug.Rollup",type:"rollup",rollup:{relation_property_name:"Episodes",rollup_property_id:"Slug",function:"show_original"}},relationEpisodes__People_Guest:{init:!0,key:"relationEpisodes__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Guest"}},relationPeople__Episodes_Guest:{init:!1,key:"relationPeople__Episodes_Guest",notion:"Episodes.Guest",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Guest"}},relationEpisodes__People_Sound_Engineer:{init:!0,key:"relationEpisodes__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Sound.Engineer"}},relationPeople__Episodes_Sound_Engineer:{init:!1,key:"relationPeople__Episodes_Sound_Engineer",notion:"Episodes.Sound.Engineer",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Sound.Engineer"}},relationEpisodes__People_Thanks:{init:!0,key:"relationEpisodes__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Episodes.Thanks"}},relationPeople__Episodes_Thanks:{init:!1,key:"relationPeople__Episodes_Thanks",notion:"Episodes.Thanks",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Thanks"}},relationEpisodes__Venues:{init:!0,key:"relationEpisodes__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Episodes"}},relationVenues__Episodes:{init:!1,key:"relationVenues__Episodes",notion:"Episodes",type:"relation",relation:{database_id:"Episodes",synced_property_name:"Venues"}},relationEvents__Venues:{init:!0,key:"relationEvents__Venues",notion:"Venues",type:"relation",relation:{database_id:"Venues",synced_property_name:"Events"}},relationVenues__Events:{init:!1,key:"relationVenues__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Venues"}},relationEvents__Shows:{init:!0,key:"relationEvents__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events"}},relationShows__Events:{init:!1,key:"relationShows__Events",notion:"Events",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows"}},relationEvents__Shows_Lineup:{init:!0,key:"relationEvents__Shows_Lineup",notion:"Shows.Lineup",type:"relation",relation:{database_id:"Shows",synced_property_name:"Events.Lineup"}},relationShows__Events_Lineup:{init:!1,key:"relationShows__Events_Lineup",notion:"Events.Lineup",type:"relation",relation:{database_id:"Events",synced_property_name:"Shows.Lineup"}},relationShows__People_Cast:{init:!0,key:"relationShows__People_Cast",notion:"Cast",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast"}},relationPeople__Shows_Cast:{init:!1,key:"relationPeople__Shows_Cast",notion:"Shows.Cast",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast"}},relationShows__People_Cast_Past:{init:!0,key:"relationShows__People_Cast_Past",notion:"Cast.Past",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Cast.Past"}},relationPeople__Shows_Cast_Past:{init:!1,key:"relationPeople__Shows_Cast_Past",notion:"Shows.Cast.Past",type:"relation",relation:{database_id:"Shows",synced_property_name:"Cast.Past"}},relationShows_People_Crew:{init:!0,key:"relationShows_People_Crew",notion:"Crew",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Crew"}},relationPeople__Shows_Crew:{init:!0,key:"relationPeople__Shows_Crew",notion:"Shows.Crew",type:"relation",relation:{database_id:"Shows",synced_property_name:"Crew"}},relationShows__People_Director:{init:!0,key:"relationShows__People_Director",notion:"Director",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director"}},relationPeople__Shows_Director:{init:!1,key:"relationPeople__Shows_Director",notion:"Shows.Director",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director"}},relationShows__People_Director_Musical:{init:!0,key:"relationShows__People_Director_Musical",notion:"Director.Musical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Musical"}},relationPeople__Shows_Director_Musical:{init:!1,key:"relationPeople__Shows_Director_Musical",notion:"Shows.Director.Musical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Musical"}},relationShows__People_Director_Technical:{init:!0,key:"relationShows__People_Director_Technical",notion:"Director.Technical",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Director.Technical"}},relationPeople__Shows_Director_Technical:{init:!1,key:"relationPeople__Shows_Director_Technical",notion:"Shows.Director.Technical",type:"relation",relation:{database_id:"Shows",synced_property_name:"Director.Technical"}},relationEvents__People_Guest:{init:!0,key:"relationEvents__People_Guest",notion:"Guest",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest"}},relationPeople__Events_Guest:{init:!1,key:"relationEvents__People_Guest",notion:"Events.Guest",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest"}},relationPodcasts__People_Host:{init:!0,key:"relationPodcasts__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Podcasts.Host"}},relationPeople__Podcasts_Host:{init:!1,key:"relationPeople__Podcasts_Host",notion:"Podcasts.Host",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Host"}},relationEvents__People_Host:{init:!0,key:"relationEvents__People_Host",notion:"Host",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Host"}},relationPeople__Events_Host:{init:!1,key:"relationPeople__Events_Host",notion:"Events.Host",type:"relation",relation:{database_id:"Events",synced_property_name:"Host"}},relationShows__People_Producer:{init:!0,key:"relationShows__People_Producer",notion:"Producer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Producer"}},relationPeople__Shows_Producer:{init:!1,key:"relationPeople__Shows_Producer",notion:"Shows.Producer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Producer"}},relationEvents__People_Guest_Music:{init:!0,key:"relationEvents__People_Guest_Music",notion:"Guest.Music",type:"relation",relation:{database_id:"People",synced_property_name:"Events.Guest.Music"}},relationPeople__Events_Guest_Music:{init:!1,key:"relationPeople__Events_Guest_Music",notion:"Events.Guest.Music",type:"relation",relation:{database_id:"Events",synced_property_name:"Guest.Music"}},relationPodcasts__People_Sound_Engineer:{init:!0,key:"relationPodcasts__People_Sound_Engineer",notion:"Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Podcasts.Sound.Engineer"}},relationPeople__Podcasts_Sound_Engineer:{init:!1,key:"relationPeople__Podcasts_Sound_Engineer",notion:"Podcasts.Sound.Engineer",type:"relation",relation:{database_id:"Podcasts",synced_property_name:"Sound.Engineer"}},relationShows__People_Thanks:{init:!0,key:"relationShows__People_Thanks",notion:"Thanks",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Thanks"}},relationPeople__Shows_Thanks:{init:!1,key:"relationPeople__Shows_Thanks",notion:"Shows.Thanks",type:"relation",relation:{database_id:"Shows",synced_property_name:"Thanks"}},relationShows__People_Writer:{init:!0,key:"relationShows__People_Writer",notion:"Writer",type:"relation",relation:{database_id:"People",synced_property_name:"Shows.Writer"}},relationPeople__Shows_Writer:{init:!1,key:"relationPeople__Shows_Writer",notion:"Shows.Writer",type:"relation",relation:{database_id:"Shows",synced_property_name:"Writer"}},relationShows__Tags:{init:!0,key:"relationShows__Tags",notion:"Tags",type:"relation",relation:{database_id:"Tags",synced_property_name:"Shows"}},relationTags__Shows:{init:!1,key:"relationTags__Shows",notion:"Shows",type:"relation",relation:{database_id:"Shows",synced_property_name:"Tags"}},rollupShows__Tags:{init:!1,key:"rollupShows__Tags",notion:"Tags.Rollup",type:"rollup",rollup:{relation_property_name:"Tags",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast:{init:!1,key:"rollupShows__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Cast_Slug:{init:!1,key:"rollupShows__People_Cast_Slug",notion:"Cast.Rollup.Slug",type:"rollup",rollup:{relation_property_name:"Cast",rollup_property_name:"Slug",function:"show_original"}},rollupShows__People_Cast_Past:{init:!1,key:"rollupShows__People_Cast_Past",notion:"Cast.Past.Rollup",type:"rollup",rollup:{relation_property_name:"Cast.Past",rollup_property_id:"Title",function:"show_original"}},rollupShows__People_Crew:{init:!1,key:"rollupShows__People_Crew",notion:"Crew.Rollup",type:"rollup",rollup:{relation_property_name:"Crew",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director:{init:!1,key:"rollupShows__People_Director",notion:"Director.Rollup",type:"rollup",rollup:{relation_property_name:"Director",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Musical:{init:!1,key:"rollupShows__People_Director_Musical",notion:"Director.Musical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Musical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Director_Technical:{init:!1,key:"rollupShows__People_Director_Technical",notion:"Director.Technical.Rollup",type:"rollup",rollup:{relation_property_name:"Director.Technical",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Music:{init:!1,key:"rollupShows__People_Music",notion:"Music.Rollup",type:"rollup",rollup:{relation_property_name:"Music",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Producer:{init:!1,key:"rollupShows__People_Producer",notion:"Producer.Rollup",type:"rollup",rollup:{relation_property_name:"Producer",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Thanks:{init:!1,key:"rollupShows__People_Thanks",notion:"Thanks.Rollup",type:"rollup",rollup:{relation_property_name:"Thanks",rollup_property_name:"Title",function:"show_original"}},rollupShows__People_Writer:{init:!1,key:"rollupShows__People_Writer",notion:"Writer.Rollup",type:"rollup",rollup:{relation_property_name:"Writer",rollup_property_name:"Title",function:"show_original"}},rollupEvents__People_Cast:{init:!1,key:"rollupEvents__People_Cast",notion:"Cast.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Cast",function:"show_original"}},rollupEvents__People_Guest:{init:!1,key:"rollupEvents__People_Guest",notion:"Guest.Rollup",type:"rollup",rollup:{relation_property_name:"Guest",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Guest_Music:{init:!1,key:"rollupEvents__People_Guest_Music",notion:"Guest.Music.Rollup",type:"rollup",rollup:{relation_property_name:"Guest.Music",rollup_property_id:"Title",function:"show_original"}},rollupEvents__People_Host:{init:!1,key:"rollupEvents__People_Host",notion:"Host.Rollup",type:"rollup",rollup:{relation_property_name:"Host",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows:{init:!1,key:"rollupEvents__Shows",notion:"Shows.Rollup",type:"rollup",rollup:{relation_property_name:"Shows",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Shows_Lineup:{init:!1,key:"rollupEvents__Shows_Lineup",notion:"Shows.Lineup.Rollup",type:"rollup",rollup:{relation_property_name:"Shows.Lineup",rollup_property_id:"Title",function:"show_original"}},rollupEvents__Venues:{init:!1,key:"rollupEvents__Venues",notion:"Venues.Rollup",type:"rollup",rollup:{relation_property_name:"Venues",rollup_property_id:"Title",function:"show_original"}},season:{init:!0,key:"season",notion:"Season",type:"number",format:"number"},seoDescription:{init:!0,key:"seoDescription",notion:"SEO.Description",type:"rich_text"},seoImage:{init:!0,key:"seoImage",notion:"SEO.Image",type:"files"},seoImageDescription:{init:!0,key:"seoImageDescription",notion:"SEO.Image.Description",type:"rich_text"},seoKeywords:{init:!0,key:"seoKeywords",notion:"SEO.Keywords",type:"rich_text"},slug:{init:!0,key:"slug",notion:"Slug",type:"rich_text"},socialFacebook:{init:!0,key:"socialFacebook",notion:"Social.Facebook",type:"url"},socialInstagram:{init:!0,key:"socialInstagram",notion:"Social.Instagram",type:"url"},socialTwitter:{init:!0,key:"socialTwitter",notion:"Social.Twitter",type:"url"},socialWebsite:{init:!0,key:"socialWebsite",notion:"Social.Website",type:"url"},socialSpotify:{init:!0,key:"socialSpotify",notion:"Social.Spotify",type:"url"},socialApple:{init:!0,key:"socialApple",notion:"Social.Apple",type:"url"},status:{init:!0,key:"status",notion:"Status",type:"select"},subtitle:{init:!0,key:"subtitle",notion:"Subtitle",type:"rich_text"},ticketUrl:{init:!0,key:"ticketUrl",notion:"TicketUrl",type:"url"},title:{init:!0,key:"title",notion:"Title",type:"title"},type:{init:!0,key:"type",notion:"Type",type:"select"}},k=[e.authors,e.datePublished,e.isIndexed,e.isPublished,e.slug,e.seoDescription,e.seoImage,e.seoImageDescription,e.seoKeywords,e.title],M=[...k],B=[...k,e.author,e.status,e.subtitle],H=[...k,e.dateRecorded,e.duration,e.episode,e.mp3,e.season,e.relationEpisodes__People_Guest,e.relationEpisodes__People_Sound_Engineer,e.relationEpisodes__People_Thanks,e.relationEpisodes__Podcasts,e.relationEpisodes__Venues,e.socialApple,e.socialSpotify,e.type,e.rollupEpisodes__Podcasts,e.rollupEpisodes__PodcastsSlugs],V=[...k,e.dateEvent,e.relationEvents__People_Guest_Music,e.relationEvents__People_Guest,e.relationEvents__People_Host,e.relationEvents__Shows_Lineup,e.relationEvents__Shows,e.relationEvents__Venues,e.socialFacebook,e.socialWebsite,e.ticketUrl,e.rollupEvents__People_Cast,e.rollupEvents__People_Guest_Music,e.rollupEvents__People_Guest,e.rollupEvents__People_Host,e.rollupEvents__Shows_Lineup,e.rollupEvents__Shows,e.rollupEvents__Venues],W=[...k],F=[...k,e.email,e.nameFirst,e.nameLast,e.namePreferred,e.relationPeople__Episodes_Guest,e.relationPeople__Episodes_Sound_Engineer,e.relationPeople__Episodes_Thanks,e.relationPeople__Events_Guest,e.relationPeople__Events_Guest_Music,e.relationPeople__Events_Host,e.relationPeople__Podcasts_Host,e.relationPeople__Podcasts_Sound_Engineer,e.relationPeople__Shows_Cast,e.relationPeople__Shows_Cast_Past,e.relationPeople__Shows_Director,e.relationPeople__Shows_Director_Musical,e.relationPeople__Shows_Director_Technical,e.relationPeople__Shows_Producer,e.relationPeople__Shows_Thanks,e.relationPeople__Shows_Writer],z=[...k,e.categories,e.explicit,e.podcastAuthor,e.podcastAuthorEmail,e.relationPodcasts__People_Host,e.relationPodcasts__People_Sound_Engineer,e.socialApple,e.socialSpotify,e.type,e.relationPodcasts__Episodes,e.rollupPodcasts__Episodes,e.rollupPodcasts__EpisodesSlugs],Y=[...k],j=[...k,e.relationShows__People_Cast,e.relationShows__People_Cast_Past,e.relationShows__People_Director,e.relationShows__People_Director_Musical,e.relationShows__People_Director_Technical,e.relationShows__People_Producer,e.relationShows__People_Thanks,e.relationShows__People_Writer,e.relationShows__Tags,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationShows__Events,e.relationShows__Events_Lineup,e.rollupShows__People_Cast,e.rollupShows__People_Cast_Slug,e.rollupShows__People_Cast_Past,e.rollupShows__People_Crew,e.rollupShows__People_Director,e.rollupShows__People_Director_Musical,e.rollupShows__People_Director_Technical,e.rollupShows__People_Music,e.rollupShows__People_Producer,e.rollupShows__People_Thanks,e.rollupShows__People_Writer,e.rollupShows__Tags],$=[...k,e.addressCity,e.addressLatitude,e.addressLongitude,e.addressNeighborhood,e.addressState,e.addressStreet,e.addressZipCode,e.phoneNumber,e.socialFacebook,e.socialInstagram,e.socialTwitter,e.socialWebsite,e.relationVenues__Episodes,e.relationVenues__Events],ro={BLOG:g(M,{init:!0}),BOOKS:g(B,{init:!0}),EPISODES:g(H,{init:!0}),EVENTS:g(V,{init:!0}),PAGES:g(W,{init:!0}),PEOPLE:g(F,{init:!0}),PODCASTS:g(z,{init:!0}),SEO:g(Y,{init:!0}),SHOWS:g(j,{init:!0}),VENUES:g($,{init:!0})},K={BLOG:M.map(t=>w(t)),BOOKS:B.map(t=>w(t)),EPISODES:H.map(t=>w(t)),EVENTS:V.map(t=>w(t)),PAGES:W.map(t=>w(t)),PEOPLE:F.map(t=>w(t)),PODCASTS:z.map(t=>w(t)),SEO:Y.map(t=>w(t)),SHOWS:j.map(t=>w(t)),VENUES:$.map(t=>w(t))},Q=Te(e,t=>w(t)),U=new Date().toISOString(),I={dateBefore:{property:e.datePublished.notion,date:{before:U}},dateOnOrAfter:{property:e.datePublished.notion,date:{on_or_after:U}},published:{property:e.isPublished.notion,checkbox:{equals:!1}},slug:{property:e.slug.notion,rich_text:{equals:""}}},be="LISTING",De="LISTING_BY_DATE",Ie="SLUG",Ce="SLUG_BY_ROUTE",Oe=[be,De,Ie,Ce],D=Object.assign({},...Oe.map(t=>({[t]:t})).flat(1));var O={sorts:[{property:e.slug.notion,direction:"ascending"}]},ve=async({database_id:t,filter:r=O==null?void 0:O.filter,getDatabasesQuery:n,sorts:l=O==null?void 0:O.sorts})=>t?await n({database_id:t,sorts:l,filter:r}):[],xe=ve;var q=async({getBlocksChildrenList:t,blocks:r})=>{if(r==null)return r;let n=r.filter(o=>o.has_children).map(o=>{let{id:i}=o;return{promise:t({block_id:i,page_size:100}),parent_block:o}}),l=await Promise.all(n.map(o=>o.promise));for(let o=0;o<l.length;o++){let i=l[o].results;if(await q({blocks:i,getBlocksChildrenList:t}),n[o]){let _=n[o].parent_block;_[_.type].children=i}}return r},Re=q;var Ge=({config:t,item:r,routeType:n,meta:l})=>{var p,y;let{NOTION:o}=t,i="",_=(p=r.properties)==null?void 0:p.slug,s="",c="/[...catchAll]";switch(n){case o.BLOG.routeType:case o.EVENTS.routeType:i=(y=r.properties[o[n.toUpperCase()].infoType.key])==null?void 0:y.start.slice(0,10);let[a,u,d]=i==null?void 0:i.split("-");s=`/${n}/${a}/${u}/${d}/${_}`;break;case o.PODCASTS.routeType:case o.EPISODES.routeType:s=`/${l==null?void 0:l.join("/")}/${_}`;break;default:s=`/${n}/${_}`;break}return s=s.replace("//","/"),{as:s,date:i,href:c,slug:_}},Le=Ge;import{sortObject as ce}from"@jeromefitz/utils";import St from"lodash/map.js";import A from"lodash/omit.js";import Z from"date-fns/addDays/index.js";import Ne from"date-fns/addMonths/index.js";import Ae from"date-fns/addYears/index.js";var Ue=(t,r)=>{switch(r){case"year":return Ae(t,1).toISOString();case"month":return Ne(t,1).toISOString();case"day":return Z(t,2).toISOString()}return Z(t,-1).toISOString()},f=Ue;import Me from"lodash/map.js";var Be=({config:t,data:r,pathVariables:n,pageId:l})=>{var p,y;let{NOTION:o}=t,i={};if(!(r!=null&&r.properties))return i;let{properties:_}=r,s="";if(n){let{meta:a,routeType:u}=n;s=u===((p=o==null?void 0:o.PODCASTS)==null?void 0:p.routeType)&&a.length>1?(y=o==null?void 0:o.EPISODES)==null?void 0:y.routeType:u}let c=s?K[s.toUpperCase()]:Q;return Me(c,a=>{let u,d=_[a.notion];i[a.key]=null,d&&(u=C[a.type](d,l),i[a.key]=u||null)}),i},E=Be;import{sortObject as He}from"@jeromefitz/utils";import Ve from"lodash/map.js";import We from"lodash/omit.js";var Fe=({config:t,results:r,routeType:n})=>{let l=[];return Ve(r,o=>{let i=We(o,"properties");i.properties=He(E({config:t,data:o,pathVariables:n,pageId:o==null?void 0:o.id})),l.push(i)}),l},J=Fe;var ze=({isPage:t,isIndex:r,hasMeta:n})=>t?D.SLUG:r&&!n?D.LISTING:r&&n?D.LISTING_BY_DATE:n?D.SLUG_BY_ROUTE:D.SLUG,L=ze;var Ye=t=>(console.dir("@notion(_unsupported)"),t),x=Ye;var je=t=>t.checkbox||!1,X=je;var $e=t=>{let{type:r}=t;return t[r]},R=$e;var Ke=t=>t.email||null,ee=Ke;import{stringToUUID as Qe}from"@jeromefitz/utils";import qe from"github-slugger";import Ze from"lodash/size.js";var Je="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",Xe=(t,r)=>Je.replace("{{FILENAME}}",encodeURIComponent(t)).replace("{{PAGE_ID}}",Qe(r)),et=(t,r)=>{let n=new qe,l={};return Ze(t.files)<=0||t.files.map(o=>{var i,_;if((o==null?void 0:o.type)==="file"){let s=(i=o==null?void 0:o.file)==null?void 0:i.url.split("?")[0],c=n.slug(s);l[c]={type:o==null?void 0:o.type,url:Xe(s,r)}}if((o==null?void 0:o.type)==="external"){let s=(_=o==null?void 0:o.external)==null?void 0:_.url.split("?")[0],c=n.slug(s);l[c]={type:o==null?void 0:o.type,url:s}}}),l},N=et;import tt from"github-slugger";import ot from"lodash/map.js";var rt=t=>{let r=new tt,n={};return ot(t.multi_select,l=>{let o=l;o.slug=r.slug(o.name),n[o.id]=o}),n},te=rt;var nt=t=>(t==null?void 0:t.number)||null,oe=nt;import it from"github-slugger";var st=t=>{let r=new it;return t.people.map(n=>{let{avatar_url:l,id:o,name:i,person:_}=n,{email:s}=_;return{[r.slug(i)]:{avatar_url:l,email:s,id:o,name:i}}})[0]},re=st;var at=t=>(t==null?void 0:t.phone_number)||null,ne=at;import ie from"lodash/map.js";var lt=t=>t.type==="rollup"?t.rollup.type==="array"&&ie(t.rollup.array,r=>C[r.type](r))[0]:ie(t.relation,r=>r.id),se=lt;var pt=t=>{var r;return t!=null&&t.rich_text?(r=t==null?void 0:t.rich_text[0])==null?void 0:r.plain_text:null},ae=pt;import le from"lodash/map.js";import _t from"lodash/sortBy.js";var ut=t=>{let r=t==null?void 0:t.rollup;return _t(le(r==null?void 0:r.array,n=>le(n[n==null?void 0:n.type],l=>C[n==null?void 0:n.type]({type:n==null?void 0:n.type,[n==null?void 0:n.type]:[l]})))).flat()},pe=ut;import dt from"github-slugger";var ct=t=>{let r=new dt,n=t.select;return n?(n.slug=r.slug(t.select.name),{[n.id]:n}):null},_e=ct;var yt=t=>{var r;return t!=null&&t.title?(r=t==null?void 0:t.title[0])==null?void 0:r.plain_text:null},ue=yt;var mt=t=>t.url||null,de=mt;var ht={checkbox:X,created_by:x,created_time:R,date:R,email:ee,files:N,formula:x,image:N,last_edited_by:x,last_edited_time:R,multi_select:te,number:oe,people:re,phone_number:ne,relation:se,rich_text:ae,rollup:pe,select:_e,title:ue,url:de},C=ht;var Pt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:o,routeType:i})=>{let{NOTION:_}=t,s={},c=_[i.toUpperCase()].page_id__seo,p=await l({page_id:c});if(!p)return{};(p==null?void 0:p.object)==="page"&&(s=A(p,"properties"),s.properties=ce(E({config:t,data:p,pathVariables:o,pageId:s.id})));let y=_[i.toUpperCase()].infoType.notion??e.datePublished.notion,a=y===e.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await r({block_id:s.id}),d=await n({database_id:_[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:a}}]}}),h=[];St(d.results,S=>{let P=S;P=A(P,"properties"),P.properties=ce(E({config:t,data:S,pathVariables:o,pageId:S.id})),h.push(P)});let m=A(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},Et=Pt;import{sortObject as ye}from"@jeromefitz/utils";import ft from"lodash/map.js";import G from"lodash/omit.js";import wt from"lodash/size.js";var gt=({config:t,pathVariables:r,routeType:n,slug:l})=>{var d,h;let{NOTION:o}=t,{meta:i}=r,[_,s,c]=i,p=wt(i),y=new Date().toISOString(),a=new Date(`${_||y.slice(0,4)}-${s||"01"}-${c||"01"}`),u=((h=(d=o[n.toUpperCase()])==null?void 0:d.infoType)==null?void 0:h.notion)??e.datePublished.notion;switch(p){case 1:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:f(a,"")}},{property:u,date:{before:f(a,"day")}},{...I.slug,rich_text:{equals:l}}]}}},kt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:o,routeType:i,slug:_})=>{let{NOTION:s}=t,c={},p={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(p=G(a,"properties"),p.properties=ye(E({config:t,data:a,pathVariables:o,pageId:a.id}))),c=await r({block_id:p.id});let u=[{property:e.datePublished.notion,direction:"descending"}],d=gt({config:t,pathVariables:o,routeType:i,slug:_}),h=s[i.toUpperCase()].database_id,m=await n({database_id:h,filter:d,sorts:u}),S=[];ft(m.results,b=>{let v=G(b,"properties");v.properties=ye(E({config:t,data:b,pathVariables:o,pageId:v.id})),v&&S.push(v)});let P=G(m,"results");P.results=S;let T=G(P,"data");return{info:p,content:c,items:T,images:{}}},Tt=kt;import{sortObject as bt}from"@jeromefitz/utils";import Dt from"lodash/omit.js";var It=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getDeepFetchAllChildren:l,pathVariables:o,routeType:i,slug:_})=>{let{NOTION:s}=t,c=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(c))return{info:{},content:{},items:{},images:{}};let y=await n({database_id:s[c].database_id,filter:{and:[{...I.slug,rich_text:{equals:_}}]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Dt(a,"properties");u.properties=bt(E({config:t,data:a,pathVariables:o,pageId:u.id}));let d=await r({block_id:u.id}),m=[...await l({blocks:d.results})];return{info:u,content:m,items:{},images:{}}},Ct=It;import{sortObject as me}from"@jeromefitz/utils";import he from"lodash/omit.js";import Ot from"lodash/size.js";var vt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i})=>{var T,b;let{NOTION:_}=t,{meta:s}=o,c=i.toUpperCase(),[p,y]=s,a=Ot(s)===2,u=(b=(T=_[c])==null?void 0:T.hasChild)==null?void 0:b.toUpperCase(),d=await n({database_id:_[a?_[u].routeType.toUpperCase():c].database_id,filter:{and:[{...I.slug,rich_text:{equals:a?y:p}}]}}),h=(d==null?void 0:d.object)==="list"&&d.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let m=he(h,"properties");m.properties=me(E({config:t,data:h,pathVariables:o,pageId:m.id}));let S=await r({block_id:m.id}),P={};return a||(P=await l({config:t,reqQuery:{podcasts:m.id,databaseType:_[u].routeType.toUpperCase()}})),{info:m,content:S,items:P,images:{}}},xt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,pathVariables:l,routeType:o,slug:i})=>{var T,b;let _=new Date().toISOString(),{NOTION:s}=t,{meta:c}=l,[p,y,a]=c,u=new Date(`${p||_.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((b=(T=s[o.toUpperCase()])==null?void 0:T.infoType)==null?void 0:b.notion)??e.datePublished.notion,h=await n({database_id:s[o.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:f(u,"")}},{property:d,date:{before:f(u,"day")}},{...I.slug,rich_text:{equals:i}}]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let S=he(m,"properties");S.properties=me(E({config:t,data:m,pathVariables:l,pageId:S.id}));let P=await r({block_id:S.id});return{info:S,content:P,items:{},images:{}}},Rt=async({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i,slug:_})=>{var p;let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=t;return(p=s[i==null?void 0:i.toUpperCase()])!=null&&p.hasChild?await vt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,getQuery:l,pathVariables:o,routeType:i}):c[D.LISTING_BY_DATE].includes(i.toUpperCase())?await xt({config:t,getBlocksByIdChildren:r,getDatabasesByIdQuery:n,pathVariables:o,routeType:i,slug:_}):{info:{},content:{},items:{},images:{}}},Gt=Rt;import{avoidRateLimit as Lt,isUndefined as Nt}from"@jeromefitz/utils";var At=async({getPagesRetrieve:t,page_id:r})=>Nt(r)?[]:(await Lt(0),await t({page_id:r})),Ut=At;import Se from"lodash/drop.js";import Mt from"lodash/dropRight.js";import Bt from"lodash/first.js";import Pe from"lodash/includes.js";import Ht from"lodash/isInteger.js";import Vt from"lodash/join.js";import Wt from"lodash/last.js";import Ee from"lodash/size.js";var Ft=({config:t,catchAll:r})=>{let{NOTION:n,PAGES__HOMEPAGE:l,ROUTE_META:o,ROUTE_TYPES:i}=t,_=Ee(r),s=Bt(r),c=s.toUpperCase(),p=Wt(r),y=_>1&&Pe(o,c)?Se(r):Se(Mt(r)),a=s===p&&!Pe(i,c)?n.PAGES.routeType:s,u=s!==p&&!Ht(parseInt(p))?p:s,d=a===n.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&Ee(y)!==0,S=d&&s===l?"":Vt(r,"/"),P={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:S},T=L(P);return{...P,dataType:T}},zt=Ft;import{avoidRateLimit as Yt,isObjectEmpty as jt}from"@jeromefitz/utils";import $t from"lodash/map.js";import Kt from"lodash/omit.js";import Qt from"lodash/size.js";var qt=[{property:e.slug.notion,direction:"ascending"}],Zt=async({config:t,reqQuery:r,notionDatabasesQuery:n})=>{let{NOTION:l}=t,{databaseType:o}=r,i=o,_=!1,s=o.toUpperCase(),c=l[s].database_id;if(!c)return[];let p={},y={},a,u;if(o==="EPISODES"){u=qt;let{podcasts:d}=r,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),Qt(m)>0&&$t(m,S=>h.push({property:e.relationEpisodes__Podcasts.notion,relation:{contains:S}})),a={or:[...h]}}else _=!0;if(!_&&(!p||jt(p))){await Yt(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:e.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await n({database_id:c,filter:a,sorts:u}),p=d,y=J({config:t,results:d.results,routeType:i}),p=Kt(p,"results"),p.results=y):_=!0}return p},Jt=Zt;export{ke as getBlocksByIdChildren,xe as getDatabasesByIdQuery,Re as getDeepFetchAllChildren,Le as getInfoType,Et as getNotionListing,Tt as getNotionListingByDate,Ct as getNotionSlug,Gt as getNotionSlugByRoute,Ut as getPagesById,zt as getPathVariables,Jt as getQuery};