@wirecat/notion-cli 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +14 -4
  3. package/contracts/wirecat.json +698 -1
  4. package/dist/bin/notion.js +2 -2
  5. package/dist/bundle/{all-profiles-OETMCOLN.js → all-profiles-4IONYZB6.js} +10 -10
  6. package/dist/bundle/{anthropic-5Y3O2TYM.js → anthropic-OXF74J4P.js} +6 -6
  7. package/dist/bundle/{app-server-IVWBIVHC.js → app-server-M2VF6ABM.js} +61 -52
  8. package/dist/bundle/{bun-EO636SAD.js → bun-DLA6QRLL.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-C2T7QJ2M.js → bun-sqlite-F4BYLW3F.js} +7 -7
  10. package/dist/bundle/{chunk-QBC23NHD.js → chunk-2MHMKNWD.js} +1 -1
  11. package/dist/bundle/{chunk-TSCIIXN3.js → chunk-4KUJTSHG.js} +2 -2
  12. package/dist/bundle/{chunk-24FAYAML.js → chunk-4TQVZXOV.js} +3 -3
  13. package/dist/bundle/{chunk-FF4DDBCB.js → chunk-5LBJNTEJ.js} +6 -6
  14. package/dist/bundle/chunk-5UA2TYMI.js +29 -0
  15. package/dist/bundle/{chunk-DIM5YWBU.js → chunk-5XP4KQ2F.js} +1 -1
  16. package/dist/bundle/{chunk-WM7663C2.js → chunk-6GN7KU7X.js} +9 -9
  17. package/dist/bundle/chunk-6JBLIQQN.js +16 -0
  18. package/dist/bundle/{chunk-CLG2ISQH.js → chunk-7NF3V5L2.js} +4 -4
  19. package/dist/bundle/{chunk-TR7R5DL4.js → chunk-7NGFGFE5.js} +12 -63
  20. package/dist/bundle/{chunk-YA4LSSDZ.js → chunk-7NVPM55S.js} +2913 -2371
  21. package/dist/bundle/{chunk-XC5CKHX2.js → chunk-7YZPBAQX.js} +1 -1
  22. package/dist/bundle/{chunk-RSIS7BR7.js → chunk-AYU5TFDU.js} +21 -21
  23. package/dist/bundle/{chunk-64D5VUZ4.js → chunk-BEPFGITI.js} +68 -64
  24. package/dist/bundle/{chunk-HRTIRRXR.js → chunk-CBGBFAYJ.js} +41 -6
  25. package/dist/bundle/{chunk-QC3KOJT4.js → chunk-CDGZZNGY.js} +6 -6
  26. package/dist/bundle/{chunk-JK44XO2S.js → chunk-CIVXTBJY.js} +56 -56
  27. package/dist/bundle/{chunk-OWJDC4CB.js → chunk-COH7OEER.js} +14 -13
  28. package/dist/bundle/{chunk-XL2HXHP3.js → chunk-D6RCRBDH.js} +2 -2
  29. package/dist/bundle/{chunk-47R43UVJ.js → chunk-EQPAZ33O.js} +19 -19
  30. package/dist/bundle/{chunk-AE2KQ37N.js → chunk-EY6S7FV3.js} +6 -6
  31. package/dist/bundle/chunk-FEMHUSGO.js +88 -0
  32. package/dist/bundle/{chunk-NLDYZBTC.js → chunk-FSJHASRQ.js} +1146 -2555
  33. package/dist/bundle/chunk-GBFEEHQC.js +385 -0
  34. package/dist/bundle/{chunk-IQWEJEB5.js → chunk-GCCPFKSU.js} +26264 -21086
  35. package/dist/bundle/{chunk-RDZ7SVBZ.js → chunk-GK4GLPG2.js} +3 -3
  36. package/dist/bundle/{chunk-B2XKEEFX.js → chunk-GSNE7OB4.js} +4 -4
  37. package/dist/bundle/{chunk-UWW24JQF.js → chunk-HTKSCSJU.js} +4 -4
  38. package/dist/bundle/{chunk-7FII4DCE.js → chunk-IJMFG7HB.js} +7 -7
  39. package/dist/bundle/{chunk-WVZFXI36.js → chunk-JIRRF6BM.js} +4 -4
  40. package/dist/bundle/{chunk-ST2UC7FS.js → chunk-JODE2XED.js} +31 -27
  41. package/dist/bundle/{chunk-CWVAYQXI.js → chunk-K5I64ZVI.js} +9 -9
  42. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  43. package/dist/bundle/{chunk-JKIN5TOU.js → chunk-KL3P5TQK.js} +4 -4
  44. package/dist/bundle/chunk-L62XTC7N.js +726 -0
  45. package/dist/bundle/chunk-L6H7PY4X.js +170 -0
  46. package/dist/bundle/{chunk-F6MLJ3V5.js → chunk-LIQMUDIZ.js} +2 -2
  47. package/dist/bundle/{chunk-HWRKURQH.js → chunk-M2EEIYBU.js} +2 -2
  48. package/dist/bundle/chunk-M6DGZ2O6.js +823 -0
  49. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  50. package/dist/bundle/{chunk-UWIA2G6Q.js → chunk-MRA62W5K.js} +404 -537
  51. package/dist/bundle/{chunk-XYIT2XB3.js → chunk-MVA5HVKL.js} +20 -0
  52. package/dist/bundle/{chunk-GA3URWIF.js → chunk-NO2LIHWA.js} +1 -1
  53. package/dist/bundle/{chunk-ESZT4WW3.js → chunk-OCDJ4FFA.js} +4 -4
  54. package/dist/bundle/{chunk-B4B65XIO.js → chunk-OI5DWZJG.js} +3 -3
  55. package/dist/bundle/chunk-P3P6DA6K.js +259 -0
  56. package/dist/bundle/chunk-QX3TPFEX.js +1977 -0
  57. package/dist/bundle/{chunk-EU5WCOMQ.js → chunk-R6SDRSZK.js} +76 -35
  58. package/dist/bundle/{chunk-K5TWMQSY.js → chunk-RMJMID5D.js} +8 -8
  59. package/dist/bundle/{chunk-RLSFOR2D.js → chunk-SGBS5QCU.js} +4 -4
  60. package/dist/bundle/{chunk-3D3PFXBP.js → chunk-T5UNSFES.js} +10 -15
  61. package/dist/bundle/{chunk-RAZKIHGH.js → chunk-TFNRCCGR.js} +4 -4
  62. package/dist/bundle/{chunk-WK3OSDNV.js → chunk-TJCPTRYD.js} +7 -7
  63. package/dist/bundle/{chunk-BWICUW7W.js → chunk-TXONV3HW.js} +2 -2
  64. package/dist/bundle/{chunk-AQZO3ITW.js → chunk-TZ2QJ53V.js} +2 -2
  65. package/dist/bundle/{chunk-35K5T6WV.js → chunk-UKE3CGHK.js} +1 -1
  66. package/dist/bundle/{chunk-7N5QB6NL.js → chunk-UROEWCOG.js} +5 -3
  67. package/dist/bundle/chunk-WHJWURZB.js +335 -0
  68. package/dist/bundle/{chunk-R6ZM45NF.js → chunk-WU3XHGOB.js} +185 -57
  69. package/dist/bundle/{chunk-2YR3RYT4.js → chunk-WZEEEQGC.js} +3 -3
  70. package/dist/bundle/{chunk-B2WFKFYL.js → chunk-XCTOCVMW.js} +20 -116
  71. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  72. package/dist/bundle/{chunk-EGTBL3MJ.js → chunk-Y5LAJWR5.js} +1 -1
  73. package/dist/bundle/{chunk-66PL7P4C.js → chunk-YAPDU3SV.js} +1 -1
  74. package/dist/bundle/{chunk-WWMB4UHF.js → chunk-YFWLHTNO.js} +1 -1
  75. package/dist/bundle/{chunk-KHOVVPLC.js → chunk-YGCI3DHS.js} +1 -1
  76. package/dist/bundle/{chunk-4GC5DBHW.js → chunk-Z53LYX4M.js} +3 -3
  77. package/dist/bundle/{chunk-EPAZ7DJB.js → chunk-ZC6ZQQ55.js} +48 -45
  78. package/dist/bundle/command-contract-UBXS6NHI.js +38 -0
  79. package/dist/bundle/{command-server-entry-A66DJ3MH.js → command-server-entry-2SORMVRM.js} +27 -24
  80. package/dist/bundle/decode-5O7IEFPN.js +297 -0
  81. package/dist/bundle/{dispatch-FEKU5UXC.js → dispatch-YHQX6FEJ.js} +8 -8
  82. package/dist/bundle/{dist-YFKABFFF.js → dist-ILNOLGYN.js} +1 -1
  83. package/dist/bundle/{echarts-XD2JSWU4.js → echarts-ARLMVQC7.js} +2 -2
  84. package/dist/bundle/{embed-F3HYGAF7.js → embed-FUDUKQ3K.js} +7 -7
  85. package/dist/bundle/{embedder-GSEDDUH7.js → embedder-HDRV7GX3.js} +10 -10
  86. package/dist/bundle/{failure-HDJLR2YJ.js → failure-JHXICWIL.js} +3 -3
  87. package/dist/bundle/first-run-BGEFTXOE.js +29 -0
  88. package/dist/bundle/first-screen-F5F3VS6Y.js +38 -0
  89. package/dist/bundle/{instructions-NZGJ4FW5.js → instructions-MEFIKCDI.js} +1 -1
  90. package/dist/bundle/{mcp-VFIOZDVY.js → mcp-VMS6PBCU.js} +2 -2
  91. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  92. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  93. package/dist/bundle/meeting-combined-HNSS3FQY.js +24 -0
  94. package/dist/bundle/meeting-model-REZVYGQW.js +26 -0
  95. package/dist/bundle/meeting-semantic-R4CSLVRG.js +22 -0
  96. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  97. package/dist/bundle/{node-RPKPDYQS.js → node-MAQALPLA.js} +2 -2
  98. package/dist/bundle/{node-sqlite-KH2UUYVO.js → node-sqlite-J7IJYNBO.js} +8 -8
  99. package/dist/bundle/notion.js +14 -14
  100. package/dist/bundle/{oauth-NKAI7TQD.js → oauth-AMV4YGJD.js} +8 -8
  101. package/dist/bundle/{open-WSAEAA2V.js → open-AB27MTGR.js} +6 -6
  102. package/dist/bundle/{openai-JPVDGHG5.js → openai-D77MU5XV.js} +31 -29
  103. package/dist/bundle/{process-5ZFVKOQX.js → process-SIOWTRJ6.js} +1 -1
  104. package/dist/bundle/{program-M3D56D6T.js → program-QC5MX4ZJ.js} +7533 -1997
  105. package/dist/bundle/{prompt-FROYQ5LV.js → prompt-W77YDHA6.js} +6 -6
  106. package/dist/bundle/{recognize-NYCHQMCX.js → recognize-3JAXQQ36.js} +5 -5
  107. package/dist/bundle/{remote-4OERF3Z4.js → remote-PSOJXCXO.js} +11 -11
  108. package/dist/bundle/{rerank-TEGXFUWY.js → rerank-EE44ZTGL.js} +8 -8
  109. package/dist/bundle/{schemas-MZNNOEYN.js → schemas-LBYUMBC6.js} +2 -2
  110. package/dist/bundle/{serve-HLYYBAXY.js → serve-XJMGAMFW.js} +10 -10
  111. package/dist/bundle/{server-D5OYNEUW.js → server-ASU6CP5R.js} +53 -44
  112. package/dist/bundle/server-WSPQ5EOA.js +72 -0
  113. package/dist/bundle/services-PT4PA4J6.js +588 -0
  114. package/dist/bundle/{sqlite-runtime-H2S5RR2F.js → sqlite-runtime-YHXRTVXE.js} +7 -7
  115. package/dist/bundle/{state-OPOXCDZL.js → state-T6ZKFWGD.js} +7 -7
  116. package/dist/bundle/{store-NHMXEJPD.js → store-3MUCZEI3.js} +20 -14
  117. package/dist/bundle/{store-Y3KRLCJ7.js → store-E5EE25FY.js} +30 -21
  118. package/dist/bundle/store-maintenance-command-ZZ55BBBG.js +63 -0
  119. package/dist/commands/api.d.ts.map +1 -1
  120. package/dist/commands/api.js +13 -4
  121. package/dist/commands/api.js.map +1 -1
  122. package/dist/commands/documents.d.ts +10 -1
  123. package/dist/commands/documents.d.ts.map +1 -1
  124. package/dist/commands/documents.js +175 -5
  125. package/dist/commands/documents.js.map +1 -1
  126. package/dist/commands/library.d.ts +10 -0
  127. package/dist/commands/library.d.ts.map +1 -0
  128. package/dist/commands/library.js +470 -0
  129. package/dist/commands/library.js.map +1 -0
  130. package/dist/commands/session.d.ts.map +1 -1
  131. package/dist/commands/session.js +4 -3
  132. package/dist/commands/session.js.map +1 -1
  133. package/dist/config.d.ts +19 -0
  134. package/dist/config.d.ts.map +1 -1
  135. package/dist/config.js +73 -5
  136. package/dist/config.js.map +1 -1
  137. package/dist/context.d.ts +8 -0
  138. package/dist/context.d.ts.map +1 -1
  139. package/dist/context.js +15 -3
  140. package/dist/context.js.map +1 -1
  141. package/dist/generated/types.d.ts +485 -375
  142. package/dist/generated/types.d.ts.map +1 -1
  143. package/dist/identity.d.ts.map +1 -1
  144. package/dist/identity.js +1 -0
  145. package/dist/identity.js.map +1 -1
  146. package/dist/knowledge.d.ts +27 -0
  147. package/dist/knowledge.d.ts.map +1 -0
  148. package/dist/knowledge.js +87 -0
  149. package/dist/knowledge.js.map +1 -0
  150. package/dist/library.d.ts +44 -0
  151. package/dist/library.d.ts.map +1 -0
  152. package/dist/library.js +149 -0
  153. package/dist/library.js.map +1 -0
  154. package/dist/notion/client.d.ts +4 -1
  155. package/dist/notion/client.d.ts.map +1 -1
  156. package/dist/notion/client.js +5 -2
  157. package/dist/notion/client.js.map +1 -1
  158. package/dist/notion/errors.d.ts +5 -0
  159. package/dist/notion/errors.d.ts.map +1 -1
  160. package/dist/notion/errors.js +33 -1
  161. package/dist/notion/errors.js.map +1 -1
  162. package/dist/notion/reads.d.ts +4 -0
  163. package/dist/notion/reads.d.ts.map +1 -1
  164. package/dist/notion/writes.d.ts +40 -0
  165. package/dist/notion/writes.d.ts.map +1 -0
  166. package/dist/notion/writes.js +112 -0
  167. package/dist/notion/writes.js.map +1 -0
  168. package/dist/program.js +2 -2
  169. package/dist/program.js.map +1 -1
  170. package/dist/sync/cursor.d.ts +93 -0
  171. package/dist/sync/cursor.d.ts.map +1 -1
  172. package/dist/sync/cursor.js +63 -2
  173. package/dist/sync/cursor.js.map +1 -1
  174. package/dist/sync/files.d.ts +87 -0
  175. package/dist/sync/files.d.ts.map +1 -0
  176. package/dist/sync/files.js +31 -0
  177. package/dist/sync/files.js.map +1 -0
  178. package/dist/sync/markdown.d.ts +4 -1
  179. package/dist/sync/markdown.d.ts.map +1 -1
  180. package/dist/sync/markdown.js +8 -6
  181. package/dist/sync/markdown.js.map +1 -1
  182. package/dist/sync/source.d.ts +6 -59
  183. package/dist/sync/source.d.ts.map +1 -1
  184. package/dist/sync/source.js +650 -271
  185. package/dist/sync/source.js.map +1 -1
  186. package/dist/version.d.ts +1 -1
  187. package/dist/version.js +1 -1
  188. package/package.json +3 -3
  189. package/skills/notion-cli/SKILL.md +18 -1
  190. package/dist/bundle/command-contract-6G5DC2FN.js +0 -35
  191. package/dist/bundle/decode-7XOFRAAT.js +0 -163
  192. package/dist/bundle/first-run-TXNTIUSP.js +0 -28
  193. package/dist/bundle/first-screen-JZPJND7J.js +0 -33
  194. package/dist/bundle/server-LWZGVMNW.js +0 -62
  195. package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +0 -53
  196. package/dist/commands/comments.d.ts +0 -3
  197. package/dist/commands/comments.d.ts.map +0 -1
  198. package/dist/commands/comments.js +0 -114
  199. package/dist/commands/comments.js.map +0 -1
  200. package/dist/sample/comments.d.ts +0 -61
  201. package/dist/sample/comments.d.ts.map +0 -1
  202. package/dist/sample/comments.js +0 -39
  203. package/dist/sample/comments.js.map +0 -1
  204. package/dist/sample/records.d.ts +0 -16
  205. package/dist/sample/records.d.ts.map +0 -1
  206. package/dist/sample/records.js +0 -22
  207. package/dist/sample/records.js.map +0 -1
  208. package/dist/sample/transport.d.ts +0 -42
  209. package/dist/sample/transport.d.ts.map +0 -1
  210. package/dist/sample/transport.js +0 -153
  211. package/dist/sample/transport.js.map +0 -1
  212. /package/dist/bundle/{chunk-ZI3YTXSF.js → chunk-SHTHNBHG.js} +0 -0
@@ -4,7 +4,7 @@ const UNKNOWN_TAG = /<unknown\b[^>]*\/>/g;
4
4
  const bare = (id) => id.replaceAll("-", "").toLowerCase();
5
5
  /** A truncated page names at most 100 unknown blocks per answer; their subtrees can be truncated again. */
6
6
  const MAX_DEPTH = 3;
7
- const expand = async (reads, markdown, unknown, depth) => {
7
+ const expand = async (reads, markdown, unknown, depth, skipped) => {
8
8
  if (!unknown.length || depth >= MAX_DEPTH)
9
9
  return { markdown, missing: unknown.length };
10
10
  let missing = 0;
@@ -12,14 +12,16 @@ const expand = async (reads, markdown, unknown, depth) => {
12
12
  for (const id of unknown) {
13
13
  try {
14
14
  const block = await reads.pageMarkdown(id);
15
- const inner = await expand(reads, block.markdown, block.unknown_block_ids, depth + 1);
15
+ const inner = await expand(reads, block.markdown, block.unknown_block_ids, depth + 1, skipped);
16
16
  parts.set(bare(id), inner.markdown);
17
17
  missing += inner.missing;
18
18
  }
19
19
  catch (error) {
20
- // Notion's list mixes truncated blocks with unshared ones, and only the re-fetch tells them apart.
21
- if (!isCliError(error) || error.code !== "not_found")
20
+ // Notion's list mixes truncated blocks with unshared ones, and only the re-fetch tells them apart. The page
21
+ // itself was read, so its failure must not leave this function: the sync would hold it, or drop it, for good.
22
+ if (!isCliError(error) || (error.code !== "not_found" && error.code !== "permission_error"))
22
23
  throw error;
24
+ skipped(id, error.code);
23
25
  missing++;
24
26
  }
25
27
  }
@@ -32,9 +34,9 @@ const expand = async (reads, markdown, unknown, depth) => {
32
34
  });
33
35
  return { markdown: replaced, missing };
34
36
  };
35
- export const pageText = async (reads, id) => {
37
+ export const pageText = async (reads, id, skipped = () => undefined) => {
36
38
  const page = await reads.pageMarkdown(id);
37
- const full = await expand(reads, page.markdown, page.unknown_block_ids, 0);
39
+ const full = await expand(reads, page.markdown, page.unknown_block_ids, 0, skipped);
38
40
  return { markdown: withoutSignedLinks(full.markdown).text, missing: full.missing };
39
41
  };
40
42
  //# sourceMappingURL=markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/sync/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAGvD,MAAM,WAAW,GAAG,qBAAqB,CAAA;AACzC,MAAM,IAAI,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAA;AACjE,2GAA2G;AAC3G,MAAM,SAAS,GAAG,CAAC,CAAA;AAQnB,MAAM,MAAM,GAAG,KAAK,EAAE,KAAkB,EAAE,QAAgB,EAAE,OAAiB,EAAE,KAAa,EAAqB,EAAE;IACjH,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;IACvF,IAAI,OAAO,GAAG,CAAC,CAAA;IACf,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC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,11 @@
1
- import type { DocumentSource, SourceFile } from "@wirecat/cli-core/documents";
2
- import type { NotionParent, NotionReads } from "../notion/reads.js";
3
- import { type FrontMatterValue } from "./front-matter.js";
4
- /** The folder that stands for everything the token sees, the scope when no folder is chosen. */
5
- export declare const WORKSPACE_ROOT = "notion-workspace";
1
+ import type { DocumentSource } from "@wirecat/cli-core/documents";
2
+ import type { NotionReads } from "../notion/reads.js";
3
+ import { type NotionFile, type NotionSourceOptions } from "./files.js";
4
+ export { isNotionDocument, isNotionFolder, type NotionFile, type NotionIdentity, type NotionKind, type NotionMetadata, type NotionSourceOptions, type SyncWarning, UNTITLED, WORKSPACE_ROOT, } from "./files.js";
6
5
  /** Notion rounds `last_edited_time` to the minute; a read this soon after an edit may miss another in that minute. */
7
6
  export declare const SETTLE_MS: number;
8
7
  export declare const MIN_OVERLAP_MS: number;
9
- export type NotionKind = "workspace" | "page" | "row" | "database";
10
- export interface NotionIdentity {
11
- id: string;
12
- name?: string;
13
- /** `author`, `editor`, or `property:<name>` for a people property. */
14
- role: string;
15
- }
16
- export interface NotionMetadata {
17
- kind: NotionKind;
18
- /** Notion's own parent. `parents` holds the container the sync files it under, which differs for a page in a block. */
19
- parent?: {
20
- type: NotionParent["type"];
21
- id: string;
22
- };
23
- dataSources?: {
24
- id: string;
25
- name: string;
26
- }[];
27
- createdBy?: string;
28
- lastEditedBy?: string;
29
- /** Set by `content()` only. */
30
- frontMatter?: Record<string, FrontMatterValue>;
31
- people?: NotionIdentity[];
32
- missingBlocks?: number;
33
- }
34
- export interface NotionFile extends SourceFile {
35
- providerMetadata: NotionMetadata;
36
- }
37
- /**
38
- * Until cli-core plans a page with children as both a folder and a document (C2), only the workspace and databases
39
- * are folders: the engine syncs top-level pages and database rows, not pages under pages.
40
- */
41
- export declare const isNotionFolder: (file: NotionFile) => boolean;
42
- export interface NotionSourceOptions {
43
- /** Chosen pages and databases; none means everything the token sees. */
44
- roots?: string[];
45
- /** What the sync already holds (the state's documents and folders), to tell a missed page from a deleted one. */
46
- known?: () => Iterable<NotionFile>;
47
- /** How far back each pass reads before the mark; at least two minutes. */
48
- overlapMs?: number;
49
- walkEveryMs?: number;
50
- /** Requests one `changes()` call may make before it returns what it has and a cursor to go on from. */
51
- maxRequests?: number;
52
- /** This computer's clock, for the walk schedule only; Notion's timestamps are never compared with it. */
53
- now?: () => number;
54
- /** An item or a step left out of this sync, and why; the sync went on without it. */
55
- warn?: (warning: SyncWarning) => void;
56
- }
57
- export interface SyncWarning {
58
- id?: string;
59
- code: string;
60
- message: string;
61
- retry_after_ms?: number;
62
- }
8
+ /** Whether a Notion pass is still under way: the next `changes()` goes on with its tasks. */
9
+ export declare const passUnderWay: (token: string | undefined) => boolean;
63
10
  export declare const notionSource: (notion: NotionReads, options?: NotionSourceOptions) => DocumentSource<NotionFile>;
64
11
  //# sourceMappingURL=source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/sync/source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAA+B,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE1G,OAAO,KAAK,EAKV,YAAY,EACZ,WAAW,EAEZ,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,KAAK,gBAAgB,EAA0C,MAAM,mBAAmB,CAAA;AAGjG,gGAAgG;AAChG,eAAO,MAAM,cAAc,qBAAqB,CAAA;AAGhD,sHAAsH;AACtH,eAAO,MAAM,SAAS,QAAa,CAAA;AACnC,eAAO,MAAM,cAAc,QAAa,CAAA;AAIxC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAA;AAElE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CA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