yanki 0.2.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 (259) hide show
  1. package/dist/abap-DXFkqnOI.js +816 -0
  2. package/dist/actionscript-3-D6NljDpC.js +1 -0
  3. package/dist/ada-CowR2XfX.js +1 -0
  4. package/dist/andromeeda-YxQm0tCS.js +1 -0
  5. package/dist/angular-html-CZfDmWtJ.js +16 -0
  6. package/dist/angular-ts-CIhYrOL5.js +666 -0
  7. package/dist/apache-rS0jd3Ly.js +1 -0
  8. package/dist/apex-Sfo2eW0G.js +274 -0
  9. package/dist/apl-DPLNWaKG.js +87 -0
  10. package/dist/applescript-BXKAgOFh.js +38 -0
  11. package/dist/ara-CG4fK2Nq.js +21 -0
  12. package/dist/asciidoc-C539GviS.js +1 -0
  13. package/dist/asm-PWN5J14X.js +1 -0
  14. package/dist/astro-71xeBtnw.js +32 -0
  15. package/dist/aurora-x-BaWyeHV_.js +1 -0
  16. package/dist/awk-i0IPvypD.js +1 -0
  17. package/dist/ayu-dark-Bn5gmY5k.js +1 -0
  18. package/dist/ballerina-T9ysyp6P.js +62 -0
  19. package/dist/bat-BPiaQZfK.js +1 -0
  20. package/dist/beancount-Urb1RsFe.js +1 -0
  21. package/dist/berry-CxrokwfH.js +1 -0
  22. package/dist/bibtex-BaedD2tq.js +1 -0
  23. package/dist/bicep-3ghuYFLd.js +1 -0
  24. package/dist/bin/cli.js +10 -0
  25. package/dist/blade-D3A5GssZ.js +831 -0
  26. package/dist/c-RCJZWN-0.js +81 -0
  27. package/dist/cadence-Bgpqy2XC.js +1 -0
  28. package/dist/catppuccin-frappe-BsOrZxH8.js +1 -0
  29. package/dist/catppuccin-latte-BYdKNJ10.js +1 -0
  30. package/dist/catppuccin-macchiato-DVLwECkk.js +1 -0
  31. package/dist/catppuccin-mocha-CEfge3mM.js +1 -0
  32. package/dist/clarity-CIekO_uJ.js +1 -0
  33. package/dist/clojure-BF6G6X0H.js +1 -0
  34. package/dist/cmake-DXZpi2gR.js +1 -0
  35. package/dist/cobol-Bi0pgIzz.js +1 -0
  36. package/dist/codeowners-CGmujMTu.js +1 -0
  37. package/dist/codeql-BOpLLL-w.js +1 -0
  38. package/dist/coffee-Cp6Hkwsd.js +100 -0
  39. package/dist/common-lisp-C3qUB5O8.js +301 -0
  40. package/dist/cpp-CeZn6MzL.js +186 -0
  41. package/dist/crystal-B5pCH4eR.js +25 -0
  42. package/dist/csharp-DISxKEhY.js +756 -0
  43. package/dist/css-CbYhyuC0.js +505 -0
  44. package/dist/csv-B2DkETJQ.js +1 -0
  45. package/dist/cue-C6Aznpr-.js +1 -0
  46. package/dist/cypher-ByMv4Xf1.js +1 -0
  47. package/dist/d-PifQWv0n.js +1 -0
  48. package/dist/dark-plus-KEYLhlmT.js +1 -0
  49. package/dist/dart-DZLoTQm4.js +1 -0
  50. package/dist/dax-DsfXcHUZ.js +29 -0
  51. package/dist/desktop-D71BffLY.js +1 -0
  52. package/dist/diff-DvyTQcux.js +1 -0
  53. package/dist/docker-DNR26wTC.js +1 -0
  54. package/dist/dracula-DGO8GyiP.js +1 -0
  55. package/dist/dracula-soft-9B1nZgL-.js +1 -0
  56. package/dist/dream-maker-Eh5U-gDp.js +52 -0
  57. package/dist/elixir-Exce1dLy.js +17 -0
  58. package/dist/elm-D7CfdsEG.js +1 -0
  59. package/dist/emacs-lisp-51pKhIDe.js +5754 -0
  60. package/dist/erb-S7d1X-Y-.js +1 -0
  61. package/dist/erlang-DS9ZWoKD.js +1 -0
  62. package/dist/fennel-DuK7IM-L.js +1 -0
  63. package/dist/fish-DfeQjIbs.js +5 -0
  64. package/dist/fluent-KPqz0Sb3.js +1 -0
  65. package/dist/fortran-fixed-form-6v7-xzYY.js +1 -0
  66. package/dist/fortran-free-form-D6pmzCqS.js +1 -0
  67. package/dist/fsharp-JZjmD0Li.js +1 -0
  68. package/dist/gdresource-CFKM8Ske.js +1 -0
  69. package/dist/gdscript-CoEqzGFw.js +44 -0
  70. package/dist/gdshader-B_SUYfiV.js +1 -0
  71. package/dist/genie-DAfrLhwG.js +1 -0
  72. package/dist/gherkin-B0PjAhci.js +1 -0
  73. package/dist/git-commit-XY8bXq83.js +1 -0
  74. package/dist/git-rebase-BE3WlPTi.js +1 -0
  75. package/dist/github-dark-CzPA46E-.js +1 -0
  76. package/dist/github-dark-default-BXF7Vm5l.js +1 -0
  77. package/dist/github-dark-dimmed-CRDKj6ck.js +1 -0
  78. package/dist/github-light-CRlnGVMD.js +1 -0
  79. package/dist/github-light-default-UREJT2Bw.js +1 -0
  80. package/dist/gleam-Dd6f7Z5P.js +1 -0
  81. package/dist/glimmer-js-I0TZ3_O1.js +13 -0
  82. package/dist/glimmer-ts-CY38hlIb.js +13 -0
  83. package/dist/glsl-tOUOXML3.js +1 -0
  84. package/dist/gnuplot-nclm9rTJ.js +266 -0
  85. package/dist/go-BJn7Ek5W.js +1 -0
  86. package/dist/graphql-DwwLrXH1.js +4 -0
  87. package/dist/groovy-wChcbJ1V.js +37 -0
  88. package/dist/hack-DmjQSZc3.js +86 -0
  89. package/dist/haml-map1ik7u.js +1 -0
  90. package/dist/handlebars-CCc9qS91.js +1 -0
  91. package/dist/haskell-DOVD4hs_.js +559 -0
  92. package/dist/haxe-Dit6kIrv.js +11 -0
  93. package/dist/hcl-CpAANOdC.js +1 -0
  94. package/dist/hjson-DZqG9GXz.js +50 -0
  95. package/dist/hlsl-DmDrTTlz.js +1 -0
  96. package/dist/houston-CZZ6oYdA.js +1 -0
  97. package/dist/html-NmvpQUfQ.js +74 -0
  98. package/dist/html-derivative-QphQoco-.js +1 -0
  99. package/dist/http-B58UUte0.js +1 -0
  100. package/dist/hxml-4EC8aR1F.js +1 -0
  101. package/dist/hy-y-6HuL9l.js +3 -0
  102. package/dist/imba-CyaA9484.js +223 -0
  103. package/dist/index-UHZxbkBe.js +2 -0
  104. package/dist/ini-DeVv6D4_.js +1 -0
  105. package/dist/java-ClXEvkw9.js +68 -0
  106. package/dist/javascript-Dch3xQiY.js +699 -0
  107. package/dist/jinja-BrXMjE5a.js +1 -0
  108. package/dist/jison-DlEKeWyG.js +1 -0
  109. package/dist/json-CupVZNk8.js +25 -0
  110. package/dist/json5-Bh8mriwU.js +17 -0
  111. package/dist/jsonc-DYI1rfmx.js +25 -0
  112. package/dist/jsonl-BUpeXbsf.js +25 -0
  113. package/dist/jsonnet-C9d3aiqh.js +1 -0
  114. package/dist/jssm-Dble9ECP.js +1 -0
  115. package/dist/jsx-CsyrCbsw.js +699 -0
  116. package/dist/julia-jDzGJc6I.js +9 -0
  117. package/dist/kotlin-BIxS-Weu.js +1 -0
  118. package/dist/kusto-DGEpfOTx.js +1 -0
  119. package/dist/latex-bjPeSN-x.js +3 -0
  120. package/dist/less-Du6_OKDb.js +159 -0
  121. package/dist/lib/index.d.ts +1022 -0
  122. package/dist/lib/index.js +1 -0
  123. package/dist/light-plus-BsvsQ1iS.js +1 -0
  124. package/dist/liquid-DHpvaAyy.js +14 -0
  125. package/dist/log-Ksn5IXup.js +1 -0
  126. package/dist/logo-DdacRhvC.js +1 -0
  127. package/dist/lua-Cy9U1SwF.js +1 -0
  128. package/dist/make-B9S9BZZh.js +1 -0
  129. package/dist/markdown-BdfWgkoX.js +129 -0
  130. package/dist/marko-neMFgnTa.js +8 -0
  131. package/dist/material-theme-B2BuIiKK.js +1 -0
  132. package/dist/material-theme-darker-BrGg7AAd.js +1 -0
  133. package/dist/material-theme-lighter-DDRuGeQH.js +1 -0
  134. package/dist/material-theme-ocean-CBL0qBdF.js +1 -0
  135. package/dist/material-theme-palenight-D7gg1Usp.js +1 -0
  136. package/dist/matlab-Btshr8M_.js +70 -0
  137. package/dist/mdc-_-l14nii.js +76 -0
  138. package/dist/mdx-CBPJd_fO.js +1 -0
  139. package/dist/mermaid-Dkb1Nx48.js +1 -0
  140. package/dist/min-dark-iSbrOpM4.js +1 -0
  141. package/dist/min-light-BITGhEdf.js +1 -0
  142. package/dist/mojo--7WWnkdy.js +517 -0
  143. package/dist/monokai-sMI-pExk.js +1 -0
  144. package/dist/move-MN12aA4C.js +1 -0
  145. package/dist/narrat-B9CT-1u6.js +7 -0
  146. package/dist/nextflow-DBxHOdLe.js +1 -0
  147. package/dist/nginx-C3DmzmOp.js +1 -0
  148. package/dist/night-owl-BeocmOPF.js +1 -0
  149. package/dist/nim-BjhyiCLB.js +1 -0
  150. package/dist/nix-B7rNE5kf.js +1 -0
  151. package/dist/nord-CsyjKwr8.js +1 -0
  152. package/dist/nushell-CrgTADc5.js +1 -0
  153. package/dist/objective-c-DHmGyzbM.js +109 -0
  154. package/dist/objective-cpp-BWKJ1FCf.js +239 -0
  155. package/dist/ocaml-RqY_Nz63.js +1 -0
  156. package/dist/one-dark-pro-BTtaZsq5.js +1 -0
  157. package/dist/one-light-alpzPJ78.js +1 -0
  158. package/dist/pascal-B6ZnTe72.js +1 -0
  159. package/dist/perl-PZnu_VA7.js +1 -0
  160. package/dist/php-m9Z3qs_k.js +771 -0
  161. package/dist/plsql-BbJj1K1w.js +1 -0
  162. package/dist/po-HrnDn_2Q.js +1 -0
  163. package/dist/poimandres-Cda-MJFk.js +1 -0
  164. package/dist/postcss-DXT9h7v2.js +1 -0
  165. package/dist/powerquery-CApMHEaB.js +1 -0
  166. package/dist/powershell-9ZOzOPqN.js +1 -0
  167. package/dist/prisma-BBJYjQ0k.js +1 -0
  168. package/dist/prolog-BH_RS3WO.js +1 -0
  169. package/dist/proto-DOtRmeXT.js +1 -0
  170. package/dist/pug-jyQP1XtO.js +1 -0
  171. package/dist/puppet-37ic6j3l.js +1 -0
  172. package/dist/purescript-Bm5O5oLm.js +7 -0
  173. package/dist/python-DwuVtWc2.js +518 -0
  174. package/dist/qml-DM3j-f55.js +1 -0
  175. package/dist/qmldir-MS3qTAOR.js +1 -0
  176. package/dist/qss-FJDVp-XM.js +1 -0
  177. package/dist/r-BXfENWL6.js +1 -0
  178. package/dist/racket-BbLA0SU8.js +353 -0
  179. package/dist/raku-D384ylkT.js +1 -0
  180. package/dist/razor-DokJXJPk.js +40 -0
  181. package/dist/red-jaXbsbtS.js +1 -0
  182. package/dist/reg-CrhH3_Og.js +1 -0
  183. package/dist/regexp-C_ZPRiAj.js +26 -0
  184. package/dist/rel-BuawaRXJ.js +1 -0
  185. package/dist/riscv-D-aEEwJo.js +13 -0
  186. package/dist/rose-pine-BIAFg_EN.js +1 -0
  187. package/dist/rose-pine-dawn-C5m_N-6l.js +1 -0
  188. package/dist/rose-pine-moon-B9S0JTD1.js +1 -0
  189. package/dist/rst-DlAMacAQ.js +1 -0
  190. package/dist/ruby-eQ1iIi6H.js +80 -0
  191. package/dist/rust-DGxQkqYo.js +1 -0
  192. package/dist/sas-BhBoFsCt.js +1 -0
  193. package/dist/sass-CMDmr8et.js +2 -0
  194. package/dist/scala-Cd0cRMx9.js +5 -0
  195. package/dist/scheme-BTeww-4z.js +136 -0
  196. package/dist/scss-DoQ2ojfq.js +90 -0
  197. package/dist/shaderlab-Bb-6Dmi7.js +1 -0
  198. package/dist/shellscript-BZfs-ost.js +1 -0
  199. package/dist/shellsession-B6XH_PlG.js +1 -0
  200. package/dist/slack-dark-C7oZ9nno.js +1 -0
  201. package/dist/slack-ochin-hXH8Gyq8.js +1 -0
  202. package/dist/smalltalk-DSsji4Hu.js +1 -0
  203. package/dist/snazzy-light-CA9nliXM.js +1 -0
  204. package/dist/solarized-dark-C86elO-m.js +1 -0
  205. package/dist/solarized-light-xPNGhBYe.js +1 -0
  206. package/dist/solidity-CThH5sBG.js +1 -0
  207. package/dist/soy-rVg8SA9F.js +1 -0
  208. package/dist/sparql-Cmp61EUJ.js +1 -0
  209. package/dist/splunk-6XBPEST2.js +1 -0
  210. package/dist/sql-DxR2xW-a.js +21 -0
  211. package/dist/ssh-config-BH1M7C1g.js +1 -0
  212. package/dist/stata-DGeqZgIM.js +3 -0
  213. package/dist/stylus-DSrLtGYv.js +15 -0
  214. package/dist/svelte-BMtjZn0z.js +1 -0
  215. package/dist/swift-C8WrqfNz.js +544 -0
  216. package/dist/sync-DItkgf9b.js +303 -0
  217. package/dist/synthwave-84-BBDuFDsq.js +1 -0
  218. package/dist/system-verilog-BscxmKrE.js +8 -0
  219. package/dist/systemd-IQPSIA3x.js +1 -0
  220. package/dist/tasl-BxwAa5i0.js +1 -0
  221. package/dist/tcl-C_8Fx7bH.js +1 -0
  222. package/dist/terraform-DBeuZS66.js +1 -0
  223. package/dist/tex-BqVuN0dX.js +1 -0
  224. package/dist/tokyo-night-eJfcURhx.js +1 -0
  225. package/dist/toml-BT9ZzGyQ.js +69 -0
  226. package/dist/tsv-DnLUQrgA.js +1 -0
  227. package/dist/tsx-BlxWTfDV.js +699 -0
  228. package/dist/turtle-C15OxdQ5.js +1 -0
  229. package/dist/twig-DDlPLETn.js +40 -0
  230. package/dist/typescript-DC8MraHL.js +666 -0
  231. package/dist/typespec-Bx89rGXK.js +1 -0
  232. package/dist/typst-I4qd5QHW.js +10 -0
  233. package/dist/v-C2TBxDwV.js +1 -0
  234. package/dist/vala-CO5hpdkB.js +1 -0
  235. package/dist/vb-beD-FUib.js +1 -0
  236. package/dist/verilog-DVfdqzEq.js +1 -0
  237. package/dist/vesper-BSB_bK09.js +1 -0
  238. package/dist/vhdl-QZ3jNtnE.js +515 -0
  239. package/dist/viml-BLluXI4E.js +1 -0
  240. package/dist/vitesse-black-B3g-KkBK.js +1 -0
  241. package/dist/vitesse-dark-Bxkoe-BC.js +1 -0
  242. package/dist/vitesse-light-Br6ll-O0.js +1 -0
  243. package/dist/vue-B6Rs-4k4.js +6 -0
  244. package/dist/vue-html-Blw9Jzz9.js +1 -0
  245. package/dist/vyper-o-cPXEvd.js +575 -0
  246. package/dist/wasm-2oxoyaYy.js +1 -0
  247. package/dist/wasm-Cicx_DS6.js +1 -0
  248. package/dist/wenyan-Cavfe_d0.js +1 -0
  249. package/dist/wgsl-BZz1Hhek.js +1 -0
  250. package/dist/wikitext-zfUCmn4z.js +40 -0
  251. package/dist/wolfram-BICIrM8O.js +1 -0
  252. package/dist/xml-sp2Egr0Z.js +1 -0
  253. package/dist/xsl-BQYvujlj.js +1 -0
  254. package/dist/yaml-C5gCGmDW.js +200 -0
  255. package/dist/zenscript-B1nm99XP.js +2 -0
  256. package/dist/zig-xtV5iK4E.js +1 -0
  257. package/license.txt +21 -0
  258. package/package.json +109 -0
  259. package/readme.md +535 -0
@@ -0,0 +1,1022 @@
1
+ type CardBrowserColumns = 'answer' | 'cardDue' | 'cardEase' | 'cardIvl' | 'cardLapses' | 'cardMod' | 'cardReps' | 'deck' | 'note' | 'noteCrt' | 'noteFld' | 'noteMod' | 'noteTags' | 'question' | 'template' | ({} & string);
2
+ type CardValueKeys = 'data' | 'did' | 'due' | 'factor' | 'flags' | 'id' | 'ivl' | 'lapses' | 'left' | 'mod' | 'odid' | 'odue' | 'ord' | 'queue' | 'reps' | 'type' | 'usn';
3
+ type CardInfo = {
4
+ answer: string;
5
+ buttons?: number[];
6
+ cardId: number;
7
+ css: string;
8
+ deckName: string;
9
+ due: number;
10
+ fieldOrder: number;
11
+ fields: Record<string, {
12
+ order: number;
13
+ value: string;
14
+ }>;
15
+ interval: number;
16
+ lapses: number;
17
+ left: number;
18
+ mod: number;
19
+ modelName: string;
20
+ nextReviews: string[];
21
+ note: number;
22
+ ord: number;
23
+ question: string;
24
+ queue: number;
25
+ reps: number;
26
+ template: string;
27
+ type: number;
28
+ };
29
+ type CardRequests = Request<'cardsModTime', 6, {
30
+ cards: number[];
31
+ }, {
32
+ cardId: number;
33
+ mod: number;
34
+ }> | Request<'setSpecificValueOfCard', 6, {
35
+ card: number;
36
+ keys: CardValueKeys[];
37
+ newValues: string[];
38
+ }, boolean[]> | Request<'answerCards', 6, {
39
+ answers: Array<{
40
+ cardId: number;
41
+ ease: number;
42
+ }>;
43
+ }, boolean[]> | Request<'areDue', 6, {
44
+ cards: number[];
45
+ }, boolean[]> | Request<'areSuspended', 6, {
46
+ cards: number[];
47
+ }, Array<boolean | null>> | Request<'cardsInfo', 6, {
48
+ cards: number[];
49
+ }, CardInfo[]> | Request<'cardsToNotes', 6, {
50
+ cards: number[];
51
+ }, number[]> | Request<'findCards', 6, {
52
+ query: string;
53
+ }, number[]> | Request<'forgetCards', 6, {
54
+ cards: number[];
55
+ }> | Request<'getEaseFactors', 6, {
56
+ cards: number[];
57
+ }, number[]> | Request<'getIntervals', 6, {
58
+ cards: number[];
59
+ complete?: boolean;
60
+ }, number[] | number[][]> | Request<'relearnCards', 6, {
61
+ cards: number[];
62
+ }> | Request<'setEaseFactors', 6, {
63
+ cards: number[];
64
+ easeFactors: number[];
65
+ }, boolean[]> | Request<'suspend', 6, {
66
+ cards: number[];
67
+ }, boolean> | Request<'suspended', 6, {
68
+ card: number;
69
+ }, boolean> | Request<'unsuspend', 6, {
70
+ cards: number[];
71
+ }, boolean>;
72
+
73
+ type DeckStats = {
74
+ deck_id: number;
75
+ learn_count: number;
76
+ name: string;
77
+ new_count: number;
78
+ review_count: number;
79
+ total_in_deck: number;
80
+ };
81
+ type DeckConfig = {
82
+ autoplay: boolean;
83
+ dyn: boolean;
84
+ id: number;
85
+ lapse: {
86
+ delays: number[];
87
+ leechAction: number;
88
+ leechFails: number;
89
+ minInt: number;
90
+ mult: number;
91
+ };
92
+ maxTaken: number;
93
+ mod: number;
94
+ name: string;
95
+ new: {
96
+ bury: boolean;
97
+ delays: number[];
98
+ initialFactor: number;
99
+ ints: number[];
100
+ order: number;
101
+ perDay: number;
102
+ separate: boolean;
103
+ };
104
+ replayq: boolean;
105
+ rev: {
106
+ bury: boolean;
107
+ ease4: number;
108
+ fuzz: number;
109
+ ivlFct: number;
110
+ maxIvl: number;
111
+ minSpace: number;
112
+ perDay: number;
113
+ };
114
+ timer: number;
115
+ usn: number;
116
+ };
117
+ type DeckRequests = Request<'changeDeck', 6, {
118
+ cards: number[];
119
+ deck: string;
120
+ }> | Request<'cloneDeckConfigId', 6, {
121
+ cloneFrom: number;
122
+ name: string;
123
+ }, false | number> | Request<'createDeck', 6, {
124
+ deck: string;
125
+ }, Record<string, number>> | Request<'deckNames', 6, never, string[]> | Request<'deckNamesAndIds', 6, never, Record<string, number>> | Request<'deleteDecks', 6, {
126
+ cardsToo: true;
127
+ decks: string[];
128
+ }> | Request<'getDeckConfig', 6, {
129
+ deck: string;
130
+ }, DeckConfig> | Request<'getDeckStats', 6, {
131
+ decks: string[];
132
+ }, Record<string, DeckStats>> | Request<'getDecks', 6, Record<'cards', number[]>, Record<string, number[]>> | Request<'removeDeckConfigId', 6, {
133
+ configId: number;
134
+ }, boolean> | Request<'saveDeckConfig', 6, {
135
+ config: DeckConfig;
136
+ }, boolean> | Request<'setDeckConfigId', 6, {
137
+ configId: number;
138
+ decks: string[];
139
+ }, boolean>;
140
+
141
+ type NoteModel = 'Basic (and reversed card)' | 'Basic (type in the answer)' | 'Basic' | 'Cloze' | ({} & string);
142
+ type NoteMedia = {
143
+ fields: string[];
144
+ filename: string;
145
+ skipHash?: false;
146
+ url: string;
147
+ };
148
+ type Note = {
149
+ audio?: NoteMedia[];
150
+ deckName: string;
151
+ fields: Record<string, string>;
152
+ modelName: NoteModel;
153
+ picture?: NoteMedia[];
154
+ tags?: string[];
155
+ video?: NoteMedia[];
156
+ };
157
+ type NoteWithCreationOptions = {
158
+ options?: {
159
+ allowDuplicate?: boolean;
160
+ duplicateScope?: 'deck' | ({} & string);
161
+ duplicateScopeOptions?: {
162
+ checkAllModels?: boolean;
163
+ checkChildren?: boolean;
164
+ deckName?: null | string;
165
+ };
166
+ };
167
+ } & Note;
168
+ type NoteRequests = Request<'addTags', 6, {
169
+ notes: number[];
170
+ tags: string;
171
+ }> | Request<'canAddNotesWithErrorDetail', 6, {
172
+ notes: NoteWithCreationOptions[];
173
+ }, Array<{
174
+ canAdd: false;
175
+ error: string;
176
+ } | {
177
+ canAdd: true;
178
+ }>> | Request<'findNotes', 6, {
179
+ query: string;
180
+ }, number[]> | Request<'getNoteTags', 6, {
181
+ note: number;
182
+ }, string[]> | Request<'notesInfo', 6, {
183
+ notes: number[];
184
+ }, Array<{
185
+ cards: number[];
186
+ fields: Record<string, {
187
+ order: number;
188
+ value: string;
189
+ }>;
190
+ modelName: string;
191
+ noteId: number;
192
+ tags: string[];
193
+ }>> | Request<'removeTags', 6, {
194
+ notes: number[];
195
+ tags: string;
196
+ }> | Request<'replaceTags', 6, {
197
+ notes: number[];
198
+ replace_with_tag: string;
199
+ tag_to_replace: string;
200
+ }> | Request<'replaceTagsInAllNotes', 6, {
201
+ replace_with_tag: string;
202
+ tag_to_replace: string;
203
+ }> | Request<'updateNote', 6, {
204
+ note: {
205
+ audio?: NoteMedia[];
206
+ fields: Record<string, string>;
207
+ id: number;
208
+ picture?: NoteMedia[];
209
+ tags?: string[];
210
+ video?: NoteMedia[];
211
+ } | {
212
+ fields?: Record<string, string>;
213
+ id: number;
214
+ tags: string[];
215
+ };
216
+ }> | Request<'updateNoteFields', 6, {
217
+ note: {
218
+ audio?: NoteMedia[];
219
+ fields: Record<string, string>;
220
+ id: number;
221
+ picture?: NoteMedia[];
222
+ video?: NoteMedia[];
223
+ };
224
+ }> | Request<'updateNoteModel', 6, {
225
+ note: {
226
+ fields: Record<string, string>;
227
+ id: number;
228
+ modelName: string;
229
+ tags: string[];
230
+ };
231
+ }> | Request<'updateNoteTags', 6, {
232
+ note: number;
233
+ tags: string[];
234
+ }> | Request<'addNote', 6, {
235
+ note: NoteWithCreationOptions;
236
+ }, null | number> | Request<'addNotes', 6, {
237
+ notes: NoteWithCreationOptions[];
238
+ }, Array<null | string>> | Request<'canAddNotes', 6, {
239
+ notes: NoteWithCreationOptions[];
240
+ }, boolean[]> | Request<'clearUnusedTags', 6, never, string[]> | Request<'deleteNotes', 6, {
241
+ notes: number[];
242
+ }> | Request<'getTags', 6, never, string[]> | Request<'removeEmptyNotes', 6>;
243
+
244
+ type GraphicalRequests = Request<'guiBrowse', 6, {
245
+ query: string;
246
+ reorderCards?: {
247
+ columnId: CardBrowserColumns;
248
+ order: 'ascending' | 'descending';
249
+ };
250
+ }, number[]> | Request<'guiAddCards', 6, {
251
+ note: Note;
252
+ }, number> | Request<'guiAnswerCard', 6, {
253
+ ease: number;
254
+ }, boolean> | Request<'guiCheckDatabase', 6, never, true> | Request<'guiCurrentCard', 6, never, CardInfo | null> | Request<'guiDeckBrowser', 6> | Request<'guiDeckOverview', 6, {
255
+ name: string;
256
+ }, boolean> | Request<'guiDeckReview', 6, {
257
+ name: string;
258
+ }, boolean> | Request<'guiEditNote', 6, {
259
+ note: number;
260
+ }> | Request<'guiExitAnki', 6> | Request<'guiImportFile', 6, {
261
+ path: string;
262
+ }> | Request<'guiSelectNote', 6, {
263
+ note: number;
264
+ }, boolean> | Request<'guiSelectedNotes', 6, never, number[]> | Request<'guiShowAnswer', 6, never, boolean> | Request<'guiShowQuestion', 6, never, boolean> | Request<'guiStartCardTimer', 6, never, true> | Request<'guiUndo', 6, never, boolean>;
265
+
266
+ type MediaRequests = Request<'retrieveMediaFile', 6, {
267
+ filename: string;
268
+ }, false | string> | Request<'storeMediaFile', 6, {
269
+ data: string;
270
+ deleteExisting: boolean;
271
+ filename: string;
272
+ path: string;
273
+ url: string;
274
+ }, string> | Request<'deleteMediaFile', 6, {
275
+ filename: string;
276
+ }> | Request<'getMediaDirPath', 6, never, string> | Request<'getMediaFilesNames', 6, {
277
+ pattern: string;
278
+ }, string[]>;
279
+
280
+ type MiscellaneousRequests = Request<'apiReflect', 6, {
281
+ actions: null | string[];
282
+ scopes: Array<'actions'>;
283
+ }, {
284
+ actions: string[];
285
+ scopes: string[];
286
+ }> | Request<'exportPackage', 6, {
287
+ deck: string;
288
+ includeSched?: boolean;
289
+ path: string;
290
+ }, boolean> | Request<'importPackage', 6, {
291
+ path: string;
292
+ }, boolean> | Request<'multi', 6, // Crazy, have to call this experimental
293
+ {
294
+ actions: Array<{
295
+ action: Requests['action'];
296
+ params?: Requests['params'];
297
+ version?: number;
298
+ }>;
299
+ }, Array<{
300
+ error: null | string;
301
+ result: Requests['response'];
302
+ } | Requests['response']>> | Request<'requestPermission', 6, never, {
303
+ permission: 'denied';
304
+ } | {
305
+ permission: 'granted';
306
+ requireApiKey: boolean;
307
+ version: boolean;
308
+ }> | Request<'getProfiles', 6, never, string[]> | Request<'loadProfile', 6, {
309
+ name: string;
310
+ }, true> | Request<'reloadCollection', 6> | Request<'sync', 6> | Request<'version', 6, never, number>;
311
+
312
+ type ModelField = {
313
+ collapsed: boolean;
314
+ description: string;
315
+ excludeFromSearch: boolean;
316
+ font: string;
317
+ id: number;
318
+ name: string;
319
+ ord: number;
320
+ plainText: boolean;
321
+ preventDeletion: boolean;
322
+ rtl: boolean;
323
+ size: number;
324
+ sticky: boolean;
325
+ tag: null;
326
+ };
327
+ type ModelTemplate = {
328
+ afmt: string;
329
+ bafmt: string;
330
+ bfont: string;
331
+ bqfmt: string;
332
+ bsize: number;
333
+ did: null;
334
+ id: number;
335
+ name: string;
336
+ ord: number;
337
+ qfmt: string;
338
+ };
339
+ type Model = {
340
+ css: string;
341
+ did: null;
342
+ flds: ModelField[];
343
+ id: number;
344
+ latexPost: string;
345
+ latexPre: string;
346
+ latexsvg: boolean;
347
+ mod: number;
348
+ name: string;
349
+ originalStockKind: number;
350
+ req: Array<[number, string, number[]]>;
351
+ sortf: number;
352
+ tmpls: ModelTemplate[];
353
+ type: number;
354
+ usn: number;
355
+ };
356
+ type ModelToCreate = {
357
+ cardTemplates: Array<{
358
+ [key: string]: string;
359
+ Back: string;
360
+ Front: string;
361
+ }>;
362
+ css?: string;
363
+ inOrderFields: string[];
364
+ isCloze?: boolean;
365
+ modelName: string;
366
+ };
367
+ type ModelRequests = Request<'findAndReplaceInModels', 6, {
368
+ model: {
369
+ back: boolean;
370
+ css: boolean;
371
+ fieldText: string;
372
+ front: boolean;
373
+ modelName: string;
374
+ replaceText: string;
375
+ };
376
+ }, number> | Request<'modelFieldDescriptions', 6, {
377
+ description: string;
378
+ fieldName: string;
379
+ modelName: string;
380
+ }, boolean> | Request<'modelFieldFonts', 6, {
381
+ modelName: string;
382
+ }, Record<string, {
383
+ font: string;
384
+ size: number;
385
+ }>> | Request<'modelFieldRename', 6, {
386
+ modelName: string;
387
+ newFieldName: string;
388
+ oldFieldName: string;
389
+ }> | Request<'modelFieldsOnTemplates', 6, {
390
+ modelName: string;
391
+ }, Record<string, [string[], string[]]>> | Request<'modelTemplateAdd', 6, {
392
+ modelName: string;
393
+ template: {
394
+ [key: string]: string;
395
+ Back: string;
396
+ Front: string;
397
+ };
398
+ }> | Request<'modelTemplateRemove', 6, {
399
+ modelName: string;
400
+ templateName: string;
401
+ }> | Request<'modelTemplateRename', 6, {
402
+ modelName: string;
403
+ newTemplateName: string;
404
+ oldTemplateName: string;
405
+ }> | Request<'modelTemplateReposition', 6, {
406
+ index: number;
407
+ modelName: string;
408
+ templateName: string;
409
+ }> | Request<'modelTemplates', 6, {
410
+ modelName: string;
411
+ }, Record<string, {
412
+ [key: string]: string;
413
+ Back: string;
414
+ Front: string;
415
+ }>> | Request<'updateModelStyling', 6, {
416
+ model: {
417
+ css: string;
418
+ name: string;
419
+ };
420
+ }> | Request<'updateModelTemplates', 6, {
421
+ model: {
422
+ name: string;
423
+ templates: Record<string, {
424
+ Back?: string;
425
+ Front?: string;
426
+ }>;
427
+ };
428
+ }> | Request<'createModel', 6, ModelToCreate, Model> | Request<'findModelsById', 6, {
429
+ modelIds: number[];
430
+ }, Model[]> | Request<'findModelsByName', 6, {
431
+ modelNames: string[];
432
+ }, Model[]> | Request<'modelFieldAdd', 6, {
433
+ fieldName: string;
434
+ index: number;
435
+ modelName: string;
436
+ }> | Request<'modelFieldNames', 6, {
437
+ modelName: string;
438
+ }, string[]> | Request<'modelFieldRemove', 6, {
439
+ fieldName: string;
440
+ modelName: string;
441
+ }> | Request<'modelFieldReposition', 6, {
442
+ fieldName: string;
443
+ index: number;
444
+ modelName: string;
445
+ }> | Request<'modelFieldSetDescription', 6, {
446
+ fieldName: string;
447
+ index: number;
448
+ modelName: string;
449
+ }> | Request<'modelFieldSetFont', 6, {
450
+ fieldName: string;
451
+ font: string;
452
+ modelName: string;
453
+ }> | Request<'modelFieldSetFontSize', 6, {
454
+ fieldName: string;
455
+ fontSize: number;
456
+ modelName: string;
457
+ }> | Request<'modelNames', 6, never, string[]> | Request<'modelNamesAndIds', 6, never, Record<string, number>> | Request<'modelStyling', 6, {
458
+ modelName: string;
459
+ }, {
460
+ css: string;
461
+ }>;
462
+
463
+ /**
464
+ * Abstract wrapper over an Anki Connect action / response
465
+ */
466
+ type Request<Action extends string, Version extends AnkiConnectVersion, Params = never, Result = null> = {
467
+ action: Action;
468
+ params: Params;
469
+ response: {
470
+ error: null | string;
471
+ result: Result;
472
+ };
473
+ version: Version;
474
+ };
475
+ /**
476
+ * Requests
477
+ */
478
+ type Requests = CardRequests | DeckRequests | GraphicalRequests | MediaRequests | MiscellaneousRequests | ModelRequests | NoteRequests | StatisticRequests;
479
+ type AnkiConnectVersion = 6;
480
+ type ParamsForAction<T extends Requests['action']> = Extract<Requests, {
481
+ action: T;
482
+ }>['params'];
483
+
484
+ type ReviewStatisticTuple = [
485
+ reviewTime: number,
486
+ cardID: number,
487
+ usn: number,
488
+ buttonPressed: number,
489
+ newInterval: number,
490
+ previousInterval: number,
491
+ newFactor: number,
492
+ reviewDuration: number,
493
+ reviewType: number
494
+ ];
495
+ type StatisticRequests = Request<'cardReviews', 6, {
496
+ deck: string;
497
+ startID: number;
498
+ }, ReviewStatisticTuple[]> | Request<'getReviewsOfCards', 6, {
499
+ cards: string[];
500
+ }, Record<string, Array<{
501
+ /** ButtonPressed */
502
+ ease: number;
503
+ /** NewFactor */
504
+ factor: number;
505
+ /** ReviewTime */
506
+ id: number;
507
+ /** NewInterval */
508
+ ivl: number;
509
+ /** PreviousInterval */
510
+ lastIvl: number;
511
+ /** ReviewDuration */
512
+ time: number;
513
+ /** ReviewType */
514
+ type: number;
515
+ /** Usn */
516
+ usn: number;
517
+ }>>> | Request<'getCollectionStatsHTML', 6, {
518
+ wholeCollection: boolean;
519
+ }, string> | Request<'getLatestReviewID', 6, {
520
+ deck: string;
521
+ }, number> | Request<'getNumCardsReviewedByDay', 6, never, Array<[string, number]>> | Request<'getNumCardsReviewedToday', 6, never, number> | Request<'insertReviews', 6, {
522
+ reviews: ReviewStatisticTuple[];
523
+ }>;
524
+
525
+ /**
526
+ * Subset of built-in Fetch interface that's actually used by Anki, for ease of
527
+ * external re-implementation when passing a custom fetch function to
528
+ * YankiClient.
529
+ */
530
+ type YankiFetch = (input: string, init: {
531
+ body: string;
532
+ headers: Record<string, string>;
533
+ method: string;
534
+ mode: RequestMode;
535
+ }) => Promise<{
536
+ json(): Promise<any>;
537
+ status: number;
538
+ } | undefined>;
539
+ /** Optional options to pass when instantiating a new YankiConnect instance. */
540
+ type YankiConnectOptions = {
541
+ /**
542
+ * Attempt to open the desktop Anki.app if it's not already running.
543
+ *
544
+ * - `true` will always attempt to open Anki _when a request is made_. This
545
+ * might introduce significant latency on the first launch.
546
+ * - `false` will never attempt to open Anki. Requests will fail until
547
+ * something or someone else opens the Anki app.
548
+ * - `immediately` is a special option that will open Anki when the client is
549
+ * instantiated.
550
+ *
551
+ * The Anki desktop app must be running for the client and the underlying
552
+ * AnkiConnect service to work.
553
+ *
554
+ * Currently supported on macOS only.
555
+ *
556
+ * The client does not attempt to close the app.
557
+ *
558
+ * @default false
559
+ */
560
+ autoLaunch: 'immediately' | boolean;
561
+ /**
562
+ * Advanced option to customize the resource fetch implementation used to make requests to Anki-Connect.
563
+ *
564
+ * Note that the signature reflects the subset of the built-in Fetch interface that's actually used by yanki-connect.
565
+ *
566
+ * The exact signature of this option is subject to change in the future.
567
+ *
568
+ * @default fetch
569
+ */
570
+ customFetch: YankiFetch | undefined;
571
+ /**
572
+ * Host where the Anki-Connect service is running.
573
+ *
574
+ * @default 'http://127.0.0.1'
575
+ */
576
+ host: string;
577
+ /**
578
+ * Anki-Connect security key (optional)
579
+ *
580
+ * @default undefined
581
+ */
582
+ key: string | undefined;
583
+ /**
584
+ * Port where the Anki-Connect service is running.
585
+ *
586
+ * @default 8765
587
+ */
588
+ port: number;
589
+ /**
590
+ * Anki-Connect API version.
591
+ *
592
+ * Only API version 6 is supported for now.
593
+ *
594
+ * @default 6
595
+ */
596
+ version: AnkiConnectVersion;
597
+ };
598
+
599
+ declare const yankiModels: [{
600
+ readonly cardTemplates: [{
601
+ readonly Back: "{{FrontSide}}\n\n<hr id=answer>\n\n{{Back}}";
602
+ readonly Front: "{{Front}}";
603
+ readonly YankiNamespace: "{{YankiNamespace}}";
604
+ }];
605
+ readonly inOrderFields: ["Front", "Back", "YankiNamespace"];
606
+ readonly modelName: "Yanki - Basic";
607
+ }, {
608
+ readonly cardTemplates: [{
609
+ readonly Back: "{{FrontSide}}\n\n<hr id=answer>\n\n{{Back}}";
610
+ readonly Front: "{{Front}}";
611
+ readonly YankiNamespace: "{{YankiNamespace}}";
612
+ }, {
613
+ readonly Back: "{{FrontSide}}\n\n<hr id=answer>\n\n{{Front}}";
614
+ readonly Front: "{{Back}}";
615
+ readonly YankiNamespace: "{{YankiNamespace}}";
616
+ }];
617
+ readonly inOrderFields: ["Front", "Back", "YankiNamespace"];
618
+ readonly modelName: "Yanki - Basic (and reversed card)";
619
+ }, {
620
+ readonly cardTemplates: [{
621
+ readonly Back: "{{cloze:Front}}<br>\n{{Back}}";
622
+ readonly Front: "{{cloze:Front}}";
623
+ readonly YankiNamespace: "{{YankiNamespace}}";
624
+ }];
625
+ readonly inOrderFields: ["Front", "Back", "YankiNamespace"];
626
+ readonly isCloze: true;
627
+ readonly modelName: "Yanki - Cloze";
628
+ }, {
629
+ readonly cardTemplates: [{
630
+ readonly Back: "{{Front}}\n\n<hr id=answer>\n\n{{type:Back}}";
631
+ readonly Front: "{{Front}}\n\n{{type:Back}}";
632
+ readonly YankiNamespace: "{{YankiNamespace}}";
633
+ }];
634
+ readonly inOrderFields: ["Front", "Back", "YankiNamespace"];
635
+ readonly modelName: "Yanki - Basic (type in the answer)";
636
+ }];
637
+ type YankiModelName = (typeof yankiModels)[number]['modelName'];
638
+
639
+ /**
640
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
641
+
642
+ @category Type
643
+ */
644
+ type Primitive =
645
+ | null
646
+ | undefined
647
+ | string
648
+ | number
649
+ | boolean
650
+ | symbol
651
+ | bigint;
652
+
653
+ declare global {
654
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
655
+ interface SymbolConstructor {
656
+ readonly observable: symbol;
657
+ }
658
+ }
659
+
660
+ /**
661
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
662
+
663
+ @example
664
+ ```
665
+ import type {Simplify} from 'type-fest';
666
+
667
+ type PositionProps = {
668
+ top: number;
669
+ left: number;
670
+ };
671
+
672
+ type SizeProps = {
673
+ width: number;
674
+ height: number;
675
+ };
676
+
677
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
678
+ type Props = Simplify<PositionProps & SizeProps>;
679
+ ```
680
+
681
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
682
+
683
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
684
+
685
+ @example
686
+ ```
687
+ import type {Simplify} from 'type-fest';
688
+
689
+ interface SomeInterface {
690
+ foo: number;
691
+ bar?: string;
692
+ baz: number | undefined;
693
+ }
694
+
695
+ type SomeType = {
696
+ foo: number;
697
+ bar?: string;
698
+ baz: number | undefined;
699
+ };
700
+
701
+ const literal = {foo: 123, bar: 'hello', baz: 456};
702
+ const someType: SomeType = literal;
703
+ const someInterface: SomeInterface = literal;
704
+
705
+ function fn(object: Record<string, unknown>): void {}
706
+
707
+ fn(literal); // Good: literal object type is sealed
708
+ fn(someType); // Good: type is sealed
709
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
710
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
711
+ ```
712
+
713
+ @link https://github.com/microsoft/TypeScript/issues/15300
714
+ @see SimplifyDeep
715
+ @category Object
716
+ */
717
+ type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
718
+
719
+ /**
720
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
721
+ */
722
+ type BuiltIns = Primitive | void | Date | RegExp;
723
+
724
+ /**
725
+ @see PartialDeep
726
+ */
727
+ type PartialDeepOptions = {
728
+ /**
729
+ Whether to affect the individual elements of arrays and tuples.
730
+
731
+ @default false
732
+ */
733
+ readonly recurseIntoArrays?: boolean;
734
+ };
735
+
736
+ /**
737
+ Create a type from another type with all keys and nested keys set to optional.
738
+
739
+ Use-cases:
740
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
741
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
742
+
743
+ @example
744
+ ```
745
+ import type {PartialDeep} from 'type-fest';
746
+
747
+ const settings: Settings = {
748
+ textEditor: {
749
+ fontSize: 14;
750
+ fontColor: '#000000';
751
+ fontWeight: 400;
752
+ }
753
+ autocomplete: false;
754
+ autosave: true;
755
+ };
756
+
757
+ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
758
+ return {...settings, ...savedSettings};
759
+ }
760
+
761
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
762
+ ```
763
+
764
+ By default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:
765
+
766
+ ```
767
+ import type {PartialDeep} from 'type-fest';
768
+
769
+ interface Settings {
770
+ languages: string[];
771
+ }
772
+
773
+ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
774
+ languages: [undefined]
775
+ };
776
+ ```
777
+
778
+ @category Object
779
+ @category Array
780
+ @category Set
781
+ @category Map
782
+ */
783
+ type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends BuiltIns | (((...arguments_: any[]) => unknown)) | (new (...arguments_: any[]) => unknown)
784
+ ? T
785
+ : T extends Map<infer KeyType, infer ValueType>
786
+ ? PartialMapDeep<KeyType, ValueType, Options>
787
+ : T extends Set<infer ItemType>
788
+ ? PartialSetDeep<ItemType, Options>
789
+ : T extends ReadonlyMap<infer KeyType, infer ValueType>
790
+ ? PartialReadonlyMapDeep<KeyType, ValueType, Options>
791
+ : T extends ReadonlySet<infer ItemType>
792
+ ? PartialReadonlySetDeep<ItemType, Options>
793
+ : T extends object
794
+ ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
795
+ ? Options['recurseIntoArrays'] extends true
796
+ ? ItemType[] extends T // Test for arrays (non-tuples) specifically
797
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
798
+ ? ReadonlyArray<PartialDeep<ItemType | undefined, Options>>
799
+ : Array<PartialDeep<ItemType | undefined, Options>>
800
+ : PartialObjectDeep<T, Options> // Tuples behave properly
801
+ : T // If they don't opt into array testing, just use the original type
802
+ : PartialObjectDeep<T, Options>
803
+ : unknown;
804
+
805
+ /**
806
+ Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
807
+ */
808
+ type PartialMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> = {} & Map<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>>;
809
+
810
+ /**
811
+ Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
812
+ */
813
+ type PartialSetDeep<T, Options extends PartialDeepOptions> = {} & Set<PartialDeep<T, Options>>;
814
+
815
+ /**
816
+ Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
817
+ */
818
+ type PartialReadonlyMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> = {} & ReadonlyMap<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>>;
819
+
820
+ /**
821
+ Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
822
+ */
823
+ type PartialReadonlySetDeep<T, Options extends PartialDeepOptions> = {} & ReadonlySet<PartialDeep<T, Options>>;
824
+
825
+ /**
826
+ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
827
+ */
828
+ type PartialObjectDeep<ObjectType extends object, Options extends PartialDeepOptions> = {
829
+ [KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType], Options>
830
+ };
831
+
832
+ type YankiNote = Simplify<{
833
+ cards?: number[];
834
+ fields: {
835
+ Back: string;
836
+ Front: string;
837
+ YankiNamespace: string;
838
+ };
839
+ modelName: YankiModelName;
840
+ noteId: number | undefined;
841
+ } & Omit<ParamsForAction<'addNote'>['note'], 'fields' | 'modelName' | 'options'>>;
842
+
843
+ declare const defaultCleanOptions: CleanOptions;
844
+ type CleanOptions = {
845
+ ankiConnectOptions: YankiConnectOptions;
846
+ /**
847
+ * Automatically sync any changes to AnkiWeb after Yanki has finished syncing
848
+ * locally. If false, only local Anki data is updated and you must manually
849
+ * invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync"
850
+ * button in the Anki app.
851
+ */
852
+ ankiWeb: boolean;
853
+ dryRun: boolean;
854
+ namespace: string;
855
+ };
856
+ type CleanReport = {
857
+ ankiWeb: boolean;
858
+ decks: string[];
859
+ deleted: YankiNote[];
860
+ dryRun: boolean;
861
+ duration: number;
862
+ namespace: string;
863
+ };
864
+ /**
865
+ * Deletes all remote notes in Anki associated with the given namespace.
866
+ *
867
+ * Use with significant caution. Mostly useful for testing.
868
+ *
869
+ * @returns The IDs of the notes that were deleted
870
+ * @param options
871
+ * @throws
872
+ */
873
+ declare function cleanNotes(options?: PartialDeep<CleanOptions>): Promise<CleanReport>;
874
+ declare function formatCleanReport(report: CleanReport, verbose?: boolean): string;
875
+
876
+ type ListOptions = {
877
+ ankiConnectOptions: YankiConnectOptions;
878
+ namespace: string;
879
+ };
880
+ declare const defaultListOptions: ListOptions;
881
+ type ListReport = {
882
+ duration: number;
883
+ namespace: string;
884
+ notes: YankiNote[];
885
+ };
886
+ /**
887
+ * Description List notes...
888
+ * @param options
889
+ * @returns
890
+ */
891
+ declare function listNotes(options?: PartialDeep<ListOptions>): Promise<ListReport>;
892
+ declare function formatListReport(report: ListReport): string;
893
+
894
+ type StyleOptions = {
895
+ ankiConnectOptions: YankiConnectOptions;
896
+ /**
897
+ * Automatically sync any changes to AnkiWeb after Yanki has finished syncing
898
+ * locally. If false, only local Anki data is updated and you must manually
899
+ * invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync"
900
+ * button in the Anki app.
901
+ */
902
+ ankiWeb: boolean;
903
+ css: string;
904
+ dryRun: boolean;
905
+ };
906
+ declare const defaultStyleOptions: StyleOptions;
907
+ type StyleReport = {
908
+ ankiWeb: boolean;
909
+ dryRun: boolean;
910
+ duration: number;
911
+ models: Array<{
912
+ action: 'unchanged' | 'updated';
913
+ name: string;
914
+ }>;
915
+ };
916
+ declare function setStyle(options: PartialDeep<StyleOptions>): Promise<StyleReport>;
917
+ declare function formatStyleReport(report: StyleReport, verbose?: boolean): string;
918
+
919
+ type SyncedNote = {
920
+ action: 'created' | 'deleted' | 'recreated' | 'unchanged' | 'updated';
921
+ filePath?: string;
922
+ note: YankiNote;
923
+ };
924
+ type SyncOptions = {
925
+ ankiConnectOptions: YankiConnectOptions;
926
+ /**
927
+ * Automatically sync any changes to AnkiWeb after Yanki has finished syncing
928
+ * locally. If false, only local Anki data is updated and you must manually
929
+ * invoke a sync to AnkiWeb. This is the equivalent of pushing the "sync"
930
+ * button in the Anki app.
931
+ */
932
+ ankiWeb: boolean;
933
+ defaultDeckName: string;
934
+ dryRun: boolean;
935
+ namespace: string;
936
+ /** Ensures that wiki-style links work correctly */
937
+ obsidianVault: string | undefined;
938
+ };
939
+ declare const defaultSyncOptions: SyncOptions;
940
+ type SyncReport = {
941
+ ankiWeb: boolean;
942
+ deletedDecks: string[];
943
+ dryRun: boolean;
944
+ duration: number;
945
+ namespace: string;
946
+ synced: SyncedNote[];
947
+ };
948
+ /**
949
+ * Syncs local notes to Anki.
950
+ *
951
+ * @param allLocalNotes All the YankiNotes to sync
952
+ * @returns The synced notes (with new IDs where applicable), plus some stats
953
+ * about the sync @throws
954
+ */
955
+ declare function syncNotes(allLocalNotes: YankiNote[], options?: PartialDeep<SyncOptions>): Promise<SyncReport>;
956
+ /**
957
+ * Sync a list of local yanki files to Anki.
958
+ *
959
+ * Wraps the syncNotes function to handle file I/O.
960
+ *
961
+ * Most importantly, it updates the note IDs in the frontmatter of the local
962
+ * files.
963
+ *
964
+ * @param allLocalFilePaths Array of paths to the local markdown files
965
+ * @returns The synced files (with new IDs where applicable), plus some stats
966
+ * about the sync @throws
967
+ */
968
+ declare function syncFiles(allLocalFilePaths: string[], options?: PartialDeep<SyncOptions>, readFile?: (filePath: string) => Promise<string>, writeFile?: (filePath: string, data: string) => Promise<void>): Promise<SyncReport>;
969
+ /**
970
+ * Helper function to infer deck names from file paths if `deckName` not defined in the note's frontmatter.
971
+ *
972
+ * `deckName` will always override the inferred deck name.
973
+ *
974
+ * Depends on the context of _all_ file paths passed to `syncNoteFiles`.
975
+ *
976
+ * Example of paths -> deck names with `common-root`:
977
+ * /base/foo/note.md -> foo
978
+ * /base/foo/baz/note.md -> foo::baz
979
+ *
980
+ * Example of paths -> deck names with `common-root`:
981
+ * /base/foo/note.md -> foo
982
+ * /base/foo/note.md -> foo
983
+ *
984
+ * Example of paths -> deck names with `common-parent`:
985
+ * /base/foo/note.md -> base::foo
986
+ * /base/foo/baz/note.md -> base::foo::baz
987
+ *
988
+ * Example of paths -> deck names with `common-parent`:
989
+ * /base/foo/note.md -> foo
990
+ * /base/foo/note.md -> foo
991
+ *
992
+ * @param absoluteFilePaths Absolute paths to all markdown Anki note files. (Ensures proper resolution if path module is polyfilled.)
993
+ * @param prune If true, deck names are not allowed to "jump" over empty directories, even if there are other note files somewhere up the hierarchy
994
+ * @returns array of ::-delimited deck paths
995
+ */
996
+ declare function getDeckNamesFromFilePaths(absoluteFilePaths: string[], mode?: 'common-parent' | 'common-root'): string[];
997
+ declare function formatSyncReport(report: SyncReport, verbose?: boolean): string;
998
+
999
+ /**
1000
+ * Helpers for working with the Markdown AST.
1001
+ */
1002
+
1003
+ type AstFromMarkdownOptions = {
1004
+ obsidianVault?: string;
1005
+ };
1006
+
1007
+ /**
1008
+ * Turns a markdown string into a YankiNote object.
1009
+ */
1010
+
1011
+ type NoteFromMarkdownOptions = {
1012
+ namespace: string;
1013
+ } & AstFromMarkdownOptions;
1014
+ declare function getNoteFromMarkdown(markdown: string, options: NoteFromMarkdownOptions): Promise<YankiNote>;
1015
+
1016
+ declare function urlToHostAndPort(url: string): {
1017
+ host: string;
1018
+ port: number;
1019
+ };
1020
+ declare function hostAndPortToUrl(host: string, port: number): string;
1021
+
1022
+ export { type CleanOptions, type CleanReport, type ListOptions, type StyleOptions, type StyleReport, type SyncOptions, type SyncReport, type YankiNote, cleanNotes, defaultCleanOptions, defaultListOptions, defaultStyleOptions, defaultSyncOptions, formatCleanReport, formatListReport, formatStyleReport, formatSyncReport, getDeckNamesFromFilePaths, getNoteFromMarkdown, hostAndPortToUrl, listNotes, setStyle, syncFiles, syncNotes, urlToHostAndPort };