@jeromefitz/notion 6.2.0-canary.1 → 7.0.1

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
package/src/index.ts DELETED
@@ -1,151 +0,0 @@
1
- import { Client as _Client } from "@notionhq/client";
2
-
3
- import { DATA_TYPES } from "./constants/index";
4
- import {
5
- getBlocksByIdChildren,
6
- getDatabasesByIdQuery,
7
- getDeepFetchAllChildren,
8
- getInfoType,
9
- getNotionListing,
10
- getNotionListingByDate,
11
- getNotionSlug,
12
- getNotionSlugByRoute,
13
- getPagesById,
14
- getPathVariables,
15
- getQuery,
16
- } from "./queries/index";
17
-
18
- type ClientProps = {
19
- custom: CustomProps;
20
- dataTypes: DataTypesProps;
21
- };
22
-
23
- type CredentialProps = {
24
- auth: string;
25
- config: any;
26
- };
27
-
28
- type CustomProps = {
29
- getBlocksByIdChildren: any;
30
- getDatabasesByIdQuery: any;
31
- getDeepFetchAllChildren: any;
32
- getInfoType: any;
33
- getPagesById: any;
34
- getPathVariables: any;
35
- getQuery: any;
36
- };
37
-
38
- type DataTypesProps = {
39
- LISTING: any;
40
- LISTING_BY_DATE: any;
41
- SLUG: any;
42
- SLUG_BY_ROUTE: any;
43
- };
44
-
45
- class Client extends _Client {
46
- #config?: any;
47
-
48
- // @todo(notion) throw error if `config` is not passed
49
- public readonly custom = {
50
- getBlocksByIdChildren: async (props) =>
51
- await getBlocksByIdChildren({
52
- ...props,
53
- getBlocksChildrenList: this.blocks.children.list,
54
- }),
55
-
56
- getDatabasesByIdQuery: async (props) =>
57
- await getDatabasesByIdQuery({
58
- ...props,
59
- getDatabasesQuery: this.databases.query,
60
- }),
61
-
62
- getDeepFetchAllChildren: async (props) =>
63
- await getDeepFetchAllChildren({
64
- ...props,
65
- getBlocksChildrenList: this.blocks.children.list,
66
- }),
67
-
68
- getInfoType: (props) => {
69
- return getInfoType({ ...props, config: this.#config });
70
- },
71
-
72
- getPagesById: async (props) =>
73
- await getPagesById({ ...props, getPagesRetrieve: this.pages.retrieve }),
74
-
75
- getPathVariables: (props) => getPathVariables({ ...props, config: this.#config }),
76
-
77
- getQuery: async (props) =>
78
- await getQuery({
79
- ...props,
80
- config: this.#config,
81
- notionDatabasesQuery: this.databases.query,
82
- }),
83
- };
84
-
85
- /**
86
- * @info details at: ../../utils/getDataType
87
- *
88
- */
89
- public readonly dataTypes = {
90
- [DATA_TYPES.LISTING]: async (props: { pathVariables: any; routeType: any; slug?: any }) => {
91
- // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING}`)
92
- return await getNotionListing({
93
- ...props,
94
- config: this.#config,
95
- getBlocksByIdChildren: this.custom.getBlocksByIdChildren,
96
- getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,
97
- getPagesById: this.custom.getPagesById,
98
- });
99
- },
100
-
101
- [DATA_TYPES.LISTING_BY_DATE]: async (props: {
102
- pathVariables: any;
103
- routeType: any;
104
- slug: any;
105
- }) => {
106
- // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING_BY_DATE}`)
107
- return await getNotionListingByDate({
108
- ...props,
109
- config: this.#config,
110
- getBlocksByIdChildren: this.custom.getBlocksByIdChildren,
111
- getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,
112
- getPagesById: this.custom.getPagesById,
113
- });
114
- },
115
-
116
- [DATA_TYPES.SLUG]: async (props: { pathVariables: any; routeType: any; slug: any }) => {
117
- // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG}`)
118
- return await getNotionSlug({
119
- ...props,
120
- config: this.#config,
121
- getBlocksByIdChildren: this.custom.getBlocksByIdChildren,
122
- getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,
123
- getDeepFetchAllChildren: this.custom.getDeepFetchAllChildren,
124
- });
125
- },
126
-
127
- [DATA_TYPES.SLUG_BY_ROUTE]: async (props: {
128
- pathVariables: any;
129
- routeType: any;
130
- slug: any;
131
- }) => {
132
- // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG_BY_ROUTE}`)
133
- return await getNotionSlugByRoute({
134
- ...props,
135
- config: this.#config,
136
- getBlocksByIdChildren: this.custom.getBlocksByIdChildren,
137
- getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,
138
- getQuery: this.custom.getQuery,
139
- });
140
- },
141
- };
142
-
143
- // public constructor(options?: ClientOptions) {
144
- public constructor(options?: any) {
145
- super(options);
146
- this.#config = options?.config;
147
- }
148
- }
149
-
150
- export type { ClientProps, CredentialProps };
151
- export { Client };
@@ -1,12 +0,0 @@
1
- import { avoidRateLimit, isUndefined } from "@jeromefitz/utils";
2
-
3
- // @todo(types)
4
- const getBlocksByIdChildren = async ({ block_id, getBlocksChildrenList }) => {
5
- if (isUndefined(block_id)) return [];
6
- await avoidRateLimit(0);
7
- return await getBlocksChildrenList({
8
- block_id,
9
- });
10
- };
11
-
12
- export default getBlocksByIdChildren;
@@ -1,28 +0,0 @@
1
- import { PROPERTIES } from "../../constants/index";
2
- import type { SortMock } from "../../schema/index";
3
-
4
- const sortDefault: SortMock = {
5
- sorts: [
6
- {
7
- direction: "ascending",
8
- property: PROPERTIES.slug.notion,
9
- },
10
- ],
11
- };
12
-
13
- // @todo(types)
14
- const getDatabasesByIdQuery = async ({
15
- database_id,
16
- filter = sortDefault?.filter,
17
- getDatabasesQuery,
18
- sorts = sortDefault?.sorts,
19
- }) => {
20
- if (!database_id) return [];
21
- return await getDatabasesQuery({
22
- database_id,
23
- filter,
24
- sorts,
25
- });
26
- };
27
-
28
- export default getDatabasesByIdQuery;
@@ -1,35 +0,0 @@
1
- const getDeepFetchAllChildren = async ({
2
- blocks,
3
- getBlocksChildrenList,
4
- }): Promise<Array<any | any[]>> => {
5
- if (blocks === null || blocks === undefined) return blocks;
6
- const fetchChildrenMap = blocks
7
- .filter((block: { has_children: any }) => block.has_children)
8
- .map((parent_block: { id: string }) => {
9
- const { id: block_id } = parent_block;
10
- return {
11
- parent_block,
12
- promise: getBlocksChildrenList({
13
- block_id,
14
- page_size: 100,
15
- }),
16
- };
17
- });
18
-
19
- const results = await Promise.all<any>(fetchChildrenMap.map((value) => value.promise));
20
-
21
- for (let i = 0; i < results.length; i++) {
22
- const blocks = results[i].results;
23
- await getDeepFetchAllChildren({
24
- blocks,
25
- getBlocksChildrenList,
26
- });
27
- if (fetchChildrenMap[i]) {
28
- const parent: any = fetchChildrenMap[i].parent_block;
29
- parent[parent.type].children = blocks;
30
- }
31
- }
32
- return blocks;
33
- };
34
-
35
- export default getDeepFetchAllChildren;
@@ -1,40 +0,0 @@
1
- const getInfoType = ({ config, item, meta, routeType }) => {
2
- const { NOTION } = config;
3
-
4
- let date = "";
5
- const slug = item.properties?.slug;
6
-
7
- let as = "";
8
- const href = `/[...catchAll]`;
9
-
10
- switch (routeType) {
11
- case NOTION.BLOG.routeType:
12
- case NOTION.EVENTS.routeType:
13
- date = item.properties[NOTION[routeType.toUpperCase()].infoType.key]?.start.slice(0, 10);
14
- // oxlint-disable-next-line no-unsafe-optional-chaining
15
- const [year, month, day] = date?.split("-");
16
- as = `/${routeType}/${year}/${month}/${day}/${slug}`;
17
- break;
18
- case NOTION.EPISODES.routeType:
19
- as = `/${meta?.join("/")}/${slug}`;
20
- break;
21
- // case NOTION.PODCASTS.routeType:
22
- // case NOTION.PEOPLE.routeType:
23
- // case NOTION.SHOWS.routeType:
24
- // case NOTION.VENUES.routeType:
25
- default:
26
- as = `/${routeType}/${slug}`;
27
- break;
28
- }
29
-
30
- as = as.replace("//", "/");
31
-
32
- return {
33
- as,
34
- date,
35
- href,
36
- slug,
37
- };
38
- };
39
-
40
- export default getInfoType;
@@ -1,91 +0,0 @@
1
- import { sortObject } from "@jeromefitz/utils";
2
- import { map as _map, omit as _omit } from "lodash-es";
3
-
4
- import { PROPERTIES } from "../../constants/index";
5
- import { dataNormalized } from "../../utils/index";
6
-
7
- const getNotionListing = async ({
8
- config,
9
- getBlocksByIdChildren,
10
- getDatabasesByIdQuery,
11
- getPagesById,
12
- pathVariables,
13
- routeType,
14
- }) => {
15
- const { NOTION } = config;
16
-
17
- let info: any = {};
18
-
19
- const page_id = NOTION[routeType.toUpperCase()].page_id__seo;
20
- const _info = await getPagesById({
21
- page_id,
22
- });
23
- // @refactor(404)
24
- if (!_info) {
25
- return {};
26
- }
27
- if (_info?.object === "page") {
28
- info = _omit(_info, "properties");
29
- info.properties = sortObject(
30
- dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),
31
- );
32
- }
33
-
34
- const property =
35
- NOTION[routeType.toUpperCase()].infoType.notion ?? PROPERTIES.datePublished.notion;
36
-
37
- /**
38
- * @todo Can we make the date dynamic?
39
- * This can be considered the date you want to go back in time to on build.
40
- * Can be construed as the website creation date, too I guess.
41
- *
42
- * For those routeTypes that do not go off of datePublished,
43
- * we want to get their listing by the current date.
44
- *
45
- * ex) /events => Only want events that are in the future.
46
- *
47
- */
48
- const timestamp =
49
- property === PROPERTIES.datePublished.notion
50
- ? new Date("2020-01-01").toISOString()
51
- : new Date().toISOString();
52
-
53
- const content = await getBlocksByIdChildren({ block_id: info.id });
54
- const _items: any = await getDatabasesByIdQuery({
55
- database_id: NOTION[routeType.toUpperCase()].database_id,
56
- filter: {
57
- and: [
58
- {
59
- date: {
60
- on_or_after: timestamp,
61
- },
62
- property,
63
- },
64
- ],
65
- },
66
- });
67
- const results: any[] = [];
68
- _map(_items.results, (item) => {
69
- let itemInit = item;
70
- itemInit = _omit(itemInit, "properties");
71
- itemInit.properties = sortObject(
72
- dataNormalized({ config, data: item, pageId: item.id, pathVariables }),
73
- );
74
- results.push(itemInit);
75
- // console.dir(`> last_edited_time`)
76
- // console.dir(item.id)
77
- // console.dir(item.last_edited_time)
78
- // console.dir(`---`)
79
- });
80
- const items = _omit(_items, "results");
81
- items.results = results;
82
-
83
- /**
84
- * @note(plaiceholder)
85
- *
86
- * Pass empty `images` object for SSR/API takeover
87
- */
88
- return { content, images: {}, info, items };
89
- };
90
-
91
- export default getNotionListing;
@@ -1,190 +0,0 @@
1
- import { sortObject } from "@jeromefitz/utils";
2
- import { map as _map, omit as _omit, size as _size } from "lodash-es";
3
-
4
- import { PROPERTIES, QUERIES } from "../../constants/index";
5
- import type { SortItem } from "../../schema/index";
6
- import { addTime, dataNormalized } from "../../utils/index";
7
-
8
- const getNotionListingByDate__getFilter = ({ config, pathVariables, routeType, slug }) => {
9
- const { NOTION } = config;
10
- const { meta } = pathVariables;
11
- const [year, month, day] = meta;
12
- const metaCount = _size(meta);
13
- // @hack nothing to see here, haha
14
- const dateTimestamp = new Date().toISOString();
15
- const timestampQuery = new Date(
16
- `${year ? year : dateTimestamp.slice(0, 4)}-${month ? month : "01"}-${day ? day : "01"}`,
17
- );
18
-
19
- /**
20
- * @filter
21
- * @note metaCount breakdown:
22
- * 1 = yyyy
23
- * 2 = yyyy/mm
24
- * 3 = yyyy/mm/dd
25
- * ? = yyyy/mm/dd/slug (SLUG_BY_ROUTE takes this over)
26
- */
27
- const property =
28
- NOTION[routeType.toUpperCase()]?.infoType?.notion ?? PROPERTIES.datePublished.notion;
29
-
30
- switch (metaCount) {
31
- /**
32
- * @note yyyy
33
- */
34
- case 1:
35
- return {
36
- and: [
37
- {
38
- date: {
39
- on_or_after: addTime(timestampQuery, ""),
40
- },
41
- property,
42
- },
43
- {
44
- date: {
45
- before: addTime(timestampQuery, "year"),
46
- },
47
- property,
48
- },
49
- ],
50
- };
51
-
52
- /**
53
- * @note yyyy/mm
54
- */
55
- case 2:
56
- return {
57
- and: [
58
- {
59
- date: {
60
- on_or_after: addTime(timestampQuery, ""),
61
- },
62
- property,
63
- },
64
- {
65
- date: {
66
- before: addTime(timestampQuery, "month"),
67
- },
68
- property,
69
- },
70
- ],
71
- };
72
-
73
- /**
74
- * @note yyyy/mm/dd
75
- */
76
- case 3:
77
- return {
78
- and: [
79
- {
80
- date: {
81
- on_or_after: addTime(timestampQuery, ""),
82
- },
83
- property,
84
- },
85
- {
86
- date: {
87
- before: addTime(timestampQuery, "day"),
88
- },
89
- property,
90
- },
91
- ],
92
- };
93
-
94
- /**
95
- * @note yyyy/mm/dd/slug
96
- *
97
- * Technically this is picked up by `getNotionSlugByRoute` SLUG_BY_ROUTE
98
- */
99
- default:
100
- return {
101
- and: [
102
- {
103
- date: {
104
- on_or_after: addTime(timestampQuery, ""),
105
- },
106
- property,
107
- },
108
- {
109
- date: {
110
- before: addTime(timestampQuery, "day"),
111
- },
112
- property,
113
- },
114
- {
115
- ...QUERIES.slug,
116
- rich_text: { equals: slug },
117
- },
118
- ],
119
- };
120
- }
121
- };
122
-
123
- const getNotionListingByDate = async ({
124
- config,
125
- getBlocksByIdChildren,
126
- getDatabasesByIdQuery,
127
- getPagesById,
128
- pathVariables,
129
- routeType,
130
- slug,
131
- }) => {
132
- const { NOTION } = config;
133
-
134
- let content: any = {},
135
- info: any = {};
136
-
137
- const page_id = NOTION[routeType.toUpperCase()].page_id__seo;
138
- const _info = await getPagesById({
139
- page_id,
140
- });
141
- if (_info.object === "page") {
142
- info = _omit(_info, "properties");
143
- info.properties = sortObject(
144
- dataNormalized({ config, data: _info, pageId: _info.id, pathVariables }),
145
- );
146
- }
147
-
148
- content = await getBlocksByIdChildren({ block_id: info.id });
149
-
150
- const sorts: SortItem[] = [
151
- {
152
- direction: "descending",
153
- property: PROPERTIES.datePublished.notion,
154
- },
155
- ];
156
- const filter = getNotionListingByDate__getFilter({
157
- config,
158
- pathVariables,
159
- routeType,
160
- slug,
161
- });
162
-
163
- const database_id = NOTION[routeType.toUpperCase()].database_id;
164
-
165
- const ___items: any = await getDatabasesByIdQuery({
166
- database_id,
167
- filter,
168
- sorts,
169
- });
170
- const __items: any[] = [];
171
- _map(___items.results, (i) => {
172
- const item = _omit(i, "properties");
173
- item.properties = sortObject(
174
- dataNormalized({ config, data: i, pageId: item.id, pathVariables }),
175
- );
176
- !!item && __items.push(item);
177
- });
178
- const _items = _omit(___items, "results");
179
- _items.results = __items;
180
- const items = _omit(_items, "data");
181
-
182
- /**
183
- * @note(plaiceholder)
184
- *
185
- * Pass empty `images` object for SSR/API takeover
186
- */
187
- return { content, images: {}, info, items };
188
- };
189
-
190
- export default getNotionListingByDate;
@@ -1,64 +0,0 @@
1
- import { sortObject } from "@jeromefitz/utils";
2
- import { omit as _omit } from "lodash-es";
3
-
4
- import { QUERIES } from "../../constants/index";
5
- import { dataNormalized } from "../../utils/index";
6
-
7
- const getNotionSlug = async ({
8
- config,
9
- getBlocksByIdChildren,
10
- getDatabasesByIdQuery,
11
- getDeepFetchAllChildren,
12
- pathVariables,
13
- routeType,
14
- slug,
15
- }) => {
16
- const { NOTION } = config;
17
-
18
- const DB_TYPE = routeType?.toUpperCase();
19
- const isValid = Object.keys(NOTION).includes(DB_TYPE);
20
-
21
- if (!isValid) return { content: {}, images: {}, info: {}, items: {} };
22
-
23
- const __info: any = await getDatabasesByIdQuery({
24
- database_id: NOTION[DB_TYPE].database_id,
25
- filter: {
26
- and: [
27
- {
28
- ...QUERIES.slug,
29
- rich_text: { equals: slug },
30
- },
31
- ],
32
- },
33
- });
34
-
35
- const _info = __info?.object === "list" && __info.results[0];
36
- // @refactor(404)
37
- if (!_info) {
38
- return {};
39
- }
40
-
41
- const info = _omit(_info, "properties");
42
- info.properties = sortObject(
43
- dataNormalized({ config, data: _info, pageId: info.id, pathVariables }),
44
- );
45
-
46
- const _content = await getBlocksByIdChildren({ block_id: info.id });
47
- const blocks = [...(await getDeepFetchAllChildren({ blocks: _content.results }))];
48
- const content = blocks;
49
-
50
- /**
51
- * @question if this is reached, there are no `items`
52
- */
53
- // const items: any = {}
54
- // items.results = _filter(items?.results, { properties: { isPublished: true } })
55
-
56
- /**
57
- * @note(plaiceholder)
58
- *
59
- * Pass empty `images` object for SSR/API takeover
60
- */
61
- return { content, images: {}, info, items: {} };
62
- };
63
-
64
- export default getNotionSlug;