@jeromefitz/notion 6.1.1-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 (279) hide show
  1. package/{utils/getTypes/_unsupported.mjs → _unsupported-BUIwc9lr.mjs} +2 -2
  2. package/_unsupported-BUIwc9lr.mjs.map +1 -0
  3. package/{utils/addTime/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 -129
  8. package/constants/index.mjs +1 -2
  9. package/constants-C2jPji6h.mjs +2 -0
  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/{utils/getTypes/files.mjs → files-Dx1jw5iY.mjs} +2 -2
  18. package/files-Dx1jw5iY.mjs.map +1 -0
  19. package/{queries/getBlocksByIdChildren/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/{queries/getDeepFetchAllChildren/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/{queries/getInfoType/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/{queries/getPagesById/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/{utils/getTitle/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/get-types-Clb6OmBv.mjs.map +1 -0
  47. package/index-BD5kzRhY.d.mts +129 -0
  48. package/index-BD5kzRhY.d.mts.map +1 -0
  49. package/{utils/getDataType/index.d.mts → index-BGofpiiB.d.mts} +4 -4
  50. package/index-BGofpiiB.d.mts.map +1 -0
  51. package/{queries/getNotionListingByDate/index.d.mts → index-BIttGCzA.d.mts} +3 -3
  52. package/index-BIttGCzA.d.mts.map +1 -0
  53. package/{queries/getPagesById/index.d.mts → index-C-J3ICp0.d.mts} +3 -3
  54. package/index-C-J3ICp0.d.mts.map +1 -0
  55. package/{queries/getNotionSlugByRoute/index.d.mts → index-CLQVoKDp.d.mts} +3 -3
  56. package/index-CLQVoKDp.d.mts.map +1 -0
  57. package/{queries/getDatabasesByIdQuery/index.d.mts → index-CucnheQT.d.mts} +4 -4
  58. package/index-CucnheQT.d.mts.map +1 -0
  59. package/{queries/getPathVariables/index.d.mts → index-D16uYjWr.d.mts} +4 -4
  60. package/index-D16uYjWr.d.mts.map +1 -0
  61. package/{queries/getNotionListing/index.d.mts → index-D4Gn1cYC.d.mts} +3 -3
  62. package/index-D4Gn1cYC.d.mts.map +1 -0
  63. package/{utils/dataNormalizedResults/index.d.mts → index-DMqCumJi.d.mts} +3 -3
  64. package/index-DMqCumJi.d.mts.map +1 -0
  65. package/{utils/getTypes/index.d.mts → index-DZSqTeBx.d.mts} +3 -3
  66. package/index-DZSqTeBx.d.mts.map +1 -0
  67. package/{utils/dataNormalized/index.d.mts → index-DZjFlXjH.d.mts} +3 -3
  68. package/index-DZjFlXjH.d.mts.map +1 -0
  69. package/{queries/getDeepFetchAllChildren/index.d.mts → index-D_fBH_D4.d.mts} +3 -3
  70. package/index-D_fBH_D4.d.mts.map +1 -0
  71. package/{queries/getNotionSlug/index.d.mts → index-Dx2yW5u0.d.mts} +3 -3
  72. package/index-Dx2yW5u0.d.mts.map +1 -0
  73. package/index-DxiWPo1l.d.mts +5 -0
  74. package/index-DxiWPo1l.d.mts.map +1 -0
  75. package/{queries/getInfoType/index.d.mts → index-H5Qko6iL.d.mts} +3 -3
  76. package/index-H5Qko6iL.d.mts.map +1 -0
  77. package/{utils/getTitle/index.d.mts → index-iru-ct3u.d.mts} +3 -3
  78. package/index-iru-ct3u.d.mts.map +1 -0
  79. package/{queries/getBlocksByIdChildren/index.d.mts → index-oAghjuN5.d.mts} +3 -3
  80. package/index-oAghjuN5.d.mts.map +1 -0
  81. package/{queries/getQuery/index.d.mts → index-wMZIVRBv.d.mts} +3 -3
  82. package/index-wMZIVRBv.d.mts.map +1 -0
  83. package/index.d.mts +1 -1
  84. package/index.d.mts.map +1 -1
  85. package/index.mjs +1 -1
  86. package/index.mjs.map +1 -1
  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/{utils/getTypes/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 +52 -52
  97. package/{utils/getTypes/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 +11 -11
  124. package/queries/index.mjs +1 -1
  125. package/queries-CCGQpuUT.mjs +1 -0
  126. package/{utils/getTypes/rich_text.mjs → rich-text-pNpMuY2o.mjs} +2 -2
  127. package/rich-text-pNpMuY2o.mjs.map +1 -0
  128. package/{utils/getTypes/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/{getTypes → get-types}/_unsupported.d.mts +1 -1
  145. package/utils/get-types/_unsupported.d.mts.map +1 -0
  146. package/utils/get-types/_unsupported.mjs +1 -0
  147. package/utils/{getTypes → get-types}/checkbox.d.mts +1 -1
  148. package/utils/get-types/checkbox.d.mts.map +1 -0
  149. package/utils/get-types/checkbox.mjs +1 -0
  150. package/utils/{getTypes → get-types}/date.d.mts +1 -1
  151. package/utils/get-types/date.d.mts.map +1 -0
  152. package/utils/get-types/date.mjs +1 -0
  153. package/utils/{getTypes → get-types}/email.d.mts +1 -1
  154. package/utils/get-types/email.d.mts.map +1 -0
  155. package/utils/get-types/email.mjs +1 -0
  156. package/utils/{getTypes → get-types}/files.d.mts +1 -1
  157. package/utils/get-types/files.d.mts.map +1 -0
  158. package/utils/get-types/files.mjs +1 -0
  159. package/utils/get-types/index.d.mts +2 -0
  160. package/utils/get-types/index.mjs +1 -0
  161. package/utils/{getTypes/multi_select.d.mts → get-types/multi-select.d.mts} +2 -2
  162. package/utils/get-types/multi-select.d.mts.map +1 -0
  163. package/utils/get-types/multi-select.mjs +1 -0
  164. package/utils/{getTypes → get-types}/number.d.mts +1 -1
  165. package/utils/get-types/number.d.mts.map +1 -0
  166. package/utils/get-types/number.mjs +1 -0
  167. package/utils/{getTypes → get-types}/people.d.mts +1 -1
  168. package/utils/get-types/people.d.mts.map +1 -0
  169. package/utils/get-types/people.mjs +1 -0
  170. package/utils/{getTypes/phone_number.d.mts → get-types/phone-number.d.mts} +2 -2
  171. package/utils/get-types/phone-number.d.mts.map +1 -0
  172. package/utils/get-types/phone-number.mjs +1 -0
  173. package/utils/{getTypes → get-types}/relation.d.mts +1 -1
  174. package/utils/get-types/relation.d.mts.map +1 -0
  175. package/utils/get-types/relation.mjs +1 -0
  176. package/utils/{getTypes/rich_text.d.mts → get-types/rich-text.d.mts} +2 -2
  177. package/utils/get-types/rich-text.d.mts.map +1 -0
  178. package/utils/get-types/rich-text.mjs +1 -0
  179. package/utils/{getTypes → get-types}/rollup.d.mts +1 -1
  180. package/utils/get-types/rollup.d.mts.map +1 -0
  181. package/utils/get-types/rollup.mjs +1 -0
  182. package/utils/{getTypes → get-types}/select.d.mts +1 -1
  183. package/utils/get-types/select.d.mts.map +1 -0
  184. package/utils/get-types/select.mjs +1 -0
  185. package/utils/{getTypes → get-types}/title.d.mts +1 -1
  186. package/utils/get-types/title.d.mts.map +1 -0
  187. package/utils/get-types/title.mjs +1 -0
  188. package/utils/{getTypes → get-types}/url.d.mts +1 -1
  189. package/utils/{getTypes → get-types}/url.d.mts.map +1 -1
  190. package/utils/get-types/url.mjs +1 -0
  191. package/utils/index.d.mts +6 -6
  192. package/utils/index.mjs +1 -1
  193. package/utils-B1QU_ezs.mjs +2 -0
  194. package/utils-B1QU_ezs.mjs.map +1 -0
  195. package/constants/index.d.mts.map +0 -1
  196. package/constants/index.mjs.map +0 -1
  197. package/getTypes-D-cwjcBl.mjs +0 -2
  198. package/getTypes-D-cwjcBl.mjs.map +0 -1
  199. package/queries/getBlocksByIdChildren/index.d.mts.map +0 -1
  200. package/queries/getBlocksByIdChildren/index.mjs.map +0 -1
  201. package/queries/getDatabasesByIdQuery/index.d.mts.map +0 -1
  202. package/queries/getDatabasesByIdQuery/index.mjs +0 -2
  203. package/queries/getDatabasesByIdQuery/index.mjs.map +0 -1
  204. package/queries/getDeepFetchAllChildren/index.d.mts.map +0 -1
  205. package/queries/getDeepFetchAllChildren/index.mjs.map +0 -1
  206. package/queries/getInfoType/index.d.mts.map +0 -1
  207. package/queries/getInfoType/index.mjs.map +0 -1
  208. package/queries/getNotionListing/index.d.mts.map +0 -1
  209. package/queries/getNotionListing/index.mjs +0 -2
  210. package/queries/getNotionListing/index.mjs.map +0 -1
  211. package/queries/getNotionListingByDate/index.d.mts.map +0 -1
  212. package/queries/getNotionListingByDate/index.mjs +0 -2
  213. package/queries/getNotionListingByDate/index.mjs.map +0 -1
  214. package/queries/getNotionSlug/index.d.mts.map +0 -1
  215. package/queries/getNotionSlug/index.mjs +0 -2
  216. package/queries/getNotionSlug/index.mjs.map +0 -1
  217. package/queries/getNotionSlugByRoute/index.d.mts.map +0 -1
  218. package/queries/getNotionSlugByRoute/index.mjs +0 -2
  219. package/queries/getNotionSlugByRoute/index.mjs.map +0 -1
  220. package/queries/getPagesById/index.d.mts.map +0 -1
  221. package/queries/getPagesById/index.mjs.map +0 -1
  222. package/queries/getPathVariables/index.d.mts.map +0 -1
  223. package/queries/getPathVariables/index.mjs +0 -2
  224. package/queries/getPathVariables/index.mjs.map +0 -1
  225. package/queries/getQuery/index.d.mts.map +0 -1
  226. package/queries/getQuery/index.mjs +0 -2
  227. package/queries/getQuery/index.mjs.map +0 -1
  228. package/utils/addTime/index.d.mts +0 -5
  229. package/utils/addTime/index.d.mts.map +0 -1
  230. package/utils/addTime/index.mjs.map +0 -1
  231. package/utils/dataNormalized/index.d.mts.map +0 -1
  232. package/utils/dataNormalized/index.mjs +0 -1
  233. package/utils/dataNormalizedResults/index.d.mts.map +0 -1
  234. package/utils/dataNormalizedResults/index.mjs +0 -1
  235. package/utils/getDataType/index.d.mts.map +0 -1
  236. package/utils/getDataType/index.mjs +0 -2
  237. package/utils/getDataType/index.mjs.map +0 -1
  238. package/utils/getTitle/index.d.mts.map +0 -1
  239. package/utils/getTitle/index.mjs.map +0 -1
  240. package/utils/getTypes/_unsupported.d.mts.map +0 -1
  241. package/utils/getTypes/_unsupported.mjs.map +0 -1
  242. package/utils/getTypes/checkbox.d.mts.map +0 -1
  243. package/utils/getTypes/checkbox.mjs +0 -2
  244. package/utils/getTypes/checkbox.mjs.map +0 -1
  245. package/utils/getTypes/date.d.mts.map +0 -1
  246. package/utils/getTypes/date.mjs +0 -2
  247. package/utils/getTypes/date.mjs.map +0 -1
  248. package/utils/getTypes/email.d.mts.map +0 -1
  249. package/utils/getTypes/email.mjs +0 -2
  250. package/utils/getTypes/email.mjs.map +0 -1
  251. package/utils/getTypes/files.d.mts.map +0 -1
  252. package/utils/getTypes/files.mjs.map +0 -1
  253. package/utils/getTypes/index.d.mts.map +0 -1
  254. package/utils/getTypes/index.mjs +0 -1
  255. package/utils/getTypes/multi_select.d.mts.map +0 -1
  256. package/utils/getTypes/multi_select.mjs.map +0 -1
  257. package/utils/getTypes/number.d.mts.map +0 -1
  258. package/utils/getTypes/number.mjs +0 -2
  259. package/utils/getTypes/number.mjs.map +0 -1
  260. package/utils/getTypes/people.d.mts.map +0 -1
  261. package/utils/getTypes/people.mjs.map +0 -1
  262. package/utils/getTypes/phone_number.d.mts.map +0 -1
  263. package/utils/getTypes/phone_number.mjs +0 -2
  264. package/utils/getTypes/phone_number.mjs.map +0 -1
  265. package/utils/getTypes/relation.d.mts.map +0 -1
  266. package/utils/getTypes/relation.mjs +0 -1
  267. package/utils/getTypes/rich_text.d.mts.map +0 -1
  268. package/utils/getTypes/rich_text.mjs.map +0 -1
  269. package/utils/getTypes/rollup.d.mts.map +0 -1
  270. package/utils/getTypes/rollup.mjs +0 -1
  271. package/utils/getTypes/select.d.mts.map +0 -1
  272. package/utils/getTypes/select.mjs.map +0 -1
  273. package/utils/getTypes/title.d.mts.map +0 -1
  274. package/utils/getTypes/title.mjs +0 -2
  275. package/utils/getTypes/title.mjs.map +0 -1
  276. package/utils/getTypes/url.mjs +0 -2
  277. package/utils/getTypes/url.mjs.map +0 -1
  278. package/utils-VfbevQkn.mjs +0 -2
  279. package/utils-VfbevQkn.mjs.map +0 -1
package/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["_Client","#config"],"sources":["../src/index.ts"],"sourcesContent":["import { Client as _Client } from \"@notionhq/client\";\n\nimport { DATA_TYPES } from \"./constants/index\";\nimport {\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getDeepFetchAllChildren,\n getInfoType,\n getNotionListing,\n getNotionListingByDate,\n getNotionSlug,\n getNotionSlugByRoute,\n getPagesById,\n getPathVariables,\n getQuery,\n} from \"./queries/index\";\n\ntype ClientProps = {\n custom: CustomProps;\n dataTypes: DataTypesProps;\n};\n\ntype CredentialProps = {\n auth: string;\n config: any;\n};\n\ntype CustomProps = {\n getBlocksByIdChildren: any;\n getDatabasesByIdQuery: any;\n getDeepFetchAllChildren: any;\n getInfoType: any;\n getPagesById: any;\n getPathVariables: any;\n getQuery: any;\n};\n\ntype DataTypesProps = {\n LISTING: any;\n LISTING_BY_DATE: any;\n SLUG: any;\n SLUG_BY_ROUTE: any;\n};\n\nclass Client extends _Client {\n #config?: any;\n\n // @todo(notion) throw error if `config` is not passed\n public readonly custom = {\n getBlocksByIdChildren: async (props) =>\n await getBlocksByIdChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getDatabasesByIdQuery: async (props) =>\n await getDatabasesByIdQuery({\n ...props,\n getDatabasesQuery: this.databases.query,\n }),\n\n getDeepFetchAllChildren: async (props) =>\n await getDeepFetchAllChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getInfoType: (props) => {\n return getInfoType({ ...props, config: this.#config });\n },\n\n getPagesById: async (props) =>\n await getPagesById({ ...props, getPagesRetrieve: this.pages.retrieve }),\n\n getPathVariables: (props) => getPathVariables({ ...props, config: this.#config }),\n\n getQuery: async (props) =>\n await getQuery({\n ...props,\n config: this.#config,\n notionDatabasesQuery: this.databases.query,\n }),\n };\n\n /**\n * @info details at: ../../utils/getDataType\n *\n */\n public readonly dataTypes = {\n [DATA_TYPES.LISTING]: async (props: { pathVariables: any; routeType: any; slug?: any }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING}`)\n return await getNotionListing({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n });\n },\n\n [DATA_TYPES.LISTING_BY_DATE]: async (props: {\n pathVariables: any;\n routeType: any;\n slug: any;\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING_BY_DATE}`)\n return await getNotionListingByDate({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n });\n },\n\n [DATA_TYPES.SLUG]: async (props: { pathVariables: any; routeType: any; slug: any }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG}`)\n return await getNotionSlug({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getDeepFetchAllChildren: this.custom.getDeepFetchAllChildren,\n });\n },\n\n [DATA_TYPES.SLUG_BY_ROUTE]: async (props: {\n pathVariables: any;\n routeType: any;\n slug: any;\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG_BY_ROUTE}`)\n return await getNotionSlugByRoute({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getQuery: this.custom.getQuery,\n });\n },\n };\n\n // public constructor(options?: ClientOptions) {\n public constructor(options?: any) {\n super(options);\n this.#config = options?.config;\n }\n}\n\nexport type { ClientProps, CredentialProps };\nexport { Client };\n"],"mappings":"4rBA4CA,IAAM,EAAN,cAAqBA,CAAQ,CAC3B,GAGA,OAAyB,CACvB,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,IAC9C,CAAC,EAEH,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,kBAAmB,KAAK,UAAU,KACpC,CAAC,EAEH,wBAAyB,KAAO,IAC9B,MAAM,EAAwB,CAC5B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,IAC9C,CAAC,EAEH,YAAc,GACL,EAAY,CAAE,GAAG,EAAO,OAAQ,KAAKC,EAAQ,CAAC,EAGvD,aAAc,KAAO,IACnB,MAAM,EAAa,CAAE,GAAG,EAAO,iBAAkB,KAAK,MAAM,QAAS,CAAC,EAExE,iBAAmB,GAAU,EAAiB,CAAE,GAAG,EAAO,OAAQ,KAAKA,EAAQ,CAAC,EAEhF,SAAU,KAAO,IACf,MAAM,EAAS,CACb,GAAG,EACH,OAAQ,KAAKA,GACb,qBAAsB,KAAK,UAAU,KACvC,CAAC,CACL,EAMA,UAA4B,EACzB,EAAW,SAAU,KAAO,IAEpB,MAAM,EAAiB,CAC5B,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,YAC5B,CAAC,GAGF,EAAW,iBAAkB,KAAO,IAM5B,MAAM,EAAuB,CAClC,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,YAC5B,CAAC,GAGF,EAAW,MAAO,KAAO,IAEjB,MAAM,EAAc,CACzB,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,wBAAyB,KAAK,OAAO,uBACvC,CAAC,GAGF,EAAW,eAAgB,KAAO,IAM1B,MAAM,EAAqB,CAChC,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,SAAU,KAAK,OAAO,QACxB,CAAC,CAEL,EAGA,YAAmB,EAAe,CAChC,MAAM,CAAO,EACb,KAAKA,GAAU,GAAS,MAC1B,CACF"}
1
+ {"version":3,"file":"index.mjs","names":["_Client","#getDataSourceId","#queryDatabase","#config"],"sources":["../src/index.ts"],"sourcesContent":["import { Client as _Client } from \"@notionhq/client\";\n\nimport { DATA_TYPES } from \"./constants/index\";\nimport {\n getBlocksByIdChildren,\n getDatabasesByIdQuery,\n getDeepFetchAllChildren,\n getInfoType,\n getNotionListing,\n getNotionListingByDate,\n getNotionSlug,\n getNotionSlugByRoute,\n getPagesById,\n getPathVariables,\n getQuery,\n} from \"./queries/index\";\n\ntype ClientProps = {\n custom: CustomProps;\n dataTypes: DataTypesProps;\n};\n\ntype CredentialProps = {\n auth: string;\n config: any;\n};\n\ntype CustomProps = {\n getBlocksByIdChildren: any;\n getDatabasesByIdQuery: any;\n getDeepFetchAllChildren: any;\n getInfoType: any;\n getPagesById: any;\n getPathVariables: any;\n getQuery: any;\n};\n\ntype DataTypesProps = {\n LISTING: any;\n LISTING_BY_DATE: any;\n SLUG: any;\n SLUG_BY_ROUTE: any;\n};\n\nclass Client extends _Client {\n #config?: any;\n\n #getDataSourceId = async (database_id: string): Promise<string> => {\n const database = await this.databases.retrieve({ database_id });\n const data_source_id = \"data_sources\" in database ? database.data_sources[0]?.id : undefined;\n if (!data_source_id) {\n throw new Error(`No data source found for Notion database ${database_id}`);\n }\n return data_source_id;\n };\n\n #queryDatabase = async ({\n database_id,\n ...rest\n }: {\n database_id: string;\n [key: string]: any;\n }) => {\n const data_source_id = await this.#getDataSourceId(database_id);\n return await this.dataSources.query({ data_source_id, ...rest });\n };\n\n // @todo(notion) throw error if `config` is not passed\n public readonly custom = {\n getBlocksByIdChildren: async (props) =>\n await getBlocksByIdChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getDatabasesByIdQuery: async (props) =>\n await getDatabasesByIdQuery({\n ...props,\n getDatabasesQuery: this.#queryDatabase,\n }),\n\n getDeepFetchAllChildren: async (props) =>\n await getDeepFetchAllChildren({\n ...props,\n getBlocksChildrenList: this.blocks.children.list,\n }),\n\n getInfoType: (props) => {\n return getInfoType({ ...props, config: this.#config });\n },\n\n getPagesById: async (props) =>\n await getPagesById({ ...props, getPagesRetrieve: this.pages.retrieve }),\n\n getPathVariables: (props) => getPathVariables({ ...props, config: this.#config }),\n\n getQuery: async (props) =>\n await getQuery({\n ...props,\n config: this.#config,\n notionDatabasesQuery: this.#queryDatabase,\n }),\n };\n\n /**\n * @info details at: ../../utils/getDataType\n *\n */\n public readonly dataTypes = {\n [DATA_TYPES.LISTING]: async (props: { pathVariables: any; routeType: any; slug?: any }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING}`)\n return await getNotionListing({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n });\n },\n\n [DATA_TYPES.LISTING_BY_DATE]: async (props: {\n pathVariables: any;\n routeType: any;\n slug: any;\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.LISTING_BY_DATE}`)\n return await getNotionListingByDate({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getPagesById: this.custom.getPagesById,\n });\n },\n\n [DATA_TYPES.SLUG]: async (props: { pathVariables: any; routeType: any; slug: any }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG}`)\n return await getNotionSlug({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getDeepFetchAllChildren: this.custom.getDeepFetchAllChildren,\n });\n },\n\n [DATA_TYPES.SLUG_BY_ROUTE]: async (props: {\n pathVariables: any;\n routeType: any;\n slug: any;\n }) => {\n // console.dir(`📦️ [@jeromefitz/notion] => ${DATA_TYPES.SLUG_BY_ROUTE}`)\n return await getNotionSlugByRoute({\n ...props,\n config: this.#config,\n getBlocksByIdChildren: this.custom.getBlocksByIdChildren,\n getDatabasesByIdQuery: this.custom.getDatabasesByIdQuery,\n getQuery: this.custom.getQuery,\n });\n },\n };\n\n // public constructor(options?: ClientOptions) {\n public constructor(options?: any) {\n super(options);\n this.#config = options?.config;\n }\n}\n\nexport type { ClientProps, CredentialProps };\nexport { Client };\n"],"mappings":"otBA4CA,IAAM,EAAN,cAAqBA,CAAQ,CAC3B,GAEA,GAAmB,KAAO,IAAyC,CACjE,IAAM,EAAW,MAAM,KAAK,UAAU,SAAS,CAAE,aAAY,CAAC,EACxD,EAAiB,iBAAkB,EAAW,EAAS,aAAa,EAAE,EAAE,GAAK,OACnF,GAAI,CAAC,EACH,MAAU,MAAM,4CAA4C,GAAa,EAE3E,OAAO,CACT,EAEA,GAAiB,MAAO,CACtB,cACA,GAAG,KAIC,CACJ,IAAM,EAAiB,MAAM,KAAKC,GAAiB,CAAW,EAC9D,OAAO,MAAM,KAAK,YAAY,MAAM,CAAE,iBAAgB,GAAG,CAAK,CAAC,CACjE,EAGA,OAAyB,CACvB,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,IAC9C,CAAC,EAEH,sBAAuB,KAAO,IAC5B,MAAM,EAAsB,CAC1B,GAAG,EACH,kBAAmB,KAAKC,EAC1B,CAAC,EAEH,wBAAyB,KAAO,IAC9B,MAAM,EAAwB,CAC5B,GAAG,EACH,sBAAuB,KAAK,OAAO,SAAS,IAC9C,CAAC,EAEH,YAAc,GACL,EAAY,CAAE,GAAG,EAAO,OAAQ,KAAKC,EAAQ,CAAC,EAGvD,aAAc,KAAO,IACnB,MAAM,EAAa,CAAE,GAAG,EAAO,iBAAkB,KAAK,MAAM,QAAS,CAAC,EAExE,iBAAmB,GAAU,EAAiB,CAAE,GAAG,EAAO,OAAQ,KAAKA,EAAQ,CAAC,EAEhF,SAAU,KAAO,IACf,MAAM,EAAS,CACb,GAAG,EACH,OAAQ,KAAKA,GACb,qBAAsB,KAAKD,EAC7B,CAAC,CACL,EAMA,UAA4B,EACzB,EAAW,SAAU,KAAO,IAEpB,MAAM,EAAiB,CAC5B,GAAG,EACH,OAAQ,KAAKC,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,YAC5B,CAAC,GAGF,EAAW,iBAAkB,KAAO,IAM5B,MAAM,EAAuB,CAClC,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,aAAc,KAAK,OAAO,YAC5B,CAAC,GAGF,EAAW,MAAO,KAAO,IAEjB,MAAM,EAAc,CACzB,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,wBAAyB,KAAK,OAAO,uBACvC,CAAC,GAGF,EAAW,eAAgB,KAAO,IAM1B,MAAM,EAAqB,CAChC,GAAG,EACH,OAAQ,KAAKA,GACb,sBAAuB,KAAK,OAAO,sBACnC,sBAAuB,KAAK,OAAO,sBACnC,SAAU,KAAK,OAAO,QACxB,CAAC,CAEL,EAGA,YAAmB,EAAe,CAChC,MAAM,CAAO,EACb,KAAKA,GAAU,GAAS,MAC1B,CACF"}
@@ -0,0 +1 @@
1
+ export { };