@wirecat/notion-cli 0.6.0 → 0.8.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.
- package/CHANGELOG.md +70 -0
- package/README.md +20 -3
- package/contracts/wirecat.json +238 -2
- package/dist/bin/notion.js +2 -2
- package/dist/bundle/agent-FDS2ENXJ.js +42 -0
- package/dist/bundle/{all-profiles-AELHUTFU.js → all-profiles-MIGUJ6UM.js} +11 -11
- package/dist/bundle/{anthropic-3CCYAGO3.js → anthropic-ZTYBZ7PI.js} +5 -5
- package/dist/bundle/{app-server-DJ6P4NY4.js → app-server-MGXJZOJ2.js} +72 -72
- package/dist/bundle/{bun-2FLR4IV4.js → bun-NS5YLOQT.js} +2 -2
- package/dist/bundle/{bun-sqlite-QB6CU6TH.js → bun-sqlite-EKMD3TXK.js} +6 -6
- package/dist/bundle/{chunk-GUIQJUJV.js → chunk-2BPQNFA5.js} +6 -6
- package/dist/bundle/{chunk-RD7BKTWV.js → chunk-2Q5ATPA6.js} +4 -4
- package/dist/bundle/{chunk-DHVVXQEL.js → chunk-2T76TPDD.js} +3 -3
- package/dist/bundle/{chunk-CFQQTDSA.js → chunk-2TVHFJKV.js} +1 -1
- package/dist/bundle/{chunk-IURYZSG3.js → chunk-2XWVZDOM.js} +12 -12
- package/dist/bundle/{chunk-OEQNP56V.js → chunk-43PCMVTZ.js} +1 -1
- package/dist/bundle/{chunk-WGZH2M64.js → chunk-53UXHJEO.js} +16 -3
- package/dist/bundle/{chunk-KB35BVTG.js → chunk-5KL3PQWI.js} +2 -2
- package/dist/bundle/{chunk-A42T4YX7.js → chunk-5QCPDJLB.js} +2 -2
- package/dist/bundle/{chunk-PHKED7AG.js → chunk-64KVWK5N.js} +5 -5
- package/dist/bundle/{chunk-QGGRFRMP.js → chunk-66M7VFIM.js} +38 -38
- package/dist/bundle/{chunk-EHW45LLT.js → chunk-6BOEXO72.js} +3 -3
- package/dist/bundle/{chunk-QEJFBORC.js → chunk-6P7HUUR5.js} +3 -3
- package/dist/bundle/{chunk-P27NDZQR.js → chunk-77727OQH.js} +214 -158
- package/dist/bundle/{chunk-BEV5LO4D.js → chunk-7KNBZOLH.js} +13 -13
- package/dist/bundle/{chunk-FMMYBVCH.js → chunk-7YPZPJTB.js} +1 -1
- package/dist/bundle/{chunk-CHPWBQUK.js → chunk-A5PL2GYK.js} +1 -1
- package/dist/bundle/{chunk-2Z7UOXFC.js → chunk-AG34MPVN.js} +1 -1
- package/dist/bundle/{chunk-STTO2MSY.js → chunk-BCO37YUH.js} +327 -6
- package/dist/bundle/{chunk-CL3YNUCC.js → chunk-COF6KS7A.js} +6 -6
- package/dist/bundle/{chunk-YDDI4QIT.js → chunk-CWTTCFDX.js} +1182 -669
- package/dist/bundle/{chunk-T37TAXVL.js → chunk-D2IVASIC.js} +2 -2
- package/dist/bundle/{chunk-5OJLUUOJ.js → chunk-D3G375NT.js} +6 -6
- package/dist/bundle/{chunk-3MYN2RMG.js → chunk-DGZNVYKK.js} +8 -8
- package/dist/bundle/{chunk-LC6WE6JS.js → chunk-DLEAVO2T.js} +14 -7
- package/dist/bundle/{chunk-KGAUINBO.js → chunk-DW6YAEMZ.js} +10 -10
- package/dist/bundle/{chunk-WB2KSQIP.js → chunk-E4FNVLTR.js} +39 -6
- package/dist/bundle/{chunk-AV2ZJ4WX.js → chunk-E5EYJU5R.js} +1 -1
- package/dist/bundle/{chunk-3LMW7U7F.js → chunk-E5XATHAF.js} +21 -8
- package/dist/bundle/{chunk-3UX4VJWD.js → chunk-EXHTGQR2.js} +3 -4
- package/dist/bundle/{chunk-JFSVAOA7.js → chunk-EZAVBR47.js} +2 -2
- package/dist/bundle/{chunk-HOVHE3A3.js → chunk-F7DHR4OO.js} +7 -7
- package/dist/bundle/{chunk-HM6AMYHR.js → chunk-FGWQHNKK.js} +2 -2
- package/dist/bundle/{chunk-DGMTSDKB.js → chunk-FSWLPNJT.js} +5 -5
- package/dist/bundle/{chunk-F5ZAN7OC.js → chunk-GFI3UUIU.js} +1 -1
- package/dist/bundle/{chunk-4RFR4J2O.js → chunk-GGNVBN2S.js} +2 -2
- package/dist/bundle/{chunk-UOC52GCB.js → chunk-GPFE4SS7.js} +4 -4
- package/dist/bundle/{chunk-ESZHGC4Q.js → chunk-H76WEF2L.js} +6 -6
- package/dist/bundle/{chunk-LECMHK2F.js → chunk-HPS2YGSZ.js} +1 -1
- package/dist/bundle/{chunk-LQVDFD65.js → chunk-HZ5LRWKH.js} +2 -2
- package/dist/bundle/{chunk-SEAGUFBX.js → chunk-I5OAVMOI.js} +12 -12
- package/dist/bundle/{chunk-TFT4FVRU.js → chunk-I62MWK5L.js} +14 -2
- package/dist/bundle/{chunk-WAGADES3.js → chunk-IBFCD6TR.js} +17 -17
- package/dist/bundle/{chunk-7L2XOKDZ.js → chunk-IL3UYHCR.js} +8 -8
- package/dist/bundle/{chunk-T6XIBULH.js → chunk-J4CXJJJU.js} +132 -32
- package/dist/bundle/{chunk-RXU5T5NM.js → chunk-JRZEXLRQ.js} +13 -12
- package/dist/bundle/{chunk-IJVTN5L3.js → chunk-KDPV6YBX.js} +2 -2
- package/dist/bundle/{chunk-BAXNAOOL.js → chunk-KHEISFJO.js} +3 -3
- package/dist/bundle/{chunk-GPRJXJC7.js → chunk-KI6OOW6D.js} +22 -1
- package/dist/bundle/{chunk-HVXOA4FO.js → chunk-KPBUJQKT.js} +1 -1
- package/dist/bundle/{chunk-FRB2L7OE.js → chunk-LEO5GWPD.js} +3 -3
- package/dist/bundle/{chunk-BQBC2WIG.js → chunk-LKUWH6KU.js} +1 -1
- package/dist/bundle/{chunk-AE4VW4NB.js → chunk-LYJDZILD.js} +3 -3
- package/dist/bundle/{chunk-NSR43UEW.js → chunk-M27SMKNH.js} +5 -5
- package/dist/bundle/{chunk-K5IC4FZN.js → chunk-MA6U4XH2.js} +1 -1
- package/dist/bundle/{chunk-2XUV7HNE.js → chunk-MC3LAGIW.js} +2 -2
- package/dist/bundle/{chunk-YUDVRFXN.js → chunk-MGC2BAD2.js} +1 -1
- package/dist/bundle/{chunk-KNCPBX5P.js → chunk-MLXDGBH4.js} +19 -19
- package/dist/bundle/{chunk-WAU5LSHP.js → chunk-NQA2STEE.js} +113 -13
- package/dist/bundle/{chunk-6EJCI47L.js → chunk-NSBTYJRP.js} +4 -4
- package/dist/bundle/{chunk-5XPHFV7H.js → chunk-NSQN4F7H.js} +8 -8
- package/dist/bundle/{chunk-YXYZAWWW.js → chunk-NVXMWAEV.js} +6 -6
- package/dist/bundle/{chunk-EZMG5QXB.js → chunk-OZAP4FEG.js} +8 -8
- package/dist/bundle/{chunk-2CMLY2X3.js → chunk-OZZ5PTHG.js} +5 -5
- package/dist/bundle/{chunk-6YOMPW7Y.js → chunk-P4ADIGTL.js} +8 -8
- package/dist/bundle/{chunk-DIU2QJJF.js → chunk-PVTW7ZOY.js} +23 -23
- package/dist/bundle/{chunk-4VXXOJ2F.js → chunk-Q5PNS2K2.js} +3 -3
- package/dist/bundle/{chunk-ERN53B3Z.js → chunk-QQP54EEZ.js} +29 -178
- package/dist/bundle/{chunk-XYQVVW4R.js → chunk-RM4DO2WZ.js} +1 -1
- package/dist/bundle/{chunk-GCAJW4SR.js → chunk-S3SLDYTU.js} +1 -1
- package/dist/bundle/{chunk-JVESLS7B.js → chunk-S5NFSVNK.js} +63 -63
- package/dist/bundle/{chunk-Q7EIL6VU.js → chunk-UE7ST7JC.js} +30 -30
- package/dist/bundle/{chunk-SAPP2LEH.js → chunk-ULTKZLJV.js} +7 -7
- package/dist/bundle/{chunk-G4ZU73SD.js → chunk-VJ5EF4C7.js} +76 -61
- package/dist/bundle/{chunk-7JVKQ6NM.js → chunk-WBVZVP4T.js} +4 -4
- package/dist/bundle/{chunk-AZLDR36U.js → chunk-WDL3QYN2.js} +3 -3
- package/dist/bundle/{chunk-FV4WTZCU.js → chunk-WPNY2J2X.js} +16 -16
- package/dist/bundle/{chunk-YYQ5GKAI.js → chunk-XRA2V4MM.js} +1886 -860
- package/dist/bundle/{chunk-VH7526NL.js → chunk-Y6KPZOOD.js} +3 -3
- package/dist/bundle/{chunk-ZDYEOE7L.js → chunk-YAYVXHMO.js} +48 -48
- package/dist/bundle/{chunk-W2VQDIU5.js → chunk-YG2FFC2R.js} +9 -9
- package/dist/bundle/{chunk-HHEWTLAT.js → chunk-YOZHKJEN.js} +2 -2
- package/dist/bundle/{chunk-KZJQPJK5.js → chunk-ZKD3TL3O.js} +4 -4
- package/dist/bundle/command-contract-ZGBZCKZP.js +41 -0
- package/dist/bundle/{command-server-entry-VUR6WL77.js → command-server-entry-ZXB7VUIG.js} +29 -29
- package/dist/bundle/{decode-I64PF2RM.js → decode-BGLAM2YP.js} +5 -5
- package/dist/bundle/{dispatch-JQBAZWCL.js → dispatch-A3WIRXBM.js} +8 -8
- package/dist/bundle/{echarts-YRRVLEX3.js → echarts-ISH62J4E.js} +2 -2
- package/dist/bundle/{embed-BLXLKMK2.js → embed-POZWSFKL.js} +6 -6
- package/dist/bundle/{embedder-JYGF6R7I.js → embedder-7DIUHQOQ.js} +9 -9
- package/dist/bundle/{failure-I6AAF5R5.js → failure-BBT3B4UY.js} +2 -2
- package/dist/bundle/{first-run-YLDOZGY6.js → first-run-SLMRAWYB.js} +12 -12
- package/dist/bundle/first-screen-CCLGBTQ2.js +41 -0
- package/dist/bundle/{instructions-AG7SRWTR.js → instructions-G5ZGHVFB.js} +1 -1
- package/dist/bundle/{mcp-YGOAUNC3.js → mcp-MQ2L5IIM.js} +2 -2
- package/dist/bundle/meeting-combined-P56K6BUT.js +25 -0
- package/dist/bundle/meeting-model-UY4ABXAZ.js +27 -0
- package/dist/bundle/{meeting-semantic-3DZPHM7L.js → meeting-semantic-VPMFO4FB.js} +6 -6
- package/dist/bundle/{node-GJQYN4FT.js → node-NLJINXVQ.js} +2 -2
- package/dist/bundle/{node-sqlite-7VXIRQPH.js → node-sqlite-LPV27ECD.js} +7 -7
- package/dist/bundle/notes-search-TKP34WJZ.js +64 -0
- package/dist/bundle/notion.js +13 -13
- package/dist/bundle/{oauth-N67CH2TK.js → oauth-SC4HSJ7X.js} +7 -7
- package/dist/bundle/{open-JGXVHIKO.js → open-K2JIOWCG.js} +5 -5
- package/dist/bundle/{openai-PFQJTF4H.js → openai-MCKQLBZM.js} +18 -18
- package/dist/bundle/{process-MEKCZMX3.js → process-LPVAYRO7.js} +1 -1
- package/dist/bundle/{program-DUJYLJH5.js → program-QXA6YXUO.js} +11870 -8637
- package/dist/bundle/{prompt-FW44QDHD.js → prompt-XWESMSOG.js} +5 -5
- package/dist/bundle/{recognize-62TDQ6A7.js → recognize-TDE6PPXV.js} +4 -4
- package/dist/bundle/{remote-7ONFD7GG.js → remote-OAGPQQVE.js} +11 -11
- package/dist/bundle/{rerank-YOHQQJS4.js → rerank-375AKI4E.js} +7 -7
- package/dist/bundle/{schemas-IIGJ7DOP.js → schemas-ZE62D6CG.js} +1 -1
- package/dist/bundle/{serve-ZCXGT5RB.js → serve-YWCHKQEP.js} +9 -9
- package/dist/bundle/{server-RQ74M637.js → server-C4SH5PRK.js} +64 -64
- package/dist/bundle/server-SYGVF5BJ.js +90 -0
- package/dist/bundle/{services-FWBRZ57M.js → services-5Z2P4D2K.js} +51 -51
- package/dist/bundle/{sqlite-runtime-ZZBNGV5L.js → sqlite-runtime-KLELNUHI.js} +6 -6
- package/dist/bundle/{state-GDDFO62Y.js → state-OWEBLXCG.js} +6 -6
- package/dist/bundle/{store-D2LRIWEI.js → store-F63SKKV7.js} +27 -23
- package/dist/bundle/{store-KQCLR57N.js → store-IVJXGAX7.js} +21 -21
- package/dist/bundle/store-maintenance-command-YBMOO7XH.js +77 -0
- package/dist/bundle/surface-G3ITURGS.js +76 -0
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +3 -25
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/comments.d.ts +1 -1
- package/dist/commands/comments.d.ts.map +1 -1
- package/dist/commands/comments.js +33 -2
- package/dist/commands/comments.js.map +1 -1
- package/dist/commands/databases.d.ts.map +1 -1
- package/dist/commands/databases.js +3 -2
- package/dist/commands/databases.js.map +1 -1
- package/dist/commands/documents.d.ts +13 -2
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +291 -23
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/library.d.ts.map +1 -1
- package/dist/commands/library.js +20 -10
- package/dist/commands/library.js.map +1 -1
- package/dist/commands/meetings.d.ts +7 -0
- package/dist/commands/meetings.d.ts.map +1 -0
- package/dist/commands/meetings.js +136 -0
- package/dist/commands/meetings.js.map +1 -0
- package/dist/commands/rows.d.ts +4 -0
- package/dist/commands/rows.d.ts.map +1 -0
- package/dist/commands/rows.js +51 -0
- package/dist/commands/rows.js.map +1 -0
- package/dist/commands/writing.d.ts +2 -1
- package/dist/commands/writing.d.ts.map +1 -1
- package/dist/commands/writing.js +2 -2
- package/dist/commands/writing.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -2
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +13 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +22 -7
- package/dist/context.js.map +1 -1
- package/dist/generated/wirecat-config.d.ts +13 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +90 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/knowledge.d.ts +18 -1
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/library.d.ts +4 -5
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +11 -14
- package/dist/library.js.map +1 -1
- package/dist/notion/client.d.ts +2 -6
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +7 -8
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/errors.d.ts +5 -0
- package/dist/notion/errors.d.ts.map +1 -1
- package/dist/notion/errors.js +40 -1
- package/dist/notion/errors.js.map +1 -1
- package/dist/notion/meeting-notes.d.ts +10 -0
- package/dist/notion/meeting-notes.d.ts.map +1 -0
- package/dist/notion/meeting-notes.js +196 -0
- package/dist/notion/meeting-notes.js.map +1 -0
- package/dist/notion/notion.d.ts +46 -0
- package/dist/notion/notion.d.ts.map +1 -1
- package/dist/notion/notion.js +105 -14
- package/dist/notion/notion.js.map +1 -1
- package/dist/notion/page-target.d.ts +30 -0
- package/dist/notion/page-target.d.ts.map +1 -0
- package/dist/notion/page-target.js +73 -0
- package/dist/notion/page-target.js.map +1 -0
- package/dist/notion/port.d.ts +10 -0
- package/dist/notion/port.d.ts.map +1 -1
- package/dist/notion/port.js +21 -0
- package/dist/notion/port.js.map +1 -1
- package/dist/notion/properties.d.ts +55 -0
- package/dist/notion/properties.d.ts.map +1 -0
- package/dist/notion/properties.js +280 -0
- package/dist/notion/properties.js.map +1 -0
- package/dist/notion/reads.d.ts +19 -1
- package/dist/notion/reads.d.ts.map +1 -1
- package/dist/notion/reads.js +2 -1
- package/dist/notion/reads.js.map +1 -1
- package/dist/notion/rows.d.ts +14 -0
- package/dist/notion/rows.d.ts.map +1 -0
- package/dist/notion/rows.js +119 -0
- package/dist/notion/rows.js.map +1 -0
- package/dist/notion/writes.d.ts +99 -0
- package/dist/notion/writes.d.ts.map +1 -1
- package/dist/notion/writes.js +278 -67
- package/dist/notion/writes.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +7 -1
- package/dist/program.js.map +1 -1
- package/dist/sync/comments.d.ts +12 -0
- package/dist/sync/comments.d.ts.map +1 -0
- package/dist/sync/comments.js +47 -0
- package/dist/sync/comments.js.map +1 -0
- package/dist/sync/files.d.ts +10 -4
- package/dist/sync/files.d.ts.map +1 -1
- package/dist/sync/files.js.map +1 -1
- package/dist/sync/from-config.d.ts +13 -0
- package/dist/sync/from-config.d.ts.map +1 -0
- package/dist/sync/from-config.js +33 -0
- package/dist/sync/from-config.js.map +1 -0
- package/dist/sync/source.d.ts +2 -1
- package/dist/sync/source.d.ts.map +1 -1
- package/dist/sync/source.js +25 -29
- package/dist/sync/source.js.map +1 -1
- package/dist/sync/users.d.ts +1 -11
- package/dist/sync/users.d.ts.map +1 -1
- package/dist/sync/users.js +0 -33
- package/dist/sync/users.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
- package/skills/notion-cli/SKILL.md +29 -3
- package/dist/bundle/agent-ILG6AH7S.js +0 -42
- package/dist/bundle/command-contract-L2FASWD6.js +0 -41
- package/dist/bundle/first-screen-GZH3LMLZ.js +0 -41
- package/dist/bundle/meeting-combined-OFQSGKBG.js +0 -25
- package/dist/bundle/meeting-model-K6NSX3O5.js +0 -27
- package/dist/bundle/notes-search-ACDOPTNH.js +0 -64
- package/dist/bundle/server-XMZF57WM.js +0 -90
- package/dist/bundle/store-maintenance-command-CK2MU5M6.js +0 -77
- package/dist/bundle/surface-K4TPIQW7.js +0 -76
- package/dist/bundle/{hast-util-from-html-X2DCPS3T.js → hast-util-from-html-237ZT4C7.js} +3 -3
- package/dist/bundle/{hast-util-to-mdast-3CSMIWK2.js → hast-util-to-mdast-H5COQ6HJ.js} +6 -6
- package/dist/bundle/{mdast-util-gfm-JO7PHUIB.js → mdast-util-gfm-M3K5BNY2.js} +16 -16
- package/dist/bundle/{mdast-util-to-hast-AYJV7KAE.js → mdast-util-to-hast-TSB5MAAV.js} +1 -1
- package/dist/bundle/{mdast-util-to-markdown-DOXGHRI7.js → mdast-util-to-markdown-SG6455IT.js} +10 -10
- package/dist/bundle/{micromark-extension-gfm-PQ7DWZM7.js → micromark-extension-gfm-7SUOOQ3A.js} +3 -3
package/dist/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,IAA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AAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;SAC9C,CAAC,CAAC;QACH,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC;QACtC,WAAW,CAAC,QAAQ,CAAC;KACtB;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAwB,EAAW,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAA;AAE9G,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAc,EAAE,OAAoB,EAAmB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NotionReads } from "../notion/reads.js";
|
|
2
|
+
import type { CommentAccess, SyncWarning } from "./files.js";
|
|
3
|
+
/**
|
|
4
|
+
* A page's open comments as lines of its searchable text, one per comment with its author and day; none adds nothing,
|
|
5
|
+
* so a page without comments keeps its hash. Notion lists only unresolved comments, so a comment that leaves the list
|
|
6
|
+
* was resolved or deleted, and the next read of the page drops it from the text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const pageComments: (reads: Pick<NotionReads, "comments">, warn: (warning: SyncWarning) => void) => (id: string) => Promise<{
|
|
9
|
+
text?: string;
|
|
10
|
+
comments: CommentAccess;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/sync/comments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAK5D;;;;GAIG;AACH,eAAO,MAAM,YAAY,UAAW,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,UAGnF,MAAM,KAAG,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAgC9E,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isCliError } from "@wirecat/cli-base";
|
|
2
|
+
/** A page's comments read for its searchable text, 100 a page; past this many the oldest are kept. */
|
|
3
|
+
const COMMENT_PAGES = 10;
|
|
4
|
+
/**
|
|
5
|
+
* A page's open comments as lines of its searchable text, one per comment with its author and day; none adds nothing,
|
|
6
|
+
* so a page without comments keeps its hash. Notion lists only unresolved comments, so a comment that leaves the list
|
|
7
|
+
* was resolved or deleted, and the next read of the page drops it from the text.
|
|
8
|
+
*/
|
|
9
|
+
export const pageComments = (reads, warn) => {
|
|
10
|
+
/** Comments are off by default in a connection's capabilities: one refusal is said once, and none is asked again. */
|
|
11
|
+
let refused = false;
|
|
12
|
+
return async (id) => {
|
|
13
|
+
if (refused)
|
|
14
|
+
return { comments: "refused" };
|
|
15
|
+
const lines = [];
|
|
16
|
+
let cursor;
|
|
17
|
+
let pages = 0;
|
|
18
|
+
try {
|
|
19
|
+
do {
|
|
20
|
+
const page = await reads.comments(id, cursor);
|
|
21
|
+
for (const comment of page.results) {
|
|
22
|
+
const author = comment.display_name?.resolved_name || comment.created_by.name || comment.created_by.id;
|
|
23
|
+
const said = comment.rich_text.map((part) => part.plain_text).join("");
|
|
24
|
+
lines.push(`${author}, ${comment.created_time.slice(0, 10)}: ${said}`);
|
|
25
|
+
}
|
|
26
|
+
cursor = page.has_more ? (page.next_cursor ?? undefined) : undefined;
|
|
27
|
+
pages++;
|
|
28
|
+
} while (cursor && pages < COMMENT_PAGES);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (!isCliError(error) || (error.code !== "permission_error" && error.code !== "not_found"))
|
|
32
|
+
throw error;
|
|
33
|
+
if (error.code === "permission_error") {
|
|
34
|
+
refused = true;
|
|
35
|
+
warn({
|
|
36
|
+
code: "permission_error",
|
|
37
|
+
reason: "notion.comments-unread",
|
|
38
|
+
message: 'comments were left out of the local copy: turn on "Read comments" in the connection\'s capabilities. ' +
|
|
39
|
+
"A page synced now gets its comments the next time it changes in Notion",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return { comments: refused ? "refused" : "read" };
|
|
43
|
+
}
|
|
44
|
+
return { comments: "read", ...(lines.length ? { text: `Comments:\n${lines.join("\n")}` } : {}) };
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/sync/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAI9C,sGAAsG;AACtG,MAAM,aAAa,GAAG,EAAE,CAAA;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,IAAoC,EAAE,EAAE;IACzG,qHAAqH;IACrH,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,OAAO,KAAK,EAAE,EAAU,EAAuD,EAAE;QAC/E,IAAI,OAAO;YAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAA;QAC3C,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,IAAI,MAA0B,CAAA;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,IAAI,CAAC;YACH,GAAG,CAAC;gBACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;gBAC7C,KA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AC;QACD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IAClG,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/dist/sync/files.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface NotionIdentity {
|
|
|
18
18
|
}
|
|
19
19
|
/** What the connection may read of users, as the first lookup in a run found it. */
|
|
20
20
|
export type UserAccess = "none" | "names" | "emails";
|
|
21
|
+
/** A page's comments were read, or the connection may not read comments. */
|
|
22
|
+
export type CommentAccess = "read" | "refused";
|
|
21
23
|
export interface NotionMetadata {
|
|
22
24
|
kind: NotionKind;
|
|
23
25
|
/** Notion's own parent. `parents` holds the container the sync files it under, which differs for a page in a block. */
|
|
@@ -37,6 +39,8 @@ export interface NotionMetadata {
|
|
|
37
39
|
/** What the read could learn of its authors; a page read before 0.6.0 has none and is read again. */
|
|
38
40
|
authors?: UserAccess;
|
|
39
41
|
missingBlocks?: number;
|
|
42
|
+
/** Whether the read could list the page's comments; a page read before 0.8.0 has none and is read again. */
|
|
43
|
+
comments?: CommentAccess;
|
|
40
44
|
}
|
|
41
45
|
export interface NotionFile extends SourceFile {
|
|
42
46
|
providerMetadata: NotionMetadata;
|
|
@@ -65,10 +69,10 @@ export interface NotionSourceOptions {
|
|
|
65
69
|
*/
|
|
66
70
|
reached?: () => Iterable<NotionFile>;
|
|
67
71
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
72
|
+
* What the connection may read of users now, as the last run learned it: a page read with less is read again for
|
|
73
|
+
* its authors (src/sync/from-config.ts).
|
|
70
74
|
*/
|
|
71
|
-
|
|
75
|
+
access?: () => UserAccess | undefined;
|
|
72
76
|
/** How far back each pass reads before the mark; at least two minutes. */
|
|
73
77
|
overlapMs?: number;
|
|
74
78
|
walkEveryMs?: number;
|
|
@@ -97,8 +101,10 @@ export interface SyncWarning {
|
|
|
97
101
|
}
|
|
98
102
|
export interface Listing {
|
|
99
103
|
files: NotionFile[];
|
|
100
|
-
/** Known items
|
|
104
|
+
/** Known items a direct read answered 404 for: deleted for good or no longer shared, Notion does not say which. */
|
|
101
105
|
gone: string[];
|
|
106
|
+
/** Known items a direct read found in Notion's trash: the one signal of a real deletion. */
|
|
107
|
+
trashed: string[];
|
|
102
108
|
/** Known items that are still there, under another parent. */
|
|
103
109
|
moved: NotionFile[];
|
|
104
110
|
}
|
package/dist/sync/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/sync/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,gGAAgG;AAChG,eAAO,MAAM,cAAc,qBAAqB,CAAA;AAEhD,eAAO,MAAM,QAAQ,WAAY,YAAY,WAa5C,CAAA;AAED,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,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;CACb;AAED,oFAAoF;AACpF,MAAM,MAAM,UAAU,GAAG,M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MAAM,SAAS,SAAU,UAAU,GAAG,SAAS,uBAI3C,CAAA"}
|
package/dist/sync/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/sync/files.ts"],"names":[],"mappings":"AAMA,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAEhD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAoB,EAAE,EAAE;IAC/C,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,OAAO,cAAc,CAAA;QACvB,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,OAAO,CAAA;QACvB,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,cAAc,CAAA;QAC9B,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,WAAW,CAAA;QAC3B,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,QAAQ,CAAA;IAC1B,CAAC;AACH,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/sync/files.ts"],"names":[],"mappings":"AAMA,gGAAgG;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAEhD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAoB,EAAE,EAAE;IAC/C,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,OAAO,cAAc,CAAA;QACvB,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,OAAO,CAAA;QACvB,KAAK,gBAAgB;YACnB,OAAO,MAAM,CAAC,cAAc,CAAA;QAC9B,KAAK,aAAa;YAChB,OAAO,MAAM,CAAC,WAAW,CAAA;QAC3B,KAAK,UAAU;YACb,OAAO,MAAM,CAAC,QAAQ,CAAA;IAC1B,CAAC;AACH,CAAC,CAAA;AAyCD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,KAAK,CAAA;AAExF,qGAAqG;AACrG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM,CAAA;AAE3F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAA;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAe,EAAE,CAAC,CAAC;IAC9C,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,kCAAkC;IACxC,OAAO,EAAE,EAAE;IACX,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,KAAK;IAClB,gBAAgB,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;CACxC,CAAC,CAAA;AA0DF,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAA4B,EAAE,EAAE,CACxD,IAAI,EAAE,gBAAgB,CAAC,WAAW;IAChC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;KACvB,IAAI,EAAE;KACN,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServiceApiCall } from "@wirecat/cli-core/cli";
|
|
2
|
+
import type { NotionSource } from "./browse.js";
|
|
3
|
+
import type { NotionSourceOptions } from "./files.js";
|
|
4
|
+
export interface NotionConfigSourceOptions extends NotionSourceOptions {
|
|
5
|
+
/** Notion's clock, from the Date header of its latest answer (`notionClock`). */
|
|
6
|
+
serverTime?: () => number | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The sync's source as wirecat.config.ts describes it: the account and every request from the calls it names, the
|
|
10
|
+
* rest as hooks. The resumable pass, the block tree and a row's container are Notion's own and stay code here.
|
|
11
|
+
*/
|
|
12
|
+
export declare const notionSourceFromConfig: (call: ServiceApiCall, options?: NotionConfigSourceOptions) => NotionSource;
|
|
13
|
+
//# sourceMappingURL=from-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from-config.d.ts","sourceRoot":"","sources":["../../src/sync/from-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAK3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAc,mBAAmB,EAAc,MAAM,YAAY,CAAA;AAK7E,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,SAAU,cAAc,YAAW,yBAAyB,KAAQ,YAmBtG,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { documentSourceFromManifest } from "@wirecat/cli-core/documents/cli";
|
|
2
|
+
import { API } from "../config.js";
|
|
3
|
+
import { SOURCE } from "../generated/wirecat-config.js";
|
|
4
|
+
import { manifestPort } from "../notion/port.js";
|
|
5
|
+
import { notionSource } from "./source.js";
|
|
6
|
+
const ACCESS_RANK = { none: 0, names: 1, emails: 2 };
|
|
7
|
+
/**
|
|
8
|
+
* The sync's source as wirecat.config.ts describes it: the account and every request from the calls it names, the
|
|
9
|
+
* rest as hooks. The resumable pass, the block tree and a row's container are Notion's own and stay code here.
|
|
10
|
+
*/
|
|
11
|
+
export const notionSourceFromConfig = (call, options = {}) => {
|
|
12
|
+
const { serverTime, ...rest } = options;
|
|
13
|
+
return documentSourceFromManifest(SOURCE, {
|
|
14
|
+
api: API.manifest,
|
|
15
|
+
call,
|
|
16
|
+
hooks: ({ read, base }) => ({
|
|
17
|
+
...notionSource(manifestPort(read, serverTime), rest),
|
|
18
|
+
// Only a page or a row has authors and comments. One read with less user information than the connection gives
|
|
19
|
+
// now is read again too, so its people are linked once the owner grants email addresses, and so is one read
|
|
20
|
+
// before the sync kept comments.
|
|
21
|
+
reread: (saved) => {
|
|
22
|
+
const { kind, authors, comments } = saved.metadata.providerMetadata;
|
|
23
|
+
if (kind !== "page" && kind !== "row")
|
|
24
|
+
return false;
|
|
25
|
+
if (base.reread?.(saved) || comments === undefined)
|
|
26
|
+
return true;
|
|
27
|
+
const access = options.access?.();
|
|
28
|
+
return authors !== undefined && access !== undefined && ACCESS_RANK[authors] < ACCESS_RANK[access];
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=from-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"from-config.js","sourceRoot":"","sources":["../../src/sync/from-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,MAAM,WAAW,GAA+B,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;AAOhF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAoB,EAAE,OAAO,GAA8B,EAAE,EAAgB,EAAE;IACpH,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACvC,OAAO,0BAA0B,CAAa,MAAM,EAAE;QACpD,GAAG,EAAE,GAAG,CAAC,QAAQ;QACjB,IAAI;QACJ,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YAC1B,GAAG,YAAY,CAAC,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC;YACrD,+GAA+G;YAC/G,4GAA4G;YAC5G,iCAAiC;YACjC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAA;gBACnE,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,KAAK;oBAAE,OAAO,KAAK,CAAA;gBACnD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,QAAQ,KAAK,SAAS;oBAAE,OAAO,IAAI,CAAA;gBAC/D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAA;gBACjC,OAAO,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;YACpG,CAAC;SACF,CAAC;KACH,CAAiB,CAAA;AACpB,CAAC,CAAA"}
|
package/dist/sync/source.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const SETTLE_MS: number;
|
|
|
7
7
|
export declare const MIN_OVERLAP_MS: number;
|
|
8
8
|
/** Whether a Notion pass is still under way: the next `changes()` goes on with its tasks. */
|
|
9
9
|
export declare const passUnderWay: (token: string | undefined) => boolean;
|
|
10
|
-
|
|
10
|
+
/** Everything but the account, which the source manifest names (src/sync/from-config.ts). */
|
|
11
|
+
export declare const notionSource: (notion: NotionReads, options?: NotionSourceOptions) => Omit<NotionSource, "identity">;
|
|
11
12
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/sync/source.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAOV,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/sync/source.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAOV,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAc5D,OAAO,EAIL,KAAK,mBAAmB,EAMzB,MAAM,YAAY,CAAA;AAKnB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,QAAQ,EACR,KAAK,UAAU,EACf,cAAc,GACf,MAAM,YAAY,CAAA;AAGnB,sHAAsH;AACtH,eAAO,MAAM,SAAS,QAAa,CAAA;AACnC,eAAO,MAAM,cAAc,QAAa,CAAA;AAUxC,6FAA6F;AAC7F,eAAO,MAAM,YAAY,UAAW,MAAM,GAAG,SAAS,YAAkE,CAAA;AAExH,6FAA6F;AAC7F,eAAO,MAAM,YAAY,WACf,WAAW,YACV,mBAAmB,KAC3B,IAAI,CAAC,YAAY,EAAE,UAAU,CAg6B/B,CAAA"}
|
package/dist/sync/source.js
CHANGED
|
@@ -3,11 +3,12 @@ import { deadlineMargin } from "@wirecat/cli-core/background";
|
|
|
3
3
|
import { isItemError, isNotFound, isRefused } from "../notion/errors.js";
|
|
4
4
|
import { withoutSignedLinks } from "../notion/links.js";
|
|
5
5
|
import { browseLevel } from "./browse.js";
|
|
6
|
+
import { pageComments } from "./comments.js";
|
|
6
7
|
import { decodeCursor, decodeListPosition, encodeCursor, encodeListPosition, } from "./cursor.js";
|
|
7
8
|
import { parentId, sourceIds, UNTITLED, WORKSPACE_ROOT, workspaceFile, } from "./files.js";
|
|
8
9
|
import { frontMatter, frontMatterLines, titleOf } from "./front-matter.js";
|
|
9
10
|
import { pageText } from "./markdown.js";
|
|
10
|
-
import {
|
|
11
|
+
import { pagePeople } from "./users.js";
|
|
11
12
|
export { isNotionDocument, isNotionFolder, UNTITLED, WORKSPACE_ROOT, } from "./files.js";
|
|
12
13
|
const MINUTE = 60_000;
|
|
13
14
|
/** Notion rounds `last_edited_time` to the minute; a read this soon after an edit may miss another in that minute. */
|
|
@@ -21,6 +22,7 @@ const text = (parts) => parts.map((part) => part.plain_text).join("");
|
|
|
21
22
|
const OUT_OF_TIME = new Error("the run's deadline is near");
|
|
22
23
|
/** Whether a Notion pass is still under way: the next `changes()` goes on with its tasks. */
|
|
23
24
|
export const passUnderWay = (token) => token !== undefined && decodeCursor(token).pass !== undefined;
|
|
25
|
+
/** Everything but the account, which the source manifest names (src/sync/from-config.ts). */
|
|
24
26
|
export const notionSource = (notion, options = {}) => {
|
|
25
27
|
const overlapMs = options.overlapMs ?? DEFAULTS.overlapMs;
|
|
26
28
|
if (overlapMs < MIN_OVERLAP_MS)
|
|
@@ -59,6 +61,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
59
61
|
retrieveBlock: counted(notion.retrieveBlock),
|
|
60
62
|
blockChildren: counted(notion.blockChildren),
|
|
61
63
|
pageMarkdown: counted(notion.pageMarkdown),
|
|
64
|
+
comments: counted(notion.comments),
|
|
62
65
|
};
|
|
63
66
|
// The state the engine holds does not change while the source lists, and parsing it costs as much as a request.
|
|
64
67
|
/** Folders listed again in this run after Notion stopped taking their saved position. */
|
|
@@ -399,7 +402,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
399
402
|
try {
|
|
400
403
|
const current = await retrieve(file.id, file.providerMetadata.kind);
|
|
401
404
|
if (current.trashed)
|
|
402
|
-
listing.
|
|
405
|
+
listing.trashed.push(file.id);
|
|
403
406
|
else if (current.parents[0] === container)
|
|
404
407
|
listing.files.push(current);
|
|
405
408
|
else
|
|
@@ -448,7 +451,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
448
451
|
else
|
|
449
452
|
at = decodeListPosition(token);
|
|
450
453
|
const files = [];
|
|
451
|
-
const listing = { files: [], gone: [], moved: [] };
|
|
454
|
+
const listing = { files: [], gone: [], trashed: [], moved: [] };
|
|
452
455
|
// Notion answers 400 validation_error to a start_cursor it no longer takes. On a later page that is the saved
|
|
453
456
|
// position going stale: as not_found the engine lists the folder again from its first page and drops nothing.
|
|
454
457
|
// Only the request sent with the saved start_cursor: a 400 on any other (a block Notion cannot list) is the
|
|
@@ -519,7 +522,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
519
522
|
};
|
|
520
523
|
/** A container's children, with every known child that did not come back checked directly before it counts as gone. */
|
|
521
524
|
const listChildren = async (id) => {
|
|
522
|
-
const listing = { files: await listed(id), gone: [], moved: [] };
|
|
525
|
+
const listing = { files: await listed(id), gone: [], trashed: [], moved: [] };
|
|
523
526
|
const seen = new Set(listing.files.map((file) => file.id));
|
|
524
527
|
await confirm([...known.values()].filter((file) => file.parents[0] === id && !seen.has(file.id)), id, listing);
|
|
525
528
|
return listing;
|
|
@@ -553,7 +556,6 @@ export const notionSource = (notion, options = {}) => {
|
|
|
553
556
|
];
|
|
554
557
|
return { next: cursor.mark, startedAt: now(), walk, tasks };
|
|
555
558
|
};
|
|
556
|
-
const { rereads, marking } = authorRereads(options.unauthored);
|
|
557
559
|
const changes = async (token) => {
|
|
558
560
|
const cursor = decodeCursor(token);
|
|
559
561
|
fresh();
|
|
@@ -564,9 +566,8 @@ export const notionSource = (notion, options = {}) => {
|
|
|
564
566
|
const since = cursor.mark ? minus(cursor.mark, overlapMs) : null;
|
|
565
567
|
const items = new Map();
|
|
566
568
|
const emit = (file) => items.set(file.id, { id: file.id, removed: false, file });
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const gone = (id) => items.set(id, { id, removed: true });
|
|
569
|
+
// Only the trash is a deletion; a 404 may be a page no longer shared, so its text is kept (owner, NEED-2803).
|
|
570
|
+
const gone = (id, deleted = false) => items.set(id, { id, removed: true, ...(deleted ? { gone: "deleted" } : {}) });
|
|
570
571
|
// The engine walks every folder it is sent, all its rows, so a database it already holds is not sent again.
|
|
571
572
|
const unheld = (file) => {
|
|
572
573
|
const before = known.get(file.id);
|
|
@@ -711,7 +712,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
711
712
|
return;
|
|
712
713
|
const file = await databaseFile(found);
|
|
713
714
|
if (file.trashed)
|
|
714
|
-
gone(task.id);
|
|
715
|
+
gone(task.id, true);
|
|
715
716
|
else {
|
|
716
717
|
unlisted(found);
|
|
717
718
|
if (unheld(file))
|
|
@@ -726,13 +727,15 @@ export const notionSource = (notion, options = {}) => {
|
|
|
726
727
|
while (task.ids.length) {
|
|
727
728
|
const file = known.get(task.ids[0]);
|
|
728
729
|
if (file) {
|
|
729
|
-
const listing = { files: [], gone: [], moved: [] };
|
|
730
|
+
const listing = { files: [], gone: [], trashed: [], moved: [] };
|
|
730
731
|
await confirm([file], task.container, listing);
|
|
731
732
|
for (const found of [...listing.files, ...listing.moved])
|
|
732
733
|
if (changedPage(found))
|
|
733
734
|
emit(found);
|
|
734
735
|
for (const id of listing.gone)
|
|
735
736
|
gone(id);
|
|
737
|
+
for (const id of listing.trashed)
|
|
738
|
+
gone(id, true);
|
|
736
739
|
}
|
|
737
740
|
task.ids.shift();
|
|
738
741
|
kept++;
|
|
@@ -753,7 +756,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
753
756
|
cursor.sources = cursor.sources.filter((item) => item.source !== task.source);
|
|
754
757
|
const database = await readDatabase(task.database);
|
|
755
758
|
if (isGone(database))
|
|
756
|
-
gone(task.database);
|
|
759
|
+
gone(task.database, typeof database === "object");
|
|
757
760
|
else if (typeof database === "object") {
|
|
758
761
|
unlisted(database);
|
|
759
762
|
const file = await databaseFile(database);
|
|
@@ -785,7 +788,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
785
788
|
return;
|
|
786
789
|
if (database === "gone" || database.in_trash) {
|
|
787
790
|
if (!roots.includes(id))
|
|
788
|
-
gone(id);
|
|
791
|
+
gone(id, database !== "gone");
|
|
789
792
|
return;
|
|
790
793
|
}
|
|
791
794
|
unlisted(database);
|
|
@@ -851,6 +854,8 @@ export const notionSource = (notion, options = {}) => {
|
|
|
851
854
|
}
|
|
852
855
|
for (const gid of listing.gone)
|
|
853
856
|
gone(gid);
|
|
857
|
+
for (const gid of listing.trashed)
|
|
858
|
+
gone(gid, true);
|
|
854
859
|
};
|
|
855
860
|
let done = 0;
|
|
856
861
|
timed = true;
|
|
@@ -924,6 +929,7 @@ export const notionSource = (notion, options = {}) => {
|
|
|
924
929
|
return { items: [...items.values()], cursor: encodeCursor(cursor) };
|
|
925
930
|
};
|
|
926
931
|
const authors = pagePeople(reads, warn, options.userAccess);
|
|
932
|
+
const discussionOf = pageComments(reads, warn);
|
|
927
933
|
const content = async (id, maxChars) => {
|
|
928
934
|
containers = new Map();
|
|
929
935
|
const page = await reads.retrievePage(id);
|
|
@@ -940,7 +946,10 @@ export const notionSource = (notion, options = {}) => {
|
|
|
940
946
|
});
|
|
941
947
|
});
|
|
942
948
|
const fields = frontMatter(page.properties);
|
|
943
|
-
const
|
|
949
|
+
const discussion = await discussionOf(id);
|
|
950
|
+
const searchable = [file.name, ...frontMatterLines(fields), body.markdown, discussion.text]
|
|
951
|
+
.filter(Boolean)
|
|
952
|
+
.join("\n\n");
|
|
944
953
|
if (maxChars !== undefined && searchable.length > maxChars)
|
|
945
954
|
throw new CliError("validation_error", "the page is longer than the text limit", {
|
|
946
955
|
reason: "source.text-limit",
|
|
@@ -954,25 +963,12 @@ export const notionSource = (notion, options = {}) => {
|
|
|
954
963
|
people: await authors.people(page),
|
|
955
964
|
authors: authors.access(),
|
|
956
965
|
...(body.missing ? { missingBlocks: body.missing } : {}),
|
|
966
|
+
comments: discussion.comments,
|
|
957
967
|
},
|
|
958
968
|
};
|
|
959
969
|
return { metadata, markdown: body.markdown, text: withoutSignedLinks(searchable).text, tabs: [] };
|
|
960
970
|
};
|
|
961
|
-
|
|
962
|
-
const identity = async () => {
|
|
963
|
-
const self = await reads.self();
|
|
964
|
-
if (!self.bot?.workspace_id)
|
|
965
|
-
throw new CliError("invalid_response", "Notion did not name the token's workspace", {
|
|
966
|
-
reason: "notion.no-workspace",
|
|
967
|
-
});
|
|
968
|
-
return `${self.bot.workspace_id}:${self.id}`;
|
|
969
|
-
};
|
|
970
|
-
return marking({
|
|
971
|
-
// One sync run asks once: the CLI checks the account before it takes the lock, and the engine asks again.
|
|
972
|
-
identity() {
|
|
973
|
-
account ??= identity();
|
|
974
|
-
return account;
|
|
975
|
-
},
|
|
971
|
+
return {
|
|
976
972
|
async metadata(id) {
|
|
977
973
|
fresh();
|
|
978
974
|
return retrieve(id, known.get(id)?.providerMetadata.kind);
|
|
@@ -1013,6 +1009,6 @@ export const notionSource = (notion, options = {}) => {
|
|
|
1013
1009
|
content,
|
|
1014
1010
|
// A page has no file of its own; its Markdown is the nearest thing to one.
|
|
1015
1011
|
bytes: async (id) => new TextEncoder().encode((await content(id)).markdown),
|
|
1016
|
-
}
|
|
1012
|
+
};
|
|
1017
1013
|
};
|
|
1018
1014
|
//# sourceMappingURL=source.js.map
|