@jeromefitz/notion 3.2.1 → 3.3.0
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/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +11 -8
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var gt=Object.create;var B=Object.defineProperty,ft=Object.defineProperties,Et=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,Tt=Object.getOwnPropertyNames,ue=Object.getOwnPropertySymbols,kt=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var de=(e,o,n)=>o in e?B(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,S=(e,o)=>{for(var n in o||(o={}))ce.call(o,n)&&de(e,n,o[n]);if(ue)for(var n of ue(o))bt.call(o,n)&&de(e,n,o[n]);return e},g=(e,o)=>ft(e,wt(o));var It=(e,o)=>{for(var n in o)B(e,n,{get:o[n],enumerable:!0})},ye=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of Tt(o))!ce.call(e,r)&&r!==n&&B(e,r,{get:()=>o[r],enumerable:!(a=Et(o,r))||a.enumerable});return e};var d=(e,o,n)=>(n=e!=null?gt(kt(e)):{},ye(o||!e||!e.__esModule?B(n,"default",{value:e,enumerable:!0}):n,e)),Dt=e=>ye(B({},"__esModule",{value:!0}),e);var ho={};It(ho,{Client:()=>St});module.exports=Dt(ho);var Pt=require("@notionhq/client");var b=d(require("lodash/filter.js"),1),he=d(require("lodash/map.js"),1),I=({key:e,notion:o,type:n})=>({key:e,notion:o,type:n}),t={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"}},D=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.seoKeywords,t.title],Pe=[...D],Se=[...D,t.author,t.status,t.subtitle],ge=[...D,t.dateRecorded,t.duration,t.episode,t.mp3,t.season,t.relationEpisodes__People_Guest,t.relationEpisodes__People_Sound_Engineer,t.relationEpisodes__People_Thanks,t.relationEpisodes__Podcasts,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type,t.rollupEpisodes__Podcasts,t.rollupEpisodes__PodcastsSlugs],fe=[...D,t.dateEvent,t.relationEvents__People_Guest_Music,t.relationEvents__People_Guest,t.relationEvents__People_Host,t.relationEvents__Shows_Lineup,t.relationEvents__Shows,t.relationEvents__Venues,t.socialFacebook,t.socialWebsite,t.ticketUrl,t.rollupEvents__People_Cast,t.rollupEvents__People_Guest_Music,t.rollupEvents__People_Guest,t.rollupEvents__People_Host,t.rollupEvents__Shows_Lineup,t.rollupEvents__Shows,t.rollupEvents__Venues],Ee=[...D],we=[...D,t.email,t.nameFirst,t.nameLast,t.namePreferred,t.relationPeople__Episodes_Guest,t.relationPeople__Episodes_Sound_Engineer,t.relationPeople__Episodes_Thanks,t.relationPeople__Events_Guest,t.relationPeople__Events_Guest_Music,t.relationPeople__Events_Host,t.relationPeople__Podcasts_Host,t.relationPeople__Podcasts_Sound_Engineer,t.relationPeople__Shows_Cast,t.relationPeople__Shows_Cast_Past,t.relationPeople__Shows_Director,t.relationPeople__Shows_Director_Musical,t.relationPeople__Shows_Director_Technical,t.relationPeople__Shows_Producer,t.relationPeople__Shows_Thanks,t.relationPeople__Shows_Writer],Te=[...D,t.categories,t.explicit,t.podcastAuthor,t.podcastAuthorEmail,t.relationPodcasts__People_Host,t.relationPodcasts__People_Sound_Engineer,t.socialApple,t.socialSpotify,t.type,t.relationPodcasts__Episodes,t.rollupPodcasts__Episodes,t.rollupPodcasts__EpisodesSlugs],ke=[...D],be=[...D,t.relationShows__People_Cast,t.relationShows__People_Cast_Past,t.relationShows__People_Director,t.relationShows__People_Director_Musical,t.relationShows__People_Director_Technical,t.relationShows__People_Producer,t.relationShows__People_Thanks,t.relationShows__People_Writer,t.relationShows__Tags,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationShows__Events,t.relationShows__Events_Lineup,t.rollupShows__People_Cast,t.rollupShows__People_Cast_Slug,t.rollupShows__People_Cast_Past,t.rollupShows__People_Crew,t.rollupShows__People_Director,t.rollupShows__People_Director_Musical,t.rollupShows__People_Director_Technical,t.rollupShows__People_Music,t.rollupShows__People_Producer,t.rollupShows__People_Thanks,t.rollupShows__People_Writer,t.rollupShows__Tags],Ie=[...D,t.addressCity,t.addressLatitude,t.addressLongitude,t.addressNeighborhood,t.addressState,t.addressStreet,t.addressZipCode,t.phoneNumber,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationVenues__Episodes,t.relationVenues__Events],So={BLOG:(0,b.default)(Pe,{init:!0}),BOOKS:(0,b.default)(Se,{init:!0}),EPISODES:(0,b.default)(ge,{init:!0}),EVENTS:(0,b.default)(fe,{init:!0}),PAGES:(0,b.default)(Ee,{init:!0}),PEOPLE:(0,b.default)(we,{init:!0}),PODCASTS:(0,b.default)(Te,{init:!0}),SEO:(0,b.default)(ke,{init:!0}),SHOWS:(0,b.default)(be,{init:!0}),VENUES:(0,b.default)(Ie,{init:!0})},De={BLOG:Pe.map(e=>I(e)),BOOKS:Se.map(e=>I(e)),EPISODES:ge.map(e=>I(e)),EVENTS:fe.map(e=>I(e)),PAGES:Ee.map(e=>I(e)),PEOPLE:we.map(e=>I(e)),PODCASTS:Te.map(e=>I(e)),SEO:ke.map(e=>I(e)),SHOWS:be.map(e=>I(e)),VENUES:Ie.map(e=>I(e))},Ce=(0,he.default)(t,e=>I(e)),me=new Date().toISOString(),O={dateBefore:{property:t.datePublished.notion,date:{before:me}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:me}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,rich_text:{equals:""}}},Ct="LISTING",Ot="LISTING_BY_DATE",vt="SLUG",xt="SLUG_BY_ROUTE",Rt=[Ct,Ot,vt,xt],T=Object.assign({},...Rt.map(e=>({[e]:e})).flat(1));var N=require("@jeromefitz/utils"),Bt=async({getBlocksChildrenList:e,block_id:o})=>(0,N.isUndefined)(o)?[]:(await(0,N.avoidRateLimit)(0),await e({block_id:o})),F=Bt;var x={sorts:[{property:t.slug.notion,direction:"ascending"}]},Lt=async({database_id:e,filter:o=x==null?void 0:x.filter,getDatabasesQuery:n,sorts:a=x==null?void 0:x.sorts})=>e?await n({database_id:e,sorts:a,filter:o}):[],Q=Lt;var Oe=async({getBlocksChildrenList:e,blocks:o})=>{if(o==null)return o;let n=o.filter(r=>r.has_children).map(r=>{let{id:i}=r;return{promise:e({block_id:i,page_size:100}),parent_block:r}}),a=await Promise.all(n.map(r=>r.promise));for(let r=0;r<a.length;r++){let i=a[r].results;if(await Oe({blocks:i,getBlocksChildrenList:e}),n[r]){let p=n[r].parent_block;p[p.type].children=i}}return o},W=Oe;var Gt=({config:e,item:o,routeType:n,meta:a})=>{var _,m;let{NOTION:r}=e,i="",p=(_=o.properties)==null?void 0:_.slug,s="",y="/[...catchAll]";switch(n){case r.BLOG.routeType:case r.EVENTS.routeType:i=(m=o.properties[r[n.toUpperCase()].infoType.key])==null?void 0:m.start.slice(0,10);let[l,u,c]=i==null?void 0:i.split("-");s=`/${n}/${l}/${u}/${c}/${p}`;break;case r.PODCASTS.routeType:case r.EPISODES.routeType:s=`/${a==null?void 0:a.join("/")}/${p}`;break;default:s=`/${n}/${p}`;break}return s=s.replace("//","/"),{as:s,date:i,href:y,slug:p}},Y=Gt;var Z=require("@jeromefitz/utils"),rt=d(require("lodash/map.js"),1),M=d(require("lodash/omit.js"),1);var z=d(require("date-fns/addDays/index.js"),1),ve=d(require("date-fns/addMonths/index.js"),1),xe=d(require("date-fns/addYears/index.js"),1),Nt=(e,o)=>{switch(o){case"year":return(0,xe.default)(e,1).toISOString();case"month":return(0,ve.default)(e,1).toISOString();case"day":return(0,z.default)(e,2).toISOString()}return(0,z.default)(e,-1).toISOString()},k=Nt;var Re=d(require("lodash/map.js"),1);var At=({config:e,data:o,pathVariables:n,pageId:a})=>{var _,m;let{NOTION:r}=e,i={};if(!(o!=null&&o.properties))return i;let{properties:p}=o,s="";if(n){let{meta:l,routeType:u}=n;s=u===((_=r==null?void 0:r.PODCASTS)==null?void 0:_.routeType)&&l.length>1?(m=r==null?void 0:r.EPISODES)==null?void 0:m.routeType:u}let y=s?De[s.toUpperCase()]:Ce;return(0,Re.default)(y,l=>{let u,c=p[l.notion];i[l.key]=null,c&&(u=v[l.type](c,a),i[l.key]=u||null)}),i},w=At;var Be=require("@jeromefitz/utils"),Le=d(require("lodash/map.js"),1),Ge=d(require("lodash/omit.js"),1);var Ut=({config:e,results:o,routeType:n})=>{let a=[];return(0,Le.default)(o,r=>{let i=(0,Ge.default)(r,"properties");i.properties=(0,Be.sortObject)(w({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),a.push(i)}),a},Ne=Ut;var Mt=({isPage:e,isIndex:o,hasMeta:n})=>e?T.SLUG:o&&!n?T.LISTING:o&&n?T.LISTING_BY_DATE:n?T.SLUG_BY_ROUTE:T.SLUG,j=Mt;var Vt=e=>(console.dir("@notion(_unsupported)"),e),A=Vt;var Ht=e=>e.checkbox||!1,Ae=Ht;var Ft=e=>{let{type:o}=e;return e[o]},U=Ft;var Qt=e=>e.email||null,Ue=Qt;var Me=require("@jeromefitz/utils"),Ve=d(require("github-slugger"),1),He=d(require("lodash/size.js"),1),Wt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",Yt=(e,o)=>Wt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",(0,Me.stringToUUID)(o)),zt=(e,o)=>{let n=new Ve.default,a={};return(0,He.default)(e.files)<=0||e.files.map(r=>{var i,p;if((r==null?void 0:r.type)==="file"){let s=(i=r==null?void 0:r.file)==null?void 0:i.url.split("?")[0],y=n.slug(s);a[y]={type:r==null?void 0:r.type,url:Yt(s,o)}}if((r==null?void 0:r.type)==="external"){let s=(p=r==null?void 0:r.external)==null?void 0:p.url.split("?")[0],y=n.slug(s);a[y]={type:r==null?void 0:r.type,url:s}}}),a},$=zt;var Fe=d(require("github-slugger"),1),Qe=d(require("lodash/map.js"),1),jt=e=>{let o=new Fe.default,n={};return(0,Qe.default)(e.multi_select,a=>{let r=a;r.slug=o.slug(r.name),n[r.id]=r}),n},We=jt;var $t=e=>(e==null?void 0:e.number)||null,Ye=$t;var ze=d(require("github-slugger"),1),Kt=e=>{let o=new ze.default;return e.people.map(n=>{let{avatar_url:a,id:r,name:i,person:p}=n,{email:s}=p;return{[o.slug(i)]:{avatar_url:a,email:s,id:r,name:i}}})[0]},je=Kt;var qt=e=>(e==null?void 0:e.phone_number)||null,$e=qt;var K=d(require("lodash/map.js"),1);var Zt=e=>e.type==="rollup"?e.rollup.type==="array"&&(0,K.default)(e.rollup.array,o=>v[o.type](o))[0]:(0,K.default)(e.relation,o=>o.id),Ke=Zt;var Jt=e=>{var o;return e!=null&&e.rich_text?(o=e==null?void 0:e.rich_text[0])==null?void 0:o.plain_text:null},qe=Jt;var q=d(require("lodash/map.js"),1),Ze=d(require("lodash/sortBy.js"),1);var Xt=e=>{let o=e==null?void 0:e.rollup;return(0,Ze.default)((0,q.default)(o==null?void 0:o.array,n=>(0,q.default)(n[n==null?void 0:n.type],a=>v[n==null?void 0:n.type]({type:n==null?void 0:n.type,[n==null?void 0:n.type]:[a]})))).flat()},Je=Xt;var Xe=d(require("github-slugger"),1),eo=e=>{let o=new Xe.default,n=e.select;return n?(n.slug=o.slug(e.select.name),{[n.id]:n}):null},et=eo;var to=e=>{var o;return e!=null&&e.title?(o=e==null?void 0:e.title[0])==null?void 0:o.plain_text:null},tt=to;var oo=e=>e.url||null,ot=oo;var ro={checkbox:Ae,created_by:A,created_time:U,date:U,email:Ue,files:$,formula:A,image:$,last_edited_by:A,last_edited_time:U,multi_select:We,number:Ye,people:je,phone_number:$e,relation:Ke,rich_text:qe,rollup:Je,select:et,title:tt,url:ot},v=ro;var no=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:a,pathVariables:r,routeType:i})=>{let{NOTION:p}=e,s={},y=p[i.toUpperCase()].page_id__seo,_=await a({page_id:y});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=(0,M.default)(_,"properties"),s.properties=(0,Z.sortObject)(w({config:e,data:_,pathVariables:r,pageId:s.id})));let m=p[i.toUpperCase()].infoType.notion??t.datePublished.notion,l=m===t.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await o({block_id:s.id}),c=await n({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:m,date:{on_or_after:l}}]}}),P=[];(0,rt.default)(c.results,f=>{let E=f;E=(0,M.default)(E,"properties"),E.properties=(0,Z.sortObject)(w({config:e,data:f,pathVariables:r,pageId:f.id})),P.push(E)});let h=(0,M.default)(c,"results");return h.results=P,{info:s,content:u,items:h,images:{}}},J=no;var X=require("@jeromefitz/utils"),nt=d(require("lodash/map.js"),1),L=d(require("lodash/omit.js"),1),it=d(require("lodash/size.js"),1);var io=({config:e,pathVariables:o,routeType:n,slug:a})=>{var c,P;let{NOTION:r}=e,{meta:i}=o,[p,s,y]=i,_=(0,it.default)(i),m=new Date().toISOString(),l=new Date(`${p||m.slice(0,4)}-${s||"01"}-${y||"01"}`),u=((P=(c=r[n.toUpperCase()])==null?void 0:c.infoType)==null?void 0:P.notion)??t.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"day")}}]};default:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"day")}},g(S({},O.slug),{rich_text:{equals:a}})]}}},so=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:a,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,y={},_={},m=s[i.toUpperCase()].page_id__seo,l=await a({page_id:m});l.object==="page"&&(_=(0,L.default)(l,"properties"),_.properties=(0,X.sortObject)(w({config:e,data:l,pathVariables:r,pageId:l.id}))),y=await o({block_id:_.id});let u=[{property:t.datePublished.notion,direction:"descending"}],c=io({config:e,pathVariables:r,routeType:i,slug:p}),P=s[i.toUpperCase()].database_id,h=await n({database_id:P,filter:c,sorts:u}),f=[];(0,nt.default)(h.results,R=>{let G=(0,L.default)(R,"properties");G.properties=(0,X.sortObject)(w({config:e,data:R,pathVariables:r,pageId:G.id})),G&&f.push(G)});let E=(0,L.default)(h,"results");E.results=f;let C=(0,L.default)(E,"data");return{info:_,content:y,items:C,images:{}}},ee=so;var st=require("@jeromefitz/utils"),at=d(require("lodash/omit.js"),1);var ao=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getDeepFetchAllChildren:a,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,y=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(y))return{info:{},content:{},items:{},images:{}};let m=await n({database_id:s[y].database_id,filter:{and:[g(S({},O.slug),{rich_text:{equals:p}})]}}),l=(m==null?void 0:m.object)==="list"&&m.results[0];if(!l)return{};let u=(0,at.default)(l,"properties");u.properties=(0,st.sortObject)(w({config:e,data:l,pathVariables:r,pageId:u.id}));let c=await o({block_id:u.id}),h=[...await a({blocks:c.results})];return{info:u,content:h,items:{},images:{}}},te=ao;var oe=require("@jeromefitz/utils"),re=d(require("lodash/omit.js"),1),lt=d(require("lodash/size.js"),1);var lo=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:a,pathVariables:r,routeType:i})=>{var C;let{NOTION:p}=e,{meta:s}=r,y=i.toUpperCase(),[_,m]=s,l=(0,lt.default)(s)===2,u=(C=p[y])==null?void 0:C.hasChild.toUpperCase(),c=await n({database_id:p[l?p[u].routeType.toUpperCase():y].database_id,filter:{and:[g(S({},O.slug),{rich_text:{equals:l?m:_}})]}}),P=(c==null?void 0:c.object)==="list"&&c.results[0];if(!P)return{info:{},content:{},items:{},images:{}};let h=(0,re.default)(P,"properties");h.properties=(0,oe.sortObject)(w({config:e,data:P,pathVariables:r,pageId:h.id}));let f=await o({block_id:h.id}),E={};return l||(E=await a({config:e,reqQuery:{podcasts:h.id,databaseType:p[u].routeType.toUpperCase()}})),{info:h,content:f,items:E,images:{}}},po=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:a,routeType:r,slug:i})=>{var C,R;let p=new Date().toISOString(),{NOTION:s}=e,{meta:y}=a,[_,m,l]=y,u=new Date(`${_||p.slice(0,4)}-${m||"01"}-${l||"01"}`),c=((R=(C=s[r.toUpperCase()])==null?void 0:C.infoType)==null?void 0:R.notion)??t.datePublished.notion,P=await n({database_id:s[r.toUpperCase()].database_id,filter:{and:[{property:c,date:{on_or_after:k(u,"")}},{property:c,date:{before:k(u,"day")}},g(S({},O.slug),{rich_text:{equals:i}})]}}),h=(P==null?void 0:P.object)==="list"&&P.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let f=(0,re.default)(h,"properties");f.properties=(0,oe.sortObject)(w({config:e,data:h,pathVariables:a,pageId:f.id}));let E=await o({block_id:f.id});return{info:f,content:E,items:{},images:{}}},_o=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:a,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:y}=e;return s[i.toUpperCase()].hasChild?await lo({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:a,pathVariables:r,routeType:i}):y[T.LISTING_BY_DATE].includes(i.toUpperCase())?await po({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:r,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},ne=_o;var V=require("@jeromefitz/utils"),uo=async({getPagesRetrieve:e,page_id:o})=>(0,V.isUndefined)(o)?[]:(await(0,V.avoidRateLimit)(0),await e({page_id:o})),ie=uo;var se=d(require("lodash/drop.js"),1),pt=d(require("lodash/dropRight.js"),1),_t=d(require("lodash/first.js"),1),ae=d(require("lodash/includes.js"),1),ut=d(require("lodash/isInteger.js"),1),dt=d(require("lodash/join.js"),1),ct=d(require("lodash/last.js"),1),le=d(require("lodash/size.js"),1);var co=({config:e,catchAll:o})=>{let{NOTION:n,PAGES__HOMEPAGE:a,ROUTE_META:r,ROUTE_TYPES:i}=e,p=(0,le.default)(o),s=(0,_t.default)(o),y=s.toUpperCase(),_=(0,ct.default)(o),m=p>1&&(0,ae.default)(r,y)?(0,se.default)(o):(0,se.default)((0,pt.default)(o)),l=s===_&&!(0,ae.default)(i,y)?n.PAGES.routeType:s,u=s!==_&&!(0,ut.default)(parseInt(_))?_:s,c=l===n.PAGES.routeType.toLowerCase(),P=u===s,h=!!m&&(0,le.default)(m)!==0,f=c&&s===a?"":(0,dt.default)(o,"/"),E={hasMeta:h,isPage:c,isIndex:P,meta:m,routeType:l,slug:u,url:f},C=j(E);return g(S({},E),{dataType:C})},pe=co;var H=require("@jeromefitz/utils"),yt=d(require("lodash/map.js"),1),mt=d(require("lodash/omit.js"),1),ht=d(require("lodash/size.js"),1);var yo=[{property:t.slug.notion,direction:"ascending"}],mo=async({config:e,reqQuery:o,notionDatabasesQuery:n})=>{let{NOTION:a}=e,{databaseType:r}=o,i=r,p=!1,s=r.toUpperCase(),y=a[s].database_id;if(!y)return[];let _={},m={},l,u;if(r==="EPISODES"){u=yo;let{podcasts:c}=o,P=[],h=[];c&&h.push(...c==null?void 0:c.split(",")),(0,ht.default)(h)>0&&(0,yt.default)(h,f=>P.push({property:t.relationEpisodes__Podcasts.notion,relation:{contains:f}})),l={or:[...P]}}else p=!0;if(!p&&(!_||(0,H.isObjectEmpty)(_))){await(0,H.avoidRateLimit)(0);let c;l?((l==null?void 0:l.or.length)===0&&(l={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),c=await n({database_id:y,filter:l,sorts:u}),_=c,m=Ne({config:e,results:c.results,routeType:i}),_=(0,mt.default)(_,"results"),_.results=m):p=!0}return _},_e=mo;var St=class extends Pt.Client{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await F(g(S({},o),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async o=>await Q(g(S({},o),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async o=>await W(g(S({},o),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:o=>Y(g(S({},o),{config:this.#e})),getPagesById:async o=>await ie(g(S({},o),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:o=>pe(g(S({},o),{config:this.#e})),getQuery:async o=>await _e(g(S({},o),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[T.LISTING]:async o=>await J(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[T.LISTING_BY_DATE]:async o=>await ee(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[T.SLUG]:async o=>await te(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[T.SLUG_BY_ROUTE]:async o=>await ne(g(S({},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};0&&(module.exports={Client});
|
|
1
|
+
var gt=Object.create;var B=Object.defineProperty,ft=Object.defineProperties,Et=Object.getOwnPropertyDescriptor,wt=Object.getOwnPropertyDescriptors,Tt=Object.getOwnPropertyNames,de=Object.getOwnPropertySymbols,kt=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var ce=(e,r,o)=>r in e?B(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,S=(e,r)=>{for(var o in r||(r={}))ye.call(r,o)&&ce(e,o,r[o]);if(de)for(var o of de(r))bt.call(r,o)&&ce(e,o,r[o]);return e},g=(e,r)=>ft(e,wt(r));var It=(e,r)=>{for(var o in r)B(e,o,{get:r[o],enumerable:!0})},me=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Tt(r))!ye.call(e,n)&&n!==o&&B(e,n,{get:()=>r[n],enumerable:!(a=Et(r,n))||a.enumerable});return e};var d=(e,r,o)=>(o=e!=null?gt(kt(e)):{},me(r||!e||!e.__esModule?B(o,"default",{value:e,enumerable:!0}):o,e)),Dt=e=>me(B({},"__esModule",{value:!0}),e);var ho={};It(ho,{Client:()=>ue});module.exports=Dt(ho);var St=require("@notionhq/client");var b=d(require("lodash/filter.js"),1),Pe=d(require("lodash/map.js"),1),I=({key:e,notion:r,type:o})=>({key:e,notion:r,type:o}),t={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"}},D=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.seoKeywords,t.title],Se=[...D],ge=[...D,t.author,t.status,t.subtitle],fe=[...D,t.dateRecorded,t.duration,t.episode,t.mp3,t.season,t.relationEpisodes__People_Guest,t.relationEpisodes__People_Sound_Engineer,t.relationEpisodes__People_Thanks,t.relationEpisodes__Podcasts,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type,t.rollupEpisodes__Podcasts,t.rollupEpisodes__PodcastsSlugs],Ee=[...D,t.dateEvent,t.relationEvents__People_Guest_Music,t.relationEvents__People_Guest,t.relationEvents__People_Host,t.relationEvents__Shows_Lineup,t.relationEvents__Shows,t.relationEvents__Venues,t.socialFacebook,t.socialWebsite,t.ticketUrl,t.rollupEvents__People_Cast,t.rollupEvents__People_Guest_Music,t.rollupEvents__People_Guest,t.rollupEvents__People_Host,t.rollupEvents__Shows_Lineup,t.rollupEvents__Shows,t.rollupEvents__Venues],we=[...D],Te=[...D,t.email,t.nameFirst,t.nameLast,t.namePreferred,t.relationPeople__Episodes_Guest,t.relationPeople__Episodes_Sound_Engineer,t.relationPeople__Episodes_Thanks,t.relationPeople__Events_Guest,t.relationPeople__Events_Guest_Music,t.relationPeople__Events_Host,t.relationPeople__Podcasts_Host,t.relationPeople__Podcasts_Sound_Engineer,t.relationPeople__Shows_Cast,t.relationPeople__Shows_Cast_Past,t.relationPeople__Shows_Director,t.relationPeople__Shows_Director_Musical,t.relationPeople__Shows_Director_Technical,t.relationPeople__Shows_Producer,t.relationPeople__Shows_Thanks,t.relationPeople__Shows_Writer],ke=[...D,t.categories,t.explicit,t.podcastAuthor,t.podcastAuthorEmail,t.relationPodcasts__People_Host,t.relationPodcasts__People_Sound_Engineer,t.socialApple,t.socialSpotify,t.type,t.relationPodcasts__Episodes,t.rollupPodcasts__Episodes,t.rollupPodcasts__EpisodesSlugs],be=[...D],Ie=[...D,t.relationShows__People_Cast,t.relationShows__People_Cast_Past,t.relationShows__People_Director,t.relationShows__People_Director_Musical,t.relationShows__People_Director_Technical,t.relationShows__People_Producer,t.relationShows__People_Thanks,t.relationShows__People_Writer,t.relationShows__Tags,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationShows__Events,t.relationShows__Events_Lineup,t.rollupShows__People_Cast,t.rollupShows__People_Cast_Slug,t.rollupShows__People_Cast_Past,t.rollupShows__People_Crew,t.rollupShows__People_Director,t.rollupShows__People_Director_Musical,t.rollupShows__People_Director_Technical,t.rollupShows__People_Music,t.rollupShows__People_Producer,t.rollupShows__People_Thanks,t.rollupShows__People_Writer,t.rollupShows__Tags],De=[...D,t.addressCity,t.addressLatitude,t.addressLongitude,t.addressNeighborhood,t.addressState,t.addressStreet,t.addressZipCode,t.phoneNumber,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationVenues__Episodes,t.relationVenues__Events],So={BLOG:(0,b.default)(Se,{init:!0}),BOOKS:(0,b.default)(ge,{init:!0}),EPISODES:(0,b.default)(fe,{init:!0}),EVENTS:(0,b.default)(Ee,{init:!0}),PAGES:(0,b.default)(we,{init:!0}),PEOPLE:(0,b.default)(Te,{init:!0}),PODCASTS:(0,b.default)(ke,{init:!0}),SEO:(0,b.default)(be,{init:!0}),SHOWS:(0,b.default)(Ie,{init:!0}),VENUES:(0,b.default)(De,{init:!0})},Ce={BLOG:Se.map(e=>I(e)),BOOKS:ge.map(e=>I(e)),EPISODES:fe.map(e=>I(e)),EVENTS:Ee.map(e=>I(e)),PAGES:we.map(e=>I(e)),PEOPLE:Te.map(e=>I(e)),PODCASTS:ke.map(e=>I(e)),SEO:be.map(e=>I(e)),SHOWS:Ie.map(e=>I(e)),VENUES:De.map(e=>I(e))},Oe=(0,Pe.default)(t,e=>I(e)),he=new Date().toISOString(),O={dateBefore:{property:t.datePublished.notion,date:{before:he}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:he}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,rich_text:{equals:""}}},Ct="LISTING",Ot="LISTING_BY_DATE",vt="SLUG",xt="SLUG_BY_ROUTE",Rt=[Ct,Ot,vt,xt],T=Object.assign({},...Rt.map(e=>({[e]:e})).flat(1));var N=require("@jeromefitz/utils"),Bt=async({getBlocksChildrenList:e,block_id:r})=>(0,N.isUndefined)(r)?[]:(await(0,N.avoidRateLimit)(0),await e({block_id:r})),F=Bt;var x={sorts:[{property:t.slug.notion,direction:"ascending"}]},Lt=async({database_id:e,filter:r=x==null?void 0:x.filter,getDatabasesQuery:o,sorts:a=x==null?void 0:x.sorts})=>e?await o({database_id:e,sorts:a,filter:r}):[],Q=Lt;var ve=async({getBlocksChildrenList:e,blocks:r})=>{if(r==null)return r;let o=r.filter(n=>n.has_children).map(n=>{let{id:i}=n;return{promise:e({block_id:i,page_size:100}),parent_block:n}}),a=await Promise.all(o.map(n=>n.promise));for(let n=0;n<a.length;n++){let i=a[n].results;if(await ve({blocks:i,getBlocksChildrenList:e}),o[n]){let p=o[n].parent_block;p[p.type].children=i}}return r},W=ve;var Gt=({config:e,item:r,routeType:o,meta:a})=>{var _,m;let{NOTION:n}=e,i="",p=(_=r.properties)==null?void 0:_.slug,s="",y="/[...catchAll]";switch(o){case n.BLOG.routeType:case n.EVENTS.routeType:i=(m=r.properties[n[o.toUpperCase()].infoType.key])==null?void 0:m.start.slice(0,10);let[l,u,c]=i==null?void 0:i.split("-");s=`/${o}/${l}/${u}/${c}/${p}`;break;case n.PODCASTS.routeType:case n.EPISODES.routeType:s=`/${a==null?void 0:a.join("/")}/${p}`;break;default:s=`/${o}/${p}`;break}return s=s.replace("//","/"),{as:s,date:i,href:y,slug:p}},Y=Gt;var Z=require("@jeromefitz/utils"),nt=d(require("lodash/map.js"),1),M=d(require("lodash/omit.js"),1);var z=d(require("date-fns/addDays/index.js"),1),xe=d(require("date-fns/addMonths/index.js"),1),Re=d(require("date-fns/addYears/index.js"),1),Nt=(e,r)=>{switch(r){case"year":return(0,Re.default)(e,1).toISOString();case"month":return(0,xe.default)(e,1).toISOString();case"day":return(0,z.default)(e,2).toISOString()}return(0,z.default)(e,-1).toISOString()},k=Nt;var Be=d(require("lodash/map.js"),1);var At=({config:e,data:r,pathVariables:o,pageId:a})=>{var _,m;let{NOTION:n}=e,i={};if(!(r!=null&&r.properties))return i;let{properties:p}=r,s="";if(o){let{meta:l,routeType:u}=o;s=u===((_=n==null?void 0:n.PODCASTS)==null?void 0:_.routeType)&&l.length>1?(m=n==null?void 0:n.EPISODES)==null?void 0:m.routeType:u}let y=s?Ce[s.toUpperCase()]:Oe;return(0,Be.default)(y,l=>{let u,c=p[l.notion];i[l.key]=null,c&&(u=v[l.type](c,a),i[l.key]=u||null)}),i},w=At;var Le=require("@jeromefitz/utils"),Ge=d(require("lodash/map.js"),1),Ne=d(require("lodash/omit.js"),1);var Ut=({config:e,results:r,routeType:o})=>{let a=[];return(0,Ge.default)(r,n=>{let i=(0,Ne.default)(n,"properties");i.properties=(0,Le.sortObject)(w({config:e,data:n,pathVariables:o,pageId:n==null?void 0:n.id})),a.push(i)}),a},Ae=Ut;var Mt=({isPage:e,isIndex:r,hasMeta:o})=>e?T.SLUG:r&&!o?T.LISTING:r&&o?T.LISTING_BY_DATE:o?T.SLUG_BY_ROUTE:T.SLUG,j=Mt;var Vt=e=>(console.dir("@notion(_unsupported)"),e),A=Vt;var Ht=e=>e.checkbox||!1,Ue=Ht;var Ft=e=>{let{type:r}=e;return e[r]},U=Ft;var Qt=e=>e.email||null,Me=Qt;var Ve=require("@jeromefitz/utils"),He=d(require("github-slugger"),1),Fe=d(require("lodash/size.js"),1),Wt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",Yt=(e,r)=>Wt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",(0,Ve.stringToUUID)(r)),zt=(e,r)=>{let o=new He.default,a={};return(0,Fe.default)(e.files)<=0||e.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],y=o.slug(s);a[y]={type:n==null?void 0:n.type,url:Yt(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],y=o.slug(s);a[y]={type:n==null?void 0:n.type,url:s}}}),a},$=zt;var Qe=d(require("github-slugger"),1),We=d(require("lodash/map.js"),1),jt=e=>{let r=new Qe.default,o={};return(0,We.default)(e.multi_select,a=>{let n=a;n.slug=r.slug(n.name),o[n.id]=n}),o},Ye=jt;var $t=e=>(e==null?void 0:e.number)||null,ze=$t;var je=d(require("github-slugger"),1),Kt=e=>{let r=new je.default;return e.people.map(o=>{let{avatar_url:a,id:n,name:i,person:p}=o,{email:s}=p;return{[r.slug(i)]:{avatar_url:a,email:s,id:n,name:i}}})[0]},$e=Kt;var qt=e=>(e==null?void 0:e.phone_number)||null,Ke=qt;var K=d(require("lodash/map.js"),1);var Zt=e=>e.type==="rollup"?e.rollup.type==="array"&&(0,K.default)(e.rollup.array,r=>v[r.type](r))[0]:(0,K.default)(e.relation,r=>r.id),qe=Zt;var Jt=e=>{var r;return e!=null&&e.rich_text?(r=e==null?void 0:e.rich_text[0])==null?void 0:r.plain_text:null},Ze=Jt;var q=d(require("lodash/map.js"),1),Je=d(require("lodash/sortBy.js"),1);var Xt=e=>{let r=e==null?void 0:e.rollup;return(0,Je.default)((0,q.default)(r==null?void 0:r.array,o=>(0,q.default)(o[o==null?void 0:o.type],a=>v[o==null?void 0:o.type]({type:o==null?void 0:o.type,[o==null?void 0:o.type]:[a]})))).flat()},Xe=Xt;var et=d(require("github-slugger"),1),eo=e=>{let r=new et.default,o=e.select;return o?(o.slug=r.slug(e.select.name),{[o.id]:o}):null},tt=eo;var to=e=>{var r;return e!=null&&e.title?(r=e==null?void 0:e.title[0])==null?void 0:r.plain_text:null},ot=to;var oo=e=>e.url||null,rt=oo;var ro={checkbox:Ue,created_by:A,created_time:U,date:U,email:Me,files:$,formula:A,image:$,last_edited_by:A,last_edited_time:U,multi_select:Ye,number:ze,people:$e,phone_number:Ke,relation:qe,rich_text:Ze,rollup:Xe,select:tt,title:ot,url:rt},v=ro;var no=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:a,pathVariables:n,routeType:i})=>{let{NOTION:p}=e,s={},y=p[i.toUpperCase()].page_id__seo,_=await a({page_id:y});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=(0,M.default)(_,"properties"),s.properties=(0,Z.sortObject)(w({config:e,data:_,pathVariables:n,pageId:s.id})));let m=p[i.toUpperCase()].infoType.notion??t.datePublished.notion,l=m===t.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await r({block_id:s.id}),c=await o({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:m,date:{on_or_after:l}}]}}),P=[];(0,nt.default)(c.results,f=>{let E=f;E=(0,M.default)(E,"properties"),E.properties=(0,Z.sortObject)(w({config:e,data:f,pathVariables:n,pageId:f.id})),P.push(E)});let h=(0,M.default)(c,"results");return h.results=P,{info:s,content:u,items:h,images:{}}},J=no;var X=require("@jeromefitz/utils"),it=d(require("lodash/map.js"),1),L=d(require("lodash/omit.js"),1),st=d(require("lodash/size.js"),1);var io=({config:e,pathVariables:r,routeType:o,slug:a})=>{var c,P;let{NOTION:n}=e,{meta:i}=r,[p,s,y]=i,_=(0,st.default)(i),m=new Date().toISOString(),l=new Date(`${p||m.slice(0,4)}-${s||"01"}-${y||"01"}`),u=((P=(c=n[o.toUpperCase()])==null?void 0:c.infoType)==null?void 0:P.notion)??t.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"day")}}]};default:return{and:[{property:u,date:{on_or_after:k(l,"")}},{property:u,date:{before:k(l,"day")}},g(S({},O.slug),{rich_text:{equals:a}})]}}},so=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:a,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=e,y={},_={},m=s[i.toUpperCase()].page_id__seo,l=await a({page_id:m});l.object==="page"&&(_=(0,L.default)(l,"properties"),_.properties=(0,X.sortObject)(w({config:e,data:l,pathVariables:n,pageId:l.id}))),y=await r({block_id:_.id});let u=[{property:t.datePublished.notion,direction:"descending"}],c=io({config:e,pathVariables:n,routeType:i,slug:p}),P=s[i.toUpperCase()].database_id,h=await o({database_id:P,filter:c,sorts:u}),f=[];(0,it.default)(h.results,R=>{let G=(0,L.default)(R,"properties");G.properties=(0,X.sortObject)(w({config:e,data:R,pathVariables:n,pageId:G.id})),G&&f.push(G)});let E=(0,L.default)(h,"results");E.results=f;let C=(0,L.default)(E,"data");return{info:_,content:y,items:C,images:{}}},ee=so;var at=require("@jeromefitz/utils"),lt=d(require("lodash/omit.js"),1);var ao=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getDeepFetchAllChildren:a,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=e,y=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(y))return{info:{},content:{},items:{},images:{}};let m=await o({database_id:s[y].database_id,filter:{and:[g(S({},O.slug),{rich_text:{equals:p}})]}}),l=(m==null?void 0:m.object)==="list"&&m.results[0];if(!l)return{};let u=(0,lt.default)(l,"properties");u.properties=(0,at.sortObject)(w({config:e,data:l,pathVariables:n,pageId:u.id}));let c=await r({block_id:u.id}),h=[...await a({blocks:c.results})];return{info:u,content:h,items:{},images:{}}},te=ao;var oe=require("@jeromefitz/utils"),re=d(require("lodash/omit.js"),1),pt=d(require("lodash/size.js"),1);var lo=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:a,pathVariables:n,routeType:i})=>{var C;let{NOTION:p}=e,{meta:s}=n,y=i.toUpperCase(),[_,m]=s,l=(0,pt.default)(s)===2,u=(C=p[y])==null?void 0:C.hasChild.toUpperCase(),c=await o({database_id:p[l?p[u].routeType.toUpperCase():y].database_id,filter:{and:[g(S({},O.slug),{rich_text:{equals:l?m:_}})]}}),P=(c==null?void 0:c.object)==="list"&&c.results[0];if(!P)return{info:{},content:{},items:{},images:{}};let h=(0,re.default)(P,"properties");h.properties=(0,oe.sortObject)(w({config:e,data:P,pathVariables:n,pageId:h.id}));let f=await r({block_id:h.id}),E={};return l||(E=await a({config:e,reqQuery:{podcasts:h.id,databaseType:p[u].routeType.toUpperCase()}})),{info:h,content:f,items:E,images:{}}},po=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:a,routeType:n,slug:i})=>{var C,R;let p=new Date().toISOString(),{NOTION:s}=e,{meta:y}=a,[_,m,l]=y,u=new Date(`${_||p.slice(0,4)}-${m||"01"}-${l||"01"}`),c=((R=(C=s[n.toUpperCase()])==null?void 0:C.infoType)==null?void 0:R.notion)??t.datePublished.notion,P=await o({database_id:s[n.toUpperCase()].database_id,filter:{and:[{property:c,date:{on_or_after:k(u,"")}},{property:c,date:{before:k(u,"day")}},g(S({},O.slug),{rich_text:{equals:i}})]}}),h=(P==null?void 0:P.object)==="list"&&P.results[0];if(!h)return{info:{},content:{},items:{},images:{}};let f=(0,re.default)(h,"properties");f.properties=(0,oe.sortObject)(w({config:e,data:h,pathVariables:a,pageId:f.id}));let E=await r({block_id:f.id});return{info:f,content:E,items:{},images:{}}},_o=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:a,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:y}=e;return s[i.toUpperCase()].hasChild?await lo({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:a,pathVariables:n,routeType:i}):y[T.LISTING_BY_DATE].includes(i.toUpperCase())?await po({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:n,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},ne=_o;var V=require("@jeromefitz/utils"),uo=async({getPagesRetrieve:e,page_id:r})=>(0,V.isUndefined)(r)?[]:(await(0,V.avoidRateLimit)(0),await e({page_id:r})),ie=uo;var se=d(require("lodash/drop.js"),1),_t=d(require("lodash/dropRight.js"),1),ut=d(require("lodash/first.js"),1),ae=d(require("lodash/includes.js"),1),dt=d(require("lodash/isInteger.js"),1),ct=d(require("lodash/join.js"),1),yt=d(require("lodash/last.js"),1),le=d(require("lodash/size.js"),1);var co=({config:e,catchAll:r})=>{let{NOTION:o,PAGES__HOMEPAGE:a,ROUTE_META:n,ROUTE_TYPES:i}=e,p=(0,le.default)(r),s=(0,ut.default)(r),y=s.toUpperCase(),_=(0,yt.default)(r),m=p>1&&(0,ae.default)(n,y)?(0,se.default)(r):(0,se.default)((0,_t.default)(r)),l=s===_&&!(0,ae.default)(i,y)?o.PAGES.routeType:s,u=s!==_&&!(0,dt.default)(parseInt(_))?_:s,c=l===o.PAGES.routeType.toLowerCase(),P=u===s,h=!!m&&(0,le.default)(m)!==0,f=c&&s===a?"":(0,ct.default)(r,"/"),E={hasMeta:h,isPage:c,isIndex:P,meta:m,routeType:l,slug:u,url:f},C=j(E);return g(S({},E),{dataType:C})},pe=co;var H=require("@jeromefitz/utils"),mt=d(require("lodash/map.js"),1),ht=d(require("lodash/omit.js"),1),Pt=d(require("lodash/size.js"),1);var yo=[{property:t.slug.notion,direction:"ascending"}],mo=async({config:e,reqQuery:r,notionDatabasesQuery:o})=>{let{NOTION:a}=e,{databaseType:n}=r,i=n,p=!1,s=n.toUpperCase(),y=a[s].database_id;if(!y)return[];let _={},m={},l,u;if(n==="EPISODES"){u=yo;let{podcasts:c}=r,P=[],h=[];c&&h.push(...c==null?void 0:c.split(",")),(0,Pt.default)(h)>0&&(0,mt.default)(h,f=>P.push({property:t.relationEpisodes__Podcasts.notion,relation:{contains:f}})),l={or:[...P]}}else p=!0;if(!p&&(!_||(0,H.isObjectEmpty)(_))){await(0,H.avoidRateLimit)(0);let c;l?((l==null?void 0:l.or.length)===0&&(l={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),c=await o({database_id:y,filter:l,sorts:u}),_=c,m=Ae({config:e,results:c.results,routeType:i}),_=(0,ht.default)(_,"results"),_.results=m):p=!0}return _},_e=mo;var ue=class extends St.Client{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await F(g(S({},o),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async o=>await Q(g(S({},o),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async o=>await W(g(S({},o),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:o=>Y(g(S({},o),{config:this.#e})),getPagesById:async o=>await ie(g(S({},o),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:o=>pe(g(S({},o),{config:this.#e})),getQuery:async o=>await _e(g(S({},o),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[T.LISTING]:async o=>await J(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[T.LISTING_BY_DATE]:async o=>await ee(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[T.SLUG]:async o=>await te(g(S({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[T.SLUG_BY_ROUTE]:async o=>await ne(g(S({},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};0&&(module.exports={Client});
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ge=Object.defineProperty,Ne=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var Ue=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var Z=(e,o,n)=>o in e?Ge(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,P=(e,o)=>{for(var n in o||(o={}))Ue.call(o,n)&&Z(e,n,o[n]);if(q)for(var n of q(o))Me.call(o,n)&&Z(e,n,o[n]);return e},S=(e,o)=>Ne(e,Ae(o));import{Client as lo}from"@notionhq/client";import b from"lodash/filter.js";import Ve from"lodash/map.js";var k=({key:e,notion:o,type:n})=>({key:e,notion:o,type:n}),t={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"}},I=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.seoKeywords,t.title],X=[...I],ee=[...I,t.author,t.status,t.subtitle],te=[...I,t.dateRecorded,t.duration,t.episode,t.mp3,t.season,t.relationEpisodes__People_Guest,t.relationEpisodes__People_Sound_Engineer,t.relationEpisodes__People_Thanks,t.relationEpisodes__Podcasts,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type,t.rollupEpisodes__Podcasts,t.rollupEpisodes__PodcastsSlugs],oe=[...I,t.dateEvent,t.relationEvents__People_Guest_Music,t.relationEvents__People_Guest,t.relationEvents__People_Host,t.relationEvents__Shows_Lineup,t.relationEvents__Shows,t.relationEvents__Venues,t.socialFacebook,t.socialWebsite,t.ticketUrl,t.rollupEvents__People_Cast,t.rollupEvents__People_Guest_Music,t.rollupEvents__People_Guest,t.rollupEvents__People_Host,t.rollupEvents__Shows_Lineup,t.rollupEvents__Shows,t.rollupEvents__Venues],re=[...I],ne=[...I,t.email,t.nameFirst,t.nameLast,t.namePreferred,t.relationPeople__Episodes_Guest,t.relationPeople__Episodes_Sound_Engineer,t.relationPeople__Episodes_Thanks,t.relationPeople__Events_Guest,t.relationPeople__Events_Guest_Music,t.relationPeople__Events_Host,t.relationPeople__Podcasts_Host,t.relationPeople__Podcasts_Sound_Engineer,t.relationPeople__Shows_Cast,t.relationPeople__Shows_Cast_Past,t.relationPeople__Shows_Director,t.relationPeople__Shows_Director_Musical,t.relationPeople__Shows_Director_Technical,t.relationPeople__Shows_Producer,t.relationPeople__Shows_Thanks,t.relationPeople__Shows_Writer],ie=[...I,t.categories,t.explicit,t.podcastAuthor,t.podcastAuthorEmail,t.relationPodcasts__People_Host,t.relationPodcasts__People_Sound_Engineer,t.socialApple,t.socialSpotify,t.type,t.relationPodcasts__Episodes,t.rollupPodcasts__Episodes,t.rollupPodcasts__EpisodesSlugs],se=[...I],ae=[...I,t.relationShows__People_Cast,t.relationShows__People_Cast_Past,t.relationShows__People_Director,t.relationShows__People_Director_Musical,t.relationShows__People_Director_Technical,t.relationShows__People_Producer,t.relationShows__People_Thanks,t.relationShows__People_Writer,t.relationShows__Tags,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationShows__Events,t.relationShows__Events_Lineup,t.rollupShows__People_Cast,t.rollupShows__People_Cast_Slug,t.rollupShows__People_Cast_Past,t.rollupShows__People_Crew,t.rollupShows__People_Director,t.rollupShows__People_Director_Musical,t.rollupShows__People_Director_Technical,t.rollupShows__People_Music,t.rollupShows__People_Producer,t.rollupShows__People_Thanks,t.rollupShows__People_Writer,t.rollupShows__Tags],le=[...I,t.addressCity,t.addressLatitude,t.addressLongitude,t.addressNeighborhood,t.addressState,t.addressStreet,t.addressZipCode,t.phoneNumber,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationVenues__Episodes,t.relationVenues__Events],yo={BLOG:b(X,{init:!0}),BOOKS:b(ee,{init:!0}),EPISODES:b(te,{init:!0}),EVENTS:b(oe,{init:!0}),PAGES:b(re,{init:!0}),PEOPLE:b(ne,{init:!0}),PODCASTS:b(ie,{init:!0}),SEO:b(se,{init:!0}),SHOWS:b(ae,{init:!0}),VENUES:b(le,{init:!0})},pe={BLOG:X.map(e=>k(e)),BOOKS:ee.map(e=>k(e)),EPISODES:te.map(e=>k(e)),EVENTS:oe.map(e=>k(e)),PAGES:re.map(e=>k(e)),PEOPLE:ne.map(e=>k(e)),PODCASTS:ie.map(e=>k(e)),SEO:se.map(e=>k(e)),SHOWS:ae.map(e=>k(e)),VENUES:le.map(e=>k(e))},_e=Ve(t,e=>k(e)),J=new Date().toISOString(),C={dateBefore:{property:t.datePublished.notion,date:{before:J}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:J}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,rich_text:{equals:""}}},He="LISTING",Fe="LISTING_BY_DATE",Qe="SLUG",We="SLUG_BY_ROUTE",Ye=[He,Fe,Qe,We],w=Object.assign({},...Ye.map(e=>({[e]:e})).flat(1));import{avoidRateLimit as ze,isUndefined as je}from"@jeromefitz/utils";var $e=async({getBlocksChildrenList:e,block_id:o})=>je(o)?[]:(await ze(0),await e({block_id:o})),N=$e;var v={sorts:[{property:t.slug.notion,direction:"ascending"}]},Ke=async({database_id:e,filter:o=v==null?void 0:v.filter,getDatabasesQuery:n,sorts:l=v==null?void 0:v.sorts})=>e?await n({database_id:e,sorts:l,filter:o}):[],A=Ke;var ue=async({getBlocksChildrenList:e,blocks:o})=>{if(o==null)return o;let n=o.filter(r=>r.has_children).map(r=>{let{id:i}=r;return{promise:e({block_id:i,page_size:100}),parent_block:r}}),l=await Promise.all(n.map(r=>r.promise));for(let r=0;r<l.length;r++){let i=l[r].results;if(await ue({blocks:i,getBlocksChildrenList:e}),n[r]){let p=n[r].parent_block;p[p.type].children=i}}return o},U=ue;var qe=({config:e,item:o,routeType:n,meta:l})=>{var _,y;let{NOTION:r}=e,i="",p=(_=o.properties)==null?void 0:_.slug,s="",c="/[...catchAll]";switch(n){case r.BLOG.routeType:case r.EVENTS.routeType:i=(y=o.properties[r[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 r.PODCASTS.routeType:case r.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}},M=qe;import{sortObject as Ce}from"@jeromefitz/utils";import Bt from"lodash/map.js";import F from"lodash/omit.js";import de from"date-fns/addDays/index.js";import Ze from"date-fns/addMonths/index.js";import Je from"date-fns/addYears/index.js";var Xe=(e,o)=>{switch(o){case"year":return Je(e,1).toISOString();case"month":return Ze(e,1).toISOString();case"day":return de(e,2).toISOString()}return de(e,-1).toISOString()},T=Xe;import et from"lodash/map.js";var tt=({config:e,data:o,pathVariables:n,pageId:l})=>{var _,y;let{NOTION:r}=e,i={};if(!(o!=null&&o.properties))return i;let{properties:p}=o,s="";if(n){let{meta:a,routeType:u}=n;s=u===((_=r==null?void 0:r.PODCASTS)==null?void 0:_.routeType)&&a.length>1?(y=r==null?void 0:r.EPISODES)==null?void 0:y.routeType:u}let c=s?pe[s.toUpperCase()]:_e;return et(c,a=>{let u,d=p[a.notion];i[a.key]=null,d&&(u=O[a.type](d,l),i[a.key]=u||null)}),i},E=tt;import{sortObject as ot}from"@jeromefitz/utils";import rt from"lodash/map.js";import nt from"lodash/omit.js";var it=({config:e,results:o,routeType:n})=>{let l=[];return rt(o,r=>{let i=nt(r,"properties");i.properties=ot(E({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),l.push(i)}),l},ce=it;var st=({isPage:e,isIndex:o,hasMeta:n})=>e?w.SLUG:o&&!n?w.LISTING:o&&n?w.LISTING_BY_DATE:n?w.SLUG_BY_ROUTE:w.SLUG,V=st;var at=e=>(console.dir("@notion(_unsupported)"),e),B=at;var lt=e=>e.checkbox||!1,ye=lt;var pt=e=>{let{type:o}=e;return e[o]},L=pt;var _t=e=>e.email||null,me=_t;import{stringToUUID as ut}from"@jeromefitz/utils";import dt from"github-slugger";import ct from"lodash/size.js";var yt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",mt=(e,o)=>yt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",ut(o)),ht=(e,o)=>{let n=new dt,l={};return ct(e.files)<=0||e.files.map(r=>{var i,p;if((r==null?void 0:r.type)==="file"){let s=(i=r==null?void 0:r.file)==null?void 0:i.url.split("?")[0],c=n.slug(s);l[c]={type:r==null?void 0:r.type,url:mt(s,o)}}if((r==null?void 0:r.type)==="external"){let s=(p=r==null?void 0:r.external)==null?void 0:p.url.split("?")[0],c=n.slug(s);l[c]={type:r==null?void 0:r.type,url:s}}}),l},H=ht;import Pt from"github-slugger";import St from"lodash/map.js";var gt=e=>{let o=new Pt,n={};return St(e.multi_select,l=>{let r=l;r.slug=o.slug(r.name),n[r.id]=r}),n},he=gt;var ft=e=>(e==null?void 0:e.number)||null,Pe=ft;import Et from"github-slugger";var wt=e=>{let o=new Et;return e.people.map(n=>{let{avatar_url:l,id:r,name:i,person:p}=n,{email:s}=p;return{[o.slug(i)]:{avatar_url:l,email:s,id:r,name:i}}})[0]},Se=wt;var Tt=e=>(e==null?void 0:e.phone_number)||null,ge=Tt;import fe from"lodash/map.js";var kt=e=>e.type==="rollup"?e.rollup.type==="array"&&fe(e.rollup.array,o=>O[o.type](o))[0]:fe(e.relation,o=>o.id),Ee=kt;var bt=e=>{var o;return e!=null&&e.rich_text?(o=e==null?void 0:e.rich_text[0])==null?void 0:o.plain_text:null},we=bt;import Te from"lodash/map.js";import It from"lodash/sortBy.js";var Dt=e=>{let o=e==null?void 0:e.rollup;return It(Te(o==null?void 0:o.array,n=>Te(n[n==null?void 0:n.type],l=>O[n==null?void 0:n.type]({type:n==null?void 0:n.type,[n==null?void 0:n.type]:[l]})))).flat()},ke=Dt;import Ct from"github-slugger";var Ot=e=>{let o=new Ct,n=e.select;return n?(n.slug=o.slug(e.select.name),{[n.id]:n}):null},be=Ot;var vt=e=>{var o;return e!=null&&e.title?(o=e==null?void 0:e.title[0])==null?void 0:o.plain_text:null},Ie=vt;var xt=e=>e.url||null,De=xt;var Rt={checkbox:ye,created_by:B,created_time:L,date:L,email:me,files:H,formula:B,image:H,last_edited_by:B,last_edited_time:L,multi_select:he,number:Pe,people:Se,phone_number:ge,relation:Ee,rich_text:we,rollup:ke,select:be,title:Ie,url:De},O=Rt;var Lt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i})=>{let{NOTION:p}=e,s={},c=p[i.toUpperCase()].page_id__seo,_=await l({page_id:c});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=F(_,"properties"),s.properties=Ce(E({config:e,data:_,pathVariables:r,pageId:s.id})));let y=p[i.toUpperCase()].infoType.notion??t.datePublished.notion,a=y===t.datePublished.notion?new Date("2020-01-01").toISOString():new Date().toISOString(),u=await o({block_id:s.id}),d=await n({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:a}}]}}),h=[];Bt(d.results,g=>{let f=g;f=F(f,"properties"),f.properties=Ce(E({config:e,data:g,pathVariables:r,pageId:g.id})),h.push(f)});let m=F(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},Q=Lt;import{sortObject as Oe}from"@jeromefitz/utils";import Gt from"lodash/map.js";import G from"lodash/omit.js";import Nt from"lodash/size.js";var At=({config:e,pathVariables:o,routeType:n,slug:l})=>{var d,h;let{NOTION:r}=e,{meta:i}=o,[p,s,c]=i,_=Nt(i),y=new Date().toISOString(),a=new Date(`${p||y.slice(0,4)}-${s||"01"}-${c||"01"}`),u=((h=(d=r[n.toUpperCase()])==null?void 0:d.infoType)==null?void 0:h.notion)??t.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"day")}},S(P({},C.slug),{rich_text:{equals:l}})]}}},Ut=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,c={},_={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(_=G(a,"properties"),_.properties=Oe(E({config:e,data:a,pathVariables:r,pageId:a.id}))),c=await o({block_id:_.id});let u=[{property:t.datePublished.notion,direction:"descending"}],d=At({config:e,pathVariables:r,routeType:i,slug:p}),h=s[i.toUpperCase()].database_id,m=await n({database_id:h,filter:d,sorts:u}),g=[];Gt(m.results,x=>{let R=G(x,"properties");R.properties=Oe(E({config:e,data:x,pathVariables:r,pageId:R.id})),R&&g.push(R)});let f=G(m,"results");f.results=g;let D=G(f,"data");return{info:_,content:c,items:D,images:{}}},W=Ut;import{sortObject as Mt}from"@jeromefitz/utils";import Vt from"lodash/omit.js";var Ht=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getDeepFetchAllChildren:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,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:[S(P({},C.slug),{rich_text:{equals:p}})]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Vt(a,"properties");u.properties=Mt(E({config:e,data:a,pathVariables:r,pageId:u.id}));let d=await o({block_id:u.id}),m=[...await l({blocks:d.results})];return{info:u,content:m,items:{},images:{}}},Y=Ht;import{sortObject as ve}from"@jeromefitz/utils";import xe from"lodash/omit.js";import Ft from"lodash/size.js";var Qt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i})=>{var D;let{NOTION:p}=e,{meta:s}=r,c=i.toUpperCase(),[_,y]=s,a=Ft(s)===2,u=(D=p[c])==null?void 0:D.hasChild.toUpperCase(),d=await n({database_id:p[a?p[u].routeType.toUpperCase():c].database_id,filter:{and:[S(P({},C.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=xe(h,"properties");m.properties=ve(E({config:e,data:h,pathVariables:r,pageId:m.id}));let g=await o({block_id:m.id}),f={};return a||(f=await l({config:e,reqQuery:{podcasts:m.id,databaseType:p[u].routeType.toUpperCase()}})),{info:m,content:g,items:f,images:{}}},Wt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:l,routeType:r,slug:i})=>{var D,x;let p=new Date().toISOString(),{NOTION:s}=e,{meta:c}=l,[_,y,a]=c,u=new Date(`${_||p.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((x=(D=s[r.toUpperCase()])==null?void 0:D.infoType)==null?void 0:x.notion)??t.datePublished.notion,h=await n({database_id:s[r.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:T(u,"")}},{property:d,date:{before:T(u,"day")}},S(P({},C.slug),{rich_text:{equals:i}})]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let g=xe(m,"properties");g.properties=ve(E({config:e,data:m,pathVariables:l,pageId:g.id}));let f=await o({block_id:g.id});return{info:g,content:f,items:{},images:{}}},Yt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=e;return s[i.toUpperCase()].hasChild?await Qt({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i}):c[w.LISTING_BY_DATE].includes(i.toUpperCase())?await Wt({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:r,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},z=Yt;import{avoidRateLimit as zt,isUndefined as jt}from"@jeromefitz/utils";var $t=async({getPagesRetrieve:e,page_id:o})=>jt(o)?[]:(await zt(0),await e({page_id:o})),j=$t;import Re from"lodash/drop.js";import Kt from"lodash/dropRight.js";import qt from"lodash/first.js";import Be from"lodash/includes.js";import Zt from"lodash/isInteger.js";import Jt from"lodash/join.js";import Xt from"lodash/last.js";import Le from"lodash/size.js";var eo=({config:e,catchAll:o})=>{let{NOTION:n,PAGES__HOMEPAGE:l,ROUTE_META:r,ROUTE_TYPES:i}=e,p=Le(o),s=qt(o),c=s.toUpperCase(),_=Xt(o),y=p>1&&Be(r,c)?Re(o):Re(Kt(o)),a=s===_&&!Be(i,c)?n.PAGES.routeType:s,u=s!==_&&!Zt(parseInt(_))?_:s,d=a===n.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&Le(y)!==0,g=d&&s===l?"":Jt(o,"/"),f={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:g},D=V(f);return S(P({},f),{dataType:D})},$=eo;import{avoidRateLimit as to,isObjectEmpty as oo}from"@jeromefitz/utils";import ro from"lodash/map.js";import no from"lodash/omit.js";import io from"lodash/size.js";var so=[{property:t.slug.notion,direction:"ascending"}],ao=async({config:e,reqQuery:o,notionDatabasesQuery:n})=>{let{NOTION:l}=e,{databaseType:r}=o,i=r,p=!1,s=r.toUpperCase(),c=l[s].database_id;if(!c)return[];let _={},y={},a,u;if(r==="EPISODES"){u=so;let{podcasts:d}=o,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),io(m)>0&&ro(m,g=>h.push({property:t.relationEpisodes__Podcasts.notion,relation:{contains:g}})),a={or:[...h]}}else p=!0;if(!p&&(!_||oo(_))){await to(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await n({database_id:c,filter:a,sorts:u}),_=d,y=ce({config:e,results:d.results,routeType:i}),_=no(_,"results"),_.results=y):p=!0}return _},K=ao;var po=class extends lo{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await N(S(P({},o),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async o=>await A(S(P({},o),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async o=>await U(S(P({},o),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:o=>M(S(P({},o),{config:this.#e})),getPagesById:async o=>await j(S(P({},o),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:o=>$(S(P({},o),{config:this.#e})),getQuery:async o=>await K(S(P({},o),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[w.LISTING]:async o=>await Q(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[w.LISTING_BY_DATE]:async o=>await W(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[w.SLUG]:async o=>await Y(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[w.SLUG_BY_ROUTE]:async o=>await z(S(P({},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{po as Client};
|
|
1
|
+
var Ne=Object.defineProperty,Ae=Object.defineProperties;var Ue=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable;var Z=(e,r,o)=>r in e?Ne(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,P=(e,r)=>{for(var o in r||(r={}))Me.call(r,o)&&Z(e,o,r[o]);if(q)for(var o of q(r))Ve.call(r,o)&&Z(e,o,r[o]);return e},S=(e,r)=>Ae(e,Ue(r));import{Client as po}from"@notionhq/client";import b from"lodash/filter.js";import He from"lodash/map.js";var k=({key:e,notion:r,type:o})=>({key:e,notion:r,type:o}),t={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"}},I=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.seoKeywords,t.title],X=[...I],ee=[...I,t.author,t.status,t.subtitle],te=[...I,t.dateRecorded,t.duration,t.episode,t.mp3,t.season,t.relationEpisodes__People_Guest,t.relationEpisodes__People_Sound_Engineer,t.relationEpisodes__People_Thanks,t.relationEpisodes__Podcasts,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type,t.rollupEpisodes__Podcasts,t.rollupEpisodes__PodcastsSlugs],oe=[...I,t.dateEvent,t.relationEvents__People_Guest_Music,t.relationEvents__People_Guest,t.relationEvents__People_Host,t.relationEvents__Shows_Lineup,t.relationEvents__Shows,t.relationEvents__Venues,t.socialFacebook,t.socialWebsite,t.ticketUrl,t.rollupEvents__People_Cast,t.rollupEvents__People_Guest_Music,t.rollupEvents__People_Guest,t.rollupEvents__People_Host,t.rollupEvents__Shows_Lineup,t.rollupEvents__Shows,t.rollupEvents__Venues],re=[...I],ne=[...I,t.email,t.nameFirst,t.nameLast,t.namePreferred,t.relationPeople__Episodes_Guest,t.relationPeople__Episodes_Sound_Engineer,t.relationPeople__Episodes_Thanks,t.relationPeople__Events_Guest,t.relationPeople__Events_Guest_Music,t.relationPeople__Events_Host,t.relationPeople__Podcasts_Host,t.relationPeople__Podcasts_Sound_Engineer,t.relationPeople__Shows_Cast,t.relationPeople__Shows_Cast_Past,t.relationPeople__Shows_Director,t.relationPeople__Shows_Director_Musical,t.relationPeople__Shows_Director_Technical,t.relationPeople__Shows_Producer,t.relationPeople__Shows_Thanks,t.relationPeople__Shows_Writer],ie=[...I,t.categories,t.explicit,t.podcastAuthor,t.podcastAuthorEmail,t.relationPodcasts__People_Host,t.relationPodcasts__People_Sound_Engineer,t.socialApple,t.socialSpotify,t.type,t.relationPodcasts__Episodes,t.rollupPodcasts__Episodes,t.rollupPodcasts__EpisodesSlugs],se=[...I],ae=[...I,t.relationShows__People_Cast,t.relationShows__People_Cast_Past,t.relationShows__People_Director,t.relationShows__People_Director_Musical,t.relationShows__People_Director_Technical,t.relationShows__People_Producer,t.relationShows__People_Thanks,t.relationShows__People_Writer,t.relationShows__Tags,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationShows__Events,t.relationShows__Events_Lineup,t.rollupShows__People_Cast,t.rollupShows__People_Cast_Slug,t.rollupShows__People_Cast_Past,t.rollupShows__People_Crew,t.rollupShows__People_Director,t.rollupShows__People_Director_Musical,t.rollupShows__People_Director_Technical,t.rollupShows__People_Music,t.rollupShows__People_Producer,t.rollupShows__People_Thanks,t.rollupShows__People_Writer,t.rollupShows__Tags],le=[...I,t.addressCity,t.addressLatitude,t.addressLongitude,t.addressNeighborhood,t.addressState,t.addressStreet,t.addressZipCode,t.phoneNumber,t.socialFacebook,t.socialInstagram,t.socialTwitter,t.socialWebsite,t.relationVenues__Episodes,t.relationVenues__Events],yo={BLOG:b(X,{init:!0}),BOOKS:b(ee,{init:!0}),EPISODES:b(te,{init:!0}),EVENTS:b(oe,{init:!0}),PAGES:b(re,{init:!0}),PEOPLE:b(ne,{init:!0}),PODCASTS:b(ie,{init:!0}),SEO:b(se,{init:!0}),SHOWS:b(ae,{init:!0}),VENUES:b(le,{init:!0})},pe={BLOG:X.map(e=>k(e)),BOOKS:ee.map(e=>k(e)),EPISODES:te.map(e=>k(e)),EVENTS:oe.map(e=>k(e)),PAGES:re.map(e=>k(e)),PEOPLE:ne.map(e=>k(e)),PODCASTS:ie.map(e=>k(e)),SEO:se.map(e=>k(e)),SHOWS:ae.map(e=>k(e)),VENUES:le.map(e=>k(e))},_e=He(t,e=>k(e)),J=new Date().toISOString(),C={dateBefore:{property:t.datePublished.notion,date:{before:J}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:J}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,rich_text:{equals:""}}},Fe="LISTING",Qe="LISTING_BY_DATE",We="SLUG",Ye="SLUG_BY_ROUTE",ze=[Fe,Qe,We,Ye],w=Object.assign({},...ze.map(e=>({[e]:e})).flat(1));import{avoidRateLimit as je,isUndefined as $e}from"@jeromefitz/utils";var Ke=async({getBlocksChildrenList:e,block_id:r})=>$e(r)?[]:(await je(0),await e({block_id:r})),N=Ke;var v={sorts:[{property:t.slug.notion,direction:"ascending"}]},qe=async({database_id:e,filter:r=v==null?void 0:v.filter,getDatabasesQuery:o,sorts:l=v==null?void 0:v.sorts})=>e?await o({database_id:e,sorts:l,filter:r}):[],A=qe;var ue=async({getBlocksChildrenList:e,blocks:r})=>{if(r==null)return r;let o=r.filter(n=>n.has_children).map(n=>{let{id:i}=n;return{promise:e({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 ue({blocks:i,getBlocksChildrenList:e}),o[n]){let p=o[n].parent_block;p[p.type].children=i}}return r},U=ue;var Ze=({config:e,item:r,routeType:o,meta:l})=>{var _,y;let{NOTION:n}=e,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}},M=Ze;import{sortObject as Ce}from"@jeromefitz/utils";import Lt from"lodash/map.js";import F from"lodash/omit.js";import de from"date-fns/addDays/index.js";import Je from"date-fns/addMonths/index.js";import Xe from"date-fns/addYears/index.js";var et=(e,r)=>{switch(r){case"year":return Xe(e,1).toISOString();case"month":return Je(e,1).toISOString();case"day":return de(e,2).toISOString()}return de(e,-1).toISOString()},T=et;import tt from"lodash/map.js";var ot=({config:e,data:r,pathVariables:o,pageId:l})=>{var _,y;let{NOTION:n}=e,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?pe[s.toUpperCase()]:_e;return tt(c,a=>{let u,d=p[a.notion];i[a.key]=null,d&&(u=O[a.type](d,l),i[a.key]=u||null)}),i},E=ot;import{sortObject as rt}from"@jeromefitz/utils";import nt from"lodash/map.js";import it from"lodash/omit.js";var st=({config:e,results:r,routeType:o})=>{let l=[];return nt(r,n=>{let i=it(n,"properties");i.properties=rt(E({config:e,data:n,pathVariables:o,pageId:n==null?void 0:n.id})),l.push(i)}),l},ce=st;var at=({isPage:e,isIndex:r,hasMeta:o})=>e?w.SLUG:r&&!o?w.LISTING:r&&o?w.LISTING_BY_DATE:o?w.SLUG_BY_ROUTE:w.SLUG,V=at;var lt=e=>(console.dir("@notion(_unsupported)"),e),B=lt;var pt=e=>e.checkbox||!1,ye=pt;var _t=e=>{let{type:r}=e;return e[r]},L=_t;var ut=e=>e.email||null,me=ut;import{stringToUUID as dt}from"@jeromefitz/utils";import ct from"github-slugger";import yt from"lodash/size.js";var mt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",ht=(e,r)=>mt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",dt(r)),Pt=(e,r)=>{let o=new ct,l={};return yt(e.files)<=0||e.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:ht(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},H=Pt;import St from"github-slugger";import gt from"lodash/map.js";var ft=e=>{let r=new St,o={};return gt(e.multi_select,l=>{let n=l;n.slug=r.slug(n.name),o[n.id]=n}),o},he=ft;var Et=e=>(e==null?void 0:e.number)||null,Pe=Et;import wt from"github-slugger";var Tt=e=>{let r=new wt;return e.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]},Se=Tt;var kt=e=>(e==null?void 0:e.phone_number)||null,ge=kt;import fe from"lodash/map.js";var bt=e=>e.type==="rollup"?e.rollup.type==="array"&&fe(e.rollup.array,r=>O[r.type](r))[0]:fe(e.relation,r=>r.id),Ee=bt;var It=e=>{var r;return e!=null&&e.rich_text?(r=e==null?void 0:e.rich_text[0])==null?void 0:r.plain_text:null},we=It;import Te from"lodash/map.js";import Dt from"lodash/sortBy.js";var Ct=e=>{let r=e==null?void 0:e.rollup;return Dt(Te(r==null?void 0:r.array,o=>Te(o[o==null?void 0:o.type],l=>O[o==null?void 0:o.type]({type:o==null?void 0:o.type,[o==null?void 0:o.type]:[l]})))).flat()},ke=Ct;import Ot from"github-slugger";var vt=e=>{let r=new Ot,o=e.select;return o?(o.slug=r.slug(e.select.name),{[o.id]:o}):null},be=vt;var xt=e=>{var r;return e!=null&&e.title?(r=e==null?void 0:e.title[0])==null?void 0:r.plain_text:null},Ie=xt;var Rt=e=>e.url||null,De=Rt;var Bt={checkbox:ye,created_by:B,created_time:L,date:L,email:me,files:H,formula:B,image:H,last_edited_by:B,last_edited_time:L,multi_select:he,number:Pe,people:Se,phone_number:ge,relation:Ee,rich_text:we,rollup:ke,select:be,title:Ie,url:De},O=Bt;var Gt=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i})=>{let{NOTION:p}=e,s={},c=p[i.toUpperCase()].page_id__seo,_=await l({page_id:c});if(!_)return{};(_==null?void 0:_.object)==="page"&&(s=F(_,"properties"),s.properties=Ce(E({config:e,data:_,pathVariables:n,pageId:s.id})));let y=p[i.toUpperCase()].infoType.notion??t.datePublished.notion,a=y===t.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=[];Lt(d.results,g=>{let f=g;f=F(f,"properties"),f.properties=Ce(E({config:e,data:g,pathVariables:n,pageId:g.id})),h.push(f)});let m=F(d,"results");return m.results=h,{info:s,content:u,items:m,images:{}}},Q=Gt;import{sortObject as Oe}from"@jeromefitz/utils";import Nt from"lodash/map.js";import G from"lodash/omit.js";import At from"lodash/size.js";var Ut=({config:e,pathVariables:r,routeType:o,slug:l})=>{var d,h;let{NOTION:n}=e,{meta:i}=r,[p,s,c]=i,_=At(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)??t.datePublished.notion;switch(_){case 1:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:T(a,"")}},{property:u,date:{before:T(a,"day")}},S(P({},C.slug),{rich_text:{equals:l}})]}}},Mt=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getPagesById:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=e,c={},_={},y=s[i.toUpperCase()].page_id__seo,a=await l({page_id:y});a.object==="page"&&(_=G(a,"properties"),_.properties=Oe(E({config:e,data:a,pathVariables:n,pageId:a.id}))),c=await r({block_id:_.id});let u=[{property:t.datePublished.notion,direction:"descending"}],d=Ut({config:e,pathVariables:n,routeType:i,slug:p}),h=s[i.toUpperCase()].database_id,m=await o({database_id:h,filter:d,sorts:u}),g=[];Nt(m.results,x=>{let R=G(x,"properties");R.properties=Oe(E({config:e,data:x,pathVariables:n,pageId:R.id})),R&&g.push(R)});let f=G(m,"results");f.results=g;let D=G(f,"data");return{info:_,content:c,items:D,images:{}}},W=Mt;import{sortObject as Vt}from"@jeromefitz/utils";import Ht from"lodash/omit.js";var Ft=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getDeepFetchAllChildren:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s}=e,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:[S(P({},C.slug),{rich_text:{equals:p}})]}}),a=(y==null?void 0:y.object)==="list"&&y.results[0];if(!a)return{};let u=Ht(a,"properties");u.properties=Vt(E({config:e,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:{}}},Y=Ft;import{sortObject as ve}from"@jeromefitz/utils";import xe from"lodash/omit.js";import Qt from"lodash/size.js";var Wt=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i})=>{var D;let{NOTION:p}=e,{meta:s}=n,c=i.toUpperCase(),[_,y]=s,a=Qt(s)===2,u=(D=p[c])==null?void 0:D.hasChild.toUpperCase(),d=await o({database_id:p[a?p[u].routeType.toUpperCase():c].database_id,filter:{and:[S(P({},C.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=xe(h,"properties");m.properties=ve(E({config:e,data:h,pathVariables:n,pageId:m.id}));let g=await r({block_id:m.id}),f={};return a||(f=await l({config:e,reqQuery:{podcasts:m.id,databaseType:p[u].routeType.toUpperCase()}})),{info:m,content:g,items:f,images:{}}},Yt=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:l,routeType:n,slug:i})=>{var D,x;let p=new Date().toISOString(),{NOTION:s}=e,{meta:c}=l,[_,y,a]=c,u=new Date(`${_||p.slice(0,4)}-${y||"01"}-${a||"01"}`),d=((x=(D=s[n.toUpperCase()])==null?void 0:D.infoType)==null?void 0:x.notion)??t.datePublished.notion,h=await o({database_id:s[n.toUpperCase()].database_id,filter:{and:[{property:d,date:{on_or_after:T(u,"")}},{property:d,date:{before:T(u,"day")}},S(P({},C.slug),{rich_text:{equals:i}})]}}),m=(h==null?void 0:h.object)==="list"&&h.results[0];if(!m)return{info:{},content:{},items:{},images:{}};let g=xe(m,"properties");g.properties=ve(E({config:e,data:m,pathVariables:l,pageId:g.id}));let f=await r({block_id:g.id});return{info:g,content:f,items:{},images:{}}},zt=async({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:c}=e;return s[i.toUpperCase()].hasChild?await Wt({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,getQuery:l,pathVariables:n,routeType:i}):c[w.LISTING_BY_DATE].includes(i.toUpperCase())?await Yt({config:e,getBlocksByIdChildren:r,getDatabasesByIdQuery:o,pathVariables:n,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},z=zt;import{avoidRateLimit as jt,isUndefined as $t}from"@jeromefitz/utils";var Kt=async({getPagesRetrieve:e,page_id:r})=>$t(r)?[]:(await jt(0),await e({page_id:r})),j=Kt;import Re from"lodash/drop.js";import qt from"lodash/dropRight.js";import Zt from"lodash/first.js";import Be from"lodash/includes.js";import Jt from"lodash/isInteger.js";import Xt from"lodash/join.js";import eo from"lodash/last.js";import Le from"lodash/size.js";var to=({config:e,catchAll:r})=>{let{NOTION:o,PAGES__HOMEPAGE:l,ROUTE_META:n,ROUTE_TYPES:i}=e,p=Le(r),s=Zt(r),c=s.toUpperCase(),_=eo(r),y=p>1&&Be(n,c)?Re(r):Re(qt(r)),a=s===_&&!Be(i,c)?o.PAGES.routeType:s,u=s!==_&&!Jt(parseInt(_))?_:s,d=a===o.PAGES.routeType.toLowerCase(),h=u===s,m=!!y&&Le(y)!==0,g=d&&s===l?"":Xt(r,"/"),f={hasMeta:m,isPage:d,isIndex:h,meta:y,routeType:a,slug:u,url:g},D=V(f);return S(P({},f),{dataType:D})},$=to;import{avoidRateLimit as oo,isObjectEmpty as ro}from"@jeromefitz/utils";import no from"lodash/map.js";import io from"lodash/omit.js";import so from"lodash/size.js";var ao=[{property:t.slug.notion,direction:"ascending"}],lo=async({config:e,reqQuery:r,notionDatabasesQuery:o})=>{let{NOTION:l}=e,{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=ao;let{podcasts:d}=r,h=[],m=[];d&&m.push(...d==null?void 0:d.split(",")),so(m)>0&&no(m,g=>h.push({property:t.relationEpisodes__Podcasts.notion,relation:{contains:g}})),a={or:[...h]}}else p=!0;if(!p&&(!_||ro(_))){await oo(0);let d;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),d=await o({database_id:c,filter:a,sorts:u}),_=d,y=ce({config:e,results:d.results,routeType:i}),_=io(_,"results"),_.results=y):p=!0}return _},K=lo;var Ge=class extends po{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await N(S(P({},o),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async o=>await A(S(P({},o),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async o=>await U(S(P({},o),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:o=>M(S(P({},o),{config:this.#e})),getPagesById:async o=>await j(S(P({},o),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:o=>$(S(P({},o),{config:this.#e})),getQuery:async o=>await K(S(P({},o),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[w.LISTING]:async o=>await Q(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[w.LISTING_BY_DATE]:async o=>await W(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[w.SLUG]:async o=>await Y(S(P({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[w.SLUG_BY_ROUTE]:async o=>await z(S(P({},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{Ge as Client};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeromefitz/notion",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Notion: Custom Client for jeromefitzgerald.com",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jerome Fitzgerald",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"directory": "packages/notion"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=16"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,28 +30,31 @@
|
|
|
30
30
|
"dev": "tsup-node --watch",
|
|
31
31
|
"---": "",
|
|
32
32
|
"clean": "rm -rf .turbo && rm -rf dist",
|
|
33
|
-
"clean:install": "
|
|
33
|
+
"clean:install": "pnpm run clean && rm -rf node_modules",
|
|
34
34
|
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
|
|
35
35
|
"--- ": "",
|
|
36
36
|
"lint:eslint": "eslint ./src --ext cjs,js,jsx,mjs,ts,tsx --max-warnings=0",
|
|
37
37
|
"lint:prettier": "prettier \"./src/**/*.{cjs,js,jsx,mjs,ts,tsx,json,md,mdx,css,html,yml,yaml,scss}\" --ignore-unknown --loglevel warn",
|
|
38
|
-
"lint": "
|
|
39
|
-
"lint:fix": "
|
|
38
|
+
"lint": "pnpm run lint:prettier --check && pnpm run lint:eslint",
|
|
39
|
+
"lint:fix": "pnpm run lint:eslint --fix && pnpm run lint:prettier --write",
|
|
40
40
|
"--- ": "",
|
|
41
|
-
"semantic-release": "semantic-release"
|
|
42
|
-
"semantic-release:mono": "semantic-release -e semantic-release-monorepo"
|
|
41
|
+
"semantic-release": "semantic-release"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
44
|
"@notionhq/client": "1.0.4",
|
|
46
45
|
"date-fns": "2.28.0",
|
|
47
|
-
"date-fns-tz": "1.3.
|
|
46
|
+
"date-fns-tz": "1.3.5",
|
|
48
47
|
"github-slugger": "1.4.0",
|
|
49
48
|
"lodash": "4.17.21"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
51
|
+
"@jeromefitz/utils": "workspace:*",
|
|
52
52
|
"@types/github-slugger": "1.3.0",
|
|
53
53
|
"@types/lodash": "4.14.182"
|
|
54
54
|
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@jeromefitz/utils": ">= 2.1.0"
|
|
57
|
+
},
|
|
55
58
|
"type": "module",
|
|
56
59
|
"sideEffects": false,
|
|
57
60
|
"typings": "./index.d.ts",
|