@jeromefitz/notion 2.0.1 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +38 -9
  2. package/index.cjs +1 -1
  3. package/index.d.ts +70 -33
  4. package/index.js +1 -1
  5. package/package.json +12 -8
  6. package/queries/getBlocksByIdChildren/index.cjs +1 -1
  7. package/queries/getBlocksByIdChildren/index.d.ts +2 -1
  8. package/queries/getBlocksByIdChildren/index.js +1 -1
  9. package/queries/getDatabasesByIdQuery/index.cjs +1 -1
  10. package/queries/getDatabasesByIdQuery/index.d.ts +6 -3
  11. package/queries/getDatabasesByIdQuery/index.js +1 -1
  12. package/queries/getDeepFetchAllChildren/index.cjs +1 -1
  13. package/queries/getDeepFetchAllChildren/index.d.ts +2 -1
  14. package/queries/getDeepFetchAllChildren/index.js +1 -1
  15. package/queries/getInfoType/index.cjs +1 -1
  16. package/queries/getInfoType/index.js +1 -1
  17. package/queries/getNotionListing/index.cjs +1 -1
  18. package/queries/getNotionListing/index.d.ts +11 -1
  19. package/queries/getNotionListing/index.js +1 -1
  20. package/queries/getNotionListingByDate/index.cjs +1 -1
  21. package/queries/getNotionListingByDate/index.d.ts +1 -1
  22. package/queries/getNotionListingByDate/index.js +1 -1
  23. package/queries/getNotionSlug/index.cjs +1 -1
  24. package/queries/getNotionSlug/index.d.ts +8 -3
  25. package/queries/getNotionSlug/index.js +1 -1
  26. package/queries/getNotionSlugByRoute/index.cjs +1 -1
  27. package/queries/getNotionSlugByRoute/index.d.ts +6 -1
  28. package/queries/getNotionSlugByRoute/index.js +1 -1
  29. package/queries/getPagesById/index.cjs +1 -1
  30. package/queries/getPagesById/index.d.ts +2 -1
  31. package/queries/getPagesById/index.js +1 -1
  32. package/queries/getPathVariables/index.cjs +1 -1
  33. package/queries/getPathVariables/index.js +1 -1
  34. package/queries/getQuery/index.cjs +1 -1
  35. package/queries/getQuery/index.js +1 -1
  36. package/queries/index.cjs +1 -1
  37. package/queries/index.js +1 -1
  38. package/schema/index.cjs +1 -1
  39. package/schema/index.d.ts +15 -1
  40. package/utils/dataNormalized/index.cjs +1 -1
  41. package/utils/dataNormalized/index.d.ts +5 -0
  42. package/utils/dataNormalized/index.js +1 -1
  43. package/utils/dataNormalizedResults/index.cjs +1 -1
  44. package/utils/dataNormalizedResults/index.d.ts +6 -0
  45. package/utils/dataNormalizedResults/index.js +1 -1
  46. package/utils/getDataType/index.cjs +1 -0
  47. package/utils/getDataType/index.d.ts +60 -0
  48. package/utils/getDataType/index.js +1 -0
  49. package/utils/getTitle/index.cjs +1 -1
  50. package/utils/getTitle/index.d.ts +4 -0
  51. package/utils/getTitle/index.js +1 -1
  52. package/utils/getTypes/_unsupported.cjs +1 -1
  53. package/utils/getTypes/_unsupported.js +1 -1
  54. package/utils/getTypes/index.cjs +1 -1
  55. package/utils/getTypes/index.js +1 -1
  56. package/utils/getTypes/relation.cjs +1 -1
  57. package/utils/getTypes/relation.js +1 -1
  58. package/utils/getTypes/rollup.cjs +1 -1
  59. package/utils/getTypes/rollup.js +1 -1
  60. package/utils/index.cjs +1 -1
  61. package/utils/index.d.ts +2 -2
  62. package/utils/index.js +1 -1
  63. package/utils/filterImages/index.cjs +0 -1
  64. package/utils/filterImages/index.d.ts +0 -3
  65. package/utils/filterImages/index.js +0 -1
  66. package/utils/getImages/index.cjs +0 -1
  67. package/utils/getImages/index.d.ts +0 -9
  68. package/utils/getImages/index.js +0 -1
package/README.md CHANGED
@@ -35,15 +35,34 @@ const notion = new Client({ auth: process.env.NOTION_API_KEY, config })
35
35
  You need to pass `config` which informs the package of all the wonderful Notion stuff you have. Will fill this out as I go (I hope haha).
36
36
 
37
37
  ```tsx
38
- (alias) const config: {
38
+ (alias) const notionConfig: {
39
39
  DATABASES: Databases;
40
40
  NOTION: DatabaseInfo;
41
41
  PAGES__HOMEPAGE: string;
42
42
  PAGES: string[];
43
+ ROUTE_META: any[];
44
+ ROUTE_TYPES_BY_DATA_TYPES: Object;
43
45
  ROUTE_TYPES: any[];
44
46
  }
45
47
  ```
46
48
 
49
+ - `DATABASES`: 🔑️ is uppercase (usually gripped by `routeType`)
50
+ - `NOTION`: 🔑️ is uppercase; 🛠️ configuration for DB
51
+ - `active: boolean`
52
+ - `database_id: string`
53
+ - `dataTypes: DataTypes[]`
54
+ - `hasChild: string | null`
55
+ - `name: string`
56
+ - `page_id__seo: string`
57
+ - `routeMeta: boolean`
58
+ - `routeType: string`
59
+ - `slug: string`
60
+ - `PAGES__HOMEPAGE`: 🤕️ what `Pages => slug` is the homepage?
61
+ - `PAGES`: 🤕️ Only active `routeTypes` brought back
62
+ - `ROUTE_META`: 🤕️ up front share if we expect the route to have a meta (`BLOG|EVENTS|PODCASTS`)
63
+ - `ROUTE_TYPES_BY_DATA_TYPES`: For each `DATA_TYPE` determine which `routeType` are associated
64
+ - `ROUTE_TYPES`: 🤕️ Only active `routeTypes` brought back
65
+
47
66
  ### Next
48
67
 
49
68
  Will add an `./examples/next/...` to show this with a public facing Notion at some point.
@@ -55,15 +74,25 @@ Custom setup to get `pathVariables` from `next`:
55
74
  ```tsx
56
75
  export const getStaticProps = async ({ preview = false, ...props }) => {
57
76
  const { catchAll } = props.params
58
- // @todo(next) should come from `process.env...`
59
- // `./pages/api/...` cache = false
60
- const cache = true
61
- // @todo(next) should come from `catchAll`
77
+ // @todo(next)
62
78
  const clear = false
63
- const pathVariables = getPathVariables({ config: notionConfig, catchAll })
64
-
65
- const data = await getCatchAll({ cache, catchAll, clear, pathVariables, preview })
66
-
79
+ const pathVariables = notion.custom.getPathVariables({ catchAll })
80
+ /**
81
+ * @cache
82
+ * - pages = TRUE
83
+ * - pages/api = FALSE
84
+ */
85
+ const cache = true
86
+ const data = await getDataReturn({
87
+ data: await getCatchAll({
88
+ cache,
89
+ catchAll,
90
+ clear,
91
+ pathVariables,
92
+ preview,
93
+ }),
94
+ pathVariables,
95
+ })
67
96
  return {
68
97
  props: { preview, ...data, ...pathVariables, ...props },
69
98
  revalidate,
package/index.cjs CHANGED
@@ -1 +1 @@
1
- var Ht=Object.create;var F=Object.defineProperty,Wt=Object.defineProperties,Ft=Object.getOwnPropertyDescriptor,Qt=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols,zt=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty,$t=Object.prototype.propertyIsEnumerable;var Ie=(e,t,n)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))ke.call(t,n)&&Ie(e,n,t[n]);if(Te)for(var n of Te(t))$t.call(t,n)&&Ie(e,n,t[n]);return e},k=(e,t)=>Wt(e,Qt(t)),De=e=>F(e,"__esModule",{value:!0});var Yt=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},Ce=(e,t,n,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jt(t))!ke.call(e,r)&&(n||r!=="default")&&F(e,r,{get:()=>t[r],enumerable:!(p=Ft(t,r))||p.enumerable});return e},l=(e,t)=>Ce(De(F(e!=null?Ht(zt(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),qt=(e=>(t,n)=>e&&e.get(t)||(n=Ce(De({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var ve=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var L=(e,t,n)=>(ve(e,t,"read from private field"),n?n.call(e):t.get(e)),xe=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Oe=(e,t,n,p)=>(ve(e,t,"write to private field"),p?p.call(e,n):t.set(e,n),n);var Uo={};Yt(Uo,{Client:()=>Mt});var Vt=l(require("@notionhq/client"),1);var O=l(require("lodash/filter.js"),1),Ne=l(require("lodash/map.js"),1),N=({key:e,notion:t,type:n})=>({key:e,notion:t,type:n}),o={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"},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__Podcast:{init:!0,key:"relationEpisodes__Podcast",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"}},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"},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"},subtitle:{init:!0,key:"subtitle",notion:"Subitle",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"}},G=[o.authors,o.datePublished,o.isIndexed,o.isPublished,o.slug,o.seoDescription,o.seoImage,o.seoImageDescription,o.title],Ge=[...G],Le=[...G,o.dateRecorded,o.duration,o.episode,o.mp3,o.season,o.relationEpisodes__People_Guest,o.relationEpisodes__People_Sound_Engineer,o.relationEpisodes__People_Thanks,o.relationEpisodes__Podcast,o.relationEpisodes__Venues,o.socialApple,o.socialSpotify,o.type],Be=[...G,o.dateEvent,o.relationEvents__People_Guest_Music,o.relationEvents__People_Guest,o.relationEvents__People_Host,o.relationEvents__Shows_Lineup,o.relationEvents__Shows,o.relationEvents__Venues,o.socialFacebook,o.socialWebsite,o.ticketUrl,o.rollupEvents__People_Cast,o.rollupEvents__People_Guest_Music,o.rollupEvents__People_Guest,o.rollupEvents__People_Host,o.rollupEvents__Shows_Lineup,o.rollupEvents__Shows,o.rollupEvents__Venues],Ae=[...G],Ue=[...G,o.email,o.nameFirst,o.nameLast,o.namePreferred,o.relationPeople__Episodes_Guest,o.relationPeople__Episodes_Sound_Engineer,o.relationPeople__Episodes_Thanks,o.relationPeople__Events_Guest,o.relationPeople__Events_Guest_Music,o.relationPeople__Events_Host,o.relationPeople__Podcasts_Host,o.relationPeople__Podcasts_Sound_Engineer,o.relationPeople__Shows_Cast,o.relationPeople__Shows_Cast_Past,o.relationPeople__Shows_Director,o.relationPeople__Shows_Director_Musical,o.relationPeople__Shows_Director_Technical,o.relationPeople__Shows_Producer,o.relationPeople__Shows_Thanks,o.relationPeople__Shows_Writer],Ve=[...G,o.categories,o.explicit,o.podcastAuthor,o.podcastAuthorEmail,o.relationPodcasts__People_Host,o.relationPodcasts__People_Sound_Engineer,o.socialApple,o.socialSpotify,o.type,o.relationPodcasts__Episodes],Me=[...G],Re=[...G,o.relationShows__People_Cast,o.relationShows__People_Cast_Past,o.relationShows__People_Director,o.relationShows__People_Director_Musical,o.relationShows__People_Director_Technical,o.relationShows__People_Producer,o.relationShows__People_Thanks,o.relationShows__People_Writer,o.relationShows__Tags,o.socialFacebook,o.socialInstagram,o.socialTwitter,o.socialWebsite,o.relationShows__Events,o.relationShows__Events_Lineup,o.rollupShows__People_Cast,o.rollupShows__People_Cast_Slug,o.rollupShows__People_Cast_Past,o.rollupShows__People_Crew,o.rollupShows__People_Director,o.rollupShows__People_Director_Musical,o.rollupShows__People_Director_Technical,o.rollupShows__People_Music,o.rollupShows__People_Producer,o.rollupShows__People_Thanks,o.rollupShows__People_Writer,o.rollupShows__Tags],He=[...G,o.addressCity,o.addressLatitude,o.addressLongitude,o.addressNeighborhood,o.addressState,o.addressStreet,o.addressZipCode,o.phoneNumber,o.socialFacebook,o.socialInstagram,o.socialTwitter,o.socialWebsite,o.relationVenues__Episodes,o.relationVenues__Events],Mo={BLOG:(0,O.default)(Ge,{init:!0}),EPISODES:(0,O.default)(Le,{init:!0}),EVENTS:(0,O.default)(Be,{init:!0}),PAGES:(0,O.default)(Ae,{init:!0}),PEOPLE:(0,O.default)(Ue,{init:!0}),PODCASTS:(0,O.default)(Ve,{init:!0}),SEO:(0,O.default)(Me,{init:!0}),SHOWS:(0,O.default)(Re,{init:!0}),VENUES:(0,O.default)(He,{init:!0})},We={BLOG:Ge.map(e=>N(e)),EPISODES:Le.map(e=>N(e)),EVENTS:Be.map(e=>N(e)),PAGES:Ae.map(e=>N(e)),PEOPLE:Ue.map(e=>N(e)),PODCASTS:Ve.map(e=>N(e)),SEO:Me.map(e=>N(e)),SHOWS:Re.map(e=>N(e)),VENUES:He.map(e=>N(e))},Fe=(0,Ne.default)(o,e=>N(e)),Qe=new Date().toISOString(),A={dateBefore:{property:o.datePublished.notion,date:{before:Qe}},dateOnOrAfter:{property:o.datePublished.notion,date:{on_or_after:Qe}},published:{property:o.isPublished.notion,checkbox:{equals:!1}},slug:{property:o.slug.notion,text:{equals:""}}},Zt="LISTING",Kt="LISTING_BY_DATE",Jt="SLUG",Xt="SLUG_BY_ROUTE",eo=[Zt,Kt,Jt,Xt],C=Object.assign({},...eo.map(e=>({[e]:e})).flat(1));var z=l(require("@jeromefitz/utils"),1),to=async(e,{block_id:t})=>(0,z.isUndefined)(t)?[]:(await(0,z.avoidRateLimit)(),await e({block_id:t})),re=to;var je={sorts:[{property:o.slug.notion,direction:"ascending"}]},oo=async(e,{database_id:t,sorts:n=je.sorts,filter:p=je.filter})=>t?await e({database_id:t,sorts:n,filter:p}):[],ne=oo;var ze=async(e,{blocks:t})=>{if(t==null)return t;let n=t.filter(r=>r.has_children).map(r=>({promise:e({block_id:r.id,page_size:100}),parent_block:r})),p=await Promise.all(n.map(r=>r.promise));for(let r=0;r<p.length;r++){let i=p[r].results;if(await ze(e,{blocks:i}),n[r]){let a=n[r].parent_block;a[a.type].children=i}}return t},ie=ze;var ro=({config:e,item:t,routeType:n,meta:p})=>{var y,d,m,f,u;let{NOTION:r}=e,i="",a=(y=t.properties)==null?void 0:y.slug,s="",c="/[...catchAll]";switch(n){case r.BLOG.routeType:i=(m=(d=t.properties)==null?void 0:d.datePublished)==null?void 0:m.start.slice(0,10);let[T,E,g]=i==null?void 0:i.split("-");s=`/${n}/${T}/${E}/${g}/${a}`;break;case r.EVENTS.routeType:i=(u=(f=t.properties)==null?void 0:f.dateEvent)==null?void 0:u.start.slice(0,10);let[_,w,h]=i==null?void 0:i.split("-");s=`/${n}/${_}/${w}/${h}/${a}`;break;case r.PODCASTS.routeType:case r.EPISODES.routeType:s=`/${p==null?void 0:p.join("/")}/${a}`;break;case r.PEOPLE.routeType:case r.SHOWS.routeType:case r.VENUES.routeType:default:s=`/${n}/${a}`;break}return s=s.replace("//","/"),{as:s,date:i,href:c,slug:a}},se=ro;var _e=l(require("@jeromefitz/utils"),1),bt=l(require("lodash/map.js"),1),J=l(require("lodash/omit.js"),1);var ae=l(require("date-fns/addDays/index.js"),1),$e=l(require("date-fns/addMonths/index.js"),1),Ye=l(require("date-fns/addYears/index.js"),1),no=(e,t)=>{switch(t){case"year":return(0,Ye.default)(e,1).toISOString();case"month":return(0,$e.default)(e,1).toISOString();case"day":return(0,ae.default)(e,2).toISOString()}return(0,ae.default)(e,-1).toISOString()},D=no;var qe=l(require("lodash/map.js"),1);var io=({config:e,data:t,pathVariables:n,pageId:p})=>{var y,d;let{NOTION:r}=e,i={};if(!(t==null?void 0:t.properties))return i;let{properties:a}=t,s;if(n){let{meta:m,routeType:f}=n;s=f===((y=r==null?void 0:r.PODCASTS)==null?void 0:y.routeType)&&m.length>1?(d=r==null?void 0:r.EPISODES)==null?void 0:d.routeType:f}let c=s?We[s.toUpperCase()]:Fe;return(0,qe.default)(c,m=>{let f,u=a[m.notion];i[m.key]=null,u&&(f=U[m.type](u,p),i[m.key]=f||null)}),i},I=io;var Ze=l(require("@jeromefitz/utils"),1),Ke=l(require("lodash/map.js"),1),Je=l(require("lodash/omit.js"),1);var so=({config:e,results:t,routeType:n})=>{let p=[];return(0,Ke.default)(t,r=>{let i=(0,Je.default)(r,"properties");i.properties=(0,Ze.sortObject)(I({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),p.push(i)}),p},Xe=so;var et=l(require("lodash/filter.js"),1),$=l(require("lodash/map.js"),1),ao=(e,t)=>{switch(t){case"info":let n=[];return(0,$.default)(e.seoImage,r=>!!(r==null?void 0:r.url)&&(r==null?void 0:r.type)==="external"&&n.push(r==null?void 0:r.url)),n;case"content":return!!e&&(0,et.default)(e,{object:"block",type:"image"});case"items":let p=[];return(0,$.default)(e,r=>{var i;(0,$.default)((i=r==null?void 0:r.properties)==null?void 0:i.seoImage,a=>!!(a==null?void 0:a.url)&&(a==null?void 0:a.type)==="external"&&p.push(a==null?void 0:a.url))}),p;default:return[]}},R=ao;var tt=l(require("github-slugger"),1),Y=l(require("lodash/map.js"),1),q=l(require("plaiceholder"),1);var lo=async({data:e,pathVariables:t})=>{var d,m,f,u,T,E,g;let n=new tt.default,p={},r=((d=e.info)==null?void 0:d.object)==="page"?R((m=e.info)==null?void 0:m.properties,"info"):!!((f=e.info)==null?void 0:f.results)&&R((T=(u=e.info)==null?void 0:u.results[0])==null?void 0:T.properties,"info"),i=!!r&&r.map(async _=>{if(!_)return null;let w=!!_&&!!(_==null?void 0:_.url)?_==null?void 0:_.url:_;if(!w)return null;let{base64:h,img:P}=await(0,q.getPlaiceholder)(w),x=n.slug(w);return{base64:h,id:x,img:P,url:w}}),a=i?await Promise.all(i):[],s=!t.isIndex&&R(e==null?void 0:e.content,"content"),c=!!s&&s.map(async _=>{var B,M;if(!_)return null;let{type:w}=_,h=_[w],P=!!_&&!!((B=h==null?void 0:h.external)==null?void 0:B.url)?(M=h==null?void 0:h.external)==null?void 0:M.url:null;if(!P)return null;let{base64:x,img:H}=await(0,q.getPlaiceholder)(P),V=n.slug(P);return{base64:x,id:V,img:H,url:P}}),y=c?await Promise.all(c):[];if(e.items){let _=e.items.object==="page"?R((E=e.items)==null?void 0:E.data,"items"):R((g=e.items)==null?void 0:g.results,"items"),w=!!_&&_.map(async P=>{if(!P)return null;let x=!!P&&!!(P==null?void 0:P.url)?P==null?void 0:P.url:P;if(!x)return null;let{base64:H,img:V}=await(0,q.getPlaiceholder)(x),B=n.slug(x);return{base64:H,id:B,img:V,url:x}}),h=await Promise.all(w);!!h&&h[0]&&(0,Y.default)(h,P=>p[P.id]=P)}return!!a&&a[0]&&(0,Y.default)(a,_=>p[_.id]=_),!!y&&y[0]&&(0,Y.default)(y,_=>p[_.id]=_),p},Q=lo;var po=e=>(console.dir("@notion(_unsupported)"),console.dir(e),e),Z=po;var _o=e=>e.checkbox||!1,ot=_o;var uo=e=>{let{type:t}=e;return e[t]},K=uo;var co=e=>e.email||null,rt=co;var nt=l(require("@jeromefitz/utils"),1),it=l(require("github-slugger"),1),st=l(require("lodash/size.js"),1),yo="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",mo=(e,t)=>yo.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",(0,nt.stringToUUID)(t)),ho=(e,t)=>{let n=new it.default,p={};return(0,st.default)(e.files)<=0||e.files.map(r=>{var i,a;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);p[c]={type:r==null?void 0:r.type,url:mo(s,t)}}if((r==null?void 0:r.type)==="external"){let s=(a=r==null?void 0:r.external)==null?void 0:a.url.split("?")[0],c=n.slug(s);p[c]={type:r==null?void 0:r.type,url:s}}}),p},le=ho;var at=l(require("github-slugger"),1),lt=l(require("lodash/map.js"),1),So=e=>{let t=new at.default,n={};return(0,lt.default)(e.multi_select,p=>{let r=p;r.slug=t.slug(r.name),n[r.id]=r}),n},pt=So;var Po=e=>(e==null?void 0:e.number)||null,_t=Po;var ut=l(require("github-slugger"),1),fo=e=>{let t=new ut.default;return e.people.map(n=>{let{avatar_url:p,id:r,name:i,person:a}=n,{email:s}=a;return{[t.slug(i)]:{avatar_url:p,email:s,id:r,name:i}}})[0]},dt=fo;var Eo=e=>(e==null?void 0:e.phone_number)||null,ct=Eo;var pe=l(require("lodash/map.js"),1);var go=e=>e.type==="rollup"?e.rollup.type==="array"&&(0,pe.default)(e.rollup.array,t=>U[t.type](t))[0]:(0,pe.default)(e.relation,t=>t.id),yt=go;var wo=e=>{var t;return(e==null?void 0:e.rich_text)?(t=e==null?void 0:e.rich_text[0])==null?void 0:t.plain_text:null},mt=wo;var ht=l(require("lodash/map.js"),1),St=l(require("lodash/sortBy.js"),1);var bo=e=>{var t;return(0,St.default)((0,ht.default)((t=e==null?void 0:e.rollup)==null?void 0:t.array,n=>U[n.type](n)))},Pt=bo;var ft=l(require("github-slugger"),1),To=e=>{let t=new ft.default,n=e.select;return n?(n.slug=t.slug(e.select.name),{[n.id]:n}):null},Et=To;var ko=e=>{var t;return(e==null?void 0:e.title)?(t=e==null?void 0:e.title[0])==null?void 0:t.plain_text:null},gt=ko;var Io=e=>e.url||null,wt=Io;var Do={checkbox:ot,created_by:Z,created_time:K,date:K,email:rt,files:le,formula:Z,image:le,last_edited_by:Z,last_edited_time:K,multi_select:pt,number:_t,people:dt,phone_number:ct,relation:yt,rich_text:mt,rollup:Pt,select:Et,title:gt,url:wt},U=Do;var Co=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getPagesById:p,pathVariables:r,routeType:i})=>{let{NOTION:a}=e,s={},c={},y={},d=new Date().toISOString(),m=new Date("2020-01-01").toISOString(),f=a[i.toUpperCase()].page_id__seo,u=await p({page_id:f});if(!u)return{};(u==null?void 0:u.object)==="page"&&(c=(0,J.default)(u,"properties"),c.properties=(0,_e.sortObject)(I({config:e,data:u,pathVariables:r,pageId:c.id}))),s=await t({block_id:c.id});let T=await n({database_id:a[i.toUpperCase()].database_id,filter:{and:[{property:i===a.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:i===a.EVENTS.routeType?d:m}}]}}),E=[];(0,bt.default)(T.results,h=>{let P=h;P=(0,J.default)(P,"properties"),P.properties=(0,_e.sortObject)(I({config:e,data:h,pathVariables:r,pageId:h.id})),E.push(P)});let g=(0,J.default)(T,"results");g.results=E,y=g;let _={info:c,content:s,items:y,images:{}},w=_?await Q({data:_,pathVariables:r}):{};return _=k(b({},_),{images:w}),_},ue=Co;var de=l(require("@jeromefitz/utils"),1),Tt=l(require("lodash/map.js"),1),j=l(require("lodash/omit.js"),1),kt=l(require("lodash/size.js"),1);var vo=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getPagesById:p,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,{meta:c}=r,y={},d={},m={},f=new Date().toISOString(),u=s[i.toUpperCase()].page_id__seo,T=await p({page_id:u});T.object==="page"&&(d=(0,j.default)(T,"properties"),d.properties=(0,de.sortObject)(I({config:e,data:T,pathVariables:r,pageId:d.id}))),y=await t({block_id:d.id});let E=(0,kt.default)(c),[g,_,w]=c,h=new Date(`${g||f.slice(0,4)}-${_||"01"}-${w||"01"}`),P,x=[{property:o.datePublished.notion,direction:"descending"}];switch(E){case 1:P={and:[{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:D(h,"")}},{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{before:D(h,"year")}}]};break;case 2:P={and:[{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:D(h,"")}},{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{before:D(h,"month")}}]};break;case 3:P={and:[{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:D(h,"")}},{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{before:D(h,"day")}}]};break;default:P={and:[{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:D(h,"")}},{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{before:D(h,"day")}},k(b({},A.slug),{text:{equals:a}})]};break}let H=s[i.toUpperCase()].database_id,V=await n({database_id:H,filter:P,sorts:x}),B=[];(0,Tt.default)(V.results,oe=>{let W=oe;W=(0,j.default)(W,"properties"),W.properties=(0,de.sortObject)(I({config:e,data:oe,pathVariables:r,pageId:oe.id})),!!W&&B.push(W)});let M=(0,j.default)(V,"results");M.results=B,m=M,m=(0,j.default)(M,"data");let te={info:d,content:y,items:m,images:{}},Rt={};return te=k(b({},te),{images:Rt}),te},ce=vo;var It=l(require("@jeromefitz/utils"),1),Dt=l(require("lodash/filter.js"),1),Ct=l(require("lodash/omit.js"),1);var xo=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getDeepFetchAllChildren:p,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,c={},y={},d={},m=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(m))return{info:y,content:c,items:d,images:{}};let u=await n({database_id:s[m].database_id,filter:{and:[k(b({},A.slug),{text:{equals:a}})]}}),T=(u==null?void 0:u.object)==="list"&&u.results[0];if(!T)return{};y=(0,Ct.default)(T,"properties"),y.properties=(0,It.sortObject)(I({config:e,data:T,pathVariables:r,pageId:y.id})),c=await t({block_id:y.id}),c=[...await p({blocks:c.results})],d&&(d.results=(0,Dt.default)(d.results,{properties:{isPublished:!0}}));let g={info:y,content:c,items:d,images:{}},_=g?await Q({data:g,pathVariables:r}):{};return g=k(b({},g),{images:_}),g},ye=xo;var me=l(require("@jeromefitz/utils"),1),he=l(require("lodash/omit.js"),1),vt=l(require("lodash/size.js"),1);var Oo=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getQuery:p,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,{meta:c}=r,y={},d={},m={},f=new Date().toISOString();if(i===s.PODCASTS.routeType){let[E,g]=c,_=(0,vt.default)(c)===2,w=await n({database_id:s[_?s.EPISODES.routeType.toUpperCase():i.toUpperCase()].database_id,filter:{and:[k(b({},A.slug),{text:{equals:_?g:E}})]}}),h=(w==null?void 0:w.object)==="list"&&w.results[0];if(!h)return{};d=(0,he.default)(h,"properties"),d.properties=(0,me.sortObject)(I({config:e,data:h,pathVariables:r,pageId:d.id})),y=await t({block_id:d.id}),_||i===s.PODCASTS.routeType&&(m=await p({config:e,reqQuery:{podcasts:d.id,databaseType:s.EPISODES.routeType.toUpperCase()}}))}if([s.BLOG.routeType,s.EVENTS.routeType].includes(i)){let[E,g,_]=c,w=new Date(`${E||f.slice(0,4)}-${g||"01"}-${_||"01"}`),h=await n({database_id:s[i.toUpperCase()].database_id,filter:{and:[{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{on_or_after:D(w,"")}},{property:i===s.EVENTS.routeType?o.dateEvent.notion:o.datePublished.notion,date:{before:D(w,"day")}},k(b({},A.slug),{text:{equals:a}})]}}),P=(h==null?void 0:h.object)==="list"&&h.results[0];P&&(d=(0,he.default)(P,"properties"),d.properties=(0,me.sortObject)(I({config:e,data:P,pathVariables:r,pageId:d.id})),y=await t({block_id:d.id}))}let u={info:d,content:y,items:m,images:{}},T={};return u=k(b({},u),{images:T}),u},Se=Oo;var X=l(require("@jeromefitz/utils"),1),No=async(e,{page_id:t})=>(0,X.isUndefined)(t)?[]:(await(0,X.avoidRateLimit)(),await e({page_id:t})),Pe=No;var fe=l(require("lodash/drop.js"),1),xt=l(require("lodash/dropRight.js"),1),Ot=l(require("lodash/first.js"),1),Ee=l(require("lodash/includes.js"),1),Nt=l(require("lodash/isInteger.js"),1),Gt=l(require("lodash/join.js"),1),Lt=l(require("lodash/last.js"),1),ge=l(require("lodash/size.js"),1);var Go=({config:e,catchAll:t})=>{let{NOTION:n,PAGES__HOMEPAGE:p,ROUTE_TYPES:r}=e,i=(0,ge.default)(t),a=(0,Ot.default)(t),s=(0,Lt.default)(t),c=i>1&&(0,Ee.default)([n.BLOG.routeType,n.EVENTS.routeType,n.PODCASTS.routeType],a)?(0,fe.default)(t):(0,fe.default)((0,xt.default)(t)),y=a===s&&!(0,Ee.default)(r,a)?"pages":a,d=a!==s&&!(0,Nt.default)(parseInt(s))?s:a,m=y==="pages",f=d===a,u=!!c&&(0,ge.default)(c)!==0,T=m&&a===p?"":(0,Gt.default)(t,"/"),E=C.SLUG;return m?E=C.SLUG:f&&!u?E=C.LISTING:f&&u?E=C.LISTING_BY_DATE:u?E=C.SLUG_BY_ROUTE:E=C.SLUG,{dataType:E,hasMeta:u,isPage:m,isIndex:f,meta:c,routeType:y,slug:d,url:T}},we=Go;var ee=l(require("@jeromefitz/utils"),1),Bt=l(require("lodash/map.js"),1),At=l(require("lodash/omit.js"),1),Ut=l(require("lodash/size.js"),1);var Lo={ASCENDING:"ascending",DESCENDING:"descending"},Bo=[{property:o.slug.notion,direction:Lo.ASCENDING}],Ao=async({config:e,reqQuery:t,notionDatabasesQuery:n})=>{let{NOTION:p}=e,{databaseType:r}=t,i=r,a=!1,s=r.toUpperCase(),c=p[s].database_id;if(!c)return[];let y={},d={},m,f;if(r==="EPISODES"){f=Bo;let{podcasts:u}=t,T=[],E=[];!!u&&E.push(...u==null?void 0:u.split(",")),(0,Ut.default)(E)>0&&(0,Bt.default)(E,g=>T.push({property:o.relationEpisodes__Podcast.notion,relation:{contains:g}})),m={or:[...T]}}else a=!0;if(!a&&(!y||(0,ee.isObjectEmpty)(y))){await(0,ee.avoidRateLimit)();let u;m?((m==null?void 0:m.or.length)===0&&(m={and:[{property:o.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),u=await n({database_id:c,filter:m,sorts:f}),y=u,d=Xe({config:e,results:u.results,routeType:i}),y=(0,At.default)(y,"results"),y.results=d):a=!0}return y},be=Ao;var v,Mt=class extends Vt.Client{constructor(t){super(t);xe(this,v,void 0);this.custom={getBlocksByIdChildren:async t=>await re(this.blocks.children.list,b({},t)),getDatabasesByIdQuery:async t=>await ne(this.databases.query,t),getDeepFetchAllChildren:async t=>await ie(this.blocks.children.list,b({},t)),getInfoType:t=>se(k(b({},t),{config:L(this,v)})),getPagesById:async t=>await Pe(this.pages.retrieve,b({},t)),getPathVariables:t=>we(k(b({},t),{config:L(this,v)})),getQuery:async t=>await be(k(b({},t),{config:L(this,v),notionDatabasesQuery:this.databases.query}))};this.dataTypes={[C.LISTING]:async t=>await ue(k(b({},t),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[C.LISTING_BY_DATE]:async t=>await ce(k(b({},t),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[C.SLUG]:async t=>await ye(k(b({},t),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[C.SLUG_BY_ROUTE]:async t=>await Se(k(b({},t),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery}))};Oe(this,v,t==null?void 0:t.config)}};v=new WeakMap;module.exports=qt(Uo);0&&(module.exports={Client});
1
+ var ft=Object.create;var N=Object.defineProperty,Et=Object.defineProperties,wt=Object.getOwnPropertyDescriptor,Tt=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertyNames,ue=Object.getOwnPropertySymbols,bt=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable;var ce=(e,t,n)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g=(e,t)=>{for(var n in t||(t={}))de.call(t,n)&&ce(e,n,t[n]);if(ue)for(var n of ue(t))It.call(t,n)&&ce(e,n,t[n]);return e},f=(e,t)=>Et(e,Tt(t)),ye=e=>N(e,"__esModule",{value:!0});var Dt=(e,t)=>{for(var n in t)N(e,n,{get:t[n],enumerable:!0})},me=(e,t,n,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of kt(t))!de.call(e,r)&&(n||r!=="default")&&N(e,r,{get:()=>t[r],enumerable:!(p=wt(t,r))||p.enumerable});return e},l=(e,t)=>me(ye(N(e!=null?ft(bt(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Ct=(e=>(t,n)=>e&&e.get(t)||(n=me(ye({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var So={};Dt(So,{Client:()=>gt});var Pt=l(require("@notionhq/client"),1);var C=l(require("lodash/filter.js"),1),he=l(require("lodash/map.js"),1),O=({key:e,notion:t,type:n})=>({key:e,notion:t,type:n}),o={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"},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__Podcast:{init:!0,key:"relationEpisodes__Podcast",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"}},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"},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"},subtitle:{init:!0,key:"subtitle",notion:"Subitle",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"}},v=[o.authors,o.datePublished,o.isIndexed,o.isPublished,o.slug,o.seoDescription,o.seoImage,o.seoImageDescription,o.title],Se=[...v],Pe=[...v,o.dateRecorded,o.duration,o.episode,o.mp3,o.season,o.relationEpisodes__People_Guest,o.relationEpisodes__People_Sound_Engineer,o.relationEpisodes__People_Thanks,o.relationEpisodes__Podcast,o.relationEpisodes__Venues,o.socialApple,o.socialSpotify,o.type],ge=[...v,o.dateEvent,o.relationEvents__People_Guest_Music,o.relationEvents__People_Guest,o.relationEvents__People_Host,o.relationEvents__Shows_Lineup,o.relationEvents__Shows,o.relationEvents__Venues,o.socialFacebook,o.socialWebsite,o.ticketUrl,o.rollupEvents__People_Cast,o.rollupEvents__People_Guest_Music,o.rollupEvents__People_Guest,o.rollupEvents__People_Host,o.rollupEvents__Shows_Lineup,o.rollupEvents__Shows,o.rollupEvents__Venues],fe=[...v],Ee=[...v,o.email,o.nameFirst,o.nameLast,o.namePreferred,o.relationPeople__Episodes_Guest,o.relationPeople__Episodes_Sound_Engineer,o.relationPeople__Episodes_Thanks,o.relationPeople__Events_Guest,o.relationPeople__Events_Guest_Music,o.relationPeople__Events_Host,o.relationPeople__Podcasts_Host,o.relationPeople__Podcasts_Sound_Engineer,o.relationPeople__Shows_Cast,o.relationPeople__Shows_Cast_Past,o.relationPeople__Shows_Director,o.relationPeople__Shows_Director_Musical,o.relationPeople__Shows_Director_Technical,o.relationPeople__Shows_Producer,o.relationPeople__Shows_Thanks,o.relationPeople__Shows_Writer],we=[...v,o.categories,o.explicit,o.podcastAuthor,o.podcastAuthorEmail,o.relationPodcasts__People_Host,o.relationPodcasts__People_Sound_Engineer,o.socialApple,o.socialSpotify,o.type,o.relationPodcasts__Episodes],Te=[...v],ke=[...v,o.relationShows__People_Cast,o.relationShows__People_Cast_Past,o.relationShows__People_Director,o.relationShows__People_Director_Musical,o.relationShows__People_Director_Technical,o.relationShows__People_Producer,o.relationShows__People_Thanks,o.relationShows__People_Writer,o.relationShows__Tags,o.socialFacebook,o.socialInstagram,o.socialTwitter,o.socialWebsite,o.relationShows__Events,o.relationShows__Events_Lineup,o.rollupShows__People_Cast,o.rollupShows__People_Cast_Slug,o.rollupShows__People_Cast_Past,o.rollupShows__People_Crew,o.rollupShows__People_Director,o.rollupShows__People_Director_Musical,o.rollupShows__People_Director_Technical,o.rollupShows__People_Music,o.rollupShows__People_Producer,o.rollupShows__People_Thanks,o.rollupShows__People_Writer,o.rollupShows__Tags],be=[...v,o.addressCity,o.addressLatitude,o.addressLongitude,o.addressNeighborhood,o.addressState,o.addressStreet,o.addressZipCode,o.phoneNumber,o.socialFacebook,o.socialInstagram,o.socialTwitter,o.socialWebsite,o.relationVenues__Episodes,o.relationVenues__Events],go={BLOG:(0,C.default)(Se,{init:!0}),EPISODES:(0,C.default)(Pe,{init:!0}),EVENTS:(0,C.default)(ge,{init:!0}),PAGES:(0,C.default)(fe,{init:!0}),PEOPLE:(0,C.default)(Ee,{init:!0}),PODCASTS:(0,C.default)(we,{init:!0}),SEO:(0,C.default)(Te,{init:!0}),SHOWS:(0,C.default)(ke,{init:!0}),VENUES:(0,C.default)(be,{init:!0})},Ie={BLOG:Se.map(e=>O(e)),EPISODES:Pe.map(e=>O(e)),EVENTS:ge.map(e=>O(e)),PAGES:fe.map(e=>O(e)),PEOPLE:Ee.map(e=>O(e)),PODCASTS:we.map(e=>O(e)),SEO:Te.map(e=>O(e)),SHOWS:ke.map(e=>O(e)),VENUES:be.map(e=>O(e))},De=(0,he.default)(o,e=>O(e)),Ce=new Date().toISOString(),x={dateBefore:{property:o.datePublished.notion,date:{before:Ce}},dateOnOrAfter:{property:o.datePublished.notion,date:{on_or_after:Ce}},published:{property:o.isPublished.notion,checkbox:{equals:!1}},slug:{property:o.slug.notion,text:{equals:""}}},Ot="LISTING",vt="LISTING_BY_DATE",xt="SLUG",Lt="SLUG_BY_ROUTE",Bt=[Ot,vt,xt,Lt],b=Object.assign({},...Bt.map(e=>({[e]:e})).flat(1));var A=l(require("@jeromefitz/utils"),1),Nt=async({getBlocksChildrenList:e,block_id:t})=>(0,A.isUndefined)(t)?[]:(await(0,A.avoidRateLimit)(),await e({block_id:t})),F=Nt;var B={sorts:[{property:o.slug.notion,direction:"ascending"}]},Rt=async({database_id:e,filter:t=B==null?void 0:B.filter,getDatabasesQuery:n,sorts:p=B==null?void 0:B.sorts})=>e?await n({database_id:e,sorts:p,filter:t}):[],W=Rt;var Oe=async({getBlocksChildrenList:e,blocks:t})=>{if(t==null)return t;let n=t.filter(r=>r.has_children).map(r=>{let{id:i}=r;return{promise:e({block_id:i,page_size:100}),parent_block:r}}),p=await Promise.all(n.map(r=>r.promise));for(let r=0;r<p.length;r++){let i=p[r].results;if(await Oe({blocks:i,getBlocksChildrenList:e}),n[r]){let _=n[r].parent_block;_[_.type].children=i}}return t},Y=Oe;var Gt=({config:e,item:t,routeType:n,meta:p})=>{var c,h;let{NOTION:r}=e,i="",_=(c=t.properties)==null?void 0:c.slug,s="",m="/[...catchAll]";switch(n){case r.BLOG.routeType:case r.EVENTS.routeType:i=(h=t.properties[r[n.toUpperCase()].infoType.key])==null?void 0:h.start.slice(0,10);let[a,u,y]=i==null?void 0:i.split("-");s=`/${n}/${a}/${u}/${y}/${_}`;break;case r.PODCASTS.routeType:case r.EPISODES.routeType:s=`/${p==null?void 0:p.join("/")}/${_}`;break;default:s=`/${n}/${_}`;break}return s=s.replace("//","/"),{as:s,date:i,href:m,slug:_}},z=Gt;var K=l(require("@jeromefitz/utils"),1),nt=l(require("lodash/map.js"),1),V=l(require("lodash/omit.js"),1);var j=l(require("date-fns/addDays/index.js"),1),ve=l(require("date-fns/addMonths/index.js"),1),xe=l(require("date-fns/addYears/index.js"),1),At=(e,t)=>{switch(t){case"year":return(0,xe.default)(e,1).toISOString();case"month":return(0,ve.default)(e,1).toISOString();case"day":return(0,j.default)(e,2).toISOString()}return(0,j.default)(e,-1).toISOString()},I=At;var Le=l(require("lodash/map.js"),1);var Ut=({config:e,data:t,pathVariables:n,pageId:p})=>{var c,h;let{NOTION:r}=e,i={};if(!(t==null?void 0:t.properties))return i;let{properties:_}=t,s="";if(n){let{meta:a,routeType:u}=n;s=u===((c=r==null?void 0:r.PODCASTS)==null?void 0:c.routeType)&&a.length>1?(h=r==null?void 0:r.EPISODES)==null?void 0:h.routeType:u}let m=s?Ie[s.toUpperCase()]:De;return(0,Le.default)(m,a=>{let u,y=_[a.notion];i[a.key]=null,y&&(u=L[a.type](y,p),i[a.key]=u||null)}),i},w=Ut;var Be=l(require("@jeromefitz/utils"),1),Ne=l(require("lodash/map.js"),1),Re=l(require("lodash/omit.js"),1);var Mt=({config:e,results:t,routeType:n})=>{let p=[];return(0,Ne.default)(t,r=>{let i=(0,Re.default)(r,"properties");i.properties=(0,Be.sortObject)(w({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),p.push(i)}),p},Ge=Mt;var Vt=({isPage:e,isIndex:t,hasMeta:n})=>e?b.SLUG:t&&!n?b.LISTING:t&&n?b.LISTING_BY_DATE:n?b.SLUG_BY_ROUTE:b.SLUG,$=Vt;var Ht=e=>(console.dir("@notion(_unsupported)"),e),U=Ht;var Qt=e=>e.checkbox||!1,Ae=Qt;var Ft=e=>{let{type:t}=e;return e[t]},M=Ft;var Wt=e=>e.email||null,Ue=Wt;var Me=l(require("@jeromefitz/utils"),1),Ve=l(require("github-slugger"),1),He=l(require("lodash/size.js"),1),Yt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",zt=(e,t)=>Yt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",(0,Me.stringToUUID)(t)),jt=(e,t)=>{let n=new Ve.default,p={};return(0,He.default)(e.files)<=0||e.files.map(r=>{var i,_;if((r==null?void 0:r.type)==="file"){let s=(i=r==null?void 0:r.file)==null?void 0:i.url.split("?")[0],m=n.slug(s);p[m]={type:r==null?void 0:r.type,url:zt(s,t)}}if((r==null?void 0:r.type)==="external"){let s=(_=r==null?void 0:r.external)==null?void 0:_.url.split("?")[0],m=n.slug(s);p[m]={type:r==null?void 0:r.type,url:s}}}),p},q=jt;var Qe=l(require("github-slugger"),1),Fe=l(require("lodash/map.js"),1),$t=e=>{let t=new Qe.default,n={};return(0,Fe.default)(e.multi_select,p=>{let r=p;r.slug=t.slug(r.name),n[r.id]=r}),n},We=$t;var qt=e=>(e==null?void 0:e.number)||null,Ye=qt;var ze=l(require("github-slugger"),1),Zt=e=>{let t=new ze.default;return e.people.map(n=>{let{avatar_url:p,id:r,name:i,person:_}=n,{email:s}=_;return{[t.slug(i)]:{avatar_url:p,email:s,id:r,name:i}}})[0]},je=Zt;var Kt=e=>(e==null?void 0:e.phone_number)||null,$e=Kt;var Z=l(require("lodash/map.js"),1);var Jt=e=>e.type==="rollup"?e.rollup.type==="array"&&(0,Z.default)(e.rollup.array,t=>L[t.type](t))[0]:(0,Z.default)(e.relation,t=>t.id),qe=Jt;var Xt=e=>{var t;return(e==null?void 0:e.rich_text)?(t=e==null?void 0:e.rich_text[0])==null?void 0:t.plain_text:null},Ze=Xt;var Ke=l(require("lodash/map.js"),1),Je=l(require("lodash/sortBy.js"),1);var eo=e=>{var t;return(0,Je.default)((0,Ke.default)((t=e==null?void 0:e.rollup)==null?void 0:t.array,n=>L[n.type](n)))},Xe=eo;var et=l(require("github-slugger"),1),to=e=>{let t=new et.default,n=e.select;return n?(n.slug=t.slug(e.select.name),{[n.id]:n}):null},tt=to;var oo=e=>{var t;return(e==null?void 0:e.title)?(t=e==null?void 0:e.title[0])==null?void 0:t.plain_text:null},ot=oo;var ro=e=>e.url||null,rt=ro;var no={checkbox:Ae,created_by:U,created_time:M,date:M,email:Ue,files:q,formula:U,image:q,last_edited_by:U,last_edited_time:M,multi_select:We,number:Ye,people:je,phone_number:$e,relation:qe,rich_text:Ze,rollup:Xe,select:tt,title:ot,url:rt},L=no;var io=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getPagesById:p,pathVariables:r,routeType:i})=>{let{NOTION:_}=e,s={},m=new Date().toISOString(),c=new Date("2020-01-01").toISOString(),h=_[i.toUpperCase()].page_id__seo,a=await p({page_id:h});if(!a)return{};(a==null?void 0:a.object)==="page"&&(s=(0,V.default)(a,"properties"),s.properties=(0,K.sortObject)(w({config:e,data:a,pathVariables:r,pageId:s.id})));let u=_.EVENTS.routeType===i,y=_[i.toUpperCase()].infoType.notion??o.datePublished.notion,P=await t({block_id:s.id}),S=await n({database_id:_[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:u?m:c}}]}}),E=[];(0,nt.default)(S.results,k=>{let D=k;D=(0,V.default)(D,"properties"),D.properties=(0,K.sortObject)(w({config:e,data:k,pathVariables:r,pageId:k.id})),E.push(D)});let T=(0,V.default)(S,"results");return T.results=E,{info:s,content:P,items:T,images:{}}},J=io;var X=l(require("@jeromefitz/utils"),1),it=l(require("lodash/map.js"),1),R=l(require("lodash/omit.js"),1),st=l(require("lodash/size.js"),1);var so=({config:e,pathVariables:t,routeType:n,slug:p})=>{var y,P;let{NOTION:r}=e,{meta:i}=t,[_,s,m]=i,c=(0,st.default)(i),h=new Date().toISOString(),a=new Date(`${_||h.slice(0,4)}-${s||"01"}-${m||"01"}`),u=((P=(y=r[n.toUpperCase()])==null?void 0:y.infoType)==null?void 0:P.notion)??o.datePublished.notion;switch(c){case 1:return{and:[{property:u,date:{on_or_after:I(a,"")}},{property:u,date:{before:I(a,"year")}}]};case 2:return{and:[{property:u,date:{on_or_after:I(a,"")}},{property:u,date:{before:I(a,"month")}}]};case 3:return{and:[{property:u,date:{on_or_after:I(a,"")}},{property:u,date:{before:I(a,"day")}}]};default:return{and:[{property:u,date:{on_or_after:I(a,"")}},{property:u,date:{before:I(a,"day")}},f(g({},x.slug),{text:{equals:p}})]}}},ao=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getPagesById:p,pathVariables:r,routeType:i,slug:_})=>{let{NOTION:s}=e,m={},c={},h=s[i.toUpperCase()].page_id__seo,a=await p({page_id:h});a.object==="page"&&(c=(0,R.default)(a,"properties"),c.properties=(0,X.sortObject)(w({config:e,data:a,pathVariables:r,pageId:a.id}))),m=await t({block_id:c.id});let u=[{property:o.datePublished.notion,direction:"descending"}],y=so({config:e,pathVariables:r,routeType:i,slug:_}),P=s[i.toUpperCase()].database_id,S=await n({database_id:P,filter:y,sorts:u}),E=[];(0,it.default)(S.results,D=>{let G=(0,R.default)(D,"properties");G.properties=(0,X.sortObject)(w({config:e,data:D,pathVariables:r,pageId:G.id})),!!G&&E.push(G)});let T=(0,R.default)(S,"results");T.results=E;let k=(0,R.default)(T,"data");return{info:c,content:m,items:k,images:{}}},ee=ao;var at=l(require("@jeromefitz/utils"),1),lt=l(require("lodash/omit.js"),1);var lo=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getDeepFetchAllChildren:p,pathVariables:r,routeType:i,slug:_})=>{let{NOTION:s}=e,m=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(m))return{info:{},content:{},items:{},images:{}};let h=await n({database_id:s[m].database_id,filter:{and:[f(g({},x.slug),{text:{equals:_}})]}}),a=(h==null?void 0:h.object)==="list"&&h.results[0];if(!a)return{};let u=(0,lt.default)(a,"properties");u.properties=(0,at.sortObject)(w({config:e,data:a,pathVariables:r,pageId:u.id}));let y=await t({block_id:u.id}),S=[...await p({blocks:y.results})];return{info:u,content:S,items:{},images:{}}},te=lo;var oe=l(require("@jeromefitz/utils"),1),re=l(require("lodash/omit.js"),1),pt=l(require("lodash/size.js"),1);var po=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getQuery:p,pathVariables:r,routeType:i})=>{var k;let{NOTION:_}=e,{meta:s}=r,m=i.toUpperCase(),[c,h]=s,a=(0,pt.default)(s)===2,u=(k=_[m])==null?void 0:k.hasChild.toUpperCase(),y=await n({database_id:_[a?_[u].routeType.toUpperCase():m].database_id,filter:{and:[f(g({},x.slug),{text:{equals:a?h:c}})]}}),P=(y==null?void 0:y.object)==="list"&&y.results[0];if(!P)return{info:{},content:{},items:{},images:{}};let S=(0,re.default)(P,"properties");S.properties=(0,oe.sortObject)(w({config:e,data:P,pathVariables:r,pageId:S.id}));let E=await t({block_id:S.id}),T={};return a||(T=await p({config:e,reqQuery:{podcasts:S.id,databaseType:_[u].routeType.toUpperCase()}})),{info:S,content:E,items:T,images:{}}},_o=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,pathVariables:p,routeType:r,slug:i})=>{var k,D;let _=new Date().toISOString(),{NOTION:s}=e,{meta:m}=p,[c,h,a]=m,u=new Date(`${c||_.slice(0,4)}-${h||"01"}-${a||"01"}`),y=((D=(k=s[r.toUpperCase()])==null?void 0:k.infoType)==null?void 0:D.notion)??o.datePublished.notion,P=await n({database_id:s[r.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:I(u,"")}},{property:y,date:{before:I(u,"day")}},f(g({},x.slug),{text:{equals:i}})]}}),S=(P==null?void 0:P.object)==="list"&&P.results[0];if(!S)return{info:{},content:{},items:{},images:{}};let E=(0,re.default)(S,"properties");E.properties=(0,oe.sortObject)(w({config:e,data:S,pathVariables:p,pageId:E.id}));let T=await t({block_id:E.id});return{info:E,content:T,items:{},images:{}}},uo=async({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getQuery:p,pathVariables:r,routeType:i,slug:_})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:m}=e;return s[i.toUpperCase()].hasChild?await po({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,getQuery:p,pathVariables:r,routeType:i}):m[b.LISTING_BY_DATE].includes(i.toUpperCase())?await _o({config:e,getBlocksByIdChildren:t,getDatabasesByIdQuery:n,pathVariables:r,routeType:i,slug:_}):{info:{},content:{},items:{},images:{}}},ne=uo;var H=l(require("@jeromefitz/utils"),1),co=async({getPagesRetrieve:e,page_id:t})=>(0,H.isUndefined)(t)?[]:(await(0,H.avoidRateLimit)(),await e({page_id:t})),ie=co;var se=l(require("lodash/drop.js"),1),_t=l(require("lodash/dropRight.js"),1),ut=l(require("lodash/first.js"),1),ae=l(require("lodash/includes.js"),1),dt=l(require("lodash/isInteger.js"),1),ct=l(require("lodash/join.js"),1),yt=l(require("lodash/last.js"),1),le=l(require("lodash/size.js"),1);var yo=({config:e,catchAll:t})=>{let{NOTION:n,PAGES__HOMEPAGE:p,ROUTE_META:r,ROUTE_TYPES:i}=e,_=(0,le.default)(t),s=(0,ut.default)(t),m=s.toUpperCase(),c=(0,yt.default)(t),h=_>1&&(0,ae.default)(r,m)?(0,se.default)(t):(0,se.default)((0,_t.default)(t)),a=s===c&&!(0,ae.default)(i,m)?n.PAGES.routeType:s,u=s!==c&&!(0,dt.default)(parseInt(c))?c:s,y=a===n.PAGES.routeType.toLowerCase(),P=u===s,S=!!h&&(0,le.default)(h)!==0,E=y&&s===p?"":(0,ct.default)(t,"/"),T={hasMeta:S,isPage:y,isIndex:P,meta:h,routeType:a,slug:u,url:E},k=$(T);return f(g({},T),{dataType:k})},pe=yo;var Q=l(require("@jeromefitz/utils"),1),mt=l(require("lodash/map.js"),1),ht=l(require("lodash/omit.js"),1),St=l(require("lodash/size.js"),1);var mo=[{property:o.slug.notion,direction:"ascending"}],ho=async({config:e,reqQuery:t,notionDatabasesQuery:n})=>{let{NOTION:p}=e,{databaseType:r}=t,i=r,_=!1,s=r.toUpperCase(),m=p[s].database_id;if(!m)return[];let c={},h={},a,u;if(r==="EPISODES"){u=mo;let{podcasts:y}=t,P=[],S=[];!!y&&S.push(...y==null?void 0:y.split(",")),(0,St.default)(S)>0&&(0,mt.default)(S,E=>P.push({property:o.relationEpisodes__Podcast.notion,relation:{contains:E}})),a={or:[...P]}}else _=!0;if(!_&&(!c||(0,Q.isObjectEmpty)(c))){await(0,Q.avoidRateLimit)();let y;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:o.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),y=await n({database_id:m,filter:a,sorts:u}),c=y,h=Ge({config:e,results:y.results,routeType:i}),c=(0,ht.default)(c,"results"),c.results=h):_=!0}return c},_e=ho;var gt=class extends Pt.Client{constructor(t){super(t);this.custom={getBlocksByIdChildren:async t=>await F(f(g({},t),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async t=>await W(f(g({},t),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async t=>await Y(f(g({},t),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:t=>z(f(g({},t),{config:this.#e})),getPagesById:async t=>await ie(f(g({},t),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:t=>pe(f(g({},t),{config:this.#e})),getQuery:async t=>await _e(f(g({},t),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[b.LISTING]:async t=>await J(f(g({},t),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[b.LISTING_BY_DATE]:async t=>await ee(f(g({},t),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[b.SLUG]:async t=>await te(f(g({},t),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[b.SLUG_BY_ROUTE]:async t=>await ne(f(g({},t),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery}))};this.#e=t==null?void 0:t.config}#e};module.exports=Ct(So);0&&(module.exports={Client});
package/index.d.ts CHANGED
@@ -1,37 +1,44 @@
1
1
  import { DataTypes } from './schema/index';
2
2
  import { Client as Client$1 } from '@notionhq/client';
3
3
 
4
+ declare type CredentialProps = {
5
+ auth: string;
6
+ config: any;
7
+ };
8
+ declare type CustomProps = {
9
+ getBlocksByIdChildren: any;
10
+ getDatabasesByIdQuery: any;
11
+ getDeepFetchAllChildren: any;
12
+ getInfoType: any;
13
+ getPagesById: any;
14
+ getPathVariables: any;
15
+ getQuery: any;
16
+ };
17
+ declare type DataTypesProps = {
18
+ LISTING: any;
19
+ LISTING_BY_DATE: any;
20
+ SLUG: any;
21
+ SLUG_BY_ROUTE: any;
22
+ };
23
+ declare type ClientProps = {
24
+ custom: CustomProps;
25
+ dataTypes: DataTypesProps;
26
+ };
4
27
  declare class Client extends Client$1 {
5
28
  #private;
6
29
  constructor(options?: any);
7
30
  readonly custom: {
8
- getBlocksByIdChildren: (props: {
9
- block_id: any;
10
- }) => Promise<any>;
11
- getDatabasesByIdQuery: (props: {
12
- database_id: any;
13
- sorts?: any;
14
- filter?: any;
15
- }) => Promise<any>;
16
- getDeepFetchAllChildren: (props: {
17
- blocks: any;
18
- }) => Promise<any[]>;
19
- getInfoType: (props: {
20
- config: any;
21
- item: any;
22
- routeType: any;
23
- meta: any;
24
- }) => {
31
+ getBlocksByIdChildren: (props: any) => Promise<any>;
32
+ getDatabasesByIdQuery: (props: any) => Promise<any>;
33
+ getDeepFetchAllChildren: (props: any) => Promise<any[]>;
34
+ getInfoType: (props: any) => {
25
35
  as: string;
26
36
  date: string;
27
37
  href: string;
28
38
  slug: any;
29
39
  };
30
40
  getPagesById: (props: any) => Promise<any>;
31
- getPathVariables: (props: {
32
- config: any;
33
- catchAll: any;
34
- }) => {
41
+ getPathVariables: (props: any) => {
35
42
  dataType: DataTypes;
36
43
  hasMeta: boolean;
37
44
  isPage: boolean;
@@ -44,24 +51,54 @@ declare class Client extends Client$1 {
44
51
  getQuery: (props: any) => Promise<any>;
45
52
  };
46
53
  /**
47
- * @info
54
+ * @info details at: ../../utils/getDataType
48
55
  *
49
- * 1 = /about, /colophon, /contact
50
- * 2 = /blog, /events, /podcasts
51
- * 3 = /blog/2020, /blog/2020/05, /blog/2020/05/09
52
- * /events/2020, /events/2020/05, /events/2020/05/09,
53
- * 4 = /blog/2020/05/09/title, /events/2020/05/09/title,
54
- * /podcasts/knockoffs/i-know-what-you-did-last-summer
55
- * 5 = /shows/alex-o-jerome, /events/2020/05/09/jerome-and,
56
- * /podcasts/knockoffs
57
56
  */
58
57
  readonly dataTypes: {
59
- [x: string]: (props: {
58
+ [x: string]: ((props: {
59
+ pathVariables: any;
60
+ routeType: any;
61
+ slug?: any;
62
+ }) => Promise<{
63
+ info?: undefined;
64
+ content?: undefined;
65
+ items?: undefined;
66
+ images?: undefined;
67
+ } | {
68
+ info: any;
69
+ content: any;
70
+ items: Pick<any, string | number | symbol>;
71
+ images: {};
72
+ }>) | ((props: {
73
+ pathVariables: any;
74
+ routeType: any;
75
+ slug: any;
76
+ }) => Promise<{
77
+ info: any;
78
+ content: any;
79
+ items: Pick<Pick<any, string | number | symbol>, string | number | symbol>;
80
+ images: {};
81
+ }>) | ((props: {
60
82
  pathVariables: any;
61
83
  routeType: any;
62
84
  slug: any;
63
- }) => Promise<{}>;
85
+ }) => Promise<{
86
+ info: {};
87
+ content: {};
88
+ items: {};
89
+ images: {};
90
+ } | {
91
+ info?: undefined;
92
+ content?: undefined;
93
+ items?: undefined;
94
+ images?: undefined;
95
+ } | {
96
+ info: Pick<any, string | number | symbol>;
97
+ content: any[];
98
+ items: {};
99
+ images: {};
100
+ }>);
64
101
  };
65
102
  }
66
103
 
67
- export { Client };
104
+ export { Client, ClientProps, CredentialProps };
package/index.js CHANGED
@@ -1 +1 @@
1
- var Xe=Object.defineProperty,et=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var ue=Object.getOwnPropertySymbols;var ot=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var de=(e,o,n)=>o in e?Xe(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,b=(e,o)=>{for(var n in o||(o={}))ot.call(o,n)&&de(e,n,o[n]);if(ue)for(var n of ue(o))rt.call(o,n)&&de(e,n,o[n]);return e},k=(e,o)=>et(e,tt(o));var ce=(e,o,n)=>{if(!o.has(e))throw TypeError("Cannot "+n)};var L=(e,o,n)=>(ce(e,o,"read from private field"),n?n.call(e):o.get(e)),ye=(e,o,n)=>{if(o.has(e))throw TypeError("Cannot add the same private member more than once");o instanceof WeakSet?o.add(e):o.set(e,n)},me=(e,o,n,l)=>(ce(e,o,"write to private field"),l?l.call(e,n):o.set(e,n),n);import{Client as xo}from"@notionhq/client";import N from"lodash/filter.js";import nt from"lodash/map.js";var O=({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"},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__Podcast:{init:!0,key:"relationEpisodes__Podcast",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"}},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"},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"},subtitle:{init:!0,key:"subtitle",notion:"Subitle",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"}},G=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.title],he=[...G],Se=[...G,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__Podcast,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type],Pe=[...G,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],fe=[...G],Ee=[...G,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],ge=[...G,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],we=[...G],be=[...G,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],Te=[...G,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],Bo={BLOG:N(he,{init:!0}),EPISODES:N(Se,{init:!0}),EVENTS:N(Pe,{init:!0}),PAGES:N(fe,{init:!0}),PEOPLE:N(Ee,{init:!0}),PODCASTS:N(ge,{init:!0}),SEO:N(we,{init:!0}),SHOWS:N(be,{init:!0}),VENUES:N(Te,{init:!0})},ke={BLOG:he.map(e=>O(e)),EPISODES:Se.map(e=>O(e)),EVENTS:Pe.map(e=>O(e)),PAGES:fe.map(e=>O(e)),PEOPLE:Ee.map(e=>O(e)),PODCASTS:ge.map(e=>O(e)),SEO:we.map(e=>O(e)),SHOWS:be.map(e=>O(e)),VENUES:Te.map(e=>O(e))},Ie=nt(t,e=>O(e)),De=new Date().toISOString(),A={dateBefore:{property:t.datePublished.notion,date:{before:De}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:De}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,text:{equals:""}}},it="LISTING",st="LISTING_BY_DATE",at="SLUG",lt="SLUG_BY_ROUTE",pt=[it,st,at,lt],C=Object.assign({},...pt.map(e=>({[e]:e})).flat(1));import{avoidRateLimit as _t,isUndefined as ut}from"@jeromefitz/utils";var dt=async(e,{block_id:o})=>ut(o)?[]:(await _t(),await e({block_id:o})),q=dt;var Ce={sorts:[{property:t.slug.notion,direction:"ascending"}]},ct=async(e,{database_id:o,sorts:n=Ce.sorts,filter:l=Ce.filter})=>o?await e({database_id:o,sorts:n,filter:l}):[],Z=ct;var ve=async(e,{blocks:o})=>{if(o==null)return o;let n=o.filter(r=>r.has_children).map(r=>({promise:e({block_id:r.id,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 ve(e,{blocks:i}),n[r]){let a=n[r].parent_block;a[a.type].children=i}}return o},K=ve;var yt=({config:e,item:o,routeType:n,meta:l})=>{var c,u,y,f,_;let{NOTION:r}=e,i="",a=(c=o.properties)==null?void 0:c.slug,s="",d="/[...catchAll]";switch(n){case r.BLOG.routeType:i=(y=(u=o.properties)==null?void 0:u.datePublished)==null?void 0:y.start.slice(0,10);let[T,E,g]=i==null?void 0:i.split("-");s=`/${n}/${T}/${E}/${g}/${a}`;break;case r.EVENTS.routeType:i=(_=(f=o.properties)==null?void 0:f.dateEvent)==null?void 0:_.start.slice(0,10);let[p,w,m]=i==null?void 0:i.split("-");s=`/${n}/${p}/${w}/${m}/${a}`;break;case r.PODCASTS.routeType:case r.EPISODES.routeType:s=`/${l==null?void 0:l.join("/")}/${a}`;break;case r.PEOPLE.routeType:case r.SHOWS.routeType:case r.VENUES.routeType:default:s=`/${n}/${a}`;break}return s=s.replace("//","/"),{as:s,date:i,href:d,slug:a}},J=yt;import{sortObject as je}from"@jeromefitz/utils";import to from"lodash/map.js";import re from"lodash/omit.js";import xe from"date-fns/addDays/index.js";import mt from"date-fns/addMonths/index.js";import ht from"date-fns/addYears/index.js";var St=(e,o)=>{switch(o){case"year":return ht(e,1).toISOString();case"month":return mt(e,1).toISOString();case"day":return xe(e,2).toISOString()}return xe(e,-1).toISOString()},D=St;import Pt from"lodash/map.js";var ft=({config:e,data:o,pathVariables:n,pageId:l})=>{var c,u;let{NOTION:r}=e,i={};if(!(o==null?void 0:o.properties))return i;let{properties:a}=o,s;if(n){let{meta:y,routeType:f}=n;s=f===((c=r==null?void 0:r.PODCASTS)==null?void 0:c.routeType)&&y.length>1?(u=r==null?void 0:r.EPISODES)==null?void 0:u.routeType:f}let d=s?ke[s.toUpperCase()]:Ie;return Pt(d,y=>{let f,_=a[y.notion];i[y.key]=null,_&&(f=U[y.type](_,l),i[y.key]=f||null)}),i},I=ft;import{sortObject as Et}from"@jeromefitz/utils";import gt from"lodash/map.js";import wt from"lodash/omit.js";var bt=({config:e,results:o,routeType:n})=>{let l=[];return gt(o,r=>{let i=wt(r,"properties");i.properties=Et(I({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),l.push(i)}),l},Oe=bt;import Tt from"lodash/filter.js";import X from"lodash/map.js";var kt=(e,o)=>{switch(o){case"info":let n=[];return X(e.seoImage,r=>!!(r==null?void 0:r.url)&&(r==null?void 0:r.type)==="external"&&n.push(r==null?void 0:r.url)),n;case"content":return!!e&&Tt(e,{object:"block",type:"image"});case"items":let l=[];return X(e,r=>{var i;X((i=r==null?void 0:r.properties)==null?void 0:i.seoImage,a=>!!(a==null?void 0:a.url)&&(a==null?void 0:a.type)==="external"&&l.push(a==null?void 0:a.url))}),l;default:return[]}},R=kt;import It from"github-slugger";import ee from"lodash/map.js";import{getPlaiceholder as te}from"plaiceholder";var Dt=async({data:e,pathVariables:o})=>{var u,y,f,_,T,E,g;let n=new It,l={},r=((u=e.info)==null?void 0:u.object)==="page"?R((y=e.info)==null?void 0:y.properties,"info"):!!((f=e.info)==null?void 0:f.results)&&R((T=(_=e.info)==null?void 0:_.results[0])==null?void 0:T.properties,"info"),i=!!r&&r.map(async p=>{if(!p)return null;let w=!!p&&!!(p==null?void 0:p.url)?p==null?void 0:p.url:p;if(!w)return null;let{base64:m,img:P}=await te(w),x=n.slug(w);return{base64:m,id:x,img:P,url:w}}),a=i?await Promise.all(i):[],s=!o.isIndex&&R(e==null?void 0:e.content,"content"),d=!!s&&s.map(async p=>{var B,M;if(!p)return null;let{type:w}=p,m=p[w],P=!!p&&!!((B=m==null?void 0:m.external)==null?void 0:B.url)?(M=m==null?void 0:m.external)==null?void 0:M.url:null;if(!P)return null;let{base64:x,img:H}=await te(P),V=n.slug(P);return{base64:x,id:V,img:H,url:P}}),c=d?await Promise.all(d):[];if(e.items){let p=e.items.object==="page"?R((E=e.items)==null?void 0:E.data,"items"):R((g=e.items)==null?void 0:g.results,"items"),w=!!p&&p.map(async P=>{if(!P)return null;let x=!!P&&!!(P==null?void 0:P.url)?P==null?void 0:P.url:P;if(!x)return null;let{base64:H,img:V}=await te(x),B=n.slug(x);return{base64:H,id:B,img:V,url:x}}),m=await Promise.all(w);!!m&&m[0]&&ee(m,P=>l[P.id]=P)}return!!a&&a[0]&&ee(a,p=>l[p.id]=p),!!c&&c[0]&&ee(c,p=>l[p.id]=p),l},F=Dt;var Ct=e=>(console.dir("@notion(_unsupported)"),console.dir(e),e),Q=Ct;var vt=e=>e.checkbox||!1,Ne=vt;var xt=e=>{let{type:o}=e;return e[o]},j=xt;var Ot=e=>e.email||null,Ge=Ot;import{stringToUUID as Nt}from"@jeromefitz/utils";import Gt from"github-slugger";import Lt from"lodash/size.js";var Bt="https://www.notion.so/image/{{FILENAME}}?table=block&id={{PAGE_ID}}&cache=v2&w1dth=600",At=(e,o)=>Bt.replace("{{FILENAME}}",encodeURIComponent(e)).replace("{{PAGE_ID}}",Nt(o)),Ut=(e,o)=>{let n=new Gt,l={};return Lt(e.files)<=0||e.files.map(r=>{var i,a;if((r==null?void 0:r.type)==="file"){let s=(i=r==null?void 0:r.file)==null?void 0:i.url.split("?")[0],d=n.slug(s);l[d]={type:r==null?void 0:r.type,url:At(s,o)}}if((r==null?void 0:r.type)==="external"){let s=(a=r==null?void 0:r.external)==null?void 0:a.url.split("?")[0],d=n.slug(s);l[d]={type:r==null?void 0:r.type,url:s}}}),l},oe=Ut;import Vt from"github-slugger";import Mt from"lodash/map.js";var Rt=e=>{let o=new Vt,n={};return Mt(e.multi_select,l=>{let r=l;r.slug=o.slug(r.name),n[r.id]=r}),n},Le=Rt;var Ht=e=>(e==null?void 0:e.number)||null,Be=Ht;import Wt from"github-slugger";var Ft=e=>{let o=new Wt;return e.people.map(n=>{let{avatar_url:l,id:r,name:i,person:a}=n,{email:s}=a;return{[o.slug(i)]:{avatar_url:l,email:s,id:r,name:i}}})[0]},Ae=Ft;var Qt=e=>(e==null?void 0:e.phone_number)||null,Ue=Qt;import Ve from"lodash/map.js";var jt=e=>e.type==="rollup"?e.rollup.type==="array"&&Ve(e.rollup.array,o=>U[o.type](o))[0]:Ve(e.relation,o=>o.id),Me=jt;var zt=e=>{var o;return(e==null?void 0:e.rich_text)?(o=e==null?void 0:e.rich_text[0])==null?void 0:o.plain_text:null},Re=zt;import $t from"lodash/map.js";import Yt from"lodash/sortBy.js";var qt=e=>{var o;return Yt($t((o=e==null?void 0:e.rollup)==null?void 0:o.array,n=>U[n.type](n)))},He=qt;import Zt from"github-slugger";var Kt=e=>{let o=new Zt,n=e.select;return n?(n.slug=o.slug(e.select.name),{[n.id]:n}):null},We=Kt;var Jt=e=>{var o;return(e==null?void 0:e.title)?(o=e==null?void 0:e.title[0])==null?void 0:o.plain_text:null},Fe=Jt;var Xt=e=>e.url||null,Qe=Xt;var eo={checkbox:Ne,created_by:Q,created_time:j,date:j,email:Ge,files:oe,formula:Q,image:oe,last_edited_by:Q,last_edited_time:j,multi_select:Le,number:Be,people:Ae,phone_number:Ue,relation:Me,rich_text:Re,rollup:He,select:We,title:Fe,url:Qe},U=eo;var oo=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i})=>{let{NOTION:a}=e,s={},d={},c={},u=new Date().toISOString(),y=new Date("2020-01-01").toISOString(),f=a[i.toUpperCase()].page_id__seo,_=await l({page_id:f});if(!_)return{};(_==null?void 0:_.object)==="page"&&(d=re(_,"properties"),d.properties=je(I({config:e,data:_,pathVariables:r,pageId:d.id}))),s=await o({block_id:d.id});let T=await n({database_id:a[i.toUpperCase()].database_id,filter:{and:[{property:i===a.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:i===a.EVENTS.routeType?u:y}}]}}),E=[];to(T.results,m=>{let P=m;P=re(P,"properties"),P.properties=je(I({config:e,data:m,pathVariables:r,pageId:m.id})),E.push(P)});let g=re(T,"results");g.results=E,c=g;let p={info:d,content:s,items:c,images:{}},w=p?await F({data:p,pathVariables:r}):{};return p=k(b({},p),{images:w}),p},ne=oo;import{sortObject as ze}from"@jeromefitz/utils";import ro from"lodash/map.js";import z from"lodash/omit.js";import no from"lodash/size.js";var io=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,{meta:d}=r,c={},u={},y={},f=new Date().toISOString(),_=s[i.toUpperCase()].page_id__seo,T=await l({page_id:_});T.object==="page"&&(u=z(T,"properties"),u.properties=ze(I({config:e,data:T,pathVariables:r,pageId:u.id}))),c=await o({block_id:u.id});let E=no(d),[g,p,w]=d,m=new Date(`${g||f.slice(0,4)}-${p||"01"}-${w||"01"}`),P,x=[{property:t.datePublished.notion,direction:"descending"}];switch(E){case 1:P={and:[{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:D(m,"")}},{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{before:D(m,"year")}}]};break;case 2:P={and:[{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:D(m,"")}},{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{before:D(m,"month")}}]};break;case 3:P={and:[{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:D(m,"")}},{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{before:D(m,"day")}}]};break;default:P={and:[{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:D(m,"")}},{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{before:D(m,"day")}},k(b({},A.slug),{text:{equals:a}})]};break}let H=s[i.toUpperCase()].database_id,V=await n({database_id:H,filter:P,sorts:x}),B=[];ro(V.results,Y=>{let W=Y;W=z(W,"properties"),W.properties=ze(I({config:e,data:Y,pathVariables:r,pageId:Y.id})),!!W&&B.push(W)});let M=z(V,"results");M.results=B,y=M,y=z(M,"data");let $={info:u,content:c,items:y,images:{}},Je={};return $=k(b({},$),{images:Je}),$},ie=io;import{sortObject as so}from"@jeromefitz/utils";import ao from"lodash/filter.js";import lo from"lodash/omit.js";var po=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getDeepFetchAllChildren:l,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,d={},c={},u={},y=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(y))return{info:c,content:d,items:u,images:{}};let _=await n({database_id:s[y].database_id,filter:{and:[k(b({},A.slug),{text:{equals:a}})]}}),T=(_==null?void 0:_.object)==="list"&&_.results[0];if(!T)return{};c=lo(T,"properties"),c.properties=so(I({config:e,data:T,pathVariables:r,pageId:c.id})),d=await o({block_id:c.id}),d=[...await l({blocks:d.results})],u&&(u.results=ao(u.results,{properties:{isPublished:!0}}));let g={info:c,content:d,items:u,images:{}},p=g?await F({data:g,pathVariables:r}):{};return g=k(b({},g),{images:p}),g},se=po;import{sortObject as $e}from"@jeromefitz/utils";import Ye from"lodash/omit.js";import _o from"lodash/size.js";var uo=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i,slug:a})=>{let{NOTION:s}=e,{meta:d}=r,c={},u={},y={},f=new Date().toISOString();if(i===s.PODCASTS.routeType){let[E,g]=d,p=_o(d)===2,w=await n({database_id:s[p?s.EPISODES.routeType.toUpperCase():i.toUpperCase()].database_id,filter:{and:[k(b({},A.slug),{text:{equals:p?g:E}})]}}),m=(w==null?void 0:w.object)==="list"&&w.results[0];if(!m)return{};u=Ye(m,"properties"),u.properties=$e(I({config:e,data:m,pathVariables:r,pageId:u.id})),c=await o({block_id:u.id}),p||i===s.PODCASTS.routeType&&(y=await l({config:e,reqQuery:{podcasts:u.id,databaseType:s.EPISODES.routeType.toUpperCase()}}))}if([s.BLOG.routeType,s.EVENTS.routeType].includes(i)){let[E,g,p]=d,w=new Date(`${E||f.slice(0,4)}-${g||"01"}-${p||"01"}`),m=await n({database_id:s[i.toUpperCase()].database_id,filter:{and:[{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{on_or_after:D(w,"")}},{property:i===s.EVENTS.routeType?t.dateEvent.notion:t.datePublished.notion,date:{before:D(w,"day")}},k(b({},A.slug),{text:{equals:a}})]}}),P=(m==null?void 0:m.object)==="list"&&m.results[0];P&&(u=Ye(P,"properties"),u.properties=$e(I({config:e,data:P,pathVariables:r,pageId:u.id})),c=await o({block_id:u.id}))}let _={info:u,content:c,items:y,images:{}},T={};return _=k(b({},_),{images:T}),_},ae=uo;import{avoidRateLimit as co,isUndefined as yo}from"@jeromefitz/utils";var mo=async(e,{page_id:o})=>yo(o)?[]:(await co(),await e({page_id:o})),le=mo;import qe from"lodash/drop.js";import ho from"lodash/dropRight.js";import So from"lodash/first.js";import Ze from"lodash/includes.js";import Po from"lodash/isInteger.js";import fo from"lodash/join.js";import Eo from"lodash/last.js";import Ke from"lodash/size.js";var go=({config:e,catchAll:o})=>{let{NOTION:n,PAGES__HOMEPAGE:l,ROUTE_TYPES:r}=e,i=Ke(o),a=So(o),s=Eo(o),d=i>1&&Ze([n.BLOG.routeType,n.EVENTS.routeType,n.PODCASTS.routeType],a)?qe(o):qe(ho(o)),c=a===s&&!Ze(r,a)?"pages":a,u=a!==s&&!Po(parseInt(s))?s:a,y=c==="pages",f=u===a,_=!!d&&Ke(d)!==0,T=y&&a===l?"":fo(o,"/"),E=C.SLUG;return y?E=C.SLUG:f&&!_?E=C.LISTING:f&&_?E=C.LISTING_BY_DATE:_?E=C.SLUG_BY_ROUTE:E=C.SLUG,{dataType:E,hasMeta:_,isPage:y,isIndex:f,meta:d,routeType:c,slug:u,url:T}},pe=go;import{avoidRateLimit as wo,isObjectEmpty as bo}from"@jeromefitz/utils";import To from"lodash/map.js";import ko from"lodash/omit.js";import Io from"lodash/size.js";var Do={ASCENDING:"ascending",DESCENDING:"descending"},Co=[{property:t.slug.notion,direction:Do.ASCENDING}],vo=async({config:e,reqQuery:o,notionDatabasesQuery:n})=>{let{NOTION:l}=e,{databaseType:r}=o,i=r,a=!1,s=r.toUpperCase(),d=l[s].database_id;if(!d)return[];let c={},u={},y,f;if(r==="EPISODES"){f=Co;let{podcasts:_}=o,T=[],E=[];!!_&&E.push(..._==null?void 0:_.split(",")),Io(E)>0&&To(E,g=>T.push({property:t.relationEpisodes__Podcast.notion,relation:{contains:g}})),y={or:[...T]}}else a=!0;if(!a&&(!c||bo(c))){await wo();let _;y?((y==null?void 0:y.or.length)===0&&(y={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),_=await n({database_id:d,filter:y,sorts:f}),c=_,u=Oe({config:e,results:_.results,routeType:i}),c=ko(c,"results"),c.results=u):a=!0}return c},_e=vo;var v,Oo=class extends xo{constructor(o){super(o);ye(this,v,void 0);this.custom={getBlocksByIdChildren:async o=>await q(this.blocks.children.list,b({},o)),getDatabasesByIdQuery:async o=>await Z(this.databases.query,o),getDeepFetchAllChildren:async o=>await K(this.blocks.children.list,b({},o)),getInfoType:o=>J(k(b({},o),{config:L(this,v)})),getPagesById:async o=>await le(this.pages.retrieve,b({},o)),getPathVariables:o=>pe(k(b({},o),{config:L(this,v)})),getQuery:async o=>await _e(k(b({},o),{config:L(this,v),notionDatabasesQuery:this.databases.query}))};this.dataTypes={[C.LISTING]:async o=>await ne(k(b({},o),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[C.LISTING_BY_DATE]:async o=>await ie(k(b({},o),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[C.SLUG]:async o=>await se(k(b({},o),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[C.SLUG_BY_ROUTE]:async o=>await ae(k(b({},o),{config:L(this,v),getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getQuery:this.custom.getQuery}))};me(this,v,o==null?void 0:o.config)}};v=new WeakMap;export{Oo as Client};
1
+ var Re=Object.defineProperty,Ge=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var Ue=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var X=(e,o,n)=>o in e?Re(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,g=(e,o)=>{for(var n in o||(o={}))Ue.call(o,n)&&X(e,n,o[n]);if(J)for(var n of J(o))Me.call(o,n)&&X(e,n,o[n]);return e},f=(e,o)=>Ge(e,Ae(o));import{Client as po}from"@notionhq/client";import O from"lodash/filter.js";import Ve from"lodash/map.js";var C=({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"},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__Podcast:{init:!0,key:"relationEpisodes__Podcast",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"}},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"},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"},subtitle:{init:!0,key:"subtitle",notion:"Subitle",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"}},v=[t.authors,t.datePublished,t.isIndexed,t.isPublished,t.slug,t.seoDescription,t.seoImage,t.seoImageDescription,t.title],ee=[...v],te=[...v,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__Podcast,t.relationEpisodes__Venues,t.socialApple,t.socialSpotify,t.type],oe=[...v,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=[...v],ne=[...v,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=[...v,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],se=[...v],ae=[...v,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=[...v,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],mo={BLOG:O(ee,{init:!0}),EPISODES:O(te,{init:!0}),EVENTS:O(oe,{init:!0}),PAGES:O(re,{init:!0}),PEOPLE:O(ne,{init:!0}),PODCASTS:O(ie,{init:!0}),SEO:O(se,{init:!0}),SHOWS:O(ae,{init:!0}),VENUES:O(le,{init:!0})},pe={BLOG:ee.map(e=>C(e)),EPISODES:te.map(e=>C(e)),EVENTS:oe.map(e=>C(e)),PAGES:re.map(e=>C(e)),PEOPLE:ne.map(e=>C(e)),PODCASTS:ie.map(e=>C(e)),SEO:se.map(e=>C(e)),SHOWS:ae.map(e=>C(e)),VENUES:le.map(e=>C(e))},_e=Ve(t,e=>C(e)),ue=new Date().toISOString(),x={dateBefore:{property:t.datePublished.notion,date:{before:ue}},dateOnOrAfter:{property:t.datePublished.notion,date:{on_or_after:ue}},published:{property:t.isPublished.notion,checkbox:{equals:!1}},slug:{property:t.slug.notion,text:{equals:""}}},He="LISTING",Qe="LISTING_BY_DATE",Fe="SLUG",We="SLUG_BY_ROUTE",Ye=[He,Qe,Fe,We],b=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(),await e({block_id:o})),U=$e;var B={sorts:[{property:t.slug.notion,direction:"ascending"}]},qe=async({database_id:e,filter:o=B==null?void 0:B.filter,getDatabasesQuery:n,sorts:l=B==null?void 0:B.sorts})=>e?await n({database_id:e,sorts:l,filter:o}):[],M=qe;var de=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 de({blocks:i,getBlocksChildrenList:e}),n[r]){let p=n[r].parent_block;p[p.type].children=i}}return o},V=de;var Ze=({config:e,item:o,routeType:n,meta:l})=>{var c,h;let{NOTION:r}=e,i="",p=(c=o.properties)==null?void 0:c.slug,s="",m="/[...catchAll]";switch(n){case r.BLOG.routeType:case r.EVENTS.routeType:i=(h=o.properties[r[n.toUpperCase()].infoType.key])==null?void 0:h.start.slice(0,10);let[a,_,y]=i==null?void 0:i.split("-");s=`/${n}/${a}/${_}/${y}/${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:m,slug:p}},H=Ze;import{sortObject as Ce}from"@jeromefitz/utils";import Nt from"lodash/map.js";import W from"lodash/omit.js";import ce from"date-fns/addDays/index.js";import Ke 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 Ke(e,1).toISOString();case"day":return ce(e,2).toISOString()}return ce(e,-1).toISOString()},I=Xe;import et from"lodash/map.js";var tt=({config:e,data:o,pathVariables:n,pageId:l})=>{var c,h;let{NOTION:r}=e,i={};if(!(o==null?void 0:o.properties))return i;let{properties:p}=o,s="";if(n){let{meta:a,routeType:_}=n;s=_===((c=r==null?void 0:r.PODCASTS)==null?void 0:c.routeType)&&a.length>1?(h=r==null?void 0:r.EPISODES)==null?void 0:h.routeType:_}let m=s?pe[s.toUpperCase()]:_e;return et(m,a=>{let _,y=p[a.notion];i[a.key]=null,y&&(_=L[a.type](y,l),i[a.key]=_||null)}),i},w=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(w({config:e,data:r,pathVariables:n,pageId:r==null?void 0:r.id})),l.push(i)}),l},ye=it;var st=({isPage:e,isIndex:o,hasMeta:n})=>e?b.SLUG:o&&!n?b.LISTING:o&&n?b.LISTING_BY_DATE:n?b.SLUG_BY_ROUTE:b.SLUG,Q=st;var at=e=>(console.dir("@notion(_unsupported)"),e),R=at;var lt=e=>e.checkbox||!1,me=lt;var pt=e=>{let{type:o}=e;return e[o]},G=pt;var _t=e=>e.email||null,he=_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],m=n.slug(s);l[m]={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],m=n.slug(s);l[m]={type:r==null?void 0:r.type,url:s}}}),l},F=ht;import St from"github-slugger";import Pt from"lodash/map.js";var gt=e=>{let o=new St,n={};return Pt(e.multi_select,l=>{let r=l;r.slug=o.slug(r.name),n[r.id]=r}),n},Se=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]},ge=wt;var Tt=e=>(e==null?void 0:e.phone_number)||null,fe=Tt;import Ee from"lodash/map.js";var kt=e=>e.type==="rollup"?e.rollup.type==="array"&&Ee(e.rollup.array,o=>L[o.type](o))[0]:Ee(e.relation,o=>o.id),we=kt;var bt=e=>{var o;return(e==null?void 0:e.rich_text)?(o=e==null?void 0:e.rich_text[0])==null?void 0:o.plain_text:null},Te=bt;import It from"lodash/map.js";import Dt from"lodash/sortBy.js";var Ct=e=>{var o;return Dt(It((o=e==null?void 0:e.rollup)==null?void 0:o.array,n=>L[n.type](n)))},ke=Ct;import Ot from"github-slugger";var vt=e=>{let o=new Ot,n=e.select;return n?(n.slug=o.slug(e.select.name),{[n.id]:n}):null},be=vt;var xt=e=>{var o;return(e==null?void 0:e.title)?(o=e==null?void 0:e.title[0])==null?void 0:o.plain_text:null},Ie=xt;var Lt=e=>e.url||null,De=Lt;var Bt={checkbox:me,created_by:R,created_time:G,date:G,email:he,files:F,formula:R,image:F,last_edited_by:R,last_edited_time:G,multi_select:Se,number:Pe,people:ge,phone_number:fe,relation:we,rich_text:Te,rollup:ke,select:be,title:Ie,url:De},L=Bt;var Rt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i})=>{let{NOTION:p}=e,s={},m=new Date().toISOString(),c=new Date("2020-01-01").toISOString(),h=p[i.toUpperCase()].page_id__seo,a=await l({page_id:h});if(!a)return{};(a==null?void 0:a.object)==="page"&&(s=W(a,"properties"),s.properties=Ce(w({config:e,data:a,pathVariables:r,pageId:s.id})));let _=p.EVENTS.routeType===i,y=p[i.toUpperCase()].infoType.notion??t.datePublished.notion,P=await o({block_id:s.id}),S=await n({database_id:p[i.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:_?m:c}}]}}),E=[];Nt(S.results,k=>{let D=k;D=W(D,"properties"),D.properties=Ce(w({config:e,data:k,pathVariables:r,pageId:k.id})),E.push(D)});let T=W(S,"results");return T.results=E,{info:s,content:P,items:T,images:{}}},Y=Rt;import{sortObject as Oe}from"@jeromefitz/utils";import Gt from"lodash/map.js";import A from"lodash/omit.js";import At from"lodash/size.js";var Ut=({config:e,pathVariables:o,routeType:n,slug:l})=>{var y,P;let{NOTION:r}=e,{meta:i}=o,[p,s,m]=i,c=At(i),h=new Date().toISOString(),a=new Date(`${p||h.slice(0,4)}-${s||"01"}-${m||"01"}`),_=((P=(y=r[n.toUpperCase()])==null?void 0:y.infoType)==null?void 0:P.notion)??t.datePublished.notion;switch(c){case 1:return{and:[{property:_,date:{on_or_after:I(a,"")}},{property:_,date:{before:I(a,"year")}}]};case 2:return{and:[{property:_,date:{on_or_after:I(a,"")}},{property:_,date:{before:I(a,"month")}}]};case 3:return{and:[{property:_,date:{on_or_after:I(a,"")}},{property:_,date:{before:I(a,"day")}}]};default:return{and:[{property:_,date:{on_or_after:I(a,"")}},{property:_,date:{before:I(a,"day")}},f(g({},x.slug),{text:{equals:l}})]}}},Mt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getPagesById:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,m={},c={},h=s[i.toUpperCase()].page_id__seo,a=await l({page_id:h});a.object==="page"&&(c=A(a,"properties"),c.properties=Oe(w({config:e,data:a,pathVariables:r,pageId:a.id}))),m=await o({block_id:c.id});let _=[{property:t.datePublished.notion,direction:"descending"}],y=Ut({config:e,pathVariables:r,routeType:i,slug:p}),P=s[i.toUpperCase()].database_id,S=await n({database_id:P,filter:y,sorts:_}),E=[];Gt(S.results,D=>{let N=A(D,"properties");N.properties=Oe(w({config:e,data:D,pathVariables:r,pageId:N.id})),!!N&&E.push(N)});let T=A(S,"results");T.results=E;let k=A(T,"data");return{info:c,content:m,items:k,images:{}}},z=Mt;import{sortObject as Vt}from"@jeromefitz/utils";import Ht from"lodash/omit.js";var Qt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getDeepFetchAllChildren:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s}=e,m=i==null?void 0:i.toUpperCase();if(!Object.keys(s).includes(m))return{info:{},content:{},items:{},images:{}};let h=await n({database_id:s[m].database_id,filter:{and:[f(g({},x.slug),{text:{equals:p}})]}}),a=(h==null?void 0:h.object)==="list"&&h.results[0];if(!a)return{};let _=Ht(a,"properties");_.properties=Vt(w({config:e,data:a,pathVariables:r,pageId:_.id}));let y=await o({block_id:_.id}),S=[...await l({blocks:y.results})];return{info:_,content:S,items:{},images:{}}},j=Qt;import{sortObject as ve}from"@jeromefitz/utils";import xe from"lodash/omit.js";import Ft from"lodash/size.js";var Wt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i})=>{var k;let{NOTION:p}=e,{meta:s}=r,m=i.toUpperCase(),[c,h]=s,a=Ft(s)===2,_=(k=p[m])==null?void 0:k.hasChild.toUpperCase(),y=await n({database_id:p[a?p[_].routeType.toUpperCase():m].database_id,filter:{and:[f(g({},x.slug),{text:{equals:a?h:c}})]}}),P=(y==null?void 0:y.object)==="list"&&y.results[0];if(!P)return{info:{},content:{},items:{},images:{}};let S=xe(P,"properties");S.properties=ve(w({config:e,data:P,pathVariables:r,pageId:S.id}));let E=await o({block_id:S.id}),T={};return a||(T=await l({config:e,reqQuery:{podcasts:S.id,databaseType:p[_].routeType.toUpperCase()}})),{info:S,content:E,items:T,images:{}}},Yt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:l,routeType:r,slug:i})=>{var k,D;let p=new Date().toISOString(),{NOTION:s}=e,{meta:m}=l,[c,h,a]=m,_=new Date(`${c||p.slice(0,4)}-${h||"01"}-${a||"01"}`),y=((D=(k=s[r.toUpperCase()])==null?void 0:k.infoType)==null?void 0:D.notion)??t.datePublished.notion,P=await n({database_id:s[r.toUpperCase()].database_id,filter:{and:[{property:y,date:{on_or_after:I(_,"")}},{property:y,date:{before:I(_,"day")}},f(g({},x.slug),{text:{equals:i}})]}}),S=(P==null?void 0:P.object)==="list"&&P.results[0];if(!S)return{info:{},content:{},items:{},images:{}};let E=xe(S,"properties");E.properties=ve(w({config:e,data:S,pathVariables:l,pageId:E.id}));let T=await o({block_id:E.id});return{info:E,content:T,items:{},images:{}}},zt=async({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i,slug:p})=>{let{NOTION:s,ROUTE_TYPES_BY_DATA_TYPES:m}=e;return s[i.toUpperCase()].hasChild?await Wt({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,getQuery:l,pathVariables:r,routeType:i}):m[b.LISTING_BY_DATE].includes(i.toUpperCase())?await Yt({config:e,getBlocksByIdChildren:o,getDatabasesByIdQuery:n,pathVariables:r,routeType:i,slug:p}):{info:{},content:{},items:{},images:{}}},$=zt;import{avoidRateLimit as jt,isUndefined as $t}from"@jeromefitz/utils";var qt=async({getPagesRetrieve:e,page_id:o})=>$t(o)?[]:(await jt(),await e({page_id:o})),q=qt;import Le from"lodash/drop.js";import Zt from"lodash/dropRight.js";import Kt 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 Ne from"lodash/size.js";var to=({config:e,catchAll:o})=>{let{NOTION:n,PAGES__HOMEPAGE:l,ROUTE_META:r,ROUTE_TYPES:i}=e,p=Ne(o),s=Kt(o),m=s.toUpperCase(),c=eo(o),h=p>1&&Be(r,m)?Le(o):Le(Zt(o)),a=s===c&&!Be(i,m)?n.PAGES.routeType:s,_=s!==c&&!Jt(parseInt(c))?c:s,y=a===n.PAGES.routeType.toLowerCase(),P=_===s,S=!!h&&Ne(h)!==0,E=y&&s===l?"":Xt(o,"/"),T={hasMeta:S,isPage:y,isIndex:P,meta:h,routeType:a,slug:_,url:E},k=Q(T);return f(g({},T),{dataType:k})},Z=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:o,notionDatabasesQuery:n})=>{let{NOTION:l}=e,{databaseType:r}=o,i=r,p=!1,s=r.toUpperCase(),m=l[s].database_id;if(!m)return[];let c={},h={},a,_;if(r==="EPISODES"){_=ao;let{podcasts:y}=o,P=[],S=[];!!y&&S.push(...y==null?void 0:y.split(",")),so(S)>0&&no(S,E=>P.push({property:t.relationEpisodes__Podcast.notion,relation:{contains:E}})),a={or:[...P]}}else p=!0;if(!p&&(!c||ro(c))){await oo();let y;a?((a==null?void 0:a.or.length)===0&&(a={and:[{property:t.slug.notion,rich_text:{equals:"@hack(notion)-do-not-return"}}]}),y=await n({database_id:m,filter:a,sorts:_}),c=y,h=ye({config:e,results:y.results,routeType:i}),c=io(c,"results"),c.results=h):p=!0}return c},K=lo;var _o=class extends po{constructor(o){super(o);this.custom={getBlocksByIdChildren:async o=>await U(f(g({},o),{getBlocksChildrenList:this.blocks.children.list})),getDatabasesByIdQuery:async o=>await M(f(g({},o),{getDatabasesQuery:this.databases.query})),getDeepFetchAllChildren:async o=>await V(f(g({},o),{getBlocksChildrenList:this.blocks.children.list})),getInfoType:o=>H(f(g({},o),{config:this.#e})),getPagesById:async o=>await q(f(g({},o),{getPagesRetrieve:this.pages.retrieve})),getPathVariables:o=>Z(f(g({},o),{config:this.#e})),getQuery:async o=>await K(f(g({},o),{config:this.#e,notionDatabasesQuery:this.databases.query}))};this.dataTypes={[b.LISTING]:async o=>await Y(f(g({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[b.LISTING_BY_DATE]:async o=>await z(f(g({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getPagesById:this.custom.getPagesById})),[b.SLUG]:async o=>await j(f(g({},o),{config:this.#e,getBlocksByIdChildren:this.custom.getBlocksByIdChildren,getDatabasesByIdQuery:this.custom.getDatabasesByIdQuery,getDeepFetchAllChildren:this.custom.getDeepFetchAllChildren})),[b.SLUG_BY_ROUTE]:async o=>await $(f(g({},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{_o as Client};