@jeromefitz/notion 6.2.0-canary.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/{dist/utils/get-types/_unsupported.mjs → _unsupported-BUIwc9lr.mjs} +2 -2
  2. package/_unsupported-BUIwc9lr.mjs.map +1 -0
  3. package/{dist/utils/add-time/index.mjs → add-time-B_LfV4Ex.mjs} +2 -2
  4. package/add-time-B_LfV4Ex.mjs.map +1 -0
  5. package/checkbox-Cil1erOZ.mjs +2 -0
  6. package/checkbox-Cil1erOZ.mjs.map +1 -0
  7. package/constants/index.d.mts +2 -0
  8. package/constants/index.mjs +1 -0
  9. package/{dist/constants/index.mjs → constants-C2jPji6h.mjs} +2 -2
  10. package/constants-C2jPji6h.mjs.map +1 -0
  11. package/date-IJAT1r3Y.mjs +2 -0
  12. package/date-IJAT1r3Y.mjs.map +1 -0
  13. package/dist-BQciLh9t.mjs +2 -0
  14. package/dist-BQciLh9t.mjs.map +1 -0
  15. package/email-DygPLxSo.mjs +2 -0
  16. package/email-DygPLxSo.mjs.map +1 -0
  17. package/{dist/utils/get-types/files.mjs → files-Dx1jw5iY.mjs} +2 -2
  18. package/files-Dx1jw5iY.mjs.map +1 -0
  19. package/{dist/queries/get-blocks-by-id-children/index.mjs → get-blocks-by-id-children-BRe4p0pZ.mjs} +2 -2
  20. package/get-blocks-by-id-children-BRe4p0pZ.mjs.map +1 -0
  21. package/get-data-type-B5X5VOmp.mjs +2 -0
  22. package/get-data-type-B5X5VOmp.mjs.map +1 -0
  23. package/get-databases-by-id-query-CI9TMkPN.mjs +2 -0
  24. package/get-databases-by-id-query-CI9TMkPN.mjs.map +1 -0
  25. package/{dist/queries/get-deep-fetch-all-children/index.mjs → get-deep-fetch-all-children-DVZ-HFbN.mjs} +2 -2
  26. package/get-deep-fetch-all-children-DVZ-HFbN.mjs.map +1 -0
  27. package/{dist/queries/get-info-type/index.mjs → get-info-type-CUsHqtfs.mjs} +2 -2
  28. package/get-info-type-CUsHqtfs.mjs.map +1 -0
  29. package/get-notion-listing-JJxOipMx.mjs +2 -0
  30. package/get-notion-listing-JJxOipMx.mjs.map +1 -0
  31. package/get-notion-listing-by-date-CSKBdFDQ.mjs +2 -0
  32. package/get-notion-listing-by-date-CSKBdFDQ.mjs.map +1 -0
  33. package/get-notion-slug-BecwpT0b.mjs +2 -0
  34. package/get-notion-slug-BecwpT0b.mjs.map +1 -0
  35. package/get-notion-slug-by-route-Dh428D_m.mjs +2 -0
  36. package/get-notion-slug-by-route-Dh428D_m.mjs.map +1 -0
  37. package/{dist/queries/get-pages-by-id/index.mjs → get-pages-by-id-D_3I7OED.mjs} +2 -2
  38. package/get-pages-by-id-D_3I7OED.mjs.map +1 -0
  39. package/get-path-variables-CnBrxTgg.mjs +2 -0
  40. package/get-path-variables-CnBrxTgg.mjs.map +1 -0
  41. package/get-query-ljtSpKL5.mjs +2 -0
  42. package/get-query-ljtSpKL5.mjs.map +1 -0
  43. package/{dist/utils/get-title/index.mjs → get-title-BWc2Ckhi.mjs} +2 -2
  44. package/get-title-BWc2Ckhi.mjs.map +1 -0
  45. package/get-types-Clb6OmBv.mjs +2 -0
  46. package/{dist/get-types-7QEbhRzY.mjs.map → get-types-Clb6OmBv.mjs.map} +1 -1
  47. package/{dist/constants/index.d.mts → index-BD5kzRhY.d.mts} +3 -3
  48. package/index-BD5kzRhY.d.mts.map +1 -0
  49. package/{dist/utils/get-data-type/index.d.mts → index-BGofpiiB.d.mts} +3 -3
  50. package/index-BGofpiiB.d.mts.map +1 -0
  51. package/{dist/queries/get-notion-listing-by-date/index.d.mts → index-BIttGCzA.d.mts} +2 -2
  52. package/index-BIttGCzA.d.mts.map +1 -0
  53. package/{dist/queries/get-pages-by-id/index.d.mts → index-C-J3ICp0.d.mts} +2 -2
  54. package/index-C-J3ICp0.d.mts.map +1 -0
  55. package/{dist/queries/get-notion-slug-by-route/index.d.mts → index-CLQVoKDp.d.mts} +2 -2
  56. package/index-CLQVoKDp.d.mts.map +1 -0
  57. package/{dist/queries/get-databases-by-id-query/index.d.mts → index-CucnheQT.d.mts} +3 -3
  58. package/index-CucnheQT.d.mts.map +1 -0
  59. package/{dist/queries/get-path-variables/index.d.mts → index-D16uYjWr.d.mts} +3 -3
  60. package/index-D16uYjWr.d.mts.map +1 -0
  61. package/{dist/queries/get-notion-listing/index.d.mts → index-D4Gn1cYC.d.mts} +2 -2
  62. package/index-D4Gn1cYC.d.mts.map +1 -0
  63. package/{dist/utils/data-normalized-results/index.d.mts → index-DMqCumJi.d.mts} +2 -2
  64. package/index-DMqCumJi.d.mts.map +1 -0
  65. package/{dist/utils/get-types/index.d.mts → index-DZSqTeBx.d.mts} +2 -2
  66. package/index-DZSqTeBx.d.mts.map +1 -0
  67. package/{dist/utils/data-normalized/index.d.mts → index-DZjFlXjH.d.mts} +2 -2
  68. package/index-DZjFlXjH.d.mts.map +1 -0
  69. package/{dist/queries/get-deep-fetch-all-children/index.d.mts → index-D_fBH_D4.d.mts} +2 -2
  70. package/index-D_fBH_D4.d.mts.map +1 -0
  71. package/{dist/queries/get-notion-slug/index.d.mts → index-Dx2yW5u0.d.mts} +2 -2
  72. package/index-Dx2yW5u0.d.mts.map +1 -0
  73. package/{dist/utils/add-time/index.d.mts → index-DxiWPo1l.d.mts} +2 -2
  74. package/index-DxiWPo1l.d.mts.map +1 -0
  75. package/{dist/queries/get-info-type/index.d.mts → index-H5Qko6iL.d.mts} +2 -2
  76. package/index-H5Qko6iL.d.mts.map +1 -0
  77. package/{dist/utils/get-title/index.d.mts → index-iru-ct3u.d.mts} +2 -2
  78. package/index-iru-ct3u.d.mts.map +1 -0
  79. package/{dist/queries/get-blocks-by-id-children/index.d.mts → index-oAghjuN5.d.mts} +2 -2
  80. package/index-oAghjuN5.d.mts.map +1 -0
  81. package/{dist/queries/get-query/index.d.mts → index-wMZIVRBv.d.mts} +2 -2
  82. package/index-wMZIVRBv.d.mts.map +1 -0
  83. package/{dist/index.d.mts → index.d.mts} +1 -1
  84. package/index.d.mts.map +1 -0
  85. package/index.mjs +2 -0
  86. package/index.mjs.map +1 -0
  87. package/index.test.d.mts +1 -0
  88. package/index.test.mjs +129 -0
  89. package/index.test.mjs.map +1 -0
  90. package/magic-string.es-D6kIB8Km.mjs +18 -0
  91. package/magic-string.es-D6kIB8Km.mjs.map +1 -0
  92. package/{dist/utils/get-types/multi-select.mjs → multi-select-BTDQCZWJ.mjs} +2 -2
  93. package/multi-select-BTDQCZWJ.mjs.map +1 -0
  94. package/number-DXsVfS7U.mjs +2 -0
  95. package/number-DXsVfS7U.mjs.map +1 -0
  96. package/package.json +57 -208
  97. package/{dist/utils/get-types/people.mjs → people-Ognwaka4.mjs} +2 -2
  98. package/people-Ognwaka4.mjs.map +1 -0
  99. package/phone-number-D-jSJ6fm.mjs +2 -0
  100. package/phone-number-D-jSJ6fm.mjs.map +1 -0
  101. package/queries/get-blocks-by-id-children/index.d.mts +2 -0
  102. package/queries/get-blocks-by-id-children/index.mjs +1 -0
  103. package/queries/get-databases-by-id-query/index.d.mts +2 -0
  104. package/queries/get-databases-by-id-query/index.mjs +1 -0
  105. package/queries/get-deep-fetch-all-children/index.d.mts +2 -0
  106. package/queries/get-deep-fetch-all-children/index.mjs +1 -0
  107. package/queries/get-info-type/index.d.mts +2 -0
  108. package/queries/get-info-type/index.mjs +1 -0
  109. package/queries/get-notion-listing/index.d.mts +2 -0
  110. package/queries/get-notion-listing/index.mjs +1 -0
  111. package/queries/get-notion-listing-by-date/index.d.mts +2 -0
  112. package/queries/get-notion-listing-by-date/index.mjs +1 -0
  113. package/queries/get-notion-slug/index.d.mts +2 -0
  114. package/queries/get-notion-slug/index.mjs +1 -0
  115. package/queries/get-notion-slug-by-route/index.d.mts +2 -0
  116. package/queries/get-notion-slug-by-route/index.mjs +1 -0
  117. package/queries/get-pages-by-id/index.d.mts +2 -0
  118. package/queries/get-pages-by-id/index.mjs +1 -0
  119. package/queries/get-path-variables/index.d.mts +2 -0
  120. package/queries/get-path-variables/index.mjs +1 -0
  121. package/queries/get-query/index.d.mts +2 -0
  122. package/queries/get-query/index.mjs +1 -0
  123. package/queries/index.d.mts +12 -0
  124. package/queries/index.mjs +1 -0
  125. package/queries-CCGQpuUT.mjs +1 -0
  126. package/{dist/utils/get-types/rich-text.mjs → rich-text-pNpMuY2o.mjs} +2 -2
  127. package/rich-text-pNpMuY2o.mjs.map +1 -0
  128. package/{dist/utils/get-types/select.mjs → select-i6mHDBMN.mjs} +2 -2
  129. package/select-i6mHDBMN.mjs.map +1 -0
  130. package/title-vmIyt8-r.mjs +2 -0
  131. package/title-vmIyt8-r.mjs.map +1 -0
  132. package/url-D7qu9nU2.mjs +2 -0
  133. package/url-D7qu9nU2.mjs.map +1 -0
  134. package/utils/add-time/index.d.mts +2 -0
  135. package/utils/add-time/index.mjs +1 -0
  136. package/utils/data-normalized/index.d.mts +2 -0
  137. package/utils/data-normalized/index.mjs +1 -0
  138. package/utils/data-normalized-results/index.d.mts +2 -0
  139. package/utils/data-normalized-results/index.mjs +1 -0
  140. package/utils/get-data-type/index.d.mts +2 -0
  141. package/utils/get-data-type/index.mjs +1 -0
  142. package/utils/get-title/index.d.mts +2 -0
  143. package/utils/get-title/index.mjs +1 -0
  144. package/utils/get-types/_unsupported.mjs +1 -0
  145. package/utils/get-types/checkbox.mjs +1 -0
  146. package/utils/get-types/date.mjs +1 -0
  147. package/utils/get-types/email.mjs +1 -0
  148. package/utils/get-types/files.mjs +1 -0
  149. package/utils/get-types/index.d.mts +2 -0
  150. package/utils/get-types/index.mjs +1 -0
  151. package/utils/get-types/multi-select.mjs +1 -0
  152. package/utils/get-types/number.mjs +1 -0
  153. package/utils/get-types/people.mjs +1 -0
  154. package/utils/get-types/phone-number.mjs +1 -0
  155. package/utils/get-types/relation.mjs +1 -0
  156. package/utils/get-types/rich-text.mjs +1 -0
  157. package/utils/get-types/rollup.mjs +1 -0
  158. package/utils/get-types/select.mjs +1 -0
  159. package/utils/get-types/title.mjs +1 -0
  160. package/utils/get-types/url.mjs +1 -0
  161. package/utils/index.d.mts +7 -0
  162. package/utils/index.mjs +1 -0
  163. package/utils-B1QU_ezs.mjs +2 -0
  164. package/{dist/utils-SxsCJsDP.mjs.map → utils-B1QU_ezs.mjs.map} +1 -1
  165. package/.turbo/turbo-build.log +0 -4
  166. package/.turbo/turbo-lint$colon$ts.log +0 -1
  167. package/dist/constants/index.d.mts.map +0 -1
  168. package/dist/constants/index.mjs.map +0 -1
  169. package/dist/get-types-7QEbhRzY.mjs +0 -2
  170. package/dist/index.d.mts.map +0 -1
  171. package/dist/index.mjs +0 -2
  172. package/dist/index.mjs.map +0 -1
  173. package/dist/queries/get-blocks-by-id-children/index.d.mts.map +0 -1
  174. package/dist/queries/get-blocks-by-id-children/index.mjs.map +0 -1
  175. package/dist/queries/get-databases-by-id-query/index.d.mts.map +0 -1
  176. package/dist/queries/get-databases-by-id-query/index.mjs +0 -2
  177. package/dist/queries/get-databases-by-id-query/index.mjs.map +0 -1
  178. package/dist/queries/get-deep-fetch-all-children/index.d.mts.map +0 -1
  179. package/dist/queries/get-deep-fetch-all-children/index.mjs.map +0 -1
  180. package/dist/queries/get-info-type/index.d.mts.map +0 -1
  181. package/dist/queries/get-info-type/index.mjs.map +0 -1
  182. package/dist/queries/get-notion-listing/index.d.mts.map +0 -1
  183. package/dist/queries/get-notion-listing/index.mjs +0 -2
  184. package/dist/queries/get-notion-listing/index.mjs.map +0 -1
  185. package/dist/queries/get-notion-listing-by-date/index.d.mts.map +0 -1
  186. package/dist/queries/get-notion-listing-by-date/index.mjs +0 -2
  187. package/dist/queries/get-notion-listing-by-date/index.mjs.map +0 -1
  188. package/dist/queries/get-notion-slug/index.d.mts.map +0 -1
  189. package/dist/queries/get-notion-slug/index.mjs +0 -2
  190. package/dist/queries/get-notion-slug/index.mjs.map +0 -1
  191. package/dist/queries/get-notion-slug-by-route/index.d.mts.map +0 -1
  192. package/dist/queries/get-notion-slug-by-route/index.mjs +0 -2
  193. package/dist/queries/get-notion-slug-by-route/index.mjs.map +0 -1
  194. package/dist/queries/get-pages-by-id/index.d.mts.map +0 -1
  195. package/dist/queries/get-pages-by-id/index.mjs.map +0 -1
  196. package/dist/queries/get-path-variables/index.d.mts.map +0 -1
  197. package/dist/queries/get-path-variables/index.mjs +0 -2
  198. package/dist/queries/get-path-variables/index.mjs.map +0 -1
  199. package/dist/queries/get-query/index.d.mts.map +0 -1
  200. package/dist/queries/get-query/index.mjs +0 -2
  201. package/dist/queries/get-query/index.mjs.map +0 -1
  202. package/dist/queries/index.d.mts +0 -12
  203. package/dist/queries/index.mjs +0 -1
  204. package/dist/utils/add-time/index.d.mts.map +0 -1
  205. package/dist/utils/add-time/index.mjs.map +0 -1
  206. package/dist/utils/data-normalized/index.d.mts.map +0 -1
  207. package/dist/utils/data-normalized/index.mjs +0 -1
  208. package/dist/utils/data-normalized-results/index.d.mts.map +0 -1
  209. package/dist/utils/data-normalized-results/index.mjs +0 -1
  210. package/dist/utils/get-data-type/index.d.mts.map +0 -1
  211. package/dist/utils/get-data-type/index.mjs +0 -2
  212. package/dist/utils/get-data-type/index.mjs.map +0 -1
  213. package/dist/utils/get-title/index.d.mts.map +0 -1
  214. package/dist/utils/get-title/index.mjs.map +0 -1
  215. package/dist/utils/get-types/_unsupported.mjs.map +0 -1
  216. package/dist/utils/get-types/checkbox.mjs +0 -2
  217. package/dist/utils/get-types/checkbox.mjs.map +0 -1
  218. package/dist/utils/get-types/date.mjs +0 -2
  219. package/dist/utils/get-types/date.mjs.map +0 -1
  220. package/dist/utils/get-types/email.mjs +0 -2
  221. package/dist/utils/get-types/email.mjs.map +0 -1
  222. package/dist/utils/get-types/files.mjs.map +0 -1
  223. package/dist/utils/get-types/index.d.mts.map +0 -1
  224. package/dist/utils/get-types/index.mjs +0 -1
  225. package/dist/utils/get-types/multi-select.mjs.map +0 -1
  226. package/dist/utils/get-types/number.mjs +0 -2
  227. package/dist/utils/get-types/number.mjs.map +0 -1
  228. package/dist/utils/get-types/people.mjs.map +0 -1
  229. package/dist/utils/get-types/phone-number.mjs +0 -2
  230. package/dist/utils/get-types/phone-number.mjs.map +0 -1
  231. package/dist/utils/get-types/relation.mjs +0 -1
  232. package/dist/utils/get-types/rich-text.mjs.map +0 -1
  233. package/dist/utils/get-types/rollup.mjs +0 -1
  234. package/dist/utils/get-types/select.mjs.map +0 -1
  235. package/dist/utils/get-types/title.mjs +0 -2
  236. package/dist/utils/get-types/title.mjs.map +0 -1
  237. package/dist/utils/get-types/url.mjs +0 -2
  238. package/dist/utils/get-types/url.mjs.map +0 -1
  239. package/dist/utils/index.d.mts +0 -7
  240. package/dist/utils/index.mjs +0 -1
  241. package/dist/utils-SxsCJsDP.mjs +0 -2
  242. package/release.config.js +0 -25
  243. package/src/constants/index.ts +0 -1326
  244. package/src/index.ts +0 -151
  245. package/src/queries/get-blocks-by-id-children/index.ts +0 -12
  246. package/src/queries/get-databases-by-id-query/index.ts +0 -28
  247. package/src/queries/get-deep-fetch-all-children/index.ts +0 -35
  248. package/src/queries/get-info-type/index.ts +0 -40
  249. package/src/queries/get-notion-listing/index.ts +0 -91
  250. package/src/queries/get-notion-listing-by-date/index.ts +0 -190
  251. package/src/queries/get-notion-slug/index.ts +0 -64
  252. package/src/queries/get-notion-slug-by-route/index.ts +0 -201
  253. package/src/queries/get-pages-by-id/index.ts +0 -12
  254. package/src/queries/get-path-variables/index.ts +0 -60
  255. package/src/queries/get-query/index.ts +0 -140
  256. package/src/queries/index.ts +0 -25
  257. package/src/schema/index.ts +0 -386
  258. package/src/utils/add-time/index.ts +0 -16
  259. package/src/utils/data-normalized/index.ts +0 -49
  260. package/src/utils/data-normalized-results/index.ts +0 -29
  261. package/src/utils/get-data-type/index.ts +0 -62
  262. package/src/utils/get-title/index.ts +0 -21
  263. package/src/utils/get-types/_unsupported.ts +0 -7
  264. package/src/utils/get-types/checkbox.ts +0 -3
  265. package/src/utils/get-types/date.ts +0 -6
  266. package/src/utils/get-types/email.ts +0 -3
  267. package/src/utils/get-types/files.ts +0 -67
  268. package/src/utils/get-types/index.ts +0 -41
  269. package/src/utils/get-types/multi-select.ts +0 -16
  270. package/src/utils/get-types/number.ts +0 -6
  271. package/src/utils/get-types/people.ts +0 -22
  272. package/src/utils/get-types/phone-number.ts +0 -3
  273. package/src/utils/get-types/relation.ts +0 -18
  274. package/src/utils/get-types/rich-text.ts +0 -5
  275. package/src/utils/get-types/rollup.ts +0 -30
  276. package/src/utils/get-types/select.ts +0 -21
  277. package/src/utils/get-types/title.ts +0 -4
  278. package/src/utils/get-types/url.ts +0 -3
  279. package/src/utils/index.ts +0 -16
  280. package/tsconfig.json +0 -15
  281. package/tsdown.config.ts +0 -14
  282. /package/{dist/index-BAoq6yHe.d.mts → index-BAoq6yHe.d.mts} +0 -0
  283. /package/{dist/index-BAoq6yHe.d.mts.map → index-BAoq6yHe.d.mts.map} +0 -0
  284. /package/{dist/schema → schema}/index.d.mts +0 -0
  285. /package/{dist/schema → schema}/index.mjs +0 -0
  286. /package/{dist/utils → utils}/get-types/_unsupported.d.mts +0 -0
  287. /package/{dist/utils → utils}/get-types/_unsupported.d.mts.map +0 -0
  288. /package/{dist/utils → utils}/get-types/checkbox.d.mts +0 -0
  289. /package/{dist/utils → utils}/get-types/checkbox.d.mts.map +0 -0
  290. /package/{dist/utils → utils}/get-types/date.d.mts +0 -0
  291. /package/{dist/utils → utils}/get-types/date.d.mts.map +0 -0
  292. /package/{dist/utils → utils}/get-types/email.d.mts +0 -0
  293. /package/{dist/utils → utils}/get-types/email.d.mts.map +0 -0
  294. /package/{dist/utils → utils}/get-types/files.d.mts +0 -0
  295. /package/{dist/utils → utils}/get-types/files.d.mts.map +0 -0
  296. /package/{dist/utils → utils}/get-types/multi-select.d.mts +0 -0
  297. /package/{dist/utils → utils}/get-types/multi-select.d.mts.map +0 -0
  298. /package/{dist/utils → utils}/get-types/number.d.mts +0 -0
  299. /package/{dist/utils → utils}/get-types/number.d.mts.map +0 -0
  300. /package/{dist/utils → utils}/get-types/people.d.mts +0 -0
  301. /package/{dist/utils → utils}/get-types/people.d.mts.map +0 -0
  302. /package/{dist/utils → utils}/get-types/phone-number.d.mts +0 -0
  303. /package/{dist/utils → utils}/get-types/phone-number.d.mts.map +0 -0
  304. /package/{dist/utils → utils}/get-types/relation.d.mts +0 -0
  305. /package/{dist/utils → utils}/get-types/relation.d.mts.map +0 -0
  306. /package/{dist/utils → utils}/get-types/rich-text.d.mts +0 -0
  307. /package/{dist/utils → utils}/get-types/rich-text.d.mts.map +0 -0
  308. /package/{dist/utils → utils}/get-types/rollup.d.mts +0 -0
  309. /package/{dist/utils → utils}/get-types/rollup.d.mts.map +0 -0
  310. /package/{dist/utils → utils}/get-types/select.d.mts +0 -0
  311. /package/{dist/utils → utils}/get-types/select.d.mts.map +0 -0
  312. /package/{dist/utils → utils}/get-types/title.d.mts +0 -0
  313. /package/{dist/utils → utils}/get-types/title.d.mts.map +0 -0
  314. /package/{dist/utils → utils}/get-types/url.d.mts +0 -0
  315. /package/{dist/utils → utils}/get-types/url.d.mts.map +0 -0
@@ -1,201 +0,0 @@
1
- import { sortObject } from "@jeromefitz/utils";
2
- import { omit as _omit, size as _size } from "lodash-es";
3
-
4
- import { DATA_TYPES, PROPERTIES, QUERIES } from "../../constants/index";
5
- import { addTime, dataNormalized } from "../../utils/index";
6
-
7
- /**
8
- * @note Determine if PARENT|CHILD should be returned:
9
- *
10
- * PARENT
11
- * - /[parent-routeType]/[slug]
12
- * - /podcasts/jer-and-ky-and-guest
13
- *
14
- * CHILD
15
- * - /[parent-routeType]/[child-routeType]/[slug]
16
- * - /podcasts/jer-and-ky-and-guest/am-i-dracula-greg-gillotti
17
-
18
- *
19
- */
20
- const getNotionSlugByRoute__getDataByParentRouteType = async ({
21
- config,
22
- getBlocksByIdChildren,
23
- getDatabasesByIdQuery,
24
- getQuery,
25
- pathVariables,
26
- routeType,
27
- // slug,
28
- }) => {
29
- const { NOTION } = config;
30
- const { meta } = pathVariables;
31
-
32
- const ROUTE_TYPE = routeType.toUpperCase();
33
-
34
- const [parentSlug, slug] = meta;
35
- const isChild = _size(meta) === 2;
36
-
37
- const CHILD = NOTION[ROUTE_TYPE]?.hasChild?.toUpperCase();
38
-
39
- const __info: any = await getDatabasesByIdQuery({
40
- database_id: NOTION[isChild ? NOTION[CHILD].routeType.toUpperCase() : ROUTE_TYPE].database_id,
41
- filter: {
42
- and: [
43
- {
44
- ...QUERIES.slug,
45
- rich_text: { equals: isChild ? slug : parentSlug },
46
- },
47
- ],
48
- },
49
- });
50
-
51
- const _info = __info?.object === "list" && __info.results[0];
52
- // @refactor(404)
53
- if (!_info) {
54
- return { content: {}, images: {}, info: {}, items: {} };
55
- }
56
- const info = _omit(_info, "properties");
57
- info.properties = sortObject(
58
- dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),
59
- );
60
- const content = await getBlocksByIdChildren({ block_id: info.id });
61
- let items = {};
62
-
63
- /**
64
- * @note if PARENT then get CHILDREN via `items`
65
- */
66
- if (!isChild) {
67
- items = await getQuery({
68
- config,
69
- reqQuery: {
70
- databaseType: NOTION[CHILD].routeType.toUpperCase(),
71
- podcasts: info.id,
72
- },
73
- });
74
- }
75
-
76
- return { content, images: {}, info, items };
77
- };
78
-
79
- /**
80
- * @note This is unique because the following are different:
81
- *
82
- * - /events/2020/05/01/jerome-and
83
- * - /events/2020/05/08/jerome-and
84
- * - /[routeType]/[yyyy/mm/dd]/[slug]
85
- *
86
- * We actually _do_ use the date for this.
87
- *
88
- */
89
- const getNotionSlugByRoute__getDataByListingDate = async ({
90
- config,
91
- getBlocksByIdChildren,
92
- getDatabasesByIdQuery,
93
- // getQuery,
94
- pathVariables,
95
- routeType,
96
- slug,
97
- }) => {
98
- const dateTimestamp = new Date().toISOString();
99
-
100
- const { NOTION } = config;
101
- const { meta } = pathVariables;
102
-
103
- const [year, month, day] = meta;
104
- /**
105
- * @hack uh... nothing to see here, haha
106
- */
107
- const timestampQuery = new Date(
108
- `${year ? year : dateTimestamp.slice(0, 4)}-${month ? month : "01"}-${day ? day : "01"}`,
109
- );
110
- const property =
111
- NOTION[routeType.toUpperCase()]?.infoType?.notion ?? PROPERTIES.datePublished.notion;
112
-
113
- const __info: any = await getDatabasesByIdQuery({
114
- database_id: NOTION[routeType.toUpperCase()].database_id,
115
- filter: {
116
- and: [
117
- {
118
- date: {
119
- on_or_after: addTime(timestampQuery, ""),
120
- },
121
- property,
122
- },
123
- {
124
- date: {
125
- before: addTime(timestampQuery, "day"),
126
- },
127
- property,
128
- },
129
- {
130
- ...QUERIES.slug,
131
- rich_text: { equals: slug },
132
- },
133
- ],
134
- },
135
- });
136
-
137
- const _info = __info?.object === "list" && __info.results[0];
138
- // @refactor(404)
139
- if (!_info) {
140
- return { content: {}, images: {}, info: {}, items: {} };
141
- }
142
-
143
- const info = _omit(_info, "properties");
144
- info.properties = sortObject(
145
- dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),
146
- );
147
- const content = await getBlocksByIdChildren({ block_id: info.id });
148
-
149
- return { content, images: {}, info, items: {} };
150
- };
151
-
152
- const getNotionSlugByRoute = async ({
153
- config,
154
- getBlocksByIdChildren,
155
- getDatabasesByIdQuery,
156
- getQuery,
157
- pathVariables,
158
- routeType,
159
- slug,
160
- }) => {
161
- const { NOTION, ROUTE_TYPES_BY_DATA_TYPES } = config;
162
-
163
- /**
164
- * @custom (notion) DATA_TYPES.SLUG_BY_ROUTE -- but customized:
165
- * Determine if `routeType` is a parent|child
166
- *
167
- * // @todo(next-notion) move to `isChild`
168
- *
169
- */
170
- if (NOTION[routeType?.toUpperCase()]?.hasChild) {
171
- return await getNotionSlugByRoute__getDataByParentRouteType({
172
- config,
173
- getBlocksByIdChildren,
174
- getDatabasesByIdQuery,
175
- getQuery,
176
- pathVariables,
177
- routeType,
178
- // slug,
179
- });
180
- }
181
-
182
- /**
183
- * @custom (notion) DATA_TYPES.LISTING_BY_DATE
184
- *
185
- */
186
- if (ROUTE_TYPES_BY_DATA_TYPES[DATA_TYPES.LISTING_BY_DATE].includes(routeType.toUpperCase())) {
187
- return await getNotionSlugByRoute__getDataByListingDate({
188
- config,
189
- getBlocksByIdChildren,
190
- getDatabasesByIdQuery,
191
- // getQuery,
192
- pathVariables,
193
- routeType,
194
- slug,
195
- });
196
- }
197
-
198
- return { content: {}, images: {}, info: {}, items: {} };
199
- };
200
-
201
- export default getNotionSlugByRoute;
@@ -1,12 +0,0 @@
1
- import { avoidRateLimit, isUndefined } from "@jeromefitz/utils";
2
-
3
- // @todo(types)
4
- const getPagesById = async ({ getPagesRetrieve, page_id }) => {
5
- if (isUndefined(page_id)) return [];
6
- await avoidRateLimit(0);
7
- return await getPagesRetrieve({
8
- page_id,
9
- });
10
- };
11
-
12
- export default getPagesById;
@@ -1,60 +0,0 @@
1
- /**
2
- * @refactor(lodash)
3
- */
4
- import {
5
- drop as _drop,
6
- dropRight as _dropRight,
7
- first as _first,
8
- includes as _includes,
9
- isInteger as _isInteger,
10
- join as _join,
11
- last as _last,
12
- size as _size,
13
- } from "lodash-es";
14
-
15
- // import { DATA_TYPES } from '../../constants/index'
16
- import { getDataType } from "../../utils/index";
17
-
18
- const getPathVariables = ({ catchAll, config }) => {
19
- const { NOTION, PAGES__HOMEPAGE, ROUTE_META, ROUTE_TYPES } = config;
20
- const size: number = _size(catchAll);
21
- const first: any = _first(catchAll);
22
- const FIRST = first.toUpperCase();
23
- const last: any = _last(catchAll);
24
- // const LAST = last.toUpperCase()
25
-
26
- const meta =
27
- size > 1 && _includes(ROUTE_META, FIRST) ? _drop(catchAll) : _drop(_dropRight(catchAll));
28
-
29
- const routeType =
30
- first === last && !_includes(ROUTE_TYPES, FIRST) ? NOTION.PAGES.routeType : first;
31
- const slug = first !== last && !_isInteger(parseInt(last)) ? last : first;
32
-
33
- const isPage = routeType === NOTION.PAGES.routeType.toLowerCase();
34
- const isIndex = slug === first;
35
- const hasMeta = !!meta && _size(meta) !== 0;
36
-
37
- const url = isPage && first === PAGES__HOMEPAGE ? "" : _join(catchAll, "/");
38
-
39
- const pathVariables = {
40
- hasMeta,
41
- isIndex,
42
- isPage,
43
- meta,
44
- routeType,
45
- slug,
46
- url,
47
- };
48
-
49
- // console.dir(`> pathVariables`)
50
- // console.dir(pathVariables)
51
-
52
- const dataType = getDataType(pathVariables);
53
-
54
- return {
55
- ...pathVariables,
56
- dataType,
57
- };
58
- };
59
-
60
- export default getPathVariables;
@@ -1,140 +0,0 @@
1
- import { avoidRateLimit, isObjectEmpty } from "@jeromefitz/utils";
2
- import { map as _map, omit as _omit, size as _size } from "lodash-es";
3
-
4
- import { PROPERTIES } from "../../constants/index";
5
- import type { SortItem } from "../../schema/index";
6
- import dataNormalizedResults from "../../utils/data-normalized-results/index";
7
-
8
- // const useCache = process.env.NEXT_PUBLIC__NOTION_USE_CACHE
9
- // const useCache = false
10
-
11
- const SORTS: SortItem[] = [
12
- {
13
- direction: "ascending",
14
- property: PROPERTIES.slug.notion,
15
- },
16
- ];
17
-
18
- // @todo(complexity) 12
19
- // oxlint-disable-next-line complexity
20
- const getQuery = async ({ config, notionDatabasesQuery, reqQuery }) => {
21
- const { NOTION } = config;
22
- const { databaseType } = reqQuery;
23
- const routeType = databaseType;
24
- let hasError = false;
25
-
26
- /**
27
- * @setup
28
- */
29
- const DATABASE_TYPE = databaseType.toUpperCase();
30
- const database_id = NOTION[DATABASE_TYPE].database_id;
31
- if (!database_id) return [];
32
-
33
- // @todo(types) any
34
- let data: any = {},
35
- items: any = {};
36
- let filter: any, sorts: any;
37
-
38
- /**
39
- * @todo(notion) move this to the api so it can be re-used
40
- * not hidden in here all hacky
41
- *
42
- * @note(notion) right now only need this for episodes of podcasts
43
- * _OR_ Related Databases (PODCASTS => EPISODES)
44
- *
45
- * This is not needed often and can/should probably be handled instead
46
- * with Relations & Rollups rather than this customization
47
- */
48
-
49
- if (databaseType === "EPISODES") {
50
- sorts = SORTS;
51
- const { podcasts } = reqQuery;
52
-
53
- // @todo(types)
54
- const filterTagEpisodesByPodcasts: any = [];
55
- const podcastIds: any = [];
56
-
57
- // oxlint-disable-next-line no-unused-expressions
58
- !!podcasts && podcastIds.push(...podcasts?.split(","));
59
- // oxlint-disable-next-line no-unused-expressions
60
- _size(podcastIds) > 0 &&
61
- _map(podcastIds, (id) =>
62
- filterTagEpisodesByPodcasts.push({
63
- property: PROPERTIES.relationEpisodes__Podcasts.notion,
64
- relation: {
65
- contains: id,
66
- },
67
- }),
68
- );
69
- filter = { or: [...filterTagEpisodesByPodcasts] };
70
- } else {
71
- // console.dir(`no filter`)
72
- hasError = true;
73
- }
74
-
75
- // /**
76
- // * @cache pre
77
- // */
78
- // if (useCache) {
79
- // const url = catchAll.join('/')
80
- // const cacheData = await getCache(url)
81
- // if (!!cacheData) {
82
- // data = cacheData
83
- // }
84
- // }
85
-
86
- if (!hasError && (!data || isObjectEmpty(data))) {
87
- await avoidRateLimit(0);
88
- // @todo(types) any
89
- let contentData: Pick<any, number | string | symbol>;
90
-
91
- // oxlint-disable-next-line no-extra-boolean-cast
92
- if (!!filter) {
93
- // @hack(notion)-do-not-return'
94
- if (filter?.or.length === 0) {
95
- filter = {
96
- and: [
97
- {
98
- property: PROPERTIES.slug.notion,
99
- rich_text: { equals: "@hack(notion)-do-not-return" },
100
- },
101
- ],
102
- };
103
- }
104
- contentData = await notionDatabasesQuery({
105
- database_id,
106
- filter,
107
- sorts,
108
- });
109
-
110
- data = contentData;
111
- items = dataNormalizedResults({
112
- config,
113
- results: contentData.results,
114
- routeType,
115
- });
116
- data = _omit(data, "results");
117
- data.results = items;
118
- } else {
119
- // console.dir(`no filter`)
120
- hasError = true;
121
- }
122
-
123
- // /**
124
- // * @cache post
125
- // */
126
- // if (useCache && !!data) {
127
- // const url = catchAll.join('/')
128
- // // console.dir(url)
129
- // const isCacheExists = await getCache(url)
130
- // // console.dir(isCacheExists)
131
- // if (!isCacheExists || isCacheExists === undefined) {
132
- // setCache(data, url)
133
- // }
134
- // }
135
- }
136
-
137
- return data;
138
- };
139
-
140
- export default getQuery;
@@ -1,25 +0,0 @@
1
- import getBlocksByIdChildren from "./get-blocks-by-id-children/index";
2
- import getDatabasesByIdQuery from "./get-databases-by-id-query/index";
3
- import getDeepFetchAllChildren from "./get-deep-fetch-all-children/index";
4
- import getInfoType from "./get-info-type/index";
5
- import getNotionListingByDate from "./get-notion-listing-by-date/index";
6
- import getNotionListing from "./get-notion-listing/index";
7
- import getNotionSlugByRoute from "./get-notion-slug-by-route/index";
8
- import getNotionSlug from "./get-notion-slug/index";
9
- import getPagesById from "./get-pages-by-id/index";
10
- import getPathVariables from "./get-path-variables/index";
11
- import getQuery from "./get-query/index";
12
-
13
- export {
14
- getBlocksByIdChildren,
15
- getDatabasesByIdQuery,
16
- getDeepFetchAllChildren,
17
- getInfoType,
18
- getNotionListing,
19
- getNotionListingByDate,
20
- getNotionSlug,
21
- getNotionSlugByRoute,
22
- getPagesById,
23
- getPathVariables,
24
- getQuery,
25
- };